delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/01/16:50:36

From: Barry Rodewald <bsr AT hn DOT pl DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro Newbie (sprites/tiles)
Date: Sun, 02 Nov 1997 00:22:23 +1300
Lines: 55
Message-ID: <345B10EF.271A@hn.pl.net>
References: <345AD7C5 DOT 3628D59A AT csun DOT edu>
NNTP-Posting-Host: bsr.hn.planet.gen.nz
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ryan Bright wrote:
> 
>     I have sprite (and tile) files in raw data format (1028 bytes) and
> I've spent a couple of days trying to figure out how to load them and
> display them with Allegro but to no avail.  What's the preferred
> method?  I was planning on using RLE_SPRITE, but how would I go about
> loading them off the HD into the data structure?  And then,
>
Grabber will accept any bitmap file (the Windows or OS/2 kind), so if
you can, convert it from a raw file to a BMP file.  I think Paint Shop
Pro can do this, I am not exactly sure.  First, you can create a new
datafile.  To be able to save the datafile, you must first enter a
filename by moving the mouse pointer to "Editing" (just below the
menus).  A cursor appears there and you can type the filename to save
the datafile as.  You may also enter a header which is a header file
(*.h) than can be included into your code.  Read Allegro.txt for more
details.

To add an object, go to the object menu, and select new.  Select the
type of object you want and give it a name (these are saved in your
header file as well as the datafile for easier reference).  For a
sprite, you must first read a bitmap into memory.  Go to the File menu,
and select a BMP file.  The bitmap will be displayed on screen first. 
Change the X Grid and Y Grid to the size of the bitmap.  This defines
the size of what will be grabbed.  Go to the Object menu and select
Grab.  If X Grid and Y Grid are smaller than the bitmap, a rectangle
will appear,  and select the part of the bitmap to grab as a sprite.
 
>   If I use RLE sprites, then I don't see any "blit" equivalent.  So what
> do I do with the tiles in which I don't want to use masking (skip 0)?
> Do I have to use a BITMAP and waste all that space?
>
The blit() function does not skip zero pixels.  You should use
draw_sprite() for bitmaps, or draw_rle_sprite() for RLE sprites.  These
functions skip zero pixels.
Note that there is less functionality for RLE sprites, like there are no
flipping functions.

>   Continuation of first Q : I'd love to use the included "grabber"
> software to store all these RLE sprites into a single data file, but I
> don't quite see how to load them in.. it only accepts .dat files.   
And
> if I create a "new..." object then, once again, how do I load in my raw
> data sprites?...and convert to run-length?  tia
Use Read Bitmap in the file menu then Grab from the Object menu.

> btw, when I say newbie, I mean I heard about djgpp and allegro for the
> first time 3 days ago, so detailed answers would be _MUCH_
> appreciated... thanks

You're welcome.
Read allegro.txt and grabber.txt for more details.

Hope this helps,
Barry Rodewald.

- Raw text -


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