/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGGLUT_GLUTWINDOW #define OSGGLUT_GLUTWINDOW 1 #include #include #include namespace osgGLUT { /** A basic GLUTWindow base class which provides a just a basic window. */ class OSGGLUT_EXPORT Window { public: Window(); virtual ~Window(); void setWindowOrigin(int x, int y) { _wx = x, _wy = y; }; void setWindowSize(int width, int height) { _ww = width, _wh = height; }; void setWindowTitle(const std::string& title) { _title = title; } void setDisplayMode(unsigned int displayMode) { _displayMode = displayMode; } virtual bool open(); virtual bool run(); virtual void display(); protected: virtual void clear(); static void displayCB(); static void reshapeCB(int w, int h); static void visibilityCB(int state); static void mouseMotionCB(int x, int y); static void mousePassiveMotionCB(int x, int y); static void mouseCB(int button, int state, int x, int y); static void keyboardCB(unsigned char key, int x, int y ); static void keyboardUpCB(unsigned char key, int x, int y ); static void specialCB(int key, int x, int y); static void specialUpCB(int key, int x, int y); static void spaceballMotionCB(int x, int y, int z); static void spaceballRotateCB(int x, int y, int z); static void spaceballButtonCB(int button, int state); virtual void reshape(GLint w, GLint h); virtual void visibility(int state); virtual void mouseMotion(int x, int y); virtual void mousePassiveMotion(int x, int y); virtual void mouse(int button, int state, int x, int y); virtual void keyboard(int key, int x, int y, bool keydown); virtual void special(int key, int x, int y, bool keydown); virtual void spaceballMotion(int x, int y, int z); virtual void spaceballRotate(int x, int y, int z); virtual void spaceballButton(int button, int state); static Window* s_theWindow; std::string _title; int _wx, _wy, _ww, _wh; unsigned int _displayMode; int _is_open; int _mx, _my, _mbutton; bool _fullscreen; int _saved_wx, _saved_wy, _saved_ww,_saved_wh; bool _exit; void check_if_exit(); }; } #endif // SG_VIEWIER_H