mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 11:19:17 +01:00
Added a special font for the clock
This commit is contained in:
parent
fc549f113f
commit
a00104784f
12
source/cfg.c
12
source/cfg.c
@ -177,9 +177,12 @@ void cfg_int(char *name, short *var, int count)
|
||||
|
||||
//static char bg_path[100];
|
||||
|
||||
void CFG_Default()
|
||||
void CFG_Default(int widescreen) // -1 = non forced Mode
|
||||
{
|
||||
if(widescreen == -1)
|
||||
CFG.widescreen = CONF_GetAspectRatio();
|
||||
else
|
||||
CFG.widescreen = widescreen;
|
||||
|
||||
if (CFG.widescreen) {
|
||||
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "SD:/wtheme/");
|
||||
@ -346,6 +349,10 @@ void widescreen_set(char *name, char *val)
|
||||
cfg_name = name;
|
||||
cfg_val = val;
|
||||
|
||||
short widescreen;
|
||||
if (cfg_bool("widescreen", &widescreen) && CFG.widescreen != widescreen)
|
||||
CFG_Default(widescreen); //reset default when forced an other Screenmode
|
||||
/*
|
||||
if (cfg_bool("widescreen", &CFG.widescreen)) //reset default
|
||||
{
|
||||
if (CFG.widescreen) {
|
||||
@ -358,6 +365,7 @@ void widescreen_set(char *name, char *val)
|
||||
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "SD:/theme/");
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -1019,7 +1027,7 @@ void CFG_Load(int argc, char **argv)
|
||||
//set app path
|
||||
// chdir_app(argv[0]);
|
||||
|
||||
CFG_Default();
|
||||
CFG_Default(-1); // set defaults non forced
|
||||
|
||||
snprintf(pathname, sizeof(pathname), "SD:/config/config.txt");
|
||||
|
||||
|
@ -142,7 +142,7 @@ struct Game_CFG
|
||||
};
|
||||
|
||||
|
||||
void CFG_Default();
|
||||
void CFG_Default(int widescreen); // -1 = non forced mode
|
||||
void CFG_Load(int argc, char **argv);
|
||||
struct Game_CFG* CFG_get_game_opt(u8 *id);
|
||||
bool CFG_save_game_opt(u8 *id);
|
||||
|
@ -14,6 +14,9 @@
|
||||
extern const u8 font_ttf[];
|
||||
extern const u32 font_ttf_size;
|
||||
|
||||
extern const u8 clock_ttf[];
|
||||
extern const u32 clock_ttf_size;
|
||||
|
||||
extern const u8 sdcard_png[];
|
||||
extern const u32 sdcard_png_size;
|
||||
|
||||
|
BIN
source/fonts/clock.ttf
Normal file
BIN
source/fonts/clock.ttf
Normal file
Binary file not shown.
@ -622,6 +622,7 @@ class GuiText : public GuiElement
|
||||
//!\param hor Horizontal alignment (ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTRE)
|
||||
//!\param vert Vertical alignment (ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)
|
||||
void SetAlignment(int hor, int vert);
|
||||
void SetFont(FreeTypeGX *f);
|
||||
//!Constantly called to draw the text
|
||||
void Draw();
|
||||
protected:
|
||||
@ -630,6 +631,7 @@ class GuiText : public GuiElement
|
||||
int maxWidth; //!< Maximum width of the generated text object (for text wrapping)
|
||||
u16 style; //!< FreeTypeGX style attributes
|
||||
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)
|
||||
|
@ -29,6 +29,7 @@ GuiText::GuiText(const char * t, int s, GXColor c)
|
||||
alpha = c.a;
|
||||
style = FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE;
|
||||
maxWidth = 0;
|
||||
font = 0;
|
||||
|
||||
alignmentHor = ALIGN_CENTRE;
|
||||
alignmentVert = ALIGN_MIDDLE;
|
||||
@ -142,7 +143,13 @@ void GuiText::SetAlignment(int hor, int vert)
|
||||
alignmentHor = hor;
|
||||
alignmentVert = vert;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Font
|
||||
*/
|
||||
void GuiText::SetFont(FreeTypeGX *f)
|
||||
{
|
||||
font = f;
|
||||
}
|
||||
/**
|
||||
* Draw the text on screen
|
||||
*/
|
||||
@ -161,7 +168,7 @@ void GuiText::Draw()
|
||||
|
||||
if(newSize != currentSize)
|
||||
{
|
||||
fontSystem->changeSize(newSize);
|
||||
(font ? font : fontSystem)->changeSize(newSize);
|
||||
currentSize = newSize;
|
||||
}
|
||||
|
||||
@ -191,7 +198,7 @@ void GuiText::Draw()
|
||||
|
||||
if(text[ch] == ' ' || ch == strlen-1)
|
||||
{
|
||||
if(fontSystem->getWidth(tmptext[linenum]) >= maxWidth)
|
||||
if((font ? font : fontSystem)->getWidth(tmptext[linenum]) >= maxWidth)
|
||||
{
|
||||
if(lastSpace >= 0)
|
||||
{
|
||||
@ -222,13 +229,13 @@ void GuiText::Draw()
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
@ -41,7 +41,8 @@
|
||||
#define CONSOLE_WIDTH 340
|
||||
#define CONSOLE_HEIGHT 218
|
||||
|
||||
FreeTypeGX *fontSystem;
|
||||
FreeTypeGX *fontSystem=0;
|
||||
FreeTypeGX *fontClock=0;
|
||||
int ExitRequested = 0;
|
||||
bool netcheck = false;
|
||||
|
||||
@ -146,6 +147,10 @@ main(int argc, char *argv[])
|
||||
fontSystem->loadFont(font_ttf, font_ttf_size, 0);
|
||||
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();
|
||||
MainMenu(MENU_CHECK);
|
||||
return 0;
|
||||
|
@ -42,6 +42,8 @@
|
||||
|
||||
#define MAX_CHARACTERS 38
|
||||
|
||||
extern FreeTypeGX *fontClock; //CLOCK
|
||||
|
||||
static GuiImage * coverImg = NULL;
|
||||
static GuiImageData * cover = NULL;
|
||||
|
||||
@ -2381,6 +2383,7 @@ static int MenuDiscList()
|
||||
GuiText clockTime(theTime, 30, (GXColor){138, 138, 138, 255});
|
||||
clockTime.SetAlignment(THEME.clockAlign, ALIGN_BOTTOM);
|
||||
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
|
||||
clockTime.SetFont(fontClock);
|
||||
|
||||
HaltGui();
|
||||
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 (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(coverImg);
|
||||
// w.Remove(coverImg);
|
||||
|
||||
if (GameIDTxt)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user