H3D API  2.4.1
X3DKeyDeviceSensorNode.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __X3DKEYDEVICESENSORNODE_H__
30 #define __X3DKEYDEVICESENSORNODE_H__
31 
32 #include <H3D/X3DSensorNode.h>
33 #include <list>
34 #include <GL/glew.h>
35 
36 namespace H3D {
37 
43  class H3DAPI_API X3DKeyDeviceSensorNode : public X3DSensorNode {
44  public:
45 
46  typedef enum {
47  F1 = 1,
48  F2 = 2,
49  F3 = 3,
50  F4 = 4,
51  F5 = 5,
52  F6 = 6,
53  F7 = 7,
54  F8 = 8,
55  F9 = 9,
56  F10 = 10,
57  F11 = 11,
58  F12 = 12,
59  HOME = 13,
60  END = 14,
61  PGUP = 15,
62  PGDN = 16,
63  UP = 17,
64  DOWN = 18,
65  LEFT = 19,
66  RIGHT = 20,
67  ALT = 21,
68  CONTROL = 22,
69  SHIFT = 23
70  } ActionKeys;
71 
73  X3DKeyDeviceSensorNode( Inst< SFBool > _enabled = 0,
74  Inst< SFNode > _metadata = 0,
75  Inst< SFBool > _isActive = 0 );
78 
83  virtual void keyboardDown( int key, bool special_key ) = 0;
84 
89  virtual void keyboardUp( int key, bool special_key ) = 0;
90 
93  static void keyboardDownCallback( unsigned char key );
94 
96  static void keyboardSpecialDownCallback( int key );
97 
100  static void keyboardUpCallback( unsigned char key );
101 
103  static void keyboardSpecialUpCallback( int key );
104 
105  private:
107  static list< X3DKeyDeviceSensorNode * > instances;
108  };
109 }
110 
111 #endif
Header file for X3DSensorNode, X3D scene-graph node.
This abstract node type is the base type for all sensor node types which operate using key devices.
Definition: X3DKeyDeviceSensorNode.h:43
virtual void keyboardUp(int key, bool special_key)=0
Virtual function called when a key is released.
virtual void keyboardDown(int key, bool special_key)=0
Virtual function called when a key is pressed.
This abstract node type is the base type for all sensors.
Definition: X3DSensorNode.h:40
H3D API namespace.
Definition: Anchor.h:38