metaforce/Runtime/GuiSys/CTextExecuteBuffer.hpp

78 lines
2.4 KiB
C++
Raw Normal View History

2016-03-19 00:07:31 +00:00
#ifndef __URDE_CTEXTEXECUTEBUFFER_HPP__
#define __URDE_CTEXTEXECUTEBUFFER_HPP__
#include "CSaveableState.hpp"
#include "CGuiTextSupport.hpp"
#include <list>
namespace urde
{
class CInstruction;
class CFontImageDef;
2016-03-19 03:58:01 +00:00
class CTextRenderBuffer;
class CBlockInstruction;
class CLineInstruction;
2016-03-19 00:07:31 +00:00
class CTextExecuteBuffer
{
2016-03-21 22:01:19 +00:00
friend class CGuiTextSupport;
2016-12-30 06:37:01 +00:00
friend class CTextRenderBufferPages;
2016-12-31 00:51:51 +00:00
using InstList = std::list<std::shared_ptr<CInstruction>>;
2016-03-21 22:01:19 +00:00
2016-12-31 00:51:51 +00:00
InstList x0_instList;
2016-03-19 00:07:31 +00:00
u32 x14_ = 0;
2016-03-20 00:32:30 +00:00
CSaveableState x18_textState;
2016-12-16 23:05:29 +00:00
CBlockInstruction* xa0_curBlock = nullptr;
CLineInstruction* xa4_curLine = nullptr;
std::list<std::shared_ptr<CInstruction>>::iterator xa8_curWordIt;
s32 xac_curY;
s32 xb0_curX;
s32 xb4_curWordX = 0;
s32 xb8_curWordY = 0;
2016-12-16 23:05:29 +00:00
s32 xbc_spaceDistance = 0;
bool xc0_ = false;
std::list<CSaveableState> xc4_stateStack;
u32 xd8_ = 0;
2016-03-19 00:07:31 +00:00
public:
CTextExecuteBuffer()
{
2016-12-16 23:05:29 +00:00
xa8_curWordIt = x0_instList.begin();
2016-03-19 00:07:31 +00:00
}
2016-12-31 00:51:51 +00:00
CTextRenderBuffer BuildRenderBuffer() const;
CTextRenderBuffer BuildRenderBufferPage(InstList::const_iterator start,
InstList::const_iterator pgStart,
InstList::const_iterator pgEnd) const;
std::list<CTextRenderBuffer> BuildRenderBufferPages(const zeus::CVector2i& extent) const;
2016-03-20 00:32:30 +00:00
std::vector<CToken> GetAssets() const;
2017-01-24 07:41:33 +00:00
void AddString(const char16_t* str, int len);
void AddStringFragment(const char16_t* str, int len);
int WrapOneLTR(const char16_t* str, int len);
2016-03-19 00:07:31 +00:00
void MoveWordLTR();
void StartNewLine();
void StartNewWord();
void TerminateLine();
void TerminateLineLTR();
void AddPopState();
void AddPushState();
2016-03-20 06:37:08 +00:00
void AddVerticalJustification(EVerticalJustification vjust);
void AddJustification(EJustification just);
2016-03-20 00:32:30 +00:00
void AddLineExtraSpace(s32 space);
2016-03-20 06:37:08 +00:00
void AddLineSpacing(float spacing);
void AddRemoveColorOverride(int idx);
void AddColorOverride(int idx, const CTextColor& color);
2016-03-19 00:07:31 +00:00
void AddColor(EColorType, const CTextColor& color);
void AddImage(const CFontImageDef& image);
2016-03-21 00:25:53 +00:00
void AddFont(const TToken<CRasterFont>& font);
2016-03-19 00:07:31 +00:00
void EndBlock();
2016-03-20 06:37:08 +00:00
void BeginBlock(s32 offX, s32 offY, s32 padX, s32 padY,
ETextDirection dir, EJustification just,
EVerticalJustification vjust);
2016-03-19 00:07:31 +00:00
void Clear();
};
}
#endif // __URDE_CTEXTEXECUTEBUFFER_HPP__