fix turning autosave off in menu, fix keyboard, add more keyboard keys

This commit is contained in:
dborth 2009-04-06 06:23:43 +00:00
parent ef3b5a84f6
commit 9563296da3
3 changed files with 74 additions and 61 deletions

View File

@ -748,13 +748,13 @@ typedef struct _keytype {
class GuiKeyboard : public GuiWindow
{
public:
GuiKeyboard(char * t, u16 m);
GuiKeyboard(char * t, u32 m);
~GuiKeyboard();
void Update(GuiTrigger * t);
char kbtextstr[100];
char kbtextstr[256];
protected:
u16 kbtextmaxlen;
Key keys[4][10];
u32 kbtextmaxlen;
Key keys[4][11];
int shift;
int caps;
GuiText * kbText;
@ -774,10 +774,10 @@ class GuiKeyboard : public GuiWindow
GuiImage * keySpaceImg;
GuiImage * keySpaceOverImg;
GuiButton * keySpace;
GuiButton * keyBtn[4][10];
GuiImage * keyImg[4][10];
GuiImage * keyImgOver[4][10];
GuiText * keyTxt[4][10];
GuiButton * keyBtn[4][11];
GuiImage * keyImg[4][11];
GuiImage * keyImgOver[4][11];
GuiText * keyTxt[4][11];
GuiImageData * keyTextbox;
GuiImageData * key;
GuiImageData * keyOver;

View File

@ -13,7 +13,7 @@
* Constructor for the GuiKeyboard class.
*/
GuiKeyboard::GuiKeyboard(char * t, u16 max)
GuiKeyboard::GuiKeyboard(char * t, u32 max)
{
width = 540;
height = 400;
@ -23,11 +23,11 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
focus = 0; // allow focus
alignmentHor = ALIGN_CENTRE;
alignmentVert = ALIGN_MIDDLE;
strncpy(kbtextstr, t, 100);
kbtextstr[100] = 0;
strncpy(kbtextstr, t, max);
kbtextstr[max] = 0;
kbtextmaxlen = max;
Key thekeys[4][10] = {
Key thekeys[4][11] = {
{
{'1','!'},
{'2','@'},
@ -38,7 +38,8 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
{'7','&'},
{'8','*'},
{'9','('},
{'0',')'}
{'0',')'},
{'\0','\0'}
},
{
{'q','Q'},
@ -50,7 +51,8 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
{'u','U'},
{'i','I'},
{'o','O'},
{'p','P'}
{'p','P'},
{'-','_'}
},
{
{'a','A'},
@ -62,7 +64,8 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
{'j','J'},
{'k','K'},
{'l','L'},
{':',';'}
{':',';'},
{'\'','"'}
},
{
@ -75,7 +78,8 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
{'m','M'},
{',','<'},
{'.','>'},
{'/','?'}
{'/','?'},
{'\0','\0'}
}
};
memcpy(keys, thekeys, sizeof(thekeys));
@ -164,7 +168,9 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
for(int i=0; i<4; i++)
{
for(int j=0; j<10; j++)
for(int j=0; j<11; j++)
{
if(keys[i][j].ch != '\0')
{
keyImg[i][j] = new GuiImage(key);
keyImgOver[i][j] = new GuiImage(keyOver);
@ -183,6 +189,7 @@ GuiKeyboard::GuiKeyboard(char * t, u16 max)
this->Append(keyBtn[i][j]);
}
}
}
}
/**
@ -220,7 +227,9 @@ GuiKeyboard::~GuiKeyboard()
for(int i=0; i<4; i++)
{
for(int j=0; j<10; j++)
for(int j=0; j<11; j++)
{
if(keys[i][j].ch != '\0')
{
delete keyImg[i][j];
delete keyImgOver[i][j];
@ -228,6 +237,7 @@ GuiKeyboard::~GuiKeyboard()
delete keyBtn[i][j];
}
}
}
}
void GuiKeyboard::Update(GuiTrigger * t)
@ -271,7 +281,9 @@ void GuiKeyboard::Update(GuiTrigger * t)
for(int i=0; i<4; i++)
{
for(int j=0; j<10; j++)
for(int j=0; j<11; j++)
{
if(keys[i][j].ch != '\0')
{
if(shift || caps)
txt[0] = keys[i][j].chShift;
@ -299,6 +311,7 @@ void GuiKeyboard::Update(GuiTrigger * t)
}
}
}
}
this->ToggleFocus(t);

View File

@ -571,7 +571,7 @@ void AutoSave()
* Opens an on-screen keyboard window, with the data entered being stored
* into the specified variable.
***************************************************************************/
static void OnScreenKeyboard(char * var, u16 maxlen)
static void OnScreenKeyboard(char * var, u32 maxlen)
{
int save = -1;
@ -3149,7 +3149,7 @@ static int MenuSettingsFile()
else if (GCSettings.AutoLoad == 1) sprintf (options.value[5],"SRAM");
else if (GCSettings.AutoLoad == 2) sprintf (options.value[5],"Snapshot");
if (GCSettings.AutoSave == 0) sprintf (options.value[5],"Off");
if (GCSettings.AutoSave == 0) sprintf (options.value[6],"Off");
else if (GCSettings.AutoSave == 1) sprintf (options.value[6],"SRAM");
else if (GCSettings.AutoSave == 2) sprintf (options.value[6],"Snapshot");
else if (GCSettings.AutoSave == 3) sprintf (options.value[6],"Both");
@ -3169,15 +3169,15 @@ static int MenuSettingsFile()
break;
case 2:
OnScreenKeyboard(GCSettings.LoadFolder, 256);
OnScreenKeyboard(GCSettings.LoadFolder, 30);
break;
case 3:
OnScreenKeyboard(GCSettings.SaveFolder, 256);
OnScreenKeyboard(GCSettings.SaveFolder, 30);
break;
case 4:
OnScreenKeyboard(GCSettings.CheatFolder, 256);
OnScreenKeyboard(GCSettings.CheatFolder, 30);
break;
case 5: