albin-johansson / centurion Goto Github PK
View Code? Open in Web Editor NEWA modern C++ wrapper library for SDL2 in order to improve type-safety, memory safety and overall ease-of-use.
License: MIT License
A modern C++ wrapper library for SDL2 in order to improve type-safety, memory safety and overall ease-of-use.
License: MIT License
Replace the occurrences of separate width and height parameters and use Dimension
instead. It should probably be templated as well.
Improve the code coverage of the message box related components.
Add support for type-safe version of SDL_SetHint and SDL_GetHint.
Improve move and copy constructors and assignment operators by checking that this != &other
before doing anything.
When dealing with rendering menus and other things that require a lot of text rendering, it's often the case that a bunch of fonts need to be used. Since renderers don't manage any fonts on their own, the desired fonts need to be sent alongside the renderer. Investigate if renderers could hold shared pointers that could be obtainable by name, for example.
Consider adding a This is done with the DrawableString
component that will automatically recreate the associated texture whenever the string is updated. This could make it easier to render text that changes often.font_cache
class.
Remove the final
attribute from most classes if not all and add virtual destructors to them.
Use the american spellings.
Window::maximise()
-> Window::maximize()
Window::minimise()
-> Window::minimize()
.Move resources folder to tests, and check that they are CC0. Otherwise, give appropriate credit.
ctn
as an alias for centurion
, in order to make usage of Centurion components nicer in headers.Consider adding a EventLoop
component for easily creating an event-driven window.
Many of the rendering methods of Renderer
are currently const
, this needs to be changed.
const
.This is an issue for when C++11 and C++14 compatibility is dropped, since if constexpr
is needed.
Expand the almost empty touch.h
header.
Change to a property based system for designating getter and setter names, in the style of Qt. For example, if a class is said to have a width property, then the associated methods that you would expect are int width();
and int set_width(int width);
.
Consider removing namespaces that aren't really necessary such as centurion::system
. Too many namespaces makes usage of the library a bit of a nuisance.
This class should be a helper class that combines the features of MouseState
and KeyState
.
MouseState
KeyState
.MouseState
and KeyState
instances in order to construct it.The standard library and many third-party libraries utilise snake_case
for type names and basic_x<T>
for templated base classes.
area
base_path
basic_joystick
basic_renderer
basic_window
battery
blend_mode
button_state
library
, config
color
condition
controller
cursor
event_type
font
font_cache
joystick
joystick_handle
key_code
key_modifier
key_state
mouse_button
mouse_state
music
mutex
pixel_format
platform
pref_path
renderer
renderer_handle
scale_mode
scan_code
scoped_lock
sdl_string
semaphore
sound_effect
surface
texture
texture_access
thread
try_lock
unicode_string
window
window_handle
This class wasn't included in the "Redesign event components" issue because its a bit of a nuisance to implement.
centurion::event::SystemWMEvent
class.void Renderer::fill_rect_t
void Renderer::fill_rect_tf
void Renderer::draw_rect_t
void Renderer::draw_rect_tf
Key::Key(CZString) noexcept
std::string Key::name() const noexcept
bool Key::unknown() const noexcept
for checking if the key has a good value.Overhaul the usage of std::string
and const char*
and review where their respective usage is appropriate. Replace usage of const char*
with some sort of string view, e.g. using StringView = gsl::czstring_span;
...
When C++20 becomes readily available and compilers have implemented most of the new features, Centurion should take advantage of these. These changes are breaking and will not allow for the current C++11, c++14 and C++17 compatibility. In other words, these features should be adapted in a new major release.
Area Screen::size()
Replace usage of <cstdint>
with the SDL2 typedefs. For example, uint32_t
-> Uint32
.
Change Key
to lazily initialize the internal scancode/keycode, since it's often sufficient to only use either scancodes or keycodes. This slightly improves performance when often creating Key
instances.
Area
struct templated, should allow integer and floating-point types like Rect
and Point
does.using Area = Area<int>
to keep backwards compatibility.A new version of the core SDL2 library has been released, update the Centurion library to be up-to-date with the new features. https://www.reddit.com/r/sdl/comments/fgy7sa/sdl_2012_released/
Investigate an issue related to rendering text. This might be fixed by #14, however, the text rendering API seems to be a bit rough around the edges.
move_to
method.resize
method.area
method.Add information about how someone would contribute to the library.
.md
file.Since C++17, we have std::string_view
as a very nice read-only handle to a raw C-style string, whilst still being able to use the read-only API of std::string
. The library should use std::string_view
every time a string isn't claimed, which can and will improve performance drastically due to eliminating the need for expensive copies and allocations when working with std::string
. Naturally, this change would break the C++11 and C++14 compatibility.
IWindowListener
entirely.MouseState
to no longer implement IWindowListener
.Add support for creating "handles" for components that don't actually own the associated resource.
window_handle
renderer_handle
joystick_handle
cursor_handle
surface_handle
texture_handle
For some reason Travis fails whenever the SystemWMEvent is included (at least that is what I think causes the issue).
Improve the experience of using the Renderer
class.
Switch to the trailing return type syntax for non-void methods. It makes the code more readable. This isn't really a breaking change but definitely a major change in how the API looks.
The library is usable on other systems that Windows if it's used in header-only mode. However, the header-only mode isn't very elegant and isn't the recommended way of using the library. Releases should feature compiled binaries for Linux, just as they've been for Windows.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.