* Add support for key icons in the keybinding menu
This commit is contained in:
jean.chalard
2010-02-16 02:30:11 +00:00
parent 7104eff946
commit 8a19b0567b
2 changed files with 11 additions and 2 deletions

View File

@@ -438,9 +438,13 @@ void OptionKey::Render(){
JRenderer * renderer = JRenderer::GetInstance();
const KeyRep& rep = translateKey(from);
if (NULL == rep.icon)
if (rep.icon)
renderer->RenderQuad(rep.icon, x + 2, y + 2);
else
mFont->DrawString(rep.text, x + 4, y + 2, JGETEXT_LEFT);
const KeyRep& rep2 = translateKey(to);
if (NULL == rep2.icon)
if (rep2.icon)
renderer->RenderQuad(rep2.icon, x + 2, y + 2);
else
mFont->DrawString(rep2.text, width - 4, y + 2, JGETEXT_RIGHT);
}

View File

@@ -1,5 +1,6 @@
#include <map>
#include "../include/Translate.h"
#include "../include/WResourceManager.h"
#include "../include/TranslateKeys.h"
using std::string;
@@ -34,6 +35,10 @@ const KeyRep& translateKey(LocalKeySym key) {
if ((res = fattable.find(key)) != fattable.end())
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];
sprintf(str, "%d", key);
KeyRep* k = new KeyRep(NULL, str);