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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/********************************************************************
*
*	File:		fsITextSpriteComponent.h
*
*	Purpose:	Interface for text sprite components
*
*********************************************************************/

#ifndef fsITextSpriteComponenthdr
#define fsITextSpriteComponenthdr

#include <fsCore/fsStr.h>

#include "fsIRenderableComponent.h"

struct fsSColour4B;
class fsRect;
class fsIFont;


class fsITextSpriteComponent : public fsIRenderableComponent
{
public:

	enum eHORIZONTAL_ALIGNMENT
	{
		eHALIGN_LEFT = 0,
		eHALIGN_CENTRE,
		eHALIGN_RIGHT
	};

	enum eVERTICAL_ALIGNMENT
	{
		eVALIGN_TOP = 0,
		eVALIGN_MIDDLE,
		eVALIGN_BOTTOM
	};

	static fsPoint fontSizeGet(const fsCVariableTable& pVars);

	void outlineSet(const fsSColour4B& pOutline, fsF32 pSize) const;
	void shadowSet(const fsSColour4B& pShadow, fsVec2d pOffset, fsF32 pBlurRadius) const;
	void glowSet(const fsSColour4B& pGlow) const;

	void alignmentSet(eHORIZONTAL_ALIGNMENT pAlignH, eVERTICAL_ALIGNMENT pAlignV);

	void initialise(const fsStr& pText, fsIFont* pFont);

	fsS32 stringWidthInPixelsGet() const;

	void formattingRectSizeSet(const fsRect& pFormattingRect);
	void colourSet(const fsSColour4B& pColour);

	void textSet(const fsStr& pText);
	fsStr textGet() const;

protected:

	virtual void outlineSetDo(const fsSColour4B& pOutline, fsF32 pSize) const = 0;
	virtual void shadowSetDo(const fsSColour4B& pShadow, fsVec2d pOffset, fsF32 pBlurRadius) const = 0;
	virtual void glowSetDo(const fsSColour4B& pGlow) const = 0;

	virtual void alignmentSetDo(eHORIZONTAL_ALIGNMENT pAlignH, eVERTICAL_ALIGNMENT pAlignV) = 0;
	virtual void initialiseDo(const fsStr& pText, fsIFont* pFont) = 0;

	virtual fsS32 stringWidthInPixelsGetDo() const = 0;

	virtual void formattingRectSizeSetDo(const fsRect& pFormattingRect) = 0;
	virtual void colourSetDo(const fsSColour4B& pColour) = 0;
	virtual fsStr textGetDo() const = 0;
	virtual void textSetDo(const fsStr& pText) = 0;

	fsITextSpriteComponent(fsCEntity* pParent);
	virtual ~fsITextSpriteComponent();<--- Destructor in derived class

private:
};

#endif