SDL3 for Dart

Requirement

  • ffi ^2.1.3

This library is limited to 64bit.
Since ffi is used, a dynamic library suitable for various environments is required.
image, mixer, net, and ttf are optional. Please include it if necessary.
Since sdl3gfx is included in the source, a dynamic library is not required.

import 'package:sdl3/sdl3.dart'; // SDL3, SDL3_image, SDL3_mixer, SDL3_net, SDL3_ttf
import 'package:sdl3/sdl3gfx.dart'; // SDL3_gfx

Windows requires dll files.

SDL3.dll
SDL3_image.dll
SDL3_mixer.dll
SDL3_net.dll
SDL3_ttf.dll

Linux (or Android, Fuchsia) requires so files.

libSDL3.so
libSDL3_image.so
libSDL3_mixer.so
libSDL3_net.so
libSDL3_ttf.so

MacOS (or iOS) requires dylib files.

libSDL3.dylib
libSDL3_image.dylib
libSDL3_mixer.dylib
libSDL3_net.dylib
libSDL3_ttf.dylib

And more.

If you want to add a library under special circumstances (example: dylib), do the following:

SdlDynamicLibraryService().add('SDL3', DynamicLibrary.open('YOUR_SDL3_ENVIONMENT.dylib'));
SdlDynamicLibraryService().add('SDL3_image', DynamicLibrary.open('YOUR_SDL3_image_ENVIONMENT.dylib'));
SdlDynamicLibraryService().add('SDL3_mixer', DynamicLibrary.open('YOUR_SDL3_mixer_ENVIONMENT.dylib'));
SdlDynamicLibraryService().add('SDL3_net', DynamicLibrary.open('YOUR_SDL3_net_ENVIONMENT.dylib'));
SdlDynamicLibraryService().add('SDL3_ttf', DynamicLibrary.open('YOUR_SDL3_ttf_ENVIONMENT.dylib'));
if (sdlInit(SDL_INIT_VIDEO)) {
  // success
}

Note

A Dart library for accessing SDL 3 APIs using, FFI.

https://www.libsdl.org/

Windows 64bit & Linux (Tested under Windows 10 WSL2 environment)

Currently, we are providing it on an experimental basis using the dll compiled below.

https://github.com/sansuido/msbuild-sdl3

Author

yamahara

Libraries

sdl3
sdl3/dylib
sdl3/ex/dart/native_type
sdl3/ex/dart/point
sdl3/ex/dart/rectangle
sdl3/ex/image/img_animation
sdl3/ex/mixer/mix_chunk
sdl3/ex/mixer/mix_music
sdl3/ex/sdl/sdl_audio_stream
sdl3/ex/sdl/sdl_color
sdl3/ex/sdl/sdl_cursor
sdl3/ex/sdl/sdl_event
sdl3/ex/sdl/sdl_gamepad
sdl3/ex/sdl/sdl_point
sdl3/ex/sdl/sdl_rect
sdl3/ex/sdl/sdl_renderer
sdl3/ex/sdl/sdl_renderer_from_gfx
sdl3/ex/sdl/sdl_renderer_from_image
sdl3/ex/sdl/sdl_surface
sdl3/ex/sdl/sdl_texture
sdl3/ex/sdl/sdl_window
sdl3/ex/ttf/ttf_font
sdl3/generated/const_sdl
sdl3/generated/const_sdl_image
sdl3/generated/const_sdl_mixer
sdl3/generated/const_sdl_net
sdl3/generated/const_sdl_ttf
sdl3/generated/lib_sdl
sdl3/generated/lib_sdl_assert
sdl3/generated/lib_sdl_asyncio
sdl3/generated/lib_sdl_atomic
sdl3/generated/lib_sdl_audio
sdl3/generated/lib_sdl_blendmode
sdl3/generated/lib_sdl_camera
sdl3/generated/lib_sdl_clipboard
sdl3/generated/lib_sdl_cpuinfo
sdl3/generated/lib_sdl_dialog
sdl3/generated/lib_sdl_error
sdl3/generated/lib_sdl_events
sdl3/generated/lib_sdl_filesystem
sdl3/generated/lib_sdl_gamepad
sdl3/generated/lib_sdl_gpu
sdl3/generated/lib_sdl_guid
sdl3/generated/lib_sdl_haptic
sdl3/generated/lib_sdl_hidapi
sdl3/generated/lib_sdl_hints
sdl3/generated/lib_sdl_image
sdl3/generated/lib_sdl_init
sdl3/generated/lib_sdl_iostream
sdl3/generated/lib_sdl_joystick
sdl3/generated/lib_sdl_keyboard
sdl3/generated/lib_sdl_loadso
sdl3/generated/lib_sdl_locale
sdl3/generated/lib_sdl_log
sdl3/generated/lib_sdl_main
sdl3/generated/lib_sdl_messagebox
sdl3/generated/lib_sdl_metal
sdl3/generated/lib_sdl_misc
sdl3/generated/lib_sdl_mixer
sdl3/generated/lib_sdl_mouse
sdl3/generated/lib_sdl_mutex
sdl3/generated/lib_sdl_net
sdl3/generated/lib_sdl_pixels
sdl3/generated/lib_sdl_platform
sdl3/generated/lib_sdl_power
sdl3/generated/lib_sdl_process
sdl3/generated/lib_sdl_properties
sdl3/generated/lib_sdl_rect
sdl3/generated/lib_sdl_render
sdl3/generated/lib_sdl_sensor
sdl3/generated/lib_sdl_stdinc
sdl3/generated/lib_sdl_storage
sdl3/generated/lib_sdl_surface
sdl3/generated/lib_sdl_system
sdl3/generated/lib_sdl_thread
sdl3/generated/lib_sdl_time
sdl3/generated/lib_sdl_timer
sdl3/generated/lib_sdl_touch
sdl3/generated/lib_sdl_ttf
sdl3/generated/lib_sdl_version
sdl3/generated/lib_sdl_video
sdl3/generated/lib_sdl_vulkan
sdl3/generated/struct_sdl
sdl3/generated/struct_sdl_image
sdl3/generated/struct_sdl_mixer
sdl3/generated/struct_sdl_net
sdl3/generated/struct_sdl_ttf
sdl3/gfx/const
sdl3/gfx/framerate
sdl3/gfx/primitives
sdl3/gfx/primitives_font
sdl3/gfx/rotozoom
sdl3/lib_sdl_ex
sdl3/lib_sdl_gfx_ex
sdl3/lib_sdl_image_ex
sdl3/lib_sdl_mixer_ex
sdl3/lib_sdl_net_ex
sdl3/lib_sdl_ttf_ex
sdl3/lib_sdl_video_ex
sdl3gfx