shrink file selector font size, increase to 10 entries

This commit is contained in:
dborth 2009-06-18 05:47:02 +00:00
parent 026a1860a7
commit 70cdb15f83
8 changed files with 38 additions and 37 deletions

View File

@ -18,7 +18,7 @@
#include <gccore.h> #include <gccore.h>
#define MAXJOLIET 255 #define MAXJOLIET 255
#define MAXDISPLAY 35 #define MAXDISPLAY 40
typedef struct typedef struct
{ {

View File

@ -52,12 +52,13 @@
extern FreeTypeGX *fontSystem; extern FreeTypeGX *fontSystem;
#define SCROLL_INITIAL_DELAY 20 #define SCROLL_INITIAL_DELAY 20
#define SCROLL_LOOP_DELAY 3 #define SCROLL_LOOP_DELAY 3
#define PAGESIZE 8 #define FILE_PAGESIZE 10
#define SAVELISTSIZE 6 #define PAGESIZE 8
#define MAX_SAVES 20 #define SAVELISTSIZE 6
#define MAX_OPTIONS 30 #define MAX_SAVES 20
#define MAX_OPTIONS 30
typedef void (*UpdateCallback)(void * e); typedef void (*UpdateCallback)(void * e);
@ -889,14 +890,14 @@ class GuiFileBrowser : public GuiElement
void Draw(); void Draw();
void TriggerUpdate(); void TriggerUpdate();
void Update(GuiTrigger * t); void Update(GuiTrigger * t);
GuiButton * fileList[PAGESIZE]; GuiButton * fileList[FILE_PAGESIZE];
protected: protected:
int selectedItem; int selectedItem;
bool listChanged; bool listChanged;
GuiText * fileListText[PAGESIZE]; GuiText * fileListText[FILE_PAGESIZE];
GuiImage * fileListBg[PAGESIZE]; GuiImage * fileListBg[FILE_PAGESIZE];
GuiImage * fileListFolder[PAGESIZE]; GuiImage * fileListFolder[FILE_PAGESIZE];
GuiButton * arrowUpBtn; GuiButton * arrowUpBtn;
GuiButton * arrowDownBtn; GuiButton * arrowDownBtn;

View File

@ -92,26 +92,26 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg); scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg);
scrollbarBoxBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); scrollbarBoxBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
scrollbarBoxBtn->SetMinY(0); scrollbarBoxBtn->SetMinY(0);
scrollbarBoxBtn->SetMaxY(136); scrollbarBoxBtn->SetMaxY(156);
scrollbarBoxBtn->SetSelectable(false); scrollbarBoxBtn->SetSelectable(false);
scrollbarBoxBtn->SetClickable(false); scrollbarBoxBtn->SetClickable(false);
scrollbarBoxBtn->SetHoldable(true); scrollbarBoxBtn->SetHoldable(true);
scrollbarBoxBtn->SetTrigger(trigHeldA); scrollbarBoxBtn->SetTrigger(trigHeldA);
for(int i=0; i<PAGESIZE; i++) for(int i=0; i<FILE_PAGESIZE; i++)
{ {
fileListText[i] = new GuiText(NULL,22, (GXColor){0, 0, 0, 0xff}); fileListText[i] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff});
fileListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); fileListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
fileListText[i]->SetPosition(5,0); fileListText[i]->SetPosition(5,0);
fileListBg[i] = new GuiImage(bgGameSelectionEntry); fileListBg[i] = new GuiImage(bgGameSelectionEntry);
fileListFolder[i] = new GuiImage(gameFolder); fileListFolder[i] = new GuiImage(gameFolder);
fileList[i] = new GuiButton(380, 30); fileList[i] = new GuiButton(380, 26);
fileList[i]->SetParent(this); fileList[i]->SetParent(this);
fileList[i]->SetLabel(fileListText[i]); fileList[i]->SetLabel(fileListText[i]);
fileList[i]->SetImageOver(fileListBg[i]); fileList[i]->SetImageOver(fileListBg[i]);
fileList[i]->SetPosition(2,30*i+3); fileList[i]->SetPosition(2,26*i+3);
fileList[i]->SetTrigger(trigA); fileList[i]->SetTrigger(trigA);
fileList[i]->SetSoundClick(btnSoundClick); fileList[i]->SetSoundClick(btnSoundClick);
} }
@ -151,7 +151,7 @@ GuiFileBrowser::~GuiFileBrowser()
delete trigHeldA; delete trigHeldA;
delete trigA; delete trigA;
for(int i=0; i<PAGESIZE; i++) for(int i=0; i<FILE_PAGESIZE; i++)
{ {
delete fileListText[i]; delete fileListText[i];
delete fileList[i]; delete fileList[i];
@ -164,7 +164,7 @@ void GuiFileBrowser::SetFocus(int f)
{ {
focus = f; focus = f;
for(int i=0; i<PAGESIZE; i++) for(int i=0; i<FILE_PAGESIZE; i++)
fileList[i]->ResetState(); fileList[i]->ResetState();
if(f == 1) if(f == 1)
@ -177,7 +177,7 @@ void GuiFileBrowser::ResetState()
stateChan = -1; stateChan = -1;
selectedItem = 0; selectedItem = 0;
for(int i=0; i<PAGESIZE; i++) for(int i=0; i<FILE_PAGESIZE; i++)
{ {
fileList[i]->ResetState(); fileList[i]->ResetState();
} }
@ -198,7 +198,7 @@ void GuiFileBrowser::Draw()
bgGameSelectionImg->Draw(); bgGameSelectionImg->Draw();
for(int i=0; i<PAGESIZE; i++) for(int i=0; i<FILE_PAGESIZE; i++)
{ {
fileList[i]->Draw(); fileList[i]->Draw();
} }
@ -227,7 +227,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
if(scrollbarBoxBtn->GetState() == STATE_HELD && if(scrollbarBoxBtn->GetState() == STATE_HELD &&
scrollbarBoxBtn->GetStateChan() == t->chan && scrollbarBoxBtn->GetStateChan() == t->chan &&
t->wpad.ir.valid && t->wpad.ir.valid &&
browser.numEntries > PAGESIZE browser.numEntries > FILE_PAGESIZE
) )
{ {
scrollbarBoxBtn->SetPosition(0,0); scrollbarBoxBtn->SetPosition(0,0);
@ -238,15 +238,15 @@ void GuiFileBrowser::Update(GuiTrigger * t)
else if(positionWiimote > scrollbarBoxBtn->GetMaxY()) else if(positionWiimote > scrollbarBoxBtn->GetMaxY())
positionWiimote = scrollbarBoxBtn->GetMaxY(); positionWiimote = scrollbarBoxBtn->GetMaxY();
browser.pageIndex = (positionWiimote * browser.numEntries)/136.0 - selectedItem; browser.pageIndex = (positionWiimote * browser.numEntries)/156.0 - selectedItem;
if(browser.pageIndex <= 0) if(browser.pageIndex <= 0)
{ {
browser.pageIndex = 0; browser.pageIndex = 0;
} }
else if(browser.pageIndex+PAGESIZE >= browser.numEntries) else if(browser.pageIndex+FILE_PAGESIZE >= browser.numEntries)
{ {
browser.pageIndex = browser.numEntries-PAGESIZE; browser.pageIndex = browser.numEntries-FILE_PAGESIZE;
} }
listChanged = true; listChanged = true;
focus = false; focus = false;
@ -274,11 +274,11 @@ void GuiFileBrowser::Update(GuiTrigger * t)
if(t->Right()) if(t->Right())
{ {
if(browser.pageIndex < browser.numEntries && browser.numEntries > PAGESIZE) if(browser.pageIndex < browser.numEntries && browser.numEntries > FILE_PAGESIZE)
{ {
browser.pageIndex += PAGESIZE; browser.pageIndex += FILE_PAGESIZE;
if(browser.pageIndex+PAGESIZE >= browser.numEntries) if(browser.pageIndex+FILE_PAGESIZE >= browser.numEntries)
browser.pageIndex = browser.numEntries-PAGESIZE; browser.pageIndex = browser.numEntries-FILE_PAGESIZE;
listChanged = true; listChanged = true;
} }
} }
@ -286,7 +286,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
{ {
if(browser.pageIndex > 0) if(browser.pageIndex > 0)
{ {
browser.pageIndex -= PAGESIZE; browser.pageIndex -= FILE_PAGESIZE;
if(browser.pageIndex < 0) if(browser.pageIndex < 0)
browser.pageIndex = 0; browser.pageIndex = 0;
listChanged = true; listChanged = true;
@ -296,7 +296,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
{ {
if(browser.pageIndex + selectedItem + 1 < browser.numEntries) if(browser.pageIndex + selectedItem + 1 < browser.numEntries)
{ {
if(selectedItem == PAGESIZE-1) if(selectedItem == FILE_PAGESIZE-1)
{ {
// move list down by 1 // move list down by 1
browser.pageIndex++; browser.pageIndex++;
@ -326,7 +326,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
endNavigation: endNavigation:
for(int i=0; i<PAGESIZE; i++) for(int i=0; i<FILE_PAGESIZE; i++)
{ {
if(listChanged) if(listChanged)
{ {
@ -384,12 +384,12 @@ void GuiFileBrowser::Update(GuiTrigger * t)
} }
else else
{ {
position = 136*(browser.pageIndex + PAGESIZE/2.0) / (browser.numEntries*1.0); position = 156*(browser.pageIndex + FILE_PAGESIZE/2.0) / (browser.numEntries*1.0);
if(browser.pageIndex/(PAGESIZE/2.0) < 1) if(browser.pageIndex/(FILE_PAGESIZE/2.0) < 1)
position = 0; position = 0;
else if((browser.pageIndex+PAGESIZE)/(PAGESIZE*1.0) >= (browser.numEntries)/(PAGESIZE*1.0)) else if((browser.pageIndex+FILE_PAGESIZE)/(FILE_PAGESIZE*1.0) >= (browser.numEntries)/(FILE_PAGESIZE*1.0))
position = 136; position = 156;
} }
scrollbarBoxBtn->SetPosition(0,position+36); scrollbarBoxBtn->SetPosition(0,position+36);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 270 B

View File

@ -938,8 +938,8 @@ static int MenuGameSelection()
buttonWindow.Append(&settingsBtn); buttonWindow.Append(&settingsBtn);
buttonWindow.Append(&exitBtn); buttonWindow.Append(&exitBtn);
GuiFileBrowser gameBrowser(424, 248); GuiFileBrowser gameBrowser(424, 268);
gameBrowser.SetPosition(50, 108); gameBrowser.SetPosition(50, 98);
ResetBrowser(); ResetBrowser();
HaltGui(); HaltGui();