allegroflare / allegro_flare

Application toolkit for Allegro 5
https://clubcatt.com/allegroflare
MIT License
35 stars 6 forks source link

Implement "collide" in Placement2D #185

Closed MarkOates closed 2 years ago

MarkOates commented 2 years ago

Currently collide uses basic collision that doesn't take into account scale, rotation, etc.

See Elias's code in this thread on how to implement: https://www.allegro.cc/forums/thread/616647/1027133#target. Though note that transform_coordinates composes a complete transform at each step, so it may be more optimal to create a transform_coordinates that takes multiple coordinates and transforms them in a batch.

Also, note that the implementation should be added in AllegroFlare/Placement2D, and not the old allegro_flare/placement2d (which is depreciated and will be removed in this migration).

MarkOates commented 2 years ago

Finished! 🎉🍷

This feature was added today throughout the following commits https://github.com/allegroflare/allegro_flare/compare/b8ec3190b9ac960a9cbe5acb18017ebdd79c350d..1058f840014c7db57ffe727a8b555ed1af0bae53.

(Note that the Color class was added as well during that process.)

There's an interactive test TEST_F(AllegroFlare_Placement2DWithAllegroRenderingFixtureTest, DISABLED__collides__will_return_true_if_the_placement_collides_with_another_placement) that was used to develop the feature, and the test has now been disabled. To try testing it out, remove DISABLED__ from the test and run the suite.