Table of Contents | ||||||
|
||||||
TestBatchCollision | ||||||
Purpose Compares a bunch of sprites at once |
||||||
Protoype hit_test CSpriteMngr::TestBatchCollision (batch bc_group1, batch bc_group2, int i_flag) |
||||||
Parameters
|
||||||
Description This function tests a bunch of sprites against each other in one of two ways. The first way uses the flag TEST_PARALLEL and compares each sprite object to the same object in the other batch. So the first sprite object in batch1 would be compared to the first object in batch2, the second in batch1 to the second in batch2, etc. The second compare method is much more processor-intensive as it compares each object in batch1 to each object in batch2. This compare uses the flag TEST_CROSS. The function then returns a list of the boolean test values. Depending on the test method, you will have to sort through the results in a different manner. For TEST_PARALLEL you can iterate straight through the list but for TEST_CROSS you will have to use nested for loops to extract the proper values.
|
||||||
Use CSpriteMngr sprite; // build batch1 batch bc_group1; bc_group1.push_back("my_sprite1"); bc_group1.push_back("my_sprite2"); bc_group1.push_back("my_sprite3"); // build batch2 batch bc_group2; bc_group2.push_back("my_sprite1"); bc_group2.push_back("my_sprite2"); bc_group2.push_back("my_sprite3"); // compare them hit_test ht_results = sprite.TestBatchCollision(bc_group1, bc_group2, TEST_PARALLEL); |
||||||
|
||||||
|