]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/input.cpp
Convert designer to use mspgbase instead of sdl
[r2c2.git] / source / designer / input.cpp
index 5c2e9210ff25cd9dcb3279c2b1a0d85579e1dfb9..d56cc1b0c5b42e9b11410612e8d3d3fc70396faf 100644 (file)
@@ -5,29 +5,29 @@ Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
 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)
                {
@@ -35,17 +35,17 @@ void Input::key_press(unsigned key, unsigned, wchar_t ch)
                        --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;
@@ -57,7 +57,7 @@ void Input::key_press(unsigned key, unsigned, wchar_t ch)
        }
 }
 
-void Input::render()
+void ::Input::render()
 {
        glLoadIdentity();
        glTranslatef(300, 450, 0);