Beispiel #1
0
void Engine::handleKeyboardSpecialUpCallback(int key, int x, int y) {
	Engine* engine = static_cast<Engine*>(glutGetWindowData());
	engine->getInputManager()->setSpecialKeyUp(key);
	SceneManager* sceneManager = engine->getSceneManager();
	switch(key) {
		case GLUT_KEY_F1:
			if(sceneManager->getLight(0) != NULL) {
				sceneManager->getLight(0)->toggle();
			}
			break;
		case GLUT_KEY_F2:
			if(sceneManager->getLight(1) != NULL) {
				sceneManager->getLight(1)->toggle();
			}
			break;
		case GLUT_KEY_F3:
			if(sceneManager->getLight(2) != NULL) {
				sceneManager->getLight(2)->toggle();
			}
			break;
		case GLUT_KEY_F4:
			if(sceneManager->getLight(3) != NULL) {
				sceneManager->getLight(3)->toggle();
			}
			break;
	}
}
Beispiel #2
0
void Engine::displayCallback() {
	Engine* engine = static_cast<Engine*>(glutGetWindowData());
	GLUTListener* listener = engine->getListener();
	if(!listener) {
		return;
	}

	listener->notifyFrameBegin();
	listener->notifyFrameDisplay();
	glutSwapBuffers();
	listener->notifyFrameEnd();
}
Beispiel #3
0
void Engine::reshapeCallback(int width, int height) {
	Engine* engine = static_cast<Engine*>(glutGetWindowData());
	WindowInfo* window = engine->getWindowInfo();
	if(!window->isReshapable) {
		return;
	}

	GLUTListener* listener = engine->getListener();
	if(listener) {
		listener->notifyReshape(width, height, window->width, window->height);
	}
	window->width = width;
	window->height = height;
	glViewport(0, 0, width, height);
}
Beispiel #4
0
void Engine::handleKeyboardUpCallback(unsigned char key, int x, int y) {
	Engine* engine = static_cast<Engine*>(glutGetWindowData());
	engine->getInputManager()->setKeyUp(key);
	switch(key) {
		case 27:
			glutLeaveMainLoop();
			return;
		case 'f':
		case 'F':
			engine->toggleFullscreen();
			break;
		case 'm':
		case 'M':
			engine->getInputManager()->toggleMouseCapture();
			break;
		case 't':
		case 'T':
			engine->getSceneManager()->toggleAnimation();
			break;
	}
}
Beispiel #5
0
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	Initthread_LoadData();
	loadIniFile();
	InitWindow( hInstance,  hPrevInstance,  lpCmdLine,  nCmdShow);
	InitGL ();

	InitJoyStict(glutGetWindowData());
	bool tmpb=SetPriorityClass(GetCurrentProcess() , HIGH_PRIORITY_CLASS);

	Initthread_DataFream();

	
	glutDisplayFunc     ( display );  // Matching Earlier Functions To Their Counterparts
	glutReshapeFunc     ( reshape );
	glutKeyboardFunc    ( keyboard );
	glutSpecialFunc     ( arrow_keys );
	glutIdleFunc		  ( display );
	glutMainLoop        ( );          // Initialize The Main Loop
	

	return 0;
}
Beispiel #6
0
//Статическая функция обертка над функцией рендера
void GlutViewer::renderSceneWrapper(void)
{
	GlutViewer* instance = (GlutViewer*)glutGetWindowData();
	instance->renderScene();
}
Beispiel #7
0
void GlutViewer::idleWrapper()
{
	GlutViewer* instance = (GlutViewer*)glutGetWindowData();
	instance->idle();
}
Beispiel #8
0
void GlutViewer::generalKeyPressedWrapper(unsigned char key, int x, int y)
{
	GlutViewer* instance = (GlutViewer*)glutGetWindowData();
	instance->generalKeyPressed(key, x, y);
}
Beispiel #9
0
void GlutViewer::keyPressedWrapper(int key, int x, int y)
{
	GlutViewer* instance = (GlutViewer*)glutGetWindowData();
	instance->keyPressed(key, x, y);
}
Beispiel #10
0
void Engine::handleMouseMovement(int x, int y) {
	Engine* engine = static_cast<Engine*>(glutGetWindowData());
	engine->getInputManager()->addMouseMovement(x, y);
}
Beispiel #11
0
void Engine::handleKeyboardSpecialCallback(int key, int x, int y) {
	Engine* engine = static_cast<Engine*>(glutGetWindowData());
	engine->getInputManager()->setSpecialKeyDown(key);
}
Beispiel #12
0
void Engine::handleKeyboardCallback(unsigned char key, int x, int y) {
	Engine* engine = static_cast<Engine*>(glutGetWindowData());
	engine->getInputManager()->setKeyDown(key);
}