Index: client/Client/main.cpp
===================================================================
--- client/Client/main.cpp	(revision 58ca135463bf56adba496a5755378cd4ce9bf965)
+++ client/Client/main.cpp	(revision 3e44a59703de814c41c541cc1ab28333ebddf311)
@@ -35,4 +35,5 @@
 #include "../../common/Projectile.h"
 #include "../../common/Game.h"
+#include "../../common/GameSummary.h"
 
 #include "Window.h"
@@ -54,5 +55,7 @@
 void initWinSock();
 void shutdownWinSock();
-void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player*>& mapPlayers, map<unsigned int, Projectile>& mapProjectiles, unsigned int& curPlayerId, int &scoreBlue, int &scoreRed);
+void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player*>& mapPlayers,
+                    map<unsigned int, Projectile>& mapProjectiles, unsigned int& curPlayerId, int &scoreBlue, int &scoreRed,
+                    GameSummary* gameSummary);
 int getRefreshRate(int width, int height);
 void drawMessageStatus(ALLEGRO_FONT* font);
@@ -70,4 +73,5 @@
 void createGame();
 void leaveGame();
+void closeGameSummary();
 
 void error(const char *);
@@ -94,4 +98,5 @@
 Window* wndNewGame;
 Window* wndGameDebug;
+Window* wndGameSummary;
 Window* wndCurrent;
 
@@ -123,4 +128,5 @@
 map<string, int> mapGames;
 Game* game;
+GameSummary* gameSummary;
 
 MessageProcessor msgProcessor;
@@ -143,4 +149,5 @@
    bool fullscreen = false;
    game = NULL;
+   gameSummary = NULL;
 
    scoreBlue = 0;
@@ -288,4 +295,9 @@
 
    cout << "Created new game screen" << endl;
+
+   wndGameSummary = new Window(0, 0, SCREEN_W, SCREEN_H);
+   wndGameSummary->addComponent(new Button(840, 730, 160, 20, font, "Back to Lobby", closeGameSummary));
+
+   cout << "Created game summary screen" << endl;
 
    goToLoginScreen();
@@ -388,14 +400,5 @@
       }
       else if(ev.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) {
-         if(wndCurrent == wndLobby) {
-            /*
-            if (ev.mouse.button == 1) { // left click
-               txtJoinGame->clear();
-               txtCreateGame->clear();
-               state = STATE_GAME;
-               wndCurrent = wndGame;
-            }
-            */
-         }else if(wndCurrent == wndGame || wndCurrent == wndNewGame) {
+         if(wndCurrent == wndGame || wndCurrent == wndNewGame) {
             if (ev.mouse.button == 1) {   // left click
                msgTo.type = MSG_TYPE_PLAYER_MOVE;
@@ -455,5 +458,5 @@
 
       if (msgProcessor.receiveMessage(&msgFrom, sock, &from, &outputLog) >= 0)
-         processMessage(msgFrom, state, chatConsole, gameMap, mapPlayers, mapProjectiles, curPlayerId, scoreBlue, scoreRed);
+         processMessage(msgFrom, state, chatConsole, gameMap, mapPlayers, mapProjectiles, curPlayerId, scoreBlue, scoreRed, gameSummary);
 
       if (redraw)
@@ -602,4 +605,19 @@
                al_draw_line(start.x, start.y, end.x, end.y, al_map_rgb(0, 0, 0), 4);
             }
+         }else if (wndCurrent == wndGameSummary) {
+            string strBlueScore = "Blue Score: "+gameSummary->getBlueScore();
+            string strRedScore = "Red Score: "+gameSummary->getRedScore();
+
+            string strWinner;
+
+            if (gameSummary->getWinner() == 0)
+                strWinner = "Blue Team Wins";
+            else if (gameSummary->getWinner() == 1)
+                strWinner = "Red Team Wins";
+
+            al_draw_text(font, al_map_rgb(0, 255, 0), 512, 40, ALLEGRO_ALIGN_CENTRE, gameSummary->getName().c_str());
+            al_draw_text(font, al_map_rgb(0, 255, 0), 330, 80, ALLEGRO_ALIGN_LEFT, strBlueScore.c_str());
+            al_draw_text(font, al_map_rgb(0, 255, 0), 515, 80, ALLEGRO_ALIGN_LEFT, strRedScore.c_str());
+            al_draw_text(font, al_map_rgb(0, 255, 0), 512, 120, ALLEGRO_ALIGN_CENTRE, strWinner.c_str());
          }
 
@@ -632,4 +650,7 @@
       delete game;
 
+   if (gameSummary != NULL)
+      delete gameSummary;
+
    map<unsigned int, Player*>::iterator it;
 
@@ -683,5 +704,7 @@
 }
 
-void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player*>& mapPlayers, map<unsigned int, Projectile>& mapProjectiles, unsigned int& curPlayerId, int &scoreBlue, int &scoreRed)
+void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player*>& mapPlayers,
+                    map<unsigned int, Projectile>& mapProjectiles, unsigned int& curPlayerId, int &scoreBlue, int &scoreRed,
+                    GameSummary* gameSummary)
 {
    // this is outdated since most messages now don't contain just a text string
@@ -986,4 +1009,43 @@
                break;
             }
+            case MSG_TYPE_SCORE:
+            {
+               cout << "Received SCORE message!" << endl;
+
+               int blueScore;
+               memcpy(&blueScore, msg.buffer, 4);
+               cout << "blue score: " << blueScore << endl;
+               game->setBlueScore(blueScore);
+
+               int redScore;
+               memcpy(&redScore, msg.buffer+4, 4);
+               cout << "red score: " << redScore << endl;
+               game->setRedScore(redScore);
+
+               cout << "Processed SCORE message!" << endl;
+ 
+               break;
+            }
+            case MSG_TYPE_FINISH_GAME:
+            {
+               cout << "Got a finish game message" << endl;
+               cout << "Should switch to STATE_LOBBY and show the final score" << endl;
+
+               string gameName(msg.buffer);
+
+               unsigned int winner, blueScore, redScore;
+               memcpy(&winner, msg.buffer+4, 4);
+               memcpy(&blueScore, msg.buffer+8, 4);
+               memcpy(&redScore, msg.buffer+12, 4);
+
+               gameSummary = new GameSummary(gameName, winner, blueScore, redScore);
+
+               delete game;
+               game = NULL;
+               state = STATE_LOBBY;
+               wndCurrent = wndGameSummary;
+
+               break;
+            }
             case MSG_TYPE_PLAYER:
             {
@@ -1069,22 +1131,4 @@
                   cout << "Did not remove the object" << endl;
 
-               break;
-            }
-            case MSG_TYPE_SCORE:
-            {
-               cout << "Received SCORE message!" << endl;
-
-               int blueScore;
-               memcpy(&blueScore, msg.buffer, 4);
-               cout << "blue score: " << blueScore << endl;
-               game->setBlueScore(blueScore);
-
-               int redScore;
-               memcpy(&redScore, msg.buffer+4, 4);
-               cout << "red score: " << redScore << endl;
-               game->setRedScore(redScore);
-
-               cout << "Processed SCORE message!" << endl;
- 
                break;
             }
@@ -1400,2 +1444,8 @@
    msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);
 }
+
+void closeGameSummary()
+{
+    delete gameSummary;
+    wndCurrent = wndLobby;
+}
