From 5a4bcd856787af106807b0b18fba8e4e2fae63ef Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 21 Jul 2008 15:46:49 +0000 Subject: draw center pointer when hovering in Track or Cockpit --- src/client/view.cc | 69 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) (limited to 'src/client') diff --git a/src/client/view.cc b/src/client/view.cc index db0fa64..e2a0e88 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -173,6 +173,36 @@ void draw_cursor() render::Textures::bind("bitmaps/pointers/aim"); } else { + // draw center cursor in Cockpit and Track mode + if (input::mouse_control && + (render::Camera::mode() == render::Camera::Cockpit || render::Camera::mode() == render::Camera::Track)) { + + if (ui_pointercolor) { + std::stringstream colorstr(ui_pointercolor->str()); + colorstr >> color; + } + + render::Textures::bind("bitmaps/pointers/center"); + float cx = (video::width - pointer_size) /2; + float cy = (video::height - pointer_size) /2; + + gl::color(color); + gl::begin(gl::Quads); + + glTexCoord2f(0,0 ); + gl::vertex(cx,cy,0.0f); + + glTexCoord2f(1, 0); + gl::vertex(cx+pointer_size, cy, 0.0f); + + glTexCoord2f(1, 1); + gl::vertex(cx+pointer_size, cy+pointer_size, 0.0f); + + glTexCoord2f(0, 1); + gl::vertex(cx, cy+pointer_size, 0.0f); + + gl::end(); + } if (!input::mouse_control_override && targets::hover()) { @@ -183,49 +213,22 @@ void draw_cursor() render::Textures::bind("bitmaps/pointers/target"); } else if (input::mouse_control) { - + if (ui_pointercolor) { std::stringstream colorstr(ui_pointercolor->str()); colorstr >> color; } - if (render::Camera::mode() == render::Camera::Cockpit - || render::Camera::mode() == render::Camera::Track) { - - render::Textures::bind("bitmaps/pointers/center"); - - x = (video::width - pointer_size) /2; - y = (video::height - pointer_size) /2; - - gl::color(color); - gl::begin(gl::Quads); - - glTexCoord2f(0,0 ); - gl::vertex(x,y,0.0f); - - glTexCoord2f(1, 0); - gl::vertex(x+pointer_size, y, 0.0f); - - glTexCoord2f(1, 1); - gl::vertex(x+pointer_size, y+pointer_size, 0.0f); - - glTexCoord2f(0, 1); - gl::vertex(x, y+pointer_size, 0.0f); - - gl::end(); - - } - render::Textures::bind("bitmaps/pointers/control"); -// if (!input::mouse_deadzone) { + if (!input::mouse_deadzone) { x = input::mouse_x - (pointer_size /2); y = input::mouse_y - (pointer_size /2); -// } else { -// x = (video::width - pointer_size) /2; -// y = (video::height - pointer_size) /2; -// } + } else { + x = (video::width - pointer_size) /2; + y = (video::height - pointer_size) /2; + } } else { -- cgit v1.2.3