PickUp.cpp 865 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "PickUp.h"
  2. PickUp::PickUp()
  3. {
  4. //ctor
  5. }
  6. PickUp::~PickUp()
  7. {
  8. //dtor
  9. }
  10. void PickUp::init( b2World &world, float x, float y, float angle )
  11. {
  12. // Images
  13. if ( m_imgCar == nullptr )
  14. {
  15. m_imgCar = SDL_LoadBMP("Textures/PickUp.bmp");
  16. SDL_SetColorKey( m_imgCar, SDL_SRCCOLORKEY, SDL_MapRGBA( m_imgCar->format, 0, 0, 0, 255 ) );
  17. }
  18. if ( m_imgWheel == nullptr )
  19. {
  20. m_imgWheel = SDL_LoadBMP("Textures/PickUpWheel.bmp");
  21. SDL_SetColorKey( m_imgWheel, SDL_SRCCOLORKEY, SDL_MapRGBA( m_imgWheel->format, 0, 0, 0, 255 ) );
  22. }
  23. // Propre !
  24. destroy( world );
  25. // Eléments
  26. createCarenage( world, x, y );
  27. b2Vec2 rel ;
  28. rel.Set( -0.3f, 0.25f );
  29. createMotorWheel( world, rel );
  30. rel.Set( 0.25f, 0.25f );
  31. createFreeWheel( world, rel );
  32. // Fin
  33. return ;
  34. }