Include all map initializations and use configuration file

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
pull/28/head
Nic0Nic0Nii 1 year ago
parent 68393d2b07
commit 1e08589403
  1. 14
      Crawler/Crawler.cpp
  2. 5
      Crawler/Map.h
  3. 5
      Crawler/assets/config/configuration.txt
  4. 11
      Crawler/assets/config/levels.txt

@ -47,11 +47,21 @@ Crawler::Crawler()
std::string GFX_CONFIG = CONFIG_PATH + "gfx_config"_S;
utils::datafile::Read(DATA,GFX_CONFIG);
WINDOW_SIZE={"WINDOW_SIZE"_i[0],"WINDOW_SIZE"_i[1]};
std::cout<<WINDOW_SIZE<<std::endl;
std::string MAP_CONFIG = CONFIG_PATH + "map_config"_S;
utils::datafile::Read(DATA,MAP_CONFIG);
}
bool Crawler::OnUserCreate(){
InitializeLevel("assets/Campaigns/1_1.tmx",CAMPAIGN_1_1);
#define INITLEVEL(map) InitializeLevel("map_path"_S + "Levels."#map ## _S,map);
INITLEVEL(WORLD_MAP);
INITLEVEL(CAMPAIGN_1_1);
INITLEVEL(BOSS_1);
INITLEVEL(CAMPAIGN_1_2);
player=std::make_unique<Warrior>();

@ -4,9 +4,10 @@
struct XMLTag;
enum MapName{
LEVEL1,
LEVEL2,
CAMPAIGN_1_1,
CAMPAIGN_1_2,
BOSS_1,
WORLD_MAP
};
struct TileCollisionData{

@ -4,4 +4,7 @@ config_path = assets/config/
WINDOW_SIZE = 360,240
# Graphics Loading Config
gfx_config = gfx/gfx.txt
gfx_config = gfx/gfx.txt
# Map Files Loading Config
map_config = levels.txt

@ -0,0 +1,11 @@
map_path = assets/Campaigns/
Levels
{
WORLD_MAP = World_Map.tmx
CAMPAIGN_1_1 = 1_1.tmx
BOSS_1 = Boss_1.tmx
CAMPAIGN_1_2 = 1_2.tmx
}
Loading…
Cancel
Save