Example #1
0
App::App(QObject *parent) :
    QObject(parent)
{
    Controller *controller = new Controller(this);
    MainWindow *mw = new MainWindow(0);
    mw->hide();

    if (!controller->initAR()) {
        mw->error(tr("Unable to find any usable cameras. "
                  "Check if they are connected"), tr("Camera error"));
        QApplication::quit();
    }

    mw->showFullScreen();
    connect(controller, SIGNAL(setStatus(IplImage*,IplImage*,QList<Model3D*>*)),
            mw, SLOT(setStatus(IplImage*,IplImage*,QList<Model3D*>*)));
    connect(controller, SIGNAL(refresh(int,int)),
            mw, SLOT(refreshValues(int,int)));

    connect(mw, SIGNAL(languageChanged(QLocale::Language)),
            controller, SLOT(setLanguage(QLocale::Language)));
    connect(mw, SIGNAL(nextCamera()),
            controller, SLOT(nextCamera()));
    connect(mw, SIGNAL(toggleDebug()),
            controller, SLOT(toggleDebug()));

}
BOOL OpenGLRender::update(DWORD milliseconds, int mX, int mY)
{
	mouseX = mX;
	mouseY = mY;

	if(cam->hasFocus())
		cam->followFocus();

	if(keys[VK_ESCAPE])
		return FALSE;

	//Toggle lighting if key is pressed
	toggleLighting(keys['L']);

	//Toggle debug display if key is pressed
	toggleDebug(keys['P']);

	//Moves the camera around
	if(keys['W'])
		cam->strafe(3,0.0);
	if(keys['S'])
		cam->strafe(-3,0.0);
	if(keys['A'])
		cam->strafe(0.0,3);
	if(keys['D'])
		cam->strafe(0.0,-3);

	//Zooms the camera in or out
	if(keys['Q'])
		cam->rotate(-.05);
	if(keys['E'])
		cam->rotate(.05);

	if(keys[VK_SPACE])
		manager->shoot(selectedID);

	//if (g_keys->keyDown[VK_F1])									// Is F1 Being Pressed?
		//ToggleFullscreen (g_window);							// Toggle Fullscreen Mode

	//Adjust GL camera with the new frame
	perspective();
	return TRUE;
}
Example #3
0
void MY_Scene_Base::update(Step * _step){


	controller->update(_step);

	// basic debugging controls
	if(keyboard->keyJustDown(GLFW_KEY_ESCAPE)){
		game->exit();
	}if(keyboard->keyJustDown(GLFW_KEY_F11)){
		game->toggleFullScreen();
	}if(keyboard->keyJustDown(GLFW_KEY_1)){
		cycleCamera();
	}if(keyboard->keyJustDown(GLFW_KEY_2)){
		toggleDebug();
	}

	glm::uvec2 sd = sweet::getWindowDimensions();
	uiLayer->resize(0, sd.x, 0, sd.y);
	Scene::update(_step);
	uiLayer->update(_step);
}