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/basic/defs.hpp | 12 ------- src/basic/math.cpp | 94 ------------------------------------------------------ src/basic/math.hpp | 68 --------------------------------------- 3 files changed, 174 deletions(-) delete mode 100644 src/basic/defs.hpp delete mode 100644 src/basic/math.cpp delete mode 100644 src/basic/math.hpp (limited to 'src/basic') diff --git a/src/basic/defs.hpp b/src/basic/defs.hpp deleted file mode 100644 index 858bdd7..0000000 --- a/src/basic/defs.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -#define ARRAY_COUNT(x) (sizeof(x) / sizeof(x[0])) - -#define InvalidDefaultCase assert(0) - -#define KIBIBYTES(x) ((x)*1024) -#define MEBIBYTES(x) ((x)*KIBIBYTES(1024)) -#define GIBIBYTES(x) ((x)*MEBIBYTES(1024)) - diff --git a/src/basic/math.cpp b/src/basic/math.cpp deleted file mode 100644 index 81fcbbf..0000000 --- a/src/basic/math.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include - -/* V2ST */ - -bool -V2ST::operator==(V2ST& b) -{ - bool result = this->x == b.x && this->y == b.y; - return result; -} - - - -/* V2F32 */ - -V2F32 -V2F32::operator/(float scalar) -{ - V2F32 result {}; - result.x = this->x / scalar; - result.y = this->y / scalar; - return result; -} - -V2F32 -V2F32::operator*(float scalar) -{ - V2F32 result {}; - result.x = this->x * scalar; - result.y = this->y * scalar; - return result; -} - -V2F32 V2F32::operator+(V2F32 other) { - V2F32 result {}; - result.x = this->x + other.x; - result.y = this->y + other.y; - return result; -} - - -/* V3F32 */ - -V3F32 V3F32::operator/(float scalar) { - V3F32 result = {}; - result.x = this->x / scalar; - result.y = this->y / scalar; - result.z = this->z / scalar; - return result; -} - -V3F32 V3F32::operator*(float scalar) { - V3F32 result = {}; - result.x = this->x * scalar; - result.y = this->y * scalar; - result.z = this->z * scalar; - return result; -} - - -/* V4F32 */ - -V4F32 -V4F32::operator/(float scalar) -{ - V4F32 result {}; - result.x = this->x / scalar; - result.y = this->y / scalar; - result.z = this->z / scalar; - result.w = this->w / scalar; - return result; -} - -V4F32 -V4F32::operator*(float scalar) -{ - V4F32 result {}; - result.x = this->x * scalar; - result.y = this->y * scalar; - result.z = this->z * scalar; - result.w = this->z * scalar; - return result; -} - - -/* V2I32 */ - -bool -V2I32::operator==(V2I32 other) -{ - bool result = x == other.x && y == other.y; - return result; -} - diff --git a/src/basic/math.hpp b/src/basic/math.hpp deleted file mode 100644 index a3e4b64..0000000 --- a/src/basic/math.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#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; -}; - -struct RectF32 { - float x0; - float y0; - float x1; - float y1; -}; - -- cgit v1.2.3