added origin to mapper parameters
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user