diff --git a/gui.cpp b/gui.cpp index 4cb54b3..b3f378a 100644 --- a/gui.cpp +++ b/gui.cpp @@ -40,10 +40,10 @@ sf::Color GUI::color(Value val) { return VALUES[size_t(val)]; } -GUI::GUI() : $game_map(50, 20), - $canvas(60 * 2, 20 * 4), - $window(sf::VideoMode(1600,900), "Roguish"), - $screen(0,0) +GUI::GUI() : $game_map(GAME_MAP_X, GAME_MAP_Y), + $canvas(GAME_MAP_X * 2, GAME_MAP_Y * 4), + $window(sf::VideoMode(VIDEO_X,VIDEO_Y), "Roguish"), + $screen(SCREEN_X, SCREEN_Y) { int res = $hit_buf.loadFromFile("./assets/hit.wav"); dbc::check(res, "failed to load hit.wav"); @@ -57,7 +57,6 @@ GUI::GUI() : $game_map(50, 20), $player.location = $game_map.place_entity(0); $enemy.location = $game_map.place_entity(1); $goal = $game_map.place_entity($game_map.room_count() - 1); - $screen = Screen::Create(Dimension::Full()); } void GUI::create_renderer() { @@ -165,6 +164,8 @@ int GUI::main() { while($window.isOpen()) { render_scene(); handle_events(); + + std::this_thread::sleep_for(10ms); } return 0; diff --git a/gui.hpp b/gui.hpp index 1c94f2c..ef1c196 100644 --- a/gui.hpp +++ b/gui.hpp @@ -16,6 +16,13 @@ using std::string; using ftxui::Canvas, ftxui::Component, ftxui::Screen; +constexpr int GAME_MAP_X = 60; +constexpr int GAME_MAP_Y = 30; +constexpr int SCREEN_X = 106; +constexpr int SCREEN_Y = 30; +constexpr int VIDEO_X = 1600; +constexpr int VIDEO_Y = 900; + enum class Value { BLACK=0, DARK_DARK, DARK_MID, DARK_LIGHT, MID, LIGHT_DARK, LIGHT_MID, diff --git a/status.txt b/status.txt index f145d8e..19a527c 100644 --- a/status.txt +++ b/status.txt @@ -1,5 +1,5 @@ TODO: -* Clean up the code to not be such a horrible hack mess. * Figure out how to render color fonts from FTUI. +* Dynamically determine the font vs. screensize to get an exact FTXUI screen size. * Lua integration?