diff options
author | Stijn Buys <ingar@osirion.org> | 2008-06-17 17:22:41 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-06-17 17:22:41 +0000 |
commit | c5dddd62db3e070b89cb774abfd90cc3387a6d52 (patch) | |
tree | 4ffd089f567190aba57cdd59afa7ac8e3bde6261 /src | |
parent | 5438566c29ef436b32bb8722e0fa088935c59471 (diff) |
camera and cursor updates
Diffstat (limited to 'src')
-rw-r--r-- | src/client/view.cc | 48 | ||||
-rw-r--r-- | src/render/camera.cc | 4 | ||||
-rw-r--r-- | src/render/textures.cc | 1 |
3 files changed, 46 insertions, 7 deletions
diff --git a/src/client/view.cc b/src/client/view.cc index d796655..c74c83e 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -193,8 +193,6 @@ void draw_cursor() using namespace render; - - math::Color color; color.a = 0.5f; @@ -204,12 +202,50 @@ void draw_cursor() } else { if (input::mouse_control) { - render::Textures::bind("bitmaps/crosshairs/control"); - - if (cl_crosshaircolor && cl_crosshaircolor->value()) { + + if (cl_crosshaircolor) { std::stringstream colorstr(cl_crosshaircolor->str()); colorstr >> color; } + + if (render::Camera::mode() == render::Camera::Cockpit + || render::Camera::mode() == render::Camera::Track) { + + render::Textures::bind("bitmaps/crosshairs/center"); + + x = (video::width - crosshair_size) /2; + y = (video::height - crosshair_size) /2; + + gl::color(color); + gl::begin(gl::Quads); + + glTexCoord2f(0,0 ); + gl::vertex(x,y,0.0f); + + glTexCoord2f(1, 0); + gl::vertex(x+crosshair_size, y, 0.0f); + + glTexCoord2f(1, 1); + gl::vertex(x+crosshair_size, y+crosshair_size, 0.0f); + + glTexCoord2f(0, 1); + gl::vertex(x, y+crosshair_size, 0.0f); + + gl::end(); + + } + + render::Textures::bind("bitmaps/crosshairs/control"); + + if (!input::mouse_deadzone) { + x = input::mouse_x - (crosshair_size /2); + y = input::mouse_y - (crosshair_size /2); + + } else { + x = (video::width - crosshair_size) /2; + y = (video::height - crosshair_size) /2; + } + } else { render::Textures::bind("bitmaps/crosshairs/aim"); @@ -217,6 +253,8 @@ void draw_cursor() } + + gl::color(color); gl::begin(gl::Quads); diff --git a/src/render/camera.cc b/src/render/camera.cc index 5a6607f..6c9a115 100644 --- a/src/render/camera.cc +++ b/src/render/camera.cc @@ -264,11 +264,11 @@ void Camera::draw(float seconds) } } -/* if (core::localcontrol()->model()) { + if (core::localcontrol()->model()) { camera_target -= (core::localcontrol()->model()->maxbbox().x + 0.1f) * camera_axis.forward(); camera_target += (core::localcontrol()->model()->maxbbox().z + 0.1f ) * camera_axis.up(); } -*/ + } else if (mode() == Free) { camera_axis.assign(target_axis); diff --git a/src/render/textures.cc b/src/render/textures.cc index 71abc87..e4b047f 100644 --- a/src/render/textures.cc +++ b/src/render/textures.cc @@ -45,6 +45,7 @@ void Textures::init() // crosshairs load("bitmaps/crosshairs/aim"); + load("bitmaps/crosshairs/center"); load("bitmaps/crosshairs/control"); load("bitmaps/crosshairs/target"); |