2013-06-19 01:12:30 +00:00
# pragma once
2017-10-31 17:12:50 +00:00
# ifndef ES_CORE_COMPONENTS_SLIDER_COMPONENT_H
# define ES_CORE_COMPONENTS_SLIDER_COMPONENT_H
2013-06-19 01:12:30 +00:00
2014-06-20 01:30:09 +00:00
# include "components/ImageComponent.h"
2017-11-01 22:21:10 +00:00
# include "GuiComponent.h"
2013-06-19 01:12:30 +00:00
2014-01-10 22:01:28 +00:00
class Font ;
2017-11-01 22:21:10 +00:00
class TextCache ;
2014-01-10 22:01:28 +00:00
2014-01-24 22:21:10 +00:00
// Used to display/edit a value between some min and max values.
2013-06-19 01:12:30 +00:00
class SliderComponent : public GuiComponent
{
public :
2014-01-10 22:01:28 +00:00
//Minimum value (far left of the slider), maximum value (far right of the slider), increment size (how much just pressing L/R moves by), unit to display (optional).
SliderComponent ( Window * window , float min , float max , float increment , const std : : string & suffix = " " ) ;
2013-06-19 01:12:30 +00:00
void setValue ( float val ) ;
float getValue ( ) ;
bool input ( InputConfig * config , Input input ) override ;
void update ( int deltaTime ) override ;
2017-10-28 20:24:35 +00:00
void render ( const Transform4x4f & parentTrans ) override ;
2019-08-25 15:23:02 +00:00
2014-01-10 22:01:28 +00:00
void onSizeChanged ( ) override ;
2019-08-25 15:23:02 +00:00
2014-01-25 23:34:29 +00:00
virtual std : : vector < HelpPrompt > getHelpPrompts ( ) override ;
2014-01-10 22:01:28 +00:00
2013-06-19 01:12:30 +00:00
private :
2014-01-10 22:01:28 +00:00
void onValueChanged ( ) ;
2013-06-19 01:12:30 +00:00
float mMin , mMax ;
float mValue ;
2014-03-22 21:55:18 +00:00
float mSingleIncrement ;
float mMoveRate ;
int mMoveAccumulator ;
2013-06-19 01:12:30 +00:00
2014-03-08 00:16:08 +00:00
ImageComponent mKnob ;
2014-01-10 22:01:28 +00:00
std : : string mSuffix ;
std : : shared_ptr < Font > mFont ;
std : : shared_ptr < TextCache > mValueCache ;
2013-06-19 01:12:30 +00:00
} ;
2017-10-31 17:12:50 +00:00
# endif // ES_CORE_COMPONENTS_SLIDER_COMPONENT_H