#include "gui.hpp" #include "dinkyecs.hpp" #include "systems.hpp" #include "events.hpp" #include "components.hpp" #include "dbc.hpp" #include "collider.hpp" #include "render.hpp" #include "config.hpp" #include "ftxui/screen/terminal.hpp" // for SetColorSupport, Color, TrueColor using namespace ftxui; /* * This needs to be turned into a real world generator * system. */ void configure_world(DinkyECS::World &world, Map &game_map) { const auto &config = world.get_the(); // this sets up the gui event system world.set_the(Events::GUI::START); // configure a player as a fact of the world Player player{world.entity()}; world.set_the(player); spatial_map collider; world.set_the(collider); world.set(player.entity, {game_map.place_entity(0)}); world.set(player.entity, {0, 0}); world.set(player.entity, {100, 10}); world.set(player.entity, {config.PLAYER_TILE}); auto enemy = world.entity(); world.set(enemy, {game_map.place_entity(1)}); world.set(enemy, {0,0}); world.set(enemy, {20, 10}); world.set(enemy, {config.ENEMY_TILE}); auto enemy2 = world.entity(); world.set(enemy2, {game_map.place_entity(2)}); world.set(enemy2, {0,0}); world.set(enemy2, {20, 10}); world.set(enemy2, {"*"}); auto gold = world.entity(); world.set(gold, {game_map.place_entity(game_map.room_count() - 1)}); world.set(gold, {100}); world.set(gold, {"$"}); } int main() { DinkyECS::World world; Config config("./assets/config.json"); world.set_the(config); auto map = config["map"]; world.set_the({ map["WALL_TILE"], map["FLOOR_TILE"], map["PLAYER_TILE"], map["ENEMY_TILE"], map["BG_TILE"] }); auto enemy = config["enemy"]; world.set_the({ enemy["HEARING_DISTANCE"] }); Map game_map(GAME_MAP_X, GAME_MAP_Y); game_map.generate(); configure_world(world, game_map); System::init_positions(world); GUI gui(world, game_map); return gui.main(); }