Merge commit 'c0baf7efca0e4c3a86a018ad2564d9df7b07c133'
All checks were successful
Build / build (push) Successful in 2m22s
All checks were successful
Build / build (push) Successful in 2m22s
This commit is contained in:
@ -15,10 +15,11 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
PaletteEditorImGui::PaletteEditorImGui(studio::StudioContext &ctx, ox::CRStringView path):
|
||||
PaletteEditorImGui::PaletteEditorImGui(studio::StudioContext &sctx, ox::CRStringView path):
|
||||
Editor(path),
|
||||
m_ctx(ctx.tctx),
|
||||
m_pal(*keel::readObj<Palette>(keelCtx(m_ctx), ox::FileAddress(itemPath())).unwrapThrow()) {
|
||||
m_sctx(sctx),
|
||||
m_tctx(sctx.tctx),
|
||||
m_pal(*keel::readObj<Palette>(keelCtx(m_tctx), ox::FileAddress(itemPath())).unwrapThrow()) {
|
||||
undoStack()->changeTriggered.connect(this, &PaletteEditorImGui::handleCommand);
|
||||
}
|
||||
|
||||
@ -27,12 +28,12 @@ void PaletteEditorImGui::keyStateChanged(turbine::Key key, bool down) {
|
||||
return;
|
||||
}
|
||||
if (key >= turbine::Key::Num_1 && key <= turbine::Key::Num_9) {
|
||||
if (turbine::buttonDown(m_ctx, turbine::Key::Mod_Alt)) {
|
||||
if (turbine::buttonDown(m_tctx, turbine::Key::Mod_Alt)) {
|
||||
m_page = ox::min<std::size_t>(
|
||||
static_cast<uint32_t>(key - turbine::Key::Num_1), m_pal.pages.size() - 1);
|
||||
}
|
||||
} else if (key == turbine::Key::Num_0) {
|
||||
if (turbine::buttonDown(m_ctx, turbine::Key::Mod_Alt)) {
|
||||
if (turbine::buttonDown(m_tctx, turbine::Key::Mod_Alt)) {
|
||||
m_selectedColorRow =
|
||||
ox::min<std::size_t>(
|
||||
static_cast<uint32_t>(key - turbine::Key::Num_1 + 9), m_pal.pages.size() - 1);
|
||||
@ -41,7 +42,7 @@ void PaletteEditorImGui::keyStateChanged(turbine::Key key, bool down) {
|
||||
|
||||
}
|
||||
|
||||
void PaletteEditorImGui::draw(turbine::Context&) noexcept {
|
||||
void PaletteEditorImGui::draw(studio::StudioContext&) noexcept {
|
||||
auto const paneSize = ImGui::GetContentRegionAvail();
|
||||
{
|
||||
ImGui::BeginChild("Pages", ImVec2(250, paneSize.y), true);
|
||||
@ -57,8 +58,7 @@ void PaletteEditorImGui::draw(turbine::Context&) noexcept {
|
||||
}
|
||||
|
||||
ox::Error PaletteEditorImGui::saveItem() noexcept {
|
||||
const auto sctx = applicationData<studio::StudioContext>(m_ctx);
|
||||
return sctx->project->writeObj(itemPath(), m_pal);
|
||||
return m_sctx.project->writeObj(itemPath(), m_pal);
|
||||
}
|
||||
|
||||
void PaletteEditorImGui::drawColumn(ox::CStringView txt) noexcept {
|
||||
@ -70,7 +70,7 @@ void PaletteEditorImGui::drawColumn(ox::CStringView txt) noexcept {
|
||||
|
||||
void PaletteEditorImGui::drawColumn(uint64_t i) noexcept {
|
||||
ox::Array<char, 10> numStr;
|
||||
ox_itoa(i, numStr.data());
|
||||
ox::itoa(i, numStr.data());
|
||||
drawColumn(numStr.data());
|
||||
}
|
||||
|
||||
|
@ -14,17 +14,18 @@ namespace nostalgia::core {
|
||||
class PaletteEditorImGui: public studio::Editor {
|
||||
|
||||
private:
|
||||
turbine::Context &m_ctx;
|
||||
studio::StudioContext &m_sctx;
|
||||
turbine::Context &m_tctx;
|
||||
Palette m_pal;
|
||||
size_t m_selectedColorRow = 0;
|
||||
size_t m_page = 0;
|
||||
|
||||
public:
|
||||
PaletteEditorImGui(studio::StudioContext &ctx, ox::CRStringView path);
|
||||
PaletteEditorImGui(studio::StudioContext &sctx, ox::CRStringView path);
|
||||
|
||||
void keyStateChanged(turbine::Key key, bool down) override;
|
||||
|
||||
void draw(turbine::Context&) noexcept final;
|
||||
void draw(studio::StudioContext&) noexcept final;
|
||||
|
||||
protected:
|
||||
ox::Error saveItem() noexcept final;
|
||||
|
@ -24,7 +24,7 @@ core::DeleteTilesCommand::DeleteTilesCommand(
|
||||
auto dst = m_deletedPixels.data();
|
||||
auto src = p.data() + m_deletePos;
|
||||
const auto sz = m_deleteSz * sizeof(decltype(p[0]));
|
||||
ox_memcpy(dst, src, sz);
|
||||
ox::memcpy(dst, src, sz);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,8 +35,8 @@ void core::DeleteTilesCommand::redo() noexcept {
|
||||
const auto src = p.data() + srcPos;
|
||||
const auto dst1 = p.data() + m_deletePos;
|
||||
const auto dst2 = p.data() + (p.size() - m_deleteSz);
|
||||
ox_memmove(dst1, src, p.size() - srcPos);
|
||||
ox_memset(dst2, 0, m_deleteSz * sizeof(decltype(p[0])));
|
||||
ox::memmove(dst1, src, p.size() - srcPos);
|
||||
ox::memset(dst2, 0, m_deleteSz * sizeof(decltype(p[0])));
|
||||
}
|
||||
|
||||
void DeleteTilesCommand::undo() noexcept {
|
||||
@ -46,8 +46,8 @@ void DeleteTilesCommand::undo() noexcept {
|
||||
const auto dst1 = p.data() + m_deletePos + m_deleteSz;
|
||||
const auto dst2 = src;
|
||||
const auto sz = p.size() - m_deletePos - m_deleteSz;
|
||||
ox_memmove(dst1, src, sz);
|
||||
ox_memcpy(dst2, m_deletedPixels.data(), m_deletedPixels.size());
|
||||
ox::memmove(dst1, src, sz);
|
||||
ox::memcpy(dst2, m_deletedPixels.data(), m_deletedPixels.size());
|
||||
}
|
||||
|
||||
int DeleteTilesCommand::commandId() const noexcept {
|
||||
|
@ -24,7 +24,7 @@ core::InsertTilesCommand::InsertTilesCommand(
|
||||
auto dst = m_deletedPixels.data();
|
||||
auto src = p.data() + p.size() - m_insertCnt;
|
||||
const auto sz = m_insertCnt * sizeof(decltype(p[0]));
|
||||
ox_memcpy(dst, src, sz);
|
||||
ox::memcpy(dst, src, sz);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,8 +34,8 @@ void InsertTilesCommand::redo() noexcept {
|
||||
auto dstPos = m_insertPos + m_insertCnt;
|
||||
const auto dst = p.data() + dstPos;
|
||||
const auto src = p.data() + m_insertPos;
|
||||
ox_memmove(dst, src, p.size() - dstPos);
|
||||
ox_memset(src, 0, m_insertCnt * sizeof(decltype(p[0])));
|
||||
ox::memmove(dst, src, p.size() - dstPos);
|
||||
ox::memset(src, 0, m_insertCnt * sizeof(decltype(p[0])));
|
||||
}
|
||||
|
||||
void InsertTilesCommand::undo() noexcept {
|
||||
@ -46,8 +46,8 @@ void InsertTilesCommand::undo() noexcept {
|
||||
const auto dst1 = p.data() + m_insertPos;
|
||||
const auto dst2 = p.data() + p.size() - m_insertCnt;
|
||||
const auto sz = p.size() - srcIdx;
|
||||
ox_memmove(dst1, src, sz);
|
||||
ox_memcpy(dst2, m_deletedPixels.data(), m_deletedPixels.size());
|
||||
ox::memmove(dst1, src, sz);
|
||||
ox::memcpy(dst2, m_deletedPixels.data(), m_deletedPixels.size());
|
||||
}
|
||||
|
||||
int InsertTilesCommand::commandId() const noexcept {
|
||||
|
@ -78,7 +78,7 @@ static ox::Error toPngFile(
|
||||
TileSheetEditorImGui::TileSheetEditorImGui(studio::StudioContext &sctx, ox::CRStringView path):
|
||||
Editor(path),
|
||||
m_sctx(sctx),
|
||||
m_tctx(sctx.tctx),
|
||||
m_tctx(m_sctx.tctx),
|
||||
m_view(m_sctx, path, *undoStack()),
|
||||
m_model(m_view.model()) {
|
||||
oxIgnoreError(setPaletteSelection());
|
||||
@ -157,7 +157,7 @@ void TileSheetEditorImGui::keyStateChanged(turbine::Key key, bool down) {
|
||||
}
|
||||
}
|
||||
|
||||
void TileSheetEditorImGui::draw(turbine::Context&) noexcept {
|
||||
void TileSheetEditorImGui::draw(studio::StudioContext&) noexcept {
|
||||
auto const paneSize = ImGui::GetContentRegionAvail();
|
||||
auto const tileSheetParentSize = ImVec2(paneSize.x - m_palViewWidth, paneSize.y);
|
||||
auto const fbSize = ox::Vec2(tileSheetParentSize.x - 16, tileSheetParentSize.y - 16);
|
||||
@ -237,7 +237,7 @@ void TileSheetEditorImGui::draw(turbine::Context&) noexcept {
|
||||
}
|
||||
ImGui::EndChild();
|
||||
m_subsheetEditor.draw(m_tctx);
|
||||
m_exportMenu.draw(m_tctx);
|
||||
m_exportMenu.draw(m_sctx);
|
||||
}
|
||||
|
||||
void TileSheetEditorImGui::drawSubsheetSelector(
|
||||
@ -411,12 +411,12 @@ void TileSheetEditorImGui::drawPaletteSelector() noexcept {
|
||||
if (pages > 1) {
|
||||
ImGui::Indent(20);
|
||||
ox::Array<char, 10> numStr;
|
||||
ox_itoa(m_model.palettePage() + 1, numStr.data());
|
||||
ox::itoa(m_model.palettePage() + 1, numStr.data());
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - comboWidthSub);
|
||||
if (ImGui::BeginCombo("Page", numStr.data(), 0)) {
|
||||
for (auto n = 0u; n < pages; ++n) {
|
||||
auto const selected = (m_model.palettePage() == n);
|
||||
ox_itoa(n + 1, numStr.data());
|
||||
ox::itoa(n + 1, numStr.data());
|
||||
if (ImGui::Selectable(numStr.data(), selected) && m_model.palettePage() != n) {
|
||||
m_model.setPalettePage(n);
|
||||
}
|
||||
@ -482,7 +482,7 @@ ox::Error TileSheetEditorImGui::markUnsavedChanges(studio::UndoCommand const*) n
|
||||
return {};
|
||||
}
|
||||
|
||||
void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &ctx) noexcept {
|
||||
void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &sctx) noexcept {
|
||||
constexpr auto popupName = "Edit Subsheet";
|
||||
if (!m_show) {
|
||||
return;
|
||||
@ -491,7 +491,7 @@ void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &ctx) noexcept
|
||||
auto constexpr popupWidth = 235.f;
|
||||
auto const popupHeight = modSize ? 130.f : 85.f;
|
||||
auto const popupSz = ImVec2(popupWidth, popupHeight);
|
||||
if (ig::BeginPopup(ctx, popupName, m_show, popupSz)) {
|
||||
if (ig::BeginPopup(sctx, popupName, m_show, popupSz)) {
|
||||
ImGui::InputText("Name", m_name.data(), m_name.cap());
|
||||
if (modSize) {
|
||||
ImGui::InputInt("Columns", &m_cols);
|
||||
@ -508,7 +508,7 @@ void TileSheetEditorImGui::SubSheetEditor::close() noexcept {
|
||||
m_show = false;
|
||||
}
|
||||
|
||||
void TileSheetEditorImGui::ExportMenu::draw(turbine::Context &ctx) noexcept {
|
||||
void TileSheetEditorImGui::ExportMenu::draw(studio::StudioContext &sctx) noexcept {
|
||||
constexpr auto popupName = "Export Tile Sheet";
|
||||
if (!m_show) {
|
||||
return;
|
||||
@ -516,7 +516,7 @@ void TileSheetEditorImGui::ExportMenu::draw(turbine::Context &ctx) noexcept {
|
||||
constexpr auto popupWidth = 235.f;
|
||||
constexpr auto popupHeight = 85.f;
|
||||
constexpr auto popupSz = ImVec2(popupWidth, popupHeight);
|
||||
if (ig::BeginPopup(ctx, popupName, m_show, popupSz)) {
|
||||
if (ig::BeginPopup(sctx.tctx, popupName, m_show, popupSz)) {
|
||||
ImGui::InputInt("Scale", &m_scale);
|
||||
m_scale = ox::clamp(m_scale, 1, 50);
|
||||
if (ig::PopupControlsOkCancel(popupWidth, m_show) == ig::PopupResponse::OK) {
|
||||
|
@ -40,7 +40,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
||||
m_cols = cols;
|
||||
m_rows = rows;
|
||||
}
|
||||
void draw(turbine::Context &ctx) noexcept;
|
||||
void draw(turbine::Context &sctx) noexcept;
|
||||
void close() noexcept;
|
||||
[[nodiscard]]
|
||||
inline bool isOpen() const noexcept { return m_show; }
|
||||
@ -55,7 +55,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
||||
m_show = true;
|
||||
m_scale = 5;
|
||||
}
|
||||
void draw(turbine::Context &ctx) noexcept;
|
||||
void draw(studio::StudioContext &sctx) noexcept;
|
||||
void close() noexcept;
|
||||
[[nodiscard]]
|
||||
inline bool isOpen() const noexcept { return m_show; }
|
||||
@ -88,7 +88,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
||||
|
||||
void keyStateChanged(turbine::Key key, bool down) override;
|
||||
|
||||
void draw(turbine::Context&) noexcept override;
|
||||
void draw(studio::StudioContext&) noexcept override;
|
||||
|
||||
void drawSubsheetSelector(TileSheet::SubSheet&, TileSheet::SubSheetIdx &path);
|
||||
|
||||
|
@ -43,11 +43,11 @@ static void normalizeSubsheets(TileSheet::SubSheet &ss) noexcept {
|
||||
|
||||
TileSheetEditorModel::TileSheetEditorModel(studio::StudioContext &sctx, ox::StringView path, studio::UndoStack &undoStack):
|
||||
m_sctx(sctx),
|
||||
m_ctx(m_sctx.tctx),
|
||||
m_tctx(m_sctx.tctx),
|
||||
m_path(path),
|
||||
m_img(*readObj<TileSheet>(keelCtx(m_ctx), m_path).unwrapThrow()),
|
||||
m_img(*readObj<TileSheet>(keelCtx(m_tctx), m_path).unwrapThrow()),
|
||||
// ignore failure to load palette
|
||||
m_pal(readObj<Palette>(keelCtx(m_ctx), m_img.defaultPalette).value),
|
||||
m_pal(readObj<Palette>(keelCtx(m_tctx), m_img.defaultPalette).value),
|
||||
m_undoStack(undoStack) {
|
||||
normalizeSubsheets(m_img.subsheet);
|
||||
m_pal.updated.connect(this, &TileSheetEditorModel::markUpdated);
|
||||
@ -71,7 +71,7 @@ void TileSheetEditorModel::cut() {
|
||||
}
|
||||
const auto pt1 = m_selectionOrigin == ox::Point(-1, -1) ? ox::Point(0, 0) : m_selectionOrigin;
|
||||
const auto pt2 = ox::Point(s.columns * TileWidth, s.rows * TileHeight);
|
||||
turbine::setClipboardObject(m_ctx, std::move(cb));
|
||||
turbine::setClipboardObject(m_tctx, std::move(cb));
|
||||
pushCommand(ox::make<CutPasteCommand>(CommandId::Cut, m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb));
|
||||
}
|
||||
|
||||
@ -88,11 +88,11 @@ void TileSheetEditorModel::copy() {
|
||||
cb->addPixel(pt, c);
|
||||
}
|
||||
}
|
||||
turbine::setClipboardObject(m_ctx, std::move(cb));
|
||||
turbine::setClipboardObject(m_tctx, std::move(cb));
|
||||
}
|
||||
|
||||
void TileSheetEditorModel::paste() {
|
||||
auto [cb, err] = turbine::getClipboardObject<TileSheetClipboard>(m_ctx);
|
||||
auto [cb, err] = turbine::getClipboardObject<TileSheetClipboard>(m_tctx);
|
||||
if (err) {
|
||||
oxLogError(err);
|
||||
oxErrf("Could not read clipboard: {}", toStr(err));
|
||||
@ -112,7 +112,7 @@ ox::StringView TileSheetEditorModel::palPath() const noexcept {
|
||||
constexpr ox::StringView uuidPrefix = "uuid://";
|
||||
if (ox::beginsWith(path, uuidPrefix)) {
|
||||
auto uuid = ox::StringView(path.data() + uuidPrefix.bytes(), path.bytes() - uuidPrefix.bytes());
|
||||
auto out = keelCtx(m_ctx).uuidToPath.at(uuid);
|
||||
auto out = keelCtx(m_tctx).uuidToPath.at(uuid);
|
||||
if (out.error) {
|
||||
return {};
|
||||
}
|
||||
@ -123,7 +123,7 @@ ox::StringView TileSheetEditorModel::palPath() const noexcept {
|
||||
}
|
||||
|
||||
ox::Error TileSheetEditorModel::setPalette(ox::StringView path) noexcept {
|
||||
oxRequire(uuid, keelCtx(m_ctx).pathToUuid.at(path));
|
||||
oxRequire(uuid, keelCtx(m_tctx).pathToUuid.at(path));
|
||||
pushCommand(ox::make<PaletteChangeCommand>(activeSubSheetIdx(), m_img, uuid->toString()));
|
||||
return {};
|
||||
}
|
||||
@ -240,7 +240,7 @@ ox::Error TileSheetEditorModel::markUpdatedCmdId(studio::UndoCommand const*cmd)
|
||||
m_updated = true;
|
||||
const auto cmdId = cmd->commandId();
|
||||
if (static_cast<CommandId>(cmdId) == CommandId::PaletteChange) {
|
||||
oxReturnError(readObj<Palette>(keelCtx(m_ctx), m_img.defaultPalette).moveTo(m_pal));
|
||||
oxReturnError(readObj<Palette>(keelCtx(m_tctx), m_img.defaultPalette).moveTo(m_pal));
|
||||
m_palettePage = ox::min<size_t>(m_pal->pages.size(), 0);
|
||||
paletteChanged.emit();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class TileSheetEditorModel: public ox::SignalHandler {
|
||||
private:
|
||||
static Palette const s_defaultPalette;
|
||||
studio::StudioContext &m_sctx;
|
||||
turbine::Context &m_ctx;
|
||||
turbine::Context &m_tctx;
|
||||
ox::String m_path;
|
||||
TileSheet m_img;
|
||||
TileSheet::SubSheetIdx m_activeSubsSheetIdx;
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
TileSheetEditorView::TileSheetEditorView(studio::StudioContext &ctx, ox::StringView path, studio::UndoStack &undoStack):
|
||||
m_model(ctx, path, undoStack),
|
||||
TileSheetEditorView::TileSheetEditorView(studio::StudioContext &sctx, ox::StringView path, studio::UndoStack &undoStack):
|
||||
m_model(sctx, path, undoStack),
|
||||
m_pixelsDrawer(m_model) {
|
||||
glBindVertexArray(0);
|
||||
// build shaders
|
||||
|
@ -50,7 +50,7 @@ class TileSheetEditorView: public ox::SignalHandler {
|
||||
std::size_t m_palIdx = 0;
|
||||
|
||||
public:
|
||||
TileSheetEditorView(studio::StudioContext &ctx, ox::StringView path, studio::UndoStack &undoStack);
|
||||
TileSheetEditorView(studio::StudioContext &sctx, ox::StringView path, studio::UndoStack &undoStack);
|
||||
|
||||
~TileSheetEditorView() override = default;
|
||||
|
||||
|
@ -18,7 +18,7 @@ SceneEditorImGui::SceneEditorImGui(studio::StudioContext &ctx, ox::StringView pa
|
||||
setRequiresConstantRefresh(false);
|
||||
}
|
||||
|
||||
void SceneEditorImGui::draw(turbine::Context&) noexcept {
|
||||
void SceneEditorImGui::draw(studio::StudioContext&) noexcept {
|
||||
auto const paneSize = ImGui::GetContentRegionAvail();
|
||||
m_view.draw(ox::Size{static_cast<int>(paneSize.x), static_cast<int>(paneSize.y)});
|
||||
auto &fb = m_view.framebuffer();
|
||||
|
@ -23,7 +23,7 @@ class SceneEditorImGui: public studio::Editor {
|
||||
public:
|
||||
SceneEditorImGui(studio::StudioContext &ctx, ox::StringView path);
|
||||
|
||||
void draw(turbine::Context&) noexcept final;
|
||||
void draw(studio::StudioContext&) noexcept final;
|
||||
|
||||
void onActivated() noexcept override;
|
||||
|
||||
|
@ -134,12 +134,12 @@ ox::Result<char*> loadRom(ox::CRStringView) noexcept {
|
||||
// media section
|
||||
constexpr auto headerP2 = "R_______________";
|
||||
constexpr auto headerP1 = "KEEL_MEDIA_HEADE";
|
||||
constexpr auto headerP1Len = ox_strlen(headerP2);
|
||||
constexpr auto headerP2Len = ox_strlen(headerP1);
|
||||
constexpr auto headerP1Len = ox::strlen(headerP2);
|
||||
constexpr auto headerP2Len = ox::strlen(headerP1);
|
||||
constexpr auto headerLen = headerP1Len + headerP2Len;
|
||||
for (auto current = MEM_ROM; current < reinterpret_cast<char*>(0x0a000000); current += headerLen) {
|
||||
if (ox_memcmp(current, headerP1, headerP1Len) == 0 &&
|
||||
ox_memcmp(current + headerP1Len, headerP2, headerP2Len) == 0) {
|
||||
if (ox::memcmp(current, headerP1, headerP1Len) == 0 &&
|
||||
ox::memcmp(current + headerP1Len, headerP2, headerP2Len) == 0) {
|
||||
return current + headerLen;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ bool AboutPopup::isOpen() const noexcept {
|
||||
return m_stage == Stage::Open;
|
||||
}
|
||||
|
||||
void AboutPopup::draw(turbine::Context &ctx) noexcept {
|
||||
void AboutPopup::draw(studio::StudioContext &sctx) noexcept {
|
||||
switch (m_stage) {
|
||||
case Stage::Closed:
|
||||
break;
|
||||
@ -41,7 +41,7 @@ void AboutPopup::draw(turbine::Context &ctx) noexcept {
|
||||
constexpr auto modalFlags =
|
||||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
ImGui::SetNextWindowSize(ImVec2(215, 90));
|
||||
studio::ig::centerNextWindow(ctx);
|
||||
studio::ig::centerNextWindow(sctx.tctx);
|
||||
auto open = true;
|
||||
if (ImGui::BeginPopupModal("About", &open, modalFlags)) {
|
||||
ImGui::Text("%s", m_text.c_str());
|
||||
|
@ -35,7 +35,7 @@ class AboutPopup: public studio::Popup {
|
||||
[[nodiscard]]
|
||||
bool isOpen() const noexcept override;
|
||||
|
||||
void draw(turbine::Context &ctx) noexcept override;
|
||||
void draw(studio::StudioContext &sctx) noexcept override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@ ClawEditor::ClawEditor(ox::CRStringView path, ox::ModelObject obj) noexcept:
|
||||
m_obj(std::move(obj)) {
|
||||
}
|
||||
|
||||
void ClawEditor::draw(turbine::Context&) noexcept {
|
||||
void ClawEditor::draw(studio::StudioContext&) noexcept {
|
||||
ImGui::BeginChild("PaletteEditor");
|
||||
static constexpr auto flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody;
|
||||
if (ImGui::BeginTable("ObjTree", 3, flags)) {
|
||||
|
@ -18,7 +18,7 @@ class ClawEditor: public studio::Editor {
|
||||
public:
|
||||
ClawEditor(ox::CRStringView path, ox::ModelObject obj) noexcept;
|
||||
|
||||
void draw(turbine::Context&) noexcept final;
|
||||
void draw(studio::StudioContext&) noexcept final;
|
||||
|
||||
private:
|
||||
static void drawRow(ox::ModelValue const&value) noexcept;
|
||||
|
@ -33,7 +33,7 @@ bool NewMenu::isOpen() const noexcept {
|
||||
return m_open;
|
||||
}
|
||||
|
||||
void NewMenu::draw(turbine::Context &ctx) noexcept {
|
||||
void NewMenu::draw(studio::StudioContext &sctx) noexcept {
|
||||
switch (m_stage) {
|
||||
case Stage::Opening:
|
||||
ImGui::OpenPopup(title().c_str());
|
||||
@ -41,10 +41,10 @@ void NewMenu::draw(turbine::Context &ctx) noexcept {
|
||||
m_open = true;
|
||||
[[fallthrough]];
|
||||
case Stage::NewItemType:
|
||||
drawNewItemType(ctx);
|
||||
drawNewItemType(sctx);
|
||||
break;
|
||||
case Stage::NewItemName:
|
||||
drawNewItemName(ctx);
|
||||
drawNewItemName(sctx);
|
||||
break;
|
||||
case Stage::Closed:
|
||||
m_open = false;
|
||||
@ -61,8 +61,8 @@ void NewMenu::addItemMaker(ox::UniquePtr<studio::ItemMaker> &&im) noexcept {
|
||||
});
|
||||
}
|
||||
|
||||
void NewMenu::drawNewItemType(turbine::Context &ctx) noexcept {
|
||||
drawWindow(ctx, &m_open, [this] {
|
||||
void NewMenu::drawNewItemType(studio::StudioContext &sctx) noexcept {
|
||||
drawWindow(sctx.tctx, &m_open, [this] {
|
||||
auto items = ox_malloca(m_types.size() * sizeof(char const*), char const*, nullptr);
|
||||
for (auto i = 0u; auto const&im : m_types) {
|
||||
items.get()[i] = im->typeName.c_str();
|
||||
@ -73,13 +73,13 @@ void NewMenu::drawNewItemType(turbine::Context &ctx) noexcept {
|
||||
});
|
||||
}
|
||||
|
||||
void NewMenu::drawNewItemName(turbine::Context &ctx) noexcept {
|
||||
drawWindow(ctx, &m_open, [this, &ctx] {
|
||||
void NewMenu::drawNewItemName(studio::StudioContext &sctx) noexcept {
|
||||
drawWindow(sctx.tctx, &m_open, [this, &sctx] {
|
||||
auto const typeIdx = static_cast<std::size_t>(m_selectedType);
|
||||
if (typeIdx < m_types.size()) {
|
||||
ImGui::InputText("Name", m_itemName.data(), m_itemName.cap());
|
||||
}
|
||||
drawLastPageButtons(ctx);
|
||||
drawLastPageButtons(sctx);
|
||||
});
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ void NewMenu::drawFirstPageButtons() noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void NewMenu::drawLastPageButtons(turbine::Context &ctx) noexcept {
|
||||
void NewMenu::drawLastPageButtons(studio::StudioContext &sctx) noexcept {
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 138);
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20);
|
||||
if (ImGui::Button("Back")) {
|
||||
@ -105,7 +105,7 @@ void NewMenu::drawLastPageButtons(turbine::Context &ctx) noexcept {
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Finish")) {
|
||||
finish(ctx);
|
||||
finish(sctx);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Quit")) {
|
||||
@ -114,17 +114,16 @@ void NewMenu::drawLastPageButtons(turbine::Context &ctx) noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void NewMenu::finish(turbine::Context &ctx) noexcept {
|
||||
void NewMenu::finish(studio::StudioContext &sctx) noexcept {
|
||||
if (m_itemName.len() == 0) {
|
||||
return;
|
||||
}
|
||||
auto const sctx = turbine::applicationData<studio::StudioContext>(ctx);
|
||||
auto const&typeMaker = *m_types[static_cast<std::size_t>(m_selectedType)];
|
||||
if (sctx->project->exists(typeMaker.itemPath(m_itemName))) {
|
||||
if (sctx.project->exists(typeMaker.itemPath(m_itemName))) {
|
||||
oxLogError(OxError(1, "New file error: File already exists"));
|
||||
return;
|
||||
}
|
||||
auto const [path, err] = typeMaker.write(ctx, m_itemName);
|
||||
auto const [path, err] = typeMaker.write(sctx, m_itemName);
|
||||
if (err) {
|
||||
oxLogError(err);
|
||||
return;
|
||||
|
@ -43,7 +43,7 @@ class NewMenu: public studio::Popup {
|
||||
[[nodiscard]]
|
||||
bool isOpen() const noexcept override;
|
||||
|
||||
void draw(turbine::Context &ctx) noexcept override;
|
||||
void draw(studio::StudioContext &sctx) noexcept override;
|
||||
|
||||
template<typename T>
|
||||
void addItemType(ox::String name, ox::String parentDir, ox::String fileExt, T itemTempl, ox::ClawFormat pFmt = ox::ClawFormat::Metal) noexcept;
|
||||
@ -54,15 +54,15 @@ class NewMenu: public studio::Popup {
|
||||
void addItemMaker(ox::UniquePtr<studio::ItemMaker> &&im) noexcept;
|
||||
|
||||
private:
|
||||
void drawNewItemType(turbine::Context &ctx) noexcept;
|
||||
void drawNewItemType(studio::StudioContext &sctx) noexcept;
|
||||
|
||||
void drawNewItemName(turbine::Context &ctx) noexcept;
|
||||
void drawNewItemName(studio::StudioContext &sctx) noexcept;
|
||||
|
||||
void drawFirstPageButtons() noexcept;
|
||||
|
||||
void drawLastPageButtons(turbine::Context &ctx) noexcept;
|
||||
void drawLastPageButtons(studio::StudioContext &sctx) noexcept;
|
||||
|
||||
void finish(turbine::Context &ctx) noexcept;
|
||||
void finish(studio::StudioContext &sctx) noexcept;
|
||||
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,7 @@ bool NewProject::isOpen() const noexcept {
|
||||
return m_open;
|
||||
}
|
||||
|
||||
void NewProject::draw(turbine::Context &ctx) noexcept {
|
||||
void NewProject::draw(studio::StudioContext &ctx) noexcept {
|
||||
switch (m_stage) {
|
||||
case Stage::Opening:
|
||||
ImGui::OpenPopup(title().c_str());
|
||||
@ -48,14 +48,14 @@ void NewProject::draw(turbine::Context &ctx) noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void NewProject::drawNewProjectName(turbine::Context &ctx) noexcept {
|
||||
drawWindow(ctx, &m_open, [this, &ctx] {
|
||||
void NewProject::drawNewProjectName(studio::StudioContext &sctx) noexcept {
|
||||
drawWindow(sctx.tctx, &m_open, [this, &sctx] {
|
||||
ImGui::InputText("Name", m_projectName.data(), m_projectName.cap());
|
||||
ImGui::Text("Path: %s", m_projectPath.c_str());
|
||||
if (ImGui::Button("Browse")) {
|
||||
oxLogError(studio::chooseDirectory().moveTo(m_projectPath));
|
||||
}
|
||||
drawLastPageButtons(ctx);
|
||||
drawLastPageButtons(sctx);
|
||||
});
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ void NewProject::drawFirstPageButtons() noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void NewProject::drawLastPageButtons(turbine::Context&) noexcept {
|
||||
void NewProject::drawLastPageButtons(studio::StudioContext&) noexcept {
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 95);
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20);
|
||||
if (ImGui::Button("Finish")) {
|
||||
|
@ -42,14 +42,14 @@ class NewProject: public studio::Popup {
|
||||
[[nodiscard]]
|
||||
bool isOpen() const noexcept override;
|
||||
|
||||
void draw(turbine::Context &ctx) noexcept override;
|
||||
void draw(studio::StudioContext &ctx) noexcept override;
|
||||
|
||||
private:
|
||||
void drawNewProjectName(turbine::Context &ctx) noexcept;
|
||||
void drawNewProjectName(studio::StudioContext &ctx) noexcept;
|
||||
|
||||
void drawFirstPageButtons() noexcept;
|
||||
|
||||
void drawLastPageButtons(turbine::Context &ctx) noexcept;
|
||||
void drawLastPageButtons(studio::StudioContext &ctx) noexcept;
|
||||
|
||||
void finish() noexcept;
|
||||
|
||||
|
@ -37,12 +37,12 @@ static ox::Result<ox::UniquePtr<ProjectTreeModel>> buildProjectTreeModel(
|
||||
ProjectExplorer::ProjectExplorer(turbine::Context &ctx) noexcept: m_ctx(ctx) {
|
||||
}
|
||||
|
||||
void ProjectExplorer::draw(turbine::Context &ctx) noexcept {
|
||||
void ProjectExplorer::draw(studio::StudioContext &ctx) noexcept {
|
||||
auto const viewport = ImGui::GetContentRegionAvail();
|
||||
ImGui::BeginChild("ProjectExplorer", ImVec2(300, viewport.y), true);
|
||||
ImGui::SetNextItemOpen(true);
|
||||
if (m_treeModel) {
|
||||
m_treeModel->draw(ctx);
|
||||
m_treeModel->draw(ctx.tctx);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class ProjectExplorer: public studio::Widget {
|
||||
public:
|
||||
explicit ProjectExplorer(turbine::Context &ctx) noexcept;
|
||||
|
||||
void draw(turbine::Context &ctx) noexcept override;
|
||||
void draw(studio::StudioContext &ctx) noexcept override;
|
||||
|
||||
void setModel(ox::UPtr<ProjectTreeModel> &&model) noexcept;
|
||||
|
||||
|
@ -159,15 +159,15 @@ void StudioUI::draw() noexcept {
|
||||
ImGui::Begin("MainWindow##Studio", nullptr, windowFlags);
|
||||
{
|
||||
if (m_showProjectExplorer) {
|
||||
m_projectExplorer.draw(m_ctx);
|
||||
m_projectExplorer.draw(m_sctx);
|
||||
ImGui::SameLine();
|
||||
}
|
||||
drawTabBar();
|
||||
for (auto &w: m_widgets) {
|
||||
w->draw(m_ctx);
|
||||
w->draw(m_sctx);
|
||||
}
|
||||
for (auto p: m_popups) {
|
||||
p->draw(m_ctx);
|
||||
p->draw(m_sctx);
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
@ -261,7 +261,7 @@ void StudioUI::drawTabs() noexcept {
|
||||
m_activeEditor->onActivated();
|
||||
turbine::setConstantRefresh(m_ctx, m_activeEditor->requiresConstantRefresh());
|
||||
}
|
||||
e->draw(m_ctx);
|
||||
e->draw(m_sctx);
|
||||
m_activeEditorOnLastDraw = e.get();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
@ -18,7 +18,10 @@ class ItemMaker {
|
||||
ox::String const typeName;
|
||||
ox::String const parentDir;
|
||||
ox::String const fileExt;
|
||||
constexpr explicit ItemMaker(ox::StringView pName, ox::StringView pParentDir, ox::CRStringView pFileExt) noexcept:
|
||||
constexpr explicit ItemMaker(
|
||||
ox::StringView pName,
|
||||
ox::StringView pParentDir,
|
||||
ox::StringView pFileExt) noexcept:
|
||||
typeName(pName),
|
||||
parentDir(pParentDir),
|
||||
fileExt(pFileExt) {
|
||||
@ -36,7 +39,8 @@ class ItemMaker {
|
||||
* @param pName
|
||||
* @return path of file or error in Result
|
||||
*/
|
||||
virtual ox::Result<ox::String> write(turbine::Context &ctx, ox::CRStringView pName) const noexcept = 0;
|
||||
virtual ox::Result<ox::String> write(
|
||||
studio::StudioContext &ctx, ox::CRStringView pName) const noexcept = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@ -60,7 +64,7 @@ class ItemMakerT: public ItemMaker {
|
||||
T pItem,
|
||||
ox::ClawFormat pFmt) noexcept:
|
||||
ItemMaker(pDisplayName, pParentDir, fileExt),
|
||||
m_item(pItem),
|
||||
m_item(std::move(pItem)),
|
||||
m_fmt(pFmt) {
|
||||
}
|
||||
constexpr ItemMakerT(
|
||||
@ -73,11 +77,10 @@ class ItemMakerT: public ItemMaker {
|
||||
m_item(std::move(pItem)),
|
||||
m_fmt(pFmt) {
|
||||
}
|
||||
ox::Result<ox::String> write(turbine::Context &ctx, ox::CRStringView pName) const noexcept override {
|
||||
ox::Result<ox::String> write(studio::StudioContext &sctx, ox::CRStringView pName) const noexcept override {
|
||||
auto const path = itemPath(pName);
|
||||
auto const sctx = turbine::applicationData<studio::StudioContext>(ctx);
|
||||
keel::createUuidMapping(keelCtx(ctx), path, ox::UUID::generate().unwrap());
|
||||
oxReturnError(sctx->project->writeObj(path, m_item, m_fmt));
|
||||
keel::createUuidMapping(keelCtx(sctx.tctx), path, ox::UUID::generate().unwrap());
|
||||
oxReturnError(sctx.project->writeObj(path, m_item, m_fmt));
|
||||
return path;
|
||||
}
|
||||
};
|
||||
|
@ -32,7 +32,7 @@ class Popup {
|
||||
[[nodiscard]]
|
||||
virtual bool isOpen() const noexcept = 0;
|
||||
|
||||
virtual void draw(turbine::Context &ctx) noexcept = 0;
|
||||
virtual void draw(studio::StudioContext &ctx) noexcept = 0;
|
||||
|
||||
protected:
|
||||
constexpr void setSize(ox::Size sz) noexcept {
|
||||
|
@ -8,12 +8,14 @@
|
||||
|
||||
#include <turbine/context.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace studio {
|
||||
|
||||
class Widget: public ox::SignalHandler {
|
||||
public:
|
||||
~Widget() noexcept override = default;
|
||||
virtual void draw(turbine::Context&) noexcept = 0;
|
||||
virtual void draw(studio::StudioContext&) noexcept = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ namespace studio {
|
||||
|
||||
FDFilterItem::FDFilterItem(ox::CRStringView pName, ox::CRStringView pSpec) noexcept {
|
||||
name.resize(pName.len() + 1);
|
||||
ox_strncpy(name.data(), pName.data(), pName.len());
|
||||
ox::strncpy(name.data(), pName.data(), pName.len());
|
||||
spec.resize(pSpec.len() + 1);
|
||||
ox_strncpy(spec.data(), pSpec.data(), pSpec.len());
|
||||
ox::strncpy(spec.data(), pSpec.data(), pSpec.len());
|
||||
}
|
||||
|
||||
static ox::Result<ox::String> toResult(nfdresult_t r, NFD::UniquePathN const&path) noexcept {
|
||||
|
@ -37,82 +37,25 @@ inline ox::FileSystem *rom(Context &ctx) noexcept {
|
||||
return keelCtx(ctx).rom.get();
|
||||
}
|
||||
|
||||
struct WrapBase {
|
||||
virtual ~WrapBase() = default;
|
||||
virtual WrapBase *copyTo(ox::Span<char> s) noexcept = 0;
|
||||
virtual operator bool() const noexcept = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct Wrap: public WrapBase {
|
||||
T *data{};
|
||||
Wrap(T *pData) noexcept: data(pData) {
|
||||
}
|
||||
WrapBase *copyTo(ox::Span<char> s) noexcept override {
|
||||
oxAssert(s.size() >= sizeof(Wrap), "too small buffer");
|
||||
return new(s.data()) Wrap{data};
|
||||
}
|
||||
operator bool() const noexcept override {
|
||||
return data != nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
class WrapPtr {
|
||||
private:
|
||||
WrapBase *m_wrapPtr{};
|
||||
ox::Array<char, sizeof(Wrap<void*>)> m_wrapData;
|
||||
public:
|
||||
template<typename T>
|
||||
inline WrapPtr &operator=(T *ptr) noexcept {
|
||||
m_wrapPtr = new(m_wrapData.data()) Wrap(ptr);
|
||||
return *this;
|
||||
}
|
||||
inline WrapPtr &operator=(WrapBase &ptr) noexcept {
|
||||
if (ptr) {
|
||||
m_wrapPtr = ptr.copyTo(m_wrapData);
|
||||
} else {
|
||||
m_wrapPtr = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
inline operator bool() const noexcept {
|
||||
return m_wrapPtr && *m_wrapPtr;
|
||||
}
|
||||
[[nodiscard]]
|
||||
inline WrapBase *getWrapBase() const noexcept {
|
||||
return m_wrapPtr;
|
||||
}
|
||||
};
|
||||
|
||||
void setApplicationDataRaw(Context &ctx, WrapBase &applicationData) noexcept;
|
||||
void setApplicationDataRaw(Context &ctx, ox::AnyPtr const&applicationData) noexcept;
|
||||
|
||||
template<typename T>
|
||||
void setApplicationData(Context &ctx, T *applicationData) noexcept {
|
||||
Wrap w(applicationData);
|
||||
setApplicationDataRaw(ctx, w);
|
||||
setApplicationDataRaw(ctx, applicationData);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
WrapBase *applicationDataRaw(Context &ctx) noexcept;
|
||||
ox::AnyPtr const&applicationDataRaw(Context &ctx) noexcept;
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]]
|
||||
T *applicationData(Context &ctx) noexcept {
|
||||
auto const raw = applicationDataRaw(ctx);
|
||||
if (!raw) [[unlikely]] {
|
||||
return nullptr;
|
||||
}
|
||||
#ifdef OX_BARE_METAL
|
||||
auto const out = static_cast<Wrap<T>*>(raw);
|
||||
#else
|
||||
auto const out = dynamic_cast<Wrap<T>*>(raw);
|
||||
#endif
|
||||
oxAssert(out, "Cast failed - wrong type");
|
||||
return out->data;
|
||||
return applicationDataRaw(ctx).get<T>();
|
||||
}
|
||||
|
||||
void setKeyEventHandler(Context &ctx, KeyEventHandler h) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
KeyEventHandler keyEventHandler(Context &ctx) noexcept;
|
||||
|
||||
}
|
||||
|
@ -18,12 +18,12 @@ keel::Context &keelCtx(Context &ctx) noexcept {
|
||||
return ctx.keelCtx;
|
||||
}
|
||||
|
||||
void setApplicationDataRaw(Context &ctx, WrapBase &applicationData) noexcept {
|
||||
void setApplicationDataRaw(Context &ctx, ox::AnyPtr const&applicationData) noexcept {
|
||||
ctx.applicationData = applicationData;
|
||||
}
|
||||
|
||||
WrapBase *applicationDataRaw(Context &ctx) noexcept {
|
||||
return ctx.applicationData.getWrapBase();
|
||||
ox::AnyPtr const&applicationDataRaw(Context &ctx) noexcept {
|
||||
return ctx.applicationData;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class Context {
|
||||
UpdateHandler updateHandler = [](Context&) -> int {return 0;};
|
||||
keel::Context keelCtx;
|
||||
KeyEventHandler keyEventHandler = nullptr;
|
||||
WrapPtr applicationData;
|
||||
ox::AnyPtr applicationData;
|
||||
|
||||
// GBA impl data /////////////////////////////////////////////////////////
|
||||
bool running = true;
|
||||
|
@ -43,8 +43,8 @@ static ox::Result<std::size_t> findPreloadSection() noexcept {
|
||||
// media section
|
||||
constexpr auto headerP2 = "DER_____________";
|
||||
constexpr auto headerP1 = "KEEL_PRELOAD_HEA";
|
||||
constexpr auto headerP1Len = ox_strlen(headerP2);
|
||||
constexpr auto headerP2Len = ox_strlen(headerP1);
|
||||
constexpr auto headerP1Len = ox::strlen(headerP2);
|
||||
constexpr auto headerP2Len = ox::strlen(headerP1);
|
||||
constexpr auto headerLen = headerP1Len + headerP2Len;
|
||||
for (auto current = MEM_ROM; current < reinterpret_cast<char*>(0x0a000000); current += headerLen) {
|
||||
if (memcmp(current, headerP1, headerP1Len) == 0 &&
|
||||
|
@ -18,7 +18,7 @@ ox::String getClipboardText(Context &ctx) noexcept {
|
||||
|
||||
void setClipboardText(Context &ctx, ox::CRStringView text) noexcept {
|
||||
auto cstr = ox_malloca(text.bytes() + 1, char);
|
||||
ox_strncpy(cstr.get(), text.data(), text.bytes());
|
||||
ox::strncpy(cstr.get(), text.data(), text.bytes());
|
||||
glfwSetClipboardString(ctx.window, cstr.get());
|
||||
}
|
||||
|
||||
|
@ -20,12 +20,12 @@ keel::Context &keelCtx(Context &ctx) noexcept {
|
||||
return ctx.keelCtx;
|
||||
}
|
||||
|
||||
void setApplicationDataRaw(Context &ctx, WrapBase &applicationData) noexcept {
|
||||
void setApplicationDataRaw(Context &ctx, ox::AnyPtr const&applicationData) noexcept {
|
||||
ctx.applicationData = applicationData;
|
||||
}
|
||||
|
||||
WrapBase *applicationDataRaw(Context &ctx) noexcept {
|
||||
return ctx.applicationData.getWrapBase();
|
||||
ox::AnyPtr const&applicationDataRaw(Context &ctx) noexcept {
|
||||
return ctx.applicationData;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ class Context {
|
||||
UpdateHandler updateHandler = [](Context&) -> int {return 0;};
|
||||
keel::Context keelCtx;
|
||||
KeyEventHandler keyEventHandler = nullptr;
|
||||
WrapPtr applicationData;
|
||||
ox::AnyPtr applicationData;
|
||||
|
||||
// GLFW impl data ////////////////////////////////////////////////////////
|
||||
int uninterruptedRefreshes = 3;
|
||||
|
@ -221,7 +221,7 @@ ox::Error initGfx(Context &ctx) noexcept {
|
||||
|
||||
void setWindowTitle(Context &ctx, ox::CRStringView title) noexcept {
|
||||
auto cstr = ox_malloca(title.bytes() + 1, char);
|
||||
ox_strncpy(cstr.get(), title.data(), title.bytes());
|
||||
ox::strncpy(cstr.get(), title.data(), title.bytes());
|
||||
glfwSetWindowTitle(ctx.window, cstr.get());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user