diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2016-03-30 21:20:07 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2016-03-30 21:20:07 +0200 |
commit | 523f6b460dcf1f864656a9a6ccc2a54d52f385c6 (patch) | |
tree | dd457448a2518ce45ac36ba427c12491f01d7e76 /src/renderer.h | |
parent | 745d5a072d8669d1bc35e7c1f28b75b3484542e8 (diff) |
Split common.h.
Diffstat (limited to 'src/renderer.h')
-rw-r--r-- | src/renderer.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/renderer.h b/src/renderer.h new file mode 100644 index 0000000..0c38e6d --- /dev/null +++ b/src/renderer.h @@ -0,0 +1,62 @@ +#ifndef _RENDERER_H +#define _RENDERER_H + +#include "common.h" +#include "physics.h" + +extern float r_color_white[4]; +extern float r_color_black[4]; +extern float r_color_red[4]; +extern float r_color_blue[4]; + +typedef struct r_window_s r_window; +struct r_window_s { + SDL_Window *window; + SDL_Renderer *renderer; + SDL_Texture *font_texture; + + r_window *prev, *next; +}; + +int r_init(void); +void r_quit(void); + +r_window *r_window_create(void); +void r_window_destroy(r_window *rw); + +void r_clear(r_window *rw, float *color); +void r_flip(r_window *rw); + +void r_clip_enable(r_window *rw, float x, float y, float w, float h); +void r_clip_disable(r_window *rw); +void r_draw_line(r_window *rw, float x0, float y0, float x1, float y1, + float *color); +void r_draw_rect(r_window *rw, float x, float y, float w, float h, + float *color); + +#define TEXT_CENTERX 0x0001 +#define TEXT_RIGHTX 0x0002 +float r_text_width(float h, char *text); +void r_draw_text(r_window *rw, float x, float y, float h, char *text, + float *color, int flags); + +typedef enum { + XSECTION_XY, + XSECTION_XZ, + XSECTION_YZ +} r_xsection_type; + +typedef struct { + SDL_Texture *texture; + float aspect_ratio; +} r_xsection; + +void r_xsection_create(r_xsection *xsection); +void r_xsection_destroy(r_xsection *xsection); +int r_xsection_update(r_window *rw, r_xsection *xsection, + phy_field_info *fi, float *field, + r_xsection_type type, float frac); +void r_xsection_draw(r_window *rw, r_xsection *xsection, + float x, float y, float w, float h); + +#endif // _RENDERER_H |