Mail Archives: djgpp/1998/11/24/08:21:51
From: | "Jan Willem Penterman" <jw AT rel DOT nl>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: see-trough & sprites
|
Date: | Tue, 24 Nov 1998 14:17:06 +0100
|
Organization: | A2000 Kabeltelevisie & Telecommunicatie
|
Lines: | 37
|
Message-ID: | <73eblh$44e$1@pascal.a2000.nl>
|
References: | <000201be13d4$675a05a0$b2f5ffc2 AT default>
|
NNTP-Posting-Host: | node08f5.a2000.nl
|
X-Newsreader: | Microsoft Outlook Express 5.00.0518.4
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.0518.4
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hey Lazer,
Hmm i dunno what you mean with better exactly, but i suppose
this code results in a flickering image on the screen. You'd better
use a backbuffer ( a "virtual" screen in your system memory) to
draw all sprites you have on, and then copy the whoole buffer- image at once
to the screen. An alternative is page-flipping, check the allegro examples
out, they're full of useful code.
Backbuffer example:
BITMAP *backBuffer = create_bitmap(SCREEN_W,SCREEN_H);
while(!key[KEY_ESC])
{
clear(backBuffer);
Q=Q+1;
draw_sprite(backBuffer, my_image, Q, 200-my_image->h);
// you draw all your other sprites and stuff here
// when your finished drawing:
blit(backBuffer, screen, 0 , 0, 0, 0, SCREEN_W, SCREEN_H);
}
As for transparant colours...well it might be possible in 8-bit resolution
but that probbably will look like shit, there's a 16-bit color example in
ex30
or ex31 ( i forgot...) in the allegro library... but I wouldn't recommend
that
coz of speed issue's :o)
Greetz, Jan Willem
- Raw text -