Merge commit 'b0726568df6aaa37390906ca44ff1eee11735f98'
All checks were successful
Build / build (push) Successful in 1m34s
All checks were successful
Build / build (push) Successful in 1m34s
This commit is contained in:
@ -16,24 +16,19 @@ namespace ox {
|
|||||||
* StringLiteral is used for functions that want to ensure that they are taking
|
* StringLiteral is used for functions that want to ensure that they are taking
|
||||||
* string literals, and not strings outside of the data section of the program
|
* string literals, and not strings outside of the data section of the program
|
||||||
* that might get deleted.
|
* that might get deleted.
|
||||||
* This type cannot force you to use it correctly, so don't give it something
|
|
||||||
* that is not a literal.
|
|
||||||
* If you do this:
|
|
||||||
* StringLiteral(str.c_str())
|
|
||||||
* the resulting segfault is on you.
|
|
||||||
*/
|
*/
|
||||||
class StringLiteral: public detail::BaseStringView {
|
class StringLiteral: public detail::BaseStringView {
|
||||||
public:
|
public:
|
||||||
constexpr StringLiteral() noexcept = default;
|
consteval StringLiteral() noexcept = default;
|
||||||
|
|
||||||
constexpr StringLiteral(StringLiteral const &sv) noexcept = default;
|
constexpr StringLiteral(StringLiteral const &sv) noexcept = default;
|
||||||
|
|
||||||
constexpr explicit StringLiteral(std::nullptr_t) noexcept {}
|
consteval explicit StringLiteral(std::nullptr_t) noexcept {}
|
||||||
|
|
||||||
constexpr explicit StringLiteral(const char *str, std::size_t len) noexcept: BaseStringView{str, len} {}
|
consteval explicit StringLiteral(char const *str, std::size_t const len) noexcept: BaseStringView{str, len} {}
|
||||||
|
|
||||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||||
constexpr explicit StringLiteral(char const *str) noexcept: StringLiteral{str, ox::strlen(str)} {}
|
consteval explicit StringLiteral(char const *str) noexcept: StringLiteral{str, ox::strlen(str)} {}
|
||||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||||
|
|
||||||
constexpr StringLiteral &operator=(StringLiteral const &other) noexcept {
|
constexpr StringLiteral &operator=(StringLiteral const &other) noexcept {
|
||||||
@ -42,7 +37,7 @@ class StringLiteral: public detail::BaseStringView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr const char *c_str() const noexcept {
|
constexpr char const *c_str() const noexcept {
|
||||||
return data();
|
return data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,10 +114,10 @@ struct InitParams {
|
|||||||
ox::Result<ox::UPtr<Context>> init(turbine::Context &tctx, InitParams const ¶ms = {}) noexcept;
|
ox::Result<ox::UPtr<Context>> init(turbine::Context &tctx, InitParams const ¶ms = {}) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
int tileColumns(Context&) noexcept;
|
int tileColumns(Context const&) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
int tileRows(Context&) noexcept;
|
int tileRows(Context const&) noexcept;
|
||||||
|
|
||||||
ox::Error loadBgPalette(
|
ox::Error loadBgPalette(
|
||||||
Context &ctx,
|
Context &ctx,
|
||||||
|
@ -10,11 +10,11 @@ namespace nostalgia::gfx {
|
|||||||
constexpr auto GbaTileColumns = 32;
|
constexpr auto GbaTileColumns = 32;
|
||||||
constexpr auto GbaTileRows = 32;
|
constexpr auto GbaTileRows = 32;
|
||||||
|
|
||||||
int tileColumns(Context&) noexcept {
|
int tileColumns(Context const&) noexcept {
|
||||||
return GbaTileColumns;
|
return GbaTileColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tileRows(Context&) noexcept {
|
int tileRows(Context const&) noexcept {
|
||||||
return GbaTileRows;
|
return GbaTileRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
|
|
||||||
class NewProject: public studio::Popup {
|
class NewProject: public Popup {
|
||||||
public:
|
public:
|
||||||
enum class Stage {
|
enum class Stage {
|
||||||
Closed,
|
Closed,
|
||||||
|
@ -28,7 +28,7 @@ struct Selection {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr auto iterateSelection(studio::Selection const&sel, auto const&cb) {
|
constexpr auto iterateSelection(Selection const &sel, auto const &cb) {
|
||||||
constexpr auto retErr = ox::is_same_v<decltype(cb(0, 0)), ox::Error>;
|
constexpr auto retErr = ox::is_same_v<decltype(cb(0, 0)), ox::Error>;
|
||||||
for (auto x = sel.a.x; x <= sel.b.x; ++x) {
|
for (auto x = sel.a.x; x <= sel.b.x; ++x) {
|
||||||
for (auto y = sel.a.y; y <= sel.b.y; ++y) {
|
for (auto y = sel.a.y; y <= sel.b.y; ++y) {
|
||||||
@ -44,7 +44,7 @@ constexpr auto iterateSelection(studio::Selection const&sel, auto const&cb) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr auto iterateSelectionRows(studio::Selection const&sel, auto const&cb) {
|
constexpr auto iterateSelectionRows(Selection const &sel, auto const &cb) {
|
||||||
constexpr auto retErr = ox::is_same_v<decltype(cb(0, 0)), ox::Error>;
|
constexpr auto retErr = ox::is_same_v<decltype(cb(0, 0)), ox::Error>;
|
||||||
for (auto y = sel.a.y; y <= sel.b.y; ++y) {
|
for (auto y = sel.a.y; y <= sel.b.y; ++y) {
|
||||||
for (auto x = sel.a.x; x <= sel.b.x; ++x) {
|
for (auto x = sel.a.x; x <= sel.b.x; ++x) {
|
||||||
|
@ -12,7 +12,7 @@ namespace studio {
|
|||||||
|
|
||||||
class NoChangesException: public ox::Exception {
|
class NoChangesException: public ox::Exception {
|
||||||
public:
|
public:
|
||||||
inline NoChangesException(std::source_location sloc = std::source_location::current()):
|
explicit NoChangesException(std::source_location sloc = std::source_location::current()):
|
||||||
ox::Exception(1, "Command makes no changes.", sloc) {}
|
ox::Exception(1, "Command makes no changes.", sloc) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
namespace studio {
|
namespace studio {
|
||||||
|
|
||||||
void Popup::drawWindow(turbine::Context &ctx, bool &open, std::function<void()> const &drawContents) {
|
void Popup::drawWindow(turbine::Context &ctx, bool &open, std::function<void()> const &drawContents) {
|
||||||
studio::ig::centerNextWindow(ctx);
|
ig::centerNextWindow(ctx);
|
||||||
ImGui::SetNextWindowSize(static_cast<ImVec2>(m_size));
|
ImGui::SetNextWindowSize(static_cast<ImVec2>(m_size));
|
||||||
constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||||
if (ImGui::BeginPopupModal(m_title.c_str(), &open, modalFlags)) {
|
if (ImGui::BeginPopupModal(m_title.c_str(), &open, modalFlags)) {
|
||||||
|
@ -28,7 +28,7 @@ class ClipboardObject: public BaseClipboardObject {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ox::String getClipboardText(Context &ctx) noexcept;
|
ox::String getClipboardText(Context const &ctx) noexcept;
|
||||||
|
|
||||||
void setClipboardText(Context &ctx, ox::StringViewCR text) noexcept;
|
void setClipboardText(Context &ctx, ox::StringViewCR text) noexcept;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace turbine {
|
namespace turbine {
|
||||||
|
|
||||||
ox::String getClipboardText(Context&) noexcept {
|
ox::String getClipboardText(Context const &) noexcept {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace turbine {
|
namespace turbine {
|
||||||
|
|
||||||
ox::String getClipboardText(Context &ctx) noexcept {
|
ox::String getClipboardText(Context const &ctx) noexcept {
|
||||||
return ox::String(glfwGetClipboardString(ctx.window));
|
return ox::String(glfwGetClipboardString(ctx.window));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user