Add misc and sfml modules with initial implementations, including new classes, assets, and CMake integration.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// Created by David Hackbarth on 27.02.26.
|
||||
//
|
||||
|
||||
#ifndef MISC_STRUCTS_ENUMS_UNIONS_H
|
||||
#define MISC_STRUCTS_ENUMS_UNIONS_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
struct Vector3 {
|
||||
// public
|
||||
float x, y, z;
|
||||
|
||||
bool operator==(const Vector3 &other) const {
|
||||
return x == other.x && y == other.y && z == other.z;
|
||||
}
|
||||
|
||||
bool operator!=(const Vector3 &other) const { return !(*this == other); }
|
||||
bool operator<(const Vector3 &other) const { return x < other.x && y < other.y && z < other.z; }
|
||||
bool operator>(const Vector3 &other) const { return other < *this; }
|
||||
bool operator<=(const Vector3 &other) const { return !(*this > other); }
|
||||
bool operator>=(const Vector3 &other) const { return !(*this < other); }
|
||||
|
||||
Vector3 operator*(float scalar) const { return {x * scalar, y * scalar, z * scalar}; }
|
||||
|
||||
void operator*=(float scalar) {
|
||||
x *= scalar;
|
||||
y *= scalar;
|
||||
z *= scalar;
|
||||
}
|
||||
|
||||
private:
|
||||
// private
|
||||
};
|
||||
|
||||
inline Vector3 operator*(float scalar, const Vector3 &v) { return v * scalar; }
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &os, const Vector3 &v) {
|
||||
os << "(" << v.x << "/" << v.y << "/" << v.z << ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
enum Weekdays {
|
||||
Monday = 1, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday,
|
||||
|
||||
FORCE_DWORD = 0x7fffffff // DWORD -> double word -> unsigned 32bit int, word -> unsigned 16bit int
|
||||
};
|
||||
|
||||
union ScreenSize {
|
||||
// struct {
|
||||
// unsigned short width; // first 16bit
|
||||
// unsigned short height; // second 16bit
|
||||
// };
|
||||
|
||||
struct {
|
||||
unsigned short width; // first 16bit
|
||||
unsigned short height; // second 16bit
|
||||
} u;
|
||||
|
||||
unsigned int value;
|
||||
};
|
||||
|
||||
#endif //MISC_STRUCTS_ENUMS_UNIONS_H
|
||||
Reference in New Issue
Block a user