*more fixes

*quick and ugly widescreen text fix which needs to be changed later
This commit is contained in:
dimok321 2009-10-18 08:38:41 +00:00
parent 0c7ac826c3
commit 06e5f81c3a
12 changed files with 146 additions and 124 deletions

View File

@ -150,9 +150,9 @@ void FreeTypeGX::InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize, bool load
ftSlot = ftFace->glyph;
}
void FreeTypeGX::ChangeFontSize(FT_UInt pixelSize)
void FreeTypeGX::ChangeFontSize(FT_UInt pixelSize, FT_UInt pixelSizeHorz)
{
FT_Set_Pixel_Sizes(ftFace, 0, pixelSize);
FT_Set_Pixel_Sizes(ftFace, pixelSizeHorz, pixelSize);
}
uint8_t FreeTypeGX::GetMaxCharWidth()

View File

@ -286,7 +286,7 @@ class FreeTypeGX {
~FreeTypeGX();
void InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize, bool loadcustomfont);
void ChangeFontSize(FT_UInt pixelSize);
void ChangeFontSize(FT_UInt pixelSize, FT_UInt pixelSizeHorz = 0);
uint8_t GetMaxCharWidth();
void setVertexFormat(uint8_t vertexIndex);

View File

@ -150,7 +150,7 @@ int MenuHomebrewBrowse() {
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage backBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton backBtn(&backBtnImg,&backBtnImg, 2, 3, -180, 400, &trigA, &btnSoundOver, &btnClick,1);

View File

@ -760,6 +760,8 @@ class GuiText : public GuiElement
//!\param font bufferblock
//!\param font filesize
bool SetFont(const u8 *font, const u32 filesize);
//!SetWidescreen
void SetWidescreen(bool w);
//!Constantly called to draw the text
void Draw();
protected:

View File

@ -38,7 +38,7 @@ GuiText::GuiText(const char * t, int s, GXColor c)
firstLine = 0;
linestodraw = 8;
totalLines = 0;
widescreen = 0; //added
widescreen = false; //added
LineBreak = NULL;
textDyn = NULL;
font = NULL;
@ -85,7 +85,7 @@ GuiText::GuiText(const char * t)
firstLine = 0;
linestodraw = 8;
totalLines = 0;
widescreen = 0; //added
widescreen = false; //added
LineBreak = NULL;
textDyn = NULL;
font = NULL;
@ -211,7 +211,11 @@ void GuiText::SetText(const wchar_t * t)
{
int len = wcslen(t);
text = new wchar_t[len+1];
if(text) wcscpy(text, t);
if(text)
{
wcscpy(text, t);
textWidth = fontSystem[currentSize]->getWidth(text);
}
}
}
@ -465,6 +469,12 @@ bool GuiText::SetFont(const u8 *fontbuffer, const u32 filesize)
return true;
}
void GuiText::SetWidescreen(bool w)
{
LOCK(this);
widescreen = w;
}
/**
* Draw the text on screen
*/
@ -498,6 +508,9 @@ void GuiText::Draw()
currentSize = newSize;
}
if(widescreen)
(font ? font : fontSystem[currentSize])->ChangeFontSize(currentSize, currentSize*0.8);
if(maxWidth > 0 && maxWidth <= textWidth)
{
if(wrapMode == LONGTEXT) // text wrapping
@ -711,4 +724,7 @@ void GuiText::Draw()
(font ? font : fontSystem[currentSize])->drawText(this->GetLeft(), this->GetTop(), text, c, style);
}
this->UpdateEffects();
if(widescreen)
(font ? font : fontSystem[currentSize])->ChangeFontSize(currentSize, 0);
}

View File

@ -173,7 +173,7 @@ int DiscBrowse(struct discHdr * header) {
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage cancelBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//cancelBtnTxt.SetWidescreen(CFG.widescreen);
cancelBtnTxt.SetWidescreen(CFG.widescreen);
cancelBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);

View File

@ -90,7 +90,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) {
GuiText okBtnTxt(tr("OK"), 22, THEME.prompttext);
GuiImage okBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//okBtnTxt.SetWidescreen(CFG.widescreen);
okBtnTxt.SetWidescreen(CFG.widescreen);
okBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton okBtn(&okBtnImg,&okBtnImg, 0, 4, 5, 15, &trigA, &btnSoundOver, &btnClick,1);
@ -98,7 +98,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) {
GuiText cancelBtnTxt(tr("Cancel"), 22, THEME.prompttext);
GuiImage cancelBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//cancelBtnTxt.SetWidescreen(CFG.widescreen);
cancelBtnTxt.SetWidescreen(CFG.widescreen);
cancelBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 1, 4, -5, 15, &trigA, &btnSoundOver, &btnClick,1);
@ -459,7 +459,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn1Txt(btn1Label, 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
@ -470,7 +470,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn2Txt(btn2Label, 22, THEME.prompttext);
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn2Txt.SetWidescreen(CFG.widescreen);
btn2Txt.SetWidescreen(CFG.widescreen);
btn2Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn2(&btn2Img, &btn2Img, 0,3,0,0,&trigA,&btnSoundOver,&btnClick,1);
@ -481,7 +481,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn3Txt(btn3Label, 22, THEME.prompttext);
GuiImage btn3Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn3Txt.SetWidescreen(CFG.widescreen);
btn3Txt.SetWidescreen(CFG.widescreen);
btn3Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn3(&btn3Img, &btn3Img, 0,3,0,0,&trigA,&btnSoundOver,&btnClick,1);
@ -492,7 +492,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn4Txt(btn4Label, 22, THEME.prompttext);
GuiImage btn4Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn4Txt.SetWidescreen(CFG.widescreen);
btn4Txt.SetWidescreen(CFG.widescreen);
btn4Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn4(&btn4Img, &btn4Img, 0,3,0,0,&trigA,&btnSoundOver,&btnClick,1);
@ -778,7 +778,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
closeTxt.SetPosition(10,3);
GuiImage closeImg(&close);
if (Settings.wsprompt == yes) {
//closeTxt.SetWidescreen(CFG.widescreen);
closeTxt.SetWidescreen(CFG.widescreen);
closeImg.SetWidescreen(CFG.widescreen);
}
GuiButton closeBtn(close.GetWidth(), close.GetHeight());
@ -797,7 +797,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn2Txt((HBC!=1?tr("Homebrew Channel"):btn1Label), 28, (GXColor) {0, 0, 0, 255});
GuiImage btn2Img(&button);
if (Settings.wsprompt == yes) {
//btn2Txt.SetWidescreen(CFG.widescreen);
btn2Txt.SetWidescreen(CFG.widescreen);
btn2Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn2(&btn2Img,&btn2Img, 2, 5, -150, 0, &trigA, &btnSoundOver, &btnClick,1);
@ -811,7 +811,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn3Txt(btn2Label, 28, (GXColor) {0, 0, 0, 255});
GuiImage btn3Img(&button);
if (Settings.wsprompt == yes) {
//btn3Txt.SetWidescreen(CFG.widescreen);
btn3Txt.SetWidescreen(CFG.widescreen);
btn3Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn3(&btn3Img,&btn3Img, 2, 5, 150, 0, &trigA, &btnSoundOver, &btnClick,1);
@ -1060,8 +1060,8 @@ int GameWindowPrompt() {
if (Settings.wsprompt == yes)
nameBtnTT.SetWidescreen(CFG.widescreen);
GuiText nameTxt("", 22, THEME.prompttext);
//if (Settings.wsprompt == yes)
//nameTxt.SetWidescreen(CFG.widescreen);
if (Settings.wsprompt == yes)
nameTxt.SetWidescreen(CFG.widescreen);
nameTxt.SetMaxWidth(350, SCROLL_HORIZONTAL);
GuiButton nameBtn(120,50);
nameBtn.SetLabel(&nameTxt);
@ -1110,7 +1110,7 @@ int GameWindowPrompt() {
GuiText btn2Txt(tr("Back"), 22, THEME.prompttext);
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn2Txt.SetWidescreen(CFG.widescreen);
btn2Txt.SetWidescreen(CFG.widescreen);
btn2Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn2(&btn2Img,&btn2Img, 1, 5, 0, 0, &trigA, &btnSoundOver, &btnClick,1);
@ -1128,7 +1128,7 @@ int GameWindowPrompt() {
GuiText btn3Txt(tr("Settings"), 22, THEME.prompttext);
GuiImage btn3Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn3Txt.SetWidescreen(CFG.widescreen);
btn3Txt.SetWidescreen(CFG.widescreen);
btn3Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn3(&btn3Img,&btn3Img, 0, 4, 50, -40, &trigA, &btnSoundOver, &btnClick,1);
@ -1566,7 +1566,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char *
GuiText btn1Txt(btn1Label, 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 1, 5, 0, 0, &trigA, &btnSoundOver, &btnClick,1);
@ -1586,7 +1586,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char *
GuiText btn2Txt(btn2Label, 22, THEME.prompttext);
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn2Txt.SetWidescreen(CFG.widescreen);
btn2Txt.SetWidescreen(CFG.widescreen);
btn2Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn2(&btn2Img,&btn2Img, 1, 4, -20, -25, &trigA, &btnSoundOver, &btnClick,1);
@ -1872,7 +1872,7 @@ bool NetworkInitPrompt() {
GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -45, &trigA, &btnSoundOver, &btnClick,1);
@ -2000,7 +2000,7 @@ ProgressDownloadWindow(int choice2) {
GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -45, &trigA, &btnSoundOver, &btnClick,1);
@ -2484,7 +2484,7 @@ int ProgressUpdateWindow() {
GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -40, &trigA, &btnSoundOver, &btnClick,1);
@ -3112,7 +3112,7 @@ int CodeDownload(const char *id) {
GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -40, &trigA, &btnSoundOver, &btnClick,1);
@ -3389,7 +3389,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
GuiText btn1Txt(tr("Load"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
@ -3400,7 +3400,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
GuiText btn2Txt(tr("Back"), 22, THEME.prompttext);
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes) {
//btn2Txt.SetWidescreen(CFG.widescreen);
btn2Txt.SetWidescreen(CFG.widescreen);
btn2Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn2(&btn2Img, &btn2Img, 0,3,0,0,&trigA,&btnSoundOver,&btnClick,1);

View File

@ -262,7 +262,7 @@ int TitleBrowser(u32 type) {
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage cancelBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//cancelBtnTxt.SetWidescreen(CFG.widescreen);
cancelBtnTxt.SetWidescreen(CFG.widescreen);
cancelBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);

View File

@ -322,7 +322,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
GuiText ExitBtnTxt(tr("Cancel"), 24, (GXColor) {0, 0, 0, 255});
GuiImage ExitBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//ExitBtnTxt.SetWidescreen(CFG.widescreen);
ExitBtnTxt.SetWidescreen(CFG.widescreen);
ExitBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton ExitBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -337,7 +337,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
GuiText usbBtnTxt(browsers[(curDevice+1)%browsers.size()].rootdir, 24, (GXColor) {0, 0, 0, 255});
GuiImage usbBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//usbBtnTxt.SetWidescreen(CFG.widescreen);
usbBtnTxt.SetWidescreen(CFG.widescreen);
usbBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton usbBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -351,7 +351,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
GuiText okBtnTxt(tr("OK"), 22, THEME.prompttext);
GuiImage okBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//okBtnTxt.SetWidescreen(CFG.widescreen);
okBtnTxt.SetWidescreen(CFG.widescreen);
okBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton okBtn(&okBtnImg,&okBtnImg, 0, 4, 40, -35, &trigA, &btnSoundOver, &btnClick,1);

View File

@ -121,7 +121,7 @@ int MenuSettings() {
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage backBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton backBtn(&backBtnImg,&backBtnImg, 2, 3, -180, 400, &trigA, &btnSoundOver, &btnClick,1);
@ -1853,7 +1853,7 @@ int GameSettings(struct discHdr * header) {
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage backBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton backBtn(&backBtnImg,&backBtnImg, 2, 3, -180, 400, &trigA, &btnSoundOver, &btnClick,1);
@ -1867,7 +1867,7 @@ int GameSettings(struct discHdr * header) {
saveBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage saveBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//saveBtnTxt.SetWidescreen(CFG.widescreen);
saveBtnTxt.SetWidescreen(CFG.widescreen);
saveBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton saveBtn(&saveBtnImg,&saveBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);

View File

@ -85,7 +85,7 @@ bool MenuOGG() {
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage backBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -103,7 +103,7 @@ bool MenuOGG() {
defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage defaultBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//defaultBtnTxt.SetWidescreen(CFG.widescreen);
defaultBtnTxt.SetWidescreen(CFG.widescreen);
defaultBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton defaultBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -367,7 +367,7 @@ int MenuLanguageSelect() {
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage backBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -385,7 +385,7 @@ int MenuLanguageSelect() {
defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage defaultBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//defaultBtnTxt.SetWidescreen(CFG.widescreen);
defaultBtnTxt.SetWidescreen(CFG.widescreen);
defaultBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton defaultBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -402,7 +402,7 @@ int MenuLanguageSelect() {
updateBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage updateBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
//updateBtnTxt.SetWidescreen(CFG.widescreen);
updateBtnTxt.SetWidescreen(CFG.widescreen);
updateBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton updateBtn(btnOutline.GetWidth(), btnOutline.GetHeight());

View File

@ -141,9 +141,11 @@ s32 Wad_Install(FILE *fp)
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes){
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);}
if (Settings.wsprompt == yes)
{
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -35, &trigA, &btnSoundOver, &btnClick,1);
btn1.SetLabel(&btn1Txt);
btn1.SetState(STATE_SELECTED);
@ -470,9 +472,11 @@ s32 Wad_Uninstall(FILE *fp)
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes){
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);}
if (Settings.wsprompt == yes)
{
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -55, &trigA, &btnSoundOver, &btnClick,1);
btn1.SetLabel(&btn1Txt);
btn1.SetState(STATE_SELECTED);