Now able to render the map at a different size from the rest of the UI and also only shake the map.

This commit is contained in:
Zed A. Shaw 2024-10-05 17:24:07 -04:00
parent 77945be4d7
commit b8a0d9bbd1
3 changed files with 55 additions and 28 deletions

18
gui.hpp
View file

@ -16,12 +16,19 @@
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 GAME_MAP_X = 30;
constexpr int GAME_MAP_Y = 15;
constexpr int GAME_MAP_POS = 600;
constexpr int SCREEN_X = 40;
constexpr int SCREEN_Y = 30;
constexpr int VIDEO_X = 1600;
constexpr int VIDEO_Y = 900;
constexpr int MAP_FONT_SIZE=60;
constexpr int UI_FONT_SIZE=30;
#define WALL_TILE "█"
#define FLOOR_TILE "·"
#define PLAYER_TILE "☺"
#define ENEMY_TILE "Ω"
enum class Value {
BLACK=0, DARK_DARK, DARK_MID,
@ -42,12 +49,14 @@ class GUI {
Component $map_view;
Canvas $canvas;
sf::Font $font;
sf::Text $text;
sf::Text $ui_text;
sf::Text $map_text;
bool $shake_it = false;
bool $burn_baby_burn = false;
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
sf::RenderWindow $window;
Screen $screen;
Screen $map_screen;
public:
GUI();
@ -59,6 +68,7 @@ public:
void create_renderer();
void render_scene();
void handle_events();
void draw_screen(bool clear=true, float map_off_x=0.0f, float map_off_y=0.0f);
void shake();
void burn();