diff --git a/assets/config.json b/assets/config.json new file mode 100644 index 0000000..484c2f7 --- /dev/null +++ b/assets/config.json @@ -0,0 +1,29 @@ +{ + "sounds": { + "you_died": "./assets/you_died.mp3", + "build_success": "./assets/build_success.mp3", + "build_failed": "./assets/build_failed.mp3", + "building": "./mysounds/building.mp3" + }, + "sprites": { + "build_success": { + "path": "./assets/build_success.png", + "frame_width": 240, + "frame_height": 240}, + "you_died": { + "path": "./assets/you_died.png", + "frame_width": 240, + "frame_height": 240}, + "build_failed": { + "path": "./assets/build_failed.png", + "frame_width": 240, + "frame_height": 240}, + "building": { + "path": "./assets/building.png", + "frame_width": 240, + "frame_height": 240} + }, + "graphics": { + "smooth_textures": false + } +} diff --git a/assets/tiles.json b/assets/tiles.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/assets/tiles.json @@ -0,0 +1 @@ +{} diff --git a/color.hpp b/color.hpp index 4026ba5..2998737 100644 --- a/color.hpp +++ b/color.hpp @@ -2,14 +2,14 @@ #include namespace ColorValue { - const sf::Color BLACK{0, 0, 0}; - const sf::Color DARK_DARK{10, 10, 10}; - const sf::Color DARK_MID{30, 30, 30}; - const sf::Color DARK_LIGHT{60, 60, 60}; - const sf::Color MID{100, 100, 100}; - const sf::Color LIGHT_DARK{150, 150, 150}; - const sf::Color LIGHT_MID{200, 200, 200}; - const sf::Color LIGHT_LIGHT{230, 230, 230}; + const sf::Color BLACK{1, 4, 2}; + const sf::Color DARK_DARK{9, 29, 16}; + const sf::Color DARK_MID{14, 50, 26}; + const sf::Color DARK_LIGHT{0, 109, 44}; + const sf::Color MID{63, 171, 92}; + const sf::Color LIGHT_DARK{161, 217, 155}; + const sf::Color LIGHT_MID{199, 233, 192}; + const sf::Color LIGHT_LIGHT{229, 245, 224}; const sf::Color WHITE{255, 255, 255}; const sf::Color TRANSPARENT = sf::Color::Transparent; } diff --git a/constants.hpp b/constants.hpp index 30a634c..cff894f 100644 --- a/constants.hpp +++ b/constants.hpp @@ -4,20 +4,18 @@ #include "color.hpp" #include -constexpr const int TEXTURE_WIDTH=256; -constexpr const int TEXTURE_HEIGHT=256; -constexpr const int SCREEN_WIDTH=1280; -constexpr const int SCREEN_HEIGHT=720; +constexpr const int SCREEN_WIDTH= 1920 / 2; +constexpr const int SCREEN_HEIGHT= 1080 / 2; constexpr const bool VSYNC=false; constexpr const int FRAME_LIMIT=60; constexpr const int GUECS_PADDING = 3; constexpr const int GUECS_BORDER_PX = 1; -constexpr const int GUECS_FONT_SIZE = 30; -const sf::Color GUECS_FILL_COLOR = ColorValue::DARK_MID; +constexpr const int GUECS_FONT_SIZE = 40; +const sf::Color GUECS_FILL_COLOR = ColorValue::DARK_DARK; const sf::Color GUECS_TEXT_COLOR = ColorValue::LIGHT_LIGHT; -const sf::Color GUECS_BG_COLOR = ColorValue::MID; +const sf::Color GUECS_BG_COLOR = ColorValue::BLACK; const sf::Color GUECS_BORDER_COLOR = ColorValue::MID; constexpr const char *FONT_FILE_NAME="assets/text.ttf"; diff --git a/gui.cpp b/gui.cpp index b3e2cd7..9d6921b 100644 --- a/gui.cpp +++ b/gui.cpp @@ -14,7 +14,41 @@ using std::string, std::vector; -GUI::GUI(SFMLBackend &backend) : gui(backend) { +GUI::GUI(SFMLBackend &backend) : sfml(backend) { + using namespace guecs; + + $gui.position(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + $gui.layout( + "[*%(200,300)face|_|*%(100,300)stats|*%(200,500)log|_]" + "[_|_|_|_|_]" + "[_|_|_|_|_]" + "[*%(300,200)clock|_|_|_|_]" + "[_|_|_|_|_]" + "[hp_bar]"); + + $gui.world().set_the({$gui.$parser, ColorValue::DARK_MID}); + + for(auto& [name, cell] : $gui.cells()) { + auto ent = $gui.entity(name); + $gui.set(ent, {}); + } + + auto face = $gui.entity("face"); + $gui.set(face, {"building"}); + + auto stats = $gui.entity("stats"); + $gui.set(stats, {L"STATS"}); + + auto log = $gui.entity("log"); + $gui.set(log, {L"LOG"}); + + auto clock = $gui.entity("clock"); + $gui.set