kills, deaths and weapon name is displayed in right place
authornireco
Mon, 08 Dec 2008 22:57:01 +0000
changeset 325 a19c78786d7f
parent 324 3daa94b111e4
child 326 b6bdc29bcf6e
kills, deaths and weapon name is displayed in right place
src/Graphics.cc
src/Player.hh
--- a/src/Graphics.cc	Mon Dec 08 22:56:07 2008 +0000
+++ b/src/Graphics.cc	Mon Dec 08 22:57:01 2008 +0000
@@ -2,6 +2,7 @@
 #include "Graphics.hh"
 #include "GameState.hh"
 #include <cmath>
+#include <sstream>
 
 Graphics::Graphics (Engine &engine, GameState &state) :
     CL_DisplayWindow(GRAPHICS_WINDOW_TITLE, GRAPHICS_RESOLUTION_WIDTH, GRAPHICS_RESOLUTION_HEIGHT),
@@ -125,8 +126,8 @@
             box_bottom
         ),
         CL_Gradient(
-            CL_Color(0, 0, 0, 100),
-            CL_Color(50, 50, 50, 150),
+            CL_Color(0, 0, 0),
+            CL_Color(50, 50, 50),
             CL_Color(50, 50, 50, 150),
             CL_Color(100, 100, 100, 200)
         )
@@ -157,14 +158,32 @@
             CL_Color(200 - (int)(p->getHealthPercent() * 2), (int)(p->getHealthPercent() * 2), 0)
         )
     );
+    std::stringstream sskills;
+    sskills << "Kills:  " << p->getKills();
+    getSimpleFont().draw(
+        box_left + 20 + 100 * bar_length,
+        box_top + 10,
+        sskills.str(),
+        get_gc()
+    );
+
+    std::stringstream ssdeaths;
+    ssdeaths << "Deaths:  " << p->getDeaths();
+    getSimpleFont().draw(
+        box_left + 20 + 100 * bar_length,
+        box_top + 40,
+        ssdeaths.str(),
+        get_gc()
+    );
+    
 
     // Ammobar
     gc->draw_rect(
         CL_Rect(
             box_left + 9,
-            box_top + 39,
+            box_top + 69,
             box_left + 11 + 100 * bar_length,
-            box_top + 61
+            box_top + 91
         ),
         CL_Color(150, 150, 150)
     );
@@ -172,9 +191,9 @@
     gc->fill_rect(
         CL_Rect(
             box_left + 10,
-            box_top + 40,
+            box_top + 70,
             box_left + 10 + (int) (p->getCurrentWeapon()->getReloadTimer() * 100 / p->getCurrentWeapon()->getReloadTime() * bar_length),
-            box_top + 60
+            box_top + 90
         ),
         CL_Gradient(
             CL_Color(100, 100, 0),
@@ -183,5 +202,12 @@
             CL_Color(100, 100, 100)
         )
     );
+
+    getSimpleFont().draw(
+        box_left + 20 + 100 * bar_length,
+        box_top + 70,
+        p->getCurrentWeapon()->getName(),
+        get_gc()
+    );
 }
 
--- a/src/Player.hh	Mon Dec 08 22:56:07 2008 +0000
+++ b/src/Player.hh	Mon Dec 08 22:57:01 2008 +0000
@@ -157,6 +157,8 @@
     static CL_Surface skin_surface;
     virtual void draw (Graphics *g, PixelCoordinate camera);
 
+    uint16_t getKills() { return kills; }
+    uint16_t getDeaths() { return deaths; }
 };
 
 /**