added simple score display at the end and on the terminal
authorConstantin <constantin@exxxtremesys.lu>
Sun, 5 May 2013 10:27:14 +0000 (12:27 +0200)
committerConstantin <constantin@exxxtremesys.lu>
Sun, 5 May 2013 10:27:14 +0000 (12:27 +0200)
game.cpp

index 66119999b4daa8a9481c12c9b40a4d90fad9f62f..6e4b6f061584fbd3a57e01a59322d45590afb025 100644 (file)
--- a/game.cpp
+++ b/game.cpp
@@ -12,6 +12,7 @@
 #include <map>
 #include <iostream>
 #include <set>
 #include <map>
 #include <iostream>
 #include <set>
+#include <sstream>
 
 class Renderable {
 public:
 
 class Renderable {
 public:
@@ -351,7 +352,15 @@ int main (int argc, char** argv) {
                }
        }
 
                }
        }
 
-       //sleep(10);
+       for (size_t i=0; i<players.size(); i++) {
+               std::stringstream msg;
+               msg << "player " << players[i]->getName() << " has " << players[i]->getScore() << " points." << std::endl;
+               std::cout << msg.str();
+               playerTextFields[i].text = msg.str();
+       }
+       render(dpy, w, gc, blackColor, toRender);
+
+       sleep(5);
 
        return 0;
 }
 
        return 0;
 }