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-11-16 18:47:01 +0000
committerStijn Buys <ingar@osirion.org>2008-11-16 18:47:01 +0000
commit44158ccfbe943b832c0e0bf9ce547212aa6c2b8b (patch)
tree3749d855271779b65283f86599c0faebdfdf4318 /src/client/input.cc
parent315a8c2dff9b76ac5e1ebbef265f13ac19d65e3d (diff)
camera zoom
Diffstat (limited to 'src/client/input.cc')
-rw-r--r--src/client/input.cc37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index 8236b9b..a5af430 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -384,17 +384,24 @@ void action_press(Key const *key, std::string const &action)
local_afterburner = -1.0f;
/* -- camera control ------------------------------ */
+
+ } else if (action.compare("+zoomin") == 0) {
+ render::Camera::set_zoom(-0.1f);
+
+ } else if (action.compare("+zoomout") == 0) {
+ render::Camera::set_zoom(+0.1f);
+
} else if (action.compare("+camleft") == 0) {
- render::Camera::set_direction(1.0f);
+ render::Camera::set_direction( math::min(key->pressed() - core::application()->time(), 1.0f) );
} else if (action.compare("+camright") == 0) {
- render::Camera::set_direction(-1.0f);
+ render::Camera::set_direction(-math::min(key->pressed() - core::application()->time(),1.0f));
} else if (action.compare("+camup") == 0) {
- render::Camera::set_pitch(1.0f);
+ render::Camera::set_pitch(math::min(key->pressed() - core::application()->time(),1.0f));
} else if (action.compare("+camdown") == 0) {
- render::Camera::set_pitch(-1.0f);
+ render::Camera::set_pitch(-math::min(key->pressed() - core::application()->time(),1.0f));
} else
con_warn << "Unknown action " << action << std::endl;
}
@@ -471,17 +478,15 @@ void action_release(Key *key, std::string const &action)
}
}
-Key::Modifier convert_SDL_modifier(int const sdlmodifier)
-{
- if (sdlmodifier & Key::Shift)
+Key::Modifier modifier() {
+ if ((keyboard_modifiers & Key::Shift) > 0 )
return Key::Shift;
- else if (sdlmodifier & Key::Ctrl)
+ else if ((keyboard_modifiers & Key::Ctrl) > 0 )
return Key::Ctrl;
- else if (sdlmodifier & Key::Alt)
+ else if ((keyboard_modifiers & Key::Alt) > 0 )
return Key::Alt;
else
return Key::None;
-
}
void key_pressed(Key *key)
@@ -515,25 +520,25 @@ void key_pressed(Key *key)
} else if (!core::localplayer()->view() && core::application()->connected() && core::localcontrol()) {
- char c = key->bind(convert_SDL_modifier(keyboard_modifiers)).c_str()[0];
+ char c = key->bind(modifier()).c_str()[0];
if (c == '@') {
// target bind
if (targets::current_id())
- core::cmd() << key->bind(convert_SDL_modifier(keyboard_modifiers)) << " " << targets::current_id() <<"\n";
+ core::cmd() << key->bind(modifier()) << " " << targets::current_id() <<"\n";
} else if (c == '+') {
// action bind
- action_press(key, key->bind(convert_SDL_modifier(keyboard_modifiers)));
+ action_press(key, key->bind(modifier()));
} else {
// normal bind
- core::cmd() << key->bind(convert_SDL_modifier(keyboard_modifiers)) << "\n";
+ core::cmd() << key->bind(modifier()) << "\n";
}
} else if (core::application()->connected()) {
- char c = key->bind(convert_SDL_modifier(keyboard_modifiers)).c_str()[0];
+ char c = key->bind(modifier()).c_str()[0];
if (c && c != '+' && c != '@') {
// normal bind
- core::cmd() << key->bind(convert_SDL_modifier(keyboard_modifiers)) << "\n";
+ core::cmd() << key->bind(modifier()) << "\n";
}
}
}