Add SFML project with Paddle class and miscellaneous utilities
- Introduced `Paddle` class for player controls in the SFML project. - Added `main.cpp` to demonstrate basic paddle movement and rendering. - Created reusable templates (`templates.h`) and inline class (`inlines.h`) in the `misc` module. - Defined `structs`, `enums`, `unions` in `misc/structs_enums_unions.h`. - Updated CMake configuration for the `sfml` and `misc` modules. - Included new assets for backgrounds, characters, enemies, and tiles.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// 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 *this < other || *this == other; }
|
||||
bool operator>(const Vector3 &other) const { return !(*this <= other); }
|
||||
bool operator>=(const Vector3 &other) const { return !(*this < other); }
|
||||
|
||||
private:
|
||||
// private
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Vector3& v) {
|
||||
os << "(" << v.x << "/" << v.y << "/" << v.z << ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
enum Weekdays {
|
||||
Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7,
|
||||
|
||||
FORCE_DWORD = 0x7fffffff // DWORD -> double word -> unsigned 32bit, word -> unsigned 16bit
|
||||
};
|
||||
|
||||
union ScreenSize {
|
||||
unsigned int value; // 32bit
|
||||
struct {
|
||||
unsigned short width; // first 16bit
|
||||
unsigned short height; // second 16bit
|
||||
} u;
|
||||
|
||||
struct {
|
||||
unsigned short width; // first 16bit
|
||||
unsigned short height; // second 16bit
|
||||
} _;
|
||||
};
|
||||
|
||||
#endif //MISC_STRUCTS_ENUMS_UNIONS_H
|
||||
Reference in New Issue
Block a user