3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
9 #include <msp/gl/texture.h>
10 #include <msp/input/keys.h>
17 ::Input::Input(Designer &d, const string &t, const string &e):
24 void ::Input::key_press(unsigned key, unsigned, wchar_t ch)
26 if(key==Msp::Input::KEY_ENTER)
28 else if(key==Msp::Input::KEY_ESC)
30 else if(key==Msp::Input::KEY_BACKSPACE)
38 else if(key==Msp::Input::KEY_DELETE)
43 else if(key==Msp::Input::KEY_LEFT)
48 else if(key==Msp::Input::KEY_RIGHT)
55 text.insert(pos, 1, ch);
60 void ::Input::render()
63 glTranslatef(300, 450, 0);
65 GL::Texture::unbind();
66 glColor4f(0.7, 0.7, 0.7, 0.9);
74 glColor4f(0, 0, 0, 1);
75 glTranslatef(5, 35, 0);
79 designer.get_font().draw_string(title);
82 glTranslatef(0, -30, 0);
85 designer.get_font().draw_string(text);
87 glTranslatef(designer.get_font().get_string_width(text.substr(0, pos)), 0, 0);
88 glDisable(GL_TEXTURE_2D);