Changeset 87b3ee2 in network-game for client/Client/chat.cpp


Ignore:
Timestamp:
Dec 3, 2012, 12:24:23 AM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
41ad8ed
Parents:
439f7bc
Message:

Created a simple gui for the client

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/chat.cpp

    r439f7bc r87b3ee2  
    1919{
    2020   for(int x=0; x<vctChat.size(); x++)
    21       al_draw_text(font, color, 10, 10+x*15, ALLEGRO_ALIGN_LEFT, vctChat[x].c_str());
     21      al_draw_text(font, color, 10, 140+x*15, ALLEGRO_ALIGN_LEFT, vctChat[x].c_str());
    2222
    2323   al_draw_text(font, color, 10, 460, ALLEGRO_ALIGN_LEFT, strPrompt.c_str());
     
    3030
    3131// returns true if the event was consumed, false if it should be passed on
    32 bool chat::processEvent(ALLEGRO_EVENT ev)
     32bool chat::handleEvent(ALLEGRO_EVENT e)
    3333{
    3434   ALLEGRO_KEYBOARD_STATE keys;
    3535   al_get_keyboard_state(&keys);
    3636
    37    if (ev.type == ALLEGRO_EVENT_KEY_DOWN) {
     37   if (e.type == ALLEGRO_EVENT_KEY_DOWN) {
    3838      char newChar = 0;
    3939
    40       if (ALLEGRO_KEY_A <= ev.keyboard.keycode && ev.keyboard.keycode <= ALLEGRO_KEY_Z) {
    41          newChar = 'a'+ev.keyboard.keycode-ALLEGRO_KEY_A;
     40      if (ALLEGRO_KEY_A <= e.keyboard.keycode && e.keyboard.keycode <= ALLEGRO_KEY_Z) {
     41         newChar = 'a'+e.keyboard.keycode-ALLEGRO_KEY_A;
    4242         if (al_key_down(&keys, ALLEGRO_KEY_LSHIFT) || al_key_down(&keys, ALLEGRO_KEY_RSHIFT))
    4343            newChar -= 32;
    4444      }
    45       if (ALLEGRO_KEY_0 <= ev.keyboard.keycode && ev.keyboard.keycode <= ALLEGRO_KEY_9)
    46          newChar = '0'+ev.keyboard.keycode-ALLEGRO_KEY_0;
     45      if (ALLEGRO_KEY_0 <= e.keyboard.keycode && e.keyboard.keycode <= ALLEGRO_KEY_9)
     46         newChar = '0'+e.keyboard.keycode-ALLEGRO_KEY_0;
    4747
    4848      if (newChar != 0) {
     
    5151      }
    5252
    53       if (ev.keyboard.keycode == ALLEGRO_KEY_ENTER) {
     53      if (e.keyboard.keycode == ALLEGRO_KEY_ENTER) {
    5454         strEnteredInput = strPrompt;
    5555         strPrompt.clear();
Note: See TracChangeset for help on using the changeset viewer.