Index: client/Client/main.cpp
===================================================================
--- client/Client/main.cpp	(revision 3eac3b39220b6c494bbc7ae2519b52b02611d4dd)
+++ client/Client/main.cpp	(revision 929b4e0407a33aa0e35dc236e01153c6de2ac06f)
@@ -56,6 +56,7 @@
 POSITION mapToScreen(POSITION pos);
 int getRefreshRate(int width, int height);
-
-// callbacks
+void drawMessageStatus(ALLEGRO_FONT* font);
+
+// Callback declarations
 void goToLoginScreen();
 void goToRegisterScreen();
@@ -66,5 +67,6 @@
 void sendChatMessage();
 void toggleDebugging();
-void drawMessageStatus(ALLEGRO_FONT* font);
+void joinGame();
+void createGame();
 
 void error(const char *);
@@ -101,4 +103,8 @@
 RadioButtonList* rblClasses;
 TextLabel* lblRegisterStatus;
+
+// wndLobby
+Textbox* txtJoinGame;
+Textbox* txtCreateGame;
 
 // wndGame
@@ -241,4 +247,14 @@
 
    wndLobby = new Window(0, 0, SCREEN_W, SCREEN_H);
+   wndLobby->addComponent(new Button(920, 10, 80, 20, font, "Logout", logout));
+   wndLobby->addComponent(new TextLabel(SCREEN_W*1/4-112, 40, 110, 20, font, "Game Name:", ALLEGRO_ALIGN_RIGHT));
+   wndLobby->addComponent(new Textbox(SCREEN_W*1/4+4, 40, 100, 20, font));
+   wndLobby->addComponent(new Button(SCREEN_W*1/4-100, 80, 200, 20, font, "Join Existing Game", joinGame));
+   wndLobby->addComponent(new TextLabel(SCREEN_W*3/4-112, 40, 110, 20, font, "Game Name:", ALLEGRO_ALIGN_RIGHT));
+   wndLobby->addComponent(new Textbox(SCREEN_W*3/4+4, 40, 100, 20, font));
+   wndLobby->addComponent(new Button(SCREEN_W*3/4-100, 80, 200, 20, font, "Create New Game", createGame));
+
+   txtJoinGame = (Textbox*)wndLobby->getComponent(2);
+   txtCreateGame = (Textbox*)wndLobby->getComponent(5);
 
    cout << "Created lobby screen" << endl;
@@ -363,4 +379,6 @@
          if(wndCurrent == wndLobby) {
             if (ev.mouse.button == 1) { // left click
+               txtJoinGame->clear();
+               txtCreateGame->clear();
                state = STATE_GAME;
                wndCurrent = wndGame;
@@ -922,4 +940,80 @@
 }
 
+int getRefreshRate(int width, int height)
+{
+   int numRefreshRates = al_get_num_display_modes();
+   ALLEGRO_DISPLAY_MODE displayMode;
+
+   for(int i=0; i<numRefreshRates; i++) {
+      al_get_display_mode(i, &displayMode);
+
+      if (displayMode.width == width && displayMode.height == height)
+         return displayMode.refresh_rate;
+   }
+
+   return 0;
+}
+
+void drawMessageStatus(ALLEGRO_FONT* font)
+{
+   int clientMsgOffset = 5;
+   int serverMsgOffset = 950;
+
+   al_draw_text(font, al_map_rgb(0, 255, 255), 0+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "ID");
+   al_draw_text(font, al_map_rgb(0, 255, 255), 20+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "Type");
+   al_draw_text(font, al_map_rgb(0, 255, 255), 240+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "Acked?");
+
+   al_draw_text(font, al_map_rgb(0, 255, 255), serverMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "ID");
+
+   map<unsigned int, map<unsigned long, MessageContainer> >& sentMessages = msgProcessor.getSentMessages();
+   int id, type;
+   bool acked;
+   ostringstream ossId, ossAcked;
+
+   map<unsigned int, map<unsigned long, MessageContainer> >::iterator it;
+
+   int msgCount = 0;
+   for (it = sentMessages.begin(); it != sentMessages.end(); it++) {
+      map<unsigned long, MessageContainer> playerMessage = it->second;
+      map<unsigned long, MessageContainer>::iterator it2;
+      for (it2 = playerMessage.begin(); it2 !=  playerMessage.end(); it2++) {
+
+         id = it->first;
+         ossId.str("");;
+         ossId << id;
+
+         type = it2->second.getMessage()->type;
+         string typeStr = MessageContainer::getMsgTypeString(type);
+
+         acked = it2->second.getAcked();
+         ossAcked.str("");;
+         ossAcked << boolalpha << acked;
+
+         al_draw_text(font, al_map_rgb(0, 255, 0), clientMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, ossId.str().c_str());
+         al_draw_text(font, al_map_rgb(0, 255, 0), 20+clientMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, typeStr.c_str());
+         al_draw_text(font, al_map_rgb(0, 255, 0), 240+clientMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, ossAcked.str().c_str());
+
+         msgCount++;
+      }
+   }
+
+   if (msgProcessor.getAckedMessages().size() > 0) {
+      map<unsigned int, unsigned long long> ackedMessages = msgProcessor.getAckedMessages()[0];
+      map<unsigned int, unsigned long long>::iterator it3;
+
+      msgCount = 0;
+      for (it3 = ackedMessages.begin(); it3 != ackedMessages.end(); it3++) {
+         ossId.str("");;
+         ossId << it3->first;
+
+         al_draw_text(font, al_map_rgb(255, 0, 0), 25+serverMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, ossId.str().c_str());
+
+         msgCount++;
+      }
+   }
+}
+
+// Callback definitions
+
 void goToRegisterScreen()
 {
@@ -997,32 +1091,43 @@
 void logout()
 {
+   switch(state) {
+   case STATE_LOBBY:
+      txtJoinGame->clear();
+      txtCreateGame->clear();
+      break;
+   case STATE_GAME:
+      txtChat->clear();
+      chatConsole.clear();
+      break;
+   default:
+      cout << "Logout called from invalid state: " << state << endl;
+      break;
+   }
+
+   msgTo.type = MSG_TYPE_LOGOUT;
+
+   strcpy(msgTo.buffer, username.c_str());
+
+   msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);
+}
+
+void quit()
+{
+   doexit = true;
+}
+
+void sendChatMessage()
+{
+   string msg = txtChat->getStr();
+
    txtChat->clear();
-   chatConsole.clear();
-
-   msgTo.type = MSG_TYPE_LOGOUT;
-
-   strcpy(msgTo.buffer, username.c_str());
+
+   msgTo.type = MSG_TYPE_CHAT;
+
+   strcpy(msgTo.buffer, msg.c_str());
 
    msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);
 }
 
-void quit()
-{
-   doexit = true;
-}
-
-void sendChatMessage()
-{
-   string msg = txtChat->getStr();
-
-   txtChat->clear();
-
-   msgTo.type = MSG_TYPE_CHAT;
-
-   strcpy(msgTo.buffer, msg.c_str());
-
-   msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);
-}
-
 void toggleDebugging()
 {
@@ -1030,75 +1135,11 @@
 }
 
-int getRefreshRate(int width, int height)
-{
-   int numRefreshRates = al_get_num_display_modes();
-   ALLEGRO_DISPLAY_MODE displayMode;
-
-   for(int i=0; i<numRefreshRates; i++) {
-      al_get_display_mode(i, &displayMode);
-
-      if (displayMode.width == width && displayMode.height == height)
-         return displayMode.refresh_rate;
-   }
-
-   return 0;
-}
-
-void drawMessageStatus(ALLEGRO_FONT* font)
-{
-   int clientMsgOffset = 5;
-   int serverMsgOffset = 950;
-
-   al_draw_text(font, al_map_rgb(0, 255, 255), 0+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "ID");
-   al_draw_text(font, al_map_rgb(0, 255, 255), 20+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "Type");
-   al_draw_text(font, al_map_rgb(0, 255, 255), 240+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "Acked?");
-
-   al_draw_text(font, al_map_rgb(0, 255, 255), serverMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "ID");
-
-   map<unsigned int, map<unsigned long, MessageContainer> >& sentMessages = msgProcessor.getSentMessages();
-   int id, type;
-   bool acked;
-   ostringstream ossId, ossAcked;
-
-   map<unsigned int, map<unsigned long, MessageContainer> >::iterator it;
-
-   int msgCount = 0;
-   for (it = sentMessages.begin(); it != sentMessages.end(); it++) {
-      map<unsigned long, MessageContainer> playerMessage = it->second;
-      map<unsigned long, MessageContainer>::iterator it2;
-      for (it2 = playerMessage.begin(); it2 !=  playerMessage.end(); it2++) {
-
-         id = it->first;
-         ossId.str("");;
-         ossId << id;
-
-         type = it2->second.getMessage()->type;
-         string typeStr = MessageContainer::getMsgTypeString(type);
-
-         acked = it2->second.getAcked();
-         ossAcked.str("");;
-         ossAcked << boolalpha << acked;
-
-         al_draw_text(font, al_map_rgb(0, 255, 0), clientMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, ossId.str().c_str());
-         al_draw_text(font, al_map_rgb(0, 255, 0), 20+clientMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, typeStr.c_str());
-         al_draw_text(font, al_map_rgb(0, 255, 0), 240+clientMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, ossAcked.str().c_str());
-
-         msgCount++;
-      }
-   }
-
-   if (msgProcessor.getAckedMessages().size() > 0) {
-      map<unsigned int, unsigned long long> ackedMessages = msgProcessor.getAckedMessages()[0];
-      map<unsigned int, unsigned long long>::iterator it3;
-
-      msgCount = 0;
-      for (it3 = ackedMessages.begin(); it3 != ackedMessages.end(); it3++) {
-         ossId.str("");;
-         ossId << it3->first;
-
-         al_draw_text(font, al_map_rgb(255, 0, 0), 25+serverMsgOffset, 60+15*msgCount, ALLEGRO_ALIGN_LEFT, ossId.str().c_str());
-
-         msgCount++;
-      }
-   }
-}
+void joinGame()
+{
+   cout << "Joining game" << endl;
+}
+
+void createGame()
+{
+   cout << "Creating game" << endl;
+}
