From e206dc1cf625f28149c19eb4dfcbf495ef0efbb4 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 18 Feb 2022 19:31:03 +0100 Subject: refactor: improve options of all kinds --- src/engine/bounds.cpp | 5 ++++- src/engine/bounds.hpp | 4 ++-- src/engine/vector2.cpp | 2 +- src/engine/vector2.hpp | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bounds.cpp b/src/engine/bounds.cpp index 782fd02..aa54439 100644 --- a/src/engine/bounds.cpp +++ b/src/engine/bounds.cpp @@ -1,6 +1,9 @@ #include "bounds.hpp" -Bounds::Bounds(BoundsOpts opts) : _width(opts.width), _height(opts.height) {} +Bounds::Bounds(const BoundsOptions &options) + : _width(options.width), _height(options.height) +{ +} unsigned int Bounds::width() const { diff --git a/src/engine/bounds.hpp b/src/engine/bounds.hpp index 964e73a..0cadb9d 100644 --- a/src/engine/bounds.hpp +++ b/src/engine/bounds.hpp @@ -2,7 +2,7 @@ #include "engine/vector2.hpp" -struct BoundsOpts +struct BoundsOptions { unsigned int width; unsigned int height; @@ -11,7 +11,7 @@ struct BoundsOpts class Bounds { public: - explicit Bounds(BoundsOpts opts); + explicit Bounds(const BoundsOptions &options); [[nodiscard]] unsigned int width() const; diff --git a/src/engine/vector2.cpp b/src/engine/vector2.cpp index 2d2283b..8a5a3c1 100644 --- a/src/engine/vector2.cpp +++ b/src/engine/vector2.cpp @@ -2,7 +2,7 @@ #include -Vector2::Vector2(Vector2Opts opts) : _x(opts.x), _y(opts.y) {} +Vector2::Vector2(const Vector2Options &options) : _x(options.x), _y(options.y) {} unsigned int Vector2::x() const { diff --git a/src/engine/vector2.hpp b/src/engine/vector2.hpp index f69008f..e0c0d6b 100644 --- a/src/engine/vector2.hpp +++ b/src/engine/vector2.hpp @@ -2,7 +2,7 @@ #include -struct Vector2Opts +struct Vector2Options { unsigned int x; unsigned int y; @@ -17,7 +17,7 @@ public: /** * Creates a 2D vector. */ - explicit Vector2(Vector2Opts opts); + explicit Vector2(const Vector2Options &options); /** * Returns the X coordinate. -- cgit v1.2.3-18-g5258