PolyPhysicsScreenEntity.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/Box2D.h"
  14. namespace Polycode {
  15. class _PolyExport PhysicsScreenEntity {
  16. public:
  17. PhysicsScreenEntity(ScreenEntity *entity, b2World *world, float worldScale, int entType, float friction, float density, float restitution, bool isSensor, bool fixedRotation);
  18. ~PhysicsScreenEntity();
  19. ScreenEntity *getScreenEntity();
  20. void applyTorque(float torque);
  21. void applyForce(Vector2 force);
  22. void setTransform(Vector2 pos, float angle);
  23. void Update();
  24. static const int ENTITY_RECT = 1;
  25. static const int ENTITY_CIRCLE = 2;
  26. static const int ENTITY_STATICRECT = 3;
  27. b2Fixture *fixture;
  28. b2Body* body;
  29. b2BodyDef *bodyDef;
  30. b2Shape *shape;
  31. bool collisionOnly;
  32. protected:
  33. float worldScale;
  34. Vector2 lastPosition;
  35. float lastRotation;
  36. ScreenEntity *screenEntity;
  37. };
  38. }