Final Platform Layer  0.9.6-beta
Introduction

Introduction to FPL

What is FPL?

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.
  • Playback of raw 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 Informations

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.

What is a single-header-file library and why is FPL based on that?

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, to 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

Which platforms are supported by FPL?

  • Windows (x86/x64)
  • Linux (x86/x64/arm)
  • Unix/BSD (x86/x64, partially)

For more details see the page: Support/Platform Status

Which compilers are supported by FPL?

FPL should compile on any C99 or C++/11 compliant compiler, such as MSVC, GCC, Clang, etc.

What can FPL do?

Read below a detailed feature overview of FPL:

  • Core
    • Compiler detection
    • Architecture detection
    • OS detection
  • Window
    • Create and handle a Single Window
    • Fullscreen toggling
    • Event handling
    • Clipboard string reading and writing
  • Input (Event-based or by Polling)
    • Text input (Event-based only)
    • Keyboard
    • Mouse
    • Game Controllers
  • Video:
    • Graphics initialization
    • Backends:
      • OpenGL 1.x (Legacy)
      • OpenGL 3.x or higher (Modern)
      • Software Backbuffer
  • Audio
    • Raw audio asyncronous playback
    • Device iteration and selection
    • Backends:
      • DirectSound
      • ALSA
  • 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 functions
      • 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
  • Hardware info retrievement
    • Query Processor Infos (Core count, Name)
    • Query Current Memory State (Physical size, Virtual Size, Page Size, etc.)
    • Query System Architecture
  • OS info retrievement
    • 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) user for simple measurement
  • String conversion functions
    • 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

Getting started with FPL

  • 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.