Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Box2d & Allegro : Circles and rotating questions

This thread is locked; no one can reply to it. rss feed Print
Box2d & Allegro : Circles and rotating questions
chelneru
Member #15,378
November 2013
avatar

Hi
I want to make a pool game and I choosed Box2D for my physics. The problems I got are:

1. When I make a body in Box2D I draw it using bitmaps in Allegro. My question here is , Can I draw the bodies like primitives ? If not how can I rotate the image ? Also when I draw with bitmaps , I only get boxes because I draw the bitmaps with al_set_target_bitmap() and color it with al_clear_to_color. How can I get circles ? Because I will need mostly circles for my pool balls and holes.

Arthur Kalliokoski
Second in Command
February 2005
avatar

They all watch too much MSNBC... they get ideas.

l j
Member #10,584
January 2009
avatar

chelneru said:

Can I draw the bodies like primitives ?

Yes, see https://www.allegro.cc/manual/5/primitives.html

Quote:

If not how can I rotate the image ? Also when I draw with bitmaps , I only get boxes because I draw the bitmaps with al_set_target_bitmap() and color it with al_clear_to_color. How can I get circles ?

al_load_bitmap to load bitmaps from a file.
You must first initialize the image I/O addon by calling al_init_image_addon before loading any images.
al_draw_rotated_bitmap

You might possibly want to use: https://www.allegro.cc/manual/5/transformations.html

Go to: