bare-sdl
Reference overview for bare-sdl: SDL bindings for Bare—windows, GPU-accelerated rendering, textures, input events, and audio devices.
bare-sdl provides SDL bindings for Bare—native windowing, GPU-accelerated 2D rendering, input, and audio. It's a native addon and requires Bare >=1.14.0. This page is an overview of the main classes; see the repository README for constructors, enums, and the full surface.
npm i bare-sdlAPI overview
Windowing and rendering
Window— a native window.window.destroy()tears it down.Renderer— a GPU-accelerated 2D renderer for a window:renderer.clear(),renderer.texture(texture[, src[, dst]]),renderer.present(),renderer.destroy().Texture— a renderable image:texture.update(buffer, pitch[, rect]),texture.destroy().Rect— a rectangle withx,y,w,handrect.set(x, y, w, h), used for source/destination regions.
Input
Event— an input event with atypeand, for keyboard events,event.key(includingevent.key.scancode).Poller— pumps the event queue:poller.poll(event)fills anEventwith the next pending event.
Audio
AudioDevice— a playback or recording device. Instance members includename,format,isPlaybackDevice,isPhysicalDevice,isPaused, andgain, plusbindStream(stream),unbindStream(stream),pause(),resume(), andclose(). Static helpers enumerate devices and formats:AudioDevice.playbackDevices(),AudioDevice.recordingDevices(),AudioDevice.defaultPlaybackDevice([spec]),AudioDevice.playbackDeviceFormats(), andAudioDevice.recordingDeviceFormats().
See also
- Bare modules—the full
bare-*catalog, including media codecs. bare-stream—the streams bound to audio devices.- Bare runtime API—the runtime these bindings run on.