示例#1
0
void TriPickDemo::updateScene(float dt)
{
	//get input
	gDInput->poll();
	g_Camera->update(dt);
	if (gDInput->keyDown(DIK_ESCAPE))
	{
		::DestroyWindow(mhMainWnd);
		::PostQuitMessage(0);
	}
	if (m_animController != NULL)
	{
		m_animController->AdvanceTime(dt, NULL);
	}
}
示例#2
0
void Application::Update(float deltaTime) {
    try {
        //Check for lost device
        HRESULT coop = g_pDevice->TestCooperativeLevel();

        if (coop != D3D_OK) {
            if (coop == D3DERR_DEVICELOST) {
                if (m_deviceLost == false)
                    DeviceLost();
            }
            else if (coop == D3DERR_DEVICENOTRESET) {
                if (m_deviceLost == true)
                    DeviceGained();
            }

            Sleep(100);
            return;
        }

        //Update Drone
        if (m_animController != NULL) {
            m_animController->AdvanceTime(deltaTime, NULL);
        }

        //Keyboard input
        if (KeyDown(VK_ESCAPE)) {
            Quit();
        }

        if (KeyDown(VK_RETURN) && KeyDown(18)) {     //ALT + RETURN
            //Switch between windowed mode and fullscreen mode
            m_present.Windowed = !m_present.Windowed;

            DeviceLost();
            DeviceGained();

            if (m_present.Windowed) {
                RECT rc = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
                AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, false);
                SetWindowPos(m_mainWindow, HWND_NOTOPMOST, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW);
                UpdateWindow(m_mainWindow);
            }
        }
    }
    catch(...) {
        g_debug << "Error in Application::Update() \n";
    }
}