57 lines
1021 B
C++
57 lines
1021 B
C++
|
|
#include"Game.h"
|
||
|
|
|
||
|
|
|
||
|
|
Game::Game(Context& p_context) :
|
||
|
|
m_context(p_context)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
Game::~Game() {}
|
||
|
|
|
||
|
|
void Game::Update(float p_deltaTime)
|
||
|
|
{
|
||
|
|
/*Scene-Update*/
|
||
|
|
if (m_context.m_sceneManager.m_currentScene)
|
||
|
|
{
|
||
|
|
m_context.m_sceneManager.m_currentScene->Update(p_deltaTime);
|
||
|
|
}
|
||
|
|
|
||
|
|
/*Network-Update*/
|
||
|
|
|
||
|
|
|
||
|
|
/*Render-Update*/
|
||
|
|
m_context.m_renderer.RenderUI();
|
||
|
|
|
||
|
|
/*Audio-Update*/
|
||
|
|
m_context.m_audioManager.Update(p_deltaTime);
|
||
|
|
m_context.m_audioEngine.Update(p_deltaTime);
|
||
|
|
}
|
||
|
|
|
||
|
|
void Game::PreUpdate()
|
||
|
|
{
|
||
|
|
m_context.m_window.peekMessage();
|
||
|
|
m_context.m_window.Update();
|
||
|
|
m_context.m_gpu.clear();
|
||
|
|
}
|
||
|
|
|
||
|
|
void Game::PostUpdate()
|
||
|
|
{
|
||
|
|
m_context.m_window.swapBuffer();
|
||
|
|
}
|
||
|
|
|
||
|
|
void Game::OnEnter()
|
||
|
|
{
|
||
|
|
StartScene* m_startScene = new StartScene();
|
||
|
|
m_context.m_sceneManager.RegisterScene("start_scene", m_startScene);
|
||
|
|
m_startScene->m_context = &m_context;
|
||
|
|
m_context.m_sceneManager.ChangeScene(m_startScene);
|
||
|
|
|
||
|
|
/*Audio-Init*/
|
||
|
|
m_context.m_audioEngine.InitAudioEngine();
|
||
|
|
}
|
||
|
|
|
||
|
|
void Game::OnExit()
|
||
|
|
{
|
||
|
|
/*Audio-Exit*/
|
||
|
|
m_context.m_audioEngine.ExitAudioEngine();
|
||
|
|
}
|