Advertisement

FPL - a single header file platform abstraction library

Started by August 02, 2017 11:14 AM
36 comments, last by Finalspace 6 years, 8 months ago

Starting new year update!

Since the last update i changed and improved the library a lot as well fixing some bugs. The win32 platform is considered to be finished as of today, but i plan to add more win32 features in the future (Direct2D support, WASAPI, Direct3D 9/10/11, WM_DROPFILES).

But the ffmpeg demo project gots the most improvements - it is now a fully working video player without any memory leaks using hardware OpenGL 3.3 rendering. This demo uses almost all features from FPL, so this is really great for testing out the library.

The posix/linux platform implementation goes smoothly, but is still ongoing. It looks great so far - since i finally got a native linux running on my dev rig ;)

Btw the library is back to C++/11 - due to the fact there was so many things not working properly with C++/98 (Custom types, compiler issues, etc.) and i will never go back to C++/98 anymore.

 

Planned:

  • Finish Linux/POSIX support
  • Audio channel mapping support
  • Direct2D support
  • Direct3D 9/10/11 support
  • WASAPI support
  • Network UDP/TCP support (POSIX, Win32)
  • More demos

 

Here is the full changelog since last update:

 

    ## v0.5.7.4 beta:
    - Changed: Updated code documentation for all functions and types to doxygen/javadoc style
    - Changed: SetFilePosition32 position is now int32_t instead of uint32_t to support negative positions as well
    - Changed: Renamed desiredFormat to deviceFormat in AudioSettings
    - Changed: [DirectSound] Use deviceID as GUID for the audio device
    - new: Introduced AudioDeviceID
    - New: Added deviceID field in AudioSettings
    - New: Added audio::GetAudioDevices()
    - New: Added strings::FormatString()

    ## v0.5.7.3 beta:
    - Fixed: [Win32] Fixed SetWindowFullscreen was not working properly
    - New: Introduced outputRect in VideoBackBuffer + Win32 implementation
    - Changed: SetWindowFullscreen returns bool

    ## v0.5.7.2 beta:
    - Added: Added new audio formats (AudioFormatType::F64, AudioFormatType::S64)

    ## v0.5.7.1 beta:
    - Fixed: xInputSetState renamed to xInputGetState internally
    - Added: Introduced InputSettings
    - Added: [Win32] XInput controller detection is now limited to a fixed frequency, for improving performance (InputSettings.controllerDetectionFrequency)

    ## v0.5.7.0 beta:
    - Changed: Total change of documentation style
    - Changed: [Win32] ThreadMutex uses a critical section instead of a event
    - Changed: [Win32] Include windows.h in the header, so we can define HANDLE, CRITICAL_SECTION in the api
    - Changed: [Win32] Changed lots of functions to use conditions instead of asserts
    - Changed: [Win32] Changed format specifiers to use either %d or %zu for integer types
    - Changed: All Thread*Wait functions returns if the wait was successful or not in the same way Signal*Wait
    - Changed: All ListFiles* functions uses reference instead of pointer

    ## v0.5.6.0 beta:
    - Changed: We are back to C++/11 and we will never going back to C++/98

    ## v0.5.5.1 beta:
    - New[POSIX]: Implemented fpl::timings
    - New[POSIX]: Implemented fpl::library
    - New[POSIX]: Implemented fpl::threading::ThreadSleep
    - Changed[POSIX]: Moved Linux fpl::console functions to Posix

    ## v0.5.5.0 beta:
    - Changed: All internal handles are now unions now, so can have different sizes of handles
    - Changed: Introduced POSIX platform and moved linux atomics into it

    ## v0.5.4.0 beta:
    - Fixed: Some enum types was not using the namespace version

    ## v0.5.3.0 beta:
    - Changed: Use custom int types because C++/98 has no default types unfortunatly
    - Fixed: Changed compiler detection order, because some non-MSVC compilers define _MSVC
    - Changed: Better C++/11 feature detection for optional nullptr and constexpr

    ## v0.5.2.1 beta:
    - Fixed: Corrected all doxygen statements to match new enum style or added missing exlamation marks.

    ## v0.5.2 beta:
    - Changed: Library is now C++/98 complaint
    - Changed: The actual enum type for "flags" has no "s" at the end anymore.
    - Opimization: Changed some internal functions to "static inline"
    - Changed: Renamed audio::GetAudioNativeFormat to audio::GetAudioHardwareFormat
    - New: Added "periods", "bufferSizeInBytes", "bufferSizeInFrames" to AudioDeviceFormat

 

Fine update:

I updated the documentations a lot, with tutorials, examples, faq and all that stuff.
Also there was a few changes in the api and some bugfixes.

Stay tuned.

 

Here are the full changelog:

## v0.5.8.0 beta:
- Changed: SignalWaitFor* requires additional parameter for passing in the ThreadMutex reference (pthread compability)
- Changed: Signal* does not use const reference anymore (pthread compability)
- Changed: Updated documentation a ton
- Changed: Decreased MAX_ERRORSTATE_COUNT from 1024 to 256
- Changed: global__LastErrorState is a non-pointer global now
- Changed: Renamed GetPlatformLastError() to GetPlatformError()
- Changed: All array of objects parameters uses C++ array style -> int *arr[] instead of int **arr
- Fixed: MemoryAlignedFree() had wrong signature (void **) instead of (void *)
- Fixed: GetPlatformErrorCount() was not increasing when an empty error was pushed on for single error states
- Fixed: [Win32] InitPlatform() was not cleaning up the Win32State when the initialization failed
- Replaced: VideoCompabilityProfile is replaced by OpenGLCompabilityFlags (Only available with OpenGL)
- New: Added ClearPlatformErrors()

Advertisement

Documentation and improvements update

I finally finished the basic documentation, fixed some bugs and solidified the api a little bit.
Its best to update to this release as soon as possible!

This state of the documentation can be found here . I uploaded it to a friends webspace, so this link might change in the future.

It would be great if you look that up and see for youself if something important may be missing. Thanks!

 

Here is the changelog:

## v0.5.8.1 beta:
- Changed: KeyboardEventType::Char renamed to KeyboardEventType::CharInput
- Changed: Completed basic documentation
- Changed: Renamed VideoBackBuffer.stride to VideoBackBuffer.lineWidth
- Changed: Moved a few internal inline audio functions to the global audio namespace
- Fixed: [Win32] WM_CHAR was allowing unicode characters as well, which is wrong because it must be properly converted first.
- Fixed: Audio driver selection was buggy
- Added: pixelStride to fpl::video::VideoBackBuffer
- Added: fpl::window::ClearWindowEvents()
- Added: fpl::window::PushWindowEvent()
- Added: fpl::window::UpdateGameControllers()
- Added: fpl::audio::GetAudioBufferSizeInFrames()
- Added: fpl::audio::GetAudioDriverString()
- Added: fpl::audio::GetAudioFormatString()
- Added: fpl::audio::GetAudioSampleSizeInBytes()
- Added: fpl::audio::GetAudioFrameSizeInBytes()
- Added: fpl::audio::GetAudioBufferSizeInBytes()
 

Refactoring for new platforms

I changed/moved the code a lot to make it more easier to add new platforms in the future.
Also i removed all the extra globals for storing api-functions and some states.
Lastly i decided to move out the documentation doxygen code into its own file, so the library get a bit smaller.

Oh and i updated the documentations on my friends server (Previous link).

Here is the changelog
## v0.5.9.0 beta:
- Changed: Moved documentation inside its own file "final_platform_layer.documentation"
- Changed: [Win32] Window creation uses CS_OWNDC always
- Changed: Refactoring of platform and non-platform code
- Changed: InitPlatform() and ReleasePlatform() is now platform independent

Major Update:

- I transformed the entire library to C99

- I added support for disabling the C-Runtime

- Win32 Platform is complete

- Linux Platform is almost complete (ImGUI sample already works)

- Tons of bugfixing and refactoring

 

Here is the full changelog since last time:

## v0.7.0.0 beta:
- Changed: Switched to C99
- Changed: Changed Init/app state structs a lot
- Changed: Removed most anonymous unions and structs
- Changed: Renamed a lot of the internal handles
- Changed: Renamed ThreadContext to ThreadHandle
- Changed: Renamed ThreadSignal to SignalHandle
- Changed: Renamed ThreadMutex to MutexHandle
- Changed: All structs, functions with name *API renamed to *Api
- Changed: Moved internal functions around and restructured things
- Changed: Moved platforms and subplatforms into its own namespace
- Changed: Updated documentation a bit
- Changed: Introduced common::Argument*Error functions
- Changed: Removed MemoryStackAllocate()
- Changed: App state memory size is aligned by 16-bytes as well
- Changed: Video/Audio state memory block is included in app state memory as well
- Changed: PlatformInit uses InitResultType
- Changed: fpl*DefaultSettings is now fplSet*DefaultSettings and does not return a struct anymore
- Fixed: Get rid of const char* to char* warnings for Get*DriverString() functions
- Fixed: [Win32] Icon was not default application icon
- Fixed: ExtractFileName and ExtractFileExtension was not returning const char*
- New: [X11][Window] Implemented X11 Subplatform
- New: [X11][OpenGL] Implemented X11/GLX video driver
- New: [X11][Software] Implemented Software video driver
- New: [POSIX] Implemented all remaining posix functions
- New: Introduced debug logging -> FPL_LOGGING
- New: Added FPL_ALIGNMENT_OFFSET macro
- New: Added FPL_ALIGNED_SIZE macro
- New: Added InitResultType
- New: CRT (C-Runtime) is not required anymore

## v0.6.0.0 beta:
- Changed: Documentation changed a bit
- Changed: Renamed SignalWakeUp() to SignalSet()
- Changed: [Win32] Start thread always immediatly
- Changed: Included "Windows" prefix for output path in visual studio projects
- Changed: Moved opengl settings into graphics union
- Changed: All global functions use :: as a prefix
- Deleted: Removed ThreadSuspend() -> Not complaint with pthread
- Deleted: Removed ThreadResume() -> Not complaint with pthread
- Deleted: Removed SignalReset() -> Not complaint with pthread
- Fixed: Resize video backbuffer was not working anymore
- Fixed: [Win32] Some _Interlocked* functions was not existing on x86
- New: Introduced PrepareWindowForVideoAfter() so we can setup a video context after the window has been created
- New: Introduced PrepareWindowForVideoBefore() so we can setup any window before initializing the video context
- New: Added timings::GetTimeInMilliseconds() with [Win32] and [POSIX] implementation
- New: [POSIX] Implemented all threading functions
- New: [Linux] Added a makefile for each demo project
- New: Added files::FileMove

## v0.5.9.1 beta:
- Changed: MemoryInfos uses uint64_t instead of size_t
- Changed: Added BSD to platform detecton
- Changed: Architecture detection does not use _WIN64 or _WIN32 anymore
- Changed: fpl_api is now either fpl_platform_api or fpl_common_api
- Changed: Internal code refactoring
- Changed: Renamed VideoSettings driverType to driver
- Changed: Video initialization is now platform independent
- Changed: Window initialization is now platform independent
- Changed: Moved window::WindowFlip to video::VideoFlip
- Changed: [POSIX] Replaced file-io with POSIX open, read, write
- Changed: [Win32] Removed fpl_api from main entry point forward declararation
- Changed: [Win32] Moved main entry point inside the implementation block
- Fixed: Arm64 was misdetected as X64, this is now its own arch
- Fixed: GNUC and ICC are pure C-compilers, it makes no sense to detect such in a C++ library
- Fixed: [Linux][POSIX] Refactor init and release to match PlatformInitState and PlatformAppState
- Updated: Documentations updated
- New: [POSIX][X11][Linux] Added missing functions as not-implemented

Important Info:

FPL is now part of of the handmade.network: https://fpl.handmade.network/

I will no longer update this thread - if you want to stay up-to-date you can find all the informations there.

Advertisement
5 hours ago, Finalspace said:

Important Info:

FPL is now part of of the handmade.network: https://fpl.handmade.network/

I will no longer update this thread - if you want to stay up-to-date you can find all the informations there.

If you'd like to keep this community aware, perhaps Projects is more appropriate?

Admin for GameDev.net.

15 hours ago, khawk said:

If you'd like to keep this community aware, perhaps Projects is more appropriate?

Good Point! I will do that.

This topic is closed to new replies.

Advertisement