pique.c 621 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "pique.h"
  2. #include "dynar.h"
  3. #include "thing.h"
  4. /* PIQue is a Physical Information Queue where the area stores
  5. * information and events regarding the objects it manages, such as collisions,
  6. * combat strikes, button touches, etc.
  7. */
  8. enum PeventType_ {
  9. PEVENT_WALK_ON,
  10. PEVENT_BUMP_INTO,
  11. PEVENT_ATTACK_HIT,
  12. PEVENT_ATTACK,
  13. };
  14. struct Pevent_ {
  15. int kind;
  16. Thing * thing_a;
  17. Thing * thing_b;
  18. float x, y;
  19. float w, h;
  20. int z;
  21. };
  22. struct Pique_ {
  23. Dynar * events; /* Used as a circular array buffer, should be faster than a linked list. */
  24. int top;
  25. int bottom;
  26. };