struct.h 793 B

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