|
|
@ -1,31 +1,21 @@ |
|
|
|
#pragma once |
|
|
|
#pragma once |
|
|
|
#include <SFML/Graphics.hpp> |
|
|
|
#include <SFML/Graphics.hpp> |
|
|
|
#include "guecs/dbc.hpp" |
|
|
|
#include "guecs/dbc.hpp" |
|
|
|
#include "guecs/sfml/color.hpp" |
|
|
|
|
|
|
|
#include "guecs/lel.hpp" |
|
|
|
#include "guecs/lel.hpp" |
|
|
|
#include <string> |
|
|
|
#include <string> |
|
|
|
#include <memory> |
|
|
|
#include <memory> |
|
|
|
#include <functional> |
|
|
|
#include <functional> |
|
|
|
#include <any> |
|
|
|
#include <any> |
|
|
|
|
|
|
|
#include "guecs/theme.hpp" |
|
|
|
|
|
|
|
|
|
|
|
namespace guecs { |
|
|
|
namespace guecs { |
|
|
|
using std::shared_ptr, std::wstring, std::string; |
|
|
|
using std::shared_ptr, std::wstring, std::string; |
|
|
|
|
|
|
|
|
|
|
|
constexpr const int PADDING = 3; |
|
|
|
|
|
|
|
constexpr const int BORDER_PX = 1; |
|
|
|
|
|
|
|
constexpr const int TEXT_SIZE = 30; |
|
|
|
|
|
|
|
constexpr const int LABEL_SIZE = 20; |
|
|
|
|
|
|
|
constexpr const sf::Color FILL_COLOR = ColorValue::DARK_MID; |
|
|
|
|
|
|
|
constexpr const sf::Color TEXT_COLOR = ColorValue::LIGHT_LIGHT; |
|
|
|
|
|
|
|
constexpr const sf::Color BG_COLOR = ColorValue::MID; |
|
|
|
|
|
|
|
constexpr const sf::Color BORDER_COLOR = ColorValue::MID; |
|
|
|
|
|
|
|
constexpr const char *FONT_FILE_NAME="assets/text.otf"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Textual { |
|
|
|
struct Textual { |
|
|
|
std::wstring content; |
|
|
|
std::wstring content; |
|
|
|
unsigned int size = TEXT_SIZE; |
|
|
|
unsigned int size = THEME.TEXT_SIZE; |
|
|
|
sf::Color color = TEXT_COLOR; |
|
|
|
sf::Color color = THEME.TEXT_COLOR; |
|
|
|
int padding = PADDING; |
|
|
|
int padding = THEME.PADDING; |
|
|
|
bool centered = false; |
|
|
|
bool centered = false; |
|
|
|
shared_ptr<sf::Font> font = nullptr; |
|
|
|
shared_ptr<sf::Font> font = nullptr; |
|
|
|
shared_ptr<sf::Text> text = nullptr; |
|
|
|
shared_ptr<sf::Text> text = nullptr; |
|
|
@ -39,7 +29,7 @@ namespace guecs { |
|
|
|
Label(Args... args) : Textual(args...) |
|
|
|
Label(Args... args) : Textual(args...) |
|
|
|
{ |
|
|
|
{ |
|
|
|
centered = true; |
|
|
|
centered = true; |
|
|
|
size = LABEL_SIZE; |
|
|
|
size = THEME.LABEL_SIZE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Label() { |
|
|
|
Label() { |
|
|
@ -55,7 +45,7 @@ namespace guecs { |
|
|
|
// or there's a static config function you call once,
|
|
|
|
// or there's a static config function you call once,
|
|
|
|
// that's passed an object with all the necessary gear
|
|
|
|
// that's passed an object with all the necessary gear
|
|
|
|
string name; |
|
|
|
string name; |
|
|
|
int padding = PADDING; |
|
|
|
int padding = THEME.PADDING; |
|
|
|
std::shared_ptr<sf::Sprite> sprite = nullptr; |
|
|
|
std::shared_ptr<sf::Sprite> sprite = nullptr; |
|
|
|
|
|
|
|
|
|
|
|
void init(lel::Cell &cell); |
|
|
|
void init(lel::Cell &cell); |
|
|
@ -63,10 +53,10 @@ namespace guecs { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
struct Rectangle { |
|
|
|
struct Rectangle { |
|
|
|
int padding = PADDING; |
|
|
|
int padding = THEME.PADDING; |
|
|
|
sf::Color color = FILL_COLOR; |
|
|
|
sf::Color color = THEME.FILL_COLOR; |
|
|
|
sf::Color border_color = BORDER_COLOR; |
|
|
|
sf::Color border_color = THEME.BORDER_COLOR; |
|
|
|
int border_px = BORDER_PX; |
|
|
|
int border_px = THEME.BORDER_PX; |
|
|
|
shared_ptr<sf::RectangleShape> shape = nullptr; |
|
|
|
shared_ptr<sf::RectangleShape> shape = nullptr; |
|
|
|
|
|
|
|
|
|
|
|
void init(lel::Cell& cell); |
|
|
|
void init(lel::Cell& cell); |
|
|
@ -74,7 +64,7 @@ namespace guecs { |
|
|
|
|
|
|
|
|
|
|
|
struct Meter { |
|
|
|
struct Meter { |
|
|
|
float percent = 1.0f; |
|
|
|
float percent = 1.0f; |
|
|
|
sf::Color color = ColorValue::BLACK; |
|
|
|
sf::Color color = THEME.BG_COLOR_DARK; |
|
|
|
Rectangle bar; |
|
|
|
Rectangle bar; |
|
|
|
|
|
|
|
|
|
|
|
void init(lel::Cell& cell); |
|
|
|
void init(lel::Cell& cell); |
|
|
@ -108,10 +98,10 @@ namespace guecs { |
|
|
|
float y = 0.0f; |
|
|
|
float y = 0.0f; |
|
|
|
float w = 0.0f; |
|
|
|
float w = 0.0f; |
|
|
|
float h = 0.0f; |
|
|
|
float h = 0.0f; |
|
|
|
sf::Color color = BG_COLOR; |
|
|
|
sf::Color color = THEME.BG_COLOR; |
|
|
|
shared_ptr<sf::RectangleShape> shape = nullptr; |
|
|
|
shared_ptr<sf::RectangleShape> shape = nullptr; |
|
|
|
|
|
|
|
|
|
|
|
Background(lel::Parser& parser, sf::Color bg_color=BG_COLOR) : |
|
|
|
Background(lel::Parser& parser, sf::Color bg_color=THEME.BG_COLOR) : |
|
|
|
x(parser.grid_x), |
|
|
|
x(parser.grid_x), |
|
|
|
y(parser.grid_y), |
|
|
|
y(parser.grid_y), |
|
|
|
w(parser.grid_w), |
|
|
|
w(parser.grid_w), |
|
|
|