www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/02/08:27:02

Message-ID: <002901be36b8$087c5180$56f9c6c3@johans-dator>
From: "Johan Henriksson" <johan DOT he AT telia DOT com>
To: <djgpp AT delorie DOT com>
Subject: Re: Extended Stupid Question(with source)
Date: Sun, 3 Jan 1999 02:26:04 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.

------=_NextPart_000_0026_01BE36C0.69913FA0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit


from Johan Henriksson, Sweden    HTTP://come.to/jhewok  |
Primary mail: johan DOT he AT telia DOT com                  #UIN 12035895
Second: jhe75 AT hotmail DOT com    Third: johan_he AT yahoo DOT com
Leadprogrammer and FX-specialist at Real software
http://come.to/real_software
*************************************************************************
-----Original Message-----
From: Mad Cow <sw AT tenforward DOT com>
To: djgpp AT delorie DOT com <djgpp AT delorie DOT com>
Date: Saturday, January 02, 1999 1:45 AM
Subject: Extended Stupid Question(with source)


>okay, here is my code w/poblem:
>
>
>>i earlier reported an error dealing with cwsdpmi*b, well i found it on the
>>net..
>>and now all i get when trying to run my program is :
>>* in windows i get a system fault error and it shuts the dos prompt down.
>>
>>* in dos only mode i get something like this:
>>
>>Shutting Down Allegro
>>Exiting due to SIGSEGV
>>Page Fault at eip00001fe1, error 0004
>>
>>
>>***extended hex address numbers here***
>>and then it goes back to the prompt.
>>
>>
>>so, is it allegro? is it my programming? is it my machine? (i.e. bad
>>sowftware)
>
>
>might be your code. try post it if it isn't too big. I think you should try
>to localize where it halts. put exit(0); in your code. Move it forwards
>until you get the error.
>
>>what? thanks for your time.


Allright, I've overlooked it. You had commented away some important rows.
For an example, you commented away a create_bitmap and neither allegro or
windows likes when you just use clear(bitmap); I send with a (hopefully)
corrected code. I also made it look nicer ;)


>>
>>
>
>
>

------=_NextPart_000_0026_01BE36C0.69913FA0
Content-Type: application/octet-stream;
	name="alien.cc"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="alien.cc"

#include <allegro.h>
#include "tutorial.h"


#define MIN_Y 8
DATAFILE *data;

BITMAP *backdrop,
       *framebuf;
int X=0,Y=100;


int main(void)
 { 
 allegro_init();
 install_keyboard(); 
 initialise_joystick(); 
 
 data=load_datafile("alien.dat");

 set_gfx_mode(GFX_VGA,320,200,0,0); 
 set_palette((RGB*)data[DAT_GAMEPAL].dat);
 
 // create 320x192 backdrop
 backdrop=create_bitmap(320,192);
 for (int Y=0; Y<128; Y++) hline(backdrop,0,Y,319, (Y/2)+128);
 for (int Y=128; Y<192; Y++) hline(backdrop,0,Y,319, ((Y-128)/2)+192);
 
 // create 320x200 double buffer
 framebuf=create_bitmap(320,200);
 clear(framebuf);
 while (!key[KEY_ESC]) 
  {  // build frame
  blit(backdrop,framebuf,0,0,0,MIN_Y,320,200);
  draw_rle_sprite(framebuf,(RLE_SPRITE*)data[DAT_ALIEN].dat,X,Y);
 
  // display frame  
  vsync();  
  blit(framebuf,screen,0,0,0,0,320,200);
  // get user input  
  poll_joystick();  
  if (key[KEY_LEFT]||joy_left) X--;
  if (key[KEY_RIGHT]||joy_right) X++;  
  if (key[KEY_UP]||joy_up) Y--;
  if (key[KEY_DOWN]||joy_down) Y++; 
  } 
 return(0);
 }


------=_NextPart_000_0026_01BE36C0.69913FA0--

- Raw text -


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