Rendering


A main part of SDL is rendering.
LEXSDL abstracts many things away like loading textures and handles them, the SDL_Renderer is stored internally so there is no need to carry it around.
Drawing a loaded texture is as easy to call LEXSDL_DrawTextureAt(2, 50,120, 75,75);
Below are listed the functions and how to use them.


Renderer

The SDL_Renderer is stored internally so that there is no need to handle it directly but since not all SDL functions are wrapped it can be accesed directly by the LEXSDL_GetRenderer() function to get a direct pointer to the renderer being used.

Functions


Textures

Loading and rendering of textures made easier.
WARNING : Its not checked if the texture is valid at drawing which could cause segfaults and or undefined behavior.

Types

Constants

Functions


Sprites

Doesn't store a texture, a texture needs to be loaded separately and set the id at creation or after the fact.
Sprites have 2 playing modes, Steeped and Timed.

- Timed :
Plays at the set fps: if the sprite fps is set to 15 and display is rendering at 75fps it will show a different frame every 5fps or 13.333.. milliseconds.
Will skip frames that should occur during a lag spike.
a sprite set to 20 fps will update and change the frame 20 times a second, hence FPS (Frames Per Second).

- Steeped :
Advances one frame every time LEXSDL_SpritePlay() is called.

Check LEXSDL_CreateSprite().

WARNING : Its not checked if the texture is valid at drawing/playing which could cause segfaults and or undefined behavior.
The frame shown can be manipulated with LEXSDL_SpriteSetFrame() to start from a desired frame.
For having the same sprite being drawn multiple times check LEXSDL_SpriteClone();
The sprite is updated only if a Play function is called or by calling LEXSDL_SpriteUpdate() or LEXSDL_SpriteStep() manually.
The LEXSDL_Sprite struct is not accesible directly since it could cause hard to find bugs.

Functions