Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » One object - one bitmap?

This thread is locked; no one can reply to it. rss feed Print
One object - one bitmap?
FenzaFenz
Member #16,583
October 2016

I'm sorry if this is a stupid question, but are Bitmaps supposed to represent one (game) object, and I should modify them as rarely as possible, working with their coordinates, sizes, ect?

Edgar Reynaldo
Member #8,592
May 2007
avatar

First, try to narrow down what it is you're asking for. What kind of game are you making? What do you need to represent an object in that game? Do you need a sprite (bitmap image), do you need position, dimensions, other attributes, etc...

A bitmap is just an image. You can do whatever you want with it.

FenzaFenz
Member #16,583
October 2016

Well, my exact question would sound like: "Is modifying bitmap (for example, when I use al_set_target_bitmap(bitmap) and add some primitives to it) expensive?"

And is it good practise to nest bitmaps?

Edgar Reynaldo
Member #8,592
May 2007
avatar

Modifying a bitmap is not terribly expensive. You're prematurely optimizing a problem that doesn't exist yet.

What do you want to do with your bitmaps? Just draw on them? Don't worry about it until it becomes a problem. In all likelihood it will never be a problem.

What do you mean 'nest' bitmaps? Use a sub-bitmap? Using a bitmap atlas is a good idea because it allows you to avoid texture switches when drawing a batch of bitmaps using al_hold_bitmap_drawing.

FenzaFenz
Member #16,583
October 2016

Thank you, that fully answers my question :)

Edgar Reynaldo
Member #8,592
May 2007
avatar

Go to: