shape.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #include <stdint.h>
  2. #include <stdbool.h>
  3. #include "gfx/SDL_easy.h"
  4. #include "gfx/shape.h"
  5. shape_t create_shape(uint8_t colour, int x, int y, int w, int h, bool filled)
  6. {
  7. shape_t shape;
  8. shape.info.rect.x = x;
  9. shape.info.rect.y = y;
  10. shape.info.rect.w = w;
  11. shape.info.rect.h = h;
  12. shape.info.colour = colour;
  13. shape.info.filled = filled;
  14. return shape;
  15. }
  16. void draw_shape(shape_t *shape)
  17. {
  18. SDL_DrawShape(shape->info.colour, shape->info.rect.x, shape->info.rect.y, shape->info.rect.w, shape->info.rect.h, shape->info.filled);
  19. }
  20. void draw_shape_position(shape_t *shape, int x, int y)
  21. {
  22. SDL_DrawShape(shape->info.colour, x, y, shape->info.rect.w, shape->info.rect.h, shape->info.filled);
  23. }
  24. void draw_shape_scale(shape_t *shape, int w, int h)
  25. {
  26. SDL_DrawShape(shape->info.colour, shape->info.rect.x, shape->info.rect.y, w, h, shape->info.filled);
  27. }
  28. void draw_shape_resize(shape_t *shape, int x, int y, int w, int h)
  29. {
  30. SDL_DrawShape(shape->info.colour, x, y, w, h, shape->info.filled);
  31. }
  32. void set_shape(shape_t *shape, uint8_t colour, int x, int y, int w, int h, bool filled)
  33. {
  34. shape->info.rect.x = x;
  35. shape->info.rect.y = y;
  36. shape->info.rect.w = w;
  37. shape->info.rect.h = h;
  38. shape->info.colour = colour;
  39. shape->info.filled = filled;
  40. }
  41. //void draw_shapes()
  42. void add_shape_entry(shapes_t **shapes, shape_t new)
  43. {}
  44. void delete_shape_entry()
  45. {}
  46. void free_shapes()
  47. {}