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')
-rw-r--r--src/client/input.cc23
-rw-r--r--src/client/view.cc20
2 files changed, 21 insertions, 22 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index 1b895b7..10be405 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -56,6 +56,9 @@ bool mouse_control = false;
const float thruster_offset = 0.05f;
+// small hack to prevent two sounds triggered by the scrollwheel
+bool singleclick = true;
+
//--- engine functions --------------------------------------------
void func_screenshot(std::string const & args)
@@ -232,14 +235,18 @@ void action_press(std::string const &action)
{
/* -- thruster ------------------------------------ */
if (action.compare("+thrust") == 0) {
- if (local_thrust < 1.0f)
+ if (local_thrust < 1.0f && singleclick) {
audio::play("ui/thruster");
+ singleclick = false;
+ }
local_thrust += thruster_offset;
} else if (action.compare("-thrust") == 0) {
- if (local_thrust > 0.0f)
+ if (local_thrust > 0.0f && singleclick) {
audio::play("ui/thruster");
+ singleclick = false;
+ }
local_thrust -= 2.0f * thruster_offset;
/* -- mouse control ------------------------------- */
@@ -355,6 +362,7 @@ void frame(float seconds)
SDL_Event event;
Key *key = 0;
bool pressed = false;
+ singleclick = true;
while (SDL_PollEvent(&event)) {
pressed = false;
@@ -400,7 +408,7 @@ void frame(float seconds)
if (keysym.mod & KMOD_CAPS) capslock = true; else capslock = false;
if ((keysym.mod & KMOD_LSHIFT) || (keysym.mod & KMOD_RSHIFT)) capslock != capslock;
*/
- // FIXME screenshot and console are always captured
+ // console key is always captured
if (key->bind().compare("ui_console") == 0) {
console()->toggle();
local_direction = 0.0f;
@@ -410,16 +418,13 @@ void frame(float seconds)
render::Camera::set_direction(0.0f);
render::Camera::set_pitch(0.0f);
- } else if (key->bind().compare("screenshot") == 0) {
- video::screenshot();
-
} else if (console()->visible()) {
- // FIXME send key events to the console
+ // send key events to the console
if (event.type == SDL_KEYDOWN)
console()->keypressed(translate_keysym(event.key.keysym));
} else if (chat::visible()) {
- // FIXME send key events to the chat box
+ // send key events to the chat box
if (event.type == SDL_KEYDOWN)
chat::keypressed(translate_keysym(event.key.keysym));
@@ -445,7 +450,7 @@ void frame(float seconds)
} else {
- if (core::application()->connected() && core::localcontrol()) {
+ if (core::application()->connected() && core::localcontrol() && !console()->visible() && !chat::visible()) {
char c = key->bind().c_str()[0];
if (c == '+' || c == '-') {
diff --git a/src/client/view.cc b/src/client/view.cc
index fa96096..2bbae15 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -146,9 +146,6 @@ void draw_status()
{
using namespace render;
- if (console()->visible())
- return;
-
// print the status in the upper left corner
std::stringstream status;
@@ -267,8 +264,6 @@ void draw_cursor()
}
-
-
gl::color(color);
gl::begin(gl::Quads);
@@ -305,6 +300,9 @@ void frame(float seconds)
if (core::application()->connected() && core::game()->serverframetime()) {
render::draw(seconds); // draw the world
+ if (draw_radar->value()) {
+ Radar::draw();
+ }
}
// switch to ortographic projection to draw the GUI
@@ -323,14 +321,6 @@ void frame(float seconds)
}
// draw text elements
- Text::setfont("bitmaps/fonts/console", 12, 18);
- console()->draw();
- chat::draw();
-
- if (draw_radar->value()) {
- Radar::draw();
- }
-
if (draw_ui->value()) {
Text::setfont("bitmaps/fonts/gui", 16, 24);
draw_status();
@@ -338,6 +328,10 @@ void frame(float seconds)
// draw the mouse cursor
draw_cursor();
}
+
+ Text::setfont("bitmaps/fonts/console", 12, 18);
+ chat::draw();
+ console()->draw();
gl::disable(GL_TEXTURE_2D);
}