Squashed 'deps/nostalgia/' changes from 5e90f8d4..3b874c6e

3b874c6e [turbine] Fix refresh logic to handle default refresh within value
6cf7bf96 [ox/std] Hopefully fix MSVC build
e34df255 [nostalgia] Update developer-handbook non-error return
7eab2f92 [studio/modlib] Comment out logging in configio
3824788a [ox/std] Add non-const operator[] to Pair
1eac7e1e [ox/std] Add Pair
8798d2d7 [nostalgia/core] Fix getTileIdx(TileSheet, SubSheetId)
f82db690 [nostalgia/core] Make load TileSheet functions take CompactTileSheet, in addition to FileAddresses
0dfa7c30 [studio/modlib] Make TaskRunner check that task is not null
2afade24 Merge commit 'fc2dec64389824a251fb258f6fd0a9074e521cc2'
3635702e [nostalgia] Cleanup config IO
6cbafc75 [nostalgia,keel] Make repair return ox::Error
0d7b89a0 [turbine] Add TimeMs alias to uint64_t
e8f5c911 [studio/applib] Change updateHandler to 10 second interval
3cb3bc12 [nostalgia/core] Add valid and repair functions for PaletteV3
a2cec10c [keel] Add valid and repair functions for AssetManager

git-subtree-dir: deps/nostalgia
git-subtree-split: 3b874c6e6aa0b80783fc9d712c31bc837326337c
This commit is contained in:
2024-06-18 00:50:59 -05:00
parent fc2dec6438
commit 2da3579818
24 changed files with 240 additions and 253 deletions

View File

@ -113,6 +113,7 @@ install(
memory.hpp
new.hpp
optional.hpp
pair.hpp
point.hpp
random.hpp
ranges.hpp

View File

@ -14,32 +14,20 @@
namespace ox {
constexpr Vec2::operator Point() const noexcept {
return {
static_cast<int32_t>(x),
static_cast<int32_t>(y),
};
}
constexpr Point::Point(Vec2 const&pt) noexcept:
x(static_cast<int32_t>(pt.x)),
y(static_cast<int32_t>(pt.y)) {}
constexpr Vec2::operator Size() const noexcept {
return {
static_cast<int32_t>(x),
static_cast<int32_t>(y),
};
}
constexpr Size::Size(Vec2 const&pt) noexcept:
width(static_cast<int32_t>(pt.x)),
height(static_cast<int32_t>(pt.y)) {}
constexpr Point::operator Vec2() const noexcept {
return {
static_cast<float>(x),
static_cast<float>(y),
};
}
constexpr Vec2::Vec2(Point const&pt) noexcept:
x(static_cast<float>(pt.x)),
y(static_cast<float>(pt.y)) {}
constexpr Size::operator Vec2() const noexcept {
return {
static_cast<float>(width),
static_cast<float>(height),
};
}
constexpr Vec2::Vec2(Size const&pt) noexcept:
x(static_cast<float>(pt.width)),
y(static_cast<float>(pt.height)) {}
}

19
deps/ox/src/ox/std/pair.hpp vendored Normal file
View File

@ -0,0 +1,19 @@
/*
* Copyright 2015 - 2024 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
namespace ox {
template<typename T, typename U = T>
struct Pair {
T a{};
U b{};
};
}

View File

@ -24,6 +24,8 @@ class Point {
constexpr Point(int x, int y) noexcept;
explicit constexpr Point(class Vec2 const&pt) noexcept;
constexpr Point operator+(const Point &p) const noexcept;
constexpr Point operator-(const Point &p) const noexcept;

View File

@ -24,6 +24,8 @@ class Size {
constexpr Size(int width, int height) noexcept;
explicit constexpr Size(class Vec2 const&pt) noexcept;
constexpr Size operator+(Size p) const noexcept;
constexpr Size operator-(Size p) const noexcept;

View File

@ -228,6 +228,10 @@ class Span {
return iterator<const T&, const T*, true>(m_items, MaxValue<size_type>, m_size);
}
constexpr T &operator[](std::size_t i) noexcept {
return m_items[i];
}
constexpr const T &operator[](std::size_t i) const noexcept {
return m_items[i];
}

View File

@ -35,6 +35,7 @@
#include "memory.hpp"
#include "new.hpp"
#include "optional.hpp"
#include "pair.hpp"
#include "point.hpp"
#include "random.hpp"
#include "realstd.hpp"

View File

@ -142,6 +142,10 @@ class Vec2 {
constexpr Vec2() noexcept = default;
explicit constexpr Vec2(class Point const&pt) noexcept;
explicit constexpr Vec2(class Size const&pt) noexcept;
template<typename ...Args>
constexpr Vec2(float pX, float pY) noexcept: x(pX), y(pY) {
}