2004-03-31 21:10:32 +00:00
|
|
|
#ifndef _FG_OS_HXX
|
|
|
|
#define _FG_OS_HXX
|
|
|
|
|
|
|
|
// Plib pui needs to know at compile time what toolkit is in use.
|
|
|
|
// Change this when we move to something other than glut.
|
2004-04-07 14:42:41 +00:00
|
|
|
// #define PU_USE_GLUT -- moved to configure.ac -- EMH
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2004-03-31 21:10:32 +00:00
|
|
|
|
|
|
|
enum { MOUSE_BUTTON_LEFT,
|
|
|
|
MOUSE_BUTTON_MIDDLE,
|
|
|
|
MOUSE_BUTTON_RIGHT };
|
|
|
|
|
|
|
|
enum { MOUSE_BUTTON_DOWN,
|
|
|
|
MOUSE_BUTTON_UP };
|
|
|
|
|
|
|
|
enum { MOUSE_CURSOR_NONE,
|
|
|
|
MOUSE_CURSOR_POINTER,
|
|
|
|
MOUSE_CURSOR_WAIT,
|
|
|
|
MOUSE_CURSOR_CROSSHAIR,
|
|
|
|
MOUSE_CURSOR_LEFTRIGHT };
|
|
|
|
|
|
|
|
enum { KEYMOD_NONE = 0,
|
|
|
|
KEYMOD_RELEASED = 1, // Not a mod key, indicates "up" action
|
|
|
|
KEYMOD_SHIFT = 2,
|
|
|
|
KEYMOD_CTRL = 4,
|
|
|
|
KEYMOD_ALT = 8,
|
2007-12-01 13:09:11 +00:00
|
|
|
KEYMOD_META = 16,
|
|
|
|
KEYMOD_SUPER = 32,
|
|
|
|
KEYMOD_MAX = 64 };
|
2004-03-31 21:10:32 +00:00
|
|
|
|
|
|
|
// A note on key codes: none are defined here. FlightGear has no
|
|
|
|
// hard-coded interpretations of codes other than modifier keys, so we
|
|
|
|
// can get away with that. The only firm requirement is that the
|
|
|
|
// codes passed to the fgKeyHandler function be correctly interpreted
|
|
|
|
// by the PUI library. Users who need to hard-code key codes
|
|
|
|
// (probably not a good idea in any case) can use the pu.hxx header
|
|
|
|
// for definitions.
|
|
|
|
|
|
|
|
//
|
|
|
|
// OS integration functions
|
|
|
|
//
|
|
|
|
|
|
|
|
void fgOSInit(int* argc, char** argv);
|
2004-04-06 14:28:22 +00:00
|
|
|
void fgOSOpenWindow(int w, int h, int bpp, bool alpha, bool stencil,
|
|
|
|
bool fullscreen);
|
2004-03-31 21:10:32 +00:00
|
|
|
void fgOSFullScreen();
|
|
|
|
void fgOSMainLoop();
|
2004-04-25 02:17:03 +00:00
|
|
|
void fgOSExit(int code);
|
2004-03-31 21:10:32 +00:00
|
|
|
|
|
|
|
void fgSetMouseCursor(int cursor);
|
|
|
|
int fgGetMouseCursor();
|
|
|
|
void fgWarpMouse(int x, int y);
|
|
|
|
|
|
|
|
int fgGetKeyModifiers();
|
|
|
|
|
|
|
|
void fgRequestRedraw();
|
|
|
|
|
|
|
|
//
|
|
|
|
// Callbacks and registration API
|
|
|
|
//
|
|
|
|
|
2007-05-26 13:53:46 +00:00
|
|
|
namespace osg { class Camera; class GraphicsContext; }
|
|
|
|
namespace osgGA { class GUIEventAdapter; }
|
|
|
|
|
2004-03-31 21:10:32 +00:00
|
|
|
typedef void (*fgIdleHandler)();
|
|
|
|
typedef void (*fgDrawHandler)();
|
|
|
|
typedef void (*fgWindowResizeHandler)(int w, int h);
|
|
|
|
|
|
|
|
typedef void (*fgKeyHandler)(int key, int keymod, int mousex, int mousey);
|
2007-05-26 13:53:46 +00:00
|
|
|
typedef void (*fgMouseClickHandler)(int button, int updown, int x, int y, bool mainWindow, const osgGA::GUIEventAdapter*);
|
2004-03-31 21:10:32 +00:00
|
|
|
typedef void (*fgMouseMotionHandler)(int x, int y);
|
|
|
|
|
|
|
|
void fgRegisterIdleHandler(fgIdleHandler func);
|
|
|
|
void fgRegisterDrawHandler(fgDrawHandler func);
|
|
|
|
void fgRegisterWindowResizeHandler(fgWindowResizeHandler func);
|
|
|
|
|
|
|
|
void fgRegisterKeyHandler(fgKeyHandler func);
|
|
|
|
void fgRegisterMouseClickHandler(fgMouseClickHandler func);
|
|
|
|
void fgRegisterMouseMotionHandler(fgMouseMotionHandler func);
|
|
|
|
|
2007-05-21 17:50:02 +00:00
|
|
|
void fgMakeCurrent();
|
2007-05-26 13:53:46 +00:00
|
|
|
|
|
|
|
bool fgOSIsMainCamera(const osg::Camera* camera);
|
|
|
|
bool fgOSIsMainContext(const osg::GraphicsContext* context);
|
|
|
|
|
2004-03-31 21:10:32 +00:00
|
|
|
#endif // _FG_OS_HXX
|