More GUECS cleanup before releasing. Still need to sort out events and reduce the amount of stuff that GUECS needs.
This commit is contained in:
parent
1780a758b3
commit
abea6da2e0
10 changed files with 71 additions and 54 deletions
45
guecs.hpp
45
guecs.hpp
|
@ -1,20 +1,29 @@
|
|||
#pragma once
|
||||
#include "dbc.hpp"
|
||||
#include "color.hpp"
|
||||
#include "dinkyecs.hpp"
|
||||
#include "lel.hpp"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include "textures.hpp"
|
||||
#include <functional>
|
||||
#include "events.hpp"
|
||||
#include "constants.hpp"
|
||||
#include "components.hpp"
|
||||
#include <any>
|
||||
#include "shaders.hpp"
|
||||
#include <queue>
|
||||
#include <typeindex>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace guecs {
|
||||
using std::shared_ptr, std::make_shared, 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";
|
||||
|
||||
using std::shared_ptr, std::wstring, std::string;
|
||||
|
||||
using Entity = unsigned long;
|
||||
|
||||
|
@ -28,9 +37,9 @@ namespace guecs {
|
|||
|
||||
struct Textual {
|
||||
std::wstring content;
|
||||
unsigned int size = GUECS_FONT_SIZE;
|
||||
sf::Color color = GUECS_TEXT_COLOR;
|
||||
int padding = GUECS_PADDING;
|
||||
unsigned int size = TEXT_SIZE;
|
||||
sf::Color color = TEXT_COLOR;
|
||||
int padding = PADDING;
|
||||
bool centered = false;
|
||||
shared_ptr<sf::Font> font = nullptr;
|
||||
shared_ptr<sf::Text> text = nullptr;
|
||||
|
@ -44,6 +53,7 @@ namespace guecs {
|
|||
Label(Args... args) : Textual(args...)
|
||||
{
|
||||
centered = true;
|
||||
size = LABEL_SIZE;
|
||||
}
|
||||
|
||||
Label() {
|
||||
|
@ -60,7 +70,7 @@ namespace guecs {
|
|||
|
||||
struct Sprite {
|
||||
string name;
|
||||
int padding = GUECS_PADDING;
|
||||
int padding = PADDING;
|
||||
std::shared_ptr<sf::Sprite> sprite = nullptr;
|
||||
|
||||
void init(lel::Cell &cell);
|
||||
|
@ -68,10 +78,10 @@ namespace guecs {
|
|||
};
|
||||
|
||||
struct Rectangle {
|
||||
int padding = GUECS_PADDING;
|
||||
sf::Color color = GUECS_FILL_COLOR;
|
||||
sf::Color border_color = GUECS_BORDER_COLOR;
|
||||
int border_px = GUECS_BORDER_PX;
|
||||
int padding = PADDING;
|
||||
sf::Color color = FILL_COLOR;
|
||||
sf::Color border_color = BORDER_COLOR;
|
||||
int border_px = BORDER_PX;
|
||||
shared_ptr<sf::RectangleShape> shape = nullptr;
|
||||
|
||||
void init(lel::Cell& cell);
|
||||
|
@ -121,10 +131,10 @@ namespace guecs {
|
|||
float y = 0.0f;
|
||||
float w = 0.0f;
|
||||
float h = 0.0f;
|
||||
sf::Color color = GUECS_BG_COLOR;
|
||||
sf::Color color = BG_COLOR;
|
||||
shared_ptr<sf::RectangleShape> shape = nullptr;
|
||||
|
||||
Background(lel::Parser& parser, sf::Color bg_color=GUECS_BG_COLOR) :
|
||||
Background(lel::Parser& parser, sf::Color bg_color=BG_COLOR) :
|
||||
x(parser.grid_x),
|
||||
y(parser.grid_y),
|
||||
w(parser.grid_w),
|
||||
|
@ -353,7 +363,4 @@ namespace guecs {
|
|||
void show_text(const string& region, const wstring& content);
|
||||
void show_label(const string& region, const wstring& content);
|
||||
};
|
||||
|
||||
Clickable make_action(DinkyECS::World& target, Events::GUI event);
|
||||
Clickable make_action(DinkyECS::World& target, Events::GUI event, std::any data);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue