Documentation: SDLX - OutOfTheVoid/ProjectRed GitHub Wiki

( Up one level: Root )

Overview

SDLX is the SDL2 eXtension library.

It is a class library designed to provide an easy to use object oriented wrapper to the SDL2 framework, and serves largely as the OS abstraction library for Project Red. This was the first sub-library designed in this project, and has a marginally different design than the rest of the code in this project, but should remain roughly similar in terms of usage. For the most part, this sub-library is finalized, and will only be visited should some change be necessary to add features to the engine as a whole. While it is intended as a support library, it can be used entirely separately from Project Red (under the same license) by simply undefining all dependancy defines such as SDLX_XENON_GL_INTERFACE.

The overall namespace is defined in SDLX/SDLX.h

The define SDLX_XENON_GL_INTERFACE in SDLX.h sets whether SDLX should interface with and depend on Xenon to compile.

several constants are defined in the SDLX namespace, which specify global status codes written by nearly all functions and methods to an uint32_t * Status parameter.

Global status codes:

  • kStatus_Success: Success. The operation was successful and completed without errors.
  • kStatus_SDLInitFailed: Initialization of SDL failed.
  • kStatus_SDLWaitEventFailed: SDL failed to wait on the event loop properly.
  • kStatus_SDLQuit: SDL received a Quit command from the window manager.
  • kStatus_LibInitFailed: An SDL library failed to initialize.
  • kStatus_RegisterEventsFailed: SDLX failed to register an event.

Classes and namespaces within the SDLX namespace:

  • AudioDevice: Represents a single sound device interface to the sound driver. ( Optionally interfaces with Red::Audio :: IAudioOutputDevice)
  • GLContext: represents an OpenGL context which can be bound to the current thread as well as functions to specify requested context properties. ( Optionally interfaces with Xenon::GPU :: IGLContext )
  • Keyboard: Represents the system keyboard
  • Lib: Represents the SDL2 library in general, and contains the event loop logic
  • Mouse: Represents the system mouse
  • Mutex: Represents an SDL2 Mutex
  • RefCounted: Contains refcounting logic
  • Renderer: Represents an SDL2 renderer
  • Surface: Represents an SDL2 surface
  • Texture: Represents an SDL2 texture
  • Timer: Represents an asynchronous event timer
  • UserEvent: Represents the user-event system, allowing for thread-safe queueing of user-defined events
  • Window: Represents an SDL2 Window