the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2
3class IntBuffer;
4class Options;
5class Textures;
6class ResourceLocation;
7
8class Font
9{
10private:
11 int *charWidths;
12public:
13 int fontTexture;
14 Random *random;
15
16private:
17 int colors[32]; // RGB colors for formatting
18
19 Textures *textures;
20
21 float xPos;
22 float yPos;
23
24 bool enforceUnicodeSheet; // use unicode sheet for ascii
25 bool bidirectional; // use bidi to flip strings
26
27 int m_cols; // Number of columns in font sheet
28 int m_rows; // Number of rows in font sheet
29 int m_charWidth; // Maximum character width
30 int m_charHeight; // Maximum character height
31 ResourceLocation *m_textureLocation; // Texture
32 std::map<int, int> m_charMap;
33
34public:
35 Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, ResourceLocation *textureLocation, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = NULL);
36#ifndef _XBOX
37 // 4J Stu - This dtor clashes with one in xui! We never delete these anyway so take it out for now. Can go back when we have got rid of XUI
38 ~Font();
39#endif
40 void renderFakeCB(IntBuffer *cb); // 4J added
41
42private:
43 void renderCharacter(wchar_t c); // 4J added
44
45public:
46 void drawShadow(const wstring& str, int x, int y, int color);
47 void drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h); // 4J Added h param
48 void draw(const wstring &str, int x, int y, int color);
49 /**
50 * Reorders the string according to bidirectional levels. A bit expensive at
51 * the moment.
52 *
53 * @param str
54 * @return
55 */
56private:
57 wstring reorderBidi(const wstring &str);
58
59 void draw(const wstring &str, bool dropShadow);
60 void draw(const wstring& str, int x, int y, int color, bool dropShadow);
61 int MapCharacter(wchar_t c); // 4J added
62 bool CharacterExists(wchar_t c); // 4J added
63
64public:
65 int width(const wstring& str);
66 wstring sanitize(const wstring& str);
67 void drawWordWrap(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param
68
69private:
70 void drawWordWrapInternal(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param
71
72public:
73 void drawWordWrap(const wstring &string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param
74
75private:
76 void drawWordWrapInternal(const wstring& string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param
77
78public:
79 int wordWrapHeight(const wstring& string, int w);
80 void setEnforceUnicodeSheet(bool enforceUnicodeSheet);
81 void setBidirectional(bool bidirectional);
82
83 // 4J-PB - check for invalid player name - Japanese local name
84 bool AllCharactersValid(const wstring &str);
85};