2013-06-19 01:12:30 +00:00
# pragma once
2014-06-20 01:30:09 +00:00
# include "GuiComponent.h"
# include "components/ImageComponent.h"
2013-06-19 01:12:30 +00:00
2014-01-10 22:01:28 +00:00
class TextCache ;
class Font ;
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 ;
2013-07-10 11:29:43 +00:00
void render ( const Eigen : : Affine3f & parentTrans ) override ;
2013-06-19 01:12:30 +00:00
2014-01-10 22:01:28 +00:00
void onSizeChanged ( ) override ;
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
} ;