2004-03-31 21:10:32 +00:00
|
|
|
#ifndef _FG_OS_HXX
|
|
|
|
#define _FG_OS_HXX
|
|
|
|
|
2004-04-07 14:42:41 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2008-05-19 21:21:03 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <osg/ref_ptr>
|
|
|
|
#include <osg/Camera>
|
|
|
|
#include <osg/GraphicsContext>
|
|
|
|
|
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,
|
2009-01-11 15:01:05 +00:00
|
|
|
MOUSE_CURSOR_LEFTRIGHT,
|
|
|
|
MOUSE_CURSOR_TOPSIDE,
|
|
|
|
MOUSE_CURSOR_BOTTOMSIDE,
|
|
|
|
MOUSE_CURSOR_LEFTSIDE,
|
|
|
|
MOUSE_CURSOR_RIGHTSIDE,
|
|
|
|
MOUSE_CURSOR_TOPLEFT,
|
|
|
|
MOUSE_CURSOR_TOPRIGHT,
|
|
|
|
MOUSE_CURSOR_BOTTOMLEFT,
|
|
|
|
MOUSE_CURSOR_BOTTOMRIGHT,
|
|
|
|
};
|
2004-03-31 21:10:32 +00:00
|
|
|
|
|
|
|
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,
|
2008-04-25 23:21:47 +00:00
|
|
|
KEYMOD_HYPER = 64,
|
|
|
|
KEYMOD_MAX = 128 };
|
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);
|
2008-05-19 21:21:03 +00:00
|
|
|
void fgOSOpenWindow(bool stencil);
|
2004-03-31 21:10:32 +00:00
|
|
|
void fgOSFullScreen();
|
2010-09-29 20:04:11 +00:00
|
|
|
int 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();
|
|
|
|
|
|
|
|
//
|
|
|
|
// 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);
|
|
|
|
#endif // _FG_OS_HXX
|