Load BIOS font
This commit is contained in:
@@ -15,7 +15,15 @@ namespace JabyEngine {
|
||||
}
|
||||
|
||||
constexpr T add(S dx, S dy) const {
|
||||
return T(static_cast<const T*>(this)->x, static_cast<const T*>(this)->y).add(dx, dy);
|
||||
return T::create(static_cast<const T*>(this)->x, static_cast<const T*>(this)->y).add(dx, dy);
|
||||
}
|
||||
|
||||
constexpr T& add(const T& offset) {
|
||||
return add(offset.x, offset.y);
|
||||
}
|
||||
|
||||
constexpr T add(const T& offset) const {
|
||||
return add(offset.x, offset.y);
|
||||
}
|
||||
|
||||
constexpr T& sub(S dx, S dy) {
|
||||
@@ -29,6 +37,14 @@ namespace JabyEngine {
|
||||
return T::create(static_cast<const T*>(this)->x, static_cast<const T*>(this)->y).sub(dx, dy);
|
||||
}
|
||||
|
||||
constexpr T& sub(const T& offset) {
|
||||
return sub(offset.x, offset.y);
|
||||
}
|
||||
|
||||
constexpr T sub(const T& offset) const {
|
||||
return sub(offset.x, offset.y);
|
||||
}
|
||||
|
||||
constexpr T& move(S dx, S dy) {
|
||||
return this->add(dx, dy);
|
||||
}
|
||||
@@ -160,6 +176,22 @@ namespace JabyEngine {
|
||||
// Type used for primitives
|
||||
typedef PositionI16 Vertex;
|
||||
|
||||
template<typename T, typename S>
|
||||
static constexpr T tile_id_for(S id, S row_count, Size<S> size) {
|
||||
const auto x = id%row_count;
|
||||
const auto y = id/row_count;
|
||||
|
||||
return T::create(static_cast<S>(size.width*x), static_cast<S>(size.height*y));
|
||||
}
|
||||
|
||||
template<typename T, typename S>
|
||||
static constexpr T tile_id_for16(S id) {
|
||||
const auto x = id&0xF;
|
||||
const auto y = id >> 4;
|
||||
|
||||
return T::create(static_cast<S>(x << 4), static_cast<S>(y << 4));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct Area {
|
||||
Position<T> position;
|
||||
@@ -201,10 +233,7 @@ namespace JabyEngine {
|
||||
}
|
||||
|
||||
static constexpr PageOffset from_tile_id(int16_t id, int16_t row_count, SizeI16 size) {
|
||||
const auto x = id%row_count;
|
||||
const auto y = id/row_count;
|
||||
|
||||
return PageOffset::create(static_cast<int16_t>(size.width*x), static_cast<int16_t>(size.height*y));
|
||||
return tile_id_for<PageOffset>(id, row_count, size);
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user