www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/11/05:06:18

From: qballlives AT aol DOT com (QBallLives)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: screen centering
Lines: 24
Message-ID: <1998051108051300.EAA19733@ladder03.news.aol.com>
NNTP-Posting-Host: ladder03.news.aol.com
Date: 11 May 1998 08:05:13 GMT
Organization: AOL http://www.aol.com
References: <355625DB DOT 63D61E7E AT aditfree DOT com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>
>is there any way to center the screen in allegro? For example if my
>program was eunning in 320*240 and went up to 640*400 the screen would
>be up in the top left, any way to have it always centered in the middle?
>
>
>

In the example programs that come with Allegro, there are examples of this kind
of positioning....

let's say you had a 320x240 image, and you wanted in centered in 640x480
mode....

upper_left_corner_x=( screen->w - the_image->w) / 2;
upper_left_corner_y=( screen->h - the_image->h) / 2;

and then you'd just blit it...


Jim the loiterer
aloiterer AT juno DOT com
http://members.xoom.com/JimMcCue/index.htm
(Jim the loiterer's PC games, programming, & stuff...)

- Raw text -


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