17#ifndef _FGE_C_OBJSLIDER_HPP_INCLUDED
18#define _FGE_C_OBJSLIDER_HPP_INCLUDED
20#include "FastEngine/fge_extern.hpp"
21#include "FastEngine/C_guiElement.hpp"
22#include "FastEngine/object/C_objRectangleShape.hpp"
23#include "FastEngine/object/C_object.hpp"
25#define FGE_OBJSLIDER_CLASSNAME "FGE:OBJ:SLIDER"
26#define FGE_OBJSLIDER_SCROLL_RATIO_DEFAULT 0.2f
46 [[nodiscard]] fge::Vector2f getSize()
const;
48 void allowJump(
bool allow);
49 void setScrollInversion(
bool inverted);
50 void setCursorPosition(
float position);
51 void setCursorRatio(
float ratio);
52 void scroll(
float deltaRatio);
53 [[nodiscard]]
float getCursorRatio()
const;
54 [[nodiscard]]
bool isScrollPressed()
const;
55 [[nodiscard]]
bool isScrollInverted()
const;
56 [[nodiscard]]
bool isAllowingJump()
const;
61 void setScrollRectOutlineColor(
fge::Color color);
62 void setScrollBaseRectFillColor(
fge::Color color);
77 void onMouseButtonReleased(
fge::Event const& evt, SDL_MouseButtonEvent
const& arg);
78 void onMouseMoved(
fge::Event const& evt, SDL_MouseMotionEvent
const& arg);
84 void refreshSize(fge::Vector2f
const& targetSize);
93 bool g_scrollPressed{
false};
94 float g_scrollPositionY{0.0f};
95 float g_scrollLastPositionY{0.0f};
96 float g_lastMousePositionY{0.0f};
97 bool g_scrollInverted{
false};
98 bool g_allowJump{
true};
This class is used to handle callbacks in a safe way.
Definition C_callback.hpp:189
Definition C_color.hpp:35
This class is a wrapper for SDL events.
Definition C_event.hpp:59
A class to handle highest priority selection of GUI elements.
Definition C_guiElement.hpp:235
A base class for all GUI elements.
Definition C_guiElement.hpp:120
Definition C_objRectangleShape.hpp:36
Definition C_objSlider.hpp:32
void first(fge::Scene &scene) override
Method called when the object is added to a scene for initialization purposes.
fge::GuiElement * getGuiElement() override
Get the GuiElement attached to this object if there is one.
Definition C_objSlider.hpp:39
void callbackRegister(fge::Event &event, fge::GuiElementHandler *guiElementHandlerPtr) override
Ask the object to register all callbacks it needs to receive events.
fge::RectFloat getGlobalBounds() const override
Get the global bounds of the object.
char const * getClassName() const override
Get the unique class name of the object.
char const * getReadableClassName() const override
Get a readable version of the class name.
fge::RectFloat getLocalBounds() const override
Get the local bounds of the object (without any transformations)
The Object class is the base class for all objects in the engine.
Definition C_object.hpp:102
A scene contain a collection of object and handle them.
Definition C_scene.hpp:450
This class is a useful utility to "link" multiple objects around.
Definition C_subscription.hpp:150
Definition C_guiElement.hpp:56
Definition C_guiElement.hpp:45