improvement of the text input and added some documentation
This commit is contained in:
@@ -536,11 +536,12 @@ void EnterPlayernameOverlay::Init () {
|
||||
}
|
||||
|
||||
bool EnterPlayernameOverlay::OnKeyDown (const SDL_keysym &keysym) {
|
||||
if (keysym.sym == SDLK_ESCAPE) {
|
||||
/* if (keysym.sym == SDLK_ESCAPE) {
|
||||
GetModel()->SetGameState(GameStateMainMenu);
|
||||
GetController()->uistate.hotitem = 0;
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -569,18 +570,43 @@ void EnterPlayernameOverlay::Draw () {
|
||||
|
||||
GetView()->SelectFont("console.ttf");
|
||||
|
||||
Engine::GUI::Label (4, "A s t e r o i d s", right * 0.5 - 100, 180);
|
||||
// If ESC, we want to go back to the main menu (warning: OpenGL cleanup has
|
||||
// still to be performed!
|
||||
if (Engine::GUI::CheckKeyPress(SDLK_ESCAPE)) {
|
||||
GetModel()->SetGameState(GameStateMainMenu);
|
||||
glPopMatrix ();
|
||||
|
||||
Engine::GUI::Label (1, "Enter your name: ", right * 0.5 - 100, 250);
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPopMatrix ();
|
||||
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
return;
|
||||
}
|
||||
|
||||
Engine::GUI::Label (4, "A s t e r o i d s", right * 0.5 - 100, 180);
|
||||
|
||||
// Make sure we have UNICODE processing enabled!
|
||||
GetController()->EnableTextinput(true);
|
||||
|
||||
// Enter your name
|
||||
std::string player_name = GetModel()->GetPlayerName();
|
||||
|
||||
Engine::GUI::Label (1, "Enter your name: ", right * 0.5 - 100, 250);
|
||||
|
||||
if (Engine::GUI::LineEdit (2, right * 0.5 + 20, 238, player_name, 16)) {
|
||||
GetModel()->SetPlayerName(player_name);
|
||||
}
|
||||
|
||||
// some test
|
||||
static std::string otherstring("25blabla");
|
||||
|
||||
Engine::GUI::Label (6, "Enter your age : ", right * 0.5 - 100, 280);
|
||||
|
||||
if (Engine::GUI::LineEdit (7, right * 0.5 + 20, 268, otherstring, 16)) {
|
||||
// GetModel()->SetPlayerName(player_name);
|
||||
}
|
||||
|
||||
|
||||
if (Engine::GUI::Button (3, "Start Game", right - 150 - 20, 500, 150, 40)) {
|
||||
GetModel()->SetGameState(GameStateRunning);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user