Moved to SFML 3.0 now.

This commit is contained in:
Zed A. Shaw 2025-01-29 12:55:33 -05:00
parent 7c56f350ab
commit e05b2c304c
12 changed files with 167 additions and 173 deletions

View file

@ -11,6 +11,7 @@
#include "ansi_parser.hpp"
#include "panel.hpp"
#include "constants.hpp"
#include <optional>
using ftxui::Canvas, ftxui::Screen;
@ -18,8 +19,8 @@ using ftxui::Canvas, ftxui::Screen;
* BUG: This could be so much better.
*/
struct RenderConfig {
int video_x = VIDEO_WINDOW_X;
int video_y = VIDEO_WINDOW_Y;
unsigned int video_x = VIDEO_WINDOW_X;
unsigned 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;
@ -34,17 +35,18 @@ struct SFMLRender {
sf::RenderWindow $window;
int $map_font_size;
float $line_spacing;
std::unordered_map<wchar_t, sf::Sprite> $sprites;
sf::Font $font;
sf::Texture $font_texture;
sf::Glyph $base_glyph;
sf::Sprite $bg_sprite;
sf::FloatRect $grid_bounds;
sf::Text $ui_text;
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
sf::Color $default_fg;
sf::Color $default_bg;
sf::Texture $font_texture;
sf::Sprite $bg_sprite;
sf::Font $font;
sf::Text $ui_text;
ANSIParser $ansi;
std::unordered_map<wchar_t, sf::Sprite> $sprites;
sf::Glyph $base_glyph;
sf::FloatRect $grid_bounds;
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
sf::FloatRect $text_bounds;
SFMLRender();
@ -61,8 +63,8 @@ struct SFMLRender {
void draw_sprite(sf::Sprite &sprite, sf::Shader *shader);
void center_panel(Panel &panel);
bool poll_event(sf::Event &event) {
return $window.pollEvent(event);
std::optional<sf::Event> poll_event() {
return $window.pollEvent();
}
void close() { return $window.close(); }