PolyPhysicsScreenEntity.h 962 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * PolyPhysicsScreenEntity.h
  3. * Poly
  4. *
  5. * Created by Ivan Safrin on 5/8/08.
  6. * Copyright 2008 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. // @package ScreenPhysics
  10. #pragma once
  11. #include "PolyGlobals.h"
  12. #include "PolyScreenEntity.h"
  13. #include "Box2D.h"
  14. namespace Polycode {
  15. class _PolyExport PhysicsScreenEntity {
  16. public:
  17. PhysicsScreenEntity(ScreenEntity *entity, b2World *world, int entType, float friction, float density, float restitution, bool isSensor);
  18. ~PhysicsScreenEntity();
  19. ScreenEntity *getScreenEntity();
  20. void applyTorque(float torque);
  21. void applyForce(Vector2 force);
  22. void Update();
  23. static const int ENTITY_RECT = 1;
  24. static const int ENTITY_CIRCLE = 2;
  25. static const int ENTITY_STATICRECT = 3;
  26. b2Body* body;
  27. b2BodyDef *bodyDef;
  28. b2Shape *shape;
  29. bool collisionOnly;
  30. protected:
  31. Vector2 lastPosition;
  32. float lastRotation;
  33. ScreenEntity *screenEntity;
  34. };
  35. }