1.5 KiB
xSDL
package: xSDL
language: c++
version: 0.1.0
author: xdrm-brackets
xSDL is a simple 2D wrapper around the SDL2 to make your life easier.
Documentation
The API aims to be straightforward as possible and tries to take advantage of patterns and principles to achieve its goal.
xSDL can be compiled as a dynamic library (e.g. lib.so). The include header is located in include/xSDL.h. It can also be compiled directly within your application.
The class xApplication
is a singleton representing your application, its window, renderer, etc. An xApplication
features a xController
that manages user input.
The interface xElement
represents any graphical feature to be drawn on the screen. Any number of xElement
can be pushed to or pulled from the application at any time in order to show them or not.
The class xSprite
represents a sprite that can is a rectangle that can draw either as a single color, an image, or a copy of another sprite. It can be moved over time. Also, it allows you to set a custom clip if this is an image sprite.
The class xSpriteAnimation
derives from an image sprite, which clip can change over time. These clips are called frames and have to be set beforehand, when ready you can start or stop the animation with a specified delay between frames. Every xSpriteAnimation
is scheduled on the same dedicated animation thread.
The concurrency model is led simple :
- the main loop schedules rendering and user input
- the animation loop schedules animation frame shifts