renderer.h 960 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef RENDERER_H
  2. #define RENDERER_H
  3. #include <SDL2/SDL.h>
  4. #include <stdint.h>
  5. typedef struct RenImage RenImage;
  6. typedef struct RenFont RenFont;
  7. typedef struct { uint8_t b, g, r, a; } RenColor;
  8. typedef struct { int x, y, width, height; } RenRect;
  9. void ren_init(SDL_Window *win);
  10. void ren_update_rects(RenRect *rects, int count);
  11. void ren_set_clip_rect(RenRect rect);
  12. void ren_get_size(int *x, int *y);
  13. RenImage* ren_new_image(int width, int height);
  14. void ren_free_image(RenImage *image);
  15. RenFont* ren_load_font(const char *filename, float size);
  16. void ren_free_font(RenFont *font);
  17. void ren_set_font_tab_width(RenFont *font, int n);
  18. int ren_get_font_width(RenFont *font, const char *text);
  19. int ren_get_font_height(RenFont *font);
  20. void ren_draw_rect(RenRect rect, RenColor color);
  21. void ren_draw_image(RenImage *image, RenRect *sub, int x, int y, RenColor color);
  22. int ren_draw_text(RenFont *font, const char *text, int x, int y, RenColor color);
  23. #endif