Tinkering with a way to do modal UIs for things like inventory etc.

This commit is contained in:
Zed A. Shaw 2024-12-30 09:41:16 -05:00
parent db441000f8
commit d8400d0a76
9 changed files with 120 additions and 92 deletions

View file

@ -10,20 +10,23 @@
#include <codecvt>
#include "ansi_parser.hpp"
#include "panel.hpp"
#include "constants.hpp"
using ftxui::Canvas, ftxui::Screen;
/*
* BUG: This could be so much better.
*/
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;
int video_x = VIDEO_WINDOW_X;
int video_y = VIDEO_WINDOW_Y;
int ui_font_size=UI_FONT_SIZE;
int base_map_font_size=BASE_MAP_FONT_SIZE;
wchar_t bg_tile = BG_TILE;
wchar_t ui_base_char = UI_BASE_CHAR;
int bg_box_offset=BG_BOX_OFFSET;
int game_map_x=GAME_MAP_X;
int game_map_y=GAME_MAP_Y;
};
struct SFMLRender {
@ -55,6 +58,7 @@ struct SFMLRender {
void render_text(const std::wstring &text, sf::Color default_fg, sf::Color default_bg, float x, float y);
void draw(Panel &panel, float x_offset=0.0f, float y_offset=0.0f);
void draw_sprite(sf::Sprite &sprite, sf::Shader *shader);
bool poll_event(sf::Event &event) {
return $window.pollEvent(event);