/* -*- C++ -*-
* window.h
* $Id: window.h,v 1.1.1.1 2000/07/20 20:54:14 ghali Exp $
*/
#ifndef WINDOW_H
#define WINDOW_H
#include "../geom/camera.h"
#include "../nodes/group.h"
namespace MSG {
class Window {
protected:
Camera camera;
Group *root;
int mouseX, mouseY;
int dragX, dragY;
bool dragging;
// int lastXvec, lastYvec;
public:
Window(int argc, char **argv,
Group* _root,
const Camera& _camera,
char* windowTitle = "MSG");
void display(void);
void handleKeys(unsigned char c, int x, int y);
void handleMouse(int button, int state, int x, int y);
void handleMotion(int x, int y);
void handleVisibility(int state);
void idle(void);
void mainLoop();
};
// Variables and methods in global scope to interface with glut
// (it is not possible to register member functions as callbacks with glut)
extern int windowNum;
extern Window* window;
extern unsigned char k;
extern int x, y;
void displayCallback(void) {
window->display();
}
void keyboardCallback(unsigned char k,int x,int y) {
window->handleKeys(k,x,y);
}
void mouseCallback(int button, int state, int x, int y) {
window->handleMouse(button, state, x, y);
}
void motionCallback(int x, int y) {
window->handleMotion(x, y);
}
void visibilityCallback(int state) {
window->handleVisibility(state);
}
void idleCallback(void) {
window->idle();
}
}
#endif