Squashed 'deps/nostalgia/' changes from 6837a055..98ddb08a

98ddb08a [nostalgia] Cleanup
8d1701b0 [turbine/glfw] Ensure window opens with a standard mandatory refresh period
1048e522 [imgui] Make ImGui not an object lib
ee59da4a [glad] Make glad not an object lib
1ba64cb5 Merge commit '07610a5af2aaaac9cfcdcf8359b33f7df40d46cd'
462bebf6 [nostalgia/core] Cleanup unused function declaration
e3f84c4e [studio] Make first tab not draw before selected tab when window opens

git-subtree-dir: deps/nostalgia
git-subtree-split: 98ddb08abd68d2d31864fb44d240b2d79a0022c1
This commit is contained in:
Gary Talent 2025-01-05 22:40:22 -06:00
parent 07610a5af2
commit 7f481ef79f
11 changed files with 38 additions and 18 deletions

View File

@ -1,5 +1,6 @@
BC_VAR_PROJECT_NAME=nostalgia BC_VAR_PROJECT_NAME=nostalgia
BC_VAR_PROJECT_NAME_CAP=Nostalgia BC_VAR_PROJECT_NAME_CAP=Nostalgia
BC_VAR_DEVENV_ROOT=util
BUILDCORE_PATH=deps/buildcore BUILDCORE_PATH=deps/buildcore
include ${BUILDCORE_PATH}/base.mk include ${BUILDCORE_PATH}/base.mk
@ -13,7 +14,7 @@ endif
.PHONY: pkg-gba .PHONY: pkg-gba
pkg-gba: build pkg-gba: build
${BC_CMD_ENVRUN} ${BC_PY3} ./scripts/pkg-gba.py sample_project ${BC_VAR_PROJECT_NAME} ${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/pkg-gba.py sample_project ${BC_VAR_PROJECT_NAME}
.PHONY: run .PHONY: run
run: build run: build

View File

@ -1,2 +1,11 @@
add_library(glad OBJECT src/glad.c) add_library(glad src/glad.c)
target_include_directories(glad PUBLIC include) target_include_directories(glad PUBLIC include)
install(
TARGETS
glad
DESTINATION
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

View File

@ -6,7 +6,7 @@ endif()
# DrinkingTea: end # DrinkingTea: end
add_library( add_library(
imgui OBJECT imgui
imgui.cpp imgui.cpp
imgui_demo.cpp imgui_demo.cpp
imgui_draw.cpp imgui_draw.cpp
@ -20,3 +20,11 @@ target_include_directories(
imgui SYSTEM PUBLIC imgui SYSTEM PUBLIC
. .
) )
install(
TARGETS
imgui
DESTINATION
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

View File

@ -102,8 +102,6 @@ OX_MODEL_BEGIN(TileSheetSet)
OX_MODEL_FIELD(entries) OX_MODEL_FIELD(entries)
OX_MODEL_END() OX_MODEL_END()
void addEntry(TileSheetSet &set, ox::FileAddress path, int32_t begin = 0, int32_t size = -1) noexcept;
[[nodiscard]] [[nodiscard]]
int tileColumns(Context&) noexcept; int tileColumns(Context&) noexcept;

View File

@ -66,7 +66,9 @@ StudioUI::StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexce
auto openFileErr = openFileActiveTab(f, config.activeTabItemName == f); auto openFileErr = openFileActiveTab(f, config.activeTabItemName == f);
if (openFileErr) { if (openFileErr) {
oxErrorf("\nCould not open editor for file:\n\t{}\nReason:\n\t{}\n", f, toStr(openFileErr)); oxErrorf("\nCould not open editor for file:\n\t{}\nReason:\n\t{}\n", f, toStr(openFileErr));
continue;
} }
m_activeEditor = m_editors.back().value->get();
} }
} }
} else { } else {
@ -194,19 +196,19 @@ void StudioUI::drawTabBar() noexcept {
void StudioUI::drawTabs() noexcept { void StudioUI::drawTabs() noexcept {
for (auto it = m_editors.begin(); it != m_editors.end();) { for (auto it = m_editors.begin(); it != m_editors.end();) {
auto const &e = *it; auto const&e = *it;
auto open = true; auto open = true;
auto const unsavedChanges = e->unsavedChanges() ? ImGuiTabItemFlags_UnsavedDocument : 0; auto const unsavedChanges = e->unsavedChanges() ? ImGuiTabItemFlags_UnsavedDocument : 0;
auto const selected = m_activeEditorUpdatePending == e.get() ? ImGuiTabItemFlags_SetSelected : 0; auto const selected = m_activeEditorUpdatePending == e.get() ? ImGuiTabItemFlags_SetSelected : 0;
auto const flags = unsavedChanges | selected; auto const flags = unsavedChanges | selected;
if (ImGui::BeginTabItem(e->itemDisplayName().c_str(), &open, flags)) { if (ImGui::BeginTabItem(e->itemDisplayName().c_str(), &open, flags)) {
if (m_activeEditor != e.get()) { if (m_activeEditor != e.get()) [[unlikely]] {
m_activeEditor = e.get(); m_activeEditor = e.get();
studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&](StudioConfig &config) { studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&](StudioConfig &config) {
config.activeTabItemName = m_activeEditor->itemPath(); config.activeTabItemName = m_activeEditor->itemPath();
}); });
} } else [[likely]] {
if (m_activeEditorUpdatePending == e.get()) { if (m_activeEditorUpdatePending == e.get()) [[unlikely]] {
m_activeEditorUpdatePending = nullptr; m_activeEditorUpdatePending = nullptr;
} }
if (m_activeEditorOnLastDraw != e.get()) [[unlikely]] { if (m_activeEditorOnLastDraw != e.get()) [[unlikely]] {
@ -214,6 +216,7 @@ void StudioUI::drawTabs() noexcept {
} }
e->draw(m_sctx); e->draw(m_sctx);
m_activeEditorOnLastDraw = e.get(); m_activeEditorOnLastDraw = e.get();
}
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (!open) { if (!open) {

View File

@ -50,6 +50,7 @@ ox::Result<ContextUPtr> init(
glfwInit(); glfwInit();
OX_RETURN_ERROR(initGfx(*ctx)); OX_RETURN_ERROR(initGfx(*ctx));
glfwSetWindowSizeCallback(ctx->window, draw); glfwSetWindowSizeCallback(ctx->window, draw);
ctx->mandatoryRefreshPeriodEnd = ticksMs(*ctx) + config::MandatoryRefreshPeriod;
return ox::UPtr<Context, ContextDeleter>(ctx.release()); return ox::UPtr<Context, ContextDeleter>(ctx.release());
} }

View File

@ -1,4 +1,4 @@
FROM fedora:36 FROM fedora:41
RUN dnf update -y RUN dnf update -y