struct.h 982 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 enum Pattern_Enum Pattern_Enum;
  13. typedef struct Camera Camera;
  14. typedef struct Wall Wall;
  15. typedef struct Line Line;
  16. typedef struct Level Level;
  17. struct Level{
  18. //for the level generation
  19. Pattern_Enum available_patterns[][];
  20. int nb_patterns;
  21. };
  22. //the camera is defined by its center
  23. // ! and not by its upper left corner !
  24. //and an angle
  25. struct Camera{
  26. int cX;
  27. int cY;
  28. int angle;
  29. float speed;
  30. };
  31. //a simple obstacle structure
  32. //d is the distance from the lowest face of the trapeze to the center of the screen
  33. //h is the thickness of the wall
  34. //line indicates the line that contains this obstacle
  35. //id is self explanatory
  36. //nxt is used by the linked list
  37. struct Wall{
  38. float d;
  39. int h;
  40. int id;
  41. int line;
  42. Wall *nxt;
  43. };
  44. #endif