struct.h 835 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. float acceleration;
  24. };
  25. //a simple obstacle structure
  26. //d is the distance from the lowest face of the trapeze to the center of the screen
  27. //h is the thickness of the wall
  28. //line indicates the line that contains this obstacle
  29. //id is self explanatory
  30. //nxt is used by the linked list
  31. struct Wall{
  32. float d;
  33. int h;
  34. int id;
  35. int line;
  36. Wall *nxt;
  37. };
  38. #endif