]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/input.cpp
Support using a mesh as a background
[r2c2.git] / source / designer / input.cpp
index 1b1864687ca33d1e6da0aab22d98b1dbd639a3a4..d56cc1b0c5b42e9b11410612e8d3d3fc70396faf 100644 (file)
@@ -1,26 +1,33 @@
-#include <SDL_keysym.h>
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
 #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)
                {
@@ -28,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;
@@ -50,7 +57,7 @@ void Input::key_press(unsigned key, unsigned, wchar_t ch)
        }
 }
 
-void Input::render()
+void ::Input::render()
 {
        glLoadIdentity();
        glTranslatef(300, 450, 0);