delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/08/11:40:59

To: djgpp AT delorie DOT com, admcs AT megsinet DOT net
Date: Tue, 8 Apr 1997 08:26:30 -0700
Subject: Re: Can't get this to work (Allegro)
Message-ID: <19970408.082634.11982.0.bshadwick@juno.com>
From: bshadwick AT juno DOT com (Ben N Shadwick)

>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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019