Skip to content

Releases: albin-johansson/centurion

Centurion 6.0.1

26 May 09:47
cc71543
Compare
Choose a tag to compare

Fixes

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

Centurion 6.0.0

13 May 17:16
Compare
Choose a tag to compare

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

##...

Read more

Centurion 6.0.0 (Beta)

03 May 21:17
Compare
Choose a tag to compare
Pre-release

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 5.3.0

16 Mar 22:58
cb6960a
Compare
Choose a tag to compare

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 5.2.0

12 Feb 22:31
0beb8ae
Compare
Choose a tag to compare

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 5.1.0

10 Jan 00:11
8285c23
Compare
Choose a tag to compare

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 5.0.0

28 Oct 23:00
Compare
Choose a tag to compare

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

07 Sep 16:58
Compare
Choose a tag to compare
Centurion 5.0.0-beta Pre-release
Pre-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!

Centurion 4.3.0

06 Jul 13:13
Compare
Choose a tag to compare

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 4.2.0

06 Jul 00:20
Compare
Choose a tag to compare

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.