Merge branch 'dev' into dev-char

This commit is contained in:
Kayne Ruse
2013-06-24 09:02:36 +10:00
12 changed files with 41 additions and 69 deletions
+5 -5
View File
@@ -25,7 +25,7 @@
#include "base_scene.hpp"
#include "utilities.hpp"
#include "defines.hpp"
#include "service_locator.hpp"
#include "singleton.hpp"
#include "packet_type.hpp"
#include "network_queue.hpp"
#include "information_manager.hpp"
@@ -68,10 +68,10 @@ protected:
void HandleDisconnection(::Disconnect&);
//services
ConfigUtility* configUtil = ServiceLocator<ConfigUtility>::Get();
SurfaceManager* surfaceMgr = ServiceLocator<SurfaceManager>::Get();
UDPNetworkUtility* netUtil = ServiceLocator<UDPNetworkUtility>::Get();
InformationManager* infoMgr = ServiceLocator<InformationManager>::Get();
ConfigUtility* configUtil = Singleton<ConfigUtility>::Get();
SurfaceManager* surfaceMgr = Singleton<SurfaceManager>::Get();
UDPNetworkUtility* netUtil = Singleton<UDPNetworkUtility>::Get();
InformationManager* infoMgr = Singleton<InformationManager>::Get();
//members
RasterFont font;
+5 -5
View File
@@ -25,7 +25,7 @@
#include "base_scene.hpp"
#include "utilities.hpp"
#include "defines.hpp"
#include "service_locator.hpp"
#include "singleton.hpp"
#include "packet_type.hpp"
#include "network_queue.hpp"
#include "information_manager.hpp"
@@ -72,10 +72,10 @@ protected:
void BeginGame(JoinResponse&);
//services
ConfigUtility* configUtil = ServiceLocator<ConfigUtility>::Get();
SurfaceManager* surfaceMgr = ServiceLocator<SurfaceManager>::Get();
UDPNetworkUtility* netUtil = ServiceLocator<UDPNetworkUtility>::Get();
InformationManager* infoMgr = ServiceLocator<InformationManager>::Get();
ConfigUtility* configUtil = Singleton<ConfigUtility>::Get();
SurfaceManager* surfaceMgr = Singleton<SurfaceManager>::Get();
UDPNetworkUtility* netUtil = Singleton<UDPNetworkUtility>::Get();
InformationManager* infoMgr = Singleton<InformationManager>::Get();
//members
Button refreshButton;
+2 -2
View File
@@ -23,7 +23,7 @@
#define MAINMENU_HPP_
#include "base_scene.hpp"
#include "service_locator.hpp"
#include "singleton.hpp"
#include "surface_manager.hpp"
#include "button.hpp"
@@ -47,7 +47,7 @@ protected:
void MouseButtonUp(SDL_MouseButtonEvent const&);
void KeyDown(SDL_KeyboardEvent const&);
SurfaceManager* surfaceMgr = ServiceLocator<SurfaceManager>::Get();
SurfaceManager* surfaceMgr = Singleton<SurfaceManager>::Get();
Button startButton;
Button optionsButton;
+2 -2
View File
@@ -23,7 +23,7 @@
#define OPTIONSCREEN_HPP_
#include "base_scene.hpp"
#include "service_locator.hpp"
#include "singleton.hpp"
#include "surface_manager.hpp"
#include "button.hpp"
@@ -44,7 +44,7 @@ protected:
void MouseButtonUp(SDL_MouseButtonEvent const&);
void KeyDown(SDL_KeyboardEvent const&);
SurfaceManager* surfaceMgr = ServiceLocator<SurfaceManager>::Get();
SurfaceManager* surfaceMgr = Singleton<SurfaceManager>::Get();
Button backButton;
};
+3 -15
View File
@@ -54,7 +54,7 @@ SceneManager::~SceneManager() {
* operations.
* Important things to note:
* The APIs are initiated here.
* The global objects are created here.
* The global objects are initialized here.
* The game's screen is created here, based on information loaded from the config file.
* The ConfigUtility's call to Load() also ensures that the "rsc\" folder is in the directory. It's easy to forget it.
*/
@@ -62,7 +62,6 @@ SceneManager::~SceneManager() {
void SceneManager::Init() {
//load the config file
try {
configUtil = ServiceLocator<ConfigUtility>::Set(new ConfigUtility());
configUtil->Load("rsc/config.cfg");
}
catch(std::runtime_error& e) {
@@ -89,12 +88,7 @@ void SceneManager::Init() {
SDL_GetVideoInfo()->vfmt->BitsPerPixel,
flags);
//instanciate the remaining services
surfaceMgr = ServiceLocator<SurfaceManager>::Set(new SurfaceManager());
netUtil = ServiceLocator<UDPNetworkUtility>::Set(new UDPNetworkUtility());
infoMgr = ServiceLocator<InformationManager>::Set(new InformationManager());
//initiate the remaining services
//initiate the remaining singletons
netUtil->Open(0, sizeof(Packet));
}
@@ -137,16 +131,10 @@ void SceneManager::Proc() {
}
void SceneManager::Quit() {
//clean up the services
//clean up the singletons
netUtil->Close();
surfaceMgr->FreeAll();
//delete the services
configUtil = ServiceLocator<ConfigUtility>::Set(nullptr);
surfaceMgr = ServiceLocator<SurfaceManager>::Set(nullptr);
netUtil = ServiceLocator<UDPNetworkUtility>::Set(nullptr);
infoMgr = ServiceLocator<InformationManager>::Set(nullptr);
//clean up the scene
UnloadScene();
+5 -5
View File
@@ -24,7 +24,7 @@
#include "scene_list.hpp"
#include "base_scene.hpp"
#include "service_locator.hpp"
#include "singleton.hpp"
#include "packet_type.hpp"
#include "information_manager.hpp"
@@ -51,10 +51,10 @@ private:
BaseScene* activeScene = nullptr;
ConfigUtility* configUtil = nullptr;
SurfaceManager* surfaceMgr = nullptr;
UDPNetworkUtility* netUtil = nullptr;
InformationManager* infoMgr = nullptr;
ConfigUtility* configUtil = Singleton<ConfigUtility>::Get();
SurfaceManager* surfaceMgr = Singleton<SurfaceManager>::Get();
UDPNetworkUtility* netUtil = Singleton<UDPNetworkUtility>::Get();
InformationManager* infoMgr = Singleton<InformationManager>::Get();
};
#endif
+3 -3
View File
@@ -23,7 +23,7 @@
#define SPLASHSCREEN_HPP_
#include "base_scene.hpp"
#include "service_locator.hpp"
#include "singleton.hpp"
#include "config_utility.hpp"
#include "surface_manager.hpp"
@@ -44,8 +44,8 @@ protected:
void LoadResources();
bool loaded = false;
ConfigUtility* configUtil = ServiceLocator<ConfigUtility>::Get();
SurfaceManager* surfaceMgr = ServiceLocator<SurfaceManager>::Get();
ConfigUtility* configUtil = Singleton<ConfigUtility>::Get();
SurfaceManager* surfaceMgr = Singleton<SurfaceManager>::Get();
Image logo;
std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
};