centurion

A modern C++ wrapper library for SDL2 in order to improve type-safety, memory safety and overall ease-of-use.

MIT License

Stars
303

Bot releases are hidden (Show)

centurion - Centurion 7.3.0 Latest Release

Published by albin-johansson over 1 year ago

Release notes

This is likely the last release before Centurion 8 (which will target SDL3).

  • Fixed a compilation issue related to basic_surface when CENTURION_NO_SDL_IMAGE was defined
  • Rearranged headers. This is a potentially breaking change, but you should be fine if you've included the main centurion.hpp header.
  • Exception messages are now copied and stored in exception objects themselves (thanks @v1993)
  • Added file overloads to various constructors and factory functions (thanks @v1993)
  • Added close and release functions to file (thanks @v1993)
  • Updated to SDL 2.26
    • Added basic_window::size_in_pixels
    • Added basic_joystick::get_guid_info
    • Added new mouse position functions to mouse_wheel_event
  • Tweak formatting
  • Test dependencies are now installed using Vcpkg
  • Minor CI improvements
  • Minor build script improvements
  • Minor documentation improvements
  • Removed Doxygen documentation, use the wiki instead. Or you can build the documentation yourself using the root Doxyfile.
centurion - Centurion 7.2.0

Published by albin-johansson about 2 years ago

Release notes

This release adds support for SDL 2.24, SDL_ttf 2.20, SDL_mixer 2.6, and SDL_image 2.6.

SDL

  • display_count() now returns an optional value
  • Added class joy_battery_event
  • Added class virtual_joystick_desc
  • Added event_type::joy_battery_updated
  • Added keyboard::reset()
  • Added display_with() functions
  • Added basic_controller::firmware_version()
  • Added basic_controller::path()
  • Added basic_joystick::firmware_version()
  • Added basic_joystick::path()
  • Added virtual_joystick_desc overload of basic_joystick::attach_virtual()
  • Added gl_attribute::float_buffers
  • Fixed compilation issue with some overloads of message_box::show(), thanks @gxm11!

SDL_ttf

  • Added enum wrap_alignment
  • Added font::set_wrap_align()
  • Added font::wrap_align()

SDL_mixer

  • Added basic_sound_effect::set_master_volume()
  • Added basic_sound_effect::master_volume()
  • Added music::current_title()
  • Added music::title()
  • Added music::title_tag()
  • Added music::artist_tag()
  • Added music::album_tag()
  • Added music::copyright_tag()
  • Added music::position()
  • Added music::duration()
  • Added music::loop_start_time()
  • Added music::loop_end_time()
  • Added music::loop_length()

SDL_image

  • Added animation class
  • Added file::is_avif()
  • Added file::is_jxl()
  • Added file::is_qoi()
centurion - Centurion 7.1.0

Published by albin-johansson about 2 years ago

Release notes

This release adds support for SDL 2.0.22.

  • Added get_window(renderer_handle) function for getting the window associated with a renderer
  • Added text_editing_ext_event
  • Other minor improvements
centurion - Centurion 7.0.0

Published by albin-johansson over 2 years ago

Notes

This release brings the same changes outlined in the release notes for the v7.0.0 beta, with the following differences.

  • Add fwd.hpp header with forward declarations of most Centurion types
  • Put font_bundle in cen::experimental namespace
  • Functions with create_ prefix now use make_
    • basic_window::create_renderer() -> basic_window::make_renderer()
    • basic_renderer::create_texture() -> basic_renderer::make_texture()
    • vk::create_surface() -> vk::make_surface()
centurion - Centurion 6.3.2

Published by albin-johansson over 2 years ago

  • Fixed a special case in color functions as_rgb(), as_rgba(), and as_argb() when using std::format()
  • Removed some invalid documentation comments referencing the non-existent release 6.4.0
centurion - Preview of Centurion 7.0.0

Published by albin-johansson over 2 years ago

This major release includes many naming changes and improvements, and many APIs have either been overhauled or removed.

Note, this list is incomplete.

General

  • Added support for SDL 2.0.18 and 2.0.20
  • Added support for SDL_ttf 2.0.18
  • Removed support for amalgamated header mode
  • Greatly reduced the amount of headers
  • Removed comparison operators between Centurion and SDL2 enums
  • Removed header everything.hpp
  • Removed header macros.hpp
  • Added more examples

๐Ÿ—๏ธ Common

  • Added alias bounded_array_ref
  • Added alias enable_for_enum_t
  • Added milliseconds aliases u16ms, u32ms, and u64ms
  • Added Unicode aliases unicode_t and unicode32_t
  • Renamed integer aliases
    • u8 -> uint8
    • u16 -> uint16
    • u32 -> uint32
    • u64 -> uint64
    • i8 -> int8
    • i16 -> int16
    • i32 -> int32
    • i64 -> int64
  • Overhauled SFINAE helper aliases
    • enable_if_pointer_v -> enable_for_pointer_t
    • enable_if_convertible_t -> enable_for_convertible_t
    • Replaced alias enable_if_number_t with variable template is_number<T>
  • Removed string aliases str, czstring, and zstring
  • Removed alias not_null
  • Overhauled literal operators
    • Removed _u8, _u16, _u32, _u64, _i8, _i16, _i32, and _i64
    • Removed _ns, _us, and _s
    • Put _ms literal operator in inline namespace time_literals (full qualification is now cen::literals::time_literals)
    • _ms literal operator now returns u64ms when using SDL 2.0.18 or later
  • Renamed cen_error to exception

Feature detection

  • Removed macro CENTURION_HAS_STD_MEMORY_RESOURCE
  • Removed macro CENTURION_HAS_FEATURE_MEMORY_RESOURCE
  • Added macro CENTURION_HAS_FEATURE_CHARCONV

Compiler

  • Replaced is_debug_build() with is_debug_build constant
  • Replaced is_release_build() with is_release_build constant
  • Replaced on_msvc() with on_msvc constant
  • Replaced on_gcc() with on_gcc constant
  • Replaced on_clang() with on_clang constant
  • Removed on_emscripten()
  • Removed on_intel_cpp()

Initialization

  • Removed hint API
  • Removed library class, replaced by sdl, img, mix, and ttf classes

Logging

  • Added support for custom log categories
  • Removed namespace cen::log
    • log::reset_priorities() -> reset_priorities()
    • log::set_priority() -> set_priority()
    • log::get_priority() -> get_priority()
    • log::max_message_size() -> max_log_message_size()
    • log::msg() -> log()
    • log::error() -> log_error()
    • log::critical() -> log_critical()
    • log::warn() -> log_warn()
    • log::debug() -> log_debug()
    • log::info() -> log_info()
    • log::verbose() -> log_verbose()
    • Removed log::put()
    • Removed log::set_output_function()
    • Removed log::use_preset_output_function()

Math

  • Replaced basic_rect::isFloating withbasic_rect::floating
  • Replaced basic_rect::isIntegral withbasic_rect::integral
  • Added new terse conversion functions as_i()/as_f() to math types

Versioning

  • version is no longer initalized to the current Centurion version by default
  • Added current_version()

๐Ÿ”‰ Audio

  • Removed alias channel_index
  • Removed alias group_index
  • Removed alias music_finished_callback
  • Removed alias channel_finished_callback
  • Removed alias sound_font_visit_callback
  • Removed set_sound_fonts()
  • Removed get_sound_fonts()
  • Removed each_sound_font()
  • Removed namespace cen::channels and all of its functions

music

  • Added alias ms_type
  • Added is_fading_in()
  • Added is_fading_out()
  • Removed explicit conversions to Mix_Music* and const Mix_Music*

basic_sound_effect

  • Added alias ms_type
  • Removed explicit conversions to Mix_Chunk* and const Mix_Chunk*

๐Ÿงถ Concurrency

  • Removed alias thread::id

๐Ÿ‘€ Events

  • Renamed common_event to event_base
  • Renamed event to event_handler
  • Added support for user events (with custom type identifiers)

event_handler

  • Added overload of is() accepting an event_type enumerator
  • Removed constructors accepting events
  • Removed overload of push() accepting a non-const event handler
  • Added raw_type()
  • Renamed is_empty() to empty()

keyboard_event

  • Renamed functions
    • set_scan_code() -> set_scan()
    • set_key_code() -> set_key()
    • set_button_state() -> set_state()
    • is_only_any_of_active() -> is_only_subset_active()
  • Removed get_scan_code()
  • Removed get_key_code()

๐Ÿ“ Filesystem

file_mode

  • Renamed enumerators
    • read_existing -> r
    • read_existing_binary -> rb
    • write -> w
    • write_binary -> wb
    • append_or_create -> a
    • append_or_create_binary -> ab
    • read_write_existing -> rx
    • read_write_existing_binary -> rbx
    • read_write_replace -> wx
    • read_write_replace_binary -> wbx
    • read_append -> ax
    • read_append_binary -> abx

file_type

  • Renamed enumerators
    • win32 -> win
    • stdio -> std

๐Ÿ”ก Text

  • Moved text rendering functions from basic_renderer to font
  • Removed rendering convenience functions from font_cache
  • Added experimental font_bundle class

๐ŸŽฎ Input

  • Removed haptic API
  • Removed touch namespace and all of its functions
  • Added class finger
  • Renamed finger_state to controller_finger_state
  • Renamed key_modifier to key_mod (and removed key_mod alias)
  • Added is_active(key_mod)
  • Added is_only_active(key_mod)
  • Added is_only_subset_active(key_mod)

key_mod

  • Renamed enumerators
    • left_shift -> lshift
    • right_shift -> rshift
    • left_ctrl -> lctrl
    • right_ctrl -> rctrl
    • left_alt -> lalt
    • right_alt -> ralt
    • left_gui -> lgui
    • right_gui -> rgui

keyboard

  • Renamed update() to refresh()
  • Renamed key_count() to size()
  • Removed key modifier functions is_active(), is_only_active(), and is_only_any_of_active()

mouse

  • Added warp()
  • Added warp_in_window()
  • Added set_relative_mode()
  • Added is_relative_mode_enabled()
  • Added update()
  • Added update(const basic_renderer&)
  • Added is_middle_pressed()
  • Added was_middle_released()
  • Added position_relative_window()
  • Added position_relative_desktop()
  • Added delta()
  • Added is_haptic()
  • Renamed functions
    • is_left_button_pressed() -> is_left_pressed()
    • is_right_button_pressed() -> is_right_pressed()
    • was_left_button_released() -> was_left_released()
    • was_right_button_released() -> was_right_released()
  • Removed update(int, int)
  • Removed update(iarea)
  • Removed reset()
  • Removed set_logical_width()
  • Removed set_logical_height()
  • Removed set_logical_size()
  • Removed logical_width()
  • Removed logical_height()
  • Removed logical_size()

๐Ÿ’ป System

  • Removed namespace cen::counter
    • counter::frequency() -> frequency()
    • counter::now() -> now()
    • counter::now_in_seconds() -> now_in_seconds()
    • counter::ticks() -> ticks32()
  • Removed namespace cen::clipboard
    • clipboard::has_text() -> has_clipboard()
    • clipboard::get_text() -> get_clipboard()
    • clipboard::set_text() -> set_clipboard()
  • Removed namespace cen::ram
    • ram::amount_mb() -> ram_mb()
    • ram::amount_gb() -> ram_gb()
  • Added ticks64()

Platform

  • Renamed platform_id enumerator mac_osx to macos

Power

  • Removed battery::exists()
  • Removed namespace cen::battery
    • battery::seconds_left() -> battery_seconds()
    • battery::minutes_left() -> battery_minutes()
    • battery::percentage() -> battery_percentage()
    • battery::state() -> query_battery()
    • battery::is_available() -> is_battery_available()
    • battery::is_charging() -> is_battery_charging()
    • battery::is_charged() -> is_battery_charged()

๐Ÿ–ฅ๏ธ Video

  • Renderers are now created using basic_window::create_renderer()
  • Textures are now created using basic_renderer::create_texture()
  • The as_rgb(), as_rgba(), and as_argb() functions in color now use std::format, if available
  • Removed double overload of blend() function

Rendering

  • Removed font handling API from basic_renderer
  • Removed translated rendering API from basic_renderer
  • Removed text rendering functions from basic_renderer, and moved them to font
centurion - Centurion 6.3.1

Published by albin-johansson almost 3 years ago

Release notes

  • Fix incorrect point distance calculation (thanks @twantonie)
centurion - Centurion 6.3.0

Published by albin-johansson about 3 years ago

Release notes

This release brings a few minor improvements, features and fixes. Such as adding support for more events and explicitly supporting not using the amalgamated centurion.hpp header (i.e. it's now supported to include the headers in the src folder directly).

Audio

  • [+] fade_status_count()
  • [+] music_type_count()

Core

  • [~] Optimized log::use_preset_output_function() by formatting to a stack buffer (using std::format_to_n)

Compiler

  • [+] CENTURION_HAS_FEATURE_TO_ARRAY

Events

  • [+] Added enumerators to event_type
    • app_will_enter_foreground
    • locale_changed
    • controller_touchpad_down
    • controller_touchpad_up
    • controller_touchpad_motion
    • controller_sensor_update
  • [+] display_event
  • [+] sensor_event
  • [+] user_event
  • [+] controller_touchpad_event
  • [-] Removed deprecated dollar_gesture_event::fingers() function
  • [-] Removed deprecated keyboard_event::modifier_active() function
  • [-] Removed deprecated keyboard_event::shift_active() function
  • [-] Removed deprecated keyboard_event::ctrl_active() function
  • [-] Removed deprecated keyboard_event::alt_active() function
  • [-] Removed deprecated keyboard_event::gui_active() function
  • [-] Removed deprecated keyboard_event::caps_active() function
  • [-] Removed deprecated keyboard_event::num_active() function
  • [-] Removed deprecated multi_gesture_event::set_fingers() function
  • [-] Removed deprecated multi_gesture_event::fingers() function

Video

  • [~] Fixed special case in the color::as_{rgb/rgba/argb} functions which could result in the resulting string being shorter than expected
  • [+] blend_factor enum
  • [+] blend_op enum
  • [+] blend_task struct
  • [+] compose_blend_mode()
  • [-] Removed deprecated overloads of from_hsv() and from_hsl() from color
centurion - Centurion 6.2.0

Published by albin-johansson about 3 years ago

Release notes

The major features of this release includes adding support for SDL 2.0.16 and using C++20 facilities wherever possible, whilst still remaining compatible with C++17.

Audio

  • [~] Fixed one of the operator!= overloads for fade_status incorrectly taking two Mix_Fading values as arguments
  • [+] Added overloads of to_string() and operator<< for fade_status
  • [+] Added overloads of to_string() and operator<< for music_type

Compiler

  • [+] CENTURION_NODISCARD_CTOR
  • [+] CENTURION_HAS_FEATURE_CPP20
  • [+] CENTURION_HAS_FEATURE_FORMAT
  • [+] CENTURION_HAS_FEATURE_CONCEPTS
  • [+] CENTURION_HAS_FEATURE_MEMORY_RESOURCE
  • [+] CENTURION_HAS_FEATURE_LERP
  • [+] CENTURION_HAS_FEATURE_SPACESHIP
  • [+] CENTURION_HAS_FEATURE_CHRONO_TIME_ZONES

Core

  • [+] Added str alias for const char*
  • [+] log_priority_count()
  • [+] log::set_output_function() (C++20 only)
  • [+] log::use_preset_output_function() (C++20 only)
  • [~] Deprecated czstring alias
  • [~] Deprecated zstring alias
  • [~] Marked library constructors as nodiscard (C++20 only)
  • [~] Deprecated CENTURION_HAS_STD_MEMORY_RESOURCE macro
  • [+] Concept is_stateless_callable (C++20 only)
  • [+] Added overloads of to_string() and operator<< for log_category
  • [+] Added overloads of to_string() and operator<< for log_priority

Events

  • [+] Added overloads of to_string() and operator<< for event_type
  • [+] Added overloads of to_string() and operator<< for mouse_wheel_direction
  • [+] Added overloads of to_string() and operator<< for window_event_id

Filesystem

  • [+] Added overloads of to_string() and operator<< for file_mode
  • [+] Added overloads of to_string() and operator<< for file_type
  • [+] Added overloads of to_string() and operator<< for seek_mode

Hints

  • [+] hint::audio_include_monitors
  • [+] hint::audio_device_stream_role
  • [~] get_hint() is no longer incorrectly marked as noexcept
  • [~] get_hint() now has an explicit return type
  • [~] Replaced hint::joystick::hidapi_correlate_xinput with hint::joystick::rawinput_correlate_xinput on SDL 2.0.16 or later
  • [+] Concept is_hint_callback (C++20 only)
  • [+] add_hint_callback_ex() (C++20 only)

Input

  • [-] Removed deprecated key_state alias
  • [-] Removed deprecated mouse_state alias
  • [~] haptic_feature enum now uses uint as underlying type
  • [~] haptic_direction_type enum now uses u8 as underlying type
  • [~] mouse_wheel_direction enum now uses u32 as underlying type
  • [+] controller_type::amazon_luna
  • [+] controller_type::google_stadia
  • [+] basic_controller::get_sensor_data_rate()
  • [+] basic_controller::send_effect()
  • [+] basic_joystick::send_effect()
  • [+] set_modifiers()
  • [+] get_modifiers()
  • [+] keyboard::is_only_active(key_mod)
  • [+] keyboard::is_only_any_of_active(key_mod)
  • [+] Added touch_device_type alias for touch::device_type
  • [+] Added touch_finger_state alias for touch::finger_state
  • [+] Added overloads of to_string() and operator<< for button_state
  • [+] Added overloads of to_string() and operator<< for keyboard
  • [+] Added overloads of to_string() and operator<< for mouse
  • [+] Added overloads of to_string() and operator<< for mouse_button
  • [+] Added overloads of to_string() and operator<< for controller_type
  • [+] Added overloads of to_string() and operator<< for controller_axis
  • [+] Added overloads of to_string() and operator<< for controller_button
  • [+] Added overloads of to_string() and operator<< for controller_bind_type
  • [+] Added overloads of to_string() and operator<< for joy_hat_position
  • [+] Added overloads of to_string() and operator<< for joystick_power
  • [+] Added overloads of to_string() and operator<< for joystick_type
  • [+] Added overloads of to_string() and operator<< for hat_state
  • [+] Added overloads of to_string() and operator<< for sensor_type
  • [+] Added overloads of to_string() and operator<< for touch_device_type
  • [+] Added overloads of to_string() and operator<< for button_order
  • [+] Added overloads of to_string() and operator<< for haptic_direction_type
  • [+] Added overloads of to_string() and operator<< for haptic_feature
  • [+] Added overloads of to_string() and operator<< for key_modifier
  • [+] Added overloads of to_string() and operator<< for basic_controller::mapping_result

Math

  • [~] Added operator<=> to vector3 (C++20 only)
  • [~] Added defaulted operator== for basic_area (C++20 only)
  • [~] Made operator== and operator!= overloads for basic_point templated

System

  • [+] Added overloads of to_string() and operator<< for platform_id
  • [+] Added overloads of to_string() and operator<< for power_state

Threads

  • [+] thread::init(): Constrained factory functions, supporting non-void user data or no user data at all (along with optional return values) (C++20 only)
  • [~] Deprecated thread::id, use thread_id instead
  • [~] Marked thread constructor as nodiscard (C++20 only)
  • [~] Marked scoped_lock constructors as nodiscard (C++20 only)
  • [~] Marked try_lock constructor as nodiscard (C++20 only)
  • [+] Added overloads of to_string() and operator<< for lock_status
  • [+] Added overloads of to_string() and operator<< for thread_priority

Video

  • [+] flash_op enum
  • [+] basic_window::flash()
  • [+] basic_window::set_always_on_top()
  • [+] Additional overload of blend() function for colors that accepts a float bias
  • [~] Deprecated double bias overload of blend() for colors
  • [~] Marked gl_library constructor as nodiscard (C++20 only)
  • [~] Marked vk_library constructor as nodiscard (C++20 only)
  • [+] system_cursor_count()
  • [+] Added overloads of to_string() and operator<< for basic_pixel_format_info
  • [+] Added overloads of to_string() and operator<< for gl_attribute
  • [+] Added overloads of to_string() and operator<< for gl_swap_interval
  • [+] Added overloads of to_string() and operator<< for blend_mode
  • [+] Added overloads of to_string() and operator<< for font_hint
  • [+] Added overloads of to_string() and operator<< for message_box::color_id
  • [+] Added overloads of to_string() and operator<< for message_box::default_button
  • [+] Added overloads of to_string() and operator<< for message_box_type
  • [+] Added overloads of to_string() and operator<< for pixel_format
  • [+] Added overloads of to_string() and operator<< for scale_mode
  • [+] Added overloads of to_string() and operator<< for screen_orientation
  • [+] Added overloads of to_string() and operator<< for system_cursor
  • [+] Added overloads of to_string() and operator<< for texture_access

Miscellaneous

  • [~] Switched to using a doxygen-awesome theme
  • [~] Replaced the wiki with new Doxygen pages
  • [+] The CI test suites are now run using both C++17 and C++20
  • [~] Use std::format in to_string() overloads (C++20 only)
centurion - Centurion 6.1.0

Published by albin-johansson over 3 years ago

Release notes

This release features a collection of smaller quality-of-life improvements and fixes, along a few more considerable additions such as the possibility to opt-out from using any of the SDL extension libraries and the color class supporting construction/conversion from/to hexadecimal color strings and normalized color values.

Configuration

  • [+] Added opt-out macros to exclude all Centurion classes and functions related to the SDL extension libraries
    • [+] CENTURION_NO_SDL_TTF
    • [+] CENTURION_NO_SDL_MIXER
    • [+] CENTURION_NO_SDL_IMAGE

Events

  • [~] Deprecated keyboard_event::modifier_active()
  • [~] Deprecated dollar_gesture_event::fingers()
  • [~] Deprecated multi_gesture_event::fingers()
  • [~] Deprecated multi_gesture_event::set_fingers()
  • [+] key_mod alias for key_modifier
  • [+] operator| for key_modifier
  • [+] operator& for key_modifier
  • [+] operator~ for key_modifier
  • [+] keyboard_event::is_active(key_modifier)
  • [+] keyboard_event::is_only_active(key_modifier)
  • [+] keyboard_event::is_only_any_of_active(key_modifier)
  • [~] Deprecated keyboard_event::shift_active()
  • [~] Deprecated keyboard_event::ctrl_active()
  • [~] Deprecated keyboard_event::alt_active()
  • [~] Deprecated keyboard_event::gui_active()
  • [~] Deprecated keyboard_event::caps_active()
  • [~] Deprecated keyboard_event::num_active()
  • [+] dollar_gesture_event::finger_count()
  • [+] multi_gesture_event::set_finger_count()
  • [+] multi_gesture_event::finger_count() (fixes incorrect float return type with previous fingers() function)
  • [+] event::data()

Input

  • [+] Added shift, ctrl, alt, gui and reserved enumerators to key_modifier enum.

Video

  • [~] Relaxed pre-conditions of color::from_hsv() and color::from_hsl(), these functions will now clamp the arguments to be within the respective ranges
  • [~] Deprecated double overloads of color::from_hsv() and color::from_hsl(), use the new float overloads instead
  • [+] color::from_rgb()
  • [+] color::from_rgba()
  • [+] color::from_argb()
  • [+] color::from_norm()
  • [+] color::as_rgb()
  • [+] color::as_rgba()
  • [+] color::as_argb()
  • [+] color::red_norm()
  • [+] color::green_norm()
  • [+] color::blue_norm()
  • [+] color::alpha_norm()
  • [+] gl::bind()
  • [+] gl::unbind()
  • [+] gl_context/gl_context_handle aliases for gl::context/gl::context_handle, since classes are usually not located in subnamespaces in the rest of the library

Misc

  • [+] usize alias for std::size_t
  • [~] Improved performance of to_string() overloads
centurion - Centurion 6.0.1

Published by albin-johansson over 3 years ago

Fixes

  • #98 vk::required_extensions() no longer always returns an empty std::vector
centurion - Centurion 6.0.0

Published by albin-johansson over 3 years ago

Release notes

General

  • [-] Removed Read-the-Docs documentation, moving the contents to either the GitHub wiki or Doxygen documentation.
  • [~] Direct usage of headers in src/centurion is no longer officially supported, use the include/centurion.hpp header instead
  • [~] Renamed exception to cen_error
  • [~] basic_area is now final
  • [~] Added conditional noexcept optimizations to several functions, since MSVC marks many functions as noexcept, even if they aren't required to be by the standard
  • [~] Several functions that take point and area parameters as references have been made to take them by value
  • [~] All functions that previously returned bools to indicate their success, now return result values, which is a new class

Core

  • [+] result class, used to indicate the success of functions (see success and failure)
  • [+] Version API
    • CENTURION_VERSION_MAJOR
    • CENTURION_VERSION_MINOR
    • CENTURION_VERSION_PATCH
    • CENTURION_VERSION_NUMBER
    • CENTURION_MAKE_VERSION_NUMBER
    • CENTURION_VERSION_AT_LEAST
    • version struct
    • version_at_least()
  • [+] sdl_image_linked_version()
  • [+] sdl_mixer_linked_version()
  • [+] sdl_ttf_linked_version()
  • [+] to_underlying()
  • [+] str_or_na()
  • [+] uint alias
  • [+] ulonglong alias

Logging

  • [~] Extracted log::category enum and renamed it to log_category
  • [~] Extracted log::priority enum and renamed it to log_priority

Configuration

  • [~] Renamed hint::gamecontroller namespace to hint::controller

Events

event

  • [~] Renamed event::refresh() to event::update()

Threads

N/A


Input

  • [~] Renamed key_state to keyboard
  • [~] Renamed mouse_state to mouse
  • [~] Renamed touch::num_devices() to touch::device_count()
  • [~] Renamed touch::num_fingers() to touch::finger_count()
  • [+] has_screen_keyboard()

keyboard

  • [~] Renamed keyboard::was_just_released() to just_released()
  • [~] Renamed keyboard::was_just_pressed() to just_pressed()
  • [~] Renamed keyboard::modifier_active() to is_active()
  • [~] keyboard::update() is no longer marked as noexcept
  • [~] keyboard::is_held() is now only noexcept on MSVC
  • [~] keyboard::just_pressed() is now only noexcept on MSVC
  • [~] keyboard::just_released() is now only noexcept on MSVC

mouse

  • [~] Renamed mouse::was_mouse_moved() to was_moved()
  • [~] Renamed mouse::mouse_x() to x()
  • [~] Renamed mouse::mouse_y() to y()
  • [~] Renamed mouse::mouse_pos() to position()

basic_joystick

  • [~] The basic_joystick::type enum has been extracted from basic_joystick and renamed to joystick_type
  • [~] The basic_joystick::power enum has been extracted from basic_joystick and renamed to joystick_power
  • [~] The basic_joystick::hat_state enum has been extracted from basic_joystick
  • [~] The basic_joystick::ball_axis_change struct has been extracted from basic_joystick
  • [~] Renamed basic_joystick::get_type() to type()
  • [~] basic_joystick::axis_pos() no longer returns an optional value.
  • [-] basic_joystick::num_hats()
  • [-] basic_joystick::num_axes()
  • [-] basic_joystick::num_trackballs()
  • [-] basic_joystick::num_buttons()

basic_controller

  • [~] Renamed basic_controller::num_mappings() to mapping_count()

Video

  • [~] Renamed get_window_from_id() to get_window()
  • [~] Renamed num_render_drivers() to render_driver_count()
  • [~] Renamed num_video_drivers() to video_driver_count()
  • [+] OpenGL API
    • gl_library class
    • gl_attribute enum
    • gl_swap_interval enum
    • gl::basic_context class, with gl::context and gl::context_handle aliases
    • gl::swap()
    • gl::drawable_size()
    • gl::set()
    • gl::get()
    • gl::reset_attributes()
    • gl::set_swap_interval()
    • gl::swap_interval()
    • gl::get_window()
    • gl::get_context()
    • gl::is_extension_supported()
  • [+] Vulkan API
    • vk_library class
    • vk::get_instance_proc_addr()
    • vk::create_surface()
    • vk::required_extensions()
    • vk::drawable_size()
  • [+] palette class
  • [+] renderer_info class
  • [+] make_window_and_renderer()
  • [+] get_info()

screen

  • [~] Renamed screen_saver_enabled() to is_screen_saver_enabled()
  • [~] Moved set_screen_saver_enabled() and is_screen_saver_enabled() out of the screen namespace
  • [~] Display mode functions now return std::optional values
  • [~] Most screen functions have been given display index parameters, that are defaulted to 0
  • [~] Moved screen::orientation out of the screen namespace and renamed it to screen_orientation
  • [~] Moved screen::dpi_info out of the screen namespace

basic_cursor

  • [~] Renamed basic_cursor::num_system_cursors() to basic_cursor::count()

unicode_string

  • [~] unicode_string::operator[]() overloads are now conditionally noexcept

basic_renderer

  • [~] Changed type of the flags parameter to the flags constructor from SDL_RendererFlags to u32
  • [~] The flags constructor no longer sets any default settings, such as color and blend mode
  • [~] basic_renderer::default_flags() is now public
  • [~] basic_renderer::has_font() is no longer marked as noexcept
  • [~] Renamed basic_renderer::set_logical_integer_scale() to set_logical_integer_scaling()
  • [~] basic_renderer::set_target() now takes a non-const reference to a centurion texture as parameter
  • [~] basic_renderer::set_scale() now have preconditions that the supplied scales are greater than zero
  • [~] basic_renderer::set_logical_scale() now have preconditions that the supplied dimensions aren't negative
  • [~] basic_renderer::clear() now returns result
  • [~] basic_renderer::draw_rect() now returns result
  • [~] basic_renderer::fill_rect() now returns result
  • [~] basic_renderer::draw_line() now returns result
  • [~] basic_renderer::draw_lines() now returns result
  • [~] basic_renderer::draw_rect_t() now returns result
  • [~] basic_renderer::fill_rect_t() now returns result
  • [~] basic_renderer::render() overloads now returns result
  • [~] basic_renderer::set_color() now returns result
  • [~] basic_renderer::set_clip() now returns result
  • [~] basic_renderer::set_blend_mode() now returns result
  • [~] basic_renderer::set_target() now returns result
  • [~] basic_renderer::set_scale() now returns result
  • [~] basic_renderer::set_logical_size() now returns result
  • [~] basic_renderer::set_logical_integer_scaling() now returns result
  • [+] basic_renderer::reset_target()
  • [+] basic_renderer::draw_point()
  • [+] basic_renderer::draw_point_t()
  • [+] basic_renderer::draw_circle()
  • [+] basic_renderer::draw_circle_t()
  • [+] basic_renderer::fill_circle()
  • [+] basic_renderer::fill_circle_t()
  • [+] renderer_flags enum
  • [-] basic_renderer::info()
  • [-] basic_renderer::flags()
  • [-] basic_renderer::is_vsync_enabled()
  • [-] basic_renderer::is_accelerated()
  • [-] basic_renderer::is_software_based()
  • [-] basic_renderer::supports_target_textures()

basic_window

  • [+] Added defaulted flags parameter to basic_windows title/size constructor.
  • [~] Renamed basic_window::always_on_top() to is_always_on_top()
  • [~] basic_window::set_fullscreen() now returns a result
  • [~] basic_window::set_fullscreen_desktop() now returns a result
  • [~] basic_window::set_opacity() now returns a result
  • [~] basic_window::set_capturing_mouse() now returns a result
  • [~] basic_window::set_size() has new preconditions
  • [~] basic_window::set_min_size() has new preconditions
  • [~] basic_window::set_max_size() has new preconditions
  • [+] basic_window::is_screen_keyboard_shown()
  • [+] basic_window::has_grabbed_input()
  • [+] basic_window::is_high_dpi()
  • [+] basic_window::is_hidden()
  • [+] basic_window::is_metal()
  • [+] basic_window::is_utility()
  • [+] basic_window::is_tooltip()
  • [+] basic_window::is_popup_menu()
  • [+] basic_window::is_excluded_from_taskbar()
  • [+] window_flags enum

basic_surface

  • [+] std::string overload for basic_surface::with_format()
  • [+] std::string overload for basic_surface::from_bmp()
  • [+] std::string overload for basic_surface::save_as_bmp()
  • [+] basic_surface::save_as_png()
  • [+] basic_surface::save_as_jpg()

color

  • [+] blend()
  • [+] color::data()

font

  • [~] The font::hint enum has been extracted renamed to font_hint
  • [~] Removed a redundant style mask data member, slightly reducing the memory footprint of the class
  • [~] Made the string size functions return std::optional values

message_box

  • [~] The message_box::type enum has been extracted and renamed to message_box_type
  • [~] The message_box::button_order enum has been extracted to the default cen namespace
  • [~] Renamed message_box::get_type() to type()

System

  • [~] Removed the platform namespace
  • [~] Renamed platform_id::linuxx to platform_id::linux_os
  • [~] Renamed old platform::id() function to current_platform()
  • [~] Renamed old platform::name() function to platform_name()
  • [~] Moved battery::power_state enum out of battery namespace
  • [~] Moved simd_block out of cpu namespace
  • [~] Renamed get_pref_path() to preferred_path()
  • [~] Renamed get_base_path() to base_path()
  • [~] Renamed counter::now_sec() to now_in_seconds()
  • [~] Renamed counter::high_res_freq() to frequency()
  • [+] std::string overload for preferred_path()
  • [+] screen::display_mode()
  • [-] base_path class
  • [-] pref_path class

Compiler

N/A


Math

  • [+] area()
  • [+] point()
  • [+] rect()

basic_rect

  • [+] basic_rect::offset_x()
  • [+] basic_rect::offset_y()
  • [+] basic_rect::offset_width()
  • [+] basic_rect::offset_height()

Audio

  • [~] The sound effect class has been turned into an owner/handle class, with sound_effect and sound_effect_handle aliases.
  • [+] get_sound()
  • [+] channels::on_finished()
  • [+] channels::allocate()
  • [+] channels::reserve()
  • [+] channels::expire()
  • [+] channels::remove_expiration()
  • [+] channels::set_group()
  • [+] channels::reset_group()
  • [+] channels::group_count()
  • [+] channels::first_available()
  • [+] channels::most_recent()
  • [+] channels::oldest()

music

  • [~] music::play() now returns std::optional<int>, which indicates the channel used to play the music
  • [~] music::fade_in() now returns a bool
  • [~] music::fade_out() now returns a bool
  • [+] music::set_hook()
  • [+] music::reset_hook()
  • [+] music::get_hook_data()
  • [+] music::get_decoder()
  • [+] music::has_decoder()
  • [+] music::decoder_count()

basic_sound_effect

  • [~] basic_sound_effect::play() now returns a bool
  • [+] basic_sound_effect(Mix_Chunk*) constructor
  • [+] basic_sound_effect::get_decoder()
  • [+] basic_sound_effect::has_decoder()
  • [+] basic_sound_effect::decoder_count()

Misc

  • Improved to_string() implementations
  • Added serialization tests, using the Cereal library
  • Fixed various minor Doxygen issues

Differences with beta version

  • color::blend() was turned into a free function
centurion - Centurion 6.0.0 (Beta)

Published by albin-johansson over 3 years ago

This is a preview release of Centurion 6.0.0. Most APIs should be relatively stable, but they might still change before the release of v6.0.0.

centurion - Centurion 5.3.0

Published by albin-johansson over 3 years ago

Release notes

With this release, the minimum supported SDL version is 2.0.10! This is the default version on the current LTS of Ubuntu, which motivated the change. This release also brings serialization support, based on the Cereal library API, along with several improvements to the basic_surface class, and more. Furthermore, this release removes all library components that were deprecated in version 5.1.0.

The structure of the project has changed slightly, with all headers being located in src/centurion, with a new composite header located in include called centurion.hpp, which contains the contents of all other centurion headers! However, you can still use the library in the old way by including said headers under src/centurion.

The library is now continuously tested on macOS!

Changes

  • basic_surface::lock() is now public
  • basic_surface::unlock() is now public
  • basic_surface::must_lock() is now public
  • basic_controller::get_button() now takes a not_null<czstring> as a parameter, instead of czstring
  • Exception constructors can now handle null messages
  • Tweak the to_string() output format from [component | foo: bar] to component{foo: bar}

Fixes

  • counter::ticks() is no longer marked as noexcept.

Additions

  • file class, along with several associated enums
  • shared_object class
  • Byte order API
    • swap_byte_order()
    • swap_big_endian()
    • swap_little_endian()
  • Serialization support for compatible types, based on the Cereal library API, which means that compatible types feature serialize() functions that accept an "archive", which serializes the associated data using operator().
    • basic_area
    • basic_point
    • basic_rect
    • color
    • key_code
    • scan_code
    • unicode_string
    • vector3
  • New literal suffix operators for integer overloads, defined in integers.hpp
    • _u8
    • _u16
    • _u32
    • _u64
    • _i8
    • _i16
    • _i32
    • _i64
  • basic_surface::data() function for API consistency, which returns the same pointer as basic_surface::pixels()
  • basic_surface(iarea, pixel_format) constructor
  • basic_surface::from_bmp()
  • basic_surface::save_as_bmp()
  • basic_area::value_type alias
  • basic_renderer::capture() function for capturing a snapshot of the current rendering target as a surface
  • basic_rect constructor that accepts an SDL rectangle
  • basic_rect constructor that takes x, y, width and height as separate values
  • basic_window::restore()
  • area_of()
  • New std::string overloads
    • clipboard::set_text()
    • basic_controller::get_axis()
    • basic_controller::get_button()
    • basic_controller::add_mapping()
    • basic_controller::load_mappings()
    • font constructor
    • font::string_width()
    • font::string_height()
    • font::string_size()
    • font_cache::store_blended_utf8()
    • font_cache::store_blended_wrapped_utf8()
    • font_cache::store_shaded_utf8()
    • font_cache::store_solid_utf8()
    • font_cache::store_blended_latin1()
    • font_cache::store_blended_wrapped_latin1()
    • font_cache::store_shaded_latin1()
    • font_cache::store_solid_latin1()
    • basic_joystick::guid_from_string()
    • key_code key name constructor
    • key_code key name assignment operator
    • scan_code key name constructor
    • scan_code key name assignment operator
    • sound_effect constructor
    • open_url()
    • basic_surface path constructor
    • music constructor
    • basic_texture path constructor
    • basic_texture::streaming()
    • basic_window title/size constructor
    • basic_window::set_title()
    • basic_renderer::render_blended_utf8()
    • basic_renderer::render_blended_wrapped_utf8()
    • basic_renderer::render_shaded_utf8()
    • basic_renderer::render_solid_utf8()
    • basic_renderer::render_blended_latin1()
    • basic_renderer::render_blended_wrapped_latin1()
    • basic_renderer::render_shaded_latin1()
    • basic_renderer::render_solid_latin1()
  • Added constexpr functions intended to be used for conditional compilation, based on the current OS
    • platform::ifdef_win32()
    • platform::ifdef_win64()
    • platform::ifdef_linux()
    • platform::ifdef_android()
    • platform::ifdef_apple()
  • Added constexpr functions for querying information about the compiler and build mode.
    • is_debug_build()
    • is_release_build()
    • on_msvc()
    • on_gcc()
    • on_clang()
    • on_emscripten()
    • on_intel_cpp()
  • isize(), for getting the size of a container as an int
  • mouse_state::update(iarea)
  • mouse_state::set_logical_size()
  • color::from_hsv()
  • color::from_hsl()
  • event::in_queue()

Deprecations

  • event::num_queued(), use event::queue_count() instead
  • event::num_queued(event_type), use event::queue_count(event_type) instead

Removals

  • types.hpp header
  • centurion_api.hpp header
  • basic_texture::is_static()
  • basic_rect::resize()
  • basic_rect::move_to()
  • sound_effect::loopForever
  • music::loopForever
  • message_box::get_title()
  • message_box::get_message()
  • key_state::amount_of_keys()
  • basic_joystick::amount()
  • ttf_version()
  • nn_czstring
  • event::empty()
  • common_event default constructor
  • font::kerning()
  • font::bold()
  • font::italic()
  • font::underlined()
  • font::strikethrough()
  • font::outlined()

Misc

  • Documentation improvements, especially doxygen groups.
centurion - Centurion 5.2.0

Published by albin-johansson over 3 years ago

Release notes

This release makes library now compatible with both SDL2 2.0.12 and 2.0.14! Overall, this release does not bring any source-breaking changes, but there are a couple of behavioral changes and signature tweaks such as the noexcept-ness of certain functions. Furthermore, this release includes a few new APIs, such as the sensor and haptic APIs!

Changes

  • basic_texture::streaming() now throws sdl_error instead of exception if a temporary texture cannot be locked.
  • basic_texture::set_pixel() is no longer marked as noexcept, it will now throw if pixel format information cannot be obtained.
  • basic_renderer::render_glyph() now has no effect if the specified glyph doesn't exist in the font cache.
  • basic_renderer::render_text() no longer has a precondition that all glyphs in the string must have been previously cached.
  • basic_controller::rumble() is no longer marked as noexcept, and it now returns a bool to indicate the success of the rumble.
  • sound_effect::fade_in is no longer marked as noexcept.
  • sound_effect::fade_out is no longer marked as noexcept.
  • music::fade_in is no longer marked as noexcept.
  • music::fade_out is no longer marked as noexcept.
  • milliseconds overload of condition::wait() is no longer marked as noexcept.
  • basic_joystick::rumble() is no longer marked as noexcept.
  • semaphore::acquire() is no longer marked as noexcept.
  • thread::sleep() is no longer marked as noexcept.
  • basic_joystick::from_joystick() now takes a templated basic_joystick as a parameter, instead of a joystick_handle.
  • Index constructor of basic_joystick now uses 0 as the default index.

Fixes

  • Added missing SFINAE check to basic_texture::release, it's only available for owning textures. It would have caused a compilation error if used with a handle, which is the correct behavior, but would likely lead to a confusing error message.
  • Fixed missing pixel_format::bgr444 enumerator.

Additions

  • New haptic API, located in haptic.hpp.
  • New sensor API, located in sensor.hpp.
  • New locale API, located in locale.hpp.
  • POD vector3<T> struct, located in the new vector3.hpp header.
  • Class basic_pixel_format_info, along with pixel_format_info and pixel_format_info_handle aliases, located in pixel_format.hpp.
  • platform::is_tablet() function in the platform.hpp header.
  • platform::open_url() function in the platform.hpp header.
  • basic_surface::with_format(), extracted from a lambda in the implementation of the basic_texture class.
  • basic_surface::format_info(), made possible by pixel_format_info_handle.
  • basic_surface::size()
  • basic_surface::set_rle_hint()
  • basic_surface::is_rle_enabled()
  • font_cache::try_at()
  • basic_rect::data()
  • basic_point::data()
  • get_base_path() in base_path.hpp, replacement for the base_path class.
  • get_pref_path() in pref_path.hpp, replacement for the pref_path class.
  • sdl_linked_version(), located in centurion.hpp.
  • Numerous cast() specializations for basic_area.
  • Added new pixel_format enumerators
    • pixel_format::xrgb4444
    • pixel_format::xbgr4444
    • pixel_format::xrgb1555
    • pixel_format::xbgr1555
    • pixel_format::xrgb8888
    • pixel_format::xbgr8888
  • basic_controller::count()
  • basic_controller::serial()
  • basic_controller::has_axis()
  • basic_controller::rumble_triggers()
  • basic_controller::set_sensor_enabled()
  • basic_controller::has_sensor()
  • basic_controller::is_sensor_enabled()
  • basic_controller::get_sensor_data()
  • basic_controller::set_led_color()
  • basic_controller::has_led()
  • basic_joystick::rumble_triggers()
  • basic_joystick::set_led()
  • basic_joystick::serial()
  • basic_joystick::has_led()
  • basic_joystick::attach_virtual()
  • basic_joystick::detach_virtual()
  • basic_joystick::set_virtual_axis()
  • basic_joystick::set_virtual_button()
  • basic_joystick::set_virtual_hat()
  • basic_joystick::is_virtual()
  • hint::joystick::use_hidapi_ps5
  • hint::joystick::use_raw_input
  • hint::joystick::hidapi_correlate_xinput
  • hint::mouse::relative_scaling
  • hint::preferred_locales
  • hint::emscripten::asyncify
  • hint::android::pause_background_audio
  • hint::thread_priority_policy
  • hint::treat_time_critical_as_real_time
  • hint::linux_use_deadzones
  • hint::audio_device_app_name
  • hint::audio_device_stream_name
  • cpu::simd_block

Deprecations

  • Class base_path, including the associated to_string() and operator<< overloads. Use the get_base_path() function instead.
  • Class pref_path, including the associated to_string() and operator<< overloads. Use the get_pref_path() function instead.
  • basic_joystick::num_hats(), use basic_joystick::hat_count() instead.
  • basic_joystick::num_axes(), use basic_joystick::axis_count() instead.
  • basic_joystick::num_trackballs(), use basic_joystick::trackball_count() instead.
  • basic_joystick::num_buttons(), use basic_joystick::button_count() instead.

Removals

None.

Misc

  • Simplified owner/handle implementation details.
  • Tweaked name of template parameters.
  • Various documentation improvements.
centurion - Centurion 5.1.0

Published by albin-johansson almost 4 years ago

Release notes

This release turns the library into a header-only library! This change is not considered to break ABI since there is no ABI anymore. Furthermore, this release brings quite a few deprecations along with some new APIs. There shouldn't be any major source breaking changes in this release.

Changes

  • Made the library a header-only library, no more need for runtime binaries (other than those of SDL2).
  • Made ttf_version() in centurion.hpp header constexpr.
  • battery::exists() now returns true if the power state is any of: on_battery, charged or charging.
  • sound_effect::fade_in() and sound_effect::fade_out now have preconditions that the durations must be greater than zero.
  • music::fade_in() and music::fade_out now have preconditions that the durations must be greater than zero.
  • basic_window::set_fullscreen() no longer resets brightness to 1 when exiting fullscreen mode.
  • basic_window::set_brightness() now returns a bool - true if successful, false otherwise. It will also try to set the brightness even when the window isn't in fullscreen mode.
  • event::type() now returns std::optional<event_type> since there might not be an internal event instance.
  • basic_controller::load_mappings() no longer throws upon failure, instead it returns a std::optional<int>, this means that it is now marked as noexcept.
  • basic_controller::add_mapping() no longer throws upon failure, instead it returns an enum that indicates the result. As a result, it is now noexcept.
  • Index parameter to index constructor of basic_controller now defaults to 0.
  • Default-constructed event types will now be initialized with appropriate time and type values.
  • cast() function definition is now located in the new cast.hpp header.
  • Exceptions for SDL errors (i.e. sdl_error, ttf_error, img_error and mix_error) now default to the latest error message from the
    respective SDL library.

Fixes

  • Fixed basic_joystick(SDL_Joystick*) constructor being private, it is now public.
  • Fixed basic_renderer::set_logical_size() not having any effect if any of the supplied components were 0.
  • Fixed return type of basic_controller::get_axis(controller_axis) to i16 (was previously i32).
  • Fixed message_box::button_order enumerators not being equal to corresponding SDL_MessageBoxFlags values.
  • Made message_box::show(const basic_window&) actually compile when instantiated.
  • battery::seconds_left() is no longer marked as noexcept (because of std::chrono::duration contructor).
  • battery::minutes_left() is no longer marked as noexcept (because of std::chrono::duration contructor).
  • message_box::has_button() is no longer markes as noexcept (because of std::any_of).
  • Minor README and compilation fixes on newer versions of GCC thanks to @GiuseppeCesarano!

Additions

  • New event_dispatcher.hpp header, which includes the event_dispatcher and event_sink classes.
  • integers.hpp header, provides the uX and iX integer aliases (e.g. u16 and i32).
  • time.hpp header, provides the time related aliases such as seconds and milliseconds along with the associated literals.
  • not_null.hpp header, provides the not_null alias.
  • sdl_version() in centurion.hpp.
  • sdl_image_version() in centurion.hpp.
  • sdl_mixer_version() in centurion.hpp.
  • sdl_ttf_version() in centurion.hpp.
  • basic_renderer::fill()
  • basic_renderer::fill_with().
  • battery::is_charging().
  • battery::is_charged().
  • battery::is_available().
  • key_code::to_scan_code().
  • scan_code::to_key_code().
  • scan_code::count().
  • sound_effect::is_any_playing()
  • sound_effect::channel()
  • event::push(const common_event<T>&)
  • as_sdl_event(const common_event<T>&) function in event.hpp.
  • basic_rect::set_max_x().
  • basic_rect::set_max_y().

Removals

  • CENTURION_API macro.
  • CENTURION_QUERY macro.
  • Removed validate_event() from cen namespace, it was never meant to be used for anything but testing.

Deprecations

  • centurion_api.hpp header.
  • types.hpp header, use the new more explicit headers instead.
    • nn_czstring alias, use not_null<czstring> instead.
    • buffer alias.
    • font_id alias.
  • ttf_version(), use sdl_ttf_version() instead.
  • font::kerning(), use font::has_kerning() instead.
  • font::bold(), use font::is_bold() instead.
  • font::italic(), use font::is_italic() instead.
  • font::underlined(), use font::is_underlined() instead.
  • font::strikethrough(), use font::is_strikethrough() instead.
  • font::outlined(), use font::is_outlined() instead.
  • texture::is_static(), use texture::is_no_lock() instead.
  • event::empty(), use event::is_empty() instead.
  • key_state::amount_of_keys(), use key_state::key_count() instead.
  • music::loopForever, use music::forever instead.
  • sound_effect::loopForever, use sound_effect::forever instead.
  • message_box::get_title(), use message_box::title() instead.
  • message_box::get_message(), use message_box::message() instead.
  • common_event default constructor.
  • basic_joystick::amount(), use basic_joystick::count() instead.
  • basic_rect::move_to(), use basic_rect::set_position() instead.
  • basic_rect::resize(), use basic_rect::set_size() instead.

Misc

  • Changed signature of variadic overload of unicode_string::append(), but it still behaves exactly the same as before.
  • Rewrote all tests using GoogleTest (instead of Catch2).
  • Added mocked test suite in addition to the normal unit tests, so test coverage is greater and of higher quality!
  • Added debug assertions where possible for parameters marked as not_null. However, you should not rely on this, supplying a null pointer when a parameter is marked as not_null is effectively undefined behaviour.
centurion - Centurion 5.0.0

Published by albin-johansson almost 4 years ago

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
centurion - Centurion 5.0.0-beta

Published by albin-johansson about 4 years ago

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!
centurion - Centurion 4.3.0

Published by albin-johansson over 4 years ago

Release notes

This is a small release that adds a touch API and minor improvements to Joystick.

  • Add a touch API in touch.h.
  • Add equality operators for Joystick enums.
centurion - Centurion 4.2.0

Published by albin-johansson over 4 years ago

Release notes

This version bring a joystick API, improvements to the Rect class and minor documentation improvements.

  • Added a joystick API, located in joystick.h.
  • Improved the Rect class.
    • Added void move_to(Point<T>), for setting the position of the rectangle easily.
    • Added T area(), that simply returns the area of the rectangle.
  • Various improvements to the Doxygen documentation, which is a work in progress.