Changeset 11ad6fb in network-game


Ignore:
Timestamp:
Jan 26, 2014, 10:50:13 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
dfb9363
Parents:
b29ff6b
Message:

The client prints a list of all online players in the lobby

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    rb29ff6b r11ad6fb  
    386386               chatConsole.draw(font, al_map_rgb(255,255,255));
    387387
     388            al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*1/2-100, 120, ALLEGRO_ALIGN_LEFT, "Current Games");
     389
    388390            map<string, int>::iterator it;
    389391            int i=0;
    390             ostringstream ossGame;
     392            ostringstream oss;
    391393            for (it = mapGames.begin(); it != mapGames.end(); it++) {
    392                ossGame << it->first << " (" << it->second << " players)" << endl;
    393                al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*1/2-100, 120+i*15, ALLEGRO_ALIGN_LEFT, ossGame.str().c_str());
    394                ossGame.clear();
    395                ossGame.str("");
     394               oss << it->first << " (" << it->second << " players)" << endl;
     395               al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*1/2-100, 135+i*15, ALLEGRO_ALIGN_LEFT, oss.str().c_str());
     396               oss.clear();
     397               oss.str("");
     398               i++;
     399            }
     400
     401            al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*3/4-100, 120, ALLEGRO_ALIGN_LEFT, "Online Players");
     402
     403            map<unsigned int, Player*>::iterator itPlayers;
     404            i=0;
     405            for (itPlayers = mapPlayers.begin(); itPlayers != mapPlayers.end(); itPlayers++) {
     406               oss << itPlayers->second->name << endl;
     407               al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*3/4-100, 135+i*15, ALLEGRO_ALIGN_LEFT, oss.str().c_str());
     408               oss.clear();
     409               oss.str("");
    396410               i++;
    397411            }
Note: See TracChangeset for help on using the changeset viewer.