Esempio n. 1
0
bool Application::OnUpdate()
{
	//System Update
	m_pMouse->Update();
	m_pKeyboard->Update();
	m_pCamera->Update();
	m_pGameTime->Update();

	//m_fRot += PI * GameTime::GetTimeElapsed();
	//m_pScene->SetRotateY(m_fRot);

	m_pScene->Update();

	if(m_pKeyboard->IsKeyPressed(KEY_1))
	{
		m_pParent->DetachChild(m_pChild);
	}
	else if(m_pKeyboard->IsKeyPressed(KEY_2))
	{
		m_pParent->AttachChild(m_pChild);
	}

	m_pChild->Update();

	DX11Camera::FreeLookCamera(m_pCamera,10.0f);
	//m_pCamera->LookAt(D3DXVECTOR3(0,0,0));

	

	//Window Update
	return m_pWindow->Tick();
}
Esempio n. 2
0
bool Game::Run()
{
    if(!Initialize())
    {
        Log::Error << "Could not initialize GLFW window.\n";
        return false;
    }
    
    GameTime time;

    
    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(m_window))
    {
        /* Poll for and process events */
        glfwPollEvents();
        
        Update(time);
        
        
        gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT);
        
        Render(time);
        
        /* Render here */
        /* Swap front and back buffers */
        glfwSwapBuffers(m_window);
        
        auto title = "Time: " + std::to_string(time.TotalSeconds());
        
        glfwSetWindowTitle(m_window, title.c_str());
                           
        time.Update();
    }
    
    Dispose();
    
    return true;
    
}