SDL3 for Dart
Requirement
- ffi ^2.2.0
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.
For OpenGL, call require separately.
import 'package:sdl3/sdl3.dart'; // SDL3, SDL3_image, SDL3_mixer, SDL3_net, SDL3_ttf, SDL3_shadercross
import 'package:sdl3/sdl3gfx.dart'; // SDL3_gfx
import 'package:sdl3/sdl3opengl.dart'; // OpenGL
Windows requires dll files.
SDL3.dll
SDL3_image.dll
SDL3_mixer.dll
SDL3_net.dll
SDL3_ttf.dll
SDL3_shadercross.dll
Linux requires so files.
libSDL3.so.0
libSDL3_image.so.0
libSDL3_mixer.so.0
libSDL3_net.so.0
libSDL3_ttf.so.0
libSDL3_shadercross.so.0
Android, Fuchsia requires so files.
libSDL3.so
libSDL3_image.so
libSDL3_mixer.so
libSDL3_net.so
libSDL3_ttf.so
libSDL3_shadercross.so
MacOS (or iOS) requires dylib files.
libSDL3.dylib
libSDL3_image.dylib
libSDL3_mixer.dylib
libSDL3_net.dylib
libSDL3_ttf.dylib
libSDL3_shadercross.dylib
And more.
If you want to set a library under special circumstances (example: dylib), do the following:
SdlDynamicLibraryService().set('sdl', 'YOUR_SDL3_ENVIONMENT.dylib');
SdlDynamicLibraryService().set('image', 'YOUR_SDL3_image_ENVIONMENT.dylib');
SdlDynamicLibraryService().set('mixer', 'YOUR_SDL3_mixer_ENVIONMENT.dylib');
SdlDynamicLibraryService().set('net', 'YOUR_SDL3_net_ENVIONMENT.dylib');
SdlDynamicLibraryService().set('ttf', 'YOUR_SDL3_ttf_ENVIONMENT.dylib');
SdlDynamicLibraryService().set('shadercross', 'YOUR_SDL3_shadercross_ENVIONMENT.dylib');
if (sdlInit(SDL_INIT_VIDEO)) {
// success
}
Note
A Dart library for accessing SDL 3 APIs using, FFI.
Windows 64bit & Linux (Tested under Windows 11 WSL2 environment)
Currently, we are providing it on an experimental basis using the dll compiled below.
https://github.com/sansuido/build-sdl3
Examples
learnopengl.com for Dart
https://github.com/sansuido/sdl3_learnopengl/
SDL_gpu_examples for Dart
https://github.com/sansuido/sdl3_gpu_examples/
SDL_projects for Dart
https://github.com/sansuido/sdl3_projects/
Author
yamahara
Task List (for 2.9.0)
xlib_sdl.dartxlib_sdl_assert.dartxlib_sdl_asyncio.dartlib_sdl_atomic.dartxlib_sdl_audio.dartxlib_sdl_blendmode.dartlib_sdl_camera.dartxlib_sdl_clipboard.dartxlib_sdl_cpuinfo.dartxlib_sdl_dialog.dartxlib_sdl_error.dartxlib_sdl_events.dartlib_sdl_filesystem.dartlib_sdl_gamepad.dartxlib_sdl_gpu.dartlib_sdl_guid.dartlib_sdl_haptic.dartlib_sdl_hidapi.dartlib_sdl_hints.dartxlib_sdl_image.dartlib_sdl_init.dartlib_sdl_iostream.dartlib_sdl_joystick.dartxlib_sdl_keyboard.dartlib_sdl_loadso.dartlib_sdl_locale.dartlib_sdl_log.dartlib_sdl_main.dartxlib_sdl_messagebox.dartlib_sdl_metal.dartxlib_sdl_misc.dartxlib_sdl_mixer.dartxlib_sdl_mouse.dartlib_sdl_mutex.dartlib_sdl_net.dartlib_sdl_opengl.dartlib_sdl_opengl_glext.dartlib_sdl_openxr.dartxlib_sdl_pen.dartxlib_sdl_pixels.dartxlib_sdl_platform.dartlib_sdl_power.dartlib_sdl_process.dartlib_sdl_properties.dartxlib_sdl_rect.dartxlib_sdl_render.dartlib_sdl_sensor.dartxlib_sdl_shadercross.dartlib_sdl_stdinc.dartlib_sdl_storage.dartxlib_sdl_surface.dartlib_sdl_system.dartlib_sdl_thread.dartlib_sdl_time.dartxlib_sdl_timer.dartlib_sdl_touch.dartlib_sdl_tray.dartxlib_sdl_ttf.dartxlib_sdl_version.dartxlib_sdl_video.dartlib_sdl_vulkan.dart