[nostalgia] Rename common package to geo

This commit is contained in:
2022-02-13 04:03:10 -06:00
parent 0aa71f1dbb
commit 320df614a9
26 changed files with 131 additions and 130 deletions
+11 -11
View File
@@ -4,7 +4,7 @@
#pragma once
#include <nostalgia/common/point.hpp>
#include <nostalgia/geo/point.hpp>
#include "consts.hpp"
@@ -22,12 +22,12 @@ constexpr std::size_t ptToIdx(int x, int y, int c) noexcept {
}
[[nodiscard]]
constexpr std::size_t ptToIdx(const common::Point &pt, int c) noexcept {
constexpr std::size_t ptToIdx(const geo::Point &pt, int c) noexcept {
return ptToIdx(pt.x, pt.y, c * TileWidth);
}
[[nodiscard]]
constexpr common::Point idxToPt(int i, int c) noexcept {
constexpr geo::Point idxToPt(int i, int c) noexcept {
const auto t = i / PixelsPerTile; // tile number
const auto iti = i % PixelsPerTile; // in tile index
const auto tc = t % c; // tile column
@@ -40,13 +40,13 @@ constexpr common::Point idxToPt(int i, int c) noexcept {
};
}
static_assert(idxToPt(4, 1) == common::Point{4, 0});
static_assert(idxToPt(8, 1) == common::Point{0, 1});
static_assert(idxToPt(8, 2) == common::Point{0, 1});
static_assert(idxToPt(64, 2) == common::Point{8, 0});
static_assert(idxToPt(128, 2) == common::Point{0, 8});
static_assert(idxToPt(129, 2) == common::Point{1, 8});
static_assert(idxToPt(192, 2) == common::Point{8, 8});
static_assert(idxToPt(384, 8) == common::Point{48, 0});
static_assert(idxToPt(4, 1) == geo::Point{4, 0});
static_assert(idxToPt(8, 1) == geo::Point{0, 1});
static_assert(idxToPt(8, 2) == geo::Point{0, 1});
static_assert(idxToPt(64, 2) == geo::Point{8, 0});
static_assert(idxToPt(128, 2) == geo::Point{0, 8});
static_assert(idxToPt(129, 2) == geo::Point{1, 8});
static_assert(idxToPt(192, 2) == geo::Point{8, 8});
static_assert(idxToPt(384, 8) == geo::Point{48, 0});
}