|
|
|
@ -6,8 +6,7 @@ |
|
|
|
|
#include "dbc.hpp" |
|
|
|
|
#include "collider.hpp" |
|
|
|
|
#include "render.hpp" |
|
|
|
|
#include "config.hpp" |
|
|
|
|
|
|
|
|
|
#include "save.hpp" |
|
|
|
|
#include "ftxui/screen/terminal.hpp" // for SetColorSupport, Color, TrueColor |
|
|
|
|
|
|
|
|
|
using namespace ftxui; |
|
|
|
@ -25,9 +24,6 @@ void configure_world(DinkyECS::World &world, Map &game_map) { |
|
|
|
|
Player player{world.entity()}; |
|
|
|
|
world.set_the<Player>(player); |
|
|
|
|
|
|
|
|
|
spatial_map collider; |
|
|
|
|
world.set_the<spatial_map>(collider); |
|
|
|
|
|
|
|
|
|
world.set<Position>(player.entity, {game_map.place_entity(0)}); |
|
|
|
|
world.set<Motion>(player.entity, {0, 0}); |
|
|
|
|
world.set<Combat>(player.entity, {100, 10}); |
|
|
|
@ -55,27 +51,14 @@ void configure_world(DinkyECS::World &world, Map &game_map) { |
|
|
|
|
int main() { |
|
|
|
|
DinkyECS::World world; |
|
|
|
|
|
|
|
|
|
Config config("./assets/config.json"); |
|
|
|
|
world.set_the<Config>(config); |
|
|
|
|
|
|
|
|
|
auto map = config["map"]; |
|
|
|
|
world.set_the<MapConfig>({ |
|
|
|
|
map["WALL_TILE"], |
|
|
|
|
map["FLOOR_TILE"], |
|
|
|
|
map["PLAYER_TILE"], |
|
|
|
|
map["ENEMY_TILE"], |
|
|
|
|
map["BG_TILE"] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
auto enemy = config["enemy"]; |
|
|
|
|
world.set_the<EnemyConfig>({ |
|
|
|
|
enemy["HEARING_DISTANCE"] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
Map game_map(GAME_MAP_X, GAME_MAP_Y); |
|
|
|
|
game_map.generate(); |
|
|
|
|
|
|
|
|
|
save::load_configs(world); |
|
|
|
|
configure_world(world, game_map); |
|
|
|
|
|
|
|
|
|
spatial_map collider; |
|
|
|
|
world.set_the<spatial_map>(collider); |
|
|
|
|
System::init_positions(world); |
|
|
|
|
|
|
|
|
|
GUI gui(world, game_map); |
|
|
|
|