metaforce/Runtime/GuiSys/CGuiTextSupport.hpp

122 lines
2.6 KiB
C++
Raw Normal View History

2016-03-10 03:47:37 +00:00
#ifndef __URDE_CGUITEXTSUPPORT_HPP__
#define __URDE_CGUITEXTSUPPORT_HPP__
2016-03-18 03:35:16 +00:00
#include "zeus/CColor.hpp"
#include "RetroTypes.hpp"
2016-03-19 00:07:31 +00:00
#include "CToken.hpp"
#include "CTextRenderBuffer.hpp"
#include "optional.hpp"
2016-03-18 03:35:16 +00:00
#include <string>
2016-03-10 03:47:37 +00:00
namespace urde
{
2016-03-18 03:35:16 +00:00
class CSimplePool;
2016-03-19 00:07:31 +00:00
class CRasterFont;
class CTextRenderBuffer;
2016-03-18 03:35:16 +00:00
enum class EJustification
{
2016-03-21 00:25:53 +00:00
Left = 0,
Center,
Right,
Full,
NLeft,
NCenter,
NRight,
2016-03-20 06:37:08 +00:00
Seven,
Eight,
Nine
2016-03-18 03:35:16 +00:00
};
enum class EVerticalJustification
{
2016-03-21 00:25:53 +00:00
Top = 0,
Center,
Bottom,
Full,
NTop,
NCenter,
NBottom,
2016-03-20 06:37:08 +00:00
Seven,
Eight,
Nine
2016-03-18 03:35:16 +00:00
};
2016-03-19 00:07:31 +00:00
enum class EColorType
{
2016-03-21 00:25:53 +00:00
Main,
Outline,
Geometry,
Foreground,
2016-03-19 00:07:31 +00:00
Four
};
enum class ETextDirection
{
2016-03-20 00:32:30 +00:00
Horizontal,
Vertical
2016-03-19 00:07:31 +00:00
};
2016-03-19 03:58:01 +00:00
using CTextColor = zeus::CColor;
2016-03-19 00:07:31 +00:00
2016-03-18 03:35:16 +00:00
class CGuiTextProperties
{
bool x0_a;
bool x1_b;
bool x2_c;
EJustification x4_justification;
EVerticalJustification x8_vertJustification;
public:
CGuiTextProperties(bool a, bool b, bool c, EJustification justification,
EVerticalJustification vertJustification)
: x0_a(a), x1_b(b), x2_c(c), x4_justification(justification),
x8_vertJustification(vertJustification) {}
};
2016-03-10 03:47:37 +00:00
2016-03-18 03:35:16 +00:00
class CGuiTextSupport
{
u32 x4_ = 0;
u32 x8_ = 0;
CGuiTextProperties x10_props;
zeus::CColor x1c_;
zeus::CColor x20_;
zeus::CColor x24_;
s32 x28_;
s32 x2c_;
float x30_ = 0.f;
std::vector<u32> x34_;
s32 x44_ = 0;
float x48_ = 0.1f;
float x4c_ = 10.0f;
2016-03-19 00:07:31 +00:00
TResId x50_fontId;
std::experimental::optional<CTextRenderBuffer> x54_renderBuf;
bool x2ac_ = false;
s32 x2b4_ = 0;
s32 x2b8_ = 0;
s32 x2bc_ = 0;
2016-03-19 00:07:31 +00:00
TLockedToken<CRasterFont> x2c0_font;
2016-03-18 03:35:16 +00:00
public:
2016-03-19 00:07:31 +00:00
CGuiTextSupport(TResId fontId, const CGuiTextProperties& props,
2016-03-18 03:35:16 +00:00
const zeus::CColor& col1, const zeus::CColor& col2,
const zeus::CColor& col3, s32, s32, CSimplePool*);
2016-03-18 03:35:16 +00:00
void GetCurrentAnimationOverAge() const;
int GetNumCharsPrinted() const;
int GetTotalAnimationTime() const;
void SetTypeWriteEffectOptions(bool, float, float);
void Update(float dt);
void ClearBuffer();
void CheckAndRebuildTextRenderBuffer();
void Render() const;
void SetGeometryColor(const zeus::CColor& col);
void SetOutlineColor(const zeus::CColor& col);
void SetFontColor(const zeus::CColor& col);
void AddText(const std::wstring& str);
void SetText(const std::wstring& str);
void SetText(const std::string& str);
bool GetIsTextSupportFinishedLoading() const;
};
2016-03-10 03:47:37 +00:00
}
#endif // __URDE_CGUITEXTSUPPORT_HPP__