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_CAP=Nostalgia
BC_VAR_DEVENV_ROOT=util
BUILDCORE_PATH=deps/buildcore
include ${BUILDCORE_PATH}/base.mk
@ -13,7 +14,7 @@ endif
.PHONY: pkg-gba
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
run: build

View File

@ -1,2 +1,11 @@
add_library(glad OBJECT src/glad.c)
target_include_directories(glad PUBLIC include)
add_library(glad src/glad.c)
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
add_library(
imgui OBJECT
imgui
imgui.cpp
imgui_demo.cpp
imgui_draw.cpp
@ -19,4 +19,12 @@ add_library(
target_include_directories(
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_END()
void addEntry(TileSheetSet &set, ox::FileAddress path, int32_t begin = 0, int32_t size = -1) noexcept;
[[nodiscard]]
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);
if (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 {
@ -194,26 +196,27 @@ void StudioUI::drawTabBar() noexcept {
void StudioUI::drawTabs() noexcept {
for (auto it = m_editors.begin(); it != m_editors.end();) {
auto const &e = *it;
auto const&e = *it;
auto open = true;
auto const unsavedChanges = e->unsavedChanges() ? ImGuiTabItemFlags_UnsavedDocument : 0;
auto const selected = m_activeEditorUpdatePending == e.get() ? ImGuiTabItemFlags_SetSelected : 0;
auto const flags = unsavedChanges | selected;
if (ImGui::BeginTabItem(e->itemDisplayName().c_str(), &open, flags)) {
if (m_activeEditor != e.get()) {
if (m_activeEditor != e.get()) [[unlikely]] {
m_activeEditor = e.get();
studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&](StudioConfig &config) {
config.activeTabItemName = m_activeEditor->itemPath();
});
} else [[likely]] {
if (m_activeEditorUpdatePending == e.get()) [[unlikely]] {
m_activeEditorUpdatePending = nullptr;
}
if (m_activeEditorOnLastDraw != e.get()) [[unlikely]] {
m_activeEditor->onActivated();
}
e->draw(m_sctx);
m_activeEditorOnLastDraw = e.get();
}
if (m_activeEditorUpdatePending == e.get()) {
m_activeEditorUpdatePending = nullptr;
}
if (m_activeEditorOnLastDraw != e.get()) [[unlikely]] {
m_activeEditor->onActivated();
}
e->draw(m_sctx);
m_activeEditorOnLastDraw = e.get();
ImGui::EndTabItem();
}
if (!open) {

View File

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

View File

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