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 | |
parent | 5438566c29ef436b32bb8722e0fa088935c59471 (diff) |
camera and cursor updates
-rw-r--r-- | osirion.kdevelop.pcs | bin | 762514 -> 760202 bytes | |||
-rw-r--r-- | osirion.kdevses | 11 | ||||
-rw-r--r-- | src/client/view.cc | 48 | ||||
-rw-r--r-- | src/render/camera.cc | 4 | ||||
-rw-r--r-- | src/render/textures.cc | 1 |
5 files changed, 50 insertions, 14 deletions
diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs Binary files differindex f47f01a..000958d 100644 --- a/osirion.kdevelop.pcs +++ b/osirion.kdevelop.pcs diff --git a/osirion.kdevses b/osirion.kdevses index e1979af..c284b2a 100644 --- a/osirion.kdevses +++ b/osirion.kdevses @@ -1,16 +1,13 @@ <?xml version = '1.0' encoding = 'UTF-8'?> <!DOCTYPE KDevPrjSession> <KDevPrjSession> - <DocsAndViews NumberOfDocuments="3" > - <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/gameserver.cc" > - <View0 Encoding="" line="191" Type="Source" /> + <DocsAndViews NumberOfDocuments="2" > + <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/input.cc" > + <View0 Encoding="" line="449" Type="Source" /> </Doc0> <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/view.cc" > - <View0 Encoding="" line="150" Type="Source" /> + <View0 Encoding="" line="236" Type="Source" /> </Doc1> - <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/sys/sys.cc" > - <View0 Encoding="" line="0" Type="Source" /> - </Doc2> </DocsAndViews> <pluginList> <kdevdebugger> 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"); |