implemented vertical scrolling.

created new class VerticalTextScroller to handle task display in deck selection screens
modified detailed popup placement on deck selection screen to compensate for lack of border
This commit is contained in:
techdragon.nguyen@gmail.com
2010-11-24 16:12:18 +00:00
parent 2aa47cd68b
commit e4c8469490
6 changed files with 157 additions and 75 deletions

View File

@@ -12,27 +12,47 @@ protected:
string mText;
string tempText;
int fontId;
float mWidth;
float mSpeed;
float mWidth; // width of the text scroller object
float mScrollSpeed;
float mX;
float mY;
float start;
int timer;
size_t minimumItems;
vector<string> strings;
unsigned int currentId;
int mRandom;
int scrollDirection;
public:
TextScroller(int fontId, float x, float y, float width, float speed = 100);
void Add(string text);
void Reset();
void setRandom(int mode = 1);
TextScroller(int fontId, float x, float y, float width, float speed = 30, int scrollerType = 0, size_t _minimumItems = 2);
void Render();
void Update(float dt);
virtual ostream& toString(ostream& out) const;
};
class VerticalTextScroller:
public TextScroller
{
private:
size_t mNbItemsShown;
bool mScrollerInitialized;
float mHeight; // maximum height availble for display
int marginX;
int marginY; // margin used to allow text to scroll off screen without
// affecting look and feel. Should be enough
// for at least one line of text ( marginY)
protected:
string wordWrap(string sentence, float width);
public:
VerticalTextScroller(int fontId, float x, float y, float width, float height, float scrollSpeed = 30, size_t _minimumItems = 1);
void Render();
void Update(float dt);
};
#endif