Implemented the changes to ConfigUtility in the client and server
The server's changes were easy. The clients means that the constructors for each scene have one less argument, and each scene has one less member. The exception to this is LobbyMenu, where the config is used in multiple places, so it was easier to have the config's reference as a member. To replace the config's usage, I added this line in most cases: ConfigUtility& config = ConfigUtility::GetSingleton(); The only requirement is that ConfigUtility::Create() and ConfigUtility::Delete() are called from the main() function.
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include "client_application.hpp"
|
#include "client_application.hpp"
|
||||||
|
|
||||||
#include "serial.hpp"
|
#include "serial.hpp"
|
||||||
|
#include "config_utility.hpp"
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -48,6 +49,7 @@ void ClientApplication::Init(int argc, char** argv) {
|
|||||||
std::cout << "Beginning " << argv[0] << std::endl;
|
std::cout << "Beginning " << argv[0] << std::endl;
|
||||||
|
|
||||||
//load the prerequisites
|
//load the prerequisites
|
||||||
|
ConfigUtility& config = ConfigUtility::GetSingleton();
|
||||||
config.Load("rsc\\config.cfg");
|
config.Load("rsc\\config.cfg");
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
@@ -165,25 +167,25 @@ void ClientApplication::LoadScene(SceneList sceneIndex) {
|
|||||||
//add scene creation calls here
|
//add scene creation calls here
|
||||||
case SceneList::FIRST:
|
case SceneList::FIRST:
|
||||||
case SceneList::SPLASHSCREEN:
|
case SceneList::SPLASHSCREEN:
|
||||||
activeScene = new SplashScreen(&config);
|
activeScene = new SplashScreen();
|
||||||
break;
|
break;
|
||||||
case SceneList::MAINMENU:
|
case SceneList::MAINMENU:
|
||||||
activeScene = new MainMenu(&config);
|
activeScene = new MainMenu();
|
||||||
break;
|
break;
|
||||||
case SceneList::OPTIONSMENU:
|
case SceneList::OPTIONSMENU:
|
||||||
activeScene = new OptionsMenu(&config);
|
activeScene = new OptionsMenu();
|
||||||
break;
|
break;
|
||||||
case SceneList::LOBBYMENU:
|
case SceneList::LOBBYMENU:
|
||||||
activeScene = new LobbyMenu(&config, &network, &clientIndex, &accountIndex);
|
activeScene = new LobbyMenu(&network, &clientIndex, &accountIndex);
|
||||||
break;
|
break;
|
||||||
case SceneList::INWORLD:
|
case SceneList::INWORLD:
|
||||||
activeScene = new InWorld(&config, &network, &clientIndex, &accountIndex, &characterIndex, &characterMap);
|
activeScene = new InWorld(&network, &clientIndex, &accountIndex, &characterIndex, &characterMap);
|
||||||
break;
|
break;
|
||||||
case SceneList::INCOMBAT:
|
case SceneList::INCOMBAT:
|
||||||
activeScene = new InCombat(&config, &network, &clientIndex, &accountIndex, &characterIndex, &characterMap);
|
activeScene = new InCombat(&network, &clientIndex, &accountIndex, &characterIndex, &characterMap);
|
||||||
break;
|
break;
|
||||||
case SceneList::CLEANUP:
|
case SceneList::CLEANUP:
|
||||||
activeScene = new CleanUp(&config, &network, &clientIndex, &accountIndex, &characterIndex, &characterMap);
|
activeScene = new CleanUp(&network, &clientIndex, &accountIndex, &characterIndex, &characterMap);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw(std::logic_error("Failed to recognize the scene index"));
|
throw(std::logic_error("Failed to recognize the scene index"));
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include "scene_list.hpp"
|
#include "scene_list.hpp"
|
||||||
#include "base_scene.hpp"
|
#include "base_scene.hpp"
|
||||||
|
|
||||||
#include "config_utility.hpp"
|
|
||||||
#include "udp_network_utility.hpp"
|
#include "udp_network_utility.hpp"
|
||||||
#include "character.hpp"
|
#include "character.hpp"
|
||||||
|
|
||||||
@@ -48,7 +47,6 @@ private:
|
|||||||
BaseScene* activeScene = nullptr;
|
BaseScene* activeScene = nullptr;
|
||||||
|
|
||||||
//shared parameters
|
//shared parameters
|
||||||
ConfigUtility config;
|
|
||||||
UDPNetworkUtility network;
|
UDPNetworkUtility network;
|
||||||
int clientIndex = -1;
|
int clientIndex = -1;
|
||||||
int accountIndex = -1;
|
int accountIndex = -1;
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
#include "client_application.hpp"
|
#include "client_application.hpp"
|
||||||
|
|
||||||
|
//singletons
|
||||||
|
#include "config_utility.hpp"
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -28,10 +31,17 @@ using namespace std;
|
|||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
try {
|
try {
|
||||||
|
//create the singletons
|
||||||
|
ConfigUtility::Create();
|
||||||
|
|
||||||
|
//call the server's routines
|
||||||
ClientApplication app;
|
ClientApplication app;
|
||||||
app.Init(argc, argv);
|
app.Init(argc, argv);
|
||||||
app.Proc();
|
app.Proc();
|
||||||
app.Quit();
|
app.Quit();
|
||||||
|
|
||||||
|
//delete the singletons
|
||||||
|
ConfigUtility::Delete();
|
||||||
}
|
}
|
||||||
catch(exception& e) {
|
catch(exception& e) {
|
||||||
cerr << "Fatal exception thrown: " << e.what() << endl;
|
cerr << "Fatal exception thrown: " << e.what() << endl;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "clean_up.hpp"
|
#include "clean_up.hpp"
|
||||||
|
|
||||||
#include "channels.hpp"
|
#include "channels.hpp"
|
||||||
|
#include "config_utility.hpp"
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@@ -30,20 +31,20 @@
|
|||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
CleanUp::CleanUp(
|
CleanUp::CleanUp(
|
||||||
ConfigUtility* const argConfig,
|
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
int* const argAccountIndex,
|
int* const argAccountIndex,
|
||||||
int* const argCharacterIndex,
|
int* const argCharacterIndex,
|
||||||
CharacterMap* argCharacterMap
|
CharacterMap* argCharacterMap
|
||||||
):
|
):
|
||||||
config(*argConfig),
|
|
||||||
network(*argNetwork),
|
network(*argNetwork),
|
||||||
clientIndex(*argClientIndex),
|
clientIndex(*argClientIndex),
|
||||||
accountIndex(*argAccountIndex),
|
accountIndex(*argAccountIndex),
|
||||||
characterIndex(*argCharacterIndex),
|
characterIndex(*argCharacterIndex),
|
||||||
characterMap(*argCharacterMap)
|
characterMap(*argCharacterMap)
|
||||||
{
|
{
|
||||||
|
ConfigUtility& config = ConfigUtility::GetSingleton();
|
||||||
|
|
||||||
//setup the utility objects
|
//setup the utility objects
|
||||||
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
||||||
image.SetClipH(image.GetClipH()/3);
|
image.SetClipH(image.GetClipH()/3);
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include "button.hpp"
|
#include "button.hpp"
|
||||||
|
|
||||||
//common
|
//common
|
||||||
#include "config_utility.hpp"
|
|
||||||
#include "frame_rate.hpp"
|
#include "frame_rate.hpp"
|
||||||
|
|
||||||
#include "character.hpp"
|
#include "character.hpp"
|
||||||
@@ -46,7 +45,6 @@ class CleanUp : public BaseScene {
|
|||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
CleanUp(
|
CleanUp(
|
||||||
ConfigUtility* const argConfig,
|
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
int* const argAccountIndex,
|
int* const argAccountIndex,
|
||||||
@@ -70,7 +68,6 @@ protected:
|
|||||||
void KeyUp(SDL_KeyboardEvent const&);
|
void KeyUp(SDL_KeyboardEvent const&);
|
||||||
|
|
||||||
//shared parameters
|
//shared parameters
|
||||||
ConfigUtility& config;
|
|
||||||
UDPNetworkUtility& network;
|
UDPNetworkUtility& network;
|
||||||
int& clientIndex;
|
int& clientIndex;
|
||||||
int& accountIndex;
|
int& accountIndex;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "channels.hpp"
|
#include "channels.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
#include "config_utility.hpp"
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@@ -31,14 +32,12 @@
|
|||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
InCombat::InCombat(
|
InCombat::InCombat(
|
||||||
ConfigUtility* const argConfig,
|
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
int* const argAccountIndex,
|
int* const argAccountIndex,
|
||||||
int* const argCharacterIndex,
|
int* const argCharacterIndex,
|
||||||
CharacterMap* argCharacterMap
|
CharacterMap* argCharacterMap
|
||||||
):
|
):
|
||||||
config(*argConfig),
|
|
||||||
network(*argNetwork),
|
network(*argNetwork),
|
||||||
clientIndex(*argClientIndex),
|
clientIndex(*argClientIndex),
|
||||||
accountIndex(*argAccountIndex),
|
accountIndex(*argAccountIndex),
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include "button.hpp"
|
#include "button.hpp"
|
||||||
|
|
||||||
//common
|
//common
|
||||||
#include "config_utility.hpp"
|
|
||||||
#include "frame_rate.hpp"
|
#include "frame_rate.hpp"
|
||||||
|
|
||||||
#include "character.hpp"
|
#include "character.hpp"
|
||||||
@@ -43,7 +42,6 @@ class InCombat : public BaseScene {
|
|||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
InCombat(
|
InCombat(
|
||||||
ConfigUtility* const argConfig,
|
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
int* const argAccountIndex,
|
int* const argAccountIndex,
|
||||||
@@ -79,7 +77,6 @@ protected:
|
|||||||
void RequestShutdown();
|
void RequestShutdown();
|
||||||
|
|
||||||
//shared parameters
|
//shared parameters
|
||||||
ConfigUtility& config;
|
|
||||||
UDPNetworkUtility& network;
|
UDPNetworkUtility& network;
|
||||||
int& clientIndex;
|
int& clientIndex;
|
||||||
int& accountIndex;
|
int& accountIndex;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "channels.hpp"
|
#include "channels.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
#include "config_utility.hpp"
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -34,20 +35,20 @@
|
|||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
InWorld::InWorld(
|
InWorld::InWorld(
|
||||||
ConfigUtility* const argConfig,
|
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
int* const argAccountIndex,
|
int* const argAccountIndex,
|
||||||
int* const argCharacterIndex,
|
int* const argCharacterIndex,
|
||||||
CharacterMap* argCharacterMap
|
CharacterMap* argCharacterMap
|
||||||
):
|
):
|
||||||
config(*argConfig),
|
|
||||||
network(*argNetwork),
|
network(*argNetwork),
|
||||||
clientIndex(*argClientIndex),
|
clientIndex(*argClientIndex),
|
||||||
accountIndex(*argAccountIndex),
|
accountIndex(*argAccountIndex),
|
||||||
characterIndex(*argCharacterIndex),
|
characterIndex(*argCharacterIndex),
|
||||||
characterMap(*argCharacterMap)
|
characterMap(*argCharacterMap)
|
||||||
{
|
{
|
||||||
|
ConfigUtility& config = ConfigUtility::GetSingleton();
|
||||||
|
|
||||||
//setup the utility objects
|
//setup the utility objects
|
||||||
buttonImage.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
buttonImage.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
||||||
buttonImage.SetClipH(buttonImage.GetClipH()/3);
|
buttonImage.SetClipH(buttonImage.GetClipH()/3);
|
||||||
@@ -302,7 +303,7 @@ void InWorld::HandleCharacterNew(CharacterPacket* const argPacket) {
|
|||||||
newCharacter.SetHandle(argPacket->handle);
|
newCharacter.SetHandle(argPacket->handle);
|
||||||
newCharacter.SetAvatar(argPacket->avatar);
|
newCharacter.SetAvatar(argPacket->avatar);
|
||||||
|
|
||||||
newCharacter.GetSprite()->LoadSurface(config["dir.sprites"] + newCharacter.GetAvatar(), 4, 4);
|
newCharacter.GetSprite()->LoadSurface(ConfigUtility::GetSingleton()["dir.sprites"] + newCharacter.GetAvatar(), 4, 4);
|
||||||
|
|
||||||
newCharacter.SetOrigin(argPacket->origin);
|
newCharacter.SetOrigin(argPacket->origin);
|
||||||
newCharacter.SetMotion(argPacket->motion);
|
newCharacter.SetMotion(argPacket->motion);
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
#include "tile_sheet.hpp"
|
#include "tile_sheet.hpp"
|
||||||
|
|
||||||
//common
|
//common
|
||||||
#include "config_utility.hpp"
|
|
||||||
#include "frame_rate.hpp"
|
#include "frame_rate.hpp"
|
||||||
|
|
||||||
#include "character.hpp"
|
#include "character.hpp"
|
||||||
@@ -50,7 +49,6 @@ class InWorld : public BaseScene {
|
|||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
InWorld(
|
InWorld(
|
||||||
ConfigUtility* const argConfig,
|
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
int* const argAccountIndex,
|
int* const argAccountIndex,
|
||||||
@@ -94,7 +92,6 @@ protected:
|
|||||||
void UpdateMap();
|
void UpdateMap();
|
||||||
|
|
||||||
//shared parameters
|
//shared parameters
|
||||||
ConfigUtility& config;
|
|
||||||
UDPNetworkUtility& network;
|
UDPNetworkUtility& network;
|
||||||
int& clientIndex;
|
int& clientIndex;
|
||||||
int& accountIndex;
|
int& accountIndex;
|
||||||
|
|||||||
@@ -31,12 +31,10 @@
|
|||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
LobbyMenu::LobbyMenu(
|
LobbyMenu::LobbyMenu(
|
||||||
ConfigUtility* const argConfig,
|
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
int* const argAccountIndex
|
int* const argAccountIndex
|
||||||
):
|
):
|
||||||
config(*argConfig),
|
|
||||||
network(*argNetwork),
|
network(*argNetwork),
|
||||||
clientIndex(*argClientIndex),
|
clientIndex(*argClientIndex),
|
||||||
accountIndex(*argAccountIndex)
|
accountIndex(*argAccountIndex)
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ class LobbyMenu : public BaseScene {
|
|||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
LobbyMenu(
|
LobbyMenu(
|
||||||
ConfigUtility* const argConfig,
|
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
int* const argAccountIndex
|
int* const argAccountIndex
|
||||||
@@ -68,7 +67,7 @@ protected:
|
|||||||
void HandleJoinResponse(ClientPacket* const);
|
void HandleJoinResponse(ClientPacket* const);
|
||||||
|
|
||||||
//shared parameters
|
//shared parameters
|
||||||
ConfigUtility& config;
|
ConfigUtility& config = ConfigUtility::GetSingleton();
|
||||||
UDPNetworkUtility& network;
|
UDPNetworkUtility& network;
|
||||||
int& clientIndex;
|
int& clientIndex;
|
||||||
int& accountIndex;
|
int& accountIndex;
|
||||||
|
|||||||
@@ -21,13 +21,15 @@
|
|||||||
*/
|
*/
|
||||||
#include "main_menu.hpp"
|
#include "main_menu.hpp"
|
||||||
|
|
||||||
|
#include "config_utility.hpp"
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
//Public access members
|
//Public access members
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
MainMenu::MainMenu(ConfigUtility* const argConfig):
|
MainMenu::MainMenu() {
|
||||||
config(*argConfig)
|
ConfigUtility& config = ConfigUtility::GetSingleton();
|
||||||
{
|
|
||||||
//setup the utility objects
|
//setup the utility objects
|
||||||
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
||||||
image.SetClipH(image.GetClipH()/3);
|
image.SetClipH(image.GetClipH()/3);
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "base_scene.hpp"
|
#include "base_scene.hpp"
|
||||||
|
|
||||||
#include "config_utility.hpp"
|
|
||||||
#include "image.hpp"
|
#include "image.hpp"
|
||||||
#include "raster_font.hpp"
|
#include "raster_font.hpp"
|
||||||
#include "button.hpp"
|
#include "button.hpp"
|
||||||
@@ -32,7 +31,7 @@
|
|||||||
class MainMenu : public BaseScene {
|
class MainMenu : public BaseScene {
|
||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
MainMenu(ConfigUtility* const);
|
MainMenu();
|
||||||
~MainMenu();
|
~MainMenu();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -49,9 +48,6 @@ protected:
|
|||||||
void KeyDown(SDL_KeyboardEvent const&);
|
void KeyDown(SDL_KeyboardEvent const&);
|
||||||
void KeyUp(SDL_KeyboardEvent const&);
|
void KeyUp(SDL_KeyboardEvent const&);
|
||||||
|
|
||||||
//shared parameters
|
|
||||||
ConfigUtility& config;
|
|
||||||
|
|
||||||
//members
|
//members
|
||||||
Image image;
|
Image image;
|
||||||
RasterFont font;
|
RasterFont font;
|
||||||
|
|||||||
@@ -21,13 +21,15 @@
|
|||||||
*/
|
*/
|
||||||
#include "options_menu.hpp"
|
#include "options_menu.hpp"
|
||||||
|
|
||||||
|
#include "config_utility.hpp"
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
//Public access members
|
//Public access members
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
OptionsMenu::OptionsMenu(ConfigUtility* const argConfig):
|
OptionsMenu::OptionsMenu() {
|
||||||
config(*argConfig)
|
ConfigUtility& config = ConfigUtility::GetSingleton();
|
||||||
{
|
|
||||||
//setup the utility objects
|
//setup the utility objects
|
||||||
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
||||||
image.SetClipH(image.GetClipH()/3);
|
image.SetClipH(image.GetClipH()/3);
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "base_scene.hpp"
|
#include "base_scene.hpp"
|
||||||
|
|
||||||
#include "config_utility.hpp"
|
|
||||||
#include "image.hpp"
|
#include "image.hpp"
|
||||||
#include "raster_font.hpp"
|
#include "raster_font.hpp"
|
||||||
#include "button.hpp"
|
#include "button.hpp"
|
||||||
@@ -33,7 +32,7 @@
|
|||||||
class OptionsMenu : public BaseScene {
|
class OptionsMenu : public BaseScene {
|
||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
OptionsMenu(ConfigUtility* const);
|
OptionsMenu();
|
||||||
~OptionsMenu();
|
~OptionsMenu();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -50,9 +49,6 @@ protected:
|
|||||||
void KeyDown(SDL_KeyboardEvent const&);
|
void KeyDown(SDL_KeyboardEvent const&);
|
||||||
void KeyUp(SDL_KeyboardEvent const&);
|
void KeyUp(SDL_KeyboardEvent const&);
|
||||||
|
|
||||||
//shared parameters
|
|
||||||
ConfigUtility& config;
|
|
||||||
|
|
||||||
//members
|
//members
|
||||||
Image image;
|
Image image;
|
||||||
RasterFont font;
|
RasterFont font;
|
||||||
|
|||||||
@@ -21,14 +21,14 @@
|
|||||||
*/
|
*/
|
||||||
#include "splash_screen.hpp"
|
#include "splash_screen.hpp"
|
||||||
|
|
||||||
|
#include "config_utility.hpp"
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
//Public access members
|
//Public access members
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
SplashScreen::SplashScreen(ConfigUtility* const argConfig):
|
SplashScreen::SplashScreen() {
|
||||||
config(*argConfig)
|
logo.LoadSurface(ConfigUtility::GetSingleton()["dir.logos"] + "krstudios.bmp");
|
||||||
{
|
|
||||||
logo.LoadSurface(config["dir.logos"] + "krstudios.bmp");
|
|
||||||
startTick = std::chrono::steady_clock::now();
|
startTick = std::chrono::steady_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "base_scene.hpp"
|
#include "base_scene.hpp"
|
||||||
|
|
||||||
#include "config_utility.hpp"
|
|
||||||
#include "image.hpp"
|
#include "image.hpp"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -32,7 +31,7 @@
|
|||||||
class SplashScreen : public BaseScene {
|
class SplashScreen : public BaseScene {
|
||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
SplashScreen(ConfigUtility* const);
|
SplashScreen();
|
||||||
~SplashScreen();
|
~SplashScreen();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -40,9 +39,6 @@ protected:
|
|||||||
void Update(double delta);
|
void Update(double delta);
|
||||||
void Render(SDL_Surface* const);
|
void Render(SDL_Surface* const);
|
||||||
|
|
||||||
//shared parameters
|
|
||||||
ConfigUtility& config;
|
|
||||||
|
|
||||||
//members
|
//members
|
||||||
std::chrono::steady_clock::time_point startTick;
|
std::chrono::steady_clock::time_point startTick;
|
||||||
Image logo;
|
Image logo;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ server.name = local
|
|||||||
server.dbname = database.db
|
server.dbname = database.db
|
||||||
|
|
||||||
#client specific settings
|
#client specific settings
|
||||||
|
#client.screen.w = 800
|
||||||
|
#client.screen.h = 600
|
||||||
client.screen.f = false
|
client.screen.f = false
|
||||||
|
|
||||||
client.username = Kayne Ruse
|
client.username = Kayne Ruse
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
#include "server_application.hpp"
|
#include "server_application.hpp"
|
||||||
|
|
||||||
|
//singletons
|
||||||
|
#include "config_utility.hpp"
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -28,10 +31,17 @@ using namespace std;
|
|||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
try {
|
try {
|
||||||
|
//create the singletons
|
||||||
|
ConfigUtility::Create();
|
||||||
|
|
||||||
|
//call the server's routines
|
||||||
ServerApplication app;
|
ServerApplication app;
|
||||||
app.Init(argc, argv);
|
app.Init(argc, argv);
|
||||||
app.Proc();
|
app.Proc();
|
||||||
app.Quit();
|
app.Quit();
|
||||||
|
|
||||||
|
//delete the singletons
|
||||||
|
ConfigUtility::Delete();
|
||||||
}
|
}
|
||||||
catch(exception& e) {
|
catch(exception& e) {
|
||||||
cerr << "Fatal exception thrown: " << e.what() << endl;
|
cerr << "Fatal exception thrown: " << e.what() << endl;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ private:
|
|||||||
sqlite3* database = nullptr;
|
sqlite3* database = nullptr;
|
||||||
lua_State* luaState = nullptr;
|
lua_State* luaState = nullptr;
|
||||||
UDPNetworkUtility network;
|
UDPNetworkUtility network;
|
||||||
ConfigUtility config;
|
ConfigUtility& config = ConfigUtility::GetSingleton();
|
||||||
|
|
||||||
//simple tables
|
//simple tables
|
||||||
std::map<int, ClientData> clientMap;
|
std::map<int, ClientData> clientMap;
|
||||||
|
|||||||
Reference in New Issue
Block a user