You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.7 KiB
73 lines
1.7 KiB
#pragma once
|
|
#include <SFML/Audio.hpp>
|
|
#include <SFML/Graphics/Color.hpp>
|
|
#include <SFML/Graphics/Font.hpp>
|
|
#include <SFML/Graphics/RenderWindow.hpp>
|
|
#include <SFML/Graphics/Text.hpp>
|
|
#include <codecvt>
|
|
#include <ftxui/component/component.hpp>
|
|
#include <ftxui/screen/screen.hpp>
|
|
#include <ftxui/dom/canvas.hpp>
|
|
#include <locale>
|
|
#include <string>
|
|
#include "map.hpp"
|
|
#include "dinkyecs.hpp"
|
|
|
|
using std::string;
|
|
using ftxui::Canvas, ftxui::Component, ftxui::Screen;
|
|
|
|
constexpr int GAME_MAP_X = 60;
|
|
constexpr int GAME_MAP_Y = 30;
|
|
constexpr int VIEW_PORT_X = 30;
|
|
constexpr int VIEW_PORT_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;
|
|
|
|
enum class Value {
|
|
BLACK=0, DARK_DARK, DARK_MID,
|
|
DARK_LIGHT, MID, LIGHT_DARK, LIGHT_MID,
|
|
LIGHT_LIGHT, WHITE, TRANSPARENT
|
|
};
|
|
|
|
class GUI {
|
|
Map $game_map;
|
|
sf::SoundBuffer $hit_buf;
|
|
sf::Sound $hit_sound;
|
|
bool $show_paths = false;
|
|
string $status_text = "NOT DEAD";
|
|
Component $document;
|
|
Component $map_view;
|
|
Canvas $canvas;
|
|
sf::Font $font;
|
|
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;
|
|
DinkyECS::World $world;
|
|
|
|
public:
|
|
GUI();
|
|
// disable copying
|
|
GUI(GUI &gui) = delete;
|
|
|
|
sf::Color color(Value val);
|
|
sf::Color color(int val);
|
|
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();
|
|
void configure_world();
|
|
|
|
int main();
|
|
};
|
|
|