added origin to mapper parameters

This commit is contained in:
2026-07-24 19:06:14 -07:00
parent eddbb85256
commit 5298e75fdb
10 changed files with 23 additions and 25 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ namespace UwU {
template <class MapperT>
class MapperBase {
public:
Coord2 map(uint16_t x, uint16_t y) {
return static_cast<MapperT*>(this)->map(x, y);
Coord2 map(uint16_t x0, uint16_t y0, uint16_t x, uint16_t y) {
return static_cast<MapperT*>(this)->map(x0, y0, x, y);
}
};
}
+3 -1
View File
@@ -11,7 +11,9 @@ namespace UwU {
public:
NullMapper() {}
Coord2 map(uint16_t x, uint16_t y) {
Coord2 map(uint16_t x0, uint16_t y0, uint16_t x, uint16_t y) {
(void)x0;
(void)y0;
return Coord2(x, y);
}
};
+2 -6
View File
@@ -9,13 +9,9 @@
namespace UwU {
class OffsetMapper : public MapperBase<OffsetMapper> {
public:
OffsetMapper(uint16_t x0, uint16_t y0) {
this->x0 = x0;
this->y0 = y0;
}
uint16_t x0, y0;
OffsetMapper() {}
Coord2 map(uint16_t x, uint16_t y) {
Coord2 map(uint16_t x0, uint16_t y0, uint16_t x, uint16_t y) {
uint16_t u = x -x0;
uint16_t v = y -y0;
return Coord2(u, v);
+2 -6
View File
@@ -9,13 +9,9 @@
namespace UwU {
class TileMapper : public MapperBase<TileMapper> { // not actually tilemapping yet
public:
TileMapper(uint16_t x0, uint16_t y0) {
this->x0 = x0;
this->y0 = y0;
}
uint16_t x0, y0;
TileMapper() {}
Coord2 map(uint16_t x, uint16_t y) {
Coord2 map(uint16_t x0, uint16_t y0, uint16_t x, uint16_t y) {
uint16_t u = x -x0;
uint16_t v = y -y0;
return Coord2(u, v);