World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
GUIFont.h
См. документацию.
1 #pragma once
2 #include "Engine/Strings.h"
3 
4 class GUIWindow;
5 class Image;
6 struct FontData;
7 
8 class GUIFont {
9  public:
10  static GUIFont *LoadFont(const char *pFontFile, const char *pFontPalette,
11  ...);
12 
13  bool IsCharValid(unsigned char c) const;
14  unsigned int GetHeight() const;
15 
16  unsigned int AlignText_Center(unsigned int width, const String &str);
17 
18  unsigned int GetLineWidth(const String &str);
19 
20  unsigned int CalcTextHeight(const String &str, unsigned int width,
21  int x_offset, bool return_on_carriage = false);
22 
23  String GetPageTop(const String &pInString, GUIWindow *pWindow,
24  unsigned int uX, int a5);
25  void DrawTextLine(const String &text, uint16_t uDefaultColor, int uX,
26  int uY, int max_len_pix);
27  void DrawText(GUIWindow *pWindow, int uX, int uY, uint16_t uFontColor,
28  const String &str, bool present_time_transparency,
29  int max_text_height, int uFontShadowColor);
30  int DrawTextInRect(GUIWindow *pWindow, unsigned int uX, unsigned int uY,
31  uint16_t uColor, const String &str, int rect_width,
32  int reverse_text);
33 
34  String FitTextInAWindow(const String &inString, unsigned int width, int uX,
35  bool return_on_carriage = false);
36 
37  void DrawCreditsEntry(GUIFont *pSecondFont, int uFrameX, int uFrameY,
38  unsigned int w, unsigned int h, uint16_t firstColor,
39  uint16_t secondColor, const String &pString,
40  Image *image);
41  int GetStringHeight2(GUIFont *secondFont, const String &text_str,
42  GUIWindow *pWindow, int startX, int a6);
43 
44  protected:
46 
47  String FitTwoFontStringINWindow(const String &pString, GUIFont *pFontSecond,
48  GUIWindow *pWindow, int startPixlOff,
49  int a6);
50  void DrawTextLineToBuff(uint16_t uColor, uint32_t *uX_buff_pos,
51  const String &text, int line_width);
52 };
53 
54 extern GUIFont *pAutonoteFont;
55 extern GUIFont *pSpellFont;
56 extern GUIFont *pFontArrus;
57 extern GUIFont *pFontLucida;
58 extern GUIFont *pBook2Font;
59 extern GUIFont *pBookFont;
60 extern GUIFont *pFontCreate;
61 extern GUIFont *pFontComic;
62 extern GUIFont *pFontSmallnum;
uint16_t
unsigned __int16 uint16_t
Definition: SDL_config.h:37
pFontCreate
GUIFont * pFontCreate
Definition: GUIFont.cpp:22
pSpellFont
GUIFont * pSpellFont
Definition: GUIFont.cpp:17
GUIFont
Definition: GUIFont.h:8
GUIWindow
Definition: GUIWindow.h:433
pFontComic
GUIFont * pFontComic
Definition: GUIFont.cpp:24
GUIFont::DrawCreditsEntry
void DrawCreditsEntry(GUIFont *pSecondFont, int uFrameX, int uFrameY, unsigned int w, unsigned int h, uint16_t firstColor, uint16_t secondColor, const String &pString, Image *image)
Definition: GUIFont.cpp:611
GUIFont::pData
FontData * pData
Definition: GUIFont.h:45
pFontSmallnum
GUIFont * pFontSmallnum
Definition: GUIFont.cpp:25
GUIFont::DrawTextInRect
int DrawTextInRect(GUIWindow *pWindow, unsigned int uX, unsigned int uY, uint16_t uColor, const String &str, int rect_width, int reverse_text)
Definition: GUIFont.cpp:496
pBook2Font
GUIFont * pBook2Font
Definition: GUIFont.cpp:20
FontData
Definition: GUIFont.cpp:40
GUIFont::GetLineWidth
unsigned int GetLineWidth(const String &str)
Definition: GUIFont.cpp:278
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:734
GUIFont::GetHeight
unsigned int GetHeight() const
Definition: GUIFont.cpp:84
GUIFont::GetStringHeight2
int GetStringHeight2(GUIFont *secondFont, const String &text_str, GUIWindow *pWindow, int startX, int a6)
Definition: GUIFont.cpp:747
pFontLucida
GUIFont * pFontLucida
Definition: GUIFont.cpp:19
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1949
GUIFont::DrawTextLine
void DrawTextLine(const String &text, uint16_t uDefaultColor, int uX, int uY, int max_len_pix)
Definition: GUIFont.cpp:88
Image
Definition: Image.h:19
GUIFont::IsCharValid
bool IsCharValid(unsigned char c) const
Definition: GUIFont.cpp:80
pFontArrus
GUIFont * pFontArrus
Definition: GUIFont.cpp:18
GUIFont::AlignText_Center
unsigned int AlignText_Center(unsigned int width, const String &str)
Definition: GUIFont.cpp:306
pBookFont
GUIFont * pBookFont
Definition: GUIFont.cpp:21
GUIFont::LoadFont
static GUIFont * LoadFont(const char *pFontFile, const char *pFontPalette,...)
Definition: GUIFont.cpp:56
width
EGLSurface EGLint EGLint EGLint width
Definition: SDL_egl.h:1596
GUIFont::CalcTextHeight
unsigned int CalcTextHeight(const String &str, unsigned int width, int x_offset, bool return_on_carriage=false)
Definition: GUIFont.cpp:246
GUIFont::GetPageTop
String GetPageTop(const String &pInString, GUIWindow *pWindow, unsigned int uX, int a5)
Definition: GUIFont.cpp:211
GUIFont::DrawText
void DrawText(GUIWindow *pWindow, int uX, int uY, uint16_t uFontColor, const String &str, bool present_time_transparency, int max_text_height, int uFontShadowColor)
Definition: GUIFont.cpp:388
pAutonoteFont
GUIFont * pAutonoteFont
Definition: GUIFont.cpp:16
GUIFont::DrawTextLineToBuff
void DrawTextLineToBuff(uint16_t uColor, uint32_t *uX_buff_pos, const String &text, int line_width)
Definition: GUIFont.cpp:160
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
GUIFont::FitTwoFontStringINWindow
String FitTwoFontStringINWindow(const String &pString, GUIFont *pFontSecond, GUIWindow *pWindow, int startPixlOff, int a6)
Definition: GUIFont.cpp:657
GUIFont::FitTextInAWindow
String FitTextInAWindow(const String &inString, unsigned int width, int uX, bool return_on_carriage=false)
Definition: GUIFont.cpp:311
image
EGLImageKHR image
Definition: SDL_egl.h:953
uint32_t
unsigned __int32 uint32_t
Definition: SDL_config.h:39
String
std::string String
Definition: Strings.h:10
Strings.h