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 4.1.0

Published by albin-johansson over 4 years ago

Release notes

Version 4.1.0 brings a hint API, a couple of quality-of-life improvements, documentation improvements and a few deprecations.

  • Added a new hint API, located in hints.h. No more need for SDL_SetHint(const char*, const char*)!
  • Improved Renderer
    • Renderer instances can now manage and hold Font instances by itself.
    • Added void Renderer::add_font(const std::string&, const SharedPtr<Font>&)
    • Added Optional<std::string> Renderer::add_font(const SharedPtr<Font>&)
    • Added void Renderer::remove_font(const std::string&)
    • Added SharedPtr<Font> Renderer::font(const std::string&)
    • Added bool Renderer::has_font(const std::string&) const
    • Added void Renderer::draw_rect_t(const IRect&)
    • Added void Renderer::draw_rect_tf(const FRect&)
    • Added void Renderer::fill_rect_t(const IRect&)
    • Added void Renderer::fill_rect_tf(const FRect&)
  • Improved Rect<T>.
    • Added Rect::Rect(Point<T>, TArea<T>)
    • Added void Rect::set(Point<T>, TArea<T>)
    • Added bool Rect::contains(Point<T>) const
    • Deprecated Rect::Rect(T, T, T, T)
    • Deprecated void Rect::set(T, T, T, T)
    • Deprecated bool Rect::contains(T, T) const
  • Improved Key
    • Added Key::Key(CZString)
    • Added std::string Key::name() const
    • Added bool Key::unknown() const
  • Improved Screen
    • Added static IArea Screen::size()
  • Fixed a usage of std::make_unique in message_box.cpp
  • Decided to utilize Doxygen for documentation of library, begun working on hosting documentation with GitHub Pages.
  • Travis now uses GCC 8, the same as the library is being developed with.
centurion - Centurion 4.0.0

Published by albin-johansson over 4 years ago

Release notes

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.

Major changes

Dependencies

  • The gsl dependency has been replaced with gsl-lite. Enabling compatibility with C++11!
  • Usage of 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.

API

  • The library can now be used as a header-only library, this is enabled by defining 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.
  • The naming style has changed to be more Qt-like. This means that many old methods have gotten shorter, less verbose names. The most common change is that getters on the form get_foo() are now called foo().
  • The old point and rectangle classes have been replaced with templated equivalents, Point<T> and Rect<T>.
  • Redesigned the Log class.
  • Redesigned the message box related components.
  • Changed the rendering interface so that rendering methods are no longer considered const.
  • The components in the system.h header have been separated into multiple files. See cpu.h, ram.h, platform.h, screen.h and battery.h.
  • Removed inefficient direct methods for rendering text. Now you'll have to render text to a texture, using the new text-to-texture rendering methods, and then render that resulting texture.
  • C-style strings, const char*, are now aliased with CZString.
  • The library has started using aliases for smart pointers, UniquePtr, SharedPtr and WeakPtr.
  • Removed IWindowListener entirely.
  • All previously deprecated methods or components have been removed.
  • The library now only uses a few specific sub-namespaces, such as 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.
  • Many components have had aspects of their API reworked and improved.

Minor changes

API expansions

  • It's now possible to configure how the library is initialized by supplying a CenturionConfig argument when creating Centurion instances.
  • Added support for pretty much all of the events in SDL2.
  • Drastically improved text rendering support, see Renderer::text_blended, Renderer::text_blended_wrapped , Renderer::text_shaded and Renderer::text_solid.
  • The library has been updated to support some of the new features of SDL2 2.0.12.
  • Added Cursor class.
  • Improved Font class.
  • Improved KeyState class.
  • Improved Texture class.
  • Improve Surface class.
  • Add Key class.
  • Improved Window class.

Documentation

  • Started using GitBook for documentation for the library. Note that this is a work in progress.
  • Improved documentation. This is also a work in progress, and the documentation is continuously being improved as the GitBook documentation is being developed.

Misc

  • Simple getters are inlined by default.
  • Improved testing of the library.
  • Updated the test resources used in the library, credits can be found the resources folder.
  • Non-template operator== and operator!= are now not inlined by default.
  • Replace the usage of #pragma once (which is non-standard) with traditional include guards, which might improve the the portability of the library on some systems.
  • The library no longer uses the type aliases provided in <cstdint>, instead the SDL aliases are used. Such as Uint32 instead of uint32_t.
  • Fixed/Improved license headers.
  • Fixed some inconsistent naming using American/British english. The preferred spelling in the library is always the American spelling, consistent with SDL.
  • Documentation improvements.
centurion - Centurion 3.1.1

Published by albin-johansson over 4 years ago

Release notes

  • Fix memory leak in move constructors for classes that hold a pointer to a dynamically allocated SDL component.
  • Improved testing.
  • Other small documentation and code tweaks.
centurion - Centurion 3.1.0

Published by albin-johansson over 4 years ago

Release notes

  • Fixed the Travis configuration so that it actually runs the unit tests.
  • MouseState now implements the IWindowListener interface.
  • Expanded Point and FPoint.
    • FPoint::distance
    • FPoint::set
    • Point::distance
    • Point::set
    • Overloaded operator+ and operator- for both of the point classes.
  • Added the PixelFormat enum class, located in the image.h header.
  • Added SoundEffect::get_max_volume.
  • Updated ImageGenerator.
    • Deprecated ImageGenerator::unique_img(uint32_t, TextureAccess, int, int)
    • Deprecated ImageGenerator::shared_img(uint32_t, TextureAccess, int, int)
    • Added ImageGenerator::unique_img(PixelFormat, TextureAccess, int, int)
    • Added ImageGenerator::shared_img(PixelFormat, TextureAccess, int, int)
  • Expanded Window.
    • Window::get_renderer.
    • Window::maximise
    • Window::minimise
    • Window::get_display_index
    • Deprecated Window::get_pixel_format. However, the method will not be removed, it will be changed to return a PixelFormat value instead.
  • Improved the Image class.
    • Added Image(gsl::not_null<SDL_Renderer*>, PixelFormat, TextureAccess, int, int)
    • Added Image::unique(gsl::not_null<SDL_Renderer*>, PixelFormat, TextureAccess, int, int)
    • Added Image::shared(gsl::not_null<SDL_Renderer*>, PixelFormat, TextureAccess, int, int)
    • Deprecated Image(gsl::not_null<SDL_Renderer*>, uint32_t, TextureAccess, int, int)
    • Deprecated Image::unique(gsl::not_null<SDL_Renderer*>, uint32_t, TextureAccess, int, int)
    • Deprecated Image::shared(gsl::not_null<SDL_Renderer*>, uint32_t, TextureAccess, int, int)
  • Improved and expanded the Rect and FRect classes.
    • Overloaded operator== and operator!= for both of the rectangle classes.
  • Expanded CPU class.
    • CPU::is_little_endian
    • CPU::is_big_endian
  • Add FontHint enum class.
  • Expanded Font class.
    • Font::set_font_hinting
    • Font::get_font_hinting
  • Fixed a bug in MouseState related to logical window sizes.
  • Fixed minor documentation flaws.
  • Improved unit tests.
  • Add Doxygen file.
  • Other small code improvements.
centurion - Centurion 3.0.1

Published by albin-johansson over 4 years ago

Release notes

All this release fixes is the README which wasn't updated.

centurion - Centurion 3.0.0

Published by albin-johansson over 4 years ago

Features

  • Redesigned all of the components of the Centurion library.
  • The library now supports modern C++ features such as move constructors.
  • All relevant classes have received to_string methods.
  • Most classes provide factory methods for std::unique_ptr and std::shared_ptr.
  • Several classes are convertible to their SDL counterparts. For instance, Image instances are convertible to SDL_Texture*.
  • Much more of the SDL library is covered compared to older versions of Centurion.
  • The methods in the library now use snake_case, just like the STL.
  • All of the Centurion enum classes that mirror an SDL enum can be safely converted and compared.

These are the classes (and enum classes) available in this release

  • 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.