#pragma once #include #include #include #include #include #include #include #include #include #include #include /// \~chinese /// @brief 不可拷贝对象 class Noncopyable { protected: Noncopyable() = default; private: Noncopyable(const Noncopyable &) = delete; Noncopyable &operator=(const Noncopyable &) = delete; }; typedef struct VecPos { int x; int y; // 构造函数,方便初始化 VecPos(int x_ = 0, int y_ = 0) : x(x_), y(y_) {} // 定义到 SDL_Point 的转换运算符 operator SDL_Point() const { return {x, y}; // 直接返回包含 x、y 的 SDL_Point } // 加法运算符重载:两个 VecPos 相加 VecPos operator+(const VecPos &other) const { return VecPos(x + other.x, y + other.y); } // 减法运算符重载:两个 VecPos 相减 VecPos operator-(const VecPos &other) const { return VecPos(x - other.x, y - other.y); } // 复合赋值加法:当前对象加上另一个 VecPos VecPos &operator+=(const VecPos &other) { x += other.x; y += other.y; return *this; } // 复合赋值减法:当前对象减去另一个 VecPos VecPos &operator-=(const VecPos &other) { x -= other.x; y -= other.y; return *this; } } VecPos; typedef struct VecFPos { float x; float y; } VecFPos; typedef struct VecSize { int width; int height; } VecSize;