Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _TBUTTON_H_
- #define _TBUTTON_H_
- #include <SDL.h>
- #include <string>
- #include <vector>
- #include <initializer_list>
- extern "C"{
- #include "SDL_FontCache.h"
- }
- class TButton {
- private:
- SDL_Rect mButtonRect;
- SDL_Rect mTextRect;
- std::string mLabel;
- FC_Effect mStyle;
- FC_Font* mFont;
- SDL_Color mBgColor;
- SDL_Color mHoverColor;
- float mHoverTime = 0.f;
- bool mHovered = false;
- bool mCalled = false;
- void(*mCallback)() = nullptr;
- public:
- void QuerryButton(const SDL_Point & mPos, const bool & clicked);
- void Draw(SDL_Renderer * rend, const float & dTime);
- void Call();
- TButton(const SDL_Rect & rect, const std::string & label, const SDL_Color & textColor, const SDL_Color & bgColor, const SDL_Color & hoverColor, void(*callback)(), FC_Font* font);
- ~TButton();
- static std::vector<TButton> GetStandardButtons(const std::initializer_list<std::string>& labels, const std::initializer_list<void(*)()>& callbacks ,SDL_Rect startRect, const int& yOffset, FC_Font* font);
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement