Mail Archives: djgpp/1999/09/16/17:18:54
From: | JAB <jab_joe AT my-deja DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Allegro screen writing.
|
Date: | Thu, 16 Sep 1999 17:55:16 GMT
|
Organization: | Deja.com - Share what you know. Learn what you don't.
|
Lines: | 69
|
Message-ID: | <7rratt$ml7$1@nnrp1.deja.com>
|
NNTP-Posting-Host: | 195.92.194.76
|
X-Article-Creation-Date: | Thu Sep 16 17:55:16 1999 GMT
|
X-Http-User-Agent: | Mozilla/4.0 (compatible; MSIE 5.0; Windows 95)
|
X-Http-Proxy: | 1.1 www-cache.pol.co.uk (NetCache 4.0R1D3), 1.1 x31.deja.com:80 (Squid/1.1.22) for client 62.136.7.220, 195.92.194.76
|
X-MyDeja-Info: | XMYDJUIDjab_joe
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
My program won't run. I don't know what's wrong but it's something to
do with me miss-using allegro. The problem is something
do with the putpixel() bit of code. I think it's to do with the
global "screen" thing.
This is a cut of the relavent (ie screen/allegro) related code from my
void main.
void main(void)
{
BITMAP *bmp = screen;
if (allegro_init()!=0){printf("Allegro load up error\n");return;}
[snip]
/* Set up screen */
set_color_depth(24);
if (set_gfx_mode(GFX_AUTODETECT, VDU_X, VDU_Y, 0, 0) != 0)
{
printf("Error setting video mode\n");
return;
}
[snip]
}
Here is my routine to plot the ready done image (it's in the ToDiplay
array) in main memory to the on screen memory
pixel by pixel.
void display(void)
{
register unsigned int x,y,tempnum;
for(y=0;y<=VDU_Y;y++)
{
for(x=0;x<=VDU_X;x++)
{
putpixel(screen, x, y, ToDisplay[tempnum]); /* This is the line
the debugger points me to */
/* ToDisplay is a 1D array of the screen info to be put on screen
*/
tempnum++;
}
}
}
What is wrong with the putpixel line? Is there something I should have
done with "screen"?
I know the way I'm doing things isn't the best for PC. Writing to
things to a main memory array then plotting directly
to the screen from that. But the program wasn't written for the PC, I
just need to get it running, no matter how crude,
and in a short space of time. Maybe I'll come back to it latter and
change all the lines plotting to ToDisplay, but I've
not got time now.
Thanks for any help.
--
Catch ya later
JAB
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
- Raw text -