mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-22 23:58:48 -05:00
little tinkering
This commit is contained in:
parent
7e490e7213
commit
61b5a35384
@ -120,6 +120,20 @@ void GUITextInputMenu::drawMenu()
|
|||||||
gui::IGUIElement::draw();
|
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)
|
bool GUITextInputMenu::OnEvent(const SEvent& event)
|
||||||
{
|
{
|
||||||
if(event.EventType==EET_KEY_INPUT_EVENT)
|
if(event.EventType==EET_KEY_INPUT_EVENT)
|
||||||
@ -129,6 +143,12 @@ bool GUITextInputMenu::OnEvent(const SEvent& event)
|
|||||||
quitMenu();
|
quitMenu();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if(event.KeyInput.Key==KEY_RETURN && event.KeyInput.PressedDown)
|
||||||
|
{
|
||||||
|
acceptInput();
|
||||||
|
quitMenu();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(event.EventType==EET_GUI_EVENT)
|
if(event.EventType==EET_GUI_EVENT)
|
||||||
{
|
{
|
||||||
@ -148,15 +168,7 @@ bool GUITextInputMenu::OnEvent(const SEvent& event)
|
|||||||
switch(event.GUIEvent.Caller->getID())
|
switch(event.GUIEvent.Caller->getID())
|
||||||
{
|
{
|
||||||
case 257:
|
case 257:
|
||||||
if(m_dest)
|
acceptInput();
|
||||||
{
|
|
||||||
gui::IGUIElement *e = getElementFromId(256);
|
|
||||||
if(e != NULL)
|
|
||||||
{
|
|
||||||
m_dest->gotText(e->getText());
|
|
||||||
}
|
|
||||||
delete m_dest;
|
|
||||||
}
|
|
||||||
quitMenu();
|
quitMenu();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,8 @@ public:
|
|||||||
|
|
||||||
void drawMenu();
|
void drawMenu();
|
||||||
|
|
||||||
|
void acceptInput();
|
||||||
|
|
||||||
bool OnEvent(const SEvent& event);
|
bool OnEvent(const SEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
19
src/main.cpp
19
src/main.cpp
@ -2245,14 +2245,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
//TimeTaker timer9("auxiliary drawings");
|
//TimeTaker timer9("auxiliary drawings");
|
||||||
// 0ms
|
// 0ms
|
||||||
|
|
||||||
driver->draw2DLine(displaycenter - core::vector2d<s32>(10,0),
|
|
||||||
displaycenter + core::vector2d<s32>(10,0),
|
|
||||||
video::SColor(255,255,255,255));
|
|
||||||
driver->draw2DLine(displaycenter - core::vector2d<s32>(0,10),
|
|
||||||
displaycenter + core::vector2d<s32>(0,10),
|
|
||||||
video::SColor(255,255,255,255));
|
|
||||||
|
|
||||||
//timer9.stop();
|
//timer9.stop();
|
||||||
//TimeTaker //timer10("//timer10");
|
//TimeTaker //timer10("//timer10");
|
||||||
|
|
||||||
@ -2274,6 +2267,16 @@ int main(int argc, char *argv[])
|
|||||||
driver->draw3DBox(*i, video::SColor(255,0,0,0));
|
driver->draw3DBox(*i, video::SColor(255,0,0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Draw crosshair
|
||||||
|
*/
|
||||||
|
driver->draw2DLine(displaycenter - core::vector2d<s32>(10,0),
|
||||||
|
displaycenter + core::vector2d<s32>(10,0),
|
||||||
|
video::SColor(255,255,255,255));
|
||||||
|
driver->draw2DLine(displaycenter - core::vector2d<s32>(0,10),
|
||||||
|
displaycenter + core::vector2d<s32>(0,10),
|
||||||
|
video::SColor(255,255,255,255));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//timer10.stop();
|
//timer10.stop();
|
||||||
|
@ -138,6 +138,7 @@ int main(int argc, char *argv[])
|
|||||||
allowed_options.insert("port", ValueSpec(VALUETYPE_STRING));
|
allowed_options.insert("port", ValueSpec(VALUETYPE_STRING));
|
||||||
allowed_options.insert("disable-unittests", ValueSpec(VALUETYPE_FLAG));
|
allowed_options.insert("disable-unittests", ValueSpec(VALUETYPE_FLAG));
|
||||||
allowed_options.insert("enable-unittests", ValueSpec(VALUETYPE_FLAG));
|
allowed_options.insert("enable-unittests", ValueSpec(VALUETYPE_FLAG));
|
||||||
|
allowed_options.insert("map-dir", ValueSpec(VALUETYPE_STRING));
|
||||||
|
|
||||||
Settings cmd_args;
|
Settings cmd_args;
|
||||||
|
|
||||||
@ -298,8 +299,13 @@ int main(int argc, char *argv[])
|
|||||||
std::cout<<"Running dedicated server"<<std::endl;
|
std::cout<<"Running dedicated server"<<std::endl;
|
||||||
std::cout<<"========================"<<std::endl;
|
std::cout<<"========================"<<std::endl;
|
||||||
std::cout<<std::endl;
|
std::cout<<std::endl;
|
||||||
|
|
||||||
Server server("../map", hm_params, map_params);
|
// Figure out path to map
|
||||||
|
std::string map_dir = "../map";
|
||||||
|
if(cmd_args.exists("map-dir"))
|
||||||
|
map_dir = cmd_args.get("map-dir");
|
||||||
|
|
||||||
|
Server server(map_dir.c_str(), hm_params, map_params);
|
||||||
server.start(port);
|
server.start(port);
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
|
Loading…
Reference in New Issue
Block a user