Renderer is now more standalone and doesn't try to protect against small maps, that's the GUI's job.

This commit is contained in:
Zed A. Shaw 2024-11-21 15:51:22 -05:00
parent 19b8bf1850
commit 15a302d133
11 changed files with 65 additions and 90 deletions

View file

@ -13,18 +13,21 @@
using ftxui::Canvas, ftxui::Screen;
const int VIDEO_X = 1600;
const int VIDEO_Y = 900;
const int MIN_FONT_SIZE = 20;
const int MAX_FONT_SIZE = 140;
const int GAME_MAP_POS = 600;
const int UI_FONT_SIZE=30;
const int BASE_MAP_FONT_SIZE=90;
const wchar_t BG_TILE = L'';
const wchar_t UI_BASE_CHAR = L'';
const int BG_BOX_OFFSET=5;
struct RenderConfig {
int video_x = 1600;
int video_y = 900;
int ui_font_size=30;
int base_map_font_size=90;
wchar_t bg_tile = L'';
wchar_t ui_base_char = L'';
int bg_box_offset=5;
int game_map_x=40;
int game_map_y=40;
};
struct SFMLRender {
RenderConfig $config;
sf::RenderWindow $window;
int $map_font_size;
float $line_spacing;
@ -47,7 +50,7 @@ struct SFMLRender {
SFMLRender(SFMLRender &other) = delete;
sf::Sprite &get_text_sprite(wchar_t tile);
bool resize_grid(int new_size, Point &view_port);
bool resize_grid(int new_size, Panel &panel_out);
void render_grid(const std::wstring &text, float x, float y);
void render_text(const std::wstring &text, sf::Color bgcolor, float x, float y);