Changeset fd9cdb5 in network-game for client/Client/main.cpp


Ignore:
Timestamp:
Jul 5, 2014, 12:52:30 AM (10 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
b28e2bf
Parents:
abc4d56
Message:

Add new player profile screen, accessible from the lobby, which shows the game history and other information.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    rabc4d56 rfd9cdb5  
    7777void sendChatMessage();
    7878void toggleDebugging();
     79void goToProfileScreen();
     80void goToLobbyScreen();
    7981void joinGame(); // for joining the game lobby
    8082void createGame(); // for joining the game lobby
     
    107109Window* wndLobby;
    108110Window* wndLobbyDebug;
     111Window* wndProfile;
    109112Window* wndGameLobby;
    110113Window* wndGame;
     
    430433               i++;
    431434            }
     435         }
     436         else if (wndCurrent == wndProfile)
     437         {
     438            al_draw_text(font, al_map_rgb(0, 255, 0), 65, 90, ALLEGRO_ALIGN_LEFT, "Honor Points: 500");
     439
     440            // display records of the last 10 games
     441            for (int i=0; i<10; i++) {
     442               al_draw_text(font, al_map_rgb(0, 255, 0), 142, 160+30*(i+1), ALLEGRO_ALIGN_CENTRE, "VICTORY");
     443               al_draw_text(font, al_map_rgb(0, 255, 0), 302, 160+30*(i+1), ALLEGRO_ALIGN_CENTRE, "3");
     444               al_draw_text(font, al_map_rgb(0, 255, 0), 462, 160+30*(i+1), ALLEGRO_ALIGN_CENTRE, "2");
     445               al_draw_text(font, al_map_rgb(0, 255, 0), 622, 160+30*(i+1), ALLEGRO_ALIGN_CENTRE, "6/11/2014, 5:12 PM");
     446            }
     447           
    432448         }
    433449         else if (wndCurrent == wndGameLobby)
     
    608624
    609625void createGui(ALLEGRO_FONT* font) {
     626
    610627   // wndLogin
    611628
     
    663680
    664681   wndLobby = new Window(0, 0, SCREEN_W, SCREEN_H);
    665    vctComponents.push_back(wndLobby->addComponent(new Button(920, 10, 80, 20, font, "Logout", logout)));
     682   vctComponents.push_back(wndLobby->addComponent(new Button(920, 10, 80, 20, font, "Profile", goToProfileScreen)));
     683   vctComponents.push_back(wndLobby->addComponent(new Button(920, 738, 80, 20, font, "Logout", logout)));
    666684   vctComponents.push_back(wndLobby->addComponent(new TextLabel(SCREEN_W*1/2+15-112, 40, 110, 20, font, "Game Name:", ALLEGRO_ALIGN_RIGHT)));
    667685   wndLobby->addComponent(txtJoinGame);
     
    682700
    683701   wndLobbyDebug = new Window(0, 0, SCREEN_W, SCREEN_H);
    684    vctComponents.push_back(wndLobbyDebug->addComponent(new Button(920, 10, 80, 20, font, "Logout", logout)));
     702   vctComponents.push_back(wndLobbyDebug->addComponent(new Button(920, 10, 80, 20, font, "Profile", goToProfileScreen)));
     703   vctComponents.push_back(wndLobbyDebug->addComponent(new Button(920, 738, 80, 20, font, "Logout", logout)));
    685704   vctComponents.push_back(wndLobbyDebug->addComponent(new TextLabel(SCREEN_W*1/2+15-112, 40, 110, 20, font, "Game Name:", ALLEGRO_ALIGN_RIGHT)));
    686705   wndLobbyDebug->addComponent(txtJoinGame);
     
    692711
    693712   cout << "Created debug lobby screen" << endl;
     713
     714
     715   // wndProfile
     716
     717   wndProfile = new Window(0, 0, SCREEN_W, SCREEN_H);
     718   vctComponents.push_back(wndProfile->addComponent(new TextLabel(450, 40, 124, 20, font, "Profile", ALLEGRO_ALIGN_CENTRE)));
     719   vctComponents.push_back(wndProfile->addComponent(new TextLabel(160, 120, 124, 20, font, "Game History", ALLEGRO_ALIGN_CENTRE)));
     720   vctComponents.push_back(wndProfile->addComponent(new TextLabel(600, 160, 124, 20, font, "Time", ALLEGRO_ALIGN_CENTRE)));
     721   vctComponents.push_back(wndProfile->addComponent(new TextLabel(80, 160, 124, 20, font, "Result", ALLEGRO_ALIGN_CENTRE)));
     722   vctComponents.push_back(wndProfile->addComponent(new TextLabel(240, 160, 124, 20, font, "Blue Score", ALLEGRO_ALIGN_CENTRE)));
     723   vctComponents.push_back(wndProfile->addComponent(new TextLabel(400, 160, 124, 20, font, "Red Score", ALLEGRO_ALIGN_CENTRE)));
     724   vctComponents.push_back(wndProfile->addComponent(new TextLabel(560, 160, 124, 20, font, "Time", ALLEGRO_ALIGN_CENTRE)));
     725   vctComponents.push_back(wndProfile->addComponent(new Button(920, 738, 80, 20, font, "Back", goToLobbyScreen)));
    694726
    695727
     
    824856            {
    825857               chatConsole.addLine(response);
     858
     859               break;
     860            }
     861            case MSG_TYPE_PROFILE:
     862            {
     863               wndCurrent = wndProfile;
    826864
    827865               break;
     
    13571395}
    13581396
     1397void goToProfileScreen()
     1398{
     1399   msgTo.type = MSG_TYPE_PROFILE;
     1400
     1401   msgProcessor.sendMessage(&msgTo, &server);
     1402}
     1403
     1404void goToLobbyScreen()
     1405{
     1406   wndCurrent = wndLobby;
     1407}
     1408
    13591409void joinGame()
    13601410{
Note: See TracChangeset for help on using the changeset viewer.