From 61b5a353849f8c8a188c4f91c1aa89c9e7a1d10a Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Thu, 23 Dec 2010 17:32:21 +0200 Subject: [PATCH] little tinkering --- src/guiTextInputMenu.cpp | 30 +++++++++++++++++++++--------- src/guiTextInputMenu.h | 2 ++ src/main.cpp | 19 +++++++++++-------- src/servermain.cpp | 10 ++++++++-- 4 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/guiTextInputMenu.cpp b/src/guiTextInputMenu.cpp index 8a9da348..0668aa7b 100644 --- a/src/guiTextInputMenu.cpp +++ b/src/guiTextInputMenu.cpp @@ -120,6 +120,20 @@ void GUITextInputMenu::drawMenu() gui::IGUIElement::draw(); } +void GUITextInputMenu::acceptInput() +{ + if(m_dest) + { + gui::IGUIElement *e = getElementFromId(256); + if(e != NULL) + { + m_dest->gotText(e->getText()); + } + delete m_dest; + m_dest = NULL; + } +} + bool GUITextInputMenu::OnEvent(const SEvent& event) { if(event.EventType==EET_KEY_INPUT_EVENT) @@ -129,6 +143,12 @@ bool GUITextInputMenu::OnEvent(const SEvent& event) quitMenu(); return true; } + if(event.KeyInput.Key==KEY_RETURN && event.KeyInput.PressedDown) + { + acceptInput(); + quitMenu(); + return true; + } } if(event.EventType==EET_GUI_EVENT) { @@ -148,15 +168,7 @@ bool GUITextInputMenu::OnEvent(const SEvent& event) switch(event.GUIEvent.Caller->getID()) { case 257: - if(m_dest) - { - gui::IGUIElement *e = getElementFromId(256); - if(e != NULL) - { - m_dest->gotText(e->getText()); - } - delete m_dest; - } + acceptInput(); quitMenu(); break; } diff --git a/src/guiTextInputMenu.h b/src/guiTextInputMenu.h index 2efc190c..5db10a52 100644 --- a/src/guiTextInputMenu.h +++ b/src/guiTextInputMenu.h @@ -48,6 +48,8 @@ public: void drawMenu(); + void acceptInput(); + bool OnEvent(const SEvent& event); private: diff --git a/src/main.cpp b/src/main.cpp index fe0bfb09..da727811 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2245,14 +2245,7 @@ int main(int argc, char *argv[]) { //TimeTaker timer9("auxiliary drawings"); // 0ms - - driver->draw2DLine(displaycenter - core::vector2d(10,0), - displaycenter + core::vector2d(10,0), - video::SColor(255,255,255,255)); - driver->draw2DLine(displaycenter - core::vector2d(0,10), - displaycenter + core::vector2d(0,10), - video::SColor(255,255,255,255)); - + //timer9.stop(); //TimeTaker //timer10("//timer10"); @@ -2274,6 +2267,16 @@ int main(int argc, char *argv[]) driver->draw3DBox(*i, video::SColor(255,0,0,0)); } + /* + Draw crosshair + */ + driver->draw2DLine(displaycenter - core::vector2d(10,0), + displaycenter + core::vector2d(10,0), + video::SColor(255,255,255,255)); + driver->draw2DLine(displaycenter - core::vector2d(0,10), + displaycenter + core::vector2d(0,10), + video::SColor(255,255,255,255)); + } //timer10.stop(); diff --git a/src/servermain.cpp b/src/servermain.cpp index 24d3b24e..c2d697cf 100644 --- a/src/servermain.cpp +++ b/src/servermain.cpp @@ -138,6 +138,7 @@ int main(int argc, char *argv[]) allowed_options.insert("port", ValueSpec(VALUETYPE_STRING)); allowed_options.insert("disable-unittests", ValueSpec(VALUETYPE_FLAG)); allowed_options.insert("enable-unittests", ValueSpec(VALUETYPE_FLAG)); + allowed_options.insert("map-dir", ValueSpec(VALUETYPE_STRING)); Settings cmd_args; @@ -298,8 +299,13 @@ int main(int argc, char *argv[]) std::cout<<"Running dedicated server"<