collision_hit.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // SuperTux
  2. // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #ifndef HEADER_SUPERTUX_COLLISION_COLLISION_HIT_HPP
  17. #define HEADER_SUPERTUX_COLLISION_COLLISION_HIT_HPP
  18. #include "math/vector.hpp"
  19. /**
  20. * Used as return value for the collision functions, to indicate how the
  21. * collision should be handled
  22. */
  23. enum HitResponse
  24. {
  25. // Dynamic collision responses
  26. /// Call collision() but do no collision handling
  27. ABORT_MOVE = 0,
  28. /// move object out of collision and check for collisions again
  29. /// if this happens too often then the move will just be aborted
  30. /// (normal physics)
  31. CONTINUE,
  32. /// Treat object as kinematic, with infinite inertia/mass
  33. /// pushing other (CONTINUE) objects out of the way
  34. FORCE_MOVE
  35. };
  36. /**
  37. * This class collects data about a collision
  38. */
  39. class CollisionHit final
  40. {
  41. public:
  42. CollisionHit() :
  43. left(false),
  44. right(false),
  45. top(false),
  46. bottom(false),
  47. crush(false),
  48. slope_normal(0.0f, 0.0f)
  49. {}
  50. bool left, right;
  51. bool top, bottom;
  52. bool crush;
  53. Vector slope_normal;
  54. };
  55. #endif
  56. /* EOF */