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
/********************************************************************
*
*	File:		fsCVertexStreamTextSpriteRenderData.h
*
*	Purpose:	Cocos2d-x implementation of the text render data.
*
*********************************************************************/

#ifndef fsCVertexStreamTextSpriteRenderDatahdr
#define fsCVertexStreamTextSpriteRenderDatahdr

#include <2d/CCLabel.h>
#include <renderer/CCTextureAtlas.h>

#include "../../../fsITextRenderData.h"

class fsVec2d;


class fsCVertexStreamTextSpriteRenderData : public fsITextRenderData
{
	friend class fsCRenderDataFactoryVertexStream;

public:

	void implRender() override;

	fsS32 stringWidthInPixelsGet() const override;

	virtual ~fsCVertexStreamTextSpriteRenderData() = default;<--- Destructor in derived class

protected:

	static fsIRenderData* create();
	fsCVertexStreamTextSpriteRenderData();

	void dirtyTextProcessDo(const fsAffineMtx2d& pRenderMatrix, const fsRect& pFormattingRect, const fsStr& pText) override;
	void matrixApplyDo(const fsAffineMtx2d& pRenderMatrix) override;

private:

    void rawVertSet(fsS32 currVert, fsS32 x, fsS32 y, fsS32 w, fsS32 h);
	void lineHorizontalOffset(fsS32 pLineStart, fsS32 pLineEnd, fsS32 pOffset);
	void hardWrap(fsS32 pLineStart, fsS32 pLineEnd, fsS32 pOffset);
	void softWrap(fsS32 pLineStart, fsS32& pLineEnd, fsS32& pCurrVert, fsS32 pX);

	void verticalJustify(fsS32 pLineCount);

	void quadsUpdate();

	void rawVertBufferStore(const fsRect& pFormattingRect);

	cocos2d::TextureAtlas* mTextureAtlas;
	fsS32 mPixelWidth;

//#ifdef fsPCStore
//	std::u16string mU16Str;
//#else
	std::u32string mU16Str;
//#endif


};

#endif