|
|
|
@ -8,13 +8,14 @@ |
|
|
|
|
#include "texture.hpp" |
|
|
|
|
#include <functional> |
|
|
|
|
#include "events.hpp" |
|
|
|
|
#include "constants.hpp" |
|
|
|
|
|
|
|
|
|
namespace guecs { |
|
|
|
|
using std::shared_ptr, std::make_shared; |
|
|
|
|
|
|
|
|
|
struct Label { |
|
|
|
|
std::string label; |
|
|
|
|
unsigned int size = 30; |
|
|
|
|
unsigned int size = GUECS_FONT_SIZE; |
|
|
|
|
shared_ptr<sf::Font> font = nullptr; |
|
|
|
|
shared_ptr<sf::Text> text = nullptr; |
|
|
|
|
|
|
|
|
@ -30,14 +31,14 @@ namespace guecs { |
|
|
|
|
|
|
|
|
|
struct Textual { |
|
|
|
|
std::string content; |
|
|
|
|
unsigned int size = 30; |
|
|
|
|
unsigned int size = GUECS_FONT_SIZE; |
|
|
|
|
shared_ptr<sf::Font> font = nullptr; |
|
|
|
|
shared_ptr<sf::Text> text = nullptr; |
|
|
|
|
|
|
|
|
|
void init(lel::Cell &cell, shared_ptr<sf::Font> font_ptr) { |
|
|
|
|
if(font == nullptr) font = font_ptr; |
|
|
|
|
if(text == nullptr) text = make_shared<sf::Text>(*font, content, size); |
|
|
|
|
text->setPosition({float(cell.x + 6), float(cell.y + 6)}); |
|
|
|
|
text->setPosition({float(cell.x + GUECS_PADDING * 2), float(cell.y + GUECS_PADDING * 2)}); |
|
|
|
|
text->setCharacterSize(size); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -61,12 +62,12 @@ namespace guecs { |
|
|
|
|
shared_ptr<sf::RectangleShape> shape = nullptr; |
|
|
|
|
|
|
|
|
|
void init(lel::Cell& cell) { |
|
|
|
|
sf::Vector2f size{float(cell.w) - 6, float(cell.h) - 6}; |
|
|
|
|
sf::Vector2f size{float(cell.w) - GUECS_PADDING * 2, float(cell.h) - GUECS_PADDING * 2}; |
|
|
|
|
if(shape == nullptr) shape = make_shared<sf::RectangleShape>(size); |
|
|
|
|
shape->setPosition({float(cell.x + 3), float(cell.y + 3)}); |
|
|
|
|
shape->setFillColor(ColorValue::DARK_MID); |
|
|
|
|
shape->setOutlineColor(ColorValue::MID); |
|
|
|
|
shape->setOutlineThickness(1); |
|
|
|
|
shape->setPosition({float(cell.x + GUECS_PADDING), float(cell.y + GUECS_PADDING)}); |
|
|
|
|
shape->setFillColor(GUECS_FILL_COLOR); |
|
|
|
|
shape->setOutlineColor(GUECS_BORDER_COLOR); |
|
|
|
|
shape->setOutlineThickness(GUECS_BORDER_PX); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -104,7 +105,7 @@ namespace guecs { |
|
|
|
|
sf::Vector2f size{float(w), float(h)}; |
|
|
|
|
if(shape == nullptr) shape = make_shared<sf::RectangleShape>(size); |
|
|
|
|
shape->setPosition({float(x), float(y)}); |
|
|
|
|
shape->setFillColor(ColorValue::MID); |
|
|
|
|
shape->setFillColor(GUECS_BG_COLOR); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|