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"
|
2016-03-21 05:02:56 +00:00
|
|
|
#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;
|
2016-03-21 05:02:56 +00:00
|
|
|
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-21 22:01:19 +00:00
|
|
|
Background
|
2016-03-19 00:07:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class ETextDirection
|
|
|
|
{
|
2016-03-20 00:32:30 +00:00
|
|
|
Horizontal,
|
|
|
|
Vertical
|
2016-03-19 00:07:31 +00:00
|
|
|
};
|
|
|
|
|
2016-03-18 03:35:16 +00:00
|
|
|
class CGuiTextProperties
|
|
|
|
{
|
2016-03-21 22:01:19 +00:00
|
|
|
friend class CGuiTextSupport;
|
|
|
|
bool x0_wordWrap;
|
|
|
|
bool x1_vertical;
|
2016-03-18 03:35:16 +00:00
|
|
|
bool x2_c;
|
|
|
|
EJustification x4_justification;
|
|
|
|
EVerticalJustification x8_vertJustification;
|
|
|
|
public:
|
2016-03-22 02:27:46 +00:00
|
|
|
CGuiTextProperties(bool wordWrap, bool vertical, bool c, EJustification justification,
|
2016-03-18 03:35:16 +00:00
|
|
|
EVerticalJustification vertJustification)
|
2016-03-22 02:27:46 +00:00
|
|
|
: x0_wordWrap(wordWrap), x1_vertical(vertical), x2_c(c), x4_justification(justification),
|
2016-03-18 03:35:16 +00:00
|
|
|
x8_vertJustification(vertJustification) {}
|
|
|
|
};
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2016-03-18 03:35:16 +00:00
|
|
|
class CGuiTextSupport
|
|
|
|
{
|
2016-03-22 02:27:46 +00:00
|
|
|
friend class CGuiTextPane;
|
2016-03-21 22:01:19 +00:00
|
|
|
std::wstring x0_string;
|
2016-03-21 05:02:56 +00:00
|
|
|
CGuiTextProperties x10_props;
|
2016-03-21 22:01:19 +00:00
|
|
|
zeus::CColor x1c_fontColor;
|
|
|
|
zeus::CColor x20_outlineColor;
|
|
|
|
zeus::CColor x24_geometryColor;
|
2016-03-22 02:27:46 +00:00
|
|
|
s32 x28_extentX;
|
|
|
|
s32 x2c_extentY;
|
2016-03-21 22:01:19 +00:00
|
|
|
float x30_curTime = 0.f;
|
|
|
|
std::vector<std::pair<float, int>> x34_primStartTimes;
|
|
|
|
bool x44_typeEnable = false;
|
|
|
|
float x48_chFadeTime = 0.1f;
|
|
|
|
float x4c_chRate = 10.0f;
|
2016-04-14 21:42:47 +00:00
|
|
|
ResId x50_fontId;
|
2016-03-21 05:02:56 +00:00
|
|
|
std::experimental::optional<CTextRenderBuffer> x54_renderBuf;
|
2016-03-21 22:01:19 +00:00
|
|
|
bool x2ac_active = false;
|
|
|
|
std::vector<CToken> x2b0_assets;
|
2016-03-19 00:07:31 +00:00
|
|
|
TLockedToken<CRasterFont> x2c0_font;
|
2016-03-18 03:35:16 +00:00
|
|
|
public:
|
2016-04-14 21:42:47 +00:00
|
|
|
CGuiTextSupport(ResId fontId, const CGuiTextProperties& props,
|
2016-03-22 02:27:46 +00:00
|
|
|
const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
|
|
|
|
const zeus::CColor& geomCol, s32 extX, s32 extY, CSimplePool* store);
|
2016-03-21 22:01:19 +00:00
|
|
|
float GetCurrentAnimationOverAge() const;
|
|
|
|
float GetNumCharsPrinted() const;
|
|
|
|
float GetTotalAnimationTime() const;
|
|
|
|
void SetTypeWriteEffectOptions(bool enable, float chFadeTime, float chRate);
|
2016-03-18 03:35:16 +00:00
|
|
|
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__
|