Changeset 2074 for libcaca/trunk/cxx
- Timestamp:
- Nov 26, 2007, 2:04:32 AM (13 years ago)
- Location:
- libcaca/trunk/cxx
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/cxx/caca++.cpp
r2050 r2074 97 97 } 98 98 99 const char * Caca::getVersion() 100 { 101 return caca_get_version(); 102 } 103 -
libcaca/trunk/cxx/caca++.h
r2071 r2074 79 79 void setMouse(int); 80 80 81 static char const * getVersion(); 81 82 private: 82 83 caca_display_t *dp; -
libcaca/trunk/cxx/cucul++.cpp
r1952 r2074 237 237 } 238 238 239 const char * Cucul::getVersion() 240 { 241 return cucul_get_version(); 242 } 243 239 244 int Cucul::setAttr(unsigned long int attr) 240 245 { -
libcaca/trunk/cxx/cucul++.h
r2071 r2074 130 130 void drawThinTriangle(int, int, int, int, int, int); 131 131 void fillTriangle(int, int, int, int, int, int, unsigned long int); 132 int Rand(int, int);133 132 int setBoundaries(cucul_canvas_t *, int, int, unsigned int, unsigned int); 134 133 unsigned int getFrameCount(); … … 143 142 void *exportMemory(char const *, unsigned long int *); 144 143 144 static int Rand(int, int); 145 static char const * getVersion(); 145 146 protected: 146 147 cucul_canvas_t *get_cucul_canvas_t(); -
libcaca/trunk/cxx/cxxtest.cpp
r2070 r2074 12 12 * http://sam.zoy.org/wtfpl/COPYING for more details. 13 13 */ 14 15 #include "config.h"16 14 17 15 #include <iostream> … … 42 40 int main(int argc, char *argv[]) 43 41 { 44 Cucul * qq, *pig;45 Caca * kk;42 Cucul *cv, *pig; 43 Caca *dp; 46 44 47 45 int x = 0, y = 0, ix = 1, iy = 1; 48 46 49 47 try { 50 qq= new Cucul();48 cv = new Cucul(); 51 49 } 52 50 catch (int e) { … … 56 54 57 55 try { 58 kk = new Caca(qq);56 dp = new Caca(cv); 59 57 } 60 58 catch(int e) { … … 74 72 } 75 73 76 kk->setDisplayTime(20000);74 dp->setDisplayTime(20000); 77 75 78 while(! kk->getEvent(Event::CACA_EVENT_KEY_PRESS, NULL, 0))76 while(!dp->getEvent(Event::CACA_EVENT_KEY_PRESS, NULL, 0)) 79 77 { 80 78 81 79 /* In case of resize ...*/ 82 if((x + pig->getWidth())-1 >= qq->getWidth() || x < 0 )80 if((x + pig->getWidth())-1 >= cv->getWidth() || x < 0 ) 83 81 x = 0; 84 if((y + pig->getHeight())-1 >= qq->getHeight() || y < 0 )82 if((y + pig->getHeight())-1 >= cv->getHeight() || y < 0 ) 85 83 y = 0; 86 84 87 qq->Clear();85 cv->Clear(); 88 86 89 87 /* Draw pig */ 90 qq->Blit(x, y, pig, NULL);88 cv->Blit(x, y, pig, NULL); 91 89 92 90 /* printf works */ 93 qq->setColorANSI(CUCUL_LIGHTBLUE, CUCUL_BLACK);94 qq->Printf(qq->getWidth() / 2 - 10, qq->getHeight() / 2,95 "Powered by libcaca %s", VERSION);91 cv->setColorANSI(CUCUL_LIGHTBLUE, CUCUL_BLACK); 92 cv->Printf(cv->getWidth() / 2 - 10, cv->getHeight() / 2, 93 "Powered by libcaca %s", dp->getVersion()); 96 94 97 95 /* Blit */ 98 kk->Display();96 dp->Display(); 99 97 100 98 x += ix; 101 99 y += iy; 102 100 103 if(x + pig->getWidth() >= qq->getWidth() || x < 0 )101 if(x + pig->getWidth() >= cv->getWidth() || x < 0 ) 104 102 ix = -ix; 105 if(y + pig->getHeight() >= qq->getHeight() || y < 0 )103 if(y + pig->getHeight() >= cv->getHeight() || y < 0 ) 106 104 iy = -iy; 107 105 108 106 } 109 107 110 delete kk;111 delete qq;108 delete dp; 109 delete cv; 112 110 113 111 return 0;
Note: See TracChangeset
for help on using the changeset viewer.