API reference
Preparing search index…

Windows, graphics, audio and networking for Node.js. Browse a module or search for an API by name.

System

Time, vectors and streams. The foundations shared by every module.

All APIs52
add

Return a new object adding values of the same type; vectors add component-wise, and Color channels saturate at 255.

addAssign

Add right to left in place and return left; read-only constants cannot be modified.

Angle

sf::Angle's float32 value, with native ownership created on demand.

Clock

A pausable monotonic stopwatch, with no native SFML handle.

degrees

Create an angle from degrees, stored with float32 precision.

divide

Return a new object divided by a scalar; dividing two Time or two Angle values returns a numeric ratio.

divideAssign

Divide the left value by a scalar in place and return it; throw RangeError if the divisor is zero.

equal

Compare same-type operands by value; floating-point comparisons are exact, and vectors require the same scalar type.

err

A singleton Writable whose bytes are written to the actual SFML stream.

FileInputStream

Seekable asynchronous file input that reads directly into caller buffers.

greater

Test whether the left value is greater than the right; both must have the same orderable type.

greaterEqual

Test whether the left value is greater than or equal to the right; both must have the same orderable type.

InputStream

Seekable input. Each operation may complete synchronously or asynchronously.

less

Test whether the left value is less than the right; supports Time, Angle, VideoMode, and IpAddress.

lessEqual

Test whether the left value is less than or equal to the right; both must have the same orderable type.

MemoryInputStream

Retains the supplied bytes without copying them.

microseconds

Create a duration from an exact signed 64-bit microsecond count, throwing RangeError if out of range.

milliseconds

Create a duration from milliseconds; the input truncated toward zero must fit in a signed 32-bit integer.

modulo

Return the duration remainder of integer microsecond division, with the remainder taking the sign of left.

moduloAssign

Write the duration remainder back to left and return left.

multiply

Return a new object from scalar scaling, transform composition, or point transformation; Color channels are multiplied and then divided by 255.

multiplyAssign

Scale, compose transforms, or modulate colors in place, returning the left operand.

negate

Return a new negated object, converted to the original scalar type; Color is unsupported, and boolean vector values remain unchanged.

notEqual

Return whether same-type operands are unequal by value.

radians

Create an angle from radians, stored with float32 precision.

ReadonlyValue

Const data members recurse; methods still return independent mutable values.

ScalarType

Vector scalar type: i/u denotes signed/unsigned integers, f denotes floating point, and the suffix is the bit width.

seconds

Create a duration from seconds using float32 arithmetic, truncating to whole microseconds.

setErrorOutput

Process-wide SFML output: Writable redirects, null mutes, undefined resets.

SFMLError

Runtime failure reported by the SFML binding.

sleep

Asynchronous wait; the calling thread remains available to the event loop.

StreamResult

undefined reports an I/O failure; throws and rejected promises reject loading.

subtract

Return a new object subtracting values of the same type; Color channels have a minimum of 0.

subtractAssign

Subtract right from left in place and return left; each Color channel has a minimum of 0.

SuspendAwareClock

SFML's Android clock, including time spent in system suspend.

Time

A signed microsecond duration; native APIs receive its bigint by value.

TimeoutPredicate

Called once per check period; return true to keep waiting or false to stop.

TimeoutWithPredicate

Timeout configuration; the consuming operation performs waits and checks.

Unicode
isGraphemeBoundary

Test for a grapheme boundary before UTF-16 index position using SFML's Unicode rules. The start and end are boundaries; the middle of a surrogate pair is not. Isolated surrogate code units are treated as U+FFFD.

isSentenceBoundary

Test for a sentence boundary before UTF-16 index position using SFML's Unicode rules. The start and end are boundaries; the middle of a surrogate pair is not. Isolated surrogate code units are treated as U+FFFD.

isWordBoundary

Test for a word boundary before UTF-16 index position using SFML's Unicode rules. The start and end are boundaries; the middle of a surrogate pair is not. Isolated surrogate code units are treated as U+FFFD.

Vector2

sf::Vector2, with a native handle lazily bound to its existing storage.

Vector2f

sf::Vector2.

Vector2i

sf::Vector2.

Vector2u

sf::Vector2.

Vector3

sf::Vector3, stored as three consecutive values of its scalar type.

Vector3f

A vector of three float32 components.

Vector3i

A vector of three signed 32-bit integer components.

Vector3u

A vector of three unsigned 32-bit integer components.

version

Runtime SFML version, cached as one immutable native-backed value.

Version

The version of the currently loaded native SFML library.

Window

Windows, input and OpenGL contexts. Connect your application to the desktop.

All APIs64
Clipboard
getString

Return the system clipboard text, or an empty string if it contains no text.

setString

Replace the system clipboard text with text.

Context

Native-owned OpenGL context; activation remains per native thread.

ContextAttribute

OpenGL context attribute bit flags.

ContextSettings

SFML context requests; omitted members use SFML's defaults.

Cursor

A system cursor or a custom RGBA pixel cursor.

CursorType

System cursor shapes; availability depends on the platform.

Event

SFML's variant: kind identifies the subtype; payload fields stay intact.

EventData

An event-data union discriminated by the kind field.

EventHandlers

Optional synchronous handlers for each event kind.

EventKind

Names of supported window event kinds.

EventPayloads

Window event kinds and their payloads; all positions are client-area pixel coordinates.

EventVisitor

A visitor receiving data for any window event.

Joystick
getAxisPosition

Return the specified axis position, from -100 to 100.

getButtonCount

Return the number of buttons on the specified joystick.

getIdentification

Return the specified joystick's name, vendor ID, and product ID.

hasAxis

Return whether the joystick provides the specified axis.

Identification

Joystick device identification information.

isButtonPressed

Query the pressed state of the specified joystick button; indices start at zero.

isConnected

Return whether the specified joystick is connected; indices start at zero.

update

Refresh joystick state manually; window event processing also refreshes it.

JoystickAxis

Joystick axes.

JoystickAxisCount

Maximum number of supported axes

JoystickButtonCount

Maximum number of supported buttons

JoystickCount

Maximum number of supported joysticks

Keyboard
delocalize

Convert a logical key code to a physical scancode using the current keyboard layout.

getDescription

Return a human-readable name for the physical key.

isKeyPressed

Query a logical key's real-time pressed state, independent of the event queue.

localize

Convert a physical scancode to a logical key code using the current keyboard layout.

setVirtualKeyboardVisible

Show or hide the on-screen keyboard on supported platforms.

KeyboardKey

Logical keys that depend on the system keyboard layout.

KeyboardKeyCount

The total number of keyboard keys, ignoring Key::Unknown

KeyboardScancode

Physical keys independent of the keyboard layout.

KeyboardScancodeCount

The total number of scancodes, ignoring Scan::Unknown

Mouse
getPosition

Return the mouse pixel position relative to the client area if a window is provided, or to the desktop otherwise.

isButtonPressed

Query a mouse button's real-time pressed state.

setPosition

Move the mouse using client-area pixel coordinates if a window is provided, or desktop pixel coordinates otherwise.

MouseButton

Mouse buttons.

MouseButtonCount

The total number of mouse buttons

MouseWheel

Mouse wheel orientations.

ReadonlyContext

A read-only settings interface for the current OpenGL context.

Sensor
getValue

Return three-axis measurements: acceleration in m/s², angular velocity in degrees/second, magnetic field in µT, and orientation in degrees.

isAvailable

Return whether the device provides the specified sensor.

setEnabled

Enable or disable sensor data acquisition.

SensorCount

The total number of sensor types

SensorType

Sensor types.

State

Initial window display state.

Style

Window style bit flags that can be combined with bitwise OR.

Touch
getPosition

Return the touch's pixel position relative to the client area of relativeTo, or to the desktop if omitted.

isDown

Return whether the specified touch is still down.

VideoMode

A video mode: pixel dimensions and bits per pixel.

Vulkan
getFunction

Query a Vulkan function address, returning undefined if not found. The address uses bigint to preserve precision; calling it requires a native binding with the matching function signature.

getGraphicsRequiredInstanceExtensions

Return a copy of the extension names required to create a graphics instance; the contents depend on SFML's platform backend.

isAvailable

Query whether the SFML backend supports Vulkan; false checks only compute capabilities.

Window

An OS window with an OpenGL context, usable by Texture.update().

WindowHandle

Platform window handles and Vulkan pointers are represented losslessly.

WindowOptions

Window creation options.

Graphics

Textures, shapes, text and rendering. Build your 2D scene.

All APIs71
BlendAdd

Adds the alpha-scaled source color to the destination; read-only.

BlendAlpha

Standard alpha blending; read-only.

BlendEquation

How to combine source and destination colors after applying their factors.

BlendFactor

Factor multiplying the source or destination color in the blend equation.

BlendMax

Component-wise maximum of source and destination; read-only.

BlendMin

Component-wise minimum of source and destination; read-only.

BlendMode

sf::BlendMode. Values are copied into each recorded draw.

BlendMultiply

Multiplies source and destination component-wise; read-only.

BlendNone

Source overwrites destination without color blending; read-only.

CircleShape

sf::CircleShape geometry with Shape appearance and transformations.

CircleShapeOptions

Initial circle geometry parameters.

ClusterGrouping

Glyph cluster grouping for text shaping.

Color

RGBA color with four one-byte channels in the range 0 to 255. Channel writes convert according to Uint8Array rules; storage is shared with Native as needed.

ConvexShape

sf::ConvexShape; points must describe a convex polygon in winding order.

CoordinateType

Units for texture coordinates.

Drawable

sf::Drawable: override draw to synchronously compose other drawables.

FloatRect

sf::Rect, sharing 16 native bytes with its member views.

Font

Native-owned font face, input storage and retained glyph atlases.

FontInfo

Identity and properties of the current font.

Glsl
Bvec2

sf::Vector2; each component occupies one canonical 0/1 byte.

Bvec3

sf::Vector3, sharing the same native family as numeric Vector3.

Bvec4

GLSL bvec4 with four boolean components.

Ivec4

GLSL ivec4 with four signed 32-bit integer components.

Mat3

GLSL mat3 with nine column-major float32 components.

Mat4

GLSL mat4 with sixteen column-major float32 components.

Vec4

GLSL vec4 with four float32 components.

Glyph

sf::Glyph and its rectangle members share a 44-byte allocation.

GlyphAppearance

Single-glyph appearance editable by the glyph preprocessor.

GlyphPreProcessor

Callback that synchronously changes glyph appearance; must not modify or query geometry of the same Text while running.

Image

Native-owned RGBA8 pixels with asynchronous file and codec operations.

IntRect

sf::Rect, with integer division in getCenter().

LineAlignment

Text line alignment.

PrimitiveType

SFML 3 primitive types (quads are not supported).

ReadonlyFont

Read-only interface to the same font resource, retaining the font and its glyph textures for their lifetimes.

ReadonlyPixels

Compile-time const view. Runtime storage is the same native Uint8Array.

ReadonlyRenderStates

Read-only draw states; textures and shaders retain resource references.

ReadonlyShader

Read-only interface to the same shader program.

ReadonlyTexture

Compile-time const reference to the same texture resource.

RectangleShape

sf::RectangleShape geometry with Shape appearance and transformations.

RenderStates

Value members copy deeply; texture and shader references retain identity.

RenderStatesInput

Draw state input: a configuration object or a single transform, blend mode, stencil mode, texture or shader resource.

RenderStatesOptions

Partially specified draw state parameters.

RenderTarget

Shared draw dispatch and command recording for render targets.

RenderTexture

sf::RenderTexture: record clear/draw, submit when display is called.

RenderTextureSettings

Depth, stencil, antialiasing and OpenGL context settings for an off-screen render target.

RenderWindow

A window supporting both Window operations and RenderTarget 2D drawing.

Shader

Native-owned program; source loading and compilation run asynchronously.

ShaderType

GLSL shader stages.

Shape

Custom shapes publish a convex point outline by calling update().

ShapedGlyph

A single shaped glyph and its layout information.

Sprite

sf::Sprite with the shared Transformable API.

StencilComparison

Compares the masked reference value with the masked stencil buffer value.

StencilMode

sf::StencilMode; reference and mask are independent value copies.

StencilModeOptions

Initial stencil test settings; omitted fields use StencilMode defaults.

StencilUpdateOperation

How the stencil buffer is updated after the stencil test passes.

StencilValue

sf::StencilValue, including the signed-to-unsigned integer conversion.

swap

Exchange same-type resources, preserving previously recorded draws.

Text

SFML shaping with native vertex storage and batched draw snapshots.

TextDirection

Glyph layout direction.

TextOptions

Initial text parameters.

TextOrientation

Horizontal or vertical writing direction.

TextStyle

Text style bit flags, combinable with bitwise operations.

Texture

GPU texture with background image decoding and ordered pixel uploads.

Transform

sf::Transform, using its 64-byte column-major storage from construction.

Transformable

sf::Transformable with native-owned staging and JS transform calculations.

Vertex

sf::Vertex, sharing position, RGBA and texture coordinates in 20 bytes.

VertexArray

Native contiguous vertices, exposed through stable per-allocation views.

VertexBuffer

GPU storage owned by Native; draw records a handle without uploading vertices.

VertexBufferUsage

Strings distinguish the single-argument Usage and PrimitiveType constructors.

View

A value camera; mutation and projection math stay on the JS side.

Audio

Playback, recording and spatial audio. Work with sound in real time.

All APIs62
AudioWorkerContext

Actual processing parameters passed to the audio callback factory.

AudioWorkerModule

A module export is a factory receiving context and structured-clone data.

AudioWorkerOptions

Audio Worker module and block queue configuration.

AudioWorkerStats

Cumulative statistics for the native audio block queue.

ChannelMap

Read-only view of channel positions in interleaved order.

Cone

One native sf::SoundSource::Cone, exposed through its float fields.

ConeInput

Directional cone parameters for a spatial sound source or listener.

EffectFrames

Frame counts actually consumed and produced by the effect processor.

EffectProcessor

Buffered DSP on native float blocks. Underflow produces silence.

EffectProcessorCallbacks

Floating-point PCM effect callbacks executed in a Node Worker.

EffectProcessorOptions

Worker and capacity configuration for a floating-point PCM effect processor.

InputSoundFile

Seekable audio decoder reading interleaved 16-bit PCM asynchronously in invocation order.

Listener
getCone

Return a copy of the listener's directional cone parameters.

getDirection

Return a copy of the listener's facing direction.

getGlobalVolume

Return the global volume percentage.

getPosition

Return a copy of the listener's 3D position.

getUpVector

Return a copy of the listener's up direction.

getVelocity

Return a copy of the listener's velocity.

setCone

Copy directional cone parameters and update the native listener.

setDirection

Set the listener's forward direction.

setGlobalVolume

Set the global volume percentage for all sources; 0 is silent and 100 is the original volume.

setPosition

Set the listener's position in world coordinates.

setUpVector

Set the listener's up direction, which defines orientation together with the forward direction.

setVelocity

Set the listener's velocity for the Doppler effect, in position units/second.

Music

Decode and play long audio in blocks without loading all samples into memory at once.

OutputSoundFile

Asynchronously encode interleaved 16-bit PCM into an audio file whose format is determined by the file extension.

PlaybackDevice
getAvailableDevices

Return the names of available playback devices.

getDefaultDevice

Return the system's default playback device name, or undefined if unavailable.

getDevice

Return the current playback device name, or undefined if unavailable.

getDeviceSampleRate

Return the current device sample rate in Hz, or undefined if unavailable.

isDefaultDevice

Return whether the current device follows the system default.

Notification

Lifecycle notifications for the audio playback device.

NotificationCallback

Callback receiving playback device status notifications.

setDevice

Switch to the named playback device and return whether it succeeded.

setDeviceToDefault

Switch to the system's default playback device and report success.

setDeviceToNull

Switch to a null device with no sound output and return whether it succeeded.

setNotificationCallback

Set the device notification callback; undefined or null removes it.

ReadonlySamples

Read-only typed view of 16-bit interleaved PCM, retaining native storage.

ReadonlySoundBuffer

Read-only audio buffer interface; sample views retain their native storage.

Sound

Play short sound effects from memory, holding a SoundBuffer to retain sample storage.

SoundBuffer

Views retain the exact native allocation from which they were obtained.

SoundBufferRecorder

Recorder that saves captured PCM in a SoundBuffer.

SoundChannel

Speaker positions for interleaved PCM channels.

SoundFileFactory

Registrations belong to the current Node environment.

SoundFileReader

Custom audio decoder interface; I/O positions count samples across all channels.

SoundFileReaderConstructor

Registrable decoder class requiring a no-argument constructor and format probe.

SoundFileReaderInfo

sf::SoundFileReader::Info with directly mapped scalar fields.

SoundFileReaderInfoInput

Format information returned by a custom audio decoder.

SoundFileWriter

Custom audio encoder interface accepting interleaved 16-bit PCM.

SoundFileWriterConstructor

Registrable encoder class requiring a no-argument constructor and a filename-based format probe.

SoundRecorder

Capture device audio and process interleaved 16-bit PCM in a Node Worker.

SoundRecorderCallbacks

Recording callbacks executed in a Node Worker.

SoundSource

Shared control/result fields; every engine operation still executes in SFML.

SoundStatus

Current playback status of a sound source.

SoundStream

Buffered SFML stream. The supplied module produces PCM in a Node Worker.

SoundStreamCallbacks

Playback stream callbacks executed in a Node Worker.

SoundStreamChunk

samples aliases a reusable native slot, valid until the callback settles.

SoundStreamOptions

Format and Worker configuration for a custom PCM playback stream.

TimeSpan

Mutable audio time span stored as exact microsecond counts.

TimeSpanInput

Audio time span input.

Network

Sockets, packets and protocols. Connect your application to the network.

All APIs53
DatagramResult

Result of receiving a single UDP datagram.

Dns
getPublicAddress

Query the public outbound address for the given address family via OpenDNS; return undefined on failure.

MxRecord

Mail exchanger record.

queryMx

Query mail exchanger records with a default 1-second timeout; return an empty array on query failure.

queryNs

Query name server records; default to system DNS and a 1-second timeout. Return an empty array on query failure.

querySrv

Query service discovery records (e.g. _service._tcp.domain); return an empty array on failure.

queryTxt

Query TXT records, each containing multiple text segments; return an empty array on failure.

resolve

Resolve IPv4/IPv6 addresses asynchronously; return undefined on failure. With no servers, use the system resolver without applying timeout. With explicit DNS servers, the default timeout is 1 second.

SrvRecord

Service discovery record.

FileType

Remote filesystem entry type.

Ftp

FTP client based on basic-ftp; queued operations run in call order.

FtpDirectoryResponse

FTP response containing a working directory path.

FtpListingResponse

FTP response containing directory entry names.

FtpResponse

FTP status code and server message.

FtpStatus

FTP server response codes and client error codes.

Http

HTTP/HTTPS client using one connection per request without automatically following redirects.

HttpMethod

HTTP request method.

HttpRequest

Mutable HTTP/1 request, defaulting to GET /, HTTP/1.0, and an empty body.

HttpResponse

HTTP response status, header fields, and body.

HttpStatus

HTTP response statuses and client errors; values retain SFML definitions.

IpAddress

Immutable IP address value supporting IPv4 and IPv6.

IpAddressType

IP address family.

Packet

Integers use network order; SFML floats use host order.

PacketType

Encoding type names accepted by Packet.write/read.

PacketValues

Packet encodings and their JS values; multibyte integers use network order.

ReadinessType

Socket readiness conditions, combinable as bit flags.

ReadyCallback

Receive the readiness bit flags obtained by this wait.

Sftp

Asynchronous SFTP client based on ssh2; file operations run in call order.

SftpAttributes

Remote entry attributes; fields omitted by the server are undefined.

SftpAttributesResult

Result containing attributes of one filesystem entry.

SftpDownloadCallback

Consume a download chunk; return false to stop early. An empty chunk indicates end of file.

SftpHostKeyType

SSH server host public key types.

SftpListingResult

Result containing a list of directory entry attributes.

SftpPathResult

Operation result containing a remote path.

SftpResult

SFTP operation status and message.

SftpResultValue

SFTP operation result codes.

SftpSessionInfo

SSH handshake negotiation results for application verification of the host public key and algorithms.

SftpTimeout

No-progress timeout configuration; reset the timer when data arrives or an RPC completes. A zero duration disables the timeout.

SftpUploadCallback

Fill an upload chunk and set size; returning false still sends the current chunk before stopping.

SftpUploadChunk

Writable data chunk received by an upload callback.

Socket

Common base for Node network transports; defaults to blocking semantics implemented with asynchronous waits.

SocketHandle

Node TCP, UDP, or listener transport object; raw OS file descriptors are not accepted.

SocketSelector

Wait asynchronously for a set of sockets to become ready, retaining the results of the latest wait.

SocketSendResult

Result of sending raw TCP bytes.

SocketStatus

Socket operation result; blocking mode waits via Promise without blocking the Node event loop.

SocketTransfer

Result of reading raw TCP bytes.

SocketType

Socket transport protocol, corresponding to sf::Socket::Type.

TcpListener

Listen for TCP connections and hand them to TcpSocket through accept.

TcpSocket

TCP socket supporting raw bytes, SFML Packet framing, and TLS upgrades.

TlsStatus

Current TLS upgrade state.

TransferMode

FTP file transfer modes.

UdpSocket

UDP socket preserving datagram boundaries; Packet data has no TCP length header.

Icons made by Lorc, Delapouite & Skoll · game-icons.net · CC BY 3.0