From 409d3ce47d8a4d48947c7b19fc2460fd801b742c Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 29 Nov 2010 13:37:16 +0000 Subject: Added 'testmodel' function, enabled autoscaling on ui::ModelView --- src/client/client.cc | 49 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) (limited to 'src/client/client.cc') diff --git a/src/client/client.cc b/src/client/client.cc index 318a0d4..ec2d002 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -102,8 +102,12 @@ void Client::init(int count, char **arguments) // initialize user interface ui::init(); - client_worldview = new WorldView(ui::root()); + client_worldview = new WorldView(ui::root()); + + client_testmodelview = new TestModelView(ui::root()); + client_testmodelview->hide(); + // Initialize the video subsystem if (!video::init()) { quit(1); @@ -139,20 +143,23 @@ void Client::init(int count, char **arguments) func = core::Func::add("ui_console", func_ui_console); func->set_info("toggle console"); - func = core::Func::add("ui_chat", Client::func_ui_chat); + func = core::Func::add("ui_chat", func_ui_chat); func->set_info("toggle chat window"); - func = core::Func::add("ui_chatbar", Client::func_ui_chatbar); + func = core::Func::add("ui_chatbar", func_ui_chatbar); func->set_info("toggle chat bar"); - func = core::Func::add("ui_inventory", Client::func_ui_inventory); + func = core::Func::add("ui_inventory", func_ui_inventory); func->set_info("toggle inventory"); - func = core::Func::add("ui_map", Client::func_ui_map); + func = core::Func::add("ui_map", func_ui_map); func->set_info("toggle map"); - func = core::Func::add("ui_menu", Client::func_ui_menu); + func = core::Func::add("ui_menu", func_ui_menu); func->set_info("toggle main menu"); + + func = core::Func::add("testmodel", func_testmodel); + func->set_info("[str] load and view a single 3D model"); func = core::Func::add("menu", func_menu); func->set_info("[command] menu functions"); @@ -239,6 +246,14 @@ void Client::frame(unsigned long timestamp) } else if (core::game()->time() && !core::localcontrol()) { ui::root()->show_menu("join"); } + + if (testmodelview()->visible()) { + testmodelview()->raise(); + } + if (ui::console()->visible()) { + ui::console()->raise(); + ui::console()->set_focus(); + } } else { if (core::localcontrol()) { @@ -572,6 +587,26 @@ void Client::func_menu(std::string const &args) } } +void Client::func_testmodel(std::string const &args) +{ + std::string modelname(args); + aux::trim(modelname); + + if (!modelname.size()) { + con_print << "usage: testmodel [model name]" << std::endl; + } + + //video::set_loader_message(); + //video::frame_loader(); + + client()->client_testmodelview->set_modelname(modelname); + client()->client_testmodelview->raise(); // raise the window + client()->client_testmodelview->show(); -} // namespace client + if (ui::console()->visible()) { + ui::console()->raise(); + ui::console()->set_focus(); + } +} +} // namespace client -- cgit v1.2.3