]> git.mxchange.org Git - flightgear.git/blob - src/Main/fg_os.hxx
14f9397958bef094d98464aa499a5ec613641bcc
[flightgear.git] / src / Main / fg_os.hxx
1 #ifndef _FG_OS_HXX
2 #define _FG_OS_HXX
3
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
7
8 enum { MOUSE_BUTTON_LEFT,
9        MOUSE_BUTTON_MIDDLE,
10        MOUSE_BUTTON_RIGHT };
11
12 enum { MOUSE_BUTTON_DOWN,
13        MOUSE_BUTTON_UP };
14
15 enum { MOUSE_CURSOR_NONE,
16        MOUSE_CURSOR_POINTER,
17        MOUSE_CURSOR_WAIT,
18        MOUSE_CURSOR_CROSSHAIR,
19        MOUSE_CURSOR_LEFTRIGHT };
20
21 enum { KEYMOD_NONE     = 0,
22        KEYMOD_RELEASED = 1, // Not a mod key, indicates "up" action
23        KEYMOD_SHIFT    = 2,
24        KEYMOD_CTRL     = 4,
25        KEYMOD_ALT      = 8,
26        KEYMOD_MAX      = 16 };
27
28 // A note on key codes: none are defined here.  FlightGear has no
29 // hard-coded interpretations of codes other than modifier keys, so we
30 // can get away with that.  The only firm requirement is that the
31 // codes passed to the fgKeyHandler function be correctly interpreted
32 // by the PUI library.  Users who need to hard-code key codes
33 // (probably not a good idea in any case) can use the pu.hxx header
34 // for definitions.
35
36 //
37 // OS integration functions
38 //
39
40 void fgOSInit(int* argc, char** argv);
41 void fgOSOpenWindow(int w, int h, int bpp, bool alpha, bool stencil,
42                     bool fullscreen);
43 void fgOSFullScreen();
44 void fgOSMainLoop();
45
46 void fgSetMouseCursor(int cursor);
47 int  fgGetMouseCursor();
48 void fgWarpMouse(int x, int y);
49
50 int  fgGetKeyModifiers();
51
52 void fgRequestRedraw();
53
54 //
55 // Callbacks and registration API
56 //
57
58 typedef void (*fgIdleHandler)();
59 typedef void (*fgDrawHandler)();
60 typedef void (*fgWindowResizeHandler)(int w, int h);
61
62 typedef void (*fgKeyHandler)(int key, int keymod, int mousex, int mousey);
63 typedef void (*fgMouseClickHandler)(int button, int updown, int x, int y);
64 typedef void (*fgMouseMotionHandler)(int x, int y);
65
66 void fgRegisterIdleHandler(fgIdleHandler func);
67 void fgRegisterDrawHandler(fgDrawHandler func);
68 void fgRegisterWindowResizeHandler(fgWindowResizeHandler func);
69
70 void fgRegisterKeyHandler(fgKeyHandler func);
71 void fgRegisterMouseClickHandler(fgMouseClickHandler func);
72 void fgRegisterMouseMotionHandler(fgMouseMotionHandler func);
73
74 #endif // _FG_OS_HXX