Files
Adventura/blockPos.hpp
Martin Prokoph 693c389e3f Because of a weird task requirement, folders are not allowed
Who tf came up with this limitation? Seriously...
2025-02-01 19:05:56 +01:00

34 lines
808 B
C++

#pragma once
class BlockPos {
int x;
int y;
public:
BlockPos(int x, int y) {
this->x = x;
this->y = y;
}
int getX() {
return x;
}
int getY() {
return y;
}
unsigned int getUnsignedX() {
return static_cast<unsigned int>(x);
}
unsigned int getUnsignedY() {
return static_cast<unsigned int>(y);
}
bool isNegative() {
return x < 0 || y < 0;
}
BlockPos add(int x, int y) {
return BlockPos(this->x + x, this->y + y);
}
BlockPos operator+(BlockPos offset) {
return BlockPos(this->getX() + offset.getX(), this->getY() + offset.getY());
}
BlockPos operator-(BlockPos offset) {
return BlockPos(this->getX() - offset.getX(), this->getY() - offset.getY());
}
};