Menu

LazSDL2 package

Imants

LazSDL2.lpk is a basic package which consists of all objects that load all methods from the SDL2 library.

Standard units to use in yours code are:
SDL.Api.libSDL2 - unit, which contains the TSDL2Library class which in turn references the rest of the necessary library methods
SDL.Api.Types - unit contains all types used by my SDL2 library.

Standard code to load the library is:

var
  SDL2: TSDL2Library;
begin
  SDL2 := TSDL2Library.Create(); // Create library instance
  try
    SDL2.Init(); // Load all methods from dll

    // Check if all is OK and all methods have loaded.
    if not SDL2.Valid then
      ShowMessage(SDL2.LastError); // If something went wrong then show what went wrong

    //Init all subsystems
    SDL2.SDL_Init(SDL_INIT_EVERYTHING);
    try

    finally
      //Free all subsystems
      SDL2.SDL_Quit()
    end
  finally
    SDL2.Free
  end
end; 

p. With this you will load the library from the default location using the default name.
If you want to load SDL2 library from a different location use @TSDL2Library.Create('/path/to/sdl2/library')@

Other examples:
* Creating an SDL window
* Initializing video driver for SDL video subsystem


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.