From c775ca6133d93ed97359a6a50bd94a5563c740de Mon Sep 17 00:00:00 2001 From: fschildt Date: Wed, 1 Oct 2025 14:08:24 +0200 Subject: general refactoring, prepare breakout game --- src/common/math.hpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/common/math.hpp (limited to 'src/common/math.hpp') diff --git a/src/common/math.hpp b/src/common/math.hpp new file mode 100644 index 0000000..de856e8 --- /dev/null +++ b/src/common/math.hpp @@ -0,0 +1,61 @@ +#pragma once + + +#include + +#include +#include + + +struct V2ST { + size_t x; + size_t y; + + bool operator==(V2ST &b); + bool operator==(const V2ST& other) const { + return x == other.x && y == other.y; + } +}; + +struct V2F32 { + float x; + float y; + + V2F32 operator/(float scalar); + V2F32 operator*(float scalar); + V2F32 operator+(V2F32 other); +}; + +struct V3F32 { + float x; + float y; + float z; + + V3F32 operator/(float scalar); + V3F32 operator*(float scalar); +}; + +struct V4F32 { + float x; + float y; + float z; + float w; + + V4F32 operator/(float scalar); + V4F32 operator*(float scalar); +}; + +struct V2I32 { + int32_t x; + int32_t y; + + bool operator==(V2I32 other); +}; + +struct Color { + float r; + float g; + float b; + float a; +}; + -- cgit v1.2.3