-
Notifications
You must be signed in to change notification settings - Fork 13
Introduction
Final Platform Layer is a Single-Header-File cross-platform C99/C++ development library designed to abstract the underlying platform to a very simple and easy-to-use API - providing low level access to:
- Single Window creation and handling
- Graphics Software or Hardware Rendering initialization.
- Asynchronous Playback of Audio Samples
- Accessing Input Devices (Keyboard, Mouse, Gamepad)
- IO handling (Files, Directories, Paths)
- Multithreading (Threads, Mutexes, Signals, Conditions)
- String conversions UTF8 <-> WideString
- Allocating Memory
- Retrieve Hardware & OS Information
The main focus is game/media/simulation development, so the default settings will create a window, set up an OpenGL rendering context, and initialize audio playback on any platform.
Final Platform Layer is released under the MIT License. This license allows you to use FPL freely in any software.
A single header file library (as the name implies) is a development library designed to be one file only.
Such a file contains the header (API) and the body (Implementation) in one file but separated and controlled by compiler conditions.
Due to the nature of a single-header-file library, all the sources come with it - so it is most likely licensed by a public domain license.
Also, such libraries mostly do not require any dependencies at all, making them more friendly to the user.
This makes it easy to use the library however you want (with source, Static-linked, As a DLL, Private use only).
So, why then is FPL based on that?
Because normal libraries typically have a lot of disadvantages:
- Force you to link to it dynamically or statically
- Force you to use build-systems just to compile it
- Requires specific CRT versions which make linking a madness
- Require or come with a ton of dependencies
- Are closed source or use an incompatible license
- Takes ages to compile because of its hundreds of translation units
- Windows (x86/x64)
- Linux (x86/x64/arm)
- Unix/BSD (x86/x64)
For more details see the page: Support/Platform Status
FPL should compile on any C99 or C++11 compliant compiler, such as MSVC, GCC, Clang, etc.
Read below a detailed feature overview of FPL:
- Core
- Compiler detection
- Architecture detection
- OS detection
- Runtime/Static Linking Support
- Window
- Create and handle a Single Window
- Fullscreen toggling
- Event handling
- Clipboard string reading and writing
- Monitor-Info Iteration
- Input (Event-based or by Polling)
- Text input (Event-based only)
- Keyboard
- Mouse
- Gamepads
- Backends:
- Win32 Keyboard/Mouse
- Win32 DirectInput
- Win32 XInput
- X11 Keyboard/Mouse
- Linux Joystick
- Video:
- Graphics initialization
- Backends:
- OpenGL 1.x (Legacy)
- OpenGL 3.x or higher (Modern)
- Vulkan
- Software Backbuffer
- Audio
- Raw audio asynchronous playback
- Device iteration and selection
- Backends:
- WASAPI
- DirectSound
- ALSA
- PulseAudio
- PipeWire
- OSS
- Memory
- Allocation and Deallocation
- Custom Alignment functions
- Fast Clear/Set and Copy
- Atomics
- Support for 8,16,32,64 bit signed and unsigned integer types
- Support for void pointer type
- Support for size type
- Compare and Exchange (CAS)
- Add / Exchange
- Load / Store
- Memory Barriers
- Shared library
- Loading of Shared Libraries (DLL on Windows, .so on Linux)
- Function Pointer Lookup
- IO
- Path
- Query User Home Directory
- Query Executable Path
- Extract Filename, Extension and Path
- Combine Paths
- Change File Extension
- Files/Directories
- Reading and Writing of Binary Files (32-bit and 64-bit)
- Iterate over Files/Directories
- Rename/Copy/Delete/Move operations
- Path
- Hardware Info
- Query Processor Infos (Core count, Name)
- Query Current Memory State (Physical size, Virtual Size, Page Size, etc.)
- Query System Architecture
- OS Info
- Query logged in Username
- Query OS infos (Name, Version)
- Timings
- Get number of seconds (Low and High precision) used for profiling and delta calculations
- Get number of milliseconds (Low and High precision) used for simple measurement
- Query current date time (Local or UTC)
- Strings
- UTF-8 <-> Widestring
- Copy
- Comparing
- Matching
- Formatting
- Locales
- Get keyboard/user/system locale
- Console
- Standard/Error out
- Formatted out
- Char input
- Debug
- DebugBreak for most compilers/platforms
- DebugOut for limited compilers/platforms
- Threading
- Threads
- Mutexes
- Signals
- Condition-Variables
- Semaphores
- You download the latest "final_platform_layer.h" file.
- Drop it into your C/C++ project and use it in any place you want.
- Define FPL_IMPLEMENTATION in at least one translation-unit before including this header file!
- Ready to go.
For more details see the pages: Getting started / Categories / Examples.
- Assertion & Debug
- Atomic operations
- Audio functions
- Clipboard functions
- Console functions
- Constants
- Display/Monitor functions
- Dynamic library loading
- Error Handling
- Files/IO functions
- Function macros
- Hardware Infos
- Input types and functions
- Localization functions
- Logging
- Memory Macros
- Memory functions
- Operating system Infos
- Path functions
- Platform functions
- Session Infos
- Settings & Configurations
- Storage class identifiers
- String functions
- Threading and synchronizations routines
- Timing functions
- Video functions
- Window events
- Window functions
- fplARMCPUCapabilities
- fplAudioChannelMap
- fplAudioDeviceID
- fplAudioDeviceInfo
- fplAudioFormat
- fplAudioSettings
- fplColor32
- fplConditionVariable
- fplConsoleSettings
- fplCPUCapabilities
- fplCPUIDLeaf
- fplDateTime
- fplDateTimeCreationResult
- fplDateTimeResult
- fplDisplayInfo
- fplDisplayMode
- fplDynamicLibraryHandle
- fplEndianess
- fplEvent
- fplFileEntry
- fplFileHandle
- fplFilePermissions
- fplFileTimeStamps
- fplGamepadButton
- fplGamepadData
- fplGamepadEvent
- fplGamepadInfo
- fplGamepadInputBinding
- fplGamepadMapping
- fplGamepadSettings
- fplGamepadState
- fplGamepadStates
- fplGraphicsApiSettings
- fplImageSource
- fplInputBackendMask
- fplInputBackendSupport
- fplInputDevice
- fplInputDeviceGuid
- fplInputSettings
- fplInternalConditionVariable
- fplInternalDynamicLibraryHandle
- fplInternalFileEntryHandle
- fplInternalFileHandle
- fplInternalFileRootInfo
- fplInternalMutexHandle
- fplInternalSemaphoreHandle
- fplInternalSignalHandle
- fplInternalThreadHandle
- fplKeyboardEvent
- fplKeyboardState
- fplLogSettings
- fplLogWriter
- fplLogWriterConsole
- fplLogWriterCustom
- fplMemoryAllocationSettings
- fplMemoryBlock
- fplMemoryInfos
- fplMemorySettings
- fplMouseEvent
- fplMouseState
- fplMutexHandle
- fplOpenGLSettings
- fplOSVersionInfos
- fplSemaphoreHandle
- fplSettings
- fplSignalHandle
- fplSpecificAudioSettings
- fplThreadHandle
- fplThreadParameters
- fplTimestamp
- fplVersionInfo
- fplVideoBackBuffer
- fplVideoRect
- fplVideoRequirements
- fplVideoRequirementsVulkan
- fplVideoSettings
- fplVideoSurface
- fplVideoSurfaceOpenGL
- fplVideoSurfaceVulkan
- fplVideoWindow
- fplVulkanSettings
- fplWindowCallbacks
- fplWindowDropFiles
- fplWindowEvent
- fplWindowPosition
- fplWindowSettings
- fplWindowSize
- fplX86CPUCapabilities