Added a special font for the clock

This commit is contained in:
ardi@ist-einmalig.de 2009-05-04 21:50:46 +00:00
parent fc549f113f
commit a00104784f
8 changed files with 1158 additions and 1130 deletions

File diff suppressed because it is too large Load Diff

View File

@ -142,85 +142,85 @@ struct Game_CFG
}; };
void CFG_Default(); void CFG_Default(int widescreen); // -1 = non forced mode
void CFG_Load(int argc, char **argv); void CFG_Load(int argc, char **argv);
struct Game_CFG* CFG_get_game_opt(u8 *id); struct Game_CFG* CFG_get_game_opt(u8 *id);
bool CFG_save_game_opt(u8 *id); bool CFG_save_game_opt(u8 *id);
bool CFG_forget_game_opt(u8 *id); bool CFG_forget_game_opt(u8 *id);
//Astidof - Begin of modification //Astidof - Begin of modification
enum { enum {
ConsoleLangDefault, ConsoleLangDefault,
jap, jap,
eng, eng,
ger, ger,
fren, fren,
esp, esp,
it, it,
dut, dut,
schin, schin,
tchin, tchin,
kor kor
}; };
enum { enum {
systemdefault, systemdefault,
discdefault, discdefault,
patch, patch,
pal50, pal50,
pal60, pal60,
ntsc ntsc
}; };
enum { enum {
off, off,
on, on,
}; };
enum { enum {
GameID, GameID,
GameRegion, GameRegion,
Both, Both,
Neither, Neither,
}; };
enum { enum {
i249, i249,
i222, i222,
}; };
enum { enum {
ios249, ios249,
ios222, ios222,
}; };
enum { enum {
HDDInfo, HDDInfo,
Clock, Clock,
}; };
enum { enum {
RumbleOff, RumbleOff,
RumbleOn, RumbleOn,
}; };
enum { enum {
TooltipsOff, TooltipsOff,
TooltipsOn, TooltipsOn,
}; };
enum { enum {
v10, v10,
v20, v20,
v30, v30,
v40, v40,
v50, v50,
v60, v60,
v70, v70,
v80, v80,
v90, v90,
v100, v100,
v0, v0,
}; };
enum { enum {
@ -228,24 +228,24 @@ enum {
ParentalControlLevel1, ParentalControlLevel1,
ParentalControlLevel2, ParentalControlLevel2,
ParentalControlLevel3 ParentalControlLevel3
}; };
struct SSettings { struct SSettings {
int video; int video;
int language; int language;
int ocarina; int ocarina;
int vpatch; int vpatch;
int ios; int ios;
int sinfo; int sinfo;
int hddinfo; int hddinfo;
int rumble; int rumble;
int volume; int volume;
int tooltips; int tooltips;
char unlockCode[20]; char unlockCode[20];
int parentalcontrol; int parentalcontrol;
int cios; int cios;
}; };
void CFG_LoadGlobal(void); void CFG_LoadGlobal(void);
bool cfg_save_global(void); bool cfg_save_global(void);
//Astidof - End of modification //Astidof - End of modification

View File

@ -14,6 +14,9 @@
extern const u8 font_ttf[]; extern const u8 font_ttf[];
extern const u32 font_ttf_size; extern const u32 font_ttf_size;
extern const u8 clock_ttf[];
extern const u32 clock_ttf_size;
extern const u8 sdcard_png[]; extern const u8 sdcard_png[];
extern const u32 sdcard_png_size; extern const u32 sdcard_png_size;

BIN
source/fonts/clock.ttf Normal file

Binary file not shown.

View File

@ -622,6 +622,7 @@ class GuiText : public GuiElement
//!\param hor Horizontal alignment (ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTRE) //!\param hor Horizontal alignment (ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTRE)
//!\param vert Vertical alignment (ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE) //!\param vert Vertical alignment (ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)
void SetAlignment(int hor, int vert); void SetAlignment(int hor, int vert);
void SetFont(FreeTypeGX *f);
//!Constantly called to draw the text //!Constantly called to draw the text
void Draw(); void Draw();
protected: protected:
@ -630,6 +631,7 @@ class GuiText : public GuiElement
int maxWidth; //!< Maximum width of the generated text object (for text wrapping) int maxWidth; //!< Maximum width of the generated text object (for text wrapping)
u16 style; //!< FreeTypeGX style attributes u16 style; //!< FreeTypeGX style attributes
GXColor color; //!< Font color GXColor color; //!< Font color
FreeTypeGX *font;
}; };
//!Display, manage, and manipulate buttons in the GUI. Buttons can have images, icons, text, and sound set (all of which are optional) //!Display, manage, and manipulate buttons in the GUI. Buttons can have images, icons, text, and sound set (all of which are optional)

View File

@ -29,6 +29,7 @@ GuiText::GuiText(const char * t, int s, GXColor c)
alpha = c.a; alpha = c.a;
style = FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE; style = FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE;
maxWidth = 0; maxWidth = 0;
font = 0;
alignmentHor = ALIGN_CENTRE; alignmentHor = ALIGN_CENTRE;
alignmentVert = ALIGN_MIDDLE; alignmentVert = ALIGN_MIDDLE;
@ -142,7 +143,13 @@ void GuiText::SetAlignment(int hor, int vert)
alignmentHor = hor; alignmentHor = hor;
alignmentVert = vert; alignmentVert = vert;
} }
/**
* Set the Font
*/
void GuiText::SetFont(FreeTypeGX *f)
{
font = f;
}
/** /**
* Draw the text on screen * Draw the text on screen
*/ */
@ -161,7 +168,7 @@ void GuiText::Draw()
if(newSize != currentSize) if(newSize != currentSize)
{ {
fontSystem->changeSize(newSize); (font ? font : fontSystem)->changeSize(newSize);
currentSize = newSize; currentSize = newSize;
} }
@ -191,7 +198,7 @@ void GuiText::Draw()
if(text[ch] == ' ' || ch == strlen-1) if(text[ch] == ' ' || ch == strlen-1)
{ {
if(fontSystem->getWidth(tmptext[linenum]) >= maxWidth) if((font ? font : fontSystem)->getWidth(tmptext[linenum]) >= maxWidth)
{ {
if(lastSpace >= 0) if(lastSpace >= 0)
{ {
@ -222,13 +229,13 @@ void GuiText::Draw()
for(i=0; i < linenum; i++) for(i=0; i < linenum; i++)
{ {
fontSystem->drawText(this->GetLeft(), this->GetTop()+voffset+i*lineheight, tmptext[i], c, style); (font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop()+voffset+i*lineheight, tmptext[i], c, style);
delete tmptext[i]; delete tmptext[i];
} }
} }
else else
{ {
fontSystem->drawText(this->GetLeft(), this->GetTop()+voffset, text, c, style); (font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop()+voffset, text, c, style);
} }
this->UpdateEffects(); this->UpdateEffects();
} }

View File

@ -41,7 +41,8 @@
#define CONSOLE_WIDTH 340 #define CONSOLE_WIDTH 340
#define CONSOLE_HEIGHT 218 #define CONSOLE_HEIGHT 218
FreeTypeGX *fontSystem; FreeTypeGX *fontSystem=0;
FreeTypeGX *fontClock=0;
int ExitRequested = 0; int ExitRequested = 0;
bool netcheck = false; bool netcheck = false;
@ -146,6 +147,10 @@ main(int argc, char *argv[])
fontSystem->loadFont(font_ttf, font_ttf_size, 0); fontSystem->loadFont(font_ttf, font_ttf_size, 0);
fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE); fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
fontClock = new FreeTypeGX();
fontClock->loadFont(clock_ttf, clock_ttf_size, 0);
fontClock->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
InitGUIThreads(); InitGUIThreads();
MainMenu(MENU_CHECK); MainMenu(MENU_CHECK);
return 0; return 0;

View File

@ -42,6 +42,8 @@
#define MAX_CHARACTERS 38 #define MAX_CHARACTERS 38
extern FreeTypeGX *fontClock; //CLOCK
static GuiImage * coverImg = NULL; static GuiImage * coverImg = NULL;
static GuiImageData * cover = NULL; static GuiImageData * cover = NULL;
@ -2381,6 +2383,7 @@ static int MenuDiscList()
GuiText clockTime(theTime, 30, (GXColor){138, 138, 138, 255}); GuiText clockTime(theTime, 30, (GXColor){138, 138, 138, 255});
clockTime.SetAlignment(THEME.clockAlign, ALIGN_BOTTOM); clockTime.SetAlignment(THEME.clockAlign, ALIGN_BOTTOM);
clockTime.SetPosition(THEME.clock_x, THEME.clock_y); clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
clockTime.SetFont(fontClock);
HaltGui(); HaltGui();
GuiWindow w(screenwidth, screenheight); GuiWindow w(screenwidth, screenheight);
@ -2609,7 +2612,7 @@ static int MenuDiscList()
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
w.Remove(&DownloadBtn); w.Remove(&DownloadBtn);
w.Remove(coverImg); // w.Remove(coverImg);
if (GameIDTxt) if (GameIDTxt)
{ {