Fixed the screen sizing issue. It was just using the terminal size and not the window graphic size.

main
Zed A. Shaw 3 months ago
parent 5cf66aad02
commit 6f952bfd28
  1. 11
      gui.cpp
  2. 7
      gui.hpp
  3. 2
      status.txt

@ -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;

@ -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,

@ -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?

Loading…
Cancel
Save