A modern C++ wrapper library for SDL2 in order to improve type-safety, memory safety and overall ease-of-use.
MIT License
Bot releases are hidden (Show)
Published by albin-johansson over 4 years ago
Version 4.1.0 brings a hint API, a couple of quality-of-life improvements, documentation improvements and a few deprecations.
hints.h
. No more need for SDL_SetHint(const char*, const char*)
!Renderer
Renderer
instances can now manage and hold Font
instances by itself.void Renderer::add_font(const std::string&, const SharedPtr<Font>&)
Optional<std::string> Renderer::add_font(const SharedPtr<Font>&)
void Renderer::remove_font(const std::string&)
SharedPtr<Font> Renderer::font(const std::string&)
bool Renderer::has_font(const std::string&) const
void Renderer::draw_rect_t(const IRect&)
void Renderer::draw_rect_tf(const FRect&)
void Renderer::fill_rect_t(const IRect&)
void Renderer::fill_rect_tf(const FRect&)
Rect<T>
.
Rect::Rect(Point<T>, TArea<T>)
void Rect::set(Point<T>, TArea<T>)
bool Rect::contains(Point<T>) const
Rect::Rect(T, T, T, T)
void Rect::set(T, T, T, T)
bool Rect::contains(T, T) const
Key
Key::Key(CZString)
std::string Key::name() const
bool Key::unknown() const
Screen
static IArea Screen::size()
std::make_unique
in message_box.cpp
Published by albin-johansson over 4 years ago
This is the fourth major release of the Centurion library and features many major improvements to the library. Future versions of the library will be minor releases, for quite some time. Hopefully a major release isn't needed in a long time. The following list of changes is far from complete since so much of the library has been improved.
gsl
dependency has been replaced with gsl-lite
. Enabling compatibility with C++11!std::optional<T>
has been replaced with tl::optional<T>
, aliased as Optional<T>
in the library. Vastly improving the user experience of using the library with either C++11 or C++14.CENTURION_HEADER_ONLY
in the centurion_cfg.h
file. Note that you'll need to include all of the .cpp
files when using this option. Using the library with the header only option enabled might improve performance due to more inlining, but will increase compilation times.get_foo()
are now called foo()
.Point<T>
and Rect<T>
.Log
class.const
.system.h
header have been separated into multiple files. See cpu.h
, ram.h
, platform.h
, screen.h
and battery.h
.const char*
, are now aliased with CZString
.UniquePtr
, SharedPtr
and WeakPtr
.IWindowListener
entirely.event
or input
, but most components are the centurion
namespace.Error
is now a member of the detail
namespace, and shouldn't be used outside of the implementation of the Centurion library.CenturionConfig
argument when creating Centurion
instances.Renderer::text_blended
, Renderer::text_blended_wrapped
, Renderer::text_shaded
and Renderer::text_solid
.Cursor
class.Font
class.KeyState
class.Texture
class.Surface
class.Key
class.Window
class.operator==
and operator!=
are now not inlined by default.#pragma once
(which is non-standard) with traditional include guards, which might improve the the portability of the library on some systems.<cstdint>
, instead the SDL aliases are used. Such as Uint32
instead of uint32_t
.Published by albin-johansson over 4 years ago
Published by albin-johansson over 4 years ago
MouseState
now implements the IWindowListener
interface.Point
and FPoint
.
FPoint::distance
FPoint::set
Point::distance
Point::set
operator+
and operator-
for both of the point classes.PixelFormat
enum class, located in the image.h
header.SoundEffect::get_max_volume
.ImageGenerator
.
ImageGenerator::unique_img(uint32_t, TextureAccess, int, int)
ImageGenerator::shared_img(uint32_t, TextureAccess, int, int)
ImageGenerator::unique_img(PixelFormat, TextureAccess, int, int)
ImageGenerator::shared_img(PixelFormat, TextureAccess, int, int)
Window
.
Window::get_renderer
.Window::maximise
Window::minimise
Window::get_display_index
Window::get_pixel_format
. However, the method will not be removed, it will be changed to return a PixelFormat
value instead.Image
class.
Image(gsl::not_null<SDL_Renderer*>, PixelFormat, TextureAccess, int, int)
Image::unique(gsl::not_null<SDL_Renderer*>, PixelFormat, TextureAccess, int, int)
Image::shared(gsl::not_null<SDL_Renderer*>, PixelFormat, TextureAccess, int, int)
Image(gsl::not_null<SDL_Renderer*>, uint32_t, TextureAccess, int, int)
Image::unique(gsl::not_null<SDL_Renderer*>, uint32_t, TextureAccess, int, int)
Image::shared(gsl::not_null<SDL_Renderer*>, uint32_t, TextureAccess, int, int)
Rect
and FRect
classes.
operator==
and operator!=
for both of the rectangle classes.CPU
class.
CPU::is_little_endian
CPU::is_big_endian
FontHint
enum class.Font
class.
Font::set_font_hinting
Font::get_font_hinting
MouseState
related to logical window sizes.Published by albin-johansson over 4 years ago
All this release fixes is the README which wasn't updated.
Published by albin-johansson over 4 years ago
to_string
methods.std::unique_ptr
and std::shared_ptr
.Image
instances are convertible to SDL_Texture*
.snake_case
, just like the STL.Centurion
in centurion.h
.BlendMode
in blend_mode.h
.BoolConverter
in bool_converter.h
.CenturionException
in centurion_exception.h
.CenturionUtils
in centurion_utils.h
.Color
in color.h
.Colors
in colors.h
.Error
in error.h
.Font
in font.h
.Image
and TextureAccess
in image.h
.ImageGenerator
in image_generator.h
.MessageBox
, ButtonDataHint
, ButtonData
, ColorType
, ColorScheme
and MessageBoxID
in message_box.h
.KeyState
in key_state.h
.MouseState
in mouse_state.h
.Log
, Category
and Priority
in log.h
.MouseState
in mouse_state.h
.Music
, FadeStatus
and MusicType
in music.h
.AppPath
and PrefPath
in paths.h
.Point
and FPoint
in point.h
.Rect
and FRect
in rectangle.h
.Renderer
in renderer.h
.SoundEffect
in sound_effect.h
.System
, Platform
, CPU
, RAM
, PowerState
, Power
and Screen
in system.h
.Timer
in timer.h
.Window
in window.h
.IWindowListener
in window_listener.h
.