mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-28 03:31:49 +01:00
This commit is contained in:
parent
74d1db9684
commit
4dd183302e
@ -26,7 +26,7 @@ static FT_Library ftLibrary; /**< FreeType FT_Library instance. */
|
|||||||
static FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */
|
static FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */
|
||||||
static FT_GlyphSlot ftSlot; /**< FreeType reusable FT_GlyphSlot glyph container object. */
|
static FT_GlyphSlot ftSlot; /**< FreeType reusable FT_GlyphSlot glyph container object. */
|
||||||
|
|
||||||
FreeTypeGX *fontSystem[50];
|
FreeTypeGX *fontSystem[MAX_FONT_SIZE+1];
|
||||||
|
|
||||||
void InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize)
|
void InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize)
|
||||||
{
|
{
|
||||||
|
@ -162,6 +162,8 @@
|
|||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#define MAX_FONT_SIZE 100
|
||||||
|
|
||||||
/*! \struct ftgxCharData_
|
/*! \struct ftgxCharData_
|
||||||
*
|
*
|
||||||
* Font face character glyph relevant data structure.
|
* Font face character glyph relevant data structure.
|
||||||
|
@ -618,10 +618,14 @@ class GuiText : public GuiElement
|
|||||||
//!\param s Font size
|
//!\param s Font size
|
||||||
void SetFontSize(int s);
|
void SetFontSize(int s);
|
||||||
//!Sets the maximum width of the drawn texture image
|
//!Sets the maximum width of the drawn texture image
|
||||||
//!If the text exceeds this, it is wrapped to the next line
|
|
||||||
//!\param w Maximum width
|
//!\param w Maximum width
|
||||||
void SetMaxWidth(int width);
|
void SetMaxWidth(int width);
|
||||||
|
//!Enables/disables text scrolling
|
||||||
|
//!\param s Scrolling on/off
|
||||||
void SetScroll(int s);
|
void SetScroll(int s);
|
||||||
|
//!Enables/disables text wrapping
|
||||||
|
//!\param w Wrapping on/off
|
||||||
|
//!\param width Maximum width (0 to disable)
|
||||||
void SetWrap(bool w, int width = 0);
|
void SetWrap(bool w, int width = 0);
|
||||||
//!Sets the font color
|
//!Sets the font color
|
||||||
//!\param c Font color
|
//!\param c Font color
|
||||||
@ -636,16 +640,16 @@ class GuiText : public GuiElement
|
|||||||
//!Constantly called to draw the text
|
//!Constantly called to draw the text
|
||||||
void Draw();
|
void Draw();
|
||||||
protected:
|
protected:
|
||||||
char * origText;
|
char * origText; //!< Original text data
|
||||||
wchar_t* text; //!< Unicode text value
|
wchar_t* text; //!< Unicode text value
|
||||||
int size; //!< Font size
|
int size; //!< Font size
|
||||||
int maxWidth; //!< Maximum width of the generated text object (for text wrapping)
|
int maxWidth; //!< Maximum width of the generated text object (for text wrapping)
|
||||||
bool wrap;
|
bool wrap; //!< Wrapping toggle
|
||||||
wchar_t* textDyn;
|
wchar_t* textDyn; //!< Wrapped text value
|
||||||
int textScroll;
|
int textScroll; //!< Scrolling toggle
|
||||||
int textScrollPos;
|
int textScrollPos; //!< Current starting index of text string for scrolling
|
||||||
int textScrollInitialDelay;
|
int textScrollInitialDelay; //!< Delay to wait before starting to scroll
|
||||||
int textScrollDelay;
|
int textScrollDelay; //!< Scrolling speed
|
||||||
u16 style; //!< FreeTypeGX style attributes
|
u16 style; //!< FreeTypeGX style attributes
|
||||||
GXColor color; //!< Font color
|
GXColor color; //!< Font color
|
||||||
};
|
};
|
||||||
|
@ -216,6 +216,9 @@ void GuiText::Draw()
|
|||||||
|
|
||||||
int newSize = size*this->GetScale();
|
int newSize = size*this->GetScale();
|
||||||
|
|
||||||
|
if(newSize > MAX_FONT_SIZE)
|
||||||
|
newSize = MAX_FONT_SIZE;
|
||||||
|
|
||||||
if(newSize != currentSize)
|
if(newSize != currentSize)
|
||||||
{
|
{
|
||||||
ChangeFontSize(newSize);
|
ChangeFontSize(newSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user