A modern C++ wrapper library for SDL2 in order to improve type-safety, memory safety and overall ease-of-use.
This is likely the last release before Centurion 8 (which will target SDL3).
basic_surface
when CENTURION_NO_SDL_IMAGE
was definedcenturion.hpp
header.file
overloads to various constructors and factory functions (thanks @v1993)close
and release
functions to file
(thanks @v1993)basic_window::size_in_pixels
basic_joystick::get_guid_info
mouse_wheel_event
Doxyfile
.This release adds support for SDL 2.24, SDL_ttf 2.20, SDL_mixer 2.6, and SDL_image 2.6.
display_count()
now returns an optional valuejoy_battery_event
virtual_joystick_desc
event_type::joy_battery_updated
keyboard::reset()
display_with()
functionsbasic_controller::firmware_version()
basic_controller::path()
basic_joystick::firmware_version()
basic_joystick::path()
virtual_joystick_desc
overload of basic_joystick::attach_virtual()
gl_attribute::float_buffers
message_box::show()
, thanks @gxm11!wrap_alignment
font::set_wrap_align()
font::wrap_align()
basic_sound_effect::set_master_volume()
basic_sound_effect::master_volume()
music::current_title()
music::title()
music::title_tag()
music::artist_tag()
music::album_tag()
music::copyright_tag()
music::position()
music::duration()
music::loop_start_time()
music::loop_end_time()
music::loop_length()
animation
classfile::is_avif()
file::is_jxl()
file::is_qoi()
This release brings the same changes outlined in the release notes for the v7.0.0 beta, with the following differences.
fwd.hpp
header with forward declarations of most Centurion typesfont_bundle
in cen::experimental
namespacecreate_
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()
color
functions as_rgb()
, as_rgba()
, and as_argb()
when using std::format()
This major release includes many naming changes and improvements, and many APIs have either been overhauled or removed.
Note, this list is incomplete.
everything.hpp
macros.hpp
bounded_array_ref
enable_for_enum_t
milliseconds
aliases u16ms
, u32ms
, and u64ms
unicode_t
and unicode32_t
u8
-> uint8
u16
-> uint16
u32
-> uint32
u64
-> uint64
i8
-> int8
i16
-> int16
i32
-> int32
i64
-> int64
enable_if_pointer_v
-> enable_for_pointer_t
enable_if_convertible_t
-> enable_for_convertible_t
enable_if_number_t
with variable template is_number<T>
str
, czstring
, and zstring
not_null
_u8
, _u16
, _u32
, _u64
, _i8
, _i16
, _i32
, and _i64
_ns
, _us
, and _s
_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 latercen_error
to exception
CENTURION_HAS_STD_MEMORY_RESOURCE
CENTURION_HAS_FEATURE_MEMORY_RESOURCE
CENTURION_HAS_FEATURE_CHARCONV
is_debug_build()
with is_debug_build
constantis_release_build()
with is_release_build
constanton_msvc()
with on_msvc
constanton_gcc()
with on_gcc
constanton_clang()
with on_clang
constanton_emscripten()
on_intel_cpp()
library
class, replaced by sdl
, img
, mix
, and ttf
classescen::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()
log::put()
log::set_output_function()
log::use_preset_output_function()
basic_rect::isFloating
withbasic_rect::floating
basic_rect::isIntegral
withbasic_rect::integral
as_i()
/as_f()
to math typesversion
is no longer initalized to the current Centurion version by defaultcurrent_version()
channel_index
group_index
music_finished_callback
channel_finished_callback
sound_font_visit_callback
set_sound_fonts()
get_sound_fonts()
each_sound_font()
cen::channels
and all of its functionsmusic
ms_type
is_fading_in()
is_fading_out()
Mix_Music*
and const Mix_Music*
basic_sound_effect
ms_type
Mix_Chunk*
and const Mix_Chunk*
thread::id
common_event
to event_base
event
to event_handler
event_handler
is()
accepting an event_type
enumeratorpush()
accepting a non-const event handlerraw_type()
is_empty()
to empty()
keyboard_event
set_scan_code()
-> set_scan()
set_key_code()
-> set_key()
set_button_state()
-> set_state()
is_only_any_of_active()
-> is_only_subset_active()
get_scan_code()
get_key_code()
file_mode
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
win32
-> win
stdio
-> std
basic_renderer
to font
font_cache
font_bundle
classtouch
namespace and all of its functionsfinger
finger_state
to controller_finger_state
key_modifier
to key_mod
(and removed key_mod
alias)is_active(key_mod)
is_only_active(key_mod)
is_only_subset_active(key_mod)
key_mod
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
update()
to refresh()
key_count()
to size()
is_active()
, is_only_active()
, and is_only_any_of_active()
mouse
warp()
warp_in_window()
set_relative_mode()
is_relative_mode_enabled()
update()
update(const basic_renderer&)
is_middle_pressed()
was_middle_released()
position_relative_window()
position_relative_desktop()
delta()
is_haptic()
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()
update(int, int)
update(iarea)
reset()
set_logical_width()
set_logical_height()
set_logical_size()
logical_width()
logical_height()
logical_size()
cen::counter
counter::frequency()
-> frequency()
counter::now()
-> now()
counter::now_in_seconds()
-> now_in_seconds()
counter::ticks()
-> ticks32()
cen::clipboard
clipboard::has_text()
-> has_clipboard()
clipboard::get_text()
-> get_clipboard()
clipboard::set_text()
-> set_clipboard()
cen::ram
ram::amount_mb()
-> ram_mb()
ram::amount_gb()
-> ram_gb()
ticks64()
platform_id
enumerator mac_osx
to macos
battery::exists()
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()
basic_window::create_renderer()
basic_renderer::create_texture()
as_rgb()
, as_rgba()
, and as_argb()
functions in color
now use std::format
, if availabledouble
overload of blend()
functionbasic_renderer
basic_renderer
basic_renderer
, and moved them to font
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).
fade_status_count()
music_type_count()
log::use_preset_output_function()
by formatting to a stack buffer (using std::format_to_n
)CENTURION_HAS_FEATURE_TO_ARRAY
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
dollar_gesture_event::fingers()
functionkeyboard_event::modifier_active()
functionkeyboard_event::shift_active()
functionkeyboard_event::ctrl_active()
functionkeyboard_event::alt_active()
functionkeyboard_event::gui_active()
functionkeyboard_event::caps_active()
functionkeyboard_event::num_active()
functionmulti_gesture_event::set_fingers()
functionmulti_gesture_event::fingers()
functioncolor::as_{rgb/rgba/argb}
functions which could result in the resulting string being shorter than expectedblend_factor
enumblend_op
enumblend_task
structcompose_blend_mode()
from_hsv()
and from_hsl()
from color
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.
operator!=
overloads for fade_status
incorrectly taking two Mix_Fading
values as argumentsto_string()
and operator<<
for fade_status
to_string()
and operator<<
for music_type
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
str
alias for const char*
log_priority_count()
log::set_output_function()
(C++20 only)log::use_preset_output_function()
(C++20 only)czstring
aliaszstring
aliaslibrary
constructors as nodiscard (C++20 only)CENTURION_HAS_STD_MEMORY_RESOURCE
macrois_stateless_callable
(C++20 only)to_string()
and operator<<
for log_category
to_string()
and operator<<
for log_priority
to_string()
and operator<<
for event_type
to_string()
and operator<<
for mouse_wheel_direction
to_string()
and operator<<
for window_event_id
to_string()
and operator<<
for file_mode
to_string()
and operator<<
for file_type
to_string()
and operator<<
for seek_mode
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 typehint::joystick::hidapi_correlate_xinput
with hint::joystick::rawinput_correlate_xinput
on SDL 2.0.16 or lateris_hint_callback
(C++20 only)add_hint_callback_ex()
(C++20 only)key_state
aliasmouse_state
aliashaptic_feature
enum now uses uint
as underlying typehaptic_direction_type
enum now uses u8
as underlying typemouse_wheel_direction
enum now uses u32
as underlying typecontroller_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)
touch_device_type
alias for touch::device_type
touch_finger_state
alias for touch::finger_state
to_string()
and operator<<
for button_state
to_string()
and operator<<
for keyboard
to_string()
and operator<<
for mouse
to_string()
and operator<<
for mouse_button
to_string()
and operator<<
for controller_type
to_string()
and operator<<
for controller_axis
to_string()
and operator<<
for controller_button
to_string()
and operator<<
for controller_bind_type
to_string()
and operator<<
for joy_hat_position
to_string()
and operator<<
for joystick_power
to_string()
and operator<<
for joystick_type
to_string()
and operator<<
for hat_state
to_string()
and operator<<
for sensor_type
to_string()
and operator<<
for touch_device_type
to_string()
and operator<<
for button_order
to_string()
and operator<<
for haptic_direction_type
to_string()
and operator<<
for haptic_feature
to_string()
and operator<<
for key_modifier
to_string()
and operator<<
for basic_controller::mapping_result
operator<=>
to vector3
(C++20 only)operator==
for basic_area
(C++20 only)operator==
and operator!=
overloads for basic_point
templatedto_string()
and operator<<
for platform_id
to_string()
and operator<<
for power_state
thread::init()
: Constrained factory functions, supporting non-void
user data or no user data at all (along with optional return values) (C++20 only)thread::id
, use thread_id
insteadthread
constructor as nodiscard (C++20 only)scoped_lock
constructors as nodiscard (C++20 only)try_lock
constructor as nodiscard (C++20 only)to_string()
and operator<<
for lock_status
to_string()
and operator<<
for thread_priority
flash_op
enumbasic_window::flash()
basic_window::set_always_on_top()
blend()
function for colors that accepts a float
biasdouble
bias overload of blend()
for colorsgl_library
constructor as nodiscard (C++20 only)vk_library
constructor as nodiscard (C++20 only)system_cursor_count()
to_string()
and operator<<
for basic_pixel_format_info
to_string()
and operator<<
for gl_attribute
to_string()
and operator<<
for gl_swap_interval
to_string()
and operator<<
for blend_mode
to_string()
and operator<<
for font_hint
to_string()
and operator<<
for message_box::color_id
to_string()
and operator<<
for message_box::default_button
to_string()
and operator<<
for message_box_type
to_string()
and operator<<
for pixel_format
to_string()
and operator<<
for scale_mode
to_string()
and operator<<
for screen_orientation
to_string()
and operator<<
for system_cursor
to_string()
and operator<<
for texture_access
std::format
in to_string()
overloads (C++20 only)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.
CENTURION_NO_SDL_TTF
CENTURION_NO_SDL_MIXER
CENTURION_NO_SDL_IMAGE
keyboard_event::modifier_active()
dollar_gesture_event::fingers()
multi_gesture_event::fingers()
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)
keyboard_event::shift_active()
keyboard_event::ctrl_active()
keyboard_event::alt_active()
keyboard_event::gui_active()
keyboard_event::caps_active()
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()
shift
, ctrl
, alt
, gui
and reserved
enumerators to key_modifier
enum.color::from_hsv()
and color::from_hsl()
, these functions will now clamp the arguments to be within the respective rangesdouble
overloads of color::from_hsv()
and color::from_hsl()
, use the new float
overloads insteadcolor::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 libraryusize
alias for std::size_t
to_string()
overloads