ES-DE/src/components/ScrollableContainer.h
Aloshi 542d41c682 Move from homegrown Vector2 class to Eigen.
Pass a matrix (Eigen::Affine3f) in GuiComponent::render instead of doing
glTranslate behind the scenes.
2013-07-10 06:29:43 -05:00

27 lines
611 B
C++

#pragma once
#include "../GuiComponent.h"
class ScrollableContainer : public GuiComponent
{
public:
ScrollableContainer(Window* window);
Eigen::Vector2d getScrollPos() const;
void setScrollPos(const Eigen::Vector2d& pos);
void setAutoScroll(int delay, double speed); //Use 0 for speed to disable.
void resetAutoScrollTimer();
void update(int deltaTime) override;
void render(const Eigen::Affine3f& parentTrans) override;
private:
Eigen::Vector2f getContentSize();
Eigen::Vector2d mScrollPos;
Eigen::Vector2d mScrollDir;
int mAutoScrollDelay;
double mAutoScrollSpeed;
int mAutoScrollTimer;
};