Skip to content

Centurion 5.0.0

Compare
Choose a tag to compare
@albin-johansson albin-johansson released this 28 Oct 23:00

Release notes

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.
  • Renamed the top-level namespace to cen instead of centurion.
  • Removed pseudo-header-only support.
  • Replaced the CENTURION_NODISCARD macro with [[nodiscard]] attribute.
  • Replacedtl::optional with std::optional.
  • Removed gsl-lite dependency.
  • Class names, enumerators and aliases are now in snake_case, as per the standard library.
  • All headers now use the .hpp extension.
  • Added owning and non-owning versions of select components. Owning types have the expected names, and non-owning types are suffixed with _handle, e.g. renderer (owning) and renderer_handle (non-owning).
  • 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 library.
    • Renamed CenturionConfig class to config.
  • 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 functions 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 std::size_t as keys instead of std::string.
  • Overhauled text-rendering API.
  • Replaced member to_string functions with a non-member equivalent, i.e. you now stringify entities using cen::to_string(obj); instead of obj.to_string();,
  • Added support for the stream operator (<<) for types that provide a to_string overload.
  • Most of the color class is now constexpr.
    • Added color::with_alpha.
  • Merged all event headers into event.hpp.
  • Improved event class.
    • Removed event::as_ functions.
    • Added event::is<T>.
    • Added event::get<T>.
    • Added event::try_get<T>.
    • Added event::empty.
    • Added event::num_queued.
  • Removed SysWMEvent entirely.
  • Removed Colour alias.
  • Removed the color::max and color::min constants.
  • Fixed the behavior of the outline related methods in font.
  • Put base_path and pref_path in separate headers.

Minor

  • The library now uses the trailing return type syntax for methods with non-void return types.
  • 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.
  • Add get_grabbed_window and get_window_from_id functions to window_utils.hpp.
  • 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!

Major differences with 5.0.0-beta

  • Removed game loop implementations.
  • Removed EnTT dependency.
  • Added texture_handle