#pragma once #ifndef SNAKE_BUTTON_HXX #define SNAKE_BUTTON_HXX #include #include #include #include #include "../AssetManager.hxx" class SDLRenderer; class Button final { public: Button(std::string title, int x, int y, int w, int h); void set_pressed(bool pressed); [[nodiscard]] bool is_pressed() const; void update(); void render(SDLRenderer& renderer); void trigger(); void set_on_click(std::function handler); void move(int x, int y); void resize(int w, int h); [[nodiscard]] SDL_Rect get_bounding_box() const; private: std::string title_; int x_, y_, w_, h_; bool pressed_; std::function on_click_; Asset up_; Asset down_; Asset font_; }; #endif // SNAKE_BUTTON_HXX