Mail Archives: djgpp/1997/04/08/11:40:59
>Could someone please tell me how I could get this to open notecard.pcx
and
>display it (centered) on the mode 13h screen?
>
>Thanks in advance,
>Paul Schmidt
>ADM Computer Services
>admcs AT megsinet DOT net
Well, I made a program to test out some Allegro functions, and the first
thing it does is centers a large bitmap on the screen. Here's some of the
code: (note: h and v are defined to be 320 and 240 [the size of the video
mode I default to] respectively, unless the user passes different values
for the screen mode, in which case they are given those values, provided
the program didn't already exit due to an invalid mode. Also, the code
should be able to adapt itself to any size bitmap and screen)
<snipped some code here>
scott = load_bmp("scott.bmp",q);
printf("SCOTT.BMP loaded, width: %i height: %i\n", scott->w,
scott->h);
printf("Press a key to begin...\n");
readkey();
<snipped some code here>
set_palette(q);
fade_out(64); /* set palette to bitmap and immediately blank out to
avoid garbage flicker */
x=((h)-(scott->w))/2;
y=((v)-(scott->h))/2;
blit(scott, screen, 0, 0, x, y, scott->w, scott->h);
fade_in(q,1);
clear_keybuf();
readkey();
<snipped some code here>
Ben Shadwick, Sysop, Mars Base BBS (360)882-0773, Vancouver, WA, USA
email: bshadwick AT juno DOT com
I am now telling the computer EXACTLY what it can do with a lifetime
supply of chocolate!!!
- Raw text -