2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-03-10 03:47:37 +00:00
|
|
|
|
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"
|
2017-01-29 03:58:16 +00:00
|
|
|
#include "CGuiWidget.hpp"
|
2017-04-02 03:03:37 +00:00
|
|
|
#include "CSaveWorld.hpp"
|
2016-03-21 05:02:56 +00:00
|
|
|
#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-12-30 06:37:01 +00:00
|
|
|
class CTextExecuteBuffer;
|
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,
|
2017-01-14 04:16:10 +00:00
|
|
|
LeftMono,
|
|
|
|
CenterMono,
|
|
|
|
RightMono
|
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,
|
2017-01-14 04:16:10 +00:00
|
|
|
TopMono,
|
|
|
|
CenterMono,
|
|
|
|
RightMono
|
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;
|
2017-01-30 04:16:20 +00:00
|
|
|
bool x1_horizontal;
|
2016-03-18 03:35:16 +00:00
|
|
|
EJustification x4_justification;
|
|
|
|
EVerticalJustification x8_vertJustification;
|
2017-08-13 05:26:14 +00:00
|
|
|
const std::vector<std::pair<CAssetId, CAssetId>>* xc_txtrMap;
|
2016-03-18 03:35:16 +00:00
|
|
|
public:
|
2017-01-30 04:16:20 +00:00
|
|
|
CGuiTextProperties(bool wordWrap, bool horizontal, EJustification justification,
|
2017-04-02 03:03:37 +00:00
|
|
|
EVerticalJustification vertJustification,
|
2017-08-13 05:26:14 +00:00
|
|
|
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap=nullptr)
|
2017-01-30 04:16:20 +00:00
|
|
|
: x0_wordWrap(wordWrap), x1_horizontal(horizontal), x4_justification(justification),
|
2017-05-31 21:26:50 +00:00
|
|
|
x8_vertJustification(vertJustification), xc_txtrMap(txtrMap) {}
|
2016-03-18 03:35:16 +00:00
|
|
|
};
|
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;
|
2017-01-24 07:41:33 +00:00
|
|
|
std::u16string x0_string;
|
2016-12-16 23:05:29 +00:00
|
|
|
float x10_curTimeMod900 = 0.f;
|
2016-08-15 20:58:07 +00:00
|
|
|
CGuiTextProperties x14_props;
|
|
|
|
zeus::CColor x24_fontColor;
|
|
|
|
zeus::CColor x28_outlineColor;
|
|
|
|
zeus::CColor x2c_geometryColor;
|
2017-01-30 04:16:20 +00:00
|
|
|
bool x30_imageBaseline = false;
|
2016-08-15 20:58:07 +00:00
|
|
|
s32 x34_extentX;
|
|
|
|
s32 x38_extentY;
|
|
|
|
float x3c_curTime = 0.f;
|
2016-12-16 23:05:29 +00:00
|
|
|
std::vector<std::pair<float, int>> x40_primStartTimes;
|
2016-08-15 20:58:07 +00:00
|
|
|
bool x50_typeEnable = false;
|
|
|
|
float x54_chFadeTime = 0.1f;
|
|
|
|
float x58_chRate = 10.0f;
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId x5c_fontId;
|
2017-01-29 03:58:16 +00:00
|
|
|
CGuiWidget::EGuiModelDrawFlags m_drawFlags;
|
2016-08-15 20:58:07 +00:00
|
|
|
std::experimental::optional<CTextRenderBuffer> x60_renderBuf;
|
2016-12-16 23:05:29 +00:00
|
|
|
std::vector<CToken> x2bc_assets;
|
2016-08-15 20:58:07 +00:00
|
|
|
TLockedToken<CRasterFont> x2cc_font;
|
2016-12-31 00:51:51 +00:00
|
|
|
std::pair<zeus::CVector2i, zeus::CVector2i> x2dc_oneBufBounds;
|
2016-08-15 20:58:07 +00:00
|
|
|
|
2016-12-31 00:51:51 +00:00
|
|
|
std::list<CTextRenderBuffer> x2ec_renderBufferPages;
|
2017-05-07 19:35:52 +00:00
|
|
|
int x304_pageCounter = 0;
|
2016-12-29 05:53:00 +00:00
|
|
|
bool x308_multipageFlag = false;
|
2016-12-16 23:05:29 +00:00
|
|
|
|
2016-12-30 06:37:01 +00:00
|
|
|
CTextRenderBuffer* GetCurrentPageRenderBuffer() const;
|
|
|
|
bool _GetIsTextSupportFinishedLoading() const;
|
2016-08-15 20:58:07 +00:00
|
|
|
|
2016-03-18 03:35:16 +00:00
|
|
|
public:
|
2017-08-13 05:26:14 +00:00
|
|
|
CGuiTextSupport(CAssetId fontId, const CGuiTextProperties& props,
|
2016-03-22 02:27:46 +00:00
|
|
|
const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
|
2017-01-29 03:58:16 +00:00
|
|
|
const zeus::CColor& geomCol, s32 extX, s32 extY, CSimplePool* store,
|
|
|
|
CGuiWidget::EGuiModelDrawFlags drawFlags);
|
2016-03-21 22:01:19 +00:00
|
|
|
float GetCurrentAnimationOverAge() const;
|
2017-01-09 03:44:00 +00:00
|
|
|
float GetNumCharsTotal() const;
|
2016-03-21 22:01:19 +00:00
|
|
|
float GetNumCharsPrinted() const;
|
|
|
|
float GetTotalAnimationTime() const;
|
2016-12-16 23:05:29 +00:00
|
|
|
bool IsAnimationDone() const;
|
2016-03-21 22:01:19 +00:00
|
|
|
void SetTypeWriteEffectOptions(bool enable, float chFadeTime, float chRate);
|
2016-03-18 03:35:16 +00:00
|
|
|
void Update(float dt);
|
2016-12-16 23:05:29 +00:00
|
|
|
void ClearRenderBuffer();
|
2016-12-30 06:37:01 +00:00
|
|
|
void CheckAndRebuildTextBuffer();
|
|
|
|
bool CheckAndRebuildRenderBuffer();
|
2016-12-31 00:51:51 +00:00
|
|
|
const std::pair<zeus::CVector2i, zeus::CVector2i>& GetBounds();
|
|
|
|
void AutoSetExtent();
|
2016-12-30 06:37:01 +00:00
|
|
|
|
2016-03-18 03:35:16 +00:00
|
|
|
void Render() const;
|
|
|
|
void SetGeometryColor(const zeus::CColor& col);
|
|
|
|
void SetOutlineColor(const zeus::CColor& col);
|
|
|
|
void SetFontColor(const zeus::CColor& col);
|
2017-11-13 06:19:18 +00:00
|
|
|
void AddText(std::u16string_view str);
|
|
|
|
void SetText(std::u16string_view str, bool multipage=false);
|
|
|
|
void SetText(std::string_view str, bool multipage=false);
|
2017-01-30 04:16:20 +00:00
|
|
|
void SetJustification(EJustification j);
|
|
|
|
void SetVerticalJustification(EVerticalJustification j);
|
|
|
|
void SetImageBaseline(bool b);
|
2016-03-18 03:35:16 +00:00
|
|
|
bool GetIsTextSupportFinishedLoading() const;
|
2017-02-12 03:17:18 +00:00
|
|
|
float GetCurTime() const { return x3c_curTime; }
|
2017-04-13 19:28:31 +00:00
|
|
|
void SetCurTime(float t) { x3c_curTime = t; }
|
2017-11-13 06:19:18 +00:00
|
|
|
std::u16string_view GetString() const { return x0_string; }
|
2017-08-13 05:26:14 +00:00
|
|
|
void SetControlTXTRMap(const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
|
2017-05-07 19:35:52 +00:00
|
|
|
int GetPageCounter() const { return x304_pageCounter; }
|
|
|
|
int GetTotalPageCount();
|
|
|
|
void SetPage(int page);
|
2016-03-18 03:35:16 +00:00
|
|
|
};
|
2016-03-10 03:47:37 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|