Merge branch 'dev' into dev-map

This commit is contained in:
Kayne Ruse
2013-06-24 09:23:12 +10:00
4 changed files with 19 additions and 16 deletions
@@ -19,7 +19,7 @@
* 3. This notice may not be removed or altered from any source * 3. This notice may not be removed or altered from any source
* distribution. * distribution.
*/ */
#include "scene_manager.hpp" #include "client_application.hpp"
#include <stdexcept> #include <stdexcept>
#include <chrono> #include <chrono>
@@ -40,15 +40,15 @@
//Public access members //Public access members
//------------------------- //-------------------------
SceneManager::SceneManager() { ClientApplication::ClientApplication() {
// //
} }
SceneManager::~SceneManager() { ClientApplication::~ClientApplication() {
UnloadScene(); UnloadScene();
} }
/* SceneManager::Init() /* ClientApplication::Init()
* This function initializes the entire program. There are a number of things * This function initializes the entire program. There are a number of things
* that could go wrong here, which is why there is such an unusual order of * that could go wrong here, which is why there is such an unusual order of
* operations. * operations.
@@ -59,7 +59,7 @@ SceneManager::~SceneManager() {
* The ConfigUtility's call to Load() also ensures that the "rsc\" folder is in the directory. It's easy to forget it. * The ConfigUtility's call to Load() also ensures that the "rsc\" folder is in the directory. It's easy to forget it.
*/ */
void SceneManager::Init() { void ClientApplication::Init() {
//load the config file //load the config file
try { try {
configUtil->Load("rsc/config.cfg"); configUtil->Load("rsc/config.cfg");
@@ -92,7 +92,7 @@ void SceneManager::Init() {
netUtil->Open(0, sizeof(Packet)); netUtil->Open(0, sizeof(Packet));
} }
void SceneManager::Proc() { void ClientApplication::Proc() {
LoadScene(SceneList::FIRST); LoadScene(SceneList::FIRST);
//prepare the time system //prepare the time system
@@ -130,7 +130,7 @@ void SceneManager::Proc() {
UnloadScene(); UnloadScene();
} }
void SceneManager::Quit() { void ClientApplication::Quit() {
//clean up the singletons //clean up the singletons
netUtil->Close(); netUtil->Close();
surfaceMgr->FreeAll(); surfaceMgr->FreeAll();
@@ -147,7 +147,7 @@ void SceneManager::Quit() {
//Private access members //Private access members
//------------------------- //-------------------------
void SceneManager::LoadScene(SceneList sceneIndex) { void ClientApplication::LoadScene(SceneList sceneIndex) {
UnloadScene(); UnloadScene();
switch(sceneIndex) { switch(sceneIndex) {
@@ -177,7 +177,7 @@ void SceneManager::LoadScene(SceneList sceneIndex) {
} }
} }
void SceneManager::UnloadScene() { void ClientApplication::UnloadScene() {
delete activeScene; delete activeScene;
activeScene = nullptr; activeScene = nullptr;
} }
@@ -19,8 +19,8 @@
* 3. This notice may not be removed or altered from any source * 3. This notice may not be removed or altered from any source
* distribution. * distribution.
*/ */
#ifndef SCENEMANAGER_HPP_ #ifndef CLIENTAPPLICATION_HPP_
#define SCENEMANAGER_HPP_ #define CLIENTAPPLICATION_HPP_
#include "scene_list.hpp" #include "scene_list.hpp"
#include "base_scene.hpp" #include "base_scene.hpp"
@@ -34,16 +34,18 @@
#include "SDL/SDL.h" #include "SDL/SDL.h"
class SceneManager { class ClientApplication {
public: public:
/* Public access members */ /* Public access members */
SceneManager(); ClientApplication();
~SceneManager(); ~ClientApplication();
void Init(); void Init();
void Proc(); void Proc();
void Quit(); void Quit();
ClientApplication(ClientApplication const&) = delete;
ClientApplication(ClientApplication const&&) = delete;
private: private:
/* Private access members */ /* Private access members */
void LoadScene(SceneList sceneIndex); void LoadScene(SceneList sceneIndex);
+2 -2
View File
@@ -19,7 +19,7 @@
* 3. This notice may not be removed or altered from any source * 3. This notice may not be removed or altered from any source
* distribution. * distribution.
*/ */
#include "scene_manager.hpp" #include "client_application.hpp"
#include <stdexcept> #include <stdexcept>
#include <iostream> #include <iostream>
@@ -31,7 +31,7 @@ int main(int, char**) {
cout << "Beginning program" << endl; cout << "Beginning program" << endl;
#endif #endif
try { try {
SceneManager app; ClientApplication app;
app.Init(); app.Init();
app.Proc(); app.Proc();
app.Quit(); app.Quit();
+1
View File
@@ -68,6 +68,7 @@ public:
void Quit(); void Quit();
ServerApplication(ServerApplication const&) = delete; ServerApplication(ServerApplication const&) = delete;
ServerApplication(ServerApplication const&&) = delete;
private: private:
//game loop //game loop
void UpdateWorld(double delta); void UpdateWorld(double delta);