# HG changeset patch # User terom # Date 1228682845 0 # Node ID 91f769d490a6ae764bfdb4f3ffad6b089ad17ef4 # Parent 8377571871f08d48b2b1fd1f0a6f457e7519f03b a better crosshair diff -r 8377571871f0 -r 91f769d490a6 src/Config.hh --- a/src/Config.hh Sun Dec 07 20:44:45 2008 +0000 +++ b/src/Config.hh Sun Dec 07 20:47:25 2008 +0000 @@ -32,7 +32,8 @@ const float PLAYER_AIM_MAX = KG_PI/2; const float PLAYER_INITIAL_X = 400.0; const float PLAYER_INITIAL_Y = 300.0; -const float PLAYER_CROSSHAIR_LENGTH = 10.0; +const float PLAYER_CROSSHAIR_DISTANCE = 20.0; +const float PLAYER_CROSSHAIR_WIDTH = 4; const float CROSSHAIR_ANGLE_SPEED = PI/40; const float PLAYER_MAX_SPEED = 43; diff -r 8377571871f0 -r 91f769d490a6 src/Player.cc --- a/src/Player.cc Sun Dec 07 20:44:45 2008 +0000 +++ b/src/Player.cc Sun Dec 07 20:47:25 2008 +0000 @@ -217,13 +217,17 @@ ), destination, gc ); - // draw "crosshair", a half-line from our position to 10px away - Vector crosshair = getDirection() * PLAYER_CROSSHAIR_LENGTH; - - PixelCoordinate aim_start = getCoordinate() + world.getPixelCoordinate(crosshair / 2) - camera; - PixelCoordinate aim_end = getCoordinate() + world.getPixelCoordinate(crosshair) - camera; + // draw a proper crosshair-box + PixelCoordinate crosshair = getCoordinate() + world.getPixelCoordinate(getDirection() * PLAYER_CROSSHAIR_DISTANCE) - camera; - gc->draw_line(aim_start.x, aim_start.y, aim_end.x, aim_end.y, CL_Color::black); + gc->draw_rect( + CL_Rectf( + crosshair.x - PLAYER_CROSSHAIR_WIDTH / 2, + crosshair.y - PLAYER_CROSSHAIR_WIDTH / 2, + crosshair.x + PLAYER_CROSSHAIR_WIDTH / 2, + crosshair.y + PLAYER_CROSSHAIR_WIDTH / 2 + ), CL_Color::red + ); // draw rope rope.draw(g, camera);