The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2KB

  1. #ifndef AddPair_H
  2. #define AddPair_H
  3. class AddPair : public Test
  4. {
  5. public:
  6. AddPair()
  7. {
  8. m_world->SetGravity(b2Vec2(0.0f,0.0f));
  9. {
  10. b2CircleShape shape;
  11. shape.m_p.SetZero();
  12. shape.m_radius = 0.1f;
  13. float minX = -6.0f;
  14. float maxX = 0.0f;
  15. float minY = 4.0f;
  16. float maxY = 6.0f;
  17. for (int i = 0; i < 400; ++i)
  18. {
  19. b2BodyDef bd;
  20. bd.type = b2_dynamicBody;
  21. bd.position = b2Vec2(RandomFloat(minX,maxX),RandomFloat(minY,maxY));
  22. b2Body* body = m_world->CreateBody(&bd);
  23. body->CreateFixture(&shape, 0.01f);
  24. }
  25. }
  26. {
  27. b2PolygonShape shape;
  28. shape.SetAsBox(1.5f, 1.5f);
  29. b2BodyDef bd;
  30. bd.type = b2_dynamicBody;
  31. bd.position.Set(-40.0f,5.0f);
  32. bd.bullet = true;
  33. b2Body* body = m_world->CreateBody(&bd);
  34. body->CreateFixture(&shape, 1.0f);
  35. body->SetLinearVelocity(b2Vec2(150.0f, 0.0f));
  36. }
  37. }
  38. static Test* Create()
  39. {
  40. return new AddPair;
  41. }
  42. };
  43. #endif