Fixed the screen sizing issue. It was just using the terminal size and not the window graphic size.
This commit is contained in:
parent
5cf66aad02
commit
6f952bfd28
3 changed files with 14 additions and 6 deletions
11
gui.cpp
11
gui.cpp
|
@ -40,10 +40,10 @@ sf::Color GUI::color(Value val) {
|
||||||
return VALUES[size_t(val)];
|
return VALUES[size_t(val)];
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI::GUI() : $game_map(50, 20),
|
GUI::GUI() : $game_map(GAME_MAP_X, GAME_MAP_Y),
|
||||||
$canvas(60 * 2, 20 * 4),
|
$canvas(GAME_MAP_X * 2, GAME_MAP_Y * 4),
|
||||||
$window(sf::VideoMode(1600,900), "Roguish"),
|
$window(sf::VideoMode(VIDEO_X,VIDEO_Y), "Roguish"),
|
||||||
$screen(0,0)
|
$screen(SCREEN_X, SCREEN_Y)
|
||||||
{
|
{
|
||||||
int res = $hit_buf.loadFromFile("./assets/hit.wav");
|
int res = $hit_buf.loadFromFile("./assets/hit.wav");
|
||||||
dbc::check(res, "failed to load 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);
|
$player.location = $game_map.place_entity(0);
|
||||||
$enemy.location = $game_map.place_entity(1);
|
$enemy.location = $game_map.place_entity(1);
|
||||||
$goal = $game_map.place_entity($game_map.room_count() - 1);
|
$goal = $game_map.place_entity($game_map.room_count() - 1);
|
||||||
$screen = Screen::Create(Dimension::Full());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::create_renderer() {
|
void GUI::create_renderer() {
|
||||||
|
@ -165,6 +164,8 @@ int GUI::main() {
|
||||||
while($window.isOpen()) {
|
while($window.isOpen()) {
|
||||||
render_scene();
|
render_scene();
|
||||||
handle_events();
|
handle_events();
|
||||||
|
|
||||||
|
std::this_thread::sleep_for(10ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
7
gui.hpp
7
gui.hpp
|
@ -16,6 +16,13 @@
|
||||||
using std::string;
|
using std::string;
|
||||||
using ftxui::Canvas, ftxui::Component, ftxui::Screen;
|
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 {
|
enum class Value {
|
||||||
BLACK=0, DARK_DARK, DARK_MID,
|
BLACK=0, DARK_DARK, DARK_MID,
|
||||||
DARK_LIGHT, MID, LIGHT_DARK, LIGHT_MID,
|
DARK_LIGHT, MID, LIGHT_DARK, LIGHT_MID,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
* Clean up the code to not be such a horrible hack mess.
|
|
||||||
* Figure out how to render color fonts from FTUI.
|
* Figure out how to render color fonts from FTUI.
|
||||||
|
* Dynamically determine the font vs. screensize to get an exact FTXUI screen size.
|
||||||
* Lua integration?
|
* Lua integration?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue