struct.h 811 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef STRUCT_H
  2. #define STRUCT_H
  3. //constants
  4. #define PI 3.14159265
  5. #define SIN_60 0.866025404
  6. #define COS_60 0.5
  7. #define true 1
  8. #define false 0
  9. #define bool unsigned char
  10. //macros
  11. #define abs(x) x>0 ? x : -x
  12. typedef struct Camera Camera;
  13. typedef struct Wall Wall;
  14. typedef struct Line Line;
  15. //the camera is defined by its center
  16. // ! and not by its upper left corner !
  17. //and an angle
  18. struct Camera{
  19. int cX;
  20. int cY;
  21. int angle;
  22. float speed;
  23. };
  24. //a simple obstacle structure
  25. //d is the distance from the lowest face of the trapeze to the center of the screen
  26. //h is the thickness of the wall
  27. //line indicates the line that contains this obstacle
  28. //id is self explanatory
  29. //nxt is used by the linked list
  30. struct Wall{
  31. float d;
  32. int h;
  33. int id;
  34. int line;
  35. Wall *nxt;
  36. };
  37. #endif