sdl3 2.11.0 copy "sdl3: ^2.11.0" to clipboard
sdl3: ^2.11.0 copied to clipboard

A Dart library for accessing common SDL3 (and SDL3_image, SDL3_mixer, SDL3_net, SDL3_ttf, SDL3_gfx, SDL3_shadercross) APIs using, FFI.

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.

https://www.libsdl.org/

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

Tast List (for struct) #

sdl #

assert #

  • ❌ SdlAssertData

asyncio #

  • ✅ SdlAsyncIo
  • ✅ SdlAsyncIoOutcome
  • ✅ SdlAsyncIoQueue

atomic #

  • ❌ SdlAtomicInt
  • ❌ SdlAtomicU32

audio #

  • ✅ SdlAudioSpec
  • ✅ SdlAudioStream

camera #

  • ✅ SdlCamera
  • ✅ SdlCameraSpec

dialog #

  • ✅ SdlDialogFileFilter

events #

  • ✅ SdlCommonEvent
  • ✅ SdlDisplayEvent
  • ✅ SdlWindowEvent
  • ✅ SdlKeyboardDeviceEvent
  • ✅ SdlKeyboardEvent
  • ✅ SdlTextEditingEvent
  • ✅ SdlTextEditingCandidatesEvent
  • ✅ SdlTextInputEvent
  • ✅ SdlMouseDeviceEvent
  • ✅ SdlMouseMotionEvent
  • ✅ SdlMouseButtonEvent
  • ✅ SdlMouseWheelEvent
  • ✅ SdlJoyAxisEvent
  • ✅ SdlJoyBallEvent
  • ✅ SdlJoyHatEvent
  • ✅ SdlJoyButtonEvent
  • ✅ SdlJoyDeviceEvent
  • ✅ SdlJoyBatteryEvent
  • ✅ SdlGamepadAxisEvent
  • ✅ SdlGamepadButtonEvent
  • ✅ SdlGamepadDeviceEvent
  • ✅ SdlGamepadTouchpadEvent
  • ✅ SdlGamepadSensorEvent
  • ✅ SdlGamepadCapSenseEvent
  • ✅ SdlAudioDeviceEvent
  • ✅ SdlCameraDeviceEvent
  • ✅ SdlNotificationEvent
  • ✅ SdlRenderEvent
  • ✅ SdlTouchFingerEvent
  • ✅ SdlPinchFingerEvent
  • ✅ SdlPenProximityEvent
  • ✅ SdlPenMotionEvent
  • ✅ SdlPenTouchEvent
  • ✅ SdlPenButtonEvent
  • ✅ SdlPenAxisEvent
  • ✅ SdlDropEvent
  • ✅ SdlClipboardEvent
  • ✅ SdlSensorEvent
  • ✅ SdlQuitEvent
  • ✅ SdlUserEvent
  • ✅ SdlEvent

filesystem #

  • ✅ SdlPathInfo

gamepad #

  • ✅ SdlGamepad
  • ✅ SdlGamepadBindingInputAxis
  • ✅ SdlGamepadBindingInputHat
  • ✅ SdlGamepadBindingInput
  • ✅ SdlGamepadBindingOutputAxis
  • ✅ SdlGamepadBindingOutput
  • ✅ SdlGamepadBinding

gpu #

  • ✅ SdlGpuDevice
  • ❌ SdlGpuBuffer
  • ❌ SdlGpuTransferBuffer
  • ❌ SdlGpuTexture
  • ❌ SdlGpuSampler
  • ❌ SdlGpuShader
  • ❌ SdlGpuComputePipeline
  • ❌ SdlGpuGraphicsPipeline
  • ✅ SdlGpuCommandBuffer
  • ✅ SdlGpuRenderPass
  • ✅ SdlGpuComputePass
  • ✅ SdlGpuCopyPass
  • ❌ SdlGpuFence
  • ✅ SdlGpuViewport
  • ✅ SdlGpuTextureTransferInfo
  • ✅ SdlGpuTransferBufferLocation
  • ✅ SdlGpuTextureLocation
  • ✅ SdlGpuTextureRegion
  • ❌ SdlGpuBlitRegion
  • ✅ SdlGpuBufferLocation
  • ✅ SdlGpuBufferRegion
  • ❌ SdlGpuIndirectDrawCommand
  • ❌ SdlGpuIndexedIndirectDrawCommand
  • ❌ SdlGpuIndirectDispatchCommand
  • ✅ SdlGpuSamplerCreateInfo
  • ❌ SdlGpuVertexBufferDescription
  • ❌ SdlGpuVertexAttribute
  • ❌ SdlGpuVertexInputState
  • ❌ SdlGpuStencilOpState
  • ❌ SdlGpuColorTargetBlendState
  • ✅ SdlGpuShaderCreateInfo
  • ✅ SdlGpuTextureCreateInfo
  • ✅ SdlGpuBufferCreateInfo
  • ✅ SdlGpuTransferBufferCreateInfo
  • ❌ SdlGpuRasterizerState
  • ❌ SdlGpuMultisampleState
  • ❌ SdlGpuDepthStencilState
  • ❌ SdlGpuColorTargetDescription
  • ❌ SdlGpuGraphicsPipelineTargetInfo
  • ✅ SdlGpuGraphicsPipelineCreateInfo
  • ✅ SdlGpuComputePipelineCreateInfo
  • ✅ SdlGpuColorTargetInfo
  • ✅ SdlGpuDepthStencilTargetInfo
  • ✅ SdlGpuBlitInfo
  • ✅ SdlGpuBufferBinding
  • ✅ SdlGpuTextureSamplerBinding
  • ✅ SdlGpuStorageBufferReadWriteBinding
  • ✅ SdlGpuStorageTextureReadWriteBinding
  • ❌ SdlGpuVulkanOptions

guid #

  • ❌ SdlGuid

haptic #

  • ❌ SdlHaptic
  • ❌ SdlHapticDirection
  • ❌ SdlHapticConstant
  • ❌ SdlHapticPeriodic
  • ❌ SdlHapticCondition
  • ❌ SdlHapticRamp
  • ❌ SdlHapticLeftRight
  • ❌ SdlHapticCustom
  • ❌ SdlHapticEffect

hidapi #

  • ✅ SdlHidDevice
  • ✅ SdlHidDeviceInfo

iostream #

  • ❌ SdlIoStreamInterface
  • ❌ SdlIoStream

joystick #

  • ✅ SdlJoystick (haptic)
  • ❌ SdlVirtualJoystickTouchpadDesc
  • ❌ SdlVirtualJoystickSensorDesc
  • ❌ SdlVirtualJoystickDesc

loadso #

  • ❌ SdlSharedObject

locate #

  • ✅ SdlLocale

main_impl #

  • ❌ HINSTANCE

messagebox #

  • ❌ SdlMessageBoxButtonData
  • ❌ SdlMessageBoxColor
  • ❌ SdlMessageBoxColorScheme
  • ❌ SdlMessageBoxData

mouse #

  • ✅ SdlCursor
  • ✅ SdlCursorFrameInfo

mutex #

  • ❌ SdlMutex
  • ❌ SdlRwLock
  • ❌ SdlSemaphore
  • ❌ SdlCondition
  • ❌ SdlInitState

notification #

  • ✅ SdlNotificationActionButton
  • ✅ SdlNotificationAction

openxr #

  • ❌ XrSessionCreateInfo
  • ❌ XrSwapchainCreateInfo

pixels #

  • ❌ SdlColor
  • ❌ SdlFColor
  • ❌ SdlPalette
  • ❌ SdlPixelFormatDetails

process #

  • ✅ SdlProcess

rect #

  • ✅ SdlPoint
  • ✅ SdlFPoint
  • ✅ SdlRect
  • ✅ SdlFRect

render #

  • ✅ SdlVertex
  • ✅ SdlRenderer (gfx / image / ttf)
  • ✅ SdlTexture
  • ❌ SdlGpuRenderStateCreateInfo
  • ❌ SdlGpuRenderState

sensor #

  • ❌ SdlSensor

stdinc #

  • ❌ SdlAlignmentTest
  • ❌ SdlEnvironment
  • ❌ SdlIconvT

storage #

  • ✅ SdlStorageInterface
  • ✅ SdlStorage

surface #

  • ✅ SdlSurface

system #

  • ❌ MSG
  • ❌ XEvent
  • ❌ XTaskQueueHandle
  • ❌ XUserHandle

thread #

  • ❌ SdlThread

time #

  • ✅ SdlDateTime

touch #

  • ❌ SdlFinger

tray #

  • ✅ SdlTray
  • ✅ SdlTrayMenu
  • ✅ SdlTrayEntry

video #

  • ❌ SdlDisplayModeData
  • ❌ SdlDisplayMode
  • ✅ SdlWindow (keyboard / metal / mouse / render / system / vulkan)
  • ✅ SdlGlContext

sdl_image #

  • ✅ ImgAnimation
  • ✅ ImgAnimationEncoder
  • ✅ ImgAnimationDecoder

sdl_mixer #

  • ✅ MixMixer
  • ✅ MixAudio
  • ✅ MixTrack
  • ✅ MixGroup
  • ✅ MixStereoGains
  • ✅ MixPoint3D
  • ✅ MixAudioDecoder

sdl_net #

  • ✅ NetAddress
  • ✅ NetStreamSocket
  • ✅ NetServer
  • ✅ NetDatagramSocket
  • ✅ NetDatagram

sdl_shadercross #

  • ❌ SdlShaderCrossIoVarMetadata
  • ❌ SdlShaderCrossGraphicsShaderResourceInfo
  • ❌ SdlShaderCrossGraphicsShaderMetadata
  • ❌ SdlShaderCrossComputePipelineMetadata
  • ❌ SdlShaderCrossSpirvInfo
  • ❌ SdlShaderCrossHlslDefine
  • ❌ SdlShaderCrossHlslInfo

sdl_ttf #

  • ❌ TtfFillOperation
  • ❌ TtfCopyOperation
  • ❌ TtfDrawOperation
  • ❌ TtfTextLayout
  • ❌ TtfTextData
  • ❌ TtfTextEngine
  • ❌ TtfFont
  • ❌ TtfText
  • ❌ TtfGpuAtlasDrawSequence
  • ❌ TtfGlAtlasDrawVertex
  • ❌ TtfGlAtlasDrawSequence
  • ❌ TtfSubString

Task List (for lib) #

  • lib_sdl.dart
  • lib_sdl_assert.dart Please use Dart assert.
  • ✅ lib_sdl_asyncio.dart
  • lib_sdl_atomic.dart Not needed. Dart uses an isolate-based concurrency model.
  • ✅ lib_sdl_audio.dart
  • lib_sdl_blendmode.dart
  • ✅ lib_sdl_camera.dart
  • ✅ lib_sdl_clipboard.dart
  • lib_sdl_cpuinfo.dart
  • ✅ lib_sdl_dialog.dart
  • lib_sdl_error.dart
  • ✅ lib_sdl_events.dart
  • ✅ lib_sdl_filesystem.dart
  • ✅ lib_sdl_gamepad.dart
  • ✅ lib_sdl_gpu.dart
  • ✅ lib_sdl_guid.dart
  • ✅ lib_sdl_haptic.dart
  • ✅ lib_sdl_hidapi.dart
  • lib_sdl_hints.dart
  • ✅ lib_sdl_image.dart
  • lib_sdl_init.dart
  • ✅ lib_sdl_iostream.dart
  • ✅ lib_sdl_joystick.dart
  • ✅ lib_sdl_keyboard.dart
  • lib_sdl_loadso.dart Please use dart:ffi.
  • ✅ lib_sdl_locale.dart
  • lib_sdl_log.dart
  • lib_sdl_main.dart Not supported. SDL3 main callbacks (SDL_AppInit) require compiling a C-level entry point.
  • ✅ lib_sdl_messagebox.dart
  • lib_sdl_metal.dart
  • lib_sdl_misc.dart
  • ✅ lib_sdl_mixer.dart
  • ✅ lib_sdl_mouse.dart
  • lib_sdl_mutex.dart Please use Dart async utilities or Mutex packages.
  • ✅ lib_sdl_net.dart
  • ✅ lib_sdl_notification.dart
  • lib_sdl_opengl.dart
  • lib_sdl_opengl_glext.dart
  • lib_sdl_openxr.dart Not supported. XR rendering pipelines should be handled directly in native C/C++.
  • lib_sdl_pen.dart
  • ✅ lib_sdl_pixels.dart
  • lib_sdl_platform.dart
  • ✅ lib_sdl_power.dart
  • ✅ lib_sdl_process.dart
  • ✅ lib_sdl_properties.dart
  • ✅ lib_sdl_rect.dart
  • ✅ lib_sdl_render.dart
  • ✅ lib_sdl_sensor.dart
  • ✅ lib_sdl_shadercross.dart
  • ✅ lib_sdl_stdinc.dart
  • ✅ lib_sdl_storage.dart
  • ✅ lib_sdl_surface.dart
  • ✅ lib_sdl_system.dart
  • lib_sdl_thread.dart Please use Dart Isolates.
  • ✅ lib_sdl_time.dart
  • lib_sdl_timer.dart
  • ✅ lib_sdl_touch.dart
  • ✅ lib_sdl_tray.dart
  • ✅ lib_sdl_ttf.dart
  • lib_sdl_version.dart
  • ✅ lib_sdl_video.dart
  • ✅ lib_sdl_vulkan.dart
13
likes
0
points
1.23k
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart library for accessing common SDL3 (and SDL3_image, SDL3_mixer, SDL3_net, SDL3_ttf, SDL3_gfx, SDL3_shadercross) APIs using, FFI.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

change_case, ffi

More

Packages that depend on sdl3