Changeset 87b3ee2 in network-game for client/Client/chat.cpp
- Timestamp:
- Dec 3, 2012, 12:24:23 AM (12 years ago)
- Branches:
- master
- Children:
- 41ad8ed
- Parents:
- 439f7bc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/chat.cpp
r439f7bc r87b3ee2 19 19 { 20 20 for(int x=0; x<vctChat.size(); x++) 21 al_draw_text(font, color, 10, 1 0+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()); 22 22 23 23 al_draw_text(font, color, 10, 460, ALLEGRO_ALIGN_LEFT, strPrompt.c_str()); … … 30 30 31 31 // returns true if the event was consumed, false if it should be passed on 32 bool chat:: processEvent(ALLEGRO_EVENT ev)32 bool chat::handleEvent(ALLEGRO_EVENT e) 33 33 { 34 34 ALLEGRO_KEYBOARD_STATE keys; 35 35 al_get_keyboard_state(&keys); 36 36 37 if (e v.type == ALLEGRO_EVENT_KEY_DOWN) {37 if (e.type == ALLEGRO_EVENT_KEY_DOWN) { 38 38 char newChar = 0; 39 39 40 if (ALLEGRO_KEY_A <= e v.keyboard.keycode && ev.keyboard.keycode <= ALLEGRO_KEY_Z) {41 newChar = 'a'+e v.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; 42 42 if (al_key_down(&keys, ALLEGRO_KEY_LSHIFT) || al_key_down(&keys, ALLEGRO_KEY_RSHIFT)) 43 43 newChar -= 32; 44 44 } 45 if (ALLEGRO_KEY_0 <= e v.keyboard.keycode && ev.keyboard.keycode <= ALLEGRO_KEY_9)46 newChar = '0'+e v.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; 47 47 48 48 if (newChar != 0) { … … 51 51 } 52 52 53 if (e v.keyboard.keycode == ALLEGRO_KEY_ENTER) {53 if (e.keyboard.keycode == ALLEGRO_KEY_ENTER) { 54 54 strEnteredInput = strPrompt; 55 55 strPrompt.clear();
Note:
See TracChangeset
for help on using the changeset viewer.