-
Notifications
You must be signed in to change notification settings - Fork 13
Getting started
- Download & Setup
- Requirements
- How to use FPL?
- How to use FPL in multiple translation units?
- How to use FPL in a static library?
- How do I get the code-documentation to show up in the IDE?
- Options
- You download the latest "final_platform_layer.h" file.
- Drop it into your C/C++ project and use it in any place you want.
- No setup required
FPL uses built-in operating system libraries and requires a C99 or C++11 compliant compiler.
Depending on the compiler and platform - linking to one system library may be needed:
- Link against "kernel32.lib"
- Link against "libdl.so"
- Compiler parameter "-pthread" (GCC Preprocessor Options)
By default, FPL uses the CRT (C-Runtime-Library) for functions such as vsnprintf(), but its usage is optional.
To learn how to use FPL without the CRT, see the page How to disable the use of the CRT in FPL
In your main C/C++ translation-unit include the header file and call fplPlatformInit() and fplPlatformRelease() respectively:
#define FPL_IMPLEMENTATION
#include "final_platform_layer.h"
int main(int argc, char **argv) {
// Initialize the platform with default settings
if ((, )) {
// your code goes here
// Release the platform
();
return 0;
} else {
return -1;
}
}You can then include this file in any other C/C++ source or header file as you would with any other header file.
Provide the typical main entry point with at least the initialization and release of the platform:
To use FPL in multiple translation units, it is recommended to create a separate "final_platform_layer.c" file in the same directory FPL is located and define the implementation there only.
Note: It is very important that the features you define in the translation units matches the header inclusion! For example using
FPL_NO_VIDEO in one place, but not in the others will propably result in compile errors.
final_platform_layer.c:
#define FPL_IMPLEMENTATION
#define FPL_NO_ENTRYPOINT // Disable the entry point inclusion
#include "final_platform_layer.h"This way FPL implementation is compiled once and can be used everywhere.
In your main translation-unit, you just include the entry point only using the preprocessor define FPL_ENTRYPOINT.
main.c:
#define FPL_ENTRYPOINT // Integrate entrypoint only
#include "final_platform_layer.h"To use FPL as a/in static library you do the same steps required for using FPL in multiple translation units.
See How to use FPL in multiple translation units? for more details.
When FPL is compiled directly in your main translation-unit, some IDEs read the comments from the implementation bodies instead of from the header definitions.
This is wrong, but we can't help it. Those editors just aren't designed for single-header-file libraries :-(
But do not fear, you can get the comments to show up in your IDE properly, just compile the implementation into a separated translation-unit only.
This way the IDE will parse the comments from the API declaration only. See How to use FPL in multiple translation units? for more details.
See Compiler Options for all compile-time options.
- 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