home *** CD-ROM | disk | FTP | other *** search
- // gscrtest.cpp
- // test code for Gscreen class
-
-
- #include <conio.h>
-
- #define Gscreen_test
-
- #include "Gscreen.cpp"
-
- const int CURUP =72;
- const int CURDN =80;
- const int CURLF =75;
- const int CURRT =77;
- const int ESCKEY=27;
-
- int main()
- {
- char ch;
-
- Gscreen screen; // will default to 0x13
- const char far *image_ptr = screen.unpackpcx ("walk24.pcx");
- BitMap bmp (image_ptr);
- bmp.set (320, 200, 120, 96, 24, 24, 5, 4);
- screen.setpalette ();
- // screen.display ();
- int dir=0;
- int incx=0, incy=0;
- int scrx=100;
- int scry=150;
- while (ch!=ESCKEY) {
- bmp.display (scrx, scry, 0,dir);
- ch=getch();
- if (ch==0) ch=getch();
- switch (ch) {
- case CURRT: dir=0; incx= 1; incy= 0; break;
- case CURLF: dir=1; incx=-1; incy= 0; break;
- case CURDN: dir=2; incx= 0; incy= 1; break;
- case CURUP: dir=3; incx= 0; incy=-1; break;
- }
- bmp.erase ();
- for (int i=1; i<4; i++) {
- scrx+=incx*4;
- scry+=incy*4;
-
- bmp.display (scrx, scry, i, dir);
- for (long counter=0; counter < 50000L; counter++);
- bmp.erase ();
- }
- }
- }
-