J :
* Use images for PSP buttons. * Um not tested. I don't have my PSP on me
This commit is contained in:
@@ -447,12 +447,12 @@ void OptionKey::Render() {
|
|||||||
{
|
{
|
||||||
const KeyRep& rep = translateKey(from);
|
const KeyRep& rep = translateKey(from);
|
||||||
if (rep.icon)
|
if (rep.icon)
|
||||||
renderer->RenderQuad(rep.icon, x + 2, y + 2);
|
renderer->RenderQuad(rep.icon, x + 4, y + 2);
|
||||||
else
|
else
|
||||||
mFont->DrawString(rep.text, x + 4, y + 2, JGETEXT_LEFT);
|
mFont->DrawString(rep.text, x + 4, y + 2, JGETEXT_LEFT);
|
||||||
const KeyRep& rep2 = translateKey(to);
|
const KeyRep& rep2 = translateKey(to);
|
||||||
if (rep2.icon)
|
if (rep2.icon)
|
||||||
renderer->RenderQuad(rep2.icon, x + 2, y + 2);
|
renderer->RenderQuad(rep2.icon, x + 4, y + 2);
|
||||||
else
|
else
|
||||||
mFont->DrawString(rep2.text, width - 4, y + 2, JGETEXT_RIGHT);
|
mFont->DrawString(rep2.text, width - 4, y + 2, JGETEXT_RIGHT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ const KeyRep& translateKey(LocalKeySym key) {
|
|||||||
if ((res = fattable.find(key)) != fattable.end())
|
if ((res = fattable.find(key)) != fattable.end())
|
||||||
return *(res->second);
|
return *(res->second);
|
||||||
}
|
}
|
||||||
char* str = XKeysymToString(key);
|
|
||||||
|
char* str = XKeysymToString(key);
|
||||||
if (!str)
|
if (!str)
|
||||||
{
|
{
|
||||||
str = new char[11];
|
str = new char[11];
|
||||||
@@ -29,6 +30,7 @@ const KeyRep& translateKey(LocalKeySym key) {
|
|||||||
return *k;
|
return *k;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
#ifdef WIN32
|
||||||
const KeyRep& translateKey(LocalKeySym key) {
|
const KeyRep& translateKey(LocalKeySym key) {
|
||||||
{
|
{
|
||||||
map<const LocalKeySym, KeyRep const*>::iterator res;
|
map<const LocalKeySym, KeyRep const*>::iterator res;
|
||||||
@@ -36,15 +38,46 @@ const KeyRep& translateKey(LocalKeySym key) {
|
|||||||
return *(res->second);
|
return *(res->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here goes PSP button-to-image code :
|
|
||||||
// k->icon = resources.RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "", RETRIEVE_NORMAL);
|
|
||||||
|
|
||||||
char* str = new char[11];
|
char* str = new char[11];
|
||||||
sprintf(str, "%d", key);
|
sprintf(str, "%d", key);
|
||||||
KeyRep* k = new KeyRep(NULL, str);
|
KeyRep* k = new KeyRep(NULL, str);
|
||||||
fattable[key] = k;
|
fattable[key] = k;
|
||||||
return *k;
|
return *k;
|
||||||
}
|
}
|
||||||
|
#else // PSP
|
||||||
|
|
||||||
|
const KeyRep& translateKey(LocalKeySym key) {
|
||||||
|
map<const LocalKeySym, KeyRep const*>::iterator res;
|
||||||
|
if ((res = fattable.find(key)) != fattable.end())
|
||||||
|
return *(res->second);
|
||||||
|
|
||||||
|
if (fattable.end() == fattable.find(PSP_CTRL_SELECT))
|
||||||
|
{
|
||||||
|
fattable[PSP_CTRL_SELECT] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)10*32, 0, 64, 32, "PSP_CTRL_SELECT", RETRIEVE_NORMAL), _("Select"));
|
||||||
|
fattable[PSP_CTRL_START] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)8*32, 0, 64, 32, "PSP_CTRL_START", RETRIEVE_NORMAL), _("Start"));
|
||||||
|
fattable[PSP_CTRL_UP] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)0*32, 0, 32, 32, "PSP_CTRL_UP", RETRIEVE_NORMAL), _("Up"));
|
||||||
|
fattable[PSP_CTRL_RIGHT] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)3*32, 0, 32, 32, "PSP_CTRL_RIGHT", RETRIEVE_NORMAL), _("Right"));
|
||||||
|
fattable[PSP_CTRL_DOWN] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)1*32, 0, 32, 32, "PSP_CTRL_DOWN", RETRIEVE_NORMAL), _("Down"));
|
||||||
|
fattable[PSP_CTRL_LEFT] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)2*32, 0, 32, 32, "PSP_CTRL_LEFT", RETRIEVE_NORMAL), _("Left"));
|
||||||
|
fattable[PSP_CTRL_LTRIGGER] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)14*32, 0, 64, 32, "PSP_CTRL_LTRIGGER", RETRIEVE_NORMAL), _("Left trigger"));
|
||||||
|
fattable[PSP_CTRL_RTRIGGER] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)16*32, 0, 64, 32, "PSP_CTRL_RTRIGGER", RETRIEVE_NORMAL), _("Right trigger"));
|
||||||
|
fattable[PSP_CTRL_TRIANGLE] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)5*32, 0, 32, 32, "PSP_CTRL_TRIANGLE", RETRIEVE_NORMAL), _("Triangle"));
|
||||||
|
fattable[PSP_CTRL_CIRCLE] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "PSP_CTRL_CIRCLE", RETRIEVE_NORMAL), _("Circle"));
|
||||||
|
fattable[PSP_CTRL_CROSS] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)7*32, 0, 32, 32, "PSP_CTRL_CROSS", RETRIEVE_NORMAL), _("Cross"));
|
||||||
|
fattable[PSP_CTRL_SQUARE] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)6*32, 0, 32, 32, "PSP_CTRL_SQUARE", RETRIEVE_NORMAL), _("Square"));
|
||||||
|
fattable[PSP_CTRL_HOLD] = new KeyRep(resources.RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "PSP_CTRL_HOLD", RETRIEVE_NORMAL), _("Hold"));
|
||||||
|
for (map<const LocalKeySym, KeyRep const*>::iterator it = fattable.begin(); it != fattable.end(); ++it)
|
||||||
|
if (it->second->icon) { it->second->icon->mWidth /= 2; it->second->icon->mHeight /= 2; }
|
||||||
|
}
|
||||||
|
if ((res = fattable.find(key)) != fattable.end())
|
||||||
|
return *(res->second);
|
||||||
|
char* str = new char[11];
|
||||||
|
sprintf(str, "%d", key);
|
||||||
|
KeyRep* k = new KeyRep(NULL, str);
|
||||||
|
fattable[key] = k;
|
||||||
|
return *k;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const KeyRep& translateKey(JButton key) {
|
const KeyRep& translateKey(JButton key) {
|
||||||
|
|||||||
Reference in New Issue
Block a user