Add Music fluctuations project and Chinese plan docs
This commit is contained in:
7
MVS/Music fluctuations/source/game/CMakeLists.txt
Normal file
7
MVS/Music fluctuations/source/game/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
#递归将本文件夹下所有cpp放到FUNCS中
|
||||
file(GLOB_RECURSE GAME ./ *.cpp)
|
||||
|
||||
#将FUNCS中所有cpp编译为funcs这个lib库
|
||||
add_library(game ${GAME} )
|
||||
|
||||
|
||||
57
MVS/Music fluctuations/source/game/Game.cpp
Normal file
57
MVS/Music fluctuations/source/game/Game.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#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();
|
||||
}
|
||||
17
MVS/Music fluctuations/source/game/Game.h
Normal file
17
MVS/Music fluctuations/source/game/Game.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include"../context/Context.h"
|
||||
#include"../scene/StartScene/StartScene.h"
|
||||
|
||||
class Game
|
||||
{
|
||||
public:
|
||||
Game(Context& p_context);
|
||||
~Game();
|
||||
void Update(float p_deltaTime);
|
||||
void PreUpdate();
|
||||
void PostUpdate();
|
||||
void OnEnter();
|
||||
void OnExit();
|
||||
private:
|
||||
Context& m_context;
|
||||
};
|
||||
Reference in New Issue
Block a user