Added config based directories
This commit is contained in:
@@ -62,7 +62,7 @@ void ClientApplication::Init() {
|
||||
if (SDL_Init(SDL_INIT_VIDEO)) {
|
||||
throw(std::runtime_error("Failed to initialize SDL"));
|
||||
}
|
||||
BaseScene::SetScreen(800, 600);
|
||||
BaseScene::SetScreen(config.Int("screen.w"), config.Int("screen.h"), 0, (config.Bool("screen.f")) ? SDL_HWSURFACE|SDL_DOUBLEBUF : SDL_HWSURFACE);
|
||||
|
||||
//initialize SDL_net
|
||||
if (SDLNet_Init()) {
|
||||
@@ -126,13 +126,13 @@ void ClientApplication::LoadScene(SceneList sceneIndex) {
|
||||
//add scene creation calls here
|
||||
case SceneList::FIRST:
|
||||
case SceneList::SPLASHSCREEN:
|
||||
activeScene = new SplashScreen();
|
||||
activeScene = new SplashScreen(&config);
|
||||
break;
|
||||
case SceneList::MAINMENU:
|
||||
activeScene = new MainMenu();
|
||||
activeScene = new MainMenu(&config);
|
||||
break;
|
||||
case SceneList::OPTIONSMENU:
|
||||
activeScene = new OptionsMenu();
|
||||
activeScene = new OptionsMenu(&config);
|
||||
break;
|
||||
case SceneList::LOBBYMENU:
|
||||
activeScene = new LobbyMenu(&config, &network);
|
||||
|
||||
@@ -30,9 +30,9 @@ LobbyMenu::LobbyMenu(ConfigUtility* const arg1, UDPNetworkUtility* const arg2):
|
||||
network(*arg2)
|
||||
{
|
||||
//setup the utility objects
|
||||
image.LoadSurface("rsc\\graphics\\interface\\button_menu.bmp");
|
||||
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
||||
image.SetClipH(image.GetClipH()/3);
|
||||
font.LoadSurface("rsc\\graphics\\fonts\\pk_white_8.bmp");
|
||||
font.LoadSurface(config["dir.fonts"] + "pk_white_8.bmp");
|
||||
|
||||
//pass the utility objects
|
||||
search.SetImage(&image);
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
class LobbyMenu : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
LobbyMenu() = delete;
|
||||
LobbyMenu(ConfigUtility* const, UDPNetworkUtility* const);
|
||||
~LobbyMenu();
|
||||
|
||||
@@ -55,7 +54,7 @@ protected:
|
||||
void KeyDown(SDL_KeyboardEvent const&);
|
||||
void KeyUp(SDL_KeyboardEvent const&);
|
||||
|
||||
//handles
|
||||
//global
|
||||
ConfigUtility& config;
|
||||
UDPNetworkUtility& network;
|
||||
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
//Public access members
|
||||
//-------------------------
|
||||
|
||||
MainMenu::MainMenu() {
|
||||
MainMenu::MainMenu(ConfigUtility* const arg1):
|
||||
config(*arg1)
|
||||
{
|
||||
//setup the utility objects
|
||||
image.LoadSurface("rsc\\graphics\\interface\\button_menu.bmp");
|
||||
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
||||
image.SetClipH(image.GetClipH()/3);
|
||||
font.LoadSurface("rsc\\graphics\\fonts\\pk_white_8.bmp");
|
||||
font.LoadSurface(config["dir.fonts"] + "pk_white_8.bmp");
|
||||
|
||||
//pass the utility objects
|
||||
startButton.SetImage(&image);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "base_scene.hpp"
|
||||
|
||||
#include "config_utility.hpp"
|
||||
#include "image.hpp"
|
||||
#include "raster_font.hpp"
|
||||
#include "button.hpp"
|
||||
@@ -31,7 +32,7 @@
|
||||
class MainMenu : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
MainMenu();
|
||||
MainMenu(ConfigUtility* const);
|
||||
~MainMenu();
|
||||
|
||||
protected:
|
||||
@@ -48,6 +49,9 @@ protected:
|
||||
void KeyDown(SDL_KeyboardEvent const&);
|
||||
void KeyUp(SDL_KeyboardEvent const&);
|
||||
|
||||
//globals
|
||||
ConfigUtility& config;
|
||||
|
||||
//members
|
||||
Image image;
|
||||
RasterFont font;
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
//Public access members
|
||||
//-------------------------
|
||||
|
||||
OptionsMenu::OptionsMenu() {
|
||||
OptionsMenu::OptionsMenu(ConfigUtility* const arg1):
|
||||
config(*arg1)
|
||||
{
|
||||
//setup the utility objects
|
||||
image.LoadSurface("rsc\\graphics\\interface\\button_menu.bmp");
|
||||
image.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
||||
image.SetClipH(image.GetClipH()/3);
|
||||
font.LoadSurface("rsc\\graphics\\fonts\\pk_white_8.bmp");
|
||||
font.LoadSurface(config["dir.fonts"] + "pk_white_8.bmp");
|
||||
|
||||
//pass the utility objects
|
||||
backButton.SetImage(&image);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "base_scene.hpp"
|
||||
|
||||
#include "config_utility.hpp"
|
||||
#include "image.hpp"
|
||||
#include "raster_font.hpp"
|
||||
#include "button.hpp"
|
||||
@@ -31,7 +32,7 @@
|
||||
class OptionsMenu : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
OptionsMenu();
|
||||
OptionsMenu(ConfigUtility* const);
|
||||
~OptionsMenu();
|
||||
|
||||
protected:
|
||||
@@ -48,6 +49,9 @@ protected:
|
||||
void KeyDown(SDL_KeyboardEvent const&);
|
||||
void KeyUp(SDL_KeyboardEvent const&);
|
||||
|
||||
//globals
|
||||
ConfigUtility& config;
|
||||
|
||||
//members
|
||||
Image image;
|
||||
RasterFont font;
|
||||
|
||||
@@ -25,8 +25,10 @@
|
||||
//Public access members
|
||||
//-------------------------
|
||||
|
||||
SplashScreen::SplashScreen() {
|
||||
logo.LoadSurface("rsc\\graphics\\logos\\krstudios.bmp");
|
||||
SplashScreen::SplashScreen(ConfigUtility* const arg1):
|
||||
config(*arg1)
|
||||
{
|
||||
logo.LoadSurface(config["dir.logos"] + "krstudios.bmp");
|
||||
startTick = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "base_scene.hpp"
|
||||
|
||||
#include "config_utility.hpp"
|
||||
#include "image.hpp"
|
||||
|
||||
#include <chrono>
|
||||
@@ -31,7 +32,7 @@
|
||||
class SplashScreen : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
SplashScreen();
|
||||
SplashScreen(ConfigUtility* const);
|
||||
~SplashScreen();
|
||||
|
||||
protected:
|
||||
@@ -39,6 +40,9 @@ protected:
|
||||
void Update(double delta);
|
||||
void Render(SDL_Surface* const);
|
||||
|
||||
//globals
|
||||
ConfigUtility& config;
|
||||
|
||||
//members
|
||||
std::chrono::steady_clock::time_point startTick;
|
||||
Image logo;
|
||||
|
||||
Reference in New Issue
Block a user