2001-10-23 23:55:01 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield
|
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
#ifndef OSGGLUT_GLUTWINDOW
|
|
|
|
#define OSGGLUT_GLUTWINDOW 1
|
|
|
|
|
|
|
|
#include <osgGLUT/Export>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2001-12-25 03:06:49 +08:00
|
|
|
namespace osgGLUT
|
|
|
|
{
|
2001-10-23 23:55:01 +08:00
|
|
|
|
|
|
|
/** A basic GLUTWindow base class which provides a just a basic window. */
|
2001-12-25 03:06:49 +08:00
|
|
|
class OSGGLUT_EXPORT Window
|
2001-10-23 23:55:01 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2001-12-25 03:06:49 +08:00
|
|
|
Window();
|
|
|
|
virtual ~Window();
|
2001-10-23 23:55:01 +08:00
|
|
|
|
|
|
|
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();
|
2001-12-25 03:06:49 +08:00
|
|
|
|
2001-10-23 23:55:01 +08:00
|
|
|
protected:
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
2002-01-18 06:40:16 +08:00
|
|
|
static void specialCB(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);
|
|
|
|
|
2001-10-23 23:55:01 +08:00
|
|
|
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(unsigned char key, int x, int y);
|
2002-01-18 06:40:16 +08:00
|
|
|
|
|
|
|
virtual void special(int key, int x, int y);
|
|
|
|
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);
|
|
|
|
|
2001-10-23 23:55:01 +08:00
|
|
|
|
2001-12-25 03:06:49 +08:00
|
|
|
static Window* s_theWindow;
|
2001-10-23 23:55:01 +08:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2002-02-03 20:33:41 +08:00
|
|
|
}
|
2001-10-23 23:55:01 +08:00
|
|
|
|
|
|
|
#endif // SG_VIEWIER_H
|