/* ========================================= Raylib GUI Libary 2023. 10. 30. Created by Dongkun Lee. Button, Slider, Image Slider Image Slider need 6 images imgSlider = &_img[0]; imgSliderBar = &_img[1]; imgSliderLeftEnabled = &_img[2]; imgSliderRightEnabled = &_img[3]; imgSliderLeftDisabled = &_img[4]; imgSliderRightDisabled = &_img[5]; */ #pragma once #include #include "raylib.h" #include "config.h" #include "buttonActionMap.h" class GUI { public: GUI(); GUI(int button_x, int button_y, int button_width, int button_height, std::string button_title, Font* _font); virtual bool Update(); virtual void Draw(); void Tick(); bool GetChecked(); void Checked(); void UnChecked(); protected: int x, y, width, height; std::string title; bool isChecked = false; Rectangle rect; Font* font; }; /*=============================== boxenabled = _box[0]; boxdisabled = _box[1]; boxenalbedChecked = _box[2]; boxdisabledChecked = _box[3]; =============================== */ class GUICheckBox : public GUI { private : bool* isHasValue; Texture2D* boxenabled; Texture2D* boxenalbedChecked; Texture2D* boxdisabled; Texture2D* boxdisabledChecked; public : GUICheckBox(); GUICheckBox(int box_x, int box_y, bool *isValue, Texture2D _box[]); virtual bool Update(); virtual void Draw(); }; class GUISlider : public GUI { protected: float padding; Rectangle leftButton; Rectangle rightButton; float *sliderValue; bool changeValueMode = false; void ValueUp(); void ValueDown(); public: enum class arrowCheck { none = 0, left, right, slider }; GUISlider(); GUISlider(int slider_x, int slider_y, int slider_width, int slider_height, std::string slider_title, Font *_font, float *value); virtual bool Update(); virtual void Draw(); bool MouseSliding(); arrowCheck arrow = arrowCheck::none; }; class GUISliderImg : public GUISlider { private : Texture2D* imgSlider; Texture2D* imgSliderBar; Texture2D* imgSliderLeftEnabled; Texture2D* imgSliderRightEnabled; Texture2D* imgSliderLeftDisabled; Texture2D* imgSliderRightDisabled; public : GUISliderImg(); GUISliderImg(int slider_x, int slider_y, int slider_width, int slider_height, std::string slider_title, Font *_font, float *value, Texture2D _img[]); virtual void Draw(); };