#pragma once #include #include #include #include #include #include namespace Quip { extern int windowCount; namespace Widget { class TextLabel { public: std::string text; int xpos, ypos = 0; explicit TextLabel(std::string text, int xpos, int ypos); TextLabel(); }; class Button { public: std::string text; std::function callback; int xpos, ypos = 0; int width = 100, height = 30; explicit Button(std::string text, std::function callback, int xpos, int ypos); }; typedef std::variant Widget; } class Window { SDL_Window* window; SDL_Renderer* renderer; SDL_Event event; TTF_Font* font; std::string title; int width, height; std::map widgets; void error(int errCode = 0, const std::string& context = ""); public: int run(); void addChild(const std::string& id, const Widget::Widget& widget); Widget::Widget* getChild(const std::string& id); explicit Window(std::string title, int width = 800, int height = 600); Window(); }; }