[nostalgia] Start on new TileSheetEditor

This commit is contained in:
2021-12-17 20:57:56 -06:00
parent ed074d07be
commit 775008a513
122 changed files with 651 additions and 2592 deletions

View File

@@ -43,4 +43,4 @@ install(
BUNDLE DESTINATION .
)
add_subdirectory(lib)
add_subdirectory(lib)

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once
@@ -14,11 +10,11 @@
namespace nostalgia {
//[[maybe_unused]] // GCC warns about the existence of this "unused" constexpr list in a header file...
//constexpr auto BuiltinModules = {
// [] {
// return ox::make_unique<core::Module>();
// },
//};
[[maybe_unused]] // GCC warns about the existence of this "unused" constexpr list in a header file...
constexpr auto BuiltinModules = {
[] {
return ox::make_unique<core::Module>();
},
};
}

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <imgui.h>

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include "configio.hpp"

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/std/string.hpp>

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/std/defines.hpp>

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include "module.hpp"

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <filesystem>

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <algorithm>

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include "undostack.hpp"

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include "widget.hpp"

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include "window.hpp"

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/std/trace.hpp>

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <algorithm>

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <imgui.h>

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <imgui.h>
@@ -61,7 +57,7 @@ void StudioUI::update() noexcept {
void StudioUI::draw() noexcept {
drawMenu();
drawToolbar();
drawTabs();
drawTabBar();
for (auto &w : m_widgets) {
w->draw(m_ctx);
}
@@ -128,7 +124,7 @@ void StudioUI::drawToolbar() noexcept {
ImGui::End();
}
void StudioUI::drawTabs() noexcept {
void StudioUI::drawTabBar() noexcept {
const auto viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(ImVec2(viewport->Pos.x + 316, viewport->Pos.y + 71));
ImGui::SetNextWindowSize(ImVec2(viewport->Size.x - 316, viewport->Size.y - 71));
@@ -140,31 +136,35 @@ void StudioUI::drawTabs() noexcept {
ImGui::Begin("TabWindow##MainWindow", nullptr, windowFlags);
constexpr auto tabBarFlags = ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_TabListPopupButton;
if (ImGui::BeginTabBar("TabBar##TabWindow##MainWindow", tabBarFlags)) {
for (auto it = m_editors.begin(); it != m_editors.end(); ) {
auto const &e = *it;
bool open = true;
if (ImGui::BeginTabItem(e->itemDisplayName().c_str(), &open)) {
e->draw(m_ctx);
ImGui::EndTabItem();
}
if (!open) {
e->close();
try {
oxThrowError(m_editors.erase(it).moveTo(&it));
} catch (const ox::Exception &ex) {
oxErrf("Editor tab deletion failed: {} ({}:{})\n", ex.what(), ex.file, ex.line);
} catch (const std::exception &ex) {
oxErrf("Editor tab deletion failed: {}\n", ex.what());
}
} else {
++it;
}
}
drawTabs();
ImGui::EndTabBar();
}
ImGui::End();
}
void StudioUI::drawTabs() noexcept {
for (auto it = m_editors.begin(); it != m_editors.end();) {
auto const &e = *it;
bool open = true;
if (ImGui::BeginTabItem(e->itemDisplayName().c_str(), &open)) {
e->draw(m_ctx);
ImGui::EndTabItem();
}
if (!open) {
e->close();
try {
oxThrowError(m_editors.erase(it).moveTo(&it));
} catch (const ox::Exception &ex) {
oxErrf("Editor tab deletion failed: {} ({}:{})\n", ex.what(), ex.file, ex.line);
} catch (const std::exception &ex) {
oxErrf("Editor tab deletion failed: {}\n", ex.what());
}
} else {
++it;
}
}
}
void StudioUI::loadEditorMaker(const studio::EditorMaker &editorMaker) noexcept {
for (auto &ext : editorMaker.fileTypes) {
m_editorMakers[ext] = editorMaker.make;

View File

@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once
@@ -48,6 +44,8 @@ class StudioUI: public ox::SignalHandler {
void drawToolbar() noexcept;
void drawTabBar() noexcept;
void drawTabs() noexcept;
void loadEditorMaker(const studio::EditorMaker &editorMaker) noexcept;