Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/client.cc')
-rw-r--r--src/client/client.cc167
1 files changed, 96 insertions, 71 deletions
diff --git a/src/client/client.cc b/src/client/client.cc
index 4b27eb7..69f36b6 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -106,8 +106,8 @@ void Client::init(int count, char **arguments)
client_mainwindow = new MainWindow(ui::root());
// FIXME needs to be a mainwindow child
- client_testmodelview = new TestModelView(ui::root());
- client_testmodelview->hide();
+ client_testmodelwindow = new TestModelWindow(ui::root());
+ client_testmodelwindow->hide();
// Initialize the video subsystem
if (!video::init()) {
@@ -247,8 +247,8 @@ void Client::frame()
ui::root()->show_menu("join");
}
- if (testmodelview()->visible()) {
- testmodelview()->raise();
+ if (testmodelwindow()->visible()) {
+ testmodelwindow()->raise();
}
if (ui::console()->visible()) {
ui::console()->raise();
@@ -421,6 +421,12 @@ void Client::func_r_restart(std::string const &args)
/* ---- func_ui ---------------------------------------------------- */
+void Client::func_ui_console(std::string const &args)
+{
+ ui::console()->toggle();
+}
+
+// list user interface widgets
void Client::func_list_ui(std::string const &args)
{
if (ui::root()) {
@@ -435,11 +441,6 @@ void Client::func_ui_restart(std::string const &args)
}
}
-void Client::func_ui_console(std::string const &args)
-{
- ui::console()->toggle();
-}
-
void Client::func_list_menu(std::string const &args)
{
if (ui::root()) {
@@ -447,6 +448,7 @@ void Client::func_list_menu(std::string const &args)
}
}
+// help for the global ui functions
void Client::func_ui_help()
{
con_print << "^BUser interface functions" << std::endl;
@@ -457,6 +459,7 @@ void Client::func_ui_help()
con_print << " ui restart reload user interface files" << std::endl;
}
+// global ui functions
void Client::func_ui(std::string const &args)
{
if (!ui::root()) {
@@ -475,47 +478,82 @@ void Client::func_ui(std::string const &args)
if (command.compare("help") == 0) {
func_ui_help();
+
} else if (command.compare("debug") == 0) {
ui::UI::ui_debug = !ui::UI::ui_debug;
+
} else if (command.compare("list") == 0) {
ui::root()->list();
+
} else if (command.compare("visible") == 0) {
ui::root()->list_visible();
+
} else if (command.compare("restart") == 0) {
ui::root()->load_settings();
+
} else {
func_ui_help();
}
}
-void Client::func_ui_chat(std::string const &args)
+// help for the global menu functions
+void Client::func_menu_help()
{
- if (client()->connected() && client()->mainwindow()->playerview()->visible()) {
- client()->mainwindow()->playerview()->toggle_chat();
- }
+ con_print << "^Bmenu functions" << std::endl;
+ con_print << " menu help show this help" << std::endl;
+ con_print << " menu list list available menus" << std::endl;
+ con_print << " menu [name] show a menu" << std::endl;
+ con_print << " menu back return to the previous menu" << std::endl;
+ con_print << " menu previous return to the previous menu" << std::endl;
+ con_print << " menu close close the current menu" << std::endl;
+ con_print << " menu hide hide the current menu" << std::endl;
+ ui::root()->list_menus();
}
-void Client::func_ui_chatbar(std::string const &args)
+// global menu fuctions
+void Client::func_menu(std::string const &args)
{
- if (client()->connected() && client()->mainwindow()->playerview()->visible()) {
- client()->mainwindow()->playerview()->toggle_chatbar();
+ if (!ui::root()) {
+ con_warn << "User Interface not available!" << std::endl;
+ return;
}
-}
-void Client::func_ui_inventory(std::string const &args)
-{
- if (client()->connected() && client()->mainwindow()->playerview()->visible()) {
- client()->mainwindow()->playerview()->toggle_inventory();
+ if (!args.size()) {
+ func_menu_help();
+ return;
}
-}
-void Client::func_ui_map(std::string const &args)
-{
- if (client()->connected() && client()->mainwindow()->playerview()->visible()) {
- client()->mainwindow()->playerview()->toggle_map();
+ std::stringstream argstr(args);
+ std::string command;
+ argstr >> command;
+
+ aux::to_label(command);
+
+
+ if (command.compare("help") == 0) {
+ func_menu_help();
+
+ } else if (command.compare("hide") == 0) {
+ ui::root()->hide_menu();
+
+ } else if (command.compare("close") == 0) {
+ ui::root()->hide_menu();
+
+ } else if (command.compare("back") == 0) {
+ ui::root()->previous_menu();
+
+ } else if (command.compare("previous") == 0) {
+ ui::root()->previous_menu();
+
+ } else if (command.compare("list") == 0) {
+ ui::root()->list_menus();
+
+ } else {
+ ui::root()->show_menu(command.c_str());
}
}
+// used by keybinds to open the main menu
void Client::func_ui_menu(std::string const &args)
{
if (client()->connected()) {
@@ -534,60 +572,47 @@ void Client::func_ui_menu(std::string const &args)
}
}
-// entity menus
-void Client::func_view(std::string const &args)
+// used by keybinds to open the chat view
+void Client::func_ui_chat(std::string const &args)
{
- if (client()->mainwindow()) {
- client()->mainwindow()->playerview()->show_menu(args);
+ if (client()->connected() && client()->mainwindow()->gamewindow()->visible()) {
+ client()->mainwindow()->gamewindow()->toggle_chat();
}
}
-// global menus
-void Client::func_menu(std::string const &args)
+// used by keybinds to open the chat bar
+void Client::func_ui_chatbar(std::string const &args)
{
- if (!ui::root()) {
- con_warn << "User Interface not available!" << std::endl;
- return;
+ if (client()->connected() && client()->mainwindow()->gamewindow()->visible()) {
+ client()->mainwindow()->gamewindow()->toggle_chatbar();
}
+}
- if (!args.size()) {
- con_print << "^Bmenu functions" << std::endl;
- con_print << " menu help show this help" << std::endl;
- con_print << " menu list list available menus" << std::endl;
- con_print << " menu [name] show a menu" << std::endl;
- con_print << " menu back return to the previous menu" << std::endl;
- con_print << " menu previous return to the previous menu" << std::endl;
- con_print << " menu close close the current menu" << std::endl;
- con_print << " menu hide hide the current menu" << std::endl;
- ui::root()->list_menus();
+// used by keybinds to open the inventory view
+void Client::func_ui_inventory(std::string const &args)
+{
+ if (client()->connected() && client()->mainwindow()->gamewindow()->visible()) {
+ client()->mainwindow()->gamewindow()->toggle_inventory();
}
+}
- std::stringstream argstr(args);
- std::string command;
- argstr >> command;
-
- aux::to_label(command);
-
- if (command.compare("hide") == 0) {
- ui::root()->hide_menu();
-
- } else if (command.compare("close") == 0) {
- ui::root()->hide_menu();
-
- } else if (command.compare("back") == 0) {
- ui::root()->previous_menu();
-
- } else if (command.compare("previous") == 0) {
- ui::root()->previous_menu();
-
- } else if (command.compare("list") == 0) {
- ui::root()->list_menus();
+// used by keybinds to open the map view
+void Client::func_ui_map(std::string const &args)
+{
+ if (client()->connected() && client()->mainwindow()->gamewindow()->visible()) {
+ client()->mainwindow()->gamewindow()->toggle_map();
+ }
+}
- } else {
- ui::root()->show_menu(command.c_str());
+// used by views and keybinds and to open entity views
+void Client::func_view(std::string const &args)
+{
+ if (client()->mainwindow()) {
+ client()->mainwindow()->gamewindow()->show_menu(args);
}
}
+// open the testmodel window
void Client::func_testmodel(std::string const &args)
{
// if testmodel is called from the command line, no module has been loaded yet
@@ -603,7 +628,7 @@ void Client::func_testmodel(std::string const &args)
}
if (!client()->connected()) {
- client()->client_testmodelview->hide();
+ client()->client_testmodelwindow->hide();
ui::console()->show();
return;
}
@@ -618,9 +643,9 @@ void Client::func_testmodel(std::string const &args)
//video::set_loader_message();
//video::frame_loader();
- client()->client_testmodelview->set_modelname(modelname);
- client()->client_testmodelview->raise(); // raise the window
- client()->client_testmodelview->show();
+ client()->client_testmodelwindow->set_modelname(modelname);
+ client()->client_testmodelwindow->raise(); // raise the window
+ client()->client_testmodelwindow->show();
if (ui::console()->visible()) {
ui::console()->raise();