diff --git a/CMakeLists.txt b/CMakeLists.txt index 89901da..9eda9ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,31 +1,37 @@ cmake_minimum_required(VERSION 3.18..3.27) -project(Editor2D - VERSION 1.0 +project(Redacted2DLevelLibrary + VERSION 1.2 LANGUAGES CXX) if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) message(FATAL_ERROR "In-source builds are not allowed!") endif() - - set(CMAKE_BUILD_PARALLEL_LEVEL 8) set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # Enable package managers include(cmake/CPM.cmake) -file(GLOB_RECURSE EDITOR_HEADERS "include/*.hpp") -file(GLOB_RECURSE EDITOR_SRC "src/*.cpp") +file(GLOB_RECURSE FORMAT_HEADERS "include/Format/*.hpp") +file(GLOB_RECURSE FORMAT_SRC "src/Format/*.cpp") + +file(GLOB_RECURSE EDITOR_HEADERS "include/Editor/*.hpp") +file(GLOB_RECURSE EDITOR_SRC "src/Editor/*.cpp") + +file(GLOB_RECURSE DEMOGAME_HEADERS "include/DemoGame/*.hpp") +file(GLOB_RECURSE DEMOGAME_SRC "src/DemoGame/*.cpp") include_directories("include") CPMAddPackage(NAME mcolor - URL https://git.redacted.cc/maxine/mcolor/archive/Prerelease-7.4.zip) + URL https://git.redacted.cc/maxine/mcolor/archive/Release-1.zip) CPMAddPackage(NAME jlog URL https://git.redacted.cc/josh/jlog/archive/Prerelease-18.zip) @@ -34,7 +40,7 @@ CPMAddPackage(NAME Event URL https://git.redacted.cc/josh/Event/archive/Release-12.zip) CPMAddPackage(NAME jjx - URL https://git.redacted.cc/josh/jjx/archive/Release-1.2.zip) + URL https://git.redacted.cc/josh/json/archive/Release-1.3.zip) CPMAddPackage(NAME J3ML URL https://git.redacted.cc/josh/j3ml/archive/3.4.5.zip) @@ -50,17 +56,33 @@ CPMAddPackage(NAME JUI if (UNIX) - add_library(Editor2D SHARED ${EDITOR_SRC}) + add_library(LevelFormat SHARED ${FORMAT_SRC}) + add_library(Editor SHARED ${EDITOR_SRC}) endif() if (WIN32) - ADD_LIBRARY(Editor2D STATIC ${EDITOR_SRC}) + ADD_LIBRARY(LevelFormat STATIC ${EDITOR_SRC}) + ADD_LIBRARY(Editor STATIC ${EDITOR_SRC}) + endif() -set_target_properties(Editor2D PROPERTIES LINKER_LANGUAGE CXX) +target_compile_definitions(LevelFormat PRIVATE Redacted2DLevelFormatVersion=1) +set_target_properties(LevelFormat PROPERTIES LINKER_LANGUAGE CXX) +set_target_properties(Editor PROPERTIES LINKER_LANGUAGE CXX) + +set(CORE_DEPENDENCY_HEADERS + ${J3ML_SOURCE_DIR}/include + ${json_SOURCE_DIR}/include) + +# Public Dependencies +target_include_directories(LevelFormat PUBLIC + ${CORE_DEPENDENCY_HEADERS}) + + + # TODO: Separate dependency packages such that only bare-minimum required is compiled with the just the lib. -target_include_directories(Editor2D PUBLIC +target_include_directories(Editor PUBLIC ${Event_SOURCE_DIR}/include ${J3ML_SOURCE_DIR}/include ${jlog_SOURCE_DIR}/include @@ -68,24 +90,25 @@ target_include_directories(Editor2D PUBLIC ${ReWindow_SOURCE_DIR}/include ${JUI_SOURCE_DIR}/include ${mcolor_SOURCE_DIR}/include - ${jjx_SOURCE_DIR}/include ) -target_link_libraries(Editor2D PUBLIC Event J3ML jlog ReWindow JGL JUI mcolor jjx) +target_link_libraries(LevelFormat PUBLIC Event J3ML json) + +target_link_libraries(Editor PUBLIC Event J3ML jlog ReWindow JGL JUI mcolor jjx) + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/assets/" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/assets) -# TODO: Reorganize lib files into LevelAPI, EditorApp, TestGame. +# Build Applications -add_executable(Editor2DApp main.cpp app.rc) -target_link_libraries(Editor2DApp PUBLIC Editor2D) +add_executable(EditorApp apps/editor.cpp app.rc) +target_link_libraries(EditorApp PUBLIC Editor) -add_executable(testgame testgame.cpp) -target_link_libraries(testgame PUBLIC Editor2D) +add_executable(DemoGame apps/game.cpp) +target_link_libraries(DemoGame PUBLIC LevelFormat) - -add_executable(level_format_tests level_format_tests.cpp) -target_link_libraries(level_format_tests PUBLIC Editor2D) +add_executable(level_format_tests apps/tests.cpp) +target_link_libraries(level_format_tests PUBLIC LevelFormat) diff --git a/main.cpp b/apps/editor.cpp similarity index 79% rename from main.cpp rename to apps/editor.cpp index 973ece9..6a41739 100644 --- a/main.cpp +++ b/apps/editor.cpp @@ -2,9 +2,9 @@ // Created by dawsh on 5/12/25. // -#include +#include -#include "cmake-build-debug/_deps/rewindow-src/include/ReWindow/Logger.h" +#include "ReWindow/Logger.h" int main(int argc, char** argv) { diff --git a/testgame.cpp b/apps/game.cpp similarity index 90% rename from testgame.cpp rename to apps/game.cpp index 112cacd..a17fa60 100644 --- a/testgame.cpp +++ b/apps/game.cpp @@ -1,18 +1,18 @@ #include #include "ReWindow/Logger.h" -#include +#include #include #include #include #include #include -#include "App/EditorCamera.hpp" +#include "Editor/EditorCamera.hpp" #include "JUI/Widgets/ListLayout.hpp" #include "JUI/Widgets/Slider.hpp" -#include +#include template struct Range { diff --git a/level_format_tests.cpp b/apps/tests.cpp similarity index 92% rename from level_format_tests.cpp rename to apps/tests.cpp index a7dac27..69d57d5 100644 --- a/level_format_tests.cpp +++ b/apps/tests.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include +#include +#include +#include void CreateSampleLevel() { diff --git a/assets/included_level/level.json b/assets/included_level/level.json index 4204929..476c804 100644 --- a/assets/included_level/level.json +++ b/assets/included_level/level.json @@ -5,9 +5,9 @@ "editor-version":1.000000, "entities":[ { - "color":"#C5549AA3", - "flip-h":0.000000, - "flip-v":-0.000000, + "color":"#FF8C00FF", + "flip-h":-170504623958157066014014014511678226432.000000, + "flip-v":-171262699299503150847779466975744360448.000000, "height":16.000000, "metadata":null, "name":"Mr Bigg", @@ -26,7 +26,7 @@ "cell-width":16.000000, "cols":64.000000, "name":"Colliding Tiles", - "order":1.000000, + "order":0.000000, "rows":64.000000 }, { @@ -40,7 +40,7 @@ } ], "map-cols":0.000000, - "map-rows":-962889206.000000, + "map-rows":53.000000, "map-type":true, "name":"Test Level", "tags":[ diff --git a/assets/included_level/tileset.json b/assets/included_level/tileset.json index 53bc54f..e2fd0f0 100644 --- a/assets/included_level/tileset.json +++ b/assets/included_level/tileset.json @@ -13,58 +13,112 @@ "tile-width":16.000000, "tiles":[ { - "id":896, - "collides": false, - "name":"Gate_Left", - "quad":[0.000000, 0.000000, 16.000000, 16.000000] + "collides":false, + "id":710.000000, + "metadata":null, + "name":"Truss1" }, { - "id":897, - "collides": false, - "name":"Gate_Right", - "quad":[0.000000, 0.000000, 16.000000, 16.000000] + "collides":false, + "id":714.000000, + "metadata":null, + "name":"Truss2" }, { - "id":777, - "collides": false, - "name":"Traffic_Cone", - "quad":[0.000000, 0.000000, 16.000000, 16.000000] + "collides":true, + "id":768.000000, + "metadata":null, + "name":"Screen1" }, { - "id":838, - "collides": false, - "name":"SecurityCamera_South", - "quad":[0.000000, 0.000000, 16.000000, 16.000000] + "collides":true, + "id":770.000000, + "metadata":null, + "name":"tile_770" }, { - "id":838, - "collides": false, - "name":"SecurityCamera_SouthWest", - "quad":[0.000000, 0.000000, 16.000000, 16.000000] + "collides":false, + "id":777.000000, + "metadata":null, + "name":"Traffic_Cone" }, { - "id":710, - "collides": false, - "name":"Truss1", - "quad":[0.000000, 0.000000, 16.000000, 16.000000] + "collides":false, + "id":798.000000, + "metadata":null, + "name":"GrassA" }, { - "id":714, - "collides": false, - "name":"Truss2", - "quad":[0.000000, 0.000000, 16.000000, 16.000000] + "collides":false, + "id":799.000000, + "metadata":null, + "name":"GrassB" }, { - "id":798, - "collides": false, - "name":"GrassA", - "quad":[0.000000, 0.000000, 16.000000, 16.000000] + "collides":true, + "id":833.000000, + "metadata":null, + "name":"tile_833" }, { - "id":799, - "collides": false, - "name":"GrassB", - "quad":[0.000000, 0.000000, 16.000000, 16.000000] + "collides":false, + "id":836.000000, + "metadata":null, + "name":"SecurityCameraW" + }, + { + "collides":false, + "id":837.000000, + "metadata":null, + "name":"SecurityCameraSW" + }, + { + "collides":false, + "id":838.000000, + "metadata":null, + "name":"SecurityCameraS" + }, + { + "collides":false, + "id":839.000000, + "metadata":null, + "name":"SecurityCameraSE" + }, + { + "collides":false, + "id":840.000000, + "metadata":null, + "name":"SecurityCameraE" + }, + { + "collides":false, + "id":896.000000, + "metadata":null, + "name":"Gate_Left" + }, + { + "collides":false, + "id":897.000000, + "metadata":null, + "name":"Gate_Right" + }, + { + "collides":false, + "id":904.000000, + "metadata":null, + "name":"Ladder1Top" + }, + { + "collides":false, + "id":968.000000, + "metadata":null, + "name":"Ladder1Bottom" + }, + { + "collides":false, + "id":1729.000000, + "metadata":null, + "name":"BlueRopeChain" } ] } \ No newline at end of file diff --git a/include/Data/Etc.hpp b/include/Data/Etc.hpp deleted file mode 100644 index f69db30..0000000 --- a/include/Data/Etc.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - - -namespace LevelFormat -{ - -}; \ No newline at end of file diff --git a/include/Data/Format.hpp b/include/Data/Format.hpp deleted file mode 100644 index 333e0be..0000000 --- a/include/Data/Format.hpp +++ /dev/null @@ -1,5 +0,0 @@ -#include -#include -#include -#include -#include diff --git a/include/TestGame/ChatBubble.hpp b/include/DemoGame/ChatBubble.hpp similarity index 100% rename from include/TestGame/ChatBubble.hpp rename to include/DemoGame/ChatBubble.hpp diff --git a/include/TestGame/Crate.hpp b/include/DemoGame/Crate.hpp similarity index 100% rename from include/TestGame/Crate.hpp rename to include/DemoGame/Crate.hpp diff --git a/include/TestGame/GameEntity.hpp b/include/DemoGame/GameEntity.hpp similarity index 95% rename from include/TestGame/GameEntity.hpp rename to include/DemoGame/GameEntity.hpp index 8950e8f..0269870 100644 --- a/include/TestGame/GameEntity.hpp +++ b/include/DemoGame/GameEntity.hpp @@ -1,5 +1,5 @@ #pragma once -#include "Data/Entity.hpp" +#include "Format/Entity.hpp" namespace TestGame { diff --git a/include/TestGame/PhysicsTweaker.hpp b/include/DemoGame/PhysicsTweaker.hpp similarity index 100% rename from include/TestGame/PhysicsTweaker.hpp rename to include/DemoGame/PhysicsTweaker.hpp diff --git a/include/TestGame/Player.hpp b/include/DemoGame/Player.hpp similarity index 100% rename from include/TestGame/Player.hpp rename to include/DemoGame/Player.hpp diff --git a/include/TestGame/TestGameApp.hpp b/include/DemoGame/TestGameApp.hpp similarity index 98% rename from include/TestGame/TestGameApp.hpp rename to include/DemoGame/TestGameApp.hpp index 0d2b6ae..6091a9c 100644 --- a/include/TestGame/TestGameApp.hpp +++ b/include/DemoGame/TestGameApp.hpp @@ -1,7 +1,7 @@ #include "GameEntity.hpp" #include "Player.hpp" -#include "App/EditorCamera.hpp" -#include "Data/Level.hpp" +#include "Editor/EditorCamera.hpp" +#include "Format/Level.hpp" #include "JUI/Widgets/Scene.hpp" #include "ReWindow/types/Window.h" diff --git a/include/App/AboutDialog.hpp b/include/Editor/AboutDialog.hpp similarity index 100% rename from include/App/AboutDialog.hpp rename to include/Editor/AboutDialog.hpp diff --git a/include/App/Editor.hpp b/include/Editor/Editor.hpp similarity index 100% rename from include/App/Editor.hpp rename to include/Editor/Editor.hpp diff --git a/include/App/EditorApp.hpp b/include/Editor/EditorApp.hpp similarity index 97% rename from include/App/EditorApp.hpp rename to include/Editor/EditorApp.hpp index c6e2512..08590fd 100644 --- a/include/App/EditorApp.hpp +++ b/include/Editor/EditorApp.hpp @@ -13,11 +13,11 @@ #include "NewMapDialog.hpp" #include "JUI/Widgets/ColorPicker.hpp" #include "Preferences.hpp" -#include -#include +#include +#include #include -#include -#include +#include +#include #include "JUI/Widgets/FpsGraph.hpp" @@ -27,7 +27,7 @@ using namespace ReWindow; using namespace JUI::UDimLiterals; -#include +#include // TODO: Support loading an entity_prefab.json file which defines template entities to copy. // TODO: Support sprites for these? diff --git a/include/App/EditorCamera.hpp b/include/Editor/EditorCamera.hpp similarity index 98% rename from include/App/EditorCamera.hpp rename to include/Editor/EditorCamera.hpp index 654b494..634dc4f 100644 --- a/include/App/EditorCamera.hpp +++ b/include/Editor/EditorCamera.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include +#include struct EditorCamera { Lerped translation; diff --git a/include/App/Grid.hpp b/include/Editor/Grid.hpp similarity index 100% rename from include/App/Grid.hpp rename to include/Editor/Grid.hpp diff --git a/include/App/LayerView.hpp b/include/Editor/LayerView.hpp similarity index 97% rename from include/App/LayerView.hpp rename to include/Editor/LayerView.hpp index 377091d..d00201d 100644 --- a/include/App/LayerView.hpp +++ b/include/Editor/LayerView.hpp @@ -6,7 +6,7 @@ #include #include -#include +#include using namespace JUI::UDimLiterals; diff --git a/include/App/NewMapDialog.hpp b/include/Editor/NewMapDialog.hpp similarity index 100% rename from include/App/NewMapDialog.hpp rename to include/Editor/NewMapDialog.hpp diff --git a/include/App/Preferences.hpp b/include/Editor/Preferences.hpp similarity index 100% rename from include/App/Preferences.hpp rename to include/Editor/Preferences.hpp diff --git a/include/App/TileMetaDialog.hpp b/include/Editor/TileMetaDialog.hpp similarity index 96% rename from include/App/TileMetaDialog.hpp rename to include/Editor/TileMetaDialog.hpp index 1025054..a4669d1 100644 --- a/include/App/TileMetaDialog.hpp +++ b/include/Editor/TileMetaDialog.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include #include diff --git a/include/App/TilesetView.hpp b/include/Editor/TilesetView.hpp similarity index 99% rename from include/App/TilesetView.hpp rename to include/Editor/TilesetView.hpp index a4d46c7..7968827 100644 --- a/include/App/TilesetView.hpp +++ b/include/Editor/TilesetView.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include "TileMetaDialog.hpp" diff --git a/include/Data/Entity.hpp b/include/Format/Entity.hpp similarity index 92% rename from include/Data/Entity.hpp rename to include/Format/Entity.hpp index c4f2a61..9948932 100644 --- a/include/Data/Entity.hpp +++ b/include/Format/Entity.hpp @@ -1,11 +1,9 @@ #pragma once #include -#include +#include #include -#include - -using namespace JJX; +#include enum class EntityRepresentativeShape { Point, AABB, Sphere, OBB diff --git a/include/Format/Format.hpp b/include/Format/Format.hpp new file mode 100644 index 0000000..186eee9 --- /dev/null +++ b/include/Format/Format.hpp @@ -0,0 +1,5 @@ +#include +#include +#include +#include +#include diff --git a/include/Data/Layer.hpp b/include/Format/Layer.hpp similarity index 97% rename from include/Data/Layer.hpp rename to include/Format/Layer.hpp index f9d7c1a..4a8f8dd 100644 --- a/include/Data/Layer.hpp +++ b/include/Format/Layer.hpp @@ -1,12 +1,12 @@ #pragma once #include #include -#include -#include -#include -#include +#include + +#include + +#include -using namespace JJX; enum class DataFormat { diff --git a/include/Data/Level.hpp b/include/Format/Level.hpp similarity index 97% rename from include/Data/Level.hpp rename to include/Format/Level.hpp index 2105099..b9805d2 100644 --- a/include/Data/Level.hpp +++ b/include/Format/Level.hpp @@ -1,15 +1,12 @@ #pragma once #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include "Tileset.hpp" - -using namespace JJX; const float REDACTED_EDITOR_LIB_VERSION = 1; diff --git a/include/Format/LevelFormat.hpp b/include/Format/LevelFormat.hpp new file mode 100644 index 0000000..3f59c93 --- /dev/null +++ b/include/Format/LevelFormat.hpp @@ -0,0 +1,2 @@ +#pragma once + diff --git a/include/Data/Tile.hpp b/include/Format/Tile.hpp similarity index 100% rename from include/Data/Tile.hpp rename to include/Format/Tile.hpp diff --git a/include/Data/Tileset.hpp b/include/Format/Tileset.hpp similarity index 77% rename from include/Data/Tileset.hpp rename to include/Format/Tileset.hpp index 0fb7fa1..6f794c6 100644 --- a/include/Data/Tileset.hpp +++ b/include/Format/Tileset.hpp @@ -1,28 +1,52 @@ +/// Redacted Software 2D Level Library +/// Level File Format Specification +/// #pragma once #include -#include +#include #include #include -#include +#include +#include + + + /// Represents a rectangular sub-region of a larger space, such as a texture. + /// @see J2D::DrawPartialSprite(); + struct Quad { + int x; int y; + int w; int h; +#ifdef QUAD_EXTENDED_API + Vector2i Position() const { return {x, y};} + Vector2i Size() const { return {w, h};} + void Position(const Vector2i& value) { x = value.x; y = value.y; } + void Size(const Vector2i& value) { w = value.x; h = value.y; } + void Set(AABB2D& rect) { } + + + Quad Translated(const Vector2i& translation) { + Quad copy; + } + + void Translate(const Vector2i& translation) { + x += translation.x; + y += translation.y; + } +#endif + }; + + -#include -#include -#include "JGL/types/Texture.h" -using namespace JJX; -struct Quad { - int x; - int y; - int w; - int h; -}; struct Tile { int id; std::string name; + /// The portion of the Tilesheet that corresponds to this tile-object. + /// @note Non-uniform tile width and height are technically possible, but not generally designed for.\n + /// The quad.w, quad.h should match the Tileset.tile_width, and Tileseh.tile_height. Quad quad; json::value metadata; bool collides; @@ -30,8 +54,6 @@ struct Tile bool persistent = false; }; -/// TODO: Only generate tile entry for tiles that are used in the level, or have been assigned custom metadata. -/// TODO: Large tilesets generate unwieldy file sizes and cause our rudimentary json parser to crash out. /// @class Tileset /// @brief Represents a collection of tiles, typically from a single texture atlas, used in a level. @@ -39,6 +61,9 @@ struct Tile /// The Tileset class defines the properties of a set of tiles, including their dimensions, /// spacing, and how they are arranged within a source texture. It also provides metadata /// about the tileset itself, such as its name and author. +/// +/// @note As a space-saving measure, tiles are only saved to file if they contain non-generic metadata, or a custom name or ID. Otherwise, tiles are simply generated in incrementing order at runtime. +/// class Tileset { public: #pragma region json fields diff --git a/include/Utils.hpp b/include/Re2DLevelAPI.hpp similarity index 74% rename from include/Utils.hpp rename to include/Re2DLevelAPI.hpp index 7d935f5..e863cb3 100644 --- a/include/Utils.hpp +++ b/include/Re2DLevelAPI.hpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -11,6 +11,7 @@ #pragma once + inline int CellToIndex(Vector2i cell, int width) { return cell.y*width + cell.x; @@ -18,14 +19,12 @@ inline int CellToIndex(Vector2i cell, int width) namespace JsonConversions { - using namespace JJX; - Color4 parse_color(const JJX::json::value& v); + Color4 parse_color(const json::value& v); + json::value deparse_color_to_hex(const Color4& color); - JJX::json::value deparse_color_to_hex(const Color4& color); + std::vector parse_string_list(const json::value& v); - std::vector parse_string_list(const JJX::json::value& v); - - JJX::json::value deparse_string_list(const std::vector& list); + json::value deparse_string_list(const std::vector& list); } // namespace JsonConversions template diff --git a/src/TestGame/PhysicsTweaker.cpp b/src/DemoGame/PhysicsTweaker.cpp similarity index 100% rename from src/TestGame/PhysicsTweaker.cpp rename to src/DemoGame/PhysicsTweaker.cpp diff --git a/src/TestGame/Player.cpp b/src/DemoGame/Player.cpp similarity index 97% rename from src/TestGame/Player.cpp rename to src/DemoGame/Player.cpp index d935b86..81f6ab1 100644 --- a/src/TestGame/Player.cpp +++ b/src/DemoGame/Player.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include TestGame::Player::Player(const Vector2 &spawn_pos): GameEntity(spawn_pos) { diff --git a/src/TestGame/TestGameApp.cpp b/src/DemoGame/TestGameApp.cpp similarity index 99% rename from src/TestGame/TestGameApp.cpp rename to src/DemoGame/TestGameApp.cpp index e88ee05..aaaf2cb 100644 --- a/src/TestGame/TestGameApp.cpp +++ b/src/DemoGame/TestGameApp.cpp @@ -1,4 +1,4 @@ -#include +#include #include "JUI/Widgets/FpsGraph.hpp" #include diff --git a/src/App/Editor.cpp b/src/Editor/Editor.cpp similarity index 100% rename from src/App/Editor.cpp rename to src/Editor/Editor.cpp diff --git a/src/App/EditorApp.cpp b/src/Editor/EditorApp.cpp similarity index 99% rename from src/App/EditorApp.cpp rename to src/Editor/EditorApp.cpp index 1a5f649..9c52f99 100644 --- a/src/App/EditorApp.cpp +++ b/src/Editor/EditorApp.cpp @@ -1,12 +1,12 @@ #include -#include -#include +#include +#include -#include +#include #include "JUI/Widgets/FpsGraph.hpp" -#include +#include JUI::Window* EditorApp::CreateAppInfoDialogWindow(JUI::Widget* parent) diff --git a/src/App/EditorCamera.cpp b/src/Editor/EditorCamera.cpp similarity index 95% rename from src/App/EditorCamera.cpp rename to src/Editor/EditorCamera.cpp index 1d76784..e72207c 100644 --- a/src/App/EditorCamera.cpp +++ b/src/Editor/EditorCamera.cpp @@ -1,4 +1,4 @@ -#include +#include Matrix4x4 EditorCamera::CurrentTranslationMatrix() const { diff --git a/src/App/LayerView.cpp b/src/Editor/LayerView.cpp similarity index 99% rename from src/App/LayerView.cpp rename to src/Editor/LayerView.cpp index 5695780..0a84bbc 100644 --- a/src/App/LayerView.cpp +++ b/src/Editor/LayerView.cpp @@ -1,4 +1,4 @@ -#include +#include LayerView::LayerView(): JUI::Window() { this->Title("Layers"); diff --git a/src/App/TileMetaDialog.cpp b/src/Editor/TileMetaDialog.cpp similarity index 98% rename from src/App/TileMetaDialog.cpp rename to src/Editor/TileMetaDialog.cpp index 5e7a01c..a4deea3 100644 --- a/src/App/TileMetaDialog.cpp +++ b/src/Editor/TileMetaDialog.cpp @@ -1,4 +1,4 @@ -#include +#include TileMetaDialog::TileMetaDialog(): JUI::Window() { diff --git a/src/Data/Entity.cpp b/src/Format/Entity.cpp similarity index 97% rename from src/Data/Entity.cpp rename to src/Format/Entity.cpp index bce0f88..479e49e 100644 --- a/src/Data/Entity.cpp +++ b/src/Format/Entity.cpp @@ -1,4 +1,4 @@ -#include +#include Entity::Entity(): x(0), y(0), diff --git a/src/Data/Layer.cpp b/src/Format/Layer.cpp similarity index 99% rename from src/Data/Layer.cpp rename to src/Format/Layer.cpp index 0f608b3..bdde324 100644 --- a/src/Data/Layer.cpp +++ b/src/Format/Layer.cpp @@ -1,4 +1,4 @@ -#include +#include Layer::Layer(): rows(0), cols(0), cell_width(0), cell_height(0), parallax_x(0), parallax_y(0), cells(nullptr), visible(true), order(0) { } diff --git a/src/Data/Level.cpp b/src/Format/Level.cpp similarity index 98% rename from src/Data/Level.cpp rename to src/Format/Level.cpp index 1d8e75a..2eced47 100644 --- a/src/Data/Level.cpp +++ b/src/Format/Level.cpp @@ -1,4 +1,4 @@ -#include +#include Level::Level(): rows(0), cols(0) diff --git a/src/Data/Tileset.cpp b/src/Format/Tileset.cpp similarity index 99% rename from src/Data/Tileset.cpp rename to src/Format/Tileset.cpp index 685004f..68a6d2e 100644 --- a/src/Data/Tileset.cpp +++ b/src/Format/Tileset.cpp @@ -1,4 +1,4 @@ -#include +#include Tileset::Tileset(): tile_width(0),tile_height(0), tile_spacing(0), diff --git a/src/Utils.cpp b/src/Re2DLevelAPI.cpp similarity index 85% rename from src/Utils.cpp rename to src/Re2DLevelAPI.cpp index 5da5ab0..0603613 100644 --- a/src/Utils.cpp +++ b/src/Re2DLevelAPI.cpp @@ -1,9 +1,9 @@ #include -#include +#include #include -Color4 JsonConversions::parse_color(const JJX::json::value& v) +Color4 JsonConversions::parse_color(const json::value& v) { if (v.type == json::value_type::string) return Color4::FromHex(v.string.value()); @@ -35,12 +35,12 @@ Color4 JsonConversions::parse_color(const JJX::json::value& v) return Colors::Transparent; } -JJX::json::value JsonConversions::deparse_color_to_hex(const Color4& color) +json::value JsonConversions::deparse_color_to_hex(const Color4& color) { - return JJX::json::string(color.ToHexAlpha()); + return json::string(color.ToHexAlpha()); } -std::vector JsonConversions::parse_string_list(const JJX::json::value& v) +std::vector JsonConversions::parse_string_list(const json::value& v) { // TODO: Log an error if the json value is an invalid type. if (v.type == json::value_type::string) @@ -58,11 +58,11 @@ std::vector JsonConversions::parse_string_list(const JJX::json::val return {}; } -JJX::json::value JsonConversions::deparse_string_list(const std::vector& list) +json::value JsonConversions::deparse_string_list(const std::vector& list) { json::array strlist; for (auto& str : list) - strlist.push_back(str); + strlist.push_back(json::string(str)); return strlist; }