Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Width of a bitmap

This thread is locked; no one can reply to it. rss feed Print
Width of a bitmap
Albin Engström
Member #8,110
December 2006
avatar

How do i get the width of a bitmap?

is there a handy function for this in allegro or do i have to make one myself?

X-G
Member #856
December 2000
avatar

... BITMAP *b; b->w

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

CGamesPlay
Member #2,559
July 2002
avatar

BITMAPClick it.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Albin Engström
Member #8,110
December 2006
avatar

Thanks ;D,
oh, missed that part of the manual.. will look harder next time.

but what should i do if the bitmap is in a datafile?
(BITMAP*)datafiles::sprites_enemies[1].dat->w
doesn't work :/

23yrold3yrold
Member #1,134
March 2001
avatar

Needs more brackets on that one IIRC.
(BITMAP*)(sprites_enemies[1].dat)->w
Something like that; I forget exactly.

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

CGamesPlay
Member #2,559
July 2002
avatar

The dat member is a void*, so it doesn't have a w member. However, the void* is really a BITMAP, so we cast it: (BITMAP*) datafiles::sprites_enemies[1].dat. From there, we take the w member: ((BITMAP*) datafiles::sprites_enemies[1].dat)->w. This is the order of operations, and it is said that the -> binds "tighter" than the (BITMAP*), so we have to use parentheses to switch the order.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Albin Engström
Member #8,110
December 2006
avatar

still doesn't work :( "`void*' is not a pointer-to-object type "

CGamesPlay
Member #2,559
July 2002
avatar

My post has the right way to do it...

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Albin Engström
Member #8,110
December 2006
avatar

totally sweet 8-). thanks!

Go to: