#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); #define XSECTION_XY 0x0001 #define XSECTION_XZ 0x0002 #define XSECTION_YZ 0x0004 #define XSECTION_PLANES (XSECTION_XY|XSECTION_XZ|XSECTION_YZ) #define XSECTION_E 0x0008 #define XSECTION_H 0x0010 #define XSECTION_EPS 0x0020 #define XSECTION_FIELDS (XSECTION_E|XSECTION_H|XSECTION_EPS) typedef struct { SDL_Texture *texture; float aspect_ratio; int last_flags; float last_frac; int64_t frame_index; } 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_sim *sim, int flags, float frac); void r_xsection_draw(r_window *rw, r_xsection *xsection, float x, float y, float w, float h); #endif // _RENDERER_H