#include "gui.hpp" #include // for EXIT_SUCCESS #include // for milliseconds #include #include #include // for allocator, shared_ptr #include // for operator+, to_string #include #include #include #include "builder.hpp" #include #include #include "sound.hpp" #include "shaders.hpp" using std::string, std::vector; GUI::GUI(int timer_seconds, const std::wstring &g) : $timer_seconds(timer_seconds), $goal(g), $window(sf::VideoMode({SCREEN_WIDTH, SCREEN_HEIGHT}), "Turing's Tarpit") { using namespace guecs; $timer_end = std::chrono::system_clock::now() + std::chrono::seconds(timer_seconds); $gui.position(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); $gui.layout( "[*%(200,500)log|_|*%(100,300)status|*%(200,300)face|_]" "[_|_|_|_|_]" "[_|_|_|_|_]" "[_|_|*%(300,100)goal|_|_]" "[_|_|*%(300,100)clock|_|_]" "[hp_bar]"); $gui.world().set_the({$gui.$parser, {0,0,0,0}}); for(auto& [name, cell] : $gui.cells()) { auto ent = $gui.entity(name); $gui.set(ent, {}); } auto face = $gui.entity("face"); $gui.set(face, {"building"}); auto status = $gui.entity("status"); $gui.set(status, {L""}); $log = $gui.entity("log"); auto& rect = $gui.get($log); rect.color = {255,255,255,255}; $gui.set($log, {(float)$timer_seconds, "build_status"}); auto clock = $gui.entity("clock"); auto& clock_rect = $gui.get(clock); clock_rect.color = ColorValue::BLACK; $gui.set