Skip to content

Centurion 5.0.0-beta

Pre-release
Pre-release
Compare
Choose a tag to compare
@albin-johansson albin-johansson released this 07 Sep 16:58
· 2875 commits to dev since this release

Release notes

Note: This is a pre-release of version 5.0.0.

This is a big update of the library. Many things have changed and a lot of stuff has been added. Some of the new features are a threading API, a new performant glyph-based text rendering API, owning and non-owning versions of classes, full C++17 utilization and much more. Far from all changes are documented in the following notes. However, the major changes are listed.

Note, this release breaks compatibility with C++11 and C++14.

Major

  • The library now only supports C++17.
  • Removed pseudo-header-only support.
  • Replaced the CENTURION_NODISCARD macro with [[nodiscard]] attribute.
  • Replacedtl::optional with std::optional.
  • Replaced gsl-lite with gsl by Microsoft.
  • Added EnTT as dependency, since it provides so many useful C++17 utilities.
  • Class names, enumerators and aliases are now in snake_case, as per the standard library.
  • All headers now use the .hpp extension.
  • Added game loop implementations: variable_timestep_loop, semi_fixed_timestep_loop and fixed_timestep_loop. Located in game_loop.hpp. No virtual inheritance necessary!
  • Added owning and non-owning versions of common components. Owning types have the expected names, and non-owning types are suffixed with _handle, e.g. renderer (owning) and renderer_handle (non-owning). Various APIs have been refactored to support both owning and non-owning versions of components where possible.
    • Added renderer_handle, a non-owning wrapper around SDL_Renderer*.
    • Added window_handle, a non-owning wrapper around SDL_Window*.
  • Added threading API.
    • Added thread class, provides a similar API to std::thread.
      • Renamed the delay function to sleep, and moved it to the thread class.
    • Added mutex class, located in mutex.hpp.
    • Added scoped_lock class, located in scoped_lock.hpp.
    • Added try_lock class, located in try_lock.hpp.
    • Added semaphore class, located in semaphore.hpp.
    • Added condition class, located in condition.hpp.
  • Added clipboard API in clipboard.hpp
  • Overhauled the hint API.
  • Added fast glyph-based rendering and string caching with font_cache, in font_cache.hpp.
  • Added simple Unicode string class, unicode_string, located in unicode_string.hpp.
  • The centurion.hpp header no longer includes the rest of the library.
    • Renamed Centurion class to centurion_lib.
  • Replaced the Battery class with the battery namespace.
  • Replaced the CPU class with the cpu namespace.
  • Replaced the Platform class with the platform namespace.
  • Replaced the Log class with the log namespace.
  • Replaced the Screen class with the screen namespace.
  • Replaced the Timer class with the counter namespace.
  • Made most implicit conversions explicit. Look for get member function, static_cast or ctn::cast function.
  • Replaced the RAM class with the ram namespace.
    • Renamed size_gb to amount_gb.
    • Renamed size_mb to amount_mb.
  • The library now utilizes std::chrono time unit types for improved type-safety and correctness of conversions of milliseconds, nanoseconds, minutes, etc.
  • Fixed several methods that had incorrect noexcept specifiers.
  • Thanks to if constexpr, the rendering API has become less bloated and more elegant. For instance, render will now delegate to either SDL_RenderCopy or SDL_RenderCopyF depending on the parameter types.
  • The renderer class now uses entt::id_type as keys, which can be created from compile-time hashed strings, e.g. "foo"_hs.
  • Overhauled text-rendering API.
  • Replaced member to_string functions with a non-member equivalent, i.e. you now stringify entities using ctn::to_string(obj); instead of obj.to_string();, this enables usage of ADL to delegate to either std::to_string or ctn::to_string.
  • Added support for the stream operator (<<) for types that provide a to_string overload.
  • Most of the color class is now constexpr.
  • Merged all event headers into event.hpp.
  • Improved event class.
    • Removed event::as_ methods from event.
    • Added the event::is<T> method.
    • Added the event::get<T> method.
    • Added the event::try_get<T> method.
    • Added the event::empty method.
  • Removed SysWMEvent entirely.
  • Removed Colour alias.
  • Removed the color::max and color::min constants.
  • Fixed the behavior of the outline related methods in font.

Minor

  • The library now uses the trailing return type syntax for methods with non-void return types.
  • Template definitions are now located in .ipp headers. (You don't have to include these explicitly).
  • Added sound_effect::is_fading method that returns true if the sound effect is being faded.
  • Added the basic_renderer::clear_with method, for clearing the rendering target with a specified color.
  • Optimized and improved the renderer implementation.
  • Added CENTURION_USE_PRAGMA_ONCE macro in centurion_cfg.hpp, which is used to specify whether or not #pragma once should be used by the Centurion headers.
  • All color constants are now inline static constexpr.
  • Drastically overhauled and improved documentation.
  • Added RtD site, which can be found here!
  • Started using AppVeyor for CI on Windows!