]> git.mxchange.org Git - flightgear.git/blob - src/Main/fg_os.hxx
88525af7fe7bcc2f1fd68b7cddaff4eb8f963e3b
[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, bool alpha);
42 void fgOSFullScreen();
43 void fgOSMainLoop();
44
45 void fgSetMouseCursor(int cursor);
46 int  fgGetMouseCursor();
47 void fgWarpMouse(int x, int y);
48
49 int  fgGetKeyModifiers();
50
51 void fgRequestRedraw();
52
53 //
54 // Callbacks and registration API
55 //
56
57 typedef void (*fgIdleHandler)();
58 typedef void (*fgDrawHandler)();
59 typedef void (*fgWindowResizeHandler)(int w, int h);
60
61 typedef void (*fgKeyHandler)(int key, int keymod, int mousex, int mousey);
62 typedef void (*fgMouseClickHandler)(int button, int updown, int x, int y);
63 typedef void (*fgMouseMotionHandler)(int x, int y);
64
65 void fgRegisterIdleHandler(fgIdleHandler func);
66 void fgRegisterDrawHandler(fgDrawHandler func);
67 void fgRegisterWindowResizeHandler(fgWindowResizeHandler func);
68
69 void fgRegisterKeyHandler(fgKeyHandler func);
70 void fgRegisterMouseClickHandler(fgMouseClickHandler func);
71 void fgRegisterMouseMotionHandler(fgMouseMotionHandler func);
72
73 #endif // _FG_OS_HXX