Made theme setting to define max characters for game list. Use "maxcharacters = ##" in theme.txt. Default is 36. This does not affect for the title appears anywhere but the game list.

This commit is contained in:
giantpune 2009-05-13 05:41:49 +00:00
parent 5fabf08980
commit fe926e0eb4
3 changed files with 22 additions and 10 deletions

View File

@ -237,6 +237,7 @@ void CFG_Default(int widescreen) // -1 = non forced Mode
THEME.cover_x = 26;
THEME.cover_y = 55;
THEME.showID = 1;
THEME.maxcharacters = 36;
THEME.id_x = 68;
THEME.id_y = 305;
THEME.region_x = 68;
@ -632,6 +633,13 @@ void theme_set(char *name, char *val)
}
}
else if (strcmp(cfg_name, "maxcharacters") == 0) {
short x;
if (sscanf(val, "%hd", &x) == 1) {
THEME.maxcharacters = x;
}
}
cfg_bool("show_id", &THEME.showID);
cfg_bool("show_tooltip", &THEME.showToolTip);
cfg_bool("show_hddinfo", &THEME.showHDD);

View File

@ -79,6 +79,7 @@ struct THEME
short cover_x;
short cover_y;
short showID;
short maxcharacters;
short id_x;
short id_y;
short region_x;

View File

@ -13,8 +13,12 @@
#include "gui_gamebrowser.h"
#include "../cfg.h"
#include <string.h>
#include <sstream>
#define GAMESELECTSIZE 30
extern const int vol;
int txtscroll = 0;
/**
* Constructor for the GuiGameBrowser class.
*/
@ -114,18 +118,18 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, co
gameTxt = new GuiText * [pagesize];
gameBg = new GuiImage * [pagesize];
char buffer[CFG.maxcharacters + 4];
char buffer[THEME.maxcharacters + 4];
for(int i=0; i < pagesize; i++)
{
if (strlen(get_title(&gameList[i])) < (u32)(CFG.maxcharacters + 3))
if (strlen(get_title(&gameList[i])) < (u32)(THEME.maxcharacters + 3))
{
sprintf(buffer, "%s", get_title(&gameList[i]));
}
else
{
sprintf(buffer, get_title(&gameList[i]), CFG.maxcharacters);
buffer[CFG.maxcharacters] = '\0';
sprintf(buffer, get_title(&gameList[i]), THEME.maxcharacters);
buffer[THEME.maxcharacters] = '\0';
strncat(buffer, "...", 3);
}
@ -315,7 +319,6 @@ void GuiGameBrowser::Update(GuiTrigger * t)
// when the arrows are clicked
float scrolldelay = 3.5;
if (scrollbaron == 1) {
// update the location of the scroll box based on the position in the option list
arrowUpBtn->Update(t);
@ -324,7 +327,7 @@ void GuiGameBrowser::Update(GuiTrigger * t)
}
next = listOffset;
char buffer[CFG.maxcharacters + 4];
char buffer[THEME.maxcharacters + 4];
for(int i=0; i<pagesize; i++)
{
@ -336,14 +339,14 @@ void GuiGameBrowser::Update(GuiTrigger * t)
game[i]->SetState(STATE_DEFAULT);
}
if (strlen(get_title(&gameList[next])) < (u32)(CFG.maxcharacters + 3))
if (strlen(get_title(&gameList[next])) < (u32)(THEME.maxcharacters + 3))
{
sprintf(buffer, "%s", get_title(&gameList[next]));
}
else
{
sprintf(buffer, get_title(&gameList[next]), CFG.maxcharacters);
buffer[CFG.maxcharacters] = '\0';
sprintf(buffer, get_title(&gameList[next]), THEME.maxcharacters);
buffer[THEME.maxcharacters] = '\0';
strncat(buffer, "...", 3);
}