blocks.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #include "blocks.h"
  2. #include <stdlib.h>
  3. #include <math.h>
  4. Block get_house() {
  5. Line* house = (Line*)malloc(sizeof(Line) * HOUSE_LINE_CO);
  6. // Outline
  7. house[0].a.x = -10;
  8. house[0].a.y = 30;
  9. house[0].b.x = 10;
  10. house[0].b.y = 30;
  11. house[1].a.x = 10;
  12. house[1].a.y = 30;
  13. house[1].b.x = 10;
  14. house[1].b.y = 0;
  15. house[2].a.x = 10;
  16. house[2].a.y = 0;
  17. house[2].b.x = -10;
  18. house[2].b.y = 0;
  19. house[3].a.x = -10;
  20. house[3].a.y = 0;
  21. house[3].b.x = -10;
  22. house[3].b.y = 30;
  23. // Windows
  24. house[4].a.x = -10;
  25. house[4].a.y = 10;
  26. house[4].b.x = 10;
  27. house[4].b.y = 10;
  28. house[5].a.x = -10;
  29. house[5].a.y = 20;
  30. house[5].b.x = 10;
  31. house[5].b.y = 20;
  32. house[6].a.x = -2;
  33. house[6].a.y = 10;
  34. house[6].b.x = -2;
  35. house[6].b.y = 20;
  36. house[7].a.x = 2;
  37. house[7].a.y = 10;
  38. house[7].b.x = 2;
  39. house[7].b.y = 20;
  40. house[8].a.x = -6;
  41. house[8].a.y = 10;
  42. house[8].b.x = -6;
  43. house[8].b.y = 20;
  44. house[9].a.x = -6;
  45. house[9].a.y = 15;
  46. house[9].b.x = -2;
  47. house[9].b.y = 15;
  48. house[10].a.x = 6;
  49. house[10].a.y = 10;
  50. house[10].b.x = 6;
  51. house[10].b.y = 20;
  52. house[10].a.x = 2;
  53. house[10].a.y = 15;
  54. house[10].b.x = 10;
  55. house[10].b.y = 15;
  56. Block b = {HOUSE_LINE_CO, house};
  57. return b;
  58. }
  59. Block get_crane() {
  60. Line* crane = (Line*)malloc(sizeof(Line) * CRANE_LINE_CO);
  61. // Crane rope
  62. crane[0].a.x = 0;
  63. crane[0].a.y = 0;
  64. crane[0].b.x = 0;
  65. crane[0].b.y = 15;
  66. Block b = {CRANE_LINE_CO, crane};
  67. return b;
  68. }
  69. Block get_ground() {
  70. Line* ground = (Line*)malloc(sizeof(Line) * GROUND_LINE_CO);
  71. // Ground
  72. ground[0].a.x = -32;
  73. ground[0].a.y = 0;
  74. ground[0].b.x = 32;
  75. ground[0].b.y = 0;
  76. Block b = {GROUND_LINE_CO, ground};
  77. return b;
  78. }