Distributed under the GPL
*/
-#include <SDL_keysym.h>
#include <GL/gl.h>
#include <msp/gl/texture.h>
+#include <msp/input/keys.h>
#include "designer.h"
#include "input.h"
using namespace std;
using namespace Msp;
-Input::Input(Designer &d, const string &t, const string &e):
+::Input::Input(Designer &d, const string &t, const string &e):
designer(d),
title(t),
text(e),
pos(text.size())
{ }
-void Input::key_press(unsigned key, unsigned, wchar_t ch)
+void ::Input::key_press(unsigned key, unsigned, wchar_t ch)
{
- if(key==SDLK_RETURN)
+ if(key==Msp::Input::KEY_ENTER)
signal_accept.emit();
- else if(key==SDLK_ESCAPE)
+ else if(key==Msp::Input::KEY_ESC)
signal_cancel.emit();
- else if(key==SDLK_BACKSPACE)
+ else if(key==Msp::Input::KEY_BACKSPACE)
{
if(pos>0)
{
--pos;
}
}
- else if(key==SDLK_DELETE)
+ else if(key==Msp::Input::KEY_DELETE)
{
if(pos<text.size())
text.erase(pos, 1);
}
- else if(key==SDLK_LEFT)
+ else if(key==Msp::Input::KEY_LEFT)
{
if(pos>0)
--pos;
}
- else if(key==SDLK_RIGHT)
+ else if(key==Msp::Input::KEY_RIGHT)
{
if(pos<text.size())
++pos;
}
}
-void Input::render()
+void ::Input::render()
{
glLoadIdentity();
glTranslatef(300, 450, 0);