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

Message-Id: <199901021358.NAA13406@remus.clara.net>
From: "Arthur" <arfa AT clara DOT net>
To: <djgpp AT delorie DOT com>
Subject: RE: Extended Stupid Question(with source)
Date: Sat, 2 Jan 1999 13:56:48 -0000
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <3.0.6.32.19990101154321.007a0d10@tenforward.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

You have one wierd way of code formatting :-)


>#include <allegro.h>
>#include "tutorial.h"
>
>#define MIN_Y 8
>DATAFILE*data;
>
>BITMAP*backdrop,*framebuf;
>int X=0,Y=100;
>
>int
n(){ 
>allegro_init();
>install_keyboard(); 
>initialise_joystick(); 
> 
> data=load_datafile("alien.dat");
>
>  set_gfx_mode(GFX_VGA,320,200,0,0); 

You should really check to see if the graphics mode initialised OK.

>  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);
OK, it looks like this line needs splitting into two:

// 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;
>  }

James Arthur - jaa AT arfa DOT clara DOT net
http://www.jado.org/users/arfa/
ICQ#15054819


- Raw text -


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