From 1e92e0d1341619f6652e9d37f1896d781c3e268c Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 20 Jan 2025 03:14:04 -0600 Subject: [PATCH] Squashed 'deps/nostalgia/' changes from 830f8fe3..672b92b3 672b92b3 [nostalgia/gfx/studio] Remove accidental version tag in default Palette 762a6517 [nostalgia] Rename core to gfx d141154a Merge commit '38777cfac8868b3628332090260710d5ac26aba0' 6170647c [nostalgia,studio] Proper fix for input filtering 48e45c7d [studio] Cleanup 5d3d9229 [nostalgia/core/studio/paletteeditor] Ignore keyboard input when popup is open d54e93d8 [studio] Cleanup 7b638538 Merge commit '8e0b6ffbabb10f8a6e9ad7e9f07e0ba1d039a02e' 240effd3 Merge commit '7e20f7200963cd0b22f84cc46e10db12b6c13806' f6f2acd6 [nostalgia/core/studio/tilesheeteditor] Add back file type check for palette drop git-subtree-dir: deps/nostalgia git-subtree-split: 672b92b363a2047c4c8ce93fb3d88001a76da35f --- src/nostalgia/modules/CMakeLists.txt | 2 +- .../modules/{core => gfx}/CMakeLists.txt | 0 .../include/nostalgia/gfx}/color.hpp | 4 +- .../include/nostalgia/gfx}/consts.hpp | 2 +- .../include/nostalgia/gfx}/context.hpp | 2 +- .../include/nostalgia/gfx}/core.hpp | 0 .../include/nostalgia/gfx}/gfx.hpp | 8 ++-- .../include/nostalgia/gfx}/initparams.hpp | 2 +- .../include/nostalgia/gfx}/keelmodule.hpp | 2 +- .../include/nostalgia/gfx}/palette.hpp | 2 +- .../include/nostalgia/gfx}/ptidxconv.hpp | 2 +- .../include/nostalgia/gfx}/studio.hpp | 0 .../include/nostalgia/gfx}/studiomodule.hpp | 2 +- .../include/nostalgia/gfx}/tilesheet.hpp | 4 +- .../modules/{core => gfx}/src/CMakeLists.txt | 0 .../{core => gfx}/src/gba/CMakeLists.txt | 0 .../modules/{core => gfx}/src/gba/context.cpp | 4 +- .../modules/{core => gfx}/src/gba/context.hpp | 4 +- .../modules/{core => gfx}/src/gba/gfx.cpp | 8 ++-- .../modules/{core => gfx}/src/gba/gfx.hpp | 4 +- .../modules/{core => gfx}/src/gba/panic.cpp | 4 +- .../modules/{core => gfx}/src/gfx.cpp | 4 +- .../{core => gfx}/src/keel/CMakeLists.txt | 0 .../{core => gfx}/src/keel/keelmodule.cpp | 6 +-- .../{core => gfx}/src/keel/typeconv.cpp | 2 +- .../{core => gfx}/src/keel/typeconv.hpp | 8 ++-- .../{core => gfx}/src/opengl/CMakeLists.txt | 0 .../{core => gfx}/src/opengl/context.cpp | 2 +- .../{core => gfx}/src/opengl/context.hpp | 6 +-- .../modules/{core => gfx}/src/opengl/gfx.cpp | 16 +++---- .../modules/{core => gfx}/src/opengl/gfx.hpp | 6 +-- .../{core => gfx}/src/studio/CMakeLists.txt | 0 .../src/studio/paletteeditor/CMakeLists.txt | 0 .../commands/addcolorcommand.cpp | 2 +- .../commands/addcolorcommand.hpp | 4 +- .../paletteeditor/commands/addpagecommand.cpp | 2 +- .../paletteeditor/commands/addpagecommand.hpp | 4 +- .../commands/applycolorallpagescommand.cpp | 2 +- .../commands/applycolorallpagescommand.hpp | 4 +- .../paletteeditor/commands/commands.hpp | 2 +- .../commands/duplicatepagecommand.cpp | 2 +- .../commands/duplicatepagecommand.hpp | 4 +- .../commands/movecolorcommand.cpp | 2 +- .../commands/movecolorcommand.hpp | 4 +- .../commands/removecolorcommand.cpp | 2 +- .../commands/removecolorcommand.hpp | 4 +- .../commands/removepagecommand.cpp | 2 +- .../commands/removepagecommand.hpp | 4 +- .../commands/renamepagecommand.cpp | 2 +- .../commands/renamepagecommand.hpp | 4 +- .../commands/updatecolorcommand.cpp | 2 +- .../commands/updatecolorcommand.hpp | 4 +- .../commands/updatecolorinfocommand.cpp | 2 +- .../commands/updatecolorinfocommand.hpp | 4 +- .../paletteeditor/paletteeditor-imgui.cpp | 4 +- .../paletteeditor/paletteeditor-imgui.hpp | 6 +-- .../{core => gfx}/src/studio/studiomodule.cpp | 4 +- .../src/studio/tilesheeteditor/CMakeLists.txt | 0 .../tilesheeteditor/commands/CMakeLists.txt | 0 .../commands/addsubsheetcommand.cpp | 2 +- .../commands/addsubsheetcommand.hpp | 2 +- .../tilesheeteditor/commands/commands.hpp | 4 +- .../commands/cutpastecommand.cpp | 4 +- .../commands/cutpastecommand.hpp | 2 +- .../commands/deletetilescommand.cpp | 6 +-- .../commands/deletetilescommand.hpp | 2 +- .../tilesheeteditor/commands/drawcommand.cpp | 2 +- .../tilesheeteditor/commands/drawcommand.hpp | 2 +- .../commands/inserttilescommand.cpp | 2 +- .../commands/inserttilescommand.hpp | 2 +- .../commands/palettechangecommand.cpp | 4 +- .../commands/palettechangecommand.hpp | 2 +- .../commands/rmsubsheetcommand.cpp | 4 +- .../commands/rmsubsheetcommand.hpp | 2 +- .../commands/updatesubsheetcommand.cpp | 4 +- .../commands/updatesubsheetcommand.hpp | 2 +- .../tilesheeteditor/tilesheeteditor-imgui.cpp | 6 +-- .../tilesheeteditor/tilesheeteditor-imgui.hpp | 2 +- .../tilesheeteditor/tilesheeteditormodel.cpp | 12 ++--- .../tilesheeteditor/tilesheeteditormodel.hpp | 6 +-- .../tilesheeteditor/tilesheeteditorview.cpp | 4 +- .../tilesheeteditor/tilesheeteditorview.hpp | 4 +- .../tilesheeteditor/tilesheetpixelgrid.cpp | 4 +- .../tilesheeteditor/tilesheetpixelgrid.hpp | 6 +-- .../tilesheeteditor/tilesheetpixels.cpp | 12 ++--- .../tilesheeteditor/tilesheetpixels.hpp | 6 +-- .../modules/{core => gfx}/src/tilesheet.cpp | 16 +++---- .../modules/{core => gfx}/test/CMakeLists.txt | 0 .../modules/{core => gfx}/test/tests.cpp | 6 +-- src/nostalgia/modules/keelmodules.cpp | 4 +- .../scene/include/nostalgia/scene/scene.hpp | 6 +-- .../include/nostalgia/scene/scenestatic.hpp | 12 ++--- .../modules/scene/src/keel/typeconv.cpp | 4 +- src/nostalgia/modules/scene/src/scene.cpp | 24 +++++----- .../scene/src/studio/sceneeditorview.cpp | 12 ++--- .../scene/src/studio/sceneeditorview.hpp | 8 ++-- src/nostalgia/modules/studiomodules.cpp | 4 +- src/nostalgia/player/app.cpp | 44 +++++++++---------- src/olympic/studio/applib/src/newdir.cpp | 5 ++- src/olympic/studio/applib/src/studioapp.cpp | 28 +++++++----- .../modlib/include/studio/imguiutil.hpp | 3 ++ src/olympic/studio/modlib/src/imguiutil.cpp | 5 +++ 102 files changed, 244 insertions(+), 229 deletions(-) rename src/nostalgia/modules/{core => gfx}/CMakeLists.txt (100%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/color.hpp (98%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/consts.hpp (92%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/context.hpp (95%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/core.hpp (100%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/gfx.hpp (97%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/initparams.hpp (89%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/keelmodule.hpp (86%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/palette.hpp (99%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/ptidxconv.hpp (98%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/studio.hpp (100%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/studiomodule.hpp (86%) rename src/nostalgia/modules/{core/include/nostalgia/core => gfx/include/nostalgia/gfx}/tilesheet.hpp (99%) rename src/nostalgia/modules/{core => gfx}/src/CMakeLists.txt (100%) rename src/nostalgia/modules/{core => gfx}/src/gba/CMakeLists.txt (100%) rename src/nostalgia/modules/{core => gfx}/src/gba/context.cpp (92%) rename src/nostalgia/modules/{core => gfx}/src/gba/context.hpp (90%) rename src/nostalgia/modules/{core => gfx}/src/gba/gfx.cpp (98%) rename src/nostalgia/modules/{core => gfx}/src/gba/gfx.hpp (71%) rename src/nostalgia/modules/{core => gfx}/src/gba/panic.cpp (96%) rename src/nostalgia/modules/{core => gfx}/src/gfx.cpp (98%) rename src/nostalgia/modules/{core => gfx}/src/keel/CMakeLists.txt (100%) rename src/nostalgia/modules/{core => gfx}/src/keel/keelmodule.cpp (96%) rename src/nostalgia/modules/{core => gfx}/src/keel/typeconv.cpp (99%) rename src/nostalgia/modules/{core => gfx}/src/keel/typeconv.hpp (93%) rename src/nostalgia/modules/{core => gfx}/src/opengl/CMakeLists.txt (100%) rename src/nostalgia/modules/{core => gfx}/src/opengl/context.cpp (96%) rename src/nostalgia/modules/{core => gfx}/src/opengl/context.hpp (89%) rename src/nostalgia/modules/{core => gfx}/src/opengl/gfx.cpp (98%) rename src/nostalgia/modules/{core => gfx}/src/opengl/gfx.hpp (94%) rename src/nostalgia/modules/{core => gfx}/src/studio/CMakeLists.txt (100%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/CMakeLists.txt (100%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/addcolorcommand.cpp (96%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/addcolorcommand.hpp (89%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/addpagecommand.cpp (95%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/addpagecommand.hpp (87%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/applycolorallpagescommand.cpp (97%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp (89%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/commands.hpp (90%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/duplicatepagecommand.cpp (96%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/duplicatepagecommand.hpp (90%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/movecolorcommand.cpp (96%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/movecolorcommand.hpp (91%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/removecolorcommand.cpp (97%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/removecolorcommand.hpp (89%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/removepagecommand.cpp (95%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/removepagecommand.hpp (88%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/renamepagecommand.cpp (95%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/renamepagecommand.hpp (89%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/updatecolorcommand.cpp (97%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/updatecolorcommand.hpp (91%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/updatecolorinfocommand.cpp (97%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp (91%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/paletteeditor-imgui.cpp (99%) rename src/nostalgia/modules/{core => gfx}/src/studio/paletteeditor/paletteeditor-imgui.hpp (94%) rename src/nostalgia/modules/{core => gfx}/src/studio/studiomodule.cpp (92%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/CMakeLists.txt (100%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/CMakeLists.txt (100%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp (98%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp (95%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/commands.hpp (90%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/cutpastecommand.cpp (96%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/cutpastecommand.hpp (98%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/deletetilescommand.cpp (92%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/deletetilescommand.hpp (96%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/drawcommand.cpp (98%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/drawcommand.hpp (97%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/inserttilescommand.cpp (98%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/inserttilescommand.hpp (96%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/palettechangecommand.cpp (91%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/palettechangecommand.hpp (95%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp (87%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp (95%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp (91%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp (95%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp (99%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp (98%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/tilesheeteditormodel.cpp (97%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/tilesheeteditormodel.hpp (97%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/tilesheeteditorview.cpp (98%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/tilesheeteditorview.hpp (97%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp (98%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp (94%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/tilesheetpixels.cpp (95%) rename src/nostalgia/modules/{core => gfx}/src/studio/tilesheeteditor/tilesheetpixels.hpp (92%) rename src/nostalgia/modules/{core => gfx}/src/tilesheet.cpp (96%) rename src/nostalgia/modules/{core => gfx}/test/CMakeLists.txt (100%) rename src/nostalgia/modules/{core => gfx}/test/tests.cpp (87%) diff --git a/src/nostalgia/modules/CMakeLists.txt b/src/nostalgia/modules/CMakeLists.txt index 9c5115d..dc91125 100644 --- a/src/nostalgia/modules/CMakeLists.txt +++ b/src/nostalgia/modules/CMakeLists.txt @@ -1,6 +1,6 @@ # module dir list -add_subdirectory(core) +add_subdirectory(gfx) add_subdirectory(scene) # module libraries diff --git a/src/nostalgia/modules/core/CMakeLists.txt b/src/nostalgia/modules/gfx/CMakeLists.txt similarity index 100% rename from src/nostalgia/modules/core/CMakeLists.txt rename to src/nostalgia/modules/gfx/CMakeLists.txt diff --git a/src/nostalgia/modules/core/include/nostalgia/core/color.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp similarity index 98% rename from src/nostalgia/modules/core/include/nostalgia/core/color.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp index 9eb9bdf..4a41a9d 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/color.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp @@ -7,7 +7,7 @@ #include #include -namespace nostalgia::core { +namespace nostalgia::gfx { using Color16 = uint16_t; @@ -154,7 +154,7 @@ static_assert(color16(16, 32, 8) == 9200); [[nodiscard]] constexpr Color16 applySelectionColor(Color16 const color) noexcept { - namespace core = nostalgia::core; + namespace core = nostalgia::gfx; auto const r = core::red16(color) / 2; auto const g = (core::green16(color) + 20) / 2; auto const b = (core::blue16(color) + 31) / 2; diff --git a/src/nostalgia/modules/core/include/nostalgia/core/consts.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/consts.hpp similarity index 92% rename from src/nostalgia/modules/core/include/nostalgia/core/consts.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/consts.hpp index 182fca5..be66224 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/consts.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/consts.hpp @@ -6,7 +6,7 @@ #include -namespace nostalgia::core { +namespace nostalgia::gfx { constexpr auto TileWidth = 8; constexpr auto TileHeight = 8; diff --git a/src/nostalgia/modules/core/include/nostalgia/core/context.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/context.hpp similarity index 95% rename from src/nostalgia/modules/core/include/nostalgia/core/context.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/context.hpp index 2f2df27..8ccb0d1 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/context.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/context.hpp @@ -13,7 +13,7 @@ #include "initparams.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class Context; diff --git a/src/nostalgia/modules/core/include/nostalgia/core/core.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/core.hpp similarity index 100% rename from src/nostalgia/modules/core/include/nostalgia/core/core.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/core.hpp diff --git a/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp similarity index 97% rename from src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp index e5f32be..d2a256f 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp @@ -13,7 +13,7 @@ #include "palette.hpp" #include "tilesheet.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { struct Sprite { static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.Sprite"; @@ -242,15 +242,15 @@ void puts(Context &ctx, int column, int row, ox::StringViewCR str) noexcept; } -namespace nostalgia::core::gl { +namespace nostalgia::gfx::gl { constexpr ox::CStringView GlslVersion = "#version 330"; [[nodiscard]] ox::Size drawSize(int scale = 5) noexcept; -void draw(core::Context &ctx, ox::Size const&renderSz) noexcept; +void draw(gfx::Context &ctx, ox::Size const&renderSz) noexcept; -void draw(core::Context&, int scale = 5) noexcept; +void draw(gfx::Context&, int scale = 5) noexcept; } diff --git a/src/nostalgia/modules/core/include/nostalgia/core/initparams.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/initparams.hpp similarity index 89% rename from src/nostalgia/modules/core/include/nostalgia/core/initparams.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/initparams.hpp index 52b61cc..e7145d3 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/initparams.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/initparams.hpp @@ -6,7 +6,7 @@ #include -namespace nostalgia::core { +namespace nostalgia::gfx { struct InitParams { bool glInstallDrawer = true; diff --git a/src/nostalgia/modules/core/include/nostalgia/core/keelmodule.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/keelmodule.hpp similarity index 86% rename from src/nostalgia/modules/core/include/nostalgia/core/keelmodule.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/keelmodule.hpp index ace09a8..da976b3 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/keelmodule.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/keelmodule.hpp @@ -6,7 +6,7 @@ #include -namespace nostalgia::core { +namespace nostalgia::gfx { const keel::Module *keelModule() noexcept; diff --git a/src/nostalgia/modules/core/include/nostalgia/core/palette.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/palette.hpp similarity index 99% rename from src/nostalgia/modules/core/include/nostalgia/core/palette.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/palette.hpp index 61cec29..c5e0ff8 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/palette.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/palette.hpp @@ -11,7 +11,7 @@ #include "color.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { struct PaletteColorV1 { static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.PaletteColor"; diff --git a/src/nostalgia/modules/core/include/nostalgia/core/ptidxconv.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/ptidxconv.hpp similarity index 98% rename from src/nostalgia/modules/core/include/nostalgia/core/ptidxconv.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/ptidxconv.hpp index ad60899..8e2548c 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/ptidxconv.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/ptidxconv.hpp @@ -8,7 +8,7 @@ #include "consts.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { [[nodiscard]] constexpr std::size_t ptToIdx(int x, int y, int c, int scale = 1) noexcept { diff --git a/src/nostalgia/modules/core/include/nostalgia/core/studio.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/studio.hpp similarity index 100% rename from src/nostalgia/modules/core/include/nostalgia/core/studio.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/studio.hpp diff --git a/src/nostalgia/modules/core/include/nostalgia/core/studiomodule.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/studiomodule.hpp similarity index 86% rename from src/nostalgia/modules/core/include/nostalgia/core/studiomodule.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/studiomodule.hpp index 79e1db6..c950021 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/studiomodule.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/studiomodule.hpp @@ -6,7 +6,7 @@ #include -namespace nostalgia::core { +namespace nostalgia::gfx { const studio::Module *studioModule() noexcept; diff --git a/src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp similarity index 99% rename from src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp rename to src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp index 6348903..ac1cd5b 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp @@ -12,11 +12,11 @@ #include #include -#include +#include #include "palette.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { struct SubSheetTemplate { static constexpr auto TypeName = "net.drinkingtea.nostalgia.gfx.SubSheetTemplate"; diff --git a/src/nostalgia/modules/core/src/CMakeLists.txt b/src/nostalgia/modules/gfx/src/CMakeLists.txt similarity index 100% rename from src/nostalgia/modules/core/src/CMakeLists.txt rename to src/nostalgia/modules/gfx/src/CMakeLists.txt diff --git a/src/nostalgia/modules/core/src/gba/CMakeLists.txt b/src/nostalgia/modules/gfx/src/gba/CMakeLists.txt similarity index 100% rename from src/nostalgia/modules/core/src/gba/CMakeLists.txt rename to src/nostalgia/modules/gfx/src/gba/CMakeLists.txt diff --git a/src/nostalgia/modules/core/src/gba/context.cpp b/src/nostalgia/modules/gfx/src/gba/context.cpp similarity index 92% rename from src/nostalgia/modules/core/src/gba/context.cpp rename to src/nostalgia/modules/gfx/src/gba/context.cpp index ab378d3..9f7be14 100644 --- a/src/nostalgia/modules/core/src/gba/context.cpp +++ b/src/nostalgia/modules/gfx/src/gba/context.cpp @@ -4,11 +4,11 @@ #include -#include +#include #include "context.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { void safeDelete(Context *ctx) noexcept { delete ctx; diff --git a/src/nostalgia/modules/core/src/gba/context.hpp b/src/nostalgia/modules/gfx/src/gba/context.hpp similarity index 90% rename from src/nostalgia/modules/core/src/gba/context.hpp rename to src/nostalgia/modules/gfx/src/gba/context.hpp index 99d2a22..c748d2d 100644 --- a/src/nostalgia/modules/core/src/gba/context.hpp +++ b/src/nostalgia/modules/gfx/src/gba/context.hpp @@ -4,9 +4,9 @@ #pragma once -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { struct BgCbbData { unsigned bpp = 4; diff --git a/src/nostalgia/modules/core/src/gba/gfx.cpp b/src/nostalgia/modules/gfx/src/gba/gfx.cpp similarity index 98% rename from src/nostalgia/modules/core/src/gba/gfx.cpp rename to src/nostalgia/modules/gfx/src/gba/gfx.cpp index eac447b..65b9ca7 100644 --- a/src/nostalgia/modules/core/src/gba/gfx.cpp +++ b/src/nostalgia/modules/gfx/src/gba/gfx.cpp @@ -11,15 +11,15 @@ #include -#include -#include -#include +#include +#include +#include #include "context.hpp" OX_ALLOW_UNSAFE_BUFFERS_BEGIN -namespace nostalgia::core { +namespace nostalgia::gfx { static constexpr auto SpriteCount = 128; diff --git a/src/nostalgia/modules/core/src/gba/gfx.hpp b/src/nostalgia/modules/gfx/src/gba/gfx.hpp similarity index 71% rename from src/nostalgia/modules/core/src/gba/gfx.hpp rename to src/nostalgia/modules/gfx/src/gba/gfx.hpp index 21aad7e..ea7aee7 100644 --- a/src/nostalgia/modules/core/src/gba/gfx.hpp +++ b/src/nostalgia/modules/gfx/src/gba/gfx.hpp @@ -4,8 +4,8 @@ #pragma once -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { ox::Error initGfx(Context &ctx, InitParams const&) noexcept; } diff --git a/src/nostalgia/modules/core/src/gba/panic.cpp b/src/nostalgia/modules/gfx/src/gba/panic.cpp similarity index 96% rename from src/nostalgia/modules/core/src/gba/panic.cpp rename to src/nostalgia/modules/gfx/src/gba/panic.cpp index 1014a4a..106bd38 100644 --- a/src/nostalgia/modules/core/src/gba/panic.cpp +++ b/src/nostalgia/modules/gfx/src/gba/panic.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include "gfx.hpp" @@ -22,7 +22,7 @@ namespace ox { -using namespace nostalgia::core; +using namespace nostalgia::gfx; void panic(const char *file, int line, const char *panicMsg, ox::Error const&err) noexcept { // reset heap to make sure we have enough memory to allocate context data diff --git a/src/nostalgia/modules/core/src/gfx.cpp b/src/nostalgia/modules/gfx/src/gfx.cpp similarity index 98% rename from src/nostalgia/modules/core/src/gfx.cpp rename to src/nostalgia/modules/gfx/src/gfx.cpp index c5094ad..8509fa8 100644 --- a/src/nostalgia/modules/core/src/gfx.cpp +++ b/src/nostalgia/modules/gfx/src/gfx.cpp @@ -3,9 +3,9 @@ */ #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { constexpr auto GbaTileColumns = 32; constexpr auto GbaTileRows = 32; diff --git a/src/nostalgia/modules/core/src/keel/CMakeLists.txt b/src/nostalgia/modules/gfx/src/keel/CMakeLists.txt similarity index 100% rename from src/nostalgia/modules/core/src/keel/CMakeLists.txt rename to src/nostalgia/modules/gfx/src/keel/CMakeLists.txt diff --git a/src/nostalgia/modules/core/src/keel/keelmodule.cpp b/src/nostalgia/modules/gfx/src/keel/keelmodule.cpp similarity index 96% rename from src/nostalgia/modules/core/src/keel/keelmodule.cpp rename to src/nostalgia/modules/gfx/src/keel/keelmodule.cpp index e56d90d..a334c86 100644 --- a/src/nostalgia/modules/core/src/keel/keelmodule.cpp +++ b/src/nostalgia/modules/gfx/src/keel/keelmodule.cpp @@ -7,12 +7,12 @@ #include #include -#include -#include +#include +#include #include "typeconv.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { static class: public keel::Module { private: diff --git a/src/nostalgia/modules/core/src/keel/typeconv.cpp b/src/nostalgia/modules/gfx/src/keel/typeconv.cpp similarity index 99% rename from src/nostalgia/modules/core/src/keel/typeconv.cpp rename to src/nostalgia/modules/gfx/src/keel/typeconv.cpp index 04ffb4b..466e69d 100644 --- a/src/nostalgia/modules/core/src/keel/typeconv.cpp +++ b/src/nostalgia/modules/gfx/src/keel/typeconv.cpp @@ -4,7 +4,7 @@ #include "typeconv.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { ox::Error NostalgiaPaletteToPaletteV1Converter::convert( keel::Context&, diff --git a/src/nostalgia/modules/core/src/keel/typeconv.hpp b/src/nostalgia/modules/gfx/src/keel/typeconv.hpp similarity index 93% rename from src/nostalgia/modules/core/src/keel/typeconv.hpp rename to src/nostalgia/modules/gfx/src/keel/typeconv.hpp index b35b2e3..1d52a13 100644 --- a/src/nostalgia/modules/core/src/keel/typeconv.hpp +++ b/src/nostalgia/modules/gfx/src/keel/typeconv.hpp @@ -8,11 +8,11 @@ #include -#include -#include -#include +#include +#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { // Type converters diff --git a/src/nostalgia/modules/core/src/opengl/CMakeLists.txt b/src/nostalgia/modules/gfx/src/opengl/CMakeLists.txt similarity index 100% rename from src/nostalgia/modules/core/src/opengl/CMakeLists.txt rename to src/nostalgia/modules/gfx/src/opengl/CMakeLists.txt diff --git a/src/nostalgia/modules/core/src/opengl/context.cpp b/src/nostalgia/modules/gfx/src/opengl/context.cpp similarity index 96% rename from src/nostalgia/modules/core/src/opengl/context.cpp rename to src/nostalgia/modules/gfx/src/opengl/context.cpp index fd727bc..45e0d79 100644 --- a/src/nostalgia/modules/core/src/opengl/context.cpp +++ b/src/nostalgia/modules/gfx/src/opengl/context.cpp @@ -5,7 +5,7 @@ #include "context.hpp" #include "gfx.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { void safeDelete(Context *ctx) noexcept { delete ctx; diff --git a/src/nostalgia/modules/core/src/opengl/context.hpp b/src/nostalgia/modules/gfx/src/opengl/context.hpp similarity index 89% rename from src/nostalgia/modules/core/src/opengl/context.hpp rename to src/nostalgia/modules/gfx/src/opengl/context.hpp index df8ad4f..be93bf0 100644 --- a/src/nostalgia/modules/core/src/opengl/context.hpp +++ b/src/nostalgia/modules/gfx/src/opengl/context.hpp @@ -8,12 +8,12 @@ #include -#include -#include +#include +#include #include "gfx.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class Context { diff --git a/src/nostalgia/modules/core/src/opengl/gfx.cpp b/src/nostalgia/modules/gfx/src/opengl/gfx.cpp similarity index 98% rename from src/nostalgia/modules/core/src/opengl/gfx.cpp rename to src/nostalgia/modules/gfx/src/opengl/gfx.cpp index 0357237..c35ba02 100644 --- a/src/nostalgia/modules/core/src/opengl/gfx.cpp +++ b/src/nostalgia/modules/gfx/src/opengl/gfx.cpp @@ -10,15 +10,15 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include "context.hpp" #include "gfx.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { namespace renderer { @@ -28,7 +28,7 @@ static constexpr auto PriorityScale = 0.01f; Drawer::Drawer(Context &ctx) noexcept: m_ctx(ctx) {} void Drawer::draw(turbine::Context &tctx) noexcept { - core::gl::draw(m_ctx, turbine::getScreenSize(tctx)); + gfx::gl::draw(m_ctx, turbine::getScreenSize(tctx)); } static constexpr ox::CStringView bgvshadTmpl = R"glsl( @@ -768,7 +768,7 @@ ox::Size drawSize(int scale) noexcept { return {240 * scale, 160 * scale}; } -void draw(core::Context &ctx, ox::Size const&renderSz) noexcept { +void draw(gfx::Context &ctx, ox::Size const&renderSz) noexcept { glViewport(0, 0, renderSz.width, renderSz.height); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); @@ -783,7 +783,7 @@ void draw(core::Context &ctx, ox::Size const&renderSz) noexcept { glDisable(GL_BLEND); } -void draw(core::Context &ctx, int scale) noexcept { +void draw(gfx::Context &ctx, int scale) noexcept { draw(ctx, drawSize(scale)); } diff --git a/src/nostalgia/modules/core/src/opengl/gfx.hpp b/src/nostalgia/modules/gfx/src/opengl/gfx.hpp similarity index 94% rename from src/nostalgia/modules/core/src/opengl/gfx.hpp rename to src/nostalgia/modules/gfx/src/opengl/gfx.hpp index 5681380..b852a2c 100644 --- a/src/nostalgia/modules/core/src/opengl/gfx.hpp +++ b/src/nostalgia/modules/gfx/src/opengl/gfx.hpp @@ -10,9 +10,9 @@ #include -#include +#include -namespace nostalgia::core::renderer { +namespace nostalgia::gfx::renderer { constexpr uint64_t TileRows = 128; constexpr uint64_t TileColumns = 128; @@ -59,7 +59,7 @@ class Drawer: public turbine::gl::Drawer { } -namespace nostalgia::core { +namespace nostalgia::gfx { ox::Error initGfx(Context &ctx, InitParams const&) noexcept; void shutdownGfx(Context &ctx) noexcept; } diff --git a/src/nostalgia/modules/core/src/studio/CMakeLists.txt b/src/nostalgia/modules/gfx/src/studio/CMakeLists.txt similarity index 100% rename from src/nostalgia/modules/core/src/studio/CMakeLists.txt rename to src/nostalgia/modules/gfx/src/studio/CMakeLists.txt diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/CMakeLists.txt b/src/nostalgia/modules/gfx/src/studio/paletteeditor/CMakeLists.txt similarity index 100% rename from src/nostalgia/modules/core/src/studio/paletteeditor/CMakeLists.txt rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/CMakeLists.txt diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/addcolorcommand.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addcolorcommand.cpp similarity index 96% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/addcolorcommand.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addcolorcommand.cpp index 7e5d4b0..016fee5 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/addcolorcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addcolorcommand.cpp @@ -5,7 +5,7 @@ #include "commands.hpp" #include "addcolorcommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { AddColorCommand::AddColorCommand(Palette &pal, Color16 const color, size_t const idx) noexcept: m_pal(pal), diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/addcolorcommand.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addcolorcommand.hpp similarity index 89% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/addcolorcommand.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addcolorcommand.hpp index cf7ba65..9fad4bb 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/addcolorcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addcolorcommand.hpp @@ -6,9 +6,9 @@ #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class AddColorCommand: public studio::UndoCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/addpagecommand.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addpagecommand.cpp similarity index 95% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/addpagecommand.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addpagecommand.cpp index 828bbc9..aa97232 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/addpagecommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addpagecommand.cpp @@ -6,7 +6,7 @@ #include "addpagecommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { AddPageCommand::AddPageCommand(Palette &pal) noexcept: m_pal(pal) {} diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/addpagecommand.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addpagecommand.hpp similarity index 87% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/addpagecommand.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addpagecommand.hpp index 58f31d7..01f659d 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/addpagecommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addpagecommand.hpp @@ -6,9 +6,9 @@ #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class AddPageCommand: public studio::UndoCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/applycolorallpagescommand.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/applycolorallpagescommand.cpp similarity index 97% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/applycolorallpagescommand.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/applycolorallpagescommand.cpp index 902d339..a80d76d 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/applycolorallpagescommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/applycolorallpagescommand.cpp @@ -5,7 +5,7 @@ #include "commands.hpp" #include "applycolorallpagescommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { ApplyColorAllPagesCommand::ApplyColorAllPagesCommand(Palette &pal, size_t const page, size_t const idx): m_pal(pal), diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp similarity index 89% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp index 0272544..8b5eec2 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp @@ -6,9 +6,9 @@ #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class ApplyColorAllPagesCommand: public studio::UndoCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/commands.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/commands.hpp similarity index 90% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/commands.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/commands.hpp index e6be3b4..7ca6ee6 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/commands.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/commands.hpp @@ -4,7 +4,7 @@ #pragma once -namespace nostalgia::core { +namespace nostalgia::gfx { enum class PaletteEditorCommandId { ApplyColorAllPages, diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/duplicatepagecommand.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/duplicatepagecommand.cpp similarity index 96% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/duplicatepagecommand.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/duplicatepagecommand.cpp index e4888ef..6d935de 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/duplicatepagecommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/duplicatepagecommand.cpp @@ -6,7 +6,7 @@ #include "duplicatepagecommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { DuplicatePageCommand::DuplicatePageCommand(Palette &pal, size_t srcIdx, size_t dstIdx) noexcept: m_pal(pal), diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/duplicatepagecommand.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/duplicatepagecommand.hpp similarity index 90% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/duplicatepagecommand.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/duplicatepagecommand.hpp index 6fba6ba..7765e27 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/duplicatepagecommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/duplicatepagecommand.hpp @@ -6,9 +6,9 @@ #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class DuplicatePageCommand: public studio::UndoCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/movecolorcommand.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movecolorcommand.cpp similarity index 96% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/movecolorcommand.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movecolorcommand.cpp index cbb7e8a..282790f 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/movecolorcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movecolorcommand.cpp @@ -6,7 +6,7 @@ #include "movecolorcommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { MoveColorCommand::MoveColorCommand( Palette &pal, size_t page, size_t srcIdx, size_t dstIdx) noexcept: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/movecolorcommand.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movecolorcommand.hpp similarity index 91% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/movecolorcommand.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movecolorcommand.hpp index 9397a65..7858ef6 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/movecolorcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movecolorcommand.hpp @@ -6,9 +6,9 @@ #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class MoveColorCommand: public studio::UndoCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/removecolorcommand.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removecolorcommand.cpp similarity index 97% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/removecolorcommand.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removecolorcommand.cpp index 2472af6..269372a 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/removecolorcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removecolorcommand.cpp @@ -5,7 +5,7 @@ #include "commands.hpp" #include "removecolorcommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { RemoveColorCommand::RemoveColorCommand(Palette &pal, size_t const idx) noexcept: m_pal(pal), diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/removecolorcommand.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removecolorcommand.hpp similarity index 89% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/removecolorcommand.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removecolorcommand.hpp index 64c70c0..d94e021 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/removecolorcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removecolorcommand.hpp @@ -6,9 +6,9 @@ #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class RemoveColorCommand: public studio::UndoCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/removepagecommand.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removepagecommand.cpp similarity index 95% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/removepagecommand.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removepagecommand.cpp index a63935b..1376b0f 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/removepagecommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removepagecommand.cpp @@ -6,7 +6,7 @@ #include "removepagecommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { RemovePageCommand::RemovePageCommand(Palette &pal, size_t idx) noexcept: m_pal(pal), diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/removepagecommand.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removepagecommand.hpp similarity index 88% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/removepagecommand.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removepagecommand.hpp index ef7f6d7..bd4264b 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/removepagecommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removepagecommand.hpp @@ -6,9 +6,9 @@ #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class RemovePageCommand: public studio::UndoCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/renamepagecommand.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/renamepagecommand.cpp similarity index 95% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/renamepagecommand.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/renamepagecommand.cpp index b7042e9..965b2bb 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/renamepagecommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/renamepagecommand.cpp @@ -4,7 +4,7 @@ #include "renamepagecommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { RenamePageCommand::RenamePageCommand(Palette &pal, size_t const page, ox::StringParam name) noexcept: m_pal(pal), diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/renamepagecommand.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/renamepagecommand.hpp similarity index 89% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/renamepagecommand.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/renamepagecommand.hpp index 4e1733f..fbc520e 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/renamepagecommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/renamepagecommand.hpp @@ -6,11 +6,11 @@ #include -#include +#include #include "commands.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class RenamePageCommand: public studio::UndoCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorcommand.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorcommand.cpp similarity index 97% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorcommand.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorcommand.cpp index a384839..b1c9eb6 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorcommand.cpp @@ -5,7 +5,7 @@ #include "commands.hpp" #include "updatecolorcommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { UpdateColorCommand::UpdateColorCommand( Palette &pal, diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorcommand.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorcommand.hpp similarity index 91% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorcommand.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorcommand.hpp index 387afbf..6b7b63c 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorcommand.hpp @@ -6,9 +6,9 @@ #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class UpdateColorCommand: public studio::UndoCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorinfocommand.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorinfocommand.cpp similarity index 97% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorinfocommand.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorinfocommand.cpp index e86797a..1657075 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorinfocommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorinfocommand.cpp @@ -5,7 +5,7 @@ #include "commands.hpp" #include "updatecolorinfocommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { UpdateColorInfoCommand::UpdateColorInfoCommand( Palette &pal, diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp similarity index 91% rename from src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp index 170514f..c5dac8c 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp @@ -6,9 +6,9 @@ #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class UpdateColorInfoCommand: public studio::UndoCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp similarity index 99% rename from src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp index d6bc4a3..1221d35 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -19,7 +19,7 @@ #include "paletteeditor-imgui.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { namespace ig = studio::ig; @@ -258,7 +258,7 @@ void PaletteEditorImGui::drawColorEditor() noexcept { std::ignore = pushCommand( m_pal, m_page, m_selectedColorRow); } - if (!inputFocused && !m_pageRenameDlg.isOpen()) { + if (ig::mainWinHasFocus()) { if (!ImGui::IsKeyDown(ImGuiKey_ModAlt)) { numShortcuts(m_selectedColorRow, largestPage(m_pal)); } else { diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp similarity index 94% rename from src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp rename to src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp index 14eca23..f3865e3 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp @@ -6,10 +6,10 @@ #include -#include -#include +#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class PaletteEditorImGui: public studio::Editor { diff --git a/src/nostalgia/modules/core/src/studio/studiomodule.cpp b/src/nostalgia/modules/gfx/src/studio/studiomodule.cpp similarity index 92% rename from src/nostalgia/modules/core/src/studio/studiomodule.cpp rename to src/nostalgia/modules/gfx/src/studio/studiomodule.cpp index 91a2dc5..5675c5d 100644 --- a/src/nostalgia/modules/core/src/studio/studiomodule.cpp +++ b/src/nostalgia/modules/gfx/src/studio/studiomodule.cpp @@ -9,7 +9,7 @@ #include "paletteeditor/paletteeditor-imgui.hpp" #include "tilesheeteditor/tilesheeteditor-imgui.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { static class: public studio::Module { ox::Vector editors(studio::StudioContext &ctx) const noexcept final { @@ -24,7 +24,7 @@ static class: public studio::Module { out.emplace_back(ox::make>("Tile Sheet", "TileSheets", FileExt_ng)); out.emplace_back(ox::make>("Palette", "Palettes", FileExt_npal, Palette{ .colorNames = {}, - .pages = {{"Page 1", ox::Vector{}}}, + .pages = {{"Page 1", ox::Vector{}}}, }, ox::ClawFormat::Organic)); return out; } diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/CMakeLists.txt b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/CMakeLists.txt similarity index 100% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/CMakeLists.txt rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/CMakeLists.txt diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/CMakeLists.txt b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/CMakeLists.txt similarity index 100% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/CMakeLists.txt rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/CMakeLists.txt diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp similarity index 98% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp index e61a5f4..7857428 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp @@ -4,7 +4,7 @@ #include "addsubsheetcommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { AddSubSheetCommand::AddSubSheetCommand( TileSheet &img, diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp similarity index 95% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp index 65f79b5..e268a6d 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp @@ -6,7 +6,7 @@ #include "commands.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class AddSubSheetCommand: public TileSheetCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/commands.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/commands.hpp similarity index 90% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/commands.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/commands.hpp index 27db437..68b15e3 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/commands.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/commands.hpp @@ -5,9 +5,9 @@ #pragma once #include -#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { // Command IDs to use with QUndoCommand::id() enum class CommandId { diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/cutpastecommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp similarity index 96% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/cutpastecommand.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp index 60e19f5..86b0fbe 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/cutpastecommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp @@ -4,7 +4,7 @@ #include "cutpastecommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { TileSheetClipboard::Pixel::Pixel(uint16_t pColorIdx, ox::Point pPt) noexcept { colorIdx = pColorIdx; @@ -37,7 +37,7 @@ CutPasteCommand::CutPasteCommand( for (auto const&p : cb.pixels()) { auto const dstPt = p.pt + dstStart; if (dstPt.x <= dstEnd.x && dstPt.y <= dstEnd.y) { - auto const idx = core::idx(ss, dstPt); + auto const idx = gfx::idx(ss, dstPt); m_changes.emplace_back(static_cast(idx), p.colorIdx, getPixel(ss, m_img.bpp, idx)); } } diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/cutpastecommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp similarity index 98% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/cutpastecommand.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp index 4d263e5..5110bb5 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/cutpastecommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp @@ -8,7 +8,7 @@ #include "commands.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { OX_MODEL_FWD_DECL(class TileSheetClipboard); diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/deletetilescommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp similarity index 92% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/deletetilescommand.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp index 9eff525..9be5a29 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/deletetilescommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp @@ -6,9 +6,9 @@ #include "deletetilescommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { -core::DeleteTilesCommand::DeleteTilesCommand( +gfx::DeleteTilesCommand::DeleteTilesCommand( TileSheet &img, TileSheet::SubSheetIdx idx, std::size_t tileIdx, @@ -28,7 +28,7 @@ core::DeleteTilesCommand::DeleteTilesCommand( } } -ox::Error core::DeleteTilesCommand::redo() noexcept { +ox::Error gfx::DeleteTilesCommand::redo() noexcept { auto &s = getSubSheet(m_img, m_idx); auto &p = s.pixels; auto srcPos = m_deletePos + m_deleteSz; diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/deletetilescommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.hpp similarity index 96% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/deletetilescommand.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.hpp index 792848b..846c228 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/deletetilescommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.hpp @@ -6,7 +6,7 @@ #include "commands.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class DeleteTilesCommand: public TileSheetCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/drawcommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.cpp similarity index 98% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/drawcommand.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.cpp index 6217f8f..c75a3e8 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/drawcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.cpp @@ -4,7 +4,7 @@ #include "drawcommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { DrawCommand::DrawCommand( TileSheet &img, diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/drawcommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.hpp similarity index 97% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/drawcommand.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.hpp index 593ade1..21cf845 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/drawcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.hpp @@ -6,7 +6,7 @@ #include "commands.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class DrawCommand: public TileSheetCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/inserttilescommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp similarity index 98% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/inserttilescommand.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp index 9651fee..1c9ce14 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/inserttilescommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp @@ -4,7 +4,7 @@ #include "inserttilescommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { InsertTilesCommand::InsertTilesCommand( TileSheet &img, diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/inserttilescommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.hpp similarity index 96% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/inserttilescommand.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.hpp index 5761c9a..49f77ab 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/inserttilescommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.hpp @@ -6,7 +6,7 @@ #include "commands.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class InsertTilesCommand: public TileSheetCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp similarity index 91% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp index 741ad01..6b17871 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp @@ -4,9 +4,9 @@ #include "palettechangecommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { -core::PaletteChangeCommand::PaletteChangeCommand( +gfx::PaletteChangeCommand::PaletteChangeCommand( TileSheet::SubSheetIdx idx, TileSheet &img, ox::StringViewCR newPalette) noexcept: diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.hpp similarity index 95% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.hpp index 3be318e..f79f1c7 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.hpp @@ -6,7 +6,7 @@ #include "commands.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class PaletteChangeCommand: public TileSheetCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp similarity index 87% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp index 8246c9f..bb6011b 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp @@ -4,9 +4,9 @@ #include "rmsubsheetcommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { -core::RmSubSheetCommand::RmSubSheetCommand(TileSheet &img, TileSheet::SubSheetIdx idx) noexcept: +gfx::RmSubSheetCommand::RmSubSheetCommand(TileSheet &img, TileSheet::SubSheetIdx idx) noexcept: m_img(img), m_idx(std::move(idx)), m_parentIdx(m_idx) { diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp similarity index 95% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp index 0b0f9ce..1813c77 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp @@ -6,7 +6,7 @@ #include "commands.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class RmSubSheetCommand: public TileSheetCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp similarity index 91% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp index f15a360..7038320 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp @@ -4,9 +4,9 @@ #include "updatesubsheetcommand.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { -core::UpdateSubSheetCommand::UpdateSubSheetCommand( +gfx::UpdateSubSheetCommand::UpdateSubSheetCommand( TileSheet &img, TileSheet::SubSheetIdx idx, ox::StringParam name, diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp similarity index 95% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp index 9a90fee..b2c5511 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp @@ -6,7 +6,7 @@ #include "commands.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class UpdateSubSheetCommand: public TileSheetCommand { private: diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp similarity index 99% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp index 4d5c4f7..9c721f3 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp @@ -11,7 +11,7 @@ #include "tilesheeteditor-imgui.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { namespace ig = studio::ig; @@ -136,7 +136,7 @@ void TileSheetEditorImGui::keyStateChanged(turbine::Key key, bool down) { auto const popupOpen = m_subsheetEditor.isOpen() || m_exportMenu.isOpen(); auto const pal = m_model.pal(); if (!popupOpen) { - auto const colorCnt = core::colorCnt(pal, m_model.palettePage()); + auto const colorCnt = gfx::colorCnt(pal, m_model.palettePage()); if (key == turbine::Key::Alpha_D) { m_tool = TileSheetTool::Draw; setCopyEnabled(false); @@ -445,7 +445,7 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept { } if (ig::DragDropTarget const dragDropTarget; dragDropTarget) { auto const [ref, err] = ig::getDragDropPayload("FileRef"); - if (!err) { + if (!err && endsWith(ref.path, FileExt_npal)) { if (ref.path != m_selectedPalette) { oxLogError(m_model.setPalette(ref.path)); } diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp similarity index 98% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp index 46797d0..f3490b3 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp @@ -14,7 +14,7 @@ #include "tilesheetpixels.hpp" #include "tilesheeteditorview.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { class TileSheetEditorImGui: public studio::Editor { diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp similarity index 97% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp index c31620f..df31d5b 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include "commands/commands.hpp" #include "commands/addsubsheetcommand.hpp" @@ -24,7 +24,7 @@ #include "commands/updatesubsheetcommand.hpp" #include "tilesheeteditormodel.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { // delete pixels of all non-leaf nodes static void normalizeSubsheets(TileSheet::SubSheet &ss) noexcept { @@ -66,7 +66,7 @@ void TileSheetEditorModel::cut() { auto const&s = activeSubSheet(); iterateSelectionRows(*m_selection, [&](int const x, int const y) { auto pt = ox::Point{x, y}; - auto const idx = core::idx(s, pt); + auto const idx = gfx::idx(s, pt); auto const c = getPixel(s, m_img.bpp, idx); pt -= m_selection->a; cb->addPixel(pt, c); @@ -87,7 +87,7 @@ void TileSheetEditorModel::copy() { iterateSelectionRows(*m_selection, [&](int const x, int const y) { auto pt = ox::Point{x, y}; const auto&s = activeSubSheet(); - const auto idx = core::idx(s, pt); + const auto idx = gfx::idx(s, pt); const auto c = getPixel(s, m_img.bpp, idx); pt -= m_selection->a; cb->addPixel(pt, c); @@ -156,7 +156,7 @@ void TileSheetEditorModel::drawCommand(ox::Point const&pt, std::size_t const pal if (pt.x >= activeSubSheet.columns * TileWidth || pt.y >= activeSubSheet.rows * TileHeight) { return; } - const auto idx = core::idx(activeSubSheet, pt); + const auto idx = gfx::idx(activeSubSheet, pt); if (m_ongoingDrawCommand) { m_updated = m_updated || m_ongoingDrawCommand->append(idx); } else if (getPixel(activeSubSheet, m_img.bpp, idx) != palIdx) { @@ -209,7 +209,7 @@ void TileSheetEditorModel::fill(ox::Point const&pt, int const palIdx) noexcept { auto const oldColor = getPixel(activeSubSheet, m_img.bpp, pt); getFillPixels(activeSubSheet, updateMap, pt, oldColor); ox::Vector idxList; - auto i = core::idx(activeSubSheet, pt) / PixelsPerTile * PixelsPerTile; + auto i = gfx::idx(activeSubSheet, pt) / PixelsPerTile * PixelsPerTile; for (auto const u : updateMap) { if (u) { idxList.emplace_back(i); diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.hpp similarity index 97% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.hpp index 6371a4e..ef65205 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.hpp @@ -9,10 +9,10 @@ #include -#include -#include +#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class TileSheetEditorModel: public ox::SignalHandler { diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditorview.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.cpp similarity index 98% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditorview.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.cpp index 0ac18ae..03fdaee 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditorview.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.cpp @@ -5,11 +5,11 @@ #include #include -#include +#include #include "tilesheeteditorview.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { TileSheetEditorView::TileSheetEditorView(studio::StudioContext &sctx, ox::StringView path, studio::UndoStack &undoStack): m_model(sctx, path, undoStack), diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditorview.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.hpp similarity index 97% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditorview.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.hpp index 5c0d11f..a319815 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditorview.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.hpp @@ -10,13 +10,13 @@ #include #include -#include +#include #include "tilesheeteditormodel.hpp" #include "tilesheetpixelgrid.hpp" #include "tilesheetpixels.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { enum class TileSheetTool { None, diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp similarity index 98% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp index e84b6f5..414aa31 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp @@ -4,11 +4,11 @@ #include -#include +#include #include "tilesheetpixelgrid.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { void TileSheetGrid::setPixelSizeMod(float sm) noexcept { m_pixelSizeMod = sm; diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp similarity index 94% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp index f1690d8..6a08895 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp @@ -7,10 +7,10 @@ #include #include -#include -#include +#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class TileSheetGrid { diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixels.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.cpp similarity index 95% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixels.cpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.cpp index fc9551f..c12ebf3 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixels.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.cpp @@ -2,12 +2,12 @@ * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include -#include +#include +#include #include "tilesheeteditormodel.hpp" #include "tilesheetpixels.hpp" -namespace nostalgia::core { +namespace nostalgia::gfx { const glutils::ProgramSource TileSheetPixels::s_programSrc = { .shaderParams = { @@ -29,7 +29,7 @@ const glutils::ProgramSource TileSheetPixels::s_programSrc = { void main() { gl_Position = vec4(vPosition + vScroll, 0.0, 1.0); fColor = vColor; - })", core::gl::GlslVersion), + })", gfx::gl::GlslVersion), .fragShader = ox::sfmt(R"( {} in vec3 fColor; @@ -37,7 +37,7 @@ const glutils::ProgramSource TileSheetPixels::s_programSrc = { void main() { //outColor = vec4(0.0, 0.7, 1.0, 1.0); outColor = vec4(fColor, 1.0); - })", core::gl::GlslVersion), + })", gfx::gl::GlslVersion), }; TileSheetPixels::TileSheetPixels(TileSheetEditorModel &model) noexcept: m_model(model) { @@ -131,7 +131,7 @@ void TileSheetPixels::setBufferObjects(ox::Vec2 const&paneSize) noexcept { m_bufferSet.elements.resize(pixels * VertexEboLength); // set pixels walkPixels(subSheet, m_model.img().bpp, [&](std::size_t i, uint8_t p) { - auto color = core::color(pal, m_model.palettePage(), p); + auto color = gfx::color(pal, m_model.palettePage(), p); auto const pt = idxToPt(static_cast(i), subSheet.columns); auto const fx = static_cast(pt.x); auto const fy = static_cast(pt.y); diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixels.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.hpp similarity index 92% rename from src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixels.hpp rename to src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.hpp index f9fabea..117b2a9 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheetpixels.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.hpp @@ -9,10 +9,10 @@ #include #include -#include -#include +#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { class TileSheetPixels { diff --git a/src/nostalgia/modules/core/src/tilesheet.cpp b/src/nostalgia/modules/gfx/src/tilesheet.cpp similarity index 96% rename from src/nostalgia/modules/core/src/tilesheet.cpp rename to src/nostalgia/modules/gfx/src/tilesheet.cpp index 3856b95..77967b4 100644 --- a/src/nostalgia/modules/core/src/tilesheet.cpp +++ b/src/nostalgia/modules/gfx/src/tilesheet.cpp @@ -5,10 +5,10 @@ #include #include -#include -#include +#include +#include -namespace nostalgia::core { +namespace nostalgia::gfx { std::size_t idx(TileSheet::SubSheet const&ss, ox::Point const&pt) noexcept { return ptToIdx(pt, ss.columns); @@ -241,11 +241,11 @@ TileSheet::SubSheet &getSubSheet( } TileSheet::SubSheet const&getSubSheet(TileSheet const&ts, TileSheet::SubSheetIdx const&idx) noexcept { - return core::getSubSheet(idx, 0, ts.subsheet); + return gfx::getSubSheet(idx, 0, ts.subsheet); } TileSheet::SubSheet &getSubSheet(TileSheet &ts, TileSheet::SubSheetIdx const&idx) noexcept { - return core::getSubSheet(idx, 0, ts.subsheet); + return gfx::getSubSheet(idx, 0, ts.subsheet); } ox::Error addSubSheet(TileSheet &ts, TileSheet::SubSheetIdx const&idx) noexcept { @@ -382,15 +382,15 @@ static ox::Result getTileOffset( } ox::Result getTileOffset(TileSheet const&ts, ox::StringViewCR pNamePath) noexcept { - return core::getTileOffset(ts.subsheet, ox::split<8>(pNamePath, '.'), ts.bpp); + return gfx::getTileOffset(ts.subsheet, ox::split<8>(pNamePath, '.'), ts.bpp); } ox::Result getNameFor(TileSheet &ts, SubSheetId pId) noexcept { - return core::getNameFor(ts.subsheet, pId); + return gfx::getNameFor(ts.subsheet, pId); } ox::Result getNameFor(TileSheet const&ts, SubSheetId pId) noexcept { - return core::getNameFor(ts.subsheet, pId); + return gfx::getNameFor(ts.subsheet, pId); } static void readPixelsTo(TileSheet::SubSheet &ss, ox::Vector &pPixels) noexcept { diff --git a/src/nostalgia/modules/core/test/CMakeLists.txt b/src/nostalgia/modules/gfx/test/CMakeLists.txt similarity index 100% rename from src/nostalgia/modules/core/test/CMakeLists.txt rename to src/nostalgia/modules/gfx/test/CMakeLists.txt diff --git a/src/nostalgia/modules/core/test/tests.cpp b/src/nostalgia/modules/gfx/test/tests.cpp similarity index 87% rename from src/nostalgia/modules/core/test/tests.cpp rename to src/nostalgia/modules/gfx/test/tests.cpp index 03c59fc..21476b3 100644 --- a/src/nostalgia/modules/core/test/tests.cpp +++ b/src/nostalgia/modules/gfx/test/tests.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include using namespace nostalgia; @@ -15,9 +15,9 @@ static std::map tests = { { "readWriteTileSheet", []() -> ox::Error { - core::TileSheet in; + gfx::TileSheet in; OX_REQUIRE(buff, ox::writeMC(in)); - OX_REQUIRE(out, ox::readMC(buff)); + OX_REQUIRE(out, ox::readMC(buff)); oxAssert(in.subsheet.name == out.subsheet.name, "subsheet.name serialization broken"); return {}; } diff --git a/src/nostalgia/modules/keelmodules.cpp b/src/nostalgia/modules/keelmodules.cpp index 00f4745..c296b7c 100644 --- a/src/nostalgia/modules/keelmodules.cpp +++ b/src/nostalgia/modules/keelmodules.cpp @@ -2,7 +2,7 @@ * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include +#include #include namespace nostalgia { @@ -13,7 +13,7 @@ void registerKeelModules() noexcept { return; } modulesRegistered = true; - keel::registerModule(core::keelModule()); + keel::registerModule(gfx::keelModule()); keel::registerModule(scene::keelModule()); } diff --git a/src/nostalgia/modules/scene/include/nostalgia/scene/scene.hpp b/src/nostalgia/modules/scene/include/nostalgia/scene/scene.hpp index 7863d79..46ba1a4 100644 --- a/src/nostalgia/modules/scene/include/nostalgia/scene/scene.hpp +++ b/src/nostalgia/modules/scene/include/nostalgia/scene/scene.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include "scenestatic.hpp" @@ -17,10 +17,10 @@ class Scene { public: explicit Scene(SceneStatic const&sceneStatic) noexcept; - ox::Error setupDisplay(core::Context &ctx) const noexcept; + ox::Error setupDisplay(gfx::Context &ctx) const noexcept; private: - void setupLayer(core::Context&, ox::Vector const&layer, unsigned layerNo) const noexcept; + void setupLayer(gfx::Context&, ox::Vector const&layer, unsigned layerNo) const noexcept; }; diff --git a/src/nostalgia/modules/scene/include/nostalgia/scene/scenestatic.hpp b/src/nostalgia/modules/scene/include/nostalgia/scene/scenestatic.hpp index 19747c9..1291c1c 100644 --- a/src/nostalgia/modules/scene/include/nostalgia/scene/scenestatic.hpp +++ b/src/nostalgia/modules/scene/include/nostalgia/scene/scenestatic.hpp @@ -10,7 +10,7 @@ #include #include -#include +#include namespace nostalgia::scene { @@ -21,7 +21,7 @@ struct SpriteDoc { constexpr static auto Preloadable = true; ox::String tilesheetPath; - ox::Vector subsheetId; + ox::Vector subsheetId; }; @@ -31,13 +31,13 @@ struct TileDoc { constexpr static auto TypeVersion = 1; constexpr static auto Preloadable = true; - core::SubSheetId subsheetId = -1; + gfx::SubSheetId subsheetId = -1; ox::String subsheetPath; uint8_t type = 0; ox::Array layerAttachments; [[nodiscard]] - constexpr ox::Result getSubsheetId(core::TileSheet const&ts) const noexcept { + constexpr ox::Result getSubsheetId(gfx::TileSheet const&ts) const noexcept { // prefer the already present ID if (subsheetId > -1) { return subsheetId; @@ -47,10 +47,10 @@ struct TileDoc { [[nodiscard]] constexpr ox::Result getSubsheetPath( - core::TileSheet const&ts) const noexcept { + gfx::TileSheet const&ts) const noexcept { // prefer the already present path if (!subsheetPath.len()) { - return core::getNameFor(ts, subsheetId); + return gfx::getNameFor(ts, subsheetId); } return ox::StringView(subsheetPath); } diff --git a/src/nostalgia/modules/scene/src/keel/typeconv.cpp b/src/nostalgia/modules/scene/src/keel/typeconv.cpp index f9c51fc..9ab112f 100644 --- a/src/nostalgia/modules/scene/src/keel/typeconv.cpp +++ b/src/nostalgia/modules/scene/src/keel/typeconv.cpp @@ -2,7 +2,7 @@ * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include +#include #include #include "typeconv.hpp" @@ -37,7 +37,7 @@ ox::Error SceneDocToSceneStaticConverter::convert( keel::Context &ctx, SceneDoc &src, SceneStatic &dst) const noexcept { - OX_REQUIRE(ts, keel::readObj(ctx, src.tilesheet)); + OX_REQUIRE(ts, keel::readObj(ctx, src.tilesheet)); const auto layerCnt = src.tiles.size(); dst.setLayerCnt(layerCnt); dst.tilesheet = ox::FileAddress(src.tilesheet); diff --git a/src/nostalgia/modules/scene/src/scene.cpp b/src/nostalgia/modules/scene/src/scene.cpp index 558e76d..99c8d42 100644 --- a/src/nostalgia/modules/scene/src/scene.cpp +++ b/src/nostalgia/modules/scene/src/scene.cpp @@ -2,7 +2,7 @@ * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include +#include #include @@ -12,15 +12,15 @@ Scene::Scene(SceneStatic const&sceneStatic) noexcept: m_sceneStatic(sceneStatic) { } -ox::Error Scene::setupDisplay(core::Context &ctx) const noexcept { +ox::Error Scene::setupDisplay(gfx::Context &ctx) const noexcept { if (m_sceneStatic.palettes.empty()) { return ox::Error(1, "Scene has no palettes"); } auto const&palette = m_sceneStatic.palettes[0]; - OX_RETURN_ERROR(core::loadBgTileSheet(ctx, 0, m_sceneStatic.tilesheet)); - OX_RETURN_ERROR(core::loadBgPalette(ctx, 0, palette)); + OX_RETURN_ERROR(gfx::loadBgTileSheet(ctx, 0, m_sceneStatic.tilesheet)); + OX_RETURN_ERROR(gfx::loadBgPalette(ctx, 0, palette)); // disable all backgrounds - core::setBgStatus(ctx, 0); + gfx::setBgStatus(ctx, 0); for (auto layerNo = 0u; auto const&layer : m_sceneStatic.tileMapIdx) { setupLayer(ctx, layer, layerNo); ++layerNo; @@ -29,20 +29,20 @@ ox::Error Scene::setupDisplay(core::Context &ctx) const noexcept { } void Scene::setupLayer( - core::Context &ctx, + gfx::Context &ctx, ox::Vector const&layer, unsigned layerNo) const noexcept { - core::setBgStatus(ctx, layerNo, true); - core::setBgCbb(ctx, layerNo, 0); + gfx::setBgStatus(ctx, layerNo, true); + gfx::setBgCbb(ctx, layerNo, 0); auto x = 0; auto y = 0; const auto width = m_sceneStatic.rows[layerNo]; for (auto const&tile : layer) { const auto tile8 = static_cast(tile); - core::setBgTile(ctx, layerNo, x, y, tile8); - core::setBgTile(ctx, layerNo, x + 1, y, tile8 + 1); - core::setBgTile(ctx, layerNo, x, y + 1, tile8 + 2); - core::setBgTile(ctx, layerNo, x + 1, y + 1, tile8 + 3); + gfx::setBgTile(ctx, layerNo, x, y, tile8); + gfx::setBgTile(ctx, layerNo, x + 1, y, tile8 + 1); + gfx::setBgTile(ctx, layerNo, x, y + 1, tile8 + 2); + gfx::setBgTile(ctx, layerNo, x + 1, y + 1, tile8 + 3); x += 2; if (x >= width * 2) { x = 0; diff --git a/src/nostalgia/modules/scene/src/studio/sceneeditorview.cpp b/src/nostalgia/modules/scene/src/studio/sceneeditorview.cpp index 6d0776f..7a15f84 100644 --- a/src/nostalgia/modules/scene/src/studio/sceneeditorview.cpp +++ b/src/nostalgia/modules/scene/src/studio/sceneeditorview.cpp @@ -2,31 +2,31 @@ * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include +#include #include "sceneeditorview.hpp" namespace nostalgia::scene { SceneEditorView::SceneEditorView(turbine::Context &tctx, SceneStatic const&sceneStatic): - m_cctx(core::init(tctx, {.glInstallDrawer = false}).unwrapThrow()), + m_cctx(gfx::init(tctx, {.glInstallDrawer = false}).unwrapThrow()), m_sceneStatic(sceneStatic), m_scene(m_sceneStatic) { } ox::Error SceneEditorView::setupScene() noexcept { - glutils::resizeInitFrameBuffer(m_frameBuffer, core::gl::drawSize(m_scale)); + glutils::resizeInitFrameBuffer(m_frameBuffer, gfx::gl::drawSize(m_scale)); return m_scene.setupDisplay(*m_cctx); } void SceneEditorView::draw(ox::Size const&targetSz) noexcept { - auto const scaleSz = targetSz / core::gl::drawSize(1); + auto const scaleSz = targetSz / gfx::gl::drawSize(1); if (m_scaleSz != scaleSz) [[unlikely]] { m_scale = ox::max(1, ox::max(scaleSz.width, scaleSz.height)); - glutils::resizeInitFrameBuffer(m_frameBuffer, core::gl::drawSize(m_scale)); + glutils::resizeInitFrameBuffer(m_frameBuffer, gfx::gl::drawSize(m_scale)); } glutils::FrameBufferBind const frameBufferBind(m_frameBuffer); - core::gl::draw(*m_cctx, m_scale); + gfx::gl::draw(*m_cctx, m_scale); } glutils::FrameBuffer const&SceneEditorView::framebuffer() const noexcept { diff --git a/src/nostalgia/modules/scene/src/studio/sceneeditorview.hpp b/src/nostalgia/modules/scene/src/studio/sceneeditorview.hpp index c1f2991..6e21e40 100644 --- a/src/nostalgia/modules/scene/src/studio/sceneeditorview.hpp +++ b/src/nostalgia/modules/scene/src/studio/sceneeditorview.hpp @@ -6,8 +6,8 @@ #include -#include -#include +#include +#include #include namespace nostalgia::scene { @@ -15,12 +15,12 @@ namespace nostalgia::scene { class SceneEditorView { private: - core::ContextUPtr m_cctx; + gfx::ContextUPtr m_cctx; SceneStatic const&m_sceneStatic; Scene m_scene; glutils::FrameBuffer m_frameBuffer; int m_scale = 1; - ox::Size m_scaleSz = core::gl::drawSize(m_scale); + ox::Size m_scaleSz = gfx::gl::drawSize(m_scale); public: SceneEditorView(turbine::Context &ctx, SceneStatic const&sceneStatic); diff --git a/src/nostalgia/modules/studiomodules.cpp b/src/nostalgia/modules/studiomodules.cpp index ead8a18..516e2ce 100644 --- a/src/nostalgia/modules/studiomodules.cpp +++ b/src/nostalgia/modules/studiomodules.cpp @@ -4,7 +4,7 @@ #include -#include +#include #include namespace nostalgia { @@ -15,7 +15,7 @@ void registerStudioModules() noexcept { return; } modulesRegistered = true; - studio::registerModule(core::studioModule()); + studio::registerModule(gfx::studioModule()); studio::registerModule(scene::studioModule()); } diff --git a/src/nostalgia/player/app.cpp b/src/nostalgia/player/app.cpp index a2d20ea..19cd31d 100644 --- a/src/nostalgia/player/app.cpp +++ b/src/nostalgia/player/app.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include using namespace nostalgia; @@ -16,7 +16,7 @@ static bool s_paused = false; [[maybe_unused]] static int testUpdateHandler(turbine::Context &tctx) noexcept { - auto &cctx = *turbine::applicationData(tctx); + auto &cctx = *turbine::applicationData(tctx); constexpr auto sleepTime = 16; if (s_paused) { return sleepTime; @@ -41,7 +41,7 @@ static int testUpdateHandler(turbine::Context &tctx) noexcept { constexpr ox::StringView sprites = "nostalgia"; for (unsigned i = 0; i < sprites.len(); ++i) { auto const c = static_cast(sprites[i] - ('a' - 1)); - core::setSprite(cctx, i, { + gfx::setSprite(cctx, i, { .enabled = true, .x = spriteX + 8 * (static_cast(i) + 1), .y = spriteY, @@ -67,13 +67,13 @@ static void testKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool d static ox::Error runTest(turbine::Context &tctx) { constexpr ox::StringView TileSheetAddr{"/TileSheets/Charset.ng"}; constexpr ox::StringView PaletteAddr{"/Palettes/Chester.npal"}; - OX_REQUIRE_M(cctx, core::init(tctx)); + OX_REQUIRE_M(cctx, gfx::init(tctx)); turbine::setApplicationData(tctx, cctx.get()); OX_REQUIRE(tsStat, turbine::rom(tctx)->stat(PaletteAddr)); - OX_RETURN_ERROR(core::loadSpriteTileSheet(*cctx, TileSheetAddr)); - OX_RETURN_ERROR(core::loadSpritePalette(*cctx, PaletteAddr)); - OX_RETURN_ERROR(core::initConsole(*cctx)); - core::puts(*cctx, 10, 9, "DOPENESS!!!"); + OX_RETURN_ERROR(gfx::loadSpriteTileSheet(*cctx, TileSheetAddr)); + OX_RETURN_ERROR(gfx::loadSpritePalette(*cctx, PaletteAddr)); + OX_RETURN_ERROR(gfx::initConsole(*cctx)); + gfx::puts(*cctx, 10, 9, "DOPENESS!!!"); turbine::setUpdateHandler(tctx, testUpdateHandler); turbine::setKeyEventHandler(tctx, testKeyEventHandler); return turbine::run(tctx); @@ -85,10 +85,10 @@ static ox::Error runTileSheetSetTest(turbine::Context &tctx) { // this should make the screen display 'ABCDB', with the A being upside down // and the first B being backwards constexpr ox::StringView PaletteAddr{"/Palettes/Charset.npal"}; - OX_REQUIRE_M(cctx, core::init(tctx)); + OX_REQUIRE_M(cctx, gfx::init(tctx)); turbine::setApplicationData(tctx, cctx.get()); OX_REQUIRE(tsStat, turbine::rom(tctx)->stat(PaletteAddr)); - core::TileSheetSet const set{ + gfx::TileSheetSet const set{ .bpp = 4, .entries = { { .tilesheet = ox::StringLiteral{"/TileSheets/Chester.ng"}, .sections{{.begin = 0, .tiles = 1}} }, @@ -98,23 +98,23 @@ static ox::Error runTileSheetSetTest(turbine::Context &tctx) { }, }; constexpr auto bgPalBank = 1; - OX_RETURN_ERROR(core::loadBgTileSheet(*cctx, 0, set)); - OX_RETURN_ERROR(core::loadSpriteTileSheet(*cctx, set)); - OX_RETURN_ERROR(core::loadBgPalette(*cctx, bgPalBank, PaletteAddr)); - OX_RETURN_ERROR(core::loadBgPalette(*cctx, 0, PaletteAddr)); - OX_RETURN_ERROR(core::loadSpritePalette(*cctx, PaletteAddr)); - core::setBgStatus(*cctx, 0, true); - core::setBgTile(*cctx, 0, 10, 9, { .tileIdx = 1, .palBank = bgPalBank, .flipX = 0, .flipY = 1 }); - core::setBgTile(*cctx, 0, 11, 9, { .tileIdx = 2, .palBank = bgPalBank, .flipX = 1, .flipY = 0 }); - core::setBgTile(*cctx, 0, 13, 9, { .tileIdx = 4, .palBank = bgPalBank, .flipX = 0, .flipY = 0 }); - core::setSprite(*cctx, 16, { + OX_RETURN_ERROR(gfx::loadBgTileSheet(*cctx, 0, set)); + OX_RETURN_ERROR(gfx::loadSpriteTileSheet(*cctx, set)); + OX_RETURN_ERROR(gfx::loadBgPalette(*cctx, bgPalBank, PaletteAddr)); + OX_RETURN_ERROR(gfx::loadBgPalette(*cctx, 0, PaletteAddr)); + OX_RETURN_ERROR(gfx::loadSpritePalette(*cctx, PaletteAddr)); + gfx::setBgStatus(*cctx, 0, true); + gfx::setBgTile(*cctx, 0, 10, 9, { .tileIdx = 1, .palBank = bgPalBank, .flipX = 0, .flipY = 1 }); + gfx::setBgTile(*cctx, 0, 11, 9, { .tileIdx = 2, .palBank = bgPalBank, .flipX = 1, .flipY = 0 }); + gfx::setBgTile(*cctx, 0, 13, 9, { .tileIdx = 4, .palBank = bgPalBank, .flipX = 0, .flipY = 0 }); + gfx::setSprite(*cctx, 16, { .enabled = true, .x = 12 * 8, .y = 9 * 8, .tileIdx = 3, .bpp = static_cast(set.bpp), }); - core::setSprite(*cctx, 17, { + gfx::setSprite(*cctx, 17, { .enabled = true, .x = 14 * 8, .y = 9 * 8, @@ -148,7 +148,7 @@ static void sceneKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool [[maybe_unused]] static ox::Error runScene(turbine::Context &tctx) { constexpr ox::StringView SceneAddr{"/Scenes/Chester.nscn"}; - OX_REQUIRE_M(cctx, core::init(tctx)); + OX_REQUIRE_M(cctx, gfx::init(tctx)); OX_REQUIRE(scn, keel::readObj(keelCtx(tctx), SceneAddr)); turbine::setUpdateHandler(tctx, sceneUpdateHandler); turbine::setKeyEventHandler(tctx, sceneKeyEventHandler); diff --git a/src/olympic/studio/applib/src/newdir.cpp b/src/olympic/studio/applib/src/newdir.cpp index 01caed3..b31644e 100644 --- a/src/olympic/studio/applib/src/newdir.cpp +++ b/src/olympic/studio/applib/src/newdir.cpp @@ -39,13 +39,15 @@ void NewDir::draw(StudioContext &ctx) noexcept { case Stage::Opening: ImGui::OpenPopup(title().c_str()); m_open = true; + m_stage = Stage::Open; [[fallthrough]]; case Stage::Open: drawWindow(ctx.tctx, m_open, [this] { - if (m_stage == Stage::Opening) { + if (ImGui::IsWindowAppearing()) { ImGui::SetKeyboardFocusHere(); } ig::InputText("Name", m_str); + ImGui::SetItemDefaultFocus(); if (ImGui::IsItemFocused() && ImGui::IsKeyPressed(ImGuiKey_Enter)) { newDir.emit(m_path + "/" + m_str); close(); @@ -55,7 +57,6 @@ void NewDir::draw(StudioContext &ctx) noexcept { close(); } }); - m_stage = Stage::Open; break; } } diff --git a/src/olympic/studio/applib/src/studioapp.cpp b/src/olympic/studio/applib/src/studioapp.cpp index a9358b3..f7e354b 100644 --- a/src/olympic/studio/applib/src/studioapp.cpp +++ b/src/olympic/studio/applib/src/studioapp.cpp @@ -18,6 +18,9 @@ namespace studio { +namespace ig { +extern bool s_mainWinHasFocus; +} static ox::Vector modules; void registerModule(Module const*mod) noexcept { @@ -102,26 +105,29 @@ void StudioUI::handleKeyEvent(turbine::Key const key, bool const down) noexcept void StudioUI::draw() noexcept { glutils::clearScreen(); drawMenu(); - auto const viewport = ImGui::GetMainViewport(); - constexpr auto menuHeight = 18; - ImGui::SetNextWindowPos(ImVec2(viewport->Pos.x, viewport->Pos.y + menuHeight)); - ImGui::SetNextWindowSize(ImVec2(viewport->Size.x, viewport->Size.y - menuHeight)); - constexpr auto windowFlags = ImGuiWindowFlags_NoTitleBar - | ImGuiWindowFlags_NoResize - | ImGuiWindowFlags_NoMove - | ImGuiWindowFlags_NoScrollbar - | ImGuiWindowFlags_NoSavedSettings; + auto const&viewport = *ImGui::GetMainViewport(); + ImGui::SetNextWindowPos(viewport.WorkPos); + ImGui::SetNextWindowSize(viewport.WorkSize); + ImGui::SetNextWindowViewport(viewport.ID); + auto constexpr windowFlags = + ImGuiWindowFlags_NoTitleBar | + ImGuiWindowFlags_NoResize | + ImGuiWindowFlags_NoMove | + ImGuiWindowFlags_NoScrollbar | + ImGuiWindowFlags_NoSavedSettings; ImGui::Begin("MainWindow##Studio", nullptr, windowFlags); { + ig::s_mainWinHasFocus = ImGui::IsWindowFocused( + ImGuiFocusedFlags_RootAndChildWindows | ImGuiFocusedFlags_NoPopupHierarchy); if (m_showProjectExplorer) { m_projectExplorer.draw(m_sctx); ImGui::SameLine(); } drawTabBar(); - for (auto &w: m_widgets) { + for (auto const&w : m_widgets) { w->draw(m_sctx); } - for (auto const p: m_popups) { + for (auto const p : m_popups) { p->draw(m_sctx); } } diff --git a/src/olympic/studio/modlib/include/studio/imguiutil.hpp b/src/olympic/studio/modlib/include/studio/imguiutil.hpp index 60bff75..cf27226 100644 --- a/src/olympic/studio/modlib/include/studio/imguiutil.hpp +++ b/src/olympic/studio/modlib/include/studio/imguiutil.hpp @@ -256,4 +256,7 @@ class FilePicker { }; +[[nodiscard]] +bool mainWinHasFocus() noexcept; + } diff --git a/src/olympic/studio/modlib/src/imguiutil.cpp b/src/olympic/studio/modlib/src/imguiutil.cpp index b6d8fb2..d3af2aa 100644 --- a/src/olympic/studio/modlib/src/imguiutil.cpp +++ b/src/olympic/studio/modlib/src/imguiutil.cpp @@ -208,4 +208,9 @@ void FilePicker::show() noexcept { m_show = true; } +bool s_mainWinHasFocus{}; +bool mainWinHasFocus() noexcept { + return s_mainWinHasFocus; +} + }