mirror of
https://github.com/Motschen/Adventura.git
synced 2025-12-16 03:45:10 +01:00
Because of a weird task requirement, folders are not allowed
Who tf came up with this limitation? Seriously...
This commit is contained in:
34
blockPos.hpp
Normal file
34
blockPos.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#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());
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user