4 // Plib pui needs to know at compile time what toolkit is in use.
5 // Change this when we move to something other than glut.
6 // #define PU_USE_GLUT -- moved to configure.ac -- EMH
12 enum { MOUSE_BUTTON_LEFT,
16 enum { MOUSE_BUTTON_DOWN,
19 enum { MOUSE_CURSOR_NONE,
22 MOUSE_CURSOR_CROSSHAIR,
23 MOUSE_CURSOR_LEFTRIGHT };
25 enum { KEYMOD_NONE = 0,
26 KEYMOD_RELEASED = 1, // Not a mod key, indicates "up" action
34 // A note on key codes: none are defined here. FlightGear has no
35 // hard-coded interpretations of codes other than modifier keys, so we
36 // can get away with that. The only firm requirement is that the
37 // codes passed to the fgKeyHandler function be correctly interpreted
38 // by the PUI library. Users who need to hard-code key codes
39 // (probably not a good idea in any case) can use the pu.hxx header
43 // OS integration functions
46 void fgOSInit(int* argc, char** argv);
47 void fgOSOpenWindow(int w, int h, int bpp, bool alpha, bool stencil,
49 void fgOSFullScreen();
51 void fgOSExit(int code);
53 void fgSetMouseCursor(int cursor);
54 int fgGetMouseCursor();
55 void fgWarpMouse(int x, int y);
57 int fgGetKeyModifiers();
59 void fgRequestRedraw();
62 // Callbacks and registration API
65 namespace osg { class Camera; class GraphicsContext; }
66 namespace osgGA { class GUIEventAdapter; }
68 typedef void (*fgIdleHandler)();
69 typedef void (*fgDrawHandler)();
70 typedef void (*fgWindowResizeHandler)(int w, int h);
72 typedef void (*fgKeyHandler)(int key, int keymod, int mousex, int mousey);
73 typedef void (*fgMouseClickHandler)(int button, int updown, int x, int y, bool mainWindow, const osgGA::GUIEventAdapter*);
74 typedef void (*fgMouseMotionHandler)(int x, int y);
76 void fgRegisterIdleHandler(fgIdleHandler func);
77 void fgRegisterDrawHandler(fgDrawHandler func);
78 void fgRegisterWindowResizeHandler(fgWindowResizeHandler func);
80 void fgRegisterKeyHandler(fgKeyHandler func);
81 void fgRegisterMouseClickHandler(fgMouseClickHandler func);
82 void fgRegisterMouseMotionHandler(fgMouseMotionHandler func);
86 bool fgOSIsMainCamera(const osg::Camera* camera);
87 bool fgOSIsMainContext(const osg::GraphicsContext* context);