ES-DE/src/components/SliderComponent.h
Aloshi 92a6678736 Added DIMTIME slider to settings.
Sliders now show their exact value + a unit suffix to the right of the
slider.
2014-01-10 16:01:28 -06:00

38 lines
880 B
C++

#pragma once
#include "../GuiComponent.h"
class TextCache;
class Font;
class SliderComponent : public GuiComponent
{
public:
//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 = "");
void setValue(float val);
float getValue();
bool input(InputConfig* config, Input input) override;
void update(int deltaTime) override;
void render(const Eigen::Affine3f& parentTrans) override;
void onSizeChanged() override;
private:
void onValueChanged();
float mMin, mMax;
float mValue;
float mIncrement;
float mMoveScale;
int mRepeatWaitTimer;
std::string mSuffix;
std::shared_ptr<Font> mFont;
std::shared_ptr<TextCache> mValueCache;
float mMoveRate;
};