www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/16/01:33:02

From: thomasl AT glink DOT net DOT hk (Thomas Lai)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro: double buffering
Date: 16 Aug 1997 03:14:11 GMT
Organization: Global Link Information Services Ltd.
Lines: 50
Message-ID: <5t35u3$aip$1@unix2.glink.net.hk>
References: <01bca9b1$8b2e3ca0$734747c3 AT 486>
NNTP-Posting-Host: earth.glink.net.hk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ingo Ruhnke (ruhnke AT owl-online DOT de) wrote:
: ======================================
: 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.
	As screen_buf in put() is a Local Non-initialized pointer,
any access pointed by screen_buf is undefined....
	Please try this:
=========================================
void put(BITMAP *screen_buf);

int main()
{
  BITMAP *screen_buf;
  screen_buf=create_bitmap(320,200);
  put(screen);
}

void put(BITMAP *screen_buf)
{
  putpixel(screen_buf, 160, 100, 15);
}
===============================================

	or declare screen_buf as Global varible.


	Hope this helps.


--
Yours,
Thomas Lai

- Raw text -


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