Skip to content

final platform layer h File Reference

Finalspace edited this page May 29, 2026 · 1 revision

Final Platform Layer (FPL) - A C99 Single-Header-File Platform Abstraction Library. More...

#include <stdint.h> #include <stddef.h> #include <stdbool.h> #include <stdarg.h> #include <limits.h> #include <assert.h> #include <signal.h> #include <malloc.h> #include <stdlib.h> #include <stdio.h> #include <wchar.h> #include <locale.h> Go to the source code of this file.

Data Structures

Type Name
struct fplARMCPUCapabilities
Container storing the capabilities of an ARM CPU. More...
struct fplAudioChannelMap
Stores the mapping of all audio channels to an audio speaker. More...
union fplAudioDeviceID
Stores the ID of the underlying backend. More...
struct fplAudioDeviceInfo
Stores the name and the ID of the audio device. More...
struct fplAudioFormat
Stores audio format properties, such as type, sample rate, channels, etc. More...
struct fplAudioSettings
Stores audio settings, such as format, device info, callbacks, backend, etc. More...
union fplColor32
Defines a 32-bit color in format BGRA. More...
struct fplConditionVariable
Stores the condition variable structure. More...
struct fplConsoleSettings
Stores the title and options for the console. More...
struct fplCPUCapabilities
Container storing the capabilities of a CPU. More...
union fplCPUIDLeaf
Container representing the 4-registers for a CPU-Leaf (EAX, EBX, ECX, EDX). More...
struct fplDateTime
Stores a date and time with milliseconds, including the UTC offset. More...
struct fplDateTimeCreationResult
Stores the result of a date time creation. More...
struct fplDateTimeResult
Stores the components for a date and time, that may be computed from a date time stamp. More...
struct fplDisplayInfo
A struct containing information about a display. More...
struct fplDisplayMode
A structure containing one set of display mode settings, such as size, refresh rate, etc. More...
struct fplDynamicLibraryHandle
Stores the internal handle to a dynamic library. More...
union fplEndianess
Byte-order probe union that overlays a 32-bit integer with its raw bytes. More...
struct fplEvent
A structure containing event data for all event types (Window, Keyboard, Mouse, etc.). More...
struct fplFileEntry
A structure containing the information for a file or directory (name, type, attributes, etc.). More...
struct fplFileHandle
The file handle structure. More...
union fplFilePermissions
fplFilePermissionMasks operator overloads for C++. More...
struct fplFileTimeStamps
A structure containing timestamps for creation/access/modify date. More...
struct fplGamepadButton
A structure containing properties for a gamepad button (IsDown, etc.). More...
struct fplGamepadData
Backend-agnostic snapshot of raw device input that a fplGamepadMapping operates on. More...
struct fplGamepadEvent
A structure containing gamepad event data (Type, Device, State, etc.). More...
struct fplGamepadInfo
Read-only description of a controller passed to a fpl_gamepad_mapping_resolver_callback at connect time. More...
struct fplGamepadInputBinding
Describes the raw input source bound to one logical FPL gamepad button or axis slot. More...
struct fplGamepadMapping
A complete mapping of raw device inputs onto FPL's logical gamepad layout. More...
struct fplGamepadSettings
Stores the settings for controlling how gamepads are handled. More...
struct fplGamepadState
A structure containing the entire gamepad state, that defines a full gamepad state in XInput/XBox layout. More...
struct fplGamepadStates
A struct containing the full state for all gamepad devices. More...
struct fplGraphicsApiSettings
Stores graphics API settings. More...
struct fplImageSource
Stores data for working with an image source. More...
struct fplInputBackendMask
Bitmask of enabled fplInputBackendType values. More...
struct fplInputBackendSupport
Describes the capabilities of a single input backend. More...
struct fplInputDevice
Describes a single input device exposed by some backend. More...
struct fplInputDeviceGuid
A 128-bit identifier uniquely identifying an input device across backends. More...
struct fplInputSettings
Stores input settings. More...
union fplInternalConditionVariable
Stores the internal condition variable for any platform. More...
union fplInternalDynamicLibraryHandle
Stores the library handle for any platform. More...
union fplInternalFileEntryHandle
FileAttributeFlags operator overloads for C++. More...
union fplInternalFileHandle
A union containing the internal file handle for any platform. More...
struct fplInternalFileRootInfo
A structure containing the internal root file information. More...
union fplInternalMutexHandle
Stores the internal mutex handle for any platform. More...
union fplInternalSemaphoreHandle
Stores the internal semaphore handle for any platform. More...
union fplInternalSignalHandle
Stores the internal signal handle for any platform. More...
union fplInternalThreadHandle
Stores the thread handle for any platform. More...
struct fplKeyboardEvent
A structure containing keyboard event data (Type, Keycode, Mapped key, etc.). More...
struct fplKeyboardState
A struct containing the full keyboard state. More...
struct fplLogSettings
Stores log settings. More...
struct fplLogWriter
Stores log writer settings. More...
struct fplLogWriterConsole
Log writer flags enumeration operators. More...
struct fplLogWriterCustom
Stores custom logging properties. More...
struct fplMemoryAllocationSettings
Stores settings for memory allocation usage. More...
struct fplMemoryBlock
Stores properties that represents any block of memory. More...
struct fplMemoryInfos
Stores information about the current memory usage. More...
struct fplMemorySettings
Stores memory settings for dynamic and temporary allocations. More...
struct fplMouseEvent
A structure containing mouse event data (Type, Button, Position, etc.). More...
struct fplMouseState
A struct containing the full mouse state. More...
struct fplMutexHandle
Stores the mutex handle structure. More...
struct fplOpenGLSettings
Stores OpenGL video settings. More...
struct fplOSVersionInfos
Stores the version information for the operating system. More...
struct fplSemaphoreHandle
Stores the semaphore handle structure. More...
struct fplSettings
Stores settings, such as window, video, etc. More...
struct fplSignalHandle
Stores the signal handle structure. More...
union fplSpecificAudioSettings
Stores backend-specific audio settings. More...
struct fplThreadHandle
Stores the thread handle structure. More...
struct fplThreadParameters
Stores creation parameters for fplThreadCreateWithParameters(). More...
union fplTimestamp
Stores a timestamp, used for delta measurements only. More...
struct fplVersionInfo
Stores version information. More...
struct fplVideoBackBuffer
A structure containing video backbuffer properties. More...
struct fplVideoRect
A structure defining a video rectangle's position and size. More...
union fplVideoRequirements
Stores the video requirements for the desired video backend. More...
struct fplVideoRequirementsVulkan
Stores the requirements for the Vulkan video backend. More...
struct fplVideoSettings
Stores video settings such as backend, v-sync, API-settings, etc. More...
struct fplVideoSurface
Stores the surface properties for the active video backend. More...
struct fplVideoSurfaceOpenGL
Stores the surface properties for the OpenGL video backend. More...
struct fplVideoSurfaceVulkan
Stores the surface properties for the Vulkan video backend. More...
union fplVideoWindow
Stores the video window handles. More...
struct fplVulkanSettings
Stores Vulkan video settings. More...
struct fplWindowCallbacks
Stores the window callbacks. More...
struct fplWindowDropFiles
A structure containing number and dropped files information. More...
struct fplWindowEvent
A structure containing window event data (Size, Position, etc.). More...
struct fplWindowPosition
Stores the position of a window. More...
struct fplWindowSettings
Stores window settings, such as size, title, etc. More...
struct fplWindowSize
Stores the size of a window. More...
struct fplX86CPUCapabilities
Container storing the capabilities of an x86 CPU. More...

Macros

Type Name
#define fpl_api
API call.
#define FPL_APPTYPE_WINDOW
Application is built as a windowed application (a window is created by FPL).
#define FPL_CACHELINE_SIZE
Cacheline size for Default Architecture (64-bytes).
#define fpl_common_api
Common API.
#define FPL_CPU_32BIT
32-bit CPU detected.
#define fpl_dllexport
Link-library Export.
#define fpl_dllimport
Link-library Import.
#define fpl_dlllocal
Link-library Local.
#define FPL_ENUM_AS_FLAGS_OPERATORS(type)
Defines bitwise operator overloads for the given enum type (C++ only, no-op in C).
#define fpl_extern
External call.
#define fpl_extern_inline
Extern inline function.
#define FPL_FILE_EXT_SEPARATOR
File extension character.
#define fpl_force_inline
Always inlines this function.
#define FPL_FUNCTION_NAME
Function name macro.
#define FPL_GAMEPAD_BUTTON_COUNT
Number of logical button slots stored in a fplGamepadMapping (matches fplGamepadButtonType).
#define FPL_GAMEPAD_DATA_MAX_AXES
Maximum number of raw axes captured in a fplGamepadData snapshot.
#define FPL_GAMEPAD_DATA_MAX_BUTTONS
Maximum number of raw buttons captured in a fplGamepadData snapshot.
#define FPL_GAMEPAD_DATA_MAX_HATS
Maximum number of raw hats captured in a fplGamepadData snapshot.
#define FPL_GAMEPAD_GUID_SIZE
Defines the size of a game controller GUID in bytes.
#define FPL_GAMEPAD_MAPPING_RESOLVE_CALLBACK(name)
Defines a prototype for a gamepad mapping resolver function.
#define fpl_globalvar
Global persistent variable.
#define fpl_inline
Inline function.
#define fpl_internal
Private/Internal function.
#define fpl_internal_inline
Private/Internal inline function.
#define FPL_IS_IDE
Is set when an IDE is active, like IntelliSense or JetBrains.
#define fpl_localvar
Local persistent variable.
#define fpl_main
Empty linkage marker for the user-defined main entry point.
#define FPL_MAX_AUDIO_CHANNEL_COUNT
Maximum number of audio channels.
#define FPL_MAX_BUFFER_LENGTH
Maximum length of an internal buffer (in bytes).
#define FPL_MAX_FILENAME_LENGTH
Maximum length of a filename.
#define FPL_MAX_GAMEPAD_STATE_COUNT
Max number of gamepad states.
#define FPL_MAX_INPUT_BACKEND_COUNT
Maximum number of input backends that can be active at once.
#define FPL_MAX_INPUT_DEVICE_COUNT
Maximum number of devices held by the input subsystem at once.
#define FPL_MAX_INPUT_DEVICE_NAME
Maximum length of the fplInputDevice name field.
#define FPL_MAX_KEYBOARD_STATE_COUNT
fplKeyboardModifierFlags operator overloads for C++.
#define FPL_MAX_NAME_LENGTH
Maximum length of a name (in characters).
#define FPL_MAX_PATH_LENGTH
Maximum length of a path.
#define FPL_MAX_VERSION_PART_LENGTH
Maximum number of digits in a single version-number part (excluding NUL).
#define fpl_no_inline
Prevents inlining of this function.
#define FPL_NOT_IMPLEMENTED
Crashes the application via a null-pointer write.
#define fpl_null
Defines a NULL pointer value that works in C/C++.
#define FPL_PATH_SEPARATOR
Path separator character.
#define fpl_platform_api
Platform API.
#define FPL_TIMEOUT_INFINITE
Infinite timeout constant.
#define FPL_X86_CPU_INSTR_SET_LEVEL
Compiled X86 CPU Instruction Set.
#define fplAlignAs(N)
Structure alignment in bytes.
#define fplAlwaysAssert(exp)
Always crashes the application with a null-pointer assignment when the specified expression evaluates to false.
#define fplArrayCount(arr)
Returns the element count from a static array.
#define fplAsm
An assembler keyword (asm) that is compiler-specific.
#define fplAssert(exp)
Breaks with a runtime assertion when the specified expression evaluates to false.
#define fplAssertPtr(ptr)
Breaks when the specified pointer is null.
#define fplClearStruct(ptr)
Clears the given struct pointer to zero.
#define fplCopyStruct(src, dst)
Copies the given source struct into the destination struct.
#define fplDebugBreak()
Stops the debugger on this line always.
#define fplGetAlignedSize(size, alignment)
Returns the given size, extended to satisfy the given alignment boundary.
#define fplGetAlignmentOffset(value, alignment)
Returns the offset for the value to satisfy the given alignment boundary.
#define fplGetEndianess32()
Returns the unsigned 32-bit integer value that represents the current platform endianness, built from the byte sequence (0, 1, 2, 3).
#define fplGigaBytes(value)
Returns the number of bytes for the given gigabytes.
#define fplHasInclude(inc)
Test for include existence.
#define fplIsAligned(ptr, alignment)
Returns true when the given pointer address is aligned to the given alignment.
#define fplIsBigEndian()
Gets a value indicating whether the current platform is big-endian or not.
#define fplIsBitSet(value, bit)
Returns true when the given value has the given bit set.
#define fplIsLittleEndian()
Gets a value indicating whether the current platform is little-endian or not.
#define fplIsMaskSet(value, mask)
Returns true when the given mask is set in the value.
#define fplIsPowerOfTwo(value)
Returns true when the given value is a power of two.
#define fplKiloBytes(value)
Returns the number of bytes for the given kilobytes.
#define fplMax(a, b)
Returns the biggest value of A and B.
#define fplMegaBytes(value)
Returns the number of bytes for the given megabytes.
#define fplMin(a, b)
Returns the smallest value of A and B.
#define fplMinAlignment
Minimum structure alignment in bytes.
#define fplOffsetOf(type, field)
Returns the offset in bytes for the specified structure type and field name.
#define fplStackAllocate(size)
Manually allocate the number of specified bytes of memory on the stack.
#define fplStaticAssert(exp)
Breaks the compilation when the specified expression evaluates to false.
#define fplStructField
Defines a single field in a struct.
#define fplStructInit
Initializes a struct by the given type.
#define fplStructSet
Overwrites the value of the given struct to a new value.
#define fplTeraBytes(value)
Returns the number of bytes for the given terabytes.
#define fplZeroInit
Initializes a struct to zero.

Typedefs

Type Name
typedef uint32_t fpl_audio_client_read_callback(const fplAudioFormat *deviceFormat, const uint32_t frameCount, void *outputSamples, void *userData)
A function definition for a callback that is called to read audio samples from the client.
typedef int32_t fpl_b32
Defines an integer-based boolean that has a width of 32-bit.
typedef bool fpl_gamepad_mapping_resolver_callback(const fplGamepadInfo *info, fplGamepadMapping *outMapping, void *userData)
Optional callback invoked once per controller connect on raw-HID gamepad backends (DirectInput, Linux joystick/evdev, etc.) to install a custom fplGamepadMapping for the device.
typedef void fpl_log_func_callback(const char *funcName, const int lineNumber, const fplLogLevel level, const char *message)
A function definition for a callback for printing a log message.
typedef void * fpl_memory_allocate_callback(void *userData, const size_t size, const size_t alignment)
A function definition for a custom memory allocation callback.
typedef void fpl_memory_release_callback(void *userData, void *ptr)
A function definition for a custom memory release callback.
typedef void fpl_run_thread_callback(const fplThreadHandle *thread, void *data)
A function definition for a callback to execute user code inside another thread.
typedef bool fpl_window_event_callback(const fplPlatformType platformType, void *windowState, void *rawEventData, void *userData)
A function definition for a callback executed for each raw window event.
typedef fpl_window_event_callback fpl_window_exposed_callback
A function definition for a callback executed when the window needs to be exposed/repainted.
typedef uint64_t fplAudioFormatU64
Encoded audio format in 64-bit ([63] Unused 8-bit, Type 8-bit, Channels 16-bit, Sample rate 32-bit [0]).
typedef uint64_t fplFileTimeStamp
The elapsed seconds since the UNIX epoch (1970-01-01 00:00:00).
typedef uint8_t fplGamepadGuid[FPL_GAMEPAD_GUID_SIZE]
A typedef that defines a 16-byte GUID used to identify a game controller.
typedef char fplGamepadName[FPL_MAX_NAME_LENGTH]
A typedef that defines the name of a game controller.
typedef uint64_t fplMilliseconds
A type definition for milliseconds (64-bit).
typedef double fplSeconds
A type definition for seconds (64-bit).
typedef uint32_t fplThreadState
A type definition that maps fplThreadStates into a 32-bit integer for atomic storage.
typedef uint32_t fplTimeoutValue
A type definition for a timeout value in milliseconds.
typedef char fplVersionNumberPart[FPL_MAX_VERSION_PART_LENGTH+1]
A type definition for mapping a part of a version number.
typedef void fplVulkanValidationLayerCallback(void *userData, const char *message, const uint32_t messageSeverity, const uint32_t messageType, const void *debugUtilsMessengerCallbackData)
A function definition for the debug callback that is called, when the validation layer writes something.

Enumerations

Type Name
enum fplAudioBackendType {
fplAudioBackendType_None , fplAudioBackendType_Auto , fplAudioBackendType_DirectSound , fplAudioBackendType_WASAPI ,
fplAudioBackendType_Alsa , fplAudioBackendType_PulseAudio , fplAudioBackendType_PipeWire , fplAudioBackendType_OSS ,
fplAudioBackendType_First , fplAudioBackendType_Last
}
An enumeration of audio backend types. More...
enum fplAudioChannelLayout {
fplAudioChannelLayout_Unsupported , fplAudioChannelLayout_Automatic , fplAudioChannelLayout_Mono , fplAudioChannelLayout_Stereo ,
fplAudioChannelLayout_2_1 , fplAudioChannelLayout_3_0_Surround , fplAudioChannelLayout_4_0_Quad , fplAudioChannelLayout_4_0_Surround ,
fplAudioChannelLayout_4_1 , fplAudioChannelLayout_5_0_Surround , fplAudioChannelLayout_5_1 , fplAudioChannelLayout_6_1 ,
fplAudioChannelLayout_7_1 , fplAudioChannelLayout_First , fplAudioChannelLayout_Last
}
An enumeration of audio channel layouts. More...
enum fplAudioChannelType {
fplAudioChannelType_None , fplAudioChannelType_FrontLeft , fplAudioChannelType_FrontRight , fplAudioChannelType_FrontCenter ,
fplAudioChannelType_LowFrequency , fplAudioChannelType_BackLeft , fplAudioChannelType_BackRight , fplAudioChannelType_FrontLeftOfCenter ,
fplAudioChannelType_FrontRightOfCenter , fplAudioChannelType_BackCenter , fplAudioChannelType_SideLeft , fplAudioChannelType_SideRight ,
fplAudioChannelType_TopCenter , fplAudioChannelType_TopFrontLeft , fplAudioChannelType_TopFrontCenter , fplAudioChannelType_TopFrontRight ,
fplAudioChannelType_TopBackLeft , fplAudioChannelType_TopBackCenter , fplAudioChannelType_TopBackRight , fplAudioChannelType_AUX0 ,
fplAudioChannelType_AUX1 , fplAudioChannelType_AUX2 , fplAudioChannelType_AUX3 , fplAudioChannelType_AUX4 ,
fplAudioChannelType_AUX5 , fplAudioChannelType_AUX6 , fplAudioChannelType_AUX7 , fplAudioChannelType_AUX8 ,
fplAudioChannelType_AUX9 , fplAudioChannelType_AUX10 , fplAudioChannelType_AUX11 , fplAudioChannelType_AUX12 ,
fplAudioChannelType_AUX13 , fplAudioChannelType_AUX14 , fplAudioChannelType_AUX15 , fplAudioChannelType_First ,
fplAudioChannelType_Last
}
An enumeration of audio channel types. More...
enum fplAudioDefaultFields {
fplAudioDefaultFields_None , fplAudioDefaultFields_BufferSize , fplAudioDefaultFields_SampleRate , fplAudioDefaultFields_Channels ,
fplAudioDefaultFields_Periods , fplAudioDefaultFields_Type , fplAudioDefaultFields_ChannelLayout
}
An enumeration of audio default fields. More...
enum fplAudioFormatType {
fplAudioFormatType_None , fplAudioFormatType_U8 , fplAudioFormatType_S16 , fplAudioFormatType_S24 ,
fplAudioFormatType_S32 , fplAudioFormatType_S64 , fplAudioFormatType_F32 , fplAudioFormatType_F64 ,
fplAudioFormatType_First , fplAudioFormatType_Last
}
An enumeration of audio format types. More...
enum fplAudioLatencyType { fplAudioLatencyType_Conservative , fplAudioLatencyType_Low }
fplAudioDefaultFields operator overloads for C++. More...
enum fplAudioMode { fplAudioMode_Shared_Conservative , fplAudioMode_Exclusive_Conservative , fplAudioMode_Shared_LowLatency , fplAudioMode_Exclusive_LowLatency }
An enumeration of audio modes that combines conservative/latency and exclusive/shared. More...
enum fplAudioResultType {
fplAudioResultType_None , fplAudioResultType_Success , fplAudioResultType_InvalidArguments , fplAudioResultType_SystemNotInitialized ,
fplAudioResultType_DeviceNotInitialized , fplAudioResultType_DeviceAlreadyStopped , fplAudioResultType_DeviceAlreadyStarted , fplAudioResultType_DeviceBusy ,
fplAudioResultType_DeviceFailure , fplAudioResultType_NoDeviceFound , fplAudioResultType_DeviceByIdNotFound , fplAudioResultType_ApiFailed ,
fplAudioResultType_PlatformNotInitialized , fplAudioResultType_BackendAlreadyInitialized , fplAudioResultType_NoBackendsFound , fplAudioResultType_UnsetAudioFormat ,
fplAudioResultType_UnsetAudioChannels , fplAudioResultType_UnsetAudioSampleRate , fplAudioResultType_UnsetAudioBufferSize , fplAudioResultType_UnsuportedDeviceFormat ,
fplAudioResultType_OutOfMemory , fplAudioResultType_NotImplemented , fplAudioResultType_Failed , fplAudioResultType_First ,
fplAudioResultType_Last
}
An enumeration of audio results. More...
enum fplAudioShareMode { fplAudioShareMode_Shared , fplAudioShareMode_Exclusive }
An enumeration of audio share modes. More...
enum fplButtonState { fplButtonState_Release , fplButtonState_Press , fplButtonState_Repeat }
An enumeration of button states. More...
enum fplCPUArchType {
fplCPUArchType_Unknown , fplCPUArchType_x86 , fplCPUArchType_x86_64 , fplCPUArchType_x64 ,
fplCPUArchType_Arm32 , fplCPUArchType_Arm64 , fplCPUArchType_First , fplCPUArchType_Last
}
An enumeration of architecture types. More...
enum fplCPUCapabilitiesType {
fplCPUCapabilitiesType_Unknown , fplCPUCapabilitiesType_X86 , fplCPUCapabilitiesType_ARM , fplCPUCapabilitiesType_First ,
fplCPUCapabilitiesType_Last
}
An enumeration of CPU types. More...
enum fplDateTimeErrors {
fplDateTimeErrors_None , fplDateTimeErrors_InvalidYear , fplDateTimeErrors_InvalidMonth , fplDateTimeErrors_InvalidDay ,
fplDateTimeErrors_InvalidHour , fplDateTimeErrors_InvalidMinute , fplDateTimeErrors_InvalidSecond
}
Defines the date time error flags. More...
enum fplDateTimeType { fplDateTimeType_UTC , fplDateTimeType_Local }
Defines the date time types. More...
enum fplEndianessType { fplEndianessType_Little , fplEndianessType_Big }
Sentinel values used to detect the byte order of the host platform at runtime. More...
enum fplEventType {
fplEventType_None , fplEventType_Window , fplEventType_Keyboard , fplEventType_Mouse ,
fplEventType_Gamepad
}
An enumeration of event types (Window, Keyboard, Mouse, etc.). More...
enum fplFileAttributeFlags {
fplFileAttributeFlags_None , fplFileAttributeFlags_Normal , fplFileAttributeFlags_Hidden , fplFileAttributeFlags_System ,
fplFileAttributeFlags_Archive
}
An enumeration of file attribute flags (Normal, Readonly, Hidden, etc.). More...
enum fplFileEntryType { fplFileEntryType_Unknown , fplFileEntryType_File , fplFileEntryType_Directory }
An enumeration of file entry types (File, Directory, etc.). More...
enum fplFilePermissionFlags { fplFilePermissionFlags_All , fplFilePermissionFlags_CanExecuteSearch , fplFilePermissionFlags_CanWrite , fplFilePermissionFlags_CanRead }
An enumeration of file permission flags. More...
enum fplFilePermissionMasks { fplFilePermissionMasks_None , fplFilePermissionMasks_User , fplFilePermissionMasks_Group , fplFilePermissionMasks_Owner }
fplFilePermissionFlags operator overloads for C++. More...
enum fplFilePositionMode { fplFilePositionMode_Beginning , fplFilePositionMode_Current , fplFilePositionMode_End }
An enumeration of file position modes (Beginning, Current, End). More...
enum fplGamepadAxisSign { fplGamepadAxisSign_Full , fplGamepadAxisSign_Positive , fplGamepadAxisSign_Negative }
Half-axis selector used when an axis source is bound with the SDL +/- prefixes. More...
enum fplGamepadAxisType {
fplGamepadAxisType_LeftX , fplGamepadAxisType_LeftY , fplGamepadAxisType_RightX , fplGamepadAxisType_RightY ,
fplGamepadAxisType_LeftTrigger , fplGamepadAxisType_RightTrigger , fplGamepadAxisType_Count
}
Logical analog axis slots filled by a fplGamepadMapping. More...
enum fplGamepadButtonType {
fplGamepadButtonType_DPadUp , fplGamepadButtonType_DPadRight , fplGamepadButtonType_DPadDown , fplGamepadButtonType_DPadLeft ,
fplGamepadButtonType_ActionA , fplGamepadButtonType_ActionB , fplGamepadButtonType_ActionX , fplGamepadButtonType_ActionY ,
fplGamepadButtonType_Start , fplGamepadButtonType_Back , fplGamepadButtonType_LeftThumb , fplGamepadButtonType_RightThumb ,
fplGamepadButtonType_LeftShoulder , fplGamepadButtonType_RightShoulder
}
An enumeration of gamepad buttons. More...
enum fplGamepadEventType { fplGamepadEventType_None , fplGamepadEventType_Connected , fplGamepadEventType_Disconnected , fplGamepadEventType_StateChanged }
An enumeration of gamepad event types (Connected, Disconnected, StateChanged, etc.). More...
enum fplGamepadInputType { fplGamepadInputType_None , fplGamepadInputType_Button , fplGamepadInputType_Axis , fplGamepadInputType_Hat }
Source kind referenced by a single fplGamepadInputBinding. More...
enum fplGamepadPlatform {
fplGamepadPlatform_Unknown , fplGamepadPlatform_Windows , fplGamepadPlatform_Linux , fplGamepadPlatform_MacOS ,
fplGamepadPlatform_Android , fplGamepadPlatform_iOS
}
Target platform tag of a fplGamepadMapping (mirrors the SDL platform: field). More...
enum fplImageType { fplImageType_None , fplImageType_RGBA }
An enumeration of image types. More...
enum fplInitFlags {
fplInitFlags_None , fplInitFlags_Console , fplInitFlags_Window , fplInitFlags_Video ,
fplInitFlags_Audio , fplInitFlags_Gamepad , fplInitFlags_Keyboard , fplInitFlags_Mouse ,
fplInitFlags_Input , fplInitFlags_All
}
An enumeration of initialization flags. More...
enum fplInputBackendType {
fplInputBackendType_None , fplInputBackendType_Auto , fplInputBackendType_XInput , fplInputBackendType_DInput ,
fplInputBackendType_LinuxJoystick , fplInputBackendType_X11Kbm , fplInputBackendType_Win32 , fplInputBackendType_First ,
fplInputBackendType_Last
}
InputSourceType operator overloads for C++. More...
enum fplInputConnectionState { fplInputConnectionState_Unknown , fplInputConnectionState_Disconnected , fplInputConnectionState_Connected }
InputDeviceFeatureFlags operator overloads for C++. More...
enum fplInputDeviceFeatureFlags { fplInputDeviceFeatureFlags_None , fplInputDeviceFeatureFlags_Polling , fplInputDeviceFeatureFlags_Events , fplInputDeviceFeatureFlags_Hotplug }
Bitmask describing the features a single fplInputDevice supports. More...
enum fplInputSourceType {
fplInputSourceType_None , fplInputSourceType_Keyboard , fplInputSourceType_Mouse , fplInputSourceType_Gamepad ,
fplInputSourceType_All
}
A bitmask of input source kinds (keyboard, mouse, gamepad). More...
enum fplKey {
fplKey_None , fplKey_Backspace , fplKey_Tab , fplKey_Clear ,
fplKey_Return , fplKey_Shift , fplKey_Control , fplKey_Alt ,
fplKey_Pause , fplKey_CapsLock , fplKey_Escape , fplKey_Space ,
fplKey_PageUp , fplKey_PageDown , fplKey_End , fplKey_Home ,
fplKey_Left , fplKey_Up , fplKey_Right , fplKey_Down ,
fplKey_Select , fplKey_Print , fplKey_Execute , fplKey_Snapshot ,
fplKey_Insert , fplKey_Delete , fplKey_Help , fplKey_0 ,
fplKey_1 , fplKey_2 , fplKey_3 , fplKey_4 ,
fplKey_5 , fplKey_6 , fplKey_7 , fplKey_8 ,
fplKey_9 , fplKey_A , fplKey_B , fplKey_C ,
fplKey_D , fplKey_E , fplKey_F , fplKey_G ,
fplKey_H , fplKey_I , fplKey_J , fplKey_K ,
fplKey_L , fplKey_M , fplKey_N , fplKey_O ,
fplKey_P , fplKey_Q , fplKey_R , fplKey_S ,
fplKey_T , fplKey_U , fplKey_V , fplKey_W ,
fplKey_X , fplKey_Y , fplKey_Z , fplKey_LeftSuper ,
fplKey_RightSuper , fplKey_Apps , fplKey_Sleep , fplKey_NumPad0 ,
fplKey_NumPad1 , fplKey_NumPad2 , fplKey_NumPad3 , fplKey_NumPad4 ,
fplKey_NumPad5 , fplKey_NumPad6 , fplKey_NumPad7 , fplKey_NumPad8 ,
fplKey_NumPad9 , fplKey_Multiply , fplKey_Add , fplKey_Separator ,
fplKey_Substract , fplKey_Decimal , fplKey_Divide , fplKey_F1 ,
fplKey_F2 , fplKey_F3 , fplKey_F4 , fplKey_F5 ,
fplKey_F6 , fplKey_F7 , fplKey_F8 , fplKey_F9 ,
fplKey_F10 , fplKey_F11 , fplKey_F12 , fplKey_F13 ,
fplKey_F14 , fplKey_F15 , fplKey_F16 , fplKey_F17 ,
fplKey_F18 , fplKey_F19 , fplKey_F20 , fplKey_F21 ,
fplKey_F22 , fplKey_F23 , fplKey_F24 , fplKey_NumLock ,
fplKey_Scroll , fplKey_LeftShift , fplKey_RightShift , fplKey_LeftControl ,
fplKey_RightControl , fplKey_LeftAlt , fplKey_RightAlt , fplKey_VolumeMute ,
fplKey_VolumeDown , fplKey_VolumeUp , fplKey_MediaNextTrack , fplKey_MediaPrevTrack ,
fplKey_MediaStop , fplKey_MediaPlayPause , fplKey_Oem1 , fplKey_OemPlus ,
fplKey_OemComma , fplKey_OemMinus , fplKey_OemPeriod , fplKey_Oem2 ,
fplKey_Oem3 , fplKey_Oem4 , fplKey_Oem5 , fplKey_Oem6 ,
fplKey_Oem7 , fplKey_Oem8 , fplKey_Last , fplKey_First
}
An enumeration of mapped keys (Based on MS Virtual-Key-Codes, mostly directly mapped from ASCII). More...
enum fplKeyboardEventType { fplKeyboardEventType_None , fplKeyboardEventType_Button , fplKeyboardEventType_Input }
An enumeration of keyboard event types. More...
enum fplKeyboardModifierFlags {
fplKeyboardModifierFlags_None , fplKeyboardModifierFlags_LAlt , fplKeyboardModifierFlags_RAlt , fplKeyboardModifierFlags_LCtrl ,
fplKeyboardModifierFlags_RCtrl , fplKeyboardModifierFlags_LShift , fplKeyboardModifierFlags_RShift , fplKeyboardModifierFlags_LSuper ,
fplKeyboardModifierFlags_RSuper , fplKeyboardModifierFlags_CapsLock , fplKeyboardModifierFlags_NumLock , fplKeyboardModifierFlags_ScrollLock
}
An enumeration of keyboard modifier flags. More...
enum fplLocaleFormat { fplLocaleFormat_None , fplLocaleFormat_ISO639 }
An enumeration of locale formats. More...
enum fplLogLevel {
fplLogLevel_All , fplLogLevel_Critical , fplLogLevel_Error , fplLogLevel_Warning ,
fplLogLevel_Info , fplLogLevel_Verbose , fplLogLevel_Debug , fplLogLevel_Trace ,
fplLogLevel_First , fplLogLevel_Last
}
An enumeration of log levels. More...
enum fplLogWriterFlags {
fplLogWriterFlags_None , fplLogWriterFlags_StandardConsole , fplLogWriterFlags_ErrorConsole , fplLogWriterFlags_DebugOut ,
fplLogWriterFlags_Custom
}
An enumeration of log writer flags. More...
enum fplMemoryAllocationMode { fplMemoryAllocationMode_Automatic , fplMemoryAllocationMode_Custom }
An enumeration of dynamic memory allocation modes. More...
enum fplMouseButtonType {
fplMouseButtonType_None , fplMouseButtonType_Left , fplMouseButtonType_Right , fplMouseButtonType_Middle ,
fplMouseButtonType_X1 , fplMouseButtonType_X2 , fplMouseButtonType_MaxCount
}
An enumeration of mouse button types (Left, Right, etc.). More...
enum fplMouseEventType { fplMouseEventType_None , fplMouseEventType_Move , fplMouseEventType_Button , fplMouseEventType_Wheel }
An enumeration of mouse event types (Move, ButtonDown, etc.). More...
enum fplOpenGLCompatibilityFlags { fplOpenGLCompatibilityFlags_Legacy , fplOpenGLCompatibilityFlags_Core , fplOpenGLCompatibilityFlags_Compatibility , fplOpenGLCompatibilityFlags_Forward }
An enumeration of OpenGL compatibility flags. More...
enum fplPlatformResultType {
fplPlatformResultType_FailedWindow , fplPlatformResultType_FailedAudio , fplPlatformResultType_FailedVideo , fplPlatformResultType_FailedPlatform ,
fplPlatformResultType_OutOfMemory , fplPlatformResultType_AlreadyInitialized , fplPlatformResultType_NotInitialized , fplPlatformResultType_Success ,
fplPlatformResultType_First , fplPlatformResultType_Last
}
An enumeration of platform result types. More...
enum fplPlatformType {
fplPlatformType_Unknown , fplPlatformType_Windows , fplPlatformType_Linux , fplPlatformType_Unix ,
fplPlatformType_First , fplPlatformType_Last
}
InitFlags operator overloads for C++. More...
enum fplSignalValue { fplSignalValue_Unset , fplSignalValue_Set }
An enumeration of signal values. More...
enum fplThreadPriority {
fplThreadPriority_Unknown , fplThreadPriority_Idle , fplThreadPriority_Low , fplThreadPriority_Normal ,
fplThreadPriority_High , fplThreadPriority_RealTime , fplThreadPriority_Lowest , fplThreadPriority_Highest ,
fplThreadPriority_First , fplThreadPriority_Last
}
Defines all possible thread priorities. More...
enum fplThreadStates { fplThreadState_Stopped , fplThreadState_Starting , fplThreadState_Running , fplThreadState_Stopping }
An enumeration of thread states. More...
enum fplVideoBackendType {
fplVideoBackendType_None , fplVideoBackendType_Software , fplVideoBackendType_OpenGL , fplVideoBackendType_Vulkan ,
fplVideoBackendType_First , fplVideoBackendType_Last
}
An enumeration of video backend types. More...
enum fplVulkanValidationLayerMode { fplVulkanValidationLayerMode_Disabled , fplVulkanValidationLayerMode_Optional , fplVulkanValidationLayerMode_Required }
An enumeration of Vulkan validation layer modes. More...
enum fplVulkanValidationSeverity {
fplVulkanValidationSeverity_Off , fplVulkanValidationSeverity_Error , fplVulkanValidationSeverity_Warning , fplVulkanValidationSeverity_Info ,
fplVulkanValidationSeverity_Verbose , fplVulkanValidationSeverity_All
}
An enumeration of Vulkan validation layer logging severity. More...
enum fplWindowEventType {
fplWindowEventType_None , fplWindowEventType_Resized , fplWindowEventType_GotFocus , fplWindowEventType_LostFocus ,
fplWindowEventType_Minimized , fplWindowEventType_Maximized , fplWindowEventType_Restored , fplWindowEventType_DroppedFiles ,
fplWindowEventType_Exposed , fplWindowEventType_PositionChanged , fplWindowEventType_Closed , fplWindowEventType_Shown ,
fplWindowEventType_Hidden
}
An enumeration of window event types (Resized, PositionChanged, etc.). More...
enum fplWindowState {
fplWindowState_Unknown , fplWindowState_Normal , fplWindowState_Iconify , fplWindowState_Maximize ,
fplWindowState_Fullscreen
}
An enumeration containing the states of a window. More...
enum fplWindowVisibilityState { fplWindowVisibilityState_Unknown , fplWindowVisibilityState_Show , fplWindowVisibilityState_Hide }
An enumeration containing the visibility state of a window. More...
enum fplX86InstructionSetLevel {
fplX86InstructionSetLevel_None , fplX86InstructionSetLevel_IA32 , fplX86InstructionSetLevel_SSE , fplX86InstructionSetLevel_SSE2 ,
fplX86InstructionSetLevel_SSE3 , fplX86InstructionSetLevel_SSSE3 , fplX86InstructionSetLevel_SSE4_1 , fplX86InstructionSetLevel_SSE4_2 ,
fplX86InstructionSetLevel_AVX , fplX86InstructionSetLevel_AVX2 , fplX86InstructionSetLevel_AVX512
}
Defines the X86 instruction sets up to AVX512. More...

Functions

Type Name
fpl_common_api void * fplAtomicAddAndFetchPtr (volatile void **dest, const intptr_t addend)
Adds the addend to destination pointer atomically and returns the result after the addition.
fpl_platform_api int32_t fplAtomicAddAndFetchS32 (volatile int32_t *dest, const int32_t addend)
Adds the addend to destination 32-bit signed integer atomically and returns the result after the addition.
fpl_platform_api int64_t fplAtomicAddAndFetchS64 (volatile int64_t *dest, const int64_t addend)
Adds the addend to destination 64-bit signed integer atomically and returns the result after the addition.
fpl_common_api size_t fplAtomicAddAndFetchSize (volatile size_t *dest, const size_t addend)
Adds the addend to destination size atomically and returns the result after the addition.
fpl_platform_api uint32_t fplAtomicAddAndFetchU32 (volatile uint32_t *dest, const uint32_t addend)
Adds the addend to destination 32-bit unsigned integer atomically and returns the result after the addition.
fpl_platform_api uint64_t fplAtomicAddAndFetchU64 (volatile uint64_t *dest, const uint64_t addend)
Adds the addend to destination 64-bit unsigned integer atomically and returns the result after the addition.
fpl_common_api void * fplAtomicCompareAndSwapPtr (volatile void **dest, const void *comparand, const void *exchange)
Compares a pointer with a comparand and swaps it when comparand matches the destination.
fpl_platform_api int32_t fplAtomicCompareAndSwapS32 (volatile int32_t *dest, const int32_t comparand, const int32_t exchange)
Compares a 32-bit signed integer with a comparand and swaps it when comparand matches the destination.
fpl_platform_api int64_t fplAtomicCompareAndSwapS64 (volatile int64_t *dest, const int64_t comparand, const int64_t exchange)
Compares a 64-bit signed integer with a comparand and swaps it when comparand matches the destination.
fpl_common_api size_t fplAtomicCompareAndSwapSize (volatile size_t *dest, const size_t comparand, const size_t exchange)
Compares a size with a comparand and swaps it when comparand matches the destination.
fpl_platform_api uint32_t fplAtomicCompareAndSwapU32 (volatile uint32_t *dest, const uint32_t comparand, const uint32_t exchange)
Compares a 32-bit unsigned integer with a comparand and swaps it when comparand matches the destination.
fpl_platform_api uint64_t fplAtomicCompareAndSwapU64 (volatile uint64_t *dest, const uint64_t comparand, const uint64_t exchange)
Compares a 64-bit unsigned integer with a comparand and swaps it when comparand matches the destination.
fpl_common_api void * fplAtomicExchangePtr (volatile void **target, const void *value)
Replaces a pointer with the given value atomically.
fpl_platform_api int32_t fplAtomicExchangeS32 (volatile int32_t *target, const int32_t value)
Replaces a 32-bit signed integer with the given value atomically.
fpl_platform_api int64_t fplAtomicExchangeS64 (volatile int64_t *target, const int64_t value)
Replaces a 64-bit signed integer with the given value atomically.
fpl_common_api size_t fplAtomicExchangeSize (volatile size_t *target, const size_t value)
Replaces a size with the given value atomically.
fpl_platform_api uint32_t fplAtomicExchangeU32 (volatile uint32_t *target, const uint32_t value)
Replaces a 32-bit unsigned integer with the given value atomically.
fpl_platform_api uint64_t fplAtomicExchangeU64 (volatile uint64_t *target, const uint64_t value)
Replaces a 64-bit unsigned integer with the given value atomically.
fpl_common_api void * fplAtomicFetchAndAddPtr (volatile void **dest, const intptr_t addend)
Adds a addend to the pointer atomically and returns the initial value before the add.
fpl_platform_api int32_t fplAtomicFetchAndAddS32 (volatile int32_t *value, const int32_t addend)
Adds a 32-bit signed integer to the value by the given addend atomically.
fpl_platform_api int64_t fplAtomicFetchAndAddS64 (volatile int64_t *value, const int64_t addend)
Adds a 64-bit signed integer to the value by the given addend atomically.
fpl_common_api size_t fplAtomicFetchAndAddSize (volatile size_t *dest, const size_t addend)
Adds a size to the value by the given addend atomically.
fpl_platform_api uint32_t fplAtomicFetchAndAddU32 (volatile uint32_t *value, const uint32_t addend)
Adds a 32-bit unsigned integer to the value by the given addend atomically.
fpl_platform_api uint64_t fplAtomicFetchAndAddU64 (volatile uint64_t *value, const uint64_t addend)
Adds a 64-bit unsigned integer to the value by the given addend atomically.
fpl_common_api void * fplAtomicIncrementPtr (volatile void **dest)
Increments/Advances the given pointer by one atomically.
fpl_platform_api int32_t fplAtomicIncrementS32 (volatile int32_t *dest)
Increments the given 32-bit signed integer by one atomically.
fpl_platform_api int64_t fplAtomicIncrementS64 (volatile int64_t *dest)
Increments the given 64-bit signed integer by one atomically.
fpl_common_api size_t fplAtomicIncrementSize (volatile size_t *dest)
Increments the given size by one atomically.
fpl_platform_api uint32_t fplAtomicIncrementU32 (volatile uint32_t *dest)
Increments the given 32-bit unsigned integer by one atomically.
fpl_platform_api uint64_t fplAtomicIncrementU64 (volatile uint64_t *dest)
Increments the given 64-bit unsigned integer by one atomically.
fpl_common_api bool fplAtomicIsCompareAndSwapPtr (volatile void **dest, const void *comparand, const void *exchange)
Compares a pointer with a comparand and swaps it when comparand matches the destination and returns a bool indicating the result.
fpl_platform_api bool fplAtomicIsCompareAndSwapS32 (volatile int32_t *dest, const int32_t comparand, const int32_t exchange)
Compares a 32-bit signed integer with a comparand and swaps it when comparand matches the destination and returns a bool indicating the result.
fpl_platform_api bool fplAtomicIsCompareAndSwapS64 (volatile int64_t *dest, const int64_t comparand, const int64_t exchange)
Compares a 64-bit signed integer with a comparand and swaps it when comparand matches the destination and returns a bool indicating the result.
fpl_common_api bool fplAtomicIsCompareAndSwapSize (volatile size_t *dest, const size_t comparand, const size_t exchange)
Compares a size with a comparand and swaps it when comparand matches the destination and returns a bool indicating the result.
fpl_platform_api bool fplAtomicIsCompareAndSwapU32 (volatile uint32_t *dest, const uint32_t comparand, const uint32_t exchange)
Compares a 32-bit unsigned integer with a comparand and swaps it when comparand matches the destination and returns a bool indicating the result.
fpl_platform_api bool fplAtomicIsCompareAndSwapU64 (volatile uint64_t *dest, const uint64_t comparand, const uint64_t exchange)
Compares a 64-bit unsigned integer with a comparand and swaps it when comparand matches the destination and returns a bool indicating the result.
fpl_common_api void * fplAtomicLoadPtr (volatile void **source)
Loads the pointer value atomically and returns the value.
fpl_platform_api int32_t fplAtomicLoadS32 (volatile int32_t *source)
Loads the 32-bit signed value atomically and returns the value.
fpl_platform_api int64_t fplAtomicLoadS64 (volatile int64_t *source)
Loads the 64-bit signed value atomically and returns the value.
fpl_common_api size_t fplAtomicLoadSize (volatile size_t *source)
Loads the size value atomically and returns the value.
fpl_platform_api uint32_t fplAtomicLoadU32 (volatile uint32_t *source)
Loads the 32-bit unsigned value atomically and returns the value.
fpl_platform_api uint64_t fplAtomicLoadU64 (volatile uint64_t *source)
Loads the 64-bit unsigned value atomically and returns the value.
fpl_platform_api void fplAtomicReadFence (void)
Inserts a memory read fence/barrier.
fpl_platform_api void fplAtomicReadWriteFence (void)
Inserts a memory read and write fence/barrier.
fpl_common_api void fplAtomicStorePtr (volatile void **dest, const void *value)
Overwrites the pointer value atomically.
fpl_platform_api void fplAtomicStoreS32 (volatile int32_t *dest, const int32_t value)
Overwrites the 32-bit signed value atomically.
fpl_platform_api void fplAtomicStoreS64 (volatile int64_t *dest, const int64_t value)
Overwrites the 64-bit signed value atomically.
fpl_common_api void fplAtomicStoreSize (volatile size_t *dest, const size_t value)
Overwrites the size value atomically.
fpl_platform_api void fplAtomicStoreU32 (volatile uint32_t *dest, const uint32_t value)
Overwrites the 32-bit unsigned value atomically.
fpl_platform_api void fplAtomicStoreU64 (volatile uint64_t *dest, const uint64_t value)
Overwrites the 64-bit unsigned value atomically.
fpl_platform_api void fplAtomicWriteFence (void)
Inserts a memory write fence/barrier.
fpl_common_api fplAudioResultType fplAudioInit (fplAudioSettings *audioSettings)
Re/Initializes the audio system with the specified audio settings.
fpl_common_api bool fplAudioRelease (void)
Unloads/Releases the audio system.
fpl_common_api size_t fplChangeFileExtension (const char *filePath, const char *newFileExtension, char *destPath, const size_t maxDestLen)
Changes the file extension on the given source path and writes the result into a destination buffer.
fpl_platform_api bool fplConditionBroadcast (fplConditionVariable *condition)
Wakes up all threads that wait on the given condition.
fpl_platform_api void fplConditionDestroy (fplConditionVariable *condition)
Releases the given condition and clears the structure to zero.
fpl_platform_api bool fplConditionInit (fplConditionVariable *condition)
Initializes the given condition.
fpl_platform_api bool fplConditionSignal (fplConditionVariable *condition)
Wakes up one thread that waits on the given condition.
fpl_platform_api bool fplConditionWait (fplConditionVariable *condition, fplMutexHandle *mutex, const fplTimeoutValue timeout)
Sleeps on the given condition and releases the mutex when done.
fpl_platform_api void fplConsoleError (const char *text)
Writes the given text to the standard error console buffer.
fpl_common_api void fplConsoleFormatError (const char *format,...)
Writes the given formatted text to the standard error console buffer.
fpl_common_api void fplConsoleFormatOut (const char *format,...)
Writes the given formatted text to the standard output console buffer.
fpl_platform_api void fplConsoleOut (const char *text)
Writes the given text to the standard output console buffer.
fpl_platform_api char fplConsoleWaitForCharInput (void)
Waits for a character to be typed in the console input and returns it.
fpl_common_api size_t fplCopyString (const char *source, char *dest, const size_t maxDestLen)
Copies the given source string into a destination string.
fpl_common_api size_t fplCopyStringLen (const char *source, const size_t sourceLen, char *dest, const size_t maxDestLen)
Copies the given source string with a constrained length into a destination string.
fpl_platform_api fplCPUArchType fplCPUGetArchitecture (void)
Gets the processor architecture type.
fpl_common_api const char * fplCPUGetArchName (const fplCPUArchType type)
Gets the string representation of the given architecture type.
fpl_common_api bool fplCPUGetCapabilities (fplCPUCapabilities *outCaps)
Gets the capabilities of the processor.
fpl_platform_api size_t fplCPUGetCoreCount (void)
Retrieves the total number of processor cores.
fpl_common_api size_t fplCPUGetName (char *destBuffer, const size_t maxDestBufferLen)
Retrieves the name of the processor.
fpl_common_api bool fplCPUID (const uint32_t functionId, fplCPUIDLeaf *outLeaf)
Queries the x86 CPUID leaf register (EAX, EBX, ECX, EDX) for the given function id.
fpl_common_api uint64_t fplCPURDTSC (void)
Reads the current time stamp counter (RDTSC).
fpl_common_api uint64_t fplCPUXCR0 (void)
Gets the x86 extended control register for index zero.
fpl_common_api fplAudioMode fplCreateAudioMode (const fplAudioLatencyType latencyType, const fplAudioShareMode shareMode)
Creates an audio mode from the specified audio latency type and share mode.
fpl_common_api fplColor32 fplCreateColorRGBA (const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t a)
Creates a 32-bit color structure from the specified R, G, B, A components.
fpl_common_api fplVideoRect fplCreateVideoRectFromLTRB (int32_t left, int32_t top, int32_t right, int32_t bottom)
Makes a video rectangle from a LTRB rectangle.
fpl_common_api fplDateTimeCreationResult fplDateTimeCreate (const uint16_t year, const uint8_t month, const uint8_t day, const uint8_t hour, const uint8_t minute, const uint8_t second, const uint16_t millisecond, const int32_t utcOffset)
Creates a date time from the specified date time components and UTC offset.
fpl_platform_api fplDateTime fplDateTimeQuery (const fplDateTimeType type)
Gets the current date and time in the specified format (UTC or local).
fpl_common_api void fplDebugFormatOut (const char *format,...)
Writes the given formatted text into the debugger output stream.
fpl_platform_api void fplDebugOut (const char *text)
Writes the given text into the debugger output stream.
fpl_common_api bool fplDecodeAudioFormatU64 (const fplAudioFormatU64 format64, uint32_t *outSampleRate, uint16_t *outChannels, fplAudioFormatType *outType)
Decodes the specified encoded audio format to the specified sample rate, channels, and type.
fpl_platform_api bool fplDirectoriesCreate (const char *path)
Creates all the directories in the given path.
fpl_platform_api bool fplDirectoryExists (const char *path)
Checks if the given directory exists and returns a boolean indicating its existence.
fpl_platform_api bool fplDirectoryListBegin (const char *path, const char *filter, fplFileEntry *entry)
Iterates through files/directories in the given directory.
fpl_platform_api void fplDirectoryListEnd (fplFileEntry *entry)
Releases opened resources from iterating through files/directories.
fpl_platform_api bool fplDirectoryListNext (fplFileEntry *entry)
Gets the next file entry from iterating through files/directories.
fpl_platform_api bool fplDirectoryRemove (const char *path)
Deletes the given empty directory without confirmation and returns true when the deletion was successful.
fpl_platform_api bool fplDisableWindowFullscreen (void)
Switches the window back to window mode.
fpl_platform_api bool fplDynamicLibraryLoad (const char *libraryFilePath, fplDynamicLibraryHandle *outHandle)
Loads a dynamic library and returns if the load was successful or not.
fpl_platform_api void fplDynamicLibraryUnload (fplDynamicLibraryHandle *handle)
Unloads the loaded library and resets the handle to zero.
fpl_platform_api bool fplEnableWindowFullscreen (void)
Enables fullscreen mode on the nearest display.
fpl_common_api fplAudioFormatU64 fplEncodeAudioFormatU64 (const uint32_t sampleRate, const uint16_t channels, const fplAudioFormatType type)
Creates an encoded audio format from the specified sample rate, channels, and type.
fpl_common_api size_t fplEnforcePathSeparator (char *path)
Ensures that the given string always ends with a path separator.
fpl_common_api size_t fplEnforcePathSeparatorLen (char *path, size_t maxPathLen)
Ensures that the given string always ends with a path separator with length constrained.
fpl_common_api void fplErrorsClear (void)
Clears all the current errors in the platform.
fpl_common_api const char * fplExtractFileExtension (const char *sourcePath)
Extracts the file extension from the given source path.
fpl_common_api const char * fplExtractFileName (const char *sourcePath)
Extracts the file name including the file extension from the given source path.
fpl_common_api size_t fplExtractFilePath (const char *sourcePath, char *destPath, const size_t maxDestLen)
Extracts the directory path from the given file path.
fpl_platform_api bool fplFileAppendBinary (const char *filePath, fplFileHandle *outHandle)
Creates or appends a binary file by the given string path and returns the handle of it.
fpl_platform_api void fplFileClose (fplFileHandle *fileHandle)
Closes the given file and releases the underlying resources and clears the handle to zero.
fpl_platform_api bool fplFileCopy (const char *sourceFilePath, const char *targetFilePath, const bool overwrite)
Copies the given source file to the target path and returns true when the copy was successful.
fpl_platform_api bool fplFileCreateBinary (const char *filePath, fplFileHandle *outHandle)
Creates a binary file for writing to the given string path and returns the handle of it.
fpl_platform_api bool fplFileDelete (const char *filePath)
Deletes the given file without confirmation and returns true when the deletion was successful.
fpl_platform_api bool fplFileExists (const char *filePath)
Checks if the file exists and returns a boolean indicating the existence.
fpl_platform_api bool fplFileFlush (fplFileHandle *fileHandle)
Flushes the buffers of the given file and causes all buffered data to be written to a file.
fpl_common_api size_t fplFileGetPosition (const fplFileHandle *fileHandle)
Gets the current file position in bytes.
fpl_platform_api uint32_t fplFileGetPosition32 (const fplFileHandle *fileHandle)
Gets the current file position in bytes.
fpl_platform_api uint64_t fplFileGetPosition64 (const fplFileHandle *fileHandle)
Gets the current file position in bytes.
fpl_common_api size_t fplFileGetSizeFromHandle (const fplFileHandle *fileHandle)
Gets the file size in bytes for an opened file.
fpl_platform_api uint32_t fplFileGetSizeFromHandle32 (const fplFileHandle *fileHandle)
Gets the file size in bytes for an opened file.
fpl_platform_api uint64_t fplFileGetSizeFromHandle64 (const fplFileHandle *fileHandle)
Gets the file size in bytes for an opened file.
fpl_platform_api size_t fplFileGetSizeFromPath (const char *filePath)
Gets the file size in bytes for the given file.
fpl_platform_api uint32_t fplFileGetSizeFromPath32 (const char *filePath)
Gets the file size in bytes for the given file.
fpl_platform_api uint64_t fplFileGetSizeFromPath64 (const char *filePath)
Gets the file size in bytes for the given file.
fpl_platform_api bool fplFileGetTimestampsFromHandle (const fplFileHandle *fileHandle, fplFileTimeStamps *outStamps)
Gets the timestamps for an opened file.
fpl_platform_api bool fplFileGetTimestampsFromPath (const char *filePath, fplFileTimeStamps *outStamps)
Gets the timestamps for the given file.
fpl_platform_api bool fplFileMove (const char *sourceFilePath, const char *targetFilePath)
Moves the given source file to the target file and returns true when the move was successful.
fpl_platform_api bool fplFileOpenBinary (const char *filePath, fplFileHandle *outHandle)
Opens a binary file for reading from a string path and returns the handle of it.
fpl_platform_api size_t fplFileReadBlock (const fplFileHandle *fileHandle, const size_t sizeToRead, void *targetBuffer, const size_t maxTargetBufferSize)
Reads a block from the given file and returns the number of bytes read.
fpl_platform_api uint32_t fplFileReadBlock32 (const fplFileHandle *fileHandle, const uint32_t sizeToRead, void *targetBuffer, const uint32_t maxTargetBufferSize)
Reads a block from the given file and returns the number of bytes read.
fpl_platform_api uint64_t fplFileReadBlock64 (const fplFileHandle *fileHandle, const uint64_t sizeToRead, void *targetBuffer, const uint64_t maxTargetBufferSize)
Reads a block from the given file and returns the number of bytes read.
fpl_common_api size_t fplFileSetPosition (const fplFileHandle *fileHandle, const intptr_t position, const fplFilePositionMode mode)
Sets the current file position by the given position, depending on the mode it's absolute or relative.
fpl_platform_api uint32_t fplFileSetPosition32 (const fplFileHandle *fileHandle, const int32_t position, const fplFilePositionMode mode)
Sets the current file position by the given position, depending on the mode it's absolute or relative.
fpl_platform_api uint64_t fplFileSetPosition64 (const fplFileHandle *fileHandle, const int64_t position, const fplFilePositionMode mode)
Sets the current file position by the given position, depending on the mode it's absolute or relative.
fpl_platform_api bool fplFileTryGetSizeFromHandle (const fplFileHandle *fileHandle, uint64_t *outSize)
Tries to get the full 64-bit file size in bytes for an opened file, distinguishing a zero-byte file from an error.
fpl_platform_api bool fplFileTryGetSizeFromPath (const char *filePath, uint64_t *outSize)
Tries to get the full 64-bit file size in bytes for the given file, distinguishing a zero-byte file from an error.
fpl_common_api size_t fplFileWriteBlock (const fplFileHandle *fileHandle, const void *sourceBuffer, const size_t sourceSize)
Writes a block to the given file and returns the number of written bytes.
fpl_platform_api uint32_t fplFileWriteBlock32 (const fplFileHandle *fileHandle, const void *sourceBuffer, const uint32_t sourceSize)
Writes a block to the given file and returns the number of written bytes.
fpl_platform_api uint64_t fplFileWriteBlock64 (const fplFileHandle *fileHandle, const void *sourceBuffer, const uint64_t sourceSize)
Writes a block to the given file and returns the number of written bytes.
fpl_common_api bool fplFindInputDevice (const fplInputDeviceGuid *guid, fplInputDevice *outDevice)
Looks up a single device by its GUID.
fpl_platform_api fplDateTimeResult fplFormatDateTime (const fplDateTime dateTime, const fplDateTimeType type)
Formats the date time into the specified format as a fplDateTimeResult.
fpl_common_api bool fplGamepadMappingApply (const fplGamepadMapping *mapping, const fplGamepadData *input, fplGamepadState *outState)
Applies a fplGamepadMapping over a raw device snapshot and writes the result into outState.
fpl_common_api bool fplGamepadMappingApplyDefault (const fplGamepadData *input, fplGamepadState *outState)
Applies the built-in default convention to a raw device snapshot when no mapping is installed.
fpl_common_api const char * fplGetAudioBackendName (const fplAudioBackendType backendType)
Gets the string that represents the given audio backend type.
fpl_common_api fplAudioBackendType fplGetAudioBackendType (void)
Gets the current audio backend type.
fpl_common_api uint32_t fplGetAudioBufferSizeInBytes (const fplAudioFormatType format, const uint16_t channelCount, const uint32_t frameCount)
Computes the total number of bytes for the buffer and the given parameters.
fpl_common_api uint32_t fplGetAudioBufferSizeInFrames (const uint32_t sampleRate, const uint32_t bufferSizeInMilliSeconds)
Computes the total number of frames for a given sample rate and buffer size.
fpl_common_api uint32_t fplGetAudioBufferSizeInMilliseconds (const uint32_t sampleRate, const uint32_t frameCount)
Computes the duration in milliseconds for the given sample rate and frame count.
fpl_common_api bool fplGetAudioChannelMap (fplAudioChannelMap *outMapping)
Gets the audio channels mapping table.
fpl_common_api uint16_t fplGetAudioChannelsFromLayout (const fplAudioChannelLayout channelLayout)
Returns the number of channels from the specified audio channel layout.
fpl_common_api const char * fplGetAudioChannelTypeName (const fplAudioChannelType type)
Audio speaker layout operator overloads for C++.
fpl_common_api bool fplGetAudioDeviceInfo (const fplAudioDeviceID *deviceId, fplAudioDeviceInfo *outDeviceInfo)
Gets the audio device info for the specified audio device ID.
fpl_common_api uint32_t fplGetAudioDevices (const uint32_t maxDeviceCount, const uint32_t deviceInfoSize, fplAudioDeviceInfo *outDevices)
Retrieves all playback audio devices.
fpl_common_api const char * fplGetAudioFormatName (const fplAudioFormatType format)
Gets the string that represents the given audio format type.
fpl_common_api uint32_t fplGetAudioFrameSizeInBytes (const fplAudioFormatType format, const uint16_t channelCount)
Computes the number of bytes required for one interleaved audio frame - containing all the channels.
fpl_common_api bool fplGetAudioHardwareDevice (fplAudioDeviceInfo *outDevice)
Retrieves the audio device info for the current audio device.
fpl_common_api const char * fplGetAudioHardwareDeviceName (void)
Retrieves the audio device name for the current audio device.
fpl_common_api bool fplGetAudioHardwareFormat (fplAudioFormat *outFormat)
Retrieves the native audio format for the current audio device.
fpl_common_api fplAudioLatencyType fplGetAudioLatencyType (const fplAudioMode mode)
Gets the audio latency type from the specified audio mode.
fpl_common_api uint32_t fplGetAudioSampleSizeInBytes (const fplAudioFormatType format)
Computes the number of bytes required to write one sample with one channel.
fpl_common_api fplAudioShareMode fplGetAudioShareMode (const fplAudioMode mode)
Gets the audio share mode from the specified audio mode.
fpl_common_api size_t fplGetAvailableThreadCount (void)
Gets the number of available threads.
fpl_platform_api bool fplGetClipboardText (char *dest, const uint32_t maxDestLen)
Retrieves the current clipboard text.
fpl_common_api const char * fplGetCPUCapabilitiesTypeName (const fplCPUCapabilitiesType type)
Gets the name of the specified fplCPUCapabilitiesType.
fpl_common_api const fplSettings * fplGetCurrentSettings (void)
Gets the current settings.
fpl_platform_api uint64_t fplGetCurrentThreadId (void)
Gets the thread id for the current thread.
fpl_common_api fplAudioChannelLayout fplGetDefaultAudioChannelLayoutFromChannels (const uint16_t channelCount)
Returns the default audio channel layout from the specified channel count.
fpl_platform_api size_t fplGetDisplayCount (void)
Gets the number of active displays.
fpl_platform_api bool fplGetDisplayFromPosition (const int32_t x, const int32_t y, fplDisplayInfo *outInfo)
Finds the display from a cursor position and retrieves the information for it.
fpl_platform_api size_t fplGetDisplayModes (const char *id, fplDisplayMode *outModes, const size_t maxDisplayModeCount)
Gets the information about the available display modes for the given display id.
fpl_platform_api size_t fplGetDisplays (fplDisplayInfo *outDisplays, const size_t maxDisplayCount)
Gets information about all active displays.
fpl_platform_api void * fplGetDynamicLibraryProc (const fplDynamicLibraryHandle *handle, const char *name)
Returns the dynamic library procedure address for the given procedure name.
fpl_common_api const char * fplGetErrorByIndex (const size_t index)
Gets the last error string from the given index.
fpl_common_api size_t fplGetErrorCount (void)
Gets the count of total last errors.
fpl_platform_api size_t fplGetExecutableFilePath (char *destPath, const size_t maxDestLen)
Gets the full path to this executable, including the executable file name.
fpl_common_api uint32_t fplGetGamepadDevices (fplInputDevice *outDevices, const uint32_t maxDevices)
Convenience wrapper that returns devices with fplInputSourceType_Gamepad.
fpl_platform_api size_t fplGetHomePath (char *destPath, const size_t maxDestLen)
Gets the full path to your home directory.
fpl_common_api uint32_t fplGetInputBackendSupport (fplInputBackendSupport *outSupports, const uint32_t maxCount)
Writes capabilities of all known input backends into outSupports.
fpl_common_api bool fplGetInputBackendSupportByType (const fplInputBackendType type, fplInputBackendSupport *outSupport)
Looks up the support descriptor for a single backend type.
fpl_common_api uint32_t fplGetInputDevices (const fplInputSourceType sourceFilter, fplInputDevice *outDevices, const uint32_t maxDevices)
Enumerates all input devices currently known to the input subsystem.
fpl_platform_api size_t fplGetInputLocale (const fplLocaleFormat targetFormat, char *buffer, const size_t maxBufferLen)
Gets the input locale in the given target format.
fpl_common_api uint32_t fplGetKeyboardDevices (fplInputDevice *outDevices, const uint32_t maxDevices)
Convenience wrapper that returns devices with fplInputSourceType_Keyboard.
fpl_common_api const char * fplGetLastError (void)
Gets the last internal error string.
fpl_common_api const fplLogSettings * fplGetLogSettings (void)
Gets the current log settings.
fpl_common_api const fplThreadHandle * fplGetMainThread (void)
Gets the thread handle for the main thread.
fpl_common_api fplLogLevel fplGetMaxLogLevel (void)
Gets the current maximum allowed log level.
fpl_common_api uint32_t fplGetMouseDevices (fplInputDevice *outDevices, const uint32_t maxDevices)
Convenience wrapper that returns devices with fplInputSourceType_Mouse.
fpl_common_api const char * fplGetPlatformName (const fplPlatformType type)
Gets the string representation of the given platform type.
fpl_common_api fplPlatformResultType fplGetPlatformResult (void)
Gets the result type of the platform initialization.
fpl_common_api fplPlatformType fplGetPlatformType (void)
Gets the type of the platform.
fpl_platform_api bool fplGetPrimaryDisplay (fplDisplayInfo *outInfo)
Gets information about the primary display.
fpl_common_api size_t fplGetStringLength (const char *str)
Counts the number of characters without including the zero terminator.
fpl_platform_api size_t fplGetSystemLocale (const fplLocaleFormat targetFormat, char *buffer, const size_t maxBufferLen)
Gets the system locale in the given target format.
fpl_common_api uint32_t fplGetTargetAudioFrameCount (const uint32_t inputFrameCount, const uint32_t inputSampleRate, const uint32_t outputSampleRate)
Computes the target number of audio frames from the specified input frame count and sample rate and the output sample rate.
fpl_platform_api fplThreadPriority fplGetThreadPriority (fplThreadHandle *thread)
Retrieves the current thread priority from the OS for the given thread handle.
fpl_common_api fplThreadState fplGetThreadState (fplThreadHandle *thread)
Gets the current thread state for the given thread.
fpl_common_api size_t fplGetUsedThreadCount (void)
Gets the number of used/active threads.
fpl_platform_api size_t fplGetUserLocale (const fplLocaleFormat targetFormat, char *buffer, const size_t maxBufferLen)
Gets the user locale in the given target format.
fpl_common_api fplVideoBackBuffer * fplGetVideoBackBuffer (void)
Retrieves the pointer to the current video backbuffer.
fpl_common_api const char * fplGetVideoBackendName (fplVideoBackendType backendType)
Gets a string that represents the given video backend.
fpl_common_api fplVideoBackendType fplGetVideoBackendType (void)
Gets the current video backend.
fpl_common_api const void * fplGetVideoProcedure (const char *procName)
Gets the procedure by the specified name from the active video backend.
fpl_common_api bool fplGetVideoRequirements (const fplVideoBackendType backendType, fplVideoRequirements *requirements)
Gets the video requirements for the specified video backend.
fpl_common_api const fplVideoSurface * fplGetVideoSurface (void)
Gets the current video surface that stores all handles used for the active video backend.
fpl_platform_api bool fplGetWindowDisplay (fplDisplayInfo *outInfo)
Gets information about the display for the FPL window.
fpl_platform_api bool fplGetWindowPosition (fplWindowPosition *outPos)
Retrieves the absolute window position.
fpl_platform_api bool fplGetWindowSize (fplWindowSize *outSize)
Retrieves the inner window size.
fpl_platform_api fplWindowState fplGetWindowState (void)
Gets the current window state.
fpl_common_api size_t fplGetWindowTitle (char *outTitle, const size_t maxOutTitleLength)
Retrieves the window title and writes it into the output string.
fpl_common_api void fplInputBackendMaskDisable (fplInputBackendMask *mask, const fplInputBackendType type)
Clears the bit for the given backend type in the mask.
fpl_common_api void fplInputBackendMaskEnable (fplInputBackendMask *mask, const fplInputBackendType type)
Sets the bit for the given backend type in the mask.
fpl_common_api bool fplInputBackendMaskIsEnabled (const fplInputBackendMask *mask, const fplInputBackendType type)
Returns true when the given backend type bit is set in the mask.
fpl_common_api bool fplIsPlatformInitialized (void)
Gets a value indicating whether the platform is initialized.
fpl_common_api bool fplIsStringEqual (const char *a, const char *b)
Compares two strings and returns a boolean indicating the equality.
fpl_common_api bool fplIsStringEqualLen (const char *a, const size_t aLen, const char *b, const size_t bLen)
Compares two strings with constrained lengths and returns a boolean indicating the equality.
fpl_common_api bool fplIsStringMatchWildcard (const char *source, const char *wildcard)
Matches the given string by the given wildcard and returns a boolean indicating the match.
fpl_platform_api bool fplIsWindowDecorated (void)
Gets the window decorated state as boolean.
fpl_platform_api bool fplIsWindowFloating (void)
Gets the window floating state as boolean.
fpl_platform_api bool fplIsWindowFullscreen (void)
Gets the window fullscreen state as boolean.
fpl_platform_api bool fplIsWindowResizable (void)
Gets the window resizable state as boolean.
fpl_platform_api bool fplIsWindowRunning (void)
Gets the window running state as a boolean.
fpl_common_api const char * fplKeyGetName (const fplKey key)
Gets the string representation of the given key.
fpl_common_api fplSettings fplMakeDefaultSettings (void)
Creates a full settings structure containing default values.
fpl_common_api void * fplMemoryAlignedAllocate (const size_t size, const size_t alignment)
Allocates aligned memory from the operating system by the given alignment.
fpl_common_api void fplMemoryAlignedFree (void *ptr)
Releases the aligned memory allocated from the operating system.
fpl_platform_api void * fplMemoryAllocate (const size_t size)
Allocates memory from the operating system by the given size, that is aligned to the operating systems page-size (most common is 64 KB).
fpl_common_api void fplMemoryClear (void *mem, const size_t size)
Clears the given memory by the given size to zero.
fpl_common_api void fplMemoryCopy (const void *sourceMem, const size_t sourceSize, void *targetMem)
Copies the given source memory with its length to the target memory.
fpl_platform_api void fplMemoryFree (void *ptr)
Releases the memory allocated from the operating system.
fpl_platform_api bool fplMemoryGetUsage (fplMemoryInfos *outInfos)
Retrieves the current system memory usage.
fpl_common_api void fplMemorySet (void *mem, const uint8_t value, const size_t size)
Sets the given memory by the given size to the given value.
fpl_platform_api fplMilliseconds fplMillisecondsQuery (void)
Gets the current system clock in milliseconds, since some fixed starting point (OS start, System start, etc.), used for time delta measurements only.
fpl_platform_api void fplMutexDestroy (fplMutexHandle *mutex)
Releases the given mutex and clears the structure to zero.
fpl_platform_api bool fplMutexInit (fplMutexHandle *mutex)
Initializes the given mutex.
fpl_platform_api bool fplMutexLock (fplMutexHandle *mutex)
Locks the given mutex and blocks any other threads.
fpl_platform_api bool fplMutexTryLock (fplMutexHandle *mutex)
Tries to lock the given mutex without blocking other threads.
fpl_platform_api bool fplMutexUnlock (fplMutexHandle *mutex)
Unlocks the given mutex.
fpl_platform_api bool fplOSGetVersionInfos (fplOSVersionInfos *outInfos)
Gets version information from the operating system.
fpl_common_api size_t fplPathCombine (char *destPath, const size_t maxDestPathLen, const size_t pathCount,...)
Combines all given paths by the platform's path separator for a fixed number of arguments.
fpl_platform_api size_t fplPathNormalize (const char *sourcePath, char *destPath, const size_t maxDestLen)
Normalizes the specified source path into the dest path and len.
fpl_common_api const char * fplPlatformGetResultName (const fplPlatformResultType type)
Gets the string representation of a platform result type.
fpl_common_api bool fplPlatformInit (const fplInitFlags initFlags, const fplSettings *initSettings)
Initializes the platform layer.
fpl_common_api void fplPlatformRelease (void)
Releases the resources allocated by the platform layer.
fpl_common_api fplAudioResultType fplPlayAudio (void)
Start playing asynchronous audio.
fpl_platform_api bool fplPollEvent (fplEvent *ev)
Polls the next event from the internal event queue or from the OS, handles them, and removes it from the queue.
fpl_platform_api void fplPollEvents (void)
Polls all the events from the OS and clears the internal event queue.
fpl_platform_api bool fplPollGamepadStates (fplGamepadStates *outStates)
Polls the current gamepad states and writes it out into the output structure.
fpl_platform_api bool fplPollKeyboardState (fplKeyboardState *outState)
Polls the current keyboard state and writes it out into the output structure.
fpl_platform_api bool fplPollMouseState (fplMouseState *outState)
Polls the current mouse state and writes it out into the output structure.
fpl_platform_api bool fplQueryCursorPosition (int32_t *outX, int32_t *outY)
Queries the cursor position in screen coordinates, relative to the root screen.
fpl_common_api bool fplResizeVideoBackBuffer (const uint32_t width, const uint32_t height)
Resizes the current video backbuffer.
fpl_common_api size_t fplS32ToString (const int32_t value, char *buffer, const size_t maxBufferLen)
Converts the given 32-bit integer value into a string.
fpl_platform_api void fplSemaphoreDestroy (fplSemaphoreHandle *semaphore)
Releases the internal semaphore resources.
fpl_platform_api bool fplSemaphoreInit (fplSemaphoreHandle *semaphore, const uint32_t initialValue)
Initializes the semaphore with the given initial value.
fpl_platform_api bool fplSemaphoreRelease (fplSemaphoreHandle *semaphore)
Increments the semaphore value by one.
fpl_platform_api bool fplSemaphoreTryWait (fplSemaphoreHandle *semaphore)
Tries to wait for the semaphore until it gets signaled or returns immediately.
fpl_platform_api int32_t fplSemaphoreValue (fplSemaphoreHandle *semaphore)
Gets the current semaphore value.
fpl_platform_api bool fplSemaphoreWait (fplSemaphoreHandle *semaphore, const fplTimeoutValue timeout)
Waits for the semaphore until it gets signaled or the timeout has been reached.
fpl_platform_api size_t fplSessionGetUsername (char *nameBuffer, const size_t maxNameBufferLen)
Gets the username of the current logged-in user from the session.
fpl_common_api bool fplSetAudioClientReadCallback (fpl_audio_client_read_callback *newCallback, void *userData)
Overwrites the audio client read callback.
fpl_platform_api bool fplSetClipboardText (const char *text)
Overwrites the current clipboard text with the given one.
fpl_common_api void fplSetDefaultAudioSettings (fplAudioSettings *audio)
Resets the given audio settings to default settings (S16 PCM, 48 kHz, 2 Channels).
fpl_common_api void fplSetDefaultConsoleSettings (fplConsoleSettings *console)
Resets the given console settings container to default settings.
fpl_common_api void fplSetDefaultGamepadSettings (fplGamepadSettings *gamepadSettings)
Resets the given gamepad settings container to default values.
fpl_common_api void fplSetDefaultInputSettings (fplInputSettings *input)
Resets the given input settings container to default values.
fpl_common_api void fplSetDefaultSettings (fplSettings *settings)
Resets the given settings container to default values for window, video, audio, etc.
fpl_common_api void fplSetDefaultVideoSettings (fplVideoSettings *video)
Resets the given video settings to default values.
fpl_common_api void fplSetDefaultWindowSettings (fplWindowSettings *window)
Resets the given window settings container to default settings.
fpl_common_api void fplSetLogSettings (const fplLogSettings *params)
Overwrites the current log settings.
fpl_common_api void fplSetMaxLogLevel (const fplLogLevel maxLevel)
Changes the current maximum log level to the given value.
fpl_platform_api bool fplSetThreadPriority (fplThreadHandle *thread, const fplThreadPriority newPriority)
Changes the thread priority to the given one, for the given thread handle.
fpl_platform_api void fplSetWindowCursorEnabled (const bool value)
Enables or disables the window cursor.
fpl_platform_api void fplSetWindowDecorated (const bool value)
Enables or disables the window decoration (Titlebar, Border, etc.).
fpl_platform_api void fplSetWindowFloating (const bool value)
Enables or disables the window floating (Top-most).
fpl_platform_api bool fplSetWindowFullscreenRect (const bool value, const int32_t x, const int32_t y, const int32_t width, const int32_t height)
Enables or disables fullscreen mode based on the given rectangle.
fpl_platform_api bool fplSetWindowFullscreenSize (const bool value, const uint32_t fullscreenWidth, const uint32_t fullscreenHeight, const uint32_t refreshRate)
Enables or disables fullscreen mode based on the given size and the current display.
fpl_common_api void fplSetWindowInputEvents (const bool enabled)
Enables or disables the input events for the window entirely.
fpl_platform_api void fplSetWindowPosition (const int32_t left, const int32_t top)
Changes the window absolute position to the given coordinates.
fpl_platform_api void fplSetWindowResizeable (const bool value)
Enables or disables the ability to resize the window.
fpl_platform_api void fplSetWindowSize (const uint32_t width, const uint32_t height)
Resizes the window to fit the inner size based on the given size.
fpl_platform_api bool fplSetWindowState (const fplWindowState newState)
Changes the current window state.
fpl_platform_api void fplSetWindowTitle (const char *title)
Changes the window title to the given string.
fpl_platform_api void fplSignalDestroy (fplSignalHandle *signal)
Releases the given signal and clears the structure to zero.
fpl_platform_api bool fplSignalInit (fplSignalHandle *signal, const fplSignalValue initialValue)
Initializes the given signal.
fpl_platform_api bool fplSignalReset (fplSignalHandle *signal)
Resets the signal.
fpl_platform_api bool fplSignalSet (fplSignalHandle *signal)
Sets the signal and wakes up the given signal.
fpl_platform_api bool fplSignalWaitForAll (fplSignalHandle **signals, const size_t count, const size_t stride, const fplTimeoutValue timeout)
Waits until all the given signals are woken up.
fpl_platform_api bool fplSignalWaitForAny (fplSignalHandle **signals, const size_t count, const size_t stride, const fplTimeoutValue timeout)
Waits until any of the given signals wakes up or the timeout has been reached.
fpl_platform_api bool fplSignalWaitForOne (fplSignalHandle *signal, const fplTimeoutValue timeout)
Waits until the given signal is woken up.
fpl_common_api fplAudioResultType fplStopAudio (void)
Stop playing asynchronous audio.
fpl_common_api size_t fplStringAppend (const char *appended, char *buffer, size_t maxBufferLen)
Appends the source string to the given buffer.
fpl_common_api size_t fplStringAppendLen (const char *appended, const size_t appendedLen, char *buffer, size_t maxBufferLen)
Appends the source string to the given buffer constrained by length.
fpl_common_api size_t fplStringFormat (char *destBuffer, const size_t maxDestBufferLen, const char *format,...)
Fills out the given destination string buffer with a formatted string, using the format specifier and variable arguments.
fpl_common_api size_t fplStringFormatArgs (char *destBuffer, const size_t maxDestBufferLen, const char *format, va_list argList)
Fills out the given destination string buffer with a formatted string, using the format specifier and the arguments list.
fpl_common_api int32_t fplStringToS32 (const char *str)
Converts the given string into a 32-bit integer.
fpl_common_api int32_t fplStringToS32Len (const char *str, const size_t len)
Converts the given string into a 32-bit integer constrained by string length.
fpl_platform_api fplThreadHandle * fplThreadCreate (fpl_run_thread_callback *runFunc, void *data)
Creates and starts a thread and returns the handle to it.
fpl_platform_api fplThreadHandle * fplThreadCreateWithParameters (fplThreadParameters *parameters)
Creates and starts a thread from the specified parameters and returns the handle to it.
fpl_platform_api void fplThreadSleep (const uint32_t milliseconds)
Lets the current thread sleep for the given amount of milliseconds.
fpl_platform_api bool fplThreadTerminate (fplThreadHandle *thread)
Forces the given thread to stop and release all underlying resources.
fpl_platform_api bool fplThreadWaitForAll (fplThreadHandle **threads, const size_t count, const size_t stride, const fplTimeoutValue timeout)
Waits until all given threads are done running or the given timeout has been reached.
fpl_platform_api bool fplThreadWaitForAny (fplThreadHandle **threads, const size_t count, const size_t stride, const fplTimeoutValue timeout)
Waits until one of the given threads is done running or the given timeout has been reached.
fpl_platform_api bool fplThreadWaitForOne (fplThreadHandle *thread, const fplTimeoutValue timeout)
Waits until the given thread is done running or the given timeout has been reached.
fpl_platform_api bool fplThreadYield (void)
Lets the current thread yield execution to another thread that is ready to run on this core.
fpl_platform_api fplSeconds fplTimestampElapsed (const fplTimestamp start, const fplTimestamp finish)
Gets the delta value from two fplTimestamp values in seconds.
fpl_platform_api fplTimestamp fplTimestampQuery (void)
Gets the current fplTimestamp with most precision, used for time delta measurements only.
fpl_common_api bool fplTryStringToS32 (const char *str, int32_t *outValue)
Try to convert the given NUL-terminated string into a 32-bit integer.
fpl_common_api bool fplTryStringToS32Len (const char *str, const size_t len, int32_t *outValue)
Try to convert the given string into a 32-bit integer constrained by string length.
fpl_common_api bool fplUpdateInputDevices (void)
Refreshes the input subsystem's device list and processes pending hotplug events.
fpl_platform_api size_t fplUTF8StringToWideString (const char *utf8Source, const size_t utf8SourceLen, wchar_t *wideDest, const size_t maxWideDestLen)
Converts the given 8-bit UTF-8 source ANSI string with length into a 16-bit wide string.
fpl_common_api void fplVideoFlip (void)
Forces the window to be redrawn or to swap the back/front buffer.
fpl_platform_api size_t fplWideStringToUTF8String (const wchar_t *wideSource, const size_t wideSourceLen, char *utf8Dest, const size_t maxUtf8DestLen)
Converts the given 16-bit source wide string with length into an 8-bit UTF-8 ANSI string.
fpl_platform_api void fplWindowShutdown (void)
Closes the window and stops the event loop.
fpl_platform_api bool fplWindowUpdate (void)
Clears the internal event queue and updates input devices if needed.

Detailed Description

Final Platform Layer (FPL) - A C99 Single-Header-File Platform Abstraction Library.

Version: v1.0.0

Author: Torsten Spaete

Definition in file final_platform_layer.h.

Macro Definition Documentation

FPL_APPTYPE_WINDOW

#define FPL_APPTYPE_WINDOW

Application is built as a windowed application (a window is created by FPL).

Definition at line 2692 of file final_platform_layer.h.

FPL_CACHELINE_SIZE

#define FPL_CACHELINE_SIZE

Cacheline size for Default Architecture (64-bytes).

Definition at line 2219 of file final_platform_layer.h.

FPL_CPU_32BIT

#define FPL_CPU_32BIT

32-bit CPU detected.

Definition at line 2181 of file final_platform_layer.h.

FPL_ENUM_AS_FLAGS_OPERATORS

#define FPL_ENUM_AS_FLAGS_OPERATORS ( type)

Defines bitwise operator overloads for the given enum type (C++ only, no-op in C).

Parameters

Direction Parameter Description
[in] type The type of the enum.

Definition at line 3591 of file final_platform_layer.h.

FPL_FUNCTION_NAME

#define FPL_FUNCTION_NAME

Function name macro.

Definition at line 2771 of file final_platform_layer.h.

FPL_IS_IDE

#define FPL_IS_IDE

Is set when an IDE is active, like IntelliSense or JetBrains.

Returns: A boolean indicating whether an IDE is active or not.

Definition at line 2765 of file final_platform_layer.h.

fpl_null

#define fpl_null

Defines a NULL pointer value that works in C/C++.

Definition at line 3249 of file final_platform_layer.h.

FPL_X86_CPU_INSTR_SET_LEVEL

#define FPL_X86_CPU_INSTR_SET_LEVEL

Compiled X86 CPU Instruction Set.

fplX86InstructionSetLevel

Definition at line 2838 of file final_platform_layer.h.

fplAlignAs

#define fplAlignAs ( N)

Structure alignment in bytes.

Parameters

Direction Parameter Description
[in] N Alignment size. Must be a power-of-two integer literal.

Definition at line 2464 of file final_platform_layer.h.

fplAsm

#define fplAsm

An assembler keyword (asm) that is compiler-specific.

Definition at line 2422 of file final_platform_layer.h.

fplHasInclude

#define fplHasInclude ( inc)

Test for include existence.

Parameters

Direction Parameter Description
[in] inc Path to the include file.

Returns: A boolean indicating whether the specified include has been found or not.

Definition at line 2320 of file final_platform_layer.h.

fplMinAlignment

#define fplMinAlignment

Minimum structure alignment in bytes.

Returns: The minimum alignment in bytes.

Definition at line 2444 of file final_platform_layer.h.

Typedef Documentation

fpl_b32

typedef int32_t fpl_b32

Defines an integer-based boolean that has a width of 32-bit.

Note: Reserved for ABI-stable boolean fields inside public structs. Use C99

bool for return values and parameters.

Definition at line 3256 of file final_platform_layer.h.

Enumeration Type Documentation

fplX86InstructionSetLevel

enum fplX86InstructionSetLevel

Defines the X86 instruction sets up to AVX512.

Name Description
fplX86InstructionSetLevel_None None or not an x86 instruction set.
fplX86InstructionSetLevel_IA32 32-Bit Instructions (80386)
fplX86InstructionSetLevel_SSE SSE.
fplX86InstructionSetLevel_SSE2 SSE + (SSE2).
fplX86InstructionSetLevel_SSE3 SSE / SSE2 + (SSE3).
fplX86InstructionSetLevel_SSSE3 SSE / SSE2 / SSE3 + (SSSE3).
fplX86InstructionSetLevel_SSE4_1 SSE / SSE2 / SSE3 + (SSE4.1).
fplX86InstructionSetLevel_SSE4_2 SSE / SSE2 / SSE3 / SSE4.1 + (SSE4.2).
fplX86InstructionSetLevel_AVX SSE / SSE2 / SSE3 / SSE4.1 / SSE4.2 + (AVX).
fplX86InstructionSetLevel_AVX2 SSE / SSE2 / SSE3 / SSE4.1 / SSE4.2 / AVX + (AVX2).
fplX86InstructionSetLevel_AVX512 SSE / SSE2 / SSE3 / SSE4.1 / SSE4.2 / AVX / AVX2 + (AVX512).

Definition at line 2785 of file final_platform_layer.h.

Final Platform Layer

Pages

Topics

Data Structures

Clone this wiki locally