Match and link CVector2i

This commit is contained in:
Phillip Stephens 2022-10-04 13:11:34 -07:00
parent 4b24bba57e
commit 45312e97ea
4 changed files with 34 additions and 3 deletions

View File

@ -33,6 +33,7 @@ COMPLETE_OBJECTS = [
"Kyoto/Graphics/CGX", "Kyoto/Graphics/CGX",
"Kyoto/Particles/CWarp", "Kyoto/Particles/CWarp",
"Kyoto/Math/CPlane", "Kyoto/Math/CPlane",
"Kyoto/Math/CVector2i",
"Kyoto/Math/CVector3d", "Kyoto/Math/CVector3d",
"Kyoto/Math/CVector3i", "Kyoto/Math/CVector3i",
"Kyoto/CRandom16", "Kyoto/CRandom16",

View File

@ -7,9 +7,16 @@ class CVector2i {
public: public:
CVector2i(int, int); CVector2i(int, int);
int GetX() const { return mX; }
int GetY() const { return mY; }
private: private:
int x; int mX;
int y; int mY;
}; };
CVector2i operator+(const CVector2i& lhs, const CVector2i& rhs);
CVector2i operator+(const CVector2i& lhs, const CVector2i& rhs);
bool operator==(const CVector2i& lhs, const CVector2i& rhs);
CVector2i operator*(const CVector2i& lhs, int rhs);
CVector2i operator/(const CVector2i& lhs, int rhs);
#endif #endif

View File

@ -521,7 +521,7 @@ KYOTO_1 :=\
$(BUILD_DIR)/asm/Kyoto/Math/CTransform4f.o\ $(BUILD_DIR)/asm/Kyoto/Math/CTransform4f.o\
$(BUILD_DIR)/asm/Kyoto/Math/CUnitVector3f.o\ $(BUILD_DIR)/asm/Kyoto/Math/CUnitVector3f.o\
$(BUILD_DIR)/asm/Kyoto/Math/CVector2f.o\ $(BUILD_DIR)/asm/Kyoto/Math/CVector2f.o\
$(BUILD_DIR)/asm/Kyoto/Math/CVector2i.o\ $(BUILD_DIR)/src/Kyoto/Math/CVector2i.o\
$(BUILD_DIR)/src/Kyoto/Math/CVector3d.o\ $(BUILD_DIR)/src/Kyoto/Math/CVector3d.o\
$(BUILD_DIR)/asm/Kyoto/Math/CVector3f.o\ $(BUILD_DIR)/asm/Kyoto/Math/CVector3f.o\
$(BUILD_DIR)/src/Kyoto/Math/CVector3i.o\ $(BUILD_DIR)/src/Kyoto/Math/CVector3i.o\

View File

@ -0,0 +1,23 @@
#include "Kyoto/Math/CVector2i.hpp"
CVector2i::CVector2i(int x, int y) : mX(x), mY(y) {}
CVector2i operator+(const CVector2i& lhs, const CVector2i& rhs) {
return CVector2i(lhs.GetX() + rhs.GetX(), lhs.GetY() + rhs.GetY());
}
CVector2i operator-(const CVector2i& lhs, const CVector2i& rhs) {
return CVector2i(lhs.GetX() - rhs.GetX(), lhs.GetY() - rhs.GetY());
}
bool operator==(const CVector2i& lhs, const CVector2i& rhs) {
return lhs.GetX() == rhs.GetX() && lhs.GetY() == rhs.GetY();
}
CVector2i operator*(const CVector2i& lhs, int rhs) {
return CVector2i(lhs.GetX() * rhs, lhs.GetY() * rhs);
}
CVector2i operator/(const CVector2i& lhs, int rhs) {
return CVector2i(lhs.GetX() / rhs, lhs.GetY() / rhs);
}