-
Notifications
You must be signed in to change notification settings - Fork 0
/
DrawnString.hpp
64 lines (57 loc) · 1.27 KB
/
DrawnString.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once
#include "TimedItem.hpp"
#include <string>
#include "cs314_math.hpp"
class cDrawnStringFactory;
class cDrawnStringInternal: public iTimedItem
{
public:
cDrawnStringInternal(int num_chars, int vbo_index);
~cDrawnStringInternal(void);
void SetLifeTime(float lifetime){
mIsTimed = true;
mLifetime = lifetime;
}
int GetIndex() const{
return mVBOindex;
}
int GetNumChars() const {
return mNumChars;
}
void SetIndex(int index){
mVBOindex = index;
}
cCoord2 GetScale() const { return mScale; }
void SetScale(cCoord2 val) { mScale = val; }
virtual void Update(float elapsed_time);
virtual void Reset(){};
virtual bool IsDone();
private:
cCoord2 mScale;
int mVBOindex;
int mNumChars;
float mElapsedTime;
float mLifetime;
bool mIsTimed;
};
class cDrawnString
{
public:
cDrawnString(cDrawnStringInternal* handle, cDrawnStringFactory* parent, cCoord3 color, cCoord2 pos)
: mHandle(handle)
, mPos(pos)
, mColor(color)
, mFactory(parent)
{}
~cDrawnString();
void SetLifeTime(float lifetime){
mHandle->SetLifeTime(lifetime);
}
void SetText( std::string text, const cCoord2& pos,const cCoord3& color);
void SetScale(cCoord2 new_scale);
private:
cDrawnStringInternal* mHandle;
cDrawnStringFactory* mFactory;
cCoord3 mColor;
cCoord2 mPos;
};