Qbasicnews.com

Full Version: sprite dimentions in c++/allegro
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
im trying to learn c++. I thought the best way of doing that is practice, so im doing all sorts of stupid little progs with allegro. Now because allegro dosnt have a collision routine (does it???) Ive made my own bounding box one. Simple, but it need the heights and widths of the sprites its checking! Ive got my sprites in dat files (from grabber) in different types (compiled, RLE and BITMAP). Is there a way of getting their heights and widths!?
HBITMAP will get you that information I think. msdn is a wonderful thing.... mainly because it's supported by developers and not microsoft directly.
Ninkazu: I doubt you're gonna find stuff about allegro in MSDN.

Citpes: You can look in the h and w attributes. As BITMAPs are pointers, you have to use the -> operator.

Code:
/* This code does the same as draw_sprite */

blit(sprite, buffer, 0, 0, x, y, sprite->w, sprite->h);

If your sprite is called "sprite", then sprite->h returns the height and sprite->w returns the width.

And remember: allegro.html is your friend Big Grin
Hmm... head-scratcher. No matter how hard I tried to find a single topic including the word "allegro" on MSDN, I just *couldn't* find anything. Imagine that. :lol:

But where'd you get the .html file? I've only got stuff in the /docs/txt directory. Everything else is empty.
The complete Allegro installation contains an extensive help and reference document. This is built at the same time as your lib is being built, and it consists in a bunch of html files inside your DOC directory.

You can also take a glance at the online version.
thanx nathan! ill try it when i get the chace. I did actually look at the docs but found nothing, obviously, i didnt look hard enough :oops:
This is a very good tutorial...just wanna learn Allegro...
Okay, some things. You wont find anything on allegro in msdn, simply becuase it's an indie library, it's crossplatform and not microsoft(windows) specific, and it's not popular enough. I bet you wont find SDL or Clanlib in there either.


Another thing, is thatt it's not a tutorial, but a list of all allegro commands, if that's a tutorial than so is qboho

Quote:HBITMAP will get you that information I think. msdn is a wonderful thing.... mainly because it's supported by developers and not microsoft directly.
HBITMAP and allegro's bitmap are not compatible or related, they can however be converted to and fro via allegro's win32 commands.