|
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
Major Reynaldo
May 2007
|
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. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
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
Major Reynaldo
May 2007
|
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. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
FenzaFenz
Member #16,583
October 2016
|
Thank you, that fully answers my question |
Edgar Reynaldo
Major Reynaldo
May 2007
|
That said, al_set_target_bitmap does take a small amount of time to switch the active texture, but you don't need to worry about it until it becomes a problem. It's still a good idea to pre-draw your sprites though, and keep them cached. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|