11 #include <osg/ref_ptr>
13 #include <osg/GraphicsContext>
16 enum { MOUSE_BUTTON_LEFT,
20 enum { MOUSE_BUTTON_DOWN,
23 enum { MOUSE_CURSOR_NONE,
26 MOUSE_CURSOR_CROSSHAIR,
27 MOUSE_CURSOR_LEFTRIGHT,
29 MOUSE_CURSOR_BOTTOMSIDE,
30 MOUSE_CURSOR_LEFTSIDE,
31 MOUSE_CURSOR_RIGHTSIDE,
33 MOUSE_CURSOR_TOPRIGHT,
34 MOUSE_CURSOR_BOTTOMLEFT,
35 MOUSE_CURSOR_BOTTOMRIGHT,
38 enum { KEYMOD_NONE = 0,
39 KEYMOD_RELEASED = 1, // Not a mod key, indicates "up" action
48 // A note on key codes: none are defined here. FlightGear has no
49 // hard-coded interpretations of codes other than modifier keys, so we
50 // can get away with that. The only firm requirement is that the
51 // codes passed to the fgKeyHandler function be correctly interpreted
52 // by the PUI library. Users who need to hard-code key codes
53 // (probably not a good idea in any case) can use the pu.hxx header
57 // OS integration functions
60 void fgOSInit(int* argc, char** argv);
61 void fgOSOpenWindow(bool stencil);
62 void fgOSFullScreen();
64 void fgOSExit(int code);
66 void fgSetMouseCursor(int cursor);
67 int fgGetMouseCursor();
68 void fgWarpMouse(int x, int y);
70 int fgGetKeyModifiers();
73 // Callbacks and registration API
76 namespace osg { class Camera; class GraphicsContext; }
77 namespace osgGA { class GUIEventAdapter; }
79 typedef void (*fgIdleHandler)();
80 typedef void (*fgDrawHandler)();
81 typedef void (*fgWindowResizeHandler)(int w, int h);
83 typedef void (*fgKeyHandler)(int key, int keymod, int mousex, int mousey);
84 typedef void (*fgMouseClickHandler)(int button, int updown, int x, int y, bool mainWindow, const osgGA::GUIEventAdapter*);
85 typedef void (*fgMouseMotionHandler)(int x, int y);
87 void fgRegisterIdleHandler(fgIdleHandler func);
88 void fgRegisterDrawHandler(fgDrawHandler func);
89 void fgRegisterWindowResizeHandler(fgWindowResizeHandler func);
91 void fgRegisterKeyHandler(fgKeyHandler func);
92 void fgRegisterMouseClickHandler(fgMouseClickHandler func);
93 void fgRegisterMouseMotionHandler(fgMouseMotionHandler func);