delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/18/19:21:20

From: David Jenkins <me AT jenkinsdavid DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro: double buffering
Date: Sat, 16 Aug 1997 03:31:16 +0100
Organization: None
Distribution: world
Message-ID: <+5Zw3GA0DR9zEwo1@jenkinsdavid.demon.co.uk>
References: <01bca9b1$8b2e3ca0$734747c3 AT 486>
NNTP-Posting-Host: jenkinsdavid.demon.co.uk
MIME-Version: 1.0
Lines: 52
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <01bca9b1$8b2e3ca0$734747c3 AT 486>, Ingo Ruhnke <ruhnke AT owl-
online.de> writes
>I try to do a double buffered screen output. My problem is that I
>must have the screen 2. extern (the 1. screen is the normal screen),
>but this didn't work. I tried something like this:
>
>======================================
>extern BITMAP *screen_buf;
>
>void main()
>{
> BITMAP *screen_buf;
> screen_buf = create_bitmap(320, 200);
> put();
>}
>
>
>void put()
>{
> BITMAP *screen_buf;
> putpixel (screen_buf, 160, 100, 15);
>}
>=======================================
>
>But if I call put() the programm crashes. 
>It would be great if anyone could help.
>
>Thanks.

You are using set_gfx_mode() + allegro_init() somewhere, aren't you.
I'd do it like this,

Why do you need the extern???
BITMAP *buffer;


int main(){
allegro_init();
set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);
buffer = create_bitmap(320,200)
put();
return 0;
}

void put(){
_putpixel(buffer, 160, 100, 15);
}

-- 
http://www.jenkinsdavid.demon.co.uk for C programmers.
David Jenkins

- Raw text -


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