Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-10-15 20:33:15 +0000
committerStijn Buys <ingar@osirion.org>2008-10-15 20:33:15 +0000
commit1e0df536c2fae85c317ce9c3cc17603d5f98c911 (patch)
tree3ab262d51451cda3e926e9581b294f08d39031d9 /src/client/input.cc
parent97fca172fd51270cebd5b722f861a6c753bd4d2a (diff)
moved client console into a Widget
Diffstat (limited to 'src/client/input.cc')
-rw-r--r--src/client/input.cc69
1 files changed, 8 insertions, 61 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index 22fd1c0..a72999e 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -133,11 +133,6 @@ void func_ui_control(std::string const &args)
audio::play("ui/control");
}
-void func_ui_console(std::string const &args)
-{
- console()->toggle();
-}
-
void func_view_next(std::string const &args)
{
if (core::application()->connected() && core::localcontrol()) {
@@ -268,12 +263,6 @@ void init()
input_mousedelay->set_info("[int] mouse click time-out in milliseconds");
core::Func *func = 0;
- func = core::Func::add("ui_console", func_ui_console);
- func->set_info("toggle console on or off");
-
- //func = core::Func::add("ui_chat", func_ui_chat);
- //func->set_info("toggle chatbox on or of");
-
func = core::Func::add("ui_control",func_ui_control);
func->set_info("toggle mouse control");
@@ -323,9 +312,7 @@ void shutdown()
core::Func::remove("screenshot");
- core::Func::remove("ui_console");
- //core::Func::remove("ui_control");
- //core::Func::remove("ui_chat");
+ core::Func::remove("ui_control");
core::Func::remove("ui_view");
keyboard->save_binds();
@@ -489,38 +476,8 @@ Key::Modifier convert_SDL_modifier(int const sdlmodifier)
void key_pressed(Key *key)
{
- ui::root()->input_key(true, Keyboard::translate_keysym(key->sym(), keyboard_modifiers), keyboard_modifiers);
-
- if (key->sym() == SDLK_ESCAPE) {
-
- if (console()->visible()) {
- console()->toggle();
- local_direction = 0.0f;
- local_pitch = 0.0f;
- local_roll = 0.0f;
-
- render::Camera::set_direction(0.0f);
- render::Camera::set_pitch(0.0f);
-
- } else {
- if (ui::root()->active()) {
- ui::root()->hide_menu();
- local_direction = 0.0f;
- local_pitch = 0.0f;
- local_roll = 0.0f;
-
- render::Camera::set_direction(0.0f);
- render::Camera::set_pitch(0.0f);
- } else {
- if (core::application()->connected()) {
- ui::root()->show_menu("game");
- } else {
- ui::root()->show_menu("main");
- }
- }
- }
-
- } else if (key->bind(Key::None).compare("ui_console") == 0) {
+ if (key->bind(Key::None).compare("ui_console") == 0) {
+ // FIXME bah
local_direction = 0.0f;
local_pitch = 0.0f;
local_roll = 0.0f;
@@ -528,21 +485,11 @@ void key_pressed(Key *key)
render::Camera::set_direction(0.0f);
render::Camera::set_pitch(0.0f);
- console()->toggle();
+ client()->console()->toggle();
- } else if (console()->visible()) {
- // send key events to the console
- if (key->sym() < 512)
- console()->keypressed(Keyboard::translate_keysym(key->sym(), keyboard_modifiers));
+ } else if (ui::root()->input_key(true, Keyboard::translate_keysym(key->sym(), keyboard_modifiers), keyboard_modifiers)) {
+ return;
- } else if (ui::root()->active()) {
-/* ui::root()->input_key(true, key->sym(), keyboard_modifiers);
-*/
-/* } else if (chat::visible()) {
- // send key events to the chat box
- if (key->sym() < 512)
- chat::keypressed(translate_keysym(key->sym(), keyboard_modifiers));
-*/
} else if (core::application()->connected() && core::localcontrol()) {
char c = key->bind(convert_SDL_modifier(keyboard_modifiers)).c_str()[0];
@@ -553,6 +500,7 @@ void key_pressed(Key *key)
// normal bind
core::cmd() << key->bind(convert_SDL_modifier(keyboard_modifiers)) << "\n";
}
+
} else if (core::application()->connected()) {
char c = key->bind(convert_SDL_modifier(keyboard_modifiers)).c_str()[0];
@@ -561,7 +509,6 @@ void key_pressed(Key *key)
core::cmd() << key->bind(convert_SDL_modifier(keyboard_modifiers)) << "\n";
}
}
-
}
void key_released(Key *key)
@@ -813,7 +760,7 @@ void frame(float seconds)
mouse_deadzone = false;
if (core::application()->connected() && core::localcontrol()) {
- mouse_control = !console()->visible() && ((input_mousecontrol->value() > 0) || (mouse_control_override && (mouse_control_override_time + (input_mousedelay->value() / 1000.0f) < core::application()->time())));
+ mouse_control = client()->console()->hidden() && !ui::root()->active() && ((input_mousecontrol->value() > 0) || (mouse_control_override && (mouse_control_override_time + (input_mousedelay->value() / 1000.0f) < core::application()->time())));
if (mouse_control && joystick_control && ((render::Camera::mode() == render::Camera::Track) || (render::Camera::mode() == render::Camera::Cockpit))) {
if (!(mouse_control_override && (mouse_control_override_time + (input_mousedelay->value() / 1000.0f) < core::application()->time()))) {