2019-12-28 12:16:32 +01:00
|
|
|
#ifndef RENDERER_H
|
|
|
|
#define RENDERER_H
|
|
|
|
|
2020-06-29 15:24:08 +02:00
|
|
|
#include <SDL.h>
|
2019-12-28 12:16:32 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef struct RenImage RenImage;
|
|
|
|
typedef struct RenFont RenFont;
|
|
|
|
|
2020-12-04 16:15:54 +01:00
|
|
|
enum {
|
|
|
|
RenFontAntialiasingMask = 1,
|
|
|
|
RenFontGrayscale = 1,
|
|
|
|
RenFontSubpixel = 0,
|
|
|
|
|
|
|
|
RenFontHintingMask = 3 << 1,
|
|
|
|
RenFontHintingSlight = 0 << 1,
|
|
|
|
RenFontHintingNone = 1 << 1,
|
|
|
|
RenFontHintingFull = 2 << 1,
|
|
|
|
};
|
|
|
|
|
2019-12-28 12:16:32 +01:00
|
|
|
typedef struct { uint8_t b, g, r, a; } RenColor;
|
|
|
|
typedef struct { int x, y, width, height; } RenRect;
|
|
|
|
|
|
|
|
|
|
|
|
void ren_init(SDL_Window *win);
|
|
|
|
void ren_update_rects(RenRect *rects, int count);
|
|
|
|
void ren_set_clip_rect(RenRect rect);
|
|
|
|
void ren_get_size(int *x, int *y);
|
|
|
|
|
|
|
|
RenImage* ren_new_image(int width, int height);
|
|
|
|
void ren_free_image(RenImage *image);
|
|
|
|
|
2020-12-04 16:15:54 +01:00
|
|
|
RenFont* ren_load_font(const char *filename, float size, unsigned int renderer_flags);
|
2019-12-28 12:16:32 +01:00
|
|
|
void ren_free_font(RenFont *font);
|
|
|
|
void ren_set_font_tab_width(RenFont *font, int n);
|
2020-09-05 16:06:12 +02:00
|
|
|
int ren_get_font_tab_width(RenFont *font);
|
2019-12-28 12:16:32 +01:00
|
|
|
int ren_get_font_width(RenFont *font, const char *text);
|
|
|
|
int ren_get_font_height(RenFont *font);
|
|
|
|
|
|
|
|
void ren_draw_rect(RenRect rect, RenColor color);
|
|
|
|
void ren_draw_image(RenImage *image, RenRect *sub, int x, int y, RenColor color);
|
|
|
|
int ren_draw_text(RenFont *font, const char *text, int x, int y, RenColor color);
|
|
|
|
|
|
|
|
#endif
|