Added config based directories
This commit is contained in:
@@ -51,10 +51,11 @@ EditorApplication::~EditorApplication() {
|
||||
}
|
||||
|
||||
void EditorApplication::Init() {
|
||||
config.Load("rsc\\config.cfg");
|
||||
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"));
|
||||
}
|
||||
|
||||
void EditorApplication::Proc() {
|
||||
@@ -110,11 +111,11 @@ void EditorApplication::LoadScene(SceneList sceneIndex) {
|
||||
//add scene creation calls here
|
||||
case SceneList::FIRST:
|
||||
case SceneList::EDITORSCENE:
|
||||
activeScene = new EditorScene();
|
||||
activeScene = new EditorScene(&config);
|
||||
break;
|
||||
|
||||
case SceneList::TESTIFICATESCENE:
|
||||
activeScene = new TestificateScene();
|
||||
activeScene = new TestificateScene(&config);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "scene_list.hpp"
|
||||
#include "base_scene.hpp"
|
||||
#include "config_utility.hpp"
|
||||
|
||||
class EditorApplication {
|
||||
private:
|
||||
@@ -43,6 +44,9 @@ private:
|
||||
void LoadScene(SceneList sceneIndex);
|
||||
void UnloadScene();
|
||||
|
||||
//globals
|
||||
ConfigUtility config;
|
||||
|
||||
BaseScene* activeScene = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,14 +33,16 @@ using namespace std;
|
||||
//Public access members
|
||||
//-------------------------
|
||||
|
||||
EditorScene::EditorScene() {
|
||||
EditorScene::EditorScene(ConfigUtility* const arg1):
|
||||
config(*arg1)
|
||||
{
|
||||
//create the debugging "window"
|
||||
debugInfo.CreateSurface(256, 256);
|
||||
|
||||
//setup the utility objects
|
||||
font.LoadSurface("rsc\\graphics\\fonts\\pk_white_8.bmp");
|
||||
font.LoadSurface(config["dir.fonts"] + "pk_white_8.bmp");
|
||||
|
||||
buttonImage.LoadSurface("rsc\\graphics\\interface\\button_menu.bmp");
|
||||
buttonImage.LoadSurface(config["dir.interface"] + "button_menu.bmp");
|
||||
buttonImage.SetClipH(buttonImage.GetClipH()/3);
|
||||
|
||||
//setup the menu bar
|
||||
@@ -66,7 +68,7 @@ EditorScene::EditorScene() {
|
||||
pager.SetWidth(32*4);
|
||||
pager.SetHeight(32*4);
|
||||
|
||||
sheetMgr.LoadSheet("rsc\\graphics\\tilesets\\terrain.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet(config["dir.tilesets"] + "terrain.bmp", 32, 32);
|
||||
}
|
||||
|
||||
EditorScene::~EditorScene() {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "region_pager.hpp"
|
||||
#include "tile_sheet_manager.hpp"
|
||||
|
||||
#include "config_utility.hpp"
|
||||
#include "image.hpp"
|
||||
#include "raster_font.hpp"
|
||||
#include "menu_bar.hpp"
|
||||
@@ -36,7 +37,7 @@
|
||||
class EditorScene : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
EditorScene();
|
||||
EditorScene(ConfigUtility* const);
|
||||
~EditorScene();
|
||||
|
||||
protected:
|
||||
@@ -53,7 +54,8 @@ protected:
|
||||
void KeyDown(SDL_KeyboardEvent const&);
|
||||
void KeyUp(SDL_KeyboardEvent const&);
|
||||
|
||||
//members
|
||||
//globals
|
||||
ConfigUtility& config;
|
||||
|
||||
//debugging tools
|
||||
void DrawToDebugInfo(std::string, int line);
|
||||
|
||||
@@ -30,12 +30,14 @@ using std::endl;
|
||||
//Public access members
|
||||
//-------------------------
|
||||
|
||||
TestificateScene::TestificateScene() {
|
||||
sheetMgr.LoadSheet("rsc\\graphics\\tilesets\\grass.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet("rsc\\graphics\\tilesets\\longgrass.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet("rsc\\graphics\\tilesets\\sand.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet("rsc\\graphics\\tilesets\\dirt.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet("rsc\\graphics\\tilesets\\water.bmp", 32, 32);
|
||||
TestificateScene::TestificateScene(ConfigUtility* const arg1):
|
||||
config(*arg1)
|
||||
{
|
||||
sheetMgr.LoadSheet(config["dir.tilesets"] + "grass.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet(config["dir.tilesets"] + "longgrass.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet(config["dir.tilesets"] + "sand.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet(config["dir.tilesets"] + "dirt.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet(config["dir.tilesets"] + "water.bmp", 32, 32);
|
||||
|
||||
cout << "Range End: " << sheetMgr.GetRangeEnd() << endl;
|
||||
|
||||
|
||||
@@ -24,13 +24,14 @@
|
||||
|
||||
#include "base_scene.hpp"
|
||||
|
||||
#include "config_utility.hpp"
|
||||
#include "tile_Sheet_manager.hpp"
|
||||
#include "region_pager.hpp"
|
||||
|
||||
class TestificateScene : public BaseScene {
|
||||
public:
|
||||
//Public access members
|
||||
TestificateScene();
|
||||
TestificateScene(ConfigUtility* const);
|
||||
~TestificateScene();
|
||||
|
||||
protected:
|
||||
@@ -47,6 +48,9 @@ protected:
|
||||
void KeyDown(SDL_KeyboardEvent const&);
|
||||
void KeyUp(SDL_KeyboardEvent const&);
|
||||
|
||||
//globals
|
||||
ConfigUtility& config;
|
||||
|
||||
//members
|
||||
TileSheetManager sheetMgr;
|
||||
RegionPager pager;
|
||||
|
||||
Reference in New Issue
Block a user