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

This commit is contained in:
Zed A. Shaw 2024-10-04 16:57:11 -04:00
parent 5cf66aad02
commit 6f952bfd28
3 changed files with 14 additions and 6 deletions

11
gui.cpp
View file

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