[nostalgia] Break part of core out into Turbine and TeaGBA libraries

This commit is contained in:
2023-06-01 23:22:31 -05:00
parent 07284ac595
commit 8c43baedea
119 changed files with 1918 additions and 1873 deletions
+2 -4
View File
@@ -2,14 +2,12 @@
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/std/memory.hpp>
#include "sceneeditor-imgui.hpp"
#include "module.hpp"
namespace nostalgia::scene {
ox::Vector<studio::EditorMaker> StudioModule::editors(core::Context *ctx) noexcept {
ox::Vector<studio::EditorMaker> StudioModule::editors(turbine::Context *ctx) noexcept {
return {
{
{"nscn"},
@@ -20,7 +18,7 @@ ox::Vector<studio::EditorMaker> StudioModule::editors(core::Context *ctx) noexce
};
}
ox::Vector<ox::UPtr<studio::ItemMaker>> StudioModule::itemMakers(core::Context*) noexcept {
ox::Vector<ox::UPtr<studio::ItemMaker>> StudioModule::itemMakers(turbine::Context*) noexcept {
ox::Vector<ox::UPtr<studio::ItemMaker>> out;
return out;
}
+4 -2
View File
@@ -4,14 +4,16 @@
#pragma once
#include <turbine/turbine.hpp>
#include <nostalgia/studio/studio.hpp>
namespace nostalgia::scene {
class StudioModule: public studio::Module {
public:
ox::Vector<studio::EditorMaker> editors(core::Context *ctx) noexcept override;
ox::Vector<ox::UPtr<studio::ItemMaker>> itemMakers(core::Context*) noexcept override;
ox::Vector<studio::EditorMaker> editors(turbine::Context *ctx) noexcept override;
ox::Vector<ox::UPtr<studio::ItemMaker>> itemMakers(turbine::Context*) noexcept override;
};
}
@@ -12,7 +12,7 @@
namespace nostalgia::scene {
SceneEditorImGui::SceneEditorImGui(core::Context *ctx, ox::CRStringView path):
SceneEditorImGui::SceneEditorImGui(turbine::Context *ctx, ox::CRStringView path):
m_editor(ctx, path),
m_view(ctx, m_editor.scene()) {
m_ctx = ctx;
@@ -30,7 +30,7 @@ ox::CRString SceneEditorImGui::itemDisplayName() const noexcept {
return m_itemName;
}
void SceneEditorImGui::draw(core::Context*) noexcept {
void SceneEditorImGui::draw(turbine::Context*) noexcept {
const auto paneSize = ImGui::GetContentRegionAvail();
const ox::Size fbSize{
static_cast<int>(paneSize.x),
@@ -50,7 +50,7 @@ void SceneEditorImGui::onActivated() noexcept {
}
ox::Error SceneEditorImGui::saveItem() noexcept {
const auto sctx = applicationData<studio::StudioContext>(m_ctx);
const auto sctx = applicationData<studio::StudioContext>(*m_ctx);
oxReturnError(sctx->project->writeObj(m_itemPath, &m_editor.scene()));
oxReturnError(m_ctx->assetManager.setAsset(m_itemPath, m_editor.scene()));
return {};
@@ -15,14 +15,14 @@ namespace nostalgia::scene {
class SceneEditorImGui: public studio::Editor {
private:
core::Context *m_ctx = nullptr;
turbine::Context *m_ctx = nullptr;
ox::String m_itemName;
ox::String m_itemPath;
SceneEditor m_editor;
SceneEditorView m_view;
public:
SceneEditorImGui(core::Context *ctx, ox::CRStringView path);
SceneEditorImGui(turbine::Context *ctx, ox::CRStringView path);
/**
* Returns the name of item being edited.
@@ -31,7 +31,7 @@ class SceneEditorImGui: public studio::Editor {
ox::CRString itemDisplayName() const noexcept final;
void draw(core::Context*) noexcept final;
void draw(turbine::Context*) noexcept final;
void onActivated() noexcept override;
+1 -1
View File
@@ -6,7 +6,7 @@
namespace nostalgia::scene {
SceneEditor::SceneEditor(core::Context *ctx, ox::CRStringView path) {
SceneEditor::SceneEditor(turbine::Context *ctx, ox::CRStringView path) {
m_ctx = ctx;
oxRequireT(scn, keel::readObj<SceneStatic>(m_ctx, path));
m_scene = *scn;
+2 -2
View File
@@ -13,13 +13,13 @@ namespace nostalgia::scene {
class SceneEditor {
private:
core::Context *m_ctx = nullptr;
turbine::Context *m_ctx = nullptr;
ox::String m_itemName;
ox::String m_itemPath;
SceneStatic m_scene;
public:
SceneEditor(core::Context *ctx, ox::CRStringView path);
SceneEditor(turbine::Context *ctx, ox::CRStringView path);
const SceneStatic &scene() noexcept {
return m_scene;
@@ -2,20 +2,20 @@
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <nostalgia/core/gfx.hpp>
#include <nostalgia/core/core.hpp>
#include "sceneeditorview.hpp"
namespace nostalgia::scene {
SceneEditorView::SceneEditorView(core::Context *ctx, const SceneStatic &sceneStatic) noexcept:
m_ctx(ctx),
SceneEditorView::SceneEditorView(turbine::Context *tctx, const SceneStatic &sceneStatic):
m_sceneStatic(sceneStatic),
m_scene(m_sceneStatic) {
oxThrowError(core::init(tctx, {.glInstallDrawer = false}).moveTo(&m_cctx));
}
ox::Error SceneEditorView::setupScene() noexcept {
return m_scene.setupDisplay(m_ctx);
return m_scene.setupDisplay(m_cctx.get());
}
void SceneEditorView::draw(int width, int height) noexcept {
@@ -23,8 +23,8 @@ void SceneEditorView::draw(int width, int height) noexcept {
glutils::resizeInitFrameBuffer(&m_frameBuffer, width, height);
}
glutils::bind(m_frameBuffer);
core::gl::setRenderSize(m_ctx, width, height);
core::gl::drawMainView(m_ctx);
core::gl::setRenderSize(m_cctx.get(), width, height);
core::gl::drawMainView(m_cctx.get());
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
@@ -13,13 +13,13 @@ namespace nostalgia::scene {
class SceneEditorView {
private:
core::Context *const m_ctx = nullptr;
ox::UPtr<core::Context> m_cctx;
const SceneStatic &m_sceneStatic;
Scene m_scene;
glutils::FrameBuffer m_frameBuffer;
public:
SceneEditorView(core::Context *ctx, const SceneStatic &sceneStatic) noexcept;
SceneEditorView(turbine::Context *ctx, const SceneStatic &sceneStatic);
ox::Error setupScene() noexcept;