Changeset 785
- Timestamp:
- Apr 17, 2006, 1:19:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/cpp/cpptest.cpp
r784 r785 21 21 22 22 static char const *pig[]= { 23 " _ ", 24 " _._ _..._ .-', _.._(`)) ", 25 " '-. ` ' /-._.-' ',/ ", 26 " ) \ '. ", 27 " / _ _ | \\ ", 28 " | a a / | ", 29 " \ .-. ; " , 30 " '-('' ).-' ,' ; ", 31 " '-; | .' ", 32 " \\ \\ / ", 33 " | 7 .__ _.-\\ \\ ", 34 " | | | ``/ /` / ", 35 " jgs /,_| | /,_/ / ", 36 " /,_/ '`-' ", 23 " ", 24 " _ ", 25 " _._ _..._ .-', _.._(`)) ", 26 " '-. ` ' /-._.-' ',/ ", 27 " ) \ '. ", 28 " / _ _ | \\ ", 29 " | a a / | ", 30 " \ .-. ; " , 31 " '-('' ).-' ,' ; ", 32 " '-; | .' ", 33 " \\ \\ / ", 34 " | 7 .__ _.-\\ \\ ", 35 " | | | ``/ /` / ", 36 " jgs /,_| | /,_/ / ", 37 " /,_/ '`-' ", 38 " ", 37 39 NULL 38 40 }; … … 43 45 Caca *kk; 44 46 Caca::Event ev; 47 int x = 0, y = 0, ix = 1, iy = 1; 48 49 45 50 46 51 try { … … 60 65 } 61 66 62 63 /* Draw pig */ 64 qq->set_color(CUCUL_COLOR_LIGHTMAGENTA, CUCUL_COLOR_BLACK); 65 66 for(int i = 0; pig[i]; i++) 67 qq->putstr(0, i, (char*)pig[i]); 68 69 /* printf works */ 70 qq->set_color(CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_BLACK); 71 qq->printf(7,15, "Powered by libcaca %s", VERSION); 72 67 kk->set_delay(20000); 73 68 74 kk->display(); 75 kk->get_event(CACA_EVENT_KEY_PRESS, &ev, -1); 69 while(!kk->get_event(CACA_EVENT_KEY_PRESS, &ev, 0)) { 70 71 /* Draw pig */ 72 qq->set_color(CUCUL_COLOR_LIGHTMAGENTA, CUCUL_COLOR_BLACK); 73 74 for(int i = 0; pig[i]; i++) 75 qq->putstr(x, y+i, (char*)pig[i]); 76 77 /* printf works */ 78 qq->set_color(CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_BLACK); 79 qq->printf(30,15, "Powered by libcaca %s", VERSION); 80 81 /* Blit */ 82 kk->display(); 83 84 x+=ix; 85 y+=iy; 86 87 if(x>=(qq->get_width()-35) || x<0 ) 88 ix=-ix; 89 if(y>=(qq->get_height()-15) || y<0 ) 90 iy=-iy; 91 92 93 } 76 94 77 95
Note: See TracChangeset
for help on using the changeset viewer.