box.h 485 B

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #include <SDL2/SDL.h>
  5. #include "gfx/shape.h"
  6. #include "gfx/text.h"
  7. typedef struct
  8. {
  9. SDL_Rect rect;
  10. text_t *title;
  11. shape_t spacer_top;
  12. shape_t spacer_bottom;
  13. _Bool is_on; // flag to show either on or off text.
  14. text_t *on_text;
  15. text_t *off_text;
  16. } box_t;
  17. //
  18. box_t *create_box(int x, int y, int w, int h, _Bool is_on, const char *title);
  19. //
  20. void draw_box(box_t *box);
  21. //
  22. void free_box(box_t *box);