![]() |
LibGame
v0.4.0
The LG Game Engine - Copyright (C) 2024-2025 ETMSoftware
|
Functions | |
| int | lg_init_renderer_2d () |
| void | lg_free_renderer_2d () |
| int | lg_render_line_2d (int x1, int y1, int x2, int y2, LG_Color_u color) |
| int | lg_render_rect_2d (Rec2Di r, LG_Color_u color) |
| int | lg_render_tex_2d (const LG_Texture *tex, const Rec2Di *src, const Rec2Di *dest) |
LG_Renderer2D structs and funcs for OpenGL 2D rendering
Originally a replacement for SDL 2D accelerated rendering.
Specifically deal with rendering of 2D lines, 2D rectangles, and 2D textures.
Use specific matrices/shaders.
| int lg_init_renderer_2d | ( | ) |
Initialize the 2D renderer
Call lg_init_line_renderer_2d(), lg_init_rect_renderer_2d() and lg_init_tex_renderer_2d()
| void lg_free_renderer_2d | ( | ) |
Call lg_free_line_renderer_2d(), lg_free_rect_renderer_2d(), and lg_free_tex_renderer_2d()
| int lg_render_line_2d | ( | int | x1, |
| int | y1, | ||
| int | x2, | ||
| int | y2, | ||
| LG_Color_u | color | ||
| ) |
Expect SDL coords sys for input (logical coords, ie inside [0 -> env->top_win_logical_w] x [0 -> env->top_win_logical_h])
| x1 | |
| y1 | |
| x2 | |
| y2 | |
| color | A LG_Color_u |
| int lg_render_rect_2d | ( | Rec2Di | r, |
| LG_Color_u | color | ||
| ) |
Render a filled rect
Expect SDL coords sys for input (logical coords, ie inside [0 -> env->top_win_logical_w] x [0 -> env->top_win_logical_h])
| r | A Rec2Di |
| color | A LG_Color_u |
| int lg_render_tex_2d | ( | const LG_Texture * | tex, |
| const Rec2Di * | src, | ||
| const Rec2Di * | dest | ||
| ) |
Replace: int SDL_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
Expect SDL coords sys for input (logical coords, ie inside [0 -> env->top_win_logical_w] x [0 -> env->top_win_logical_h])
| tex | A LG_Texture |
| src | A Rec2Di |
| dest | A Rec2Di |