Confusing refactor of library (Trust me it'll come out making sense)

This commit is contained in:
2025-06-30 18:39:36 -05:00
parent edb0f8cf68
commit 7916983d34
45 changed files with 245 additions and 154 deletions

View File

@@ -1,31 +1,37 @@
cmake_minimum_required(VERSION 3.18..3.27) cmake_minimum_required(VERSION 3.18..3.27)
project(Editor2D project(Redacted2DLevelLibrary
VERSION 1.0 VERSION 1.2
LANGUAGES CXX) LANGUAGES CXX)
if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR "In-source builds are not allowed!") message(FATAL_ERROR "In-source builds are not allowed!")
endif() endif()
set(CMAKE_BUILD_PARALLEL_LEVEL 8) set(CMAKE_BUILD_PARALLEL_LEVEL 8)
set(CMAKE_CXX_STANDARD 20) 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") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Enable package managers # Enable package managers
include(cmake/CPM.cmake) include(cmake/CPM.cmake)
file(GLOB_RECURSE EDITOR_HEADERS "include/*.hpp") file(GLOB_RECURSE FORMAT_HEADERS "include/Format/*.hpp")
file(GLOB_RECURSE EDITOR_SRC "src/*.cpp") 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") include_directories("include")
CPMAddPackage(NAME mcolor 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 CPMAddPackage(NAME jlog
URL https://git.redacted.cc/josh/jlog/archive/Prerelease-18.zip) 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) URL https://git.redacted.cc/josh/Event/archive/Release-12.zip)
CPMAddPackage(NAME jjx 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 CPMAddPackage(NAME J3ML
URL https://git.redacted.cc/josh/j3ml/archive/3.4.5.zip) URL https://git.redacted.cc/josh/j3ml/archive/3.4.5.zip)
@@ -50,17 +56,33 @@ CPMAddPackage(NAME JUI
if (UNIX) if (UNIX)
add_library(Editor2D SHARED ${EDITOR_SRC}) add_library(LevelFormat SHARED ${FORMAT_SRC})
add_library(Editor SHARED ${EDITOR_SRC})
endif() endif()
if (WIN32) if (WIN32)
ADD_LIBRARY(Editor2D STATIC ${EDITOR_SRC}) ADD_LIBRARY(LevelFormat STATIC ${EDITOR_SRC})
ADD_LIBRARY(Editor STATIC ${EDITOR_SRC})
endif() 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. # 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 ${Event_SOURCE_DIR}/include
${J3ML_SOURCE_DIR}/include ${J3ML_SOURCE_DIR}/include
${jlog_SOURCE_DIR}/include ${jlog_SOURCE_DIR}/include
@@ -68,24 +90,25 @@ target_include_directories(Editor2D PUBLIC
${ReWindow_SOURCE_DIR}/include ${ReWindow_SOURCE_DIR}/include
${JUI_SOURCE_DIR}/include ${JUI_SOURCE_DIR}/include
${mcolor_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/" file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/assets/"
DESTINATION ${CMAKE_CURRENT_BINARY_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) add_executable(EditorApp apps/editor.cpp app.rc)
target_link_libraries(Editor2DApp PUBLIC Editor2D) target_link_libraries(EditorApp PUBLIC Editor)
add_executable(testgame testgame.cpp) add_executable(DemoGame apps/game.cpp)
target_link_libraries(testgame PUBLIC Editor2D) target_link_libraries(DemoGame PUBLIC LevelFormat)
add_executable(level_format_tests apps/tests.cpp)
add_executable(level_format_tests level_format_tests.cpp) target_link_libraries(level_format_tests PUBLIC LevelFormat)
target_link_libraries(level_format_tests PUBLIC Editor2D)

View File

@@ -2,9 +2,9 @@
// Created by dawsh on 5/12/25. // Created by dawsh on 5/12/25.
// //
#include <App/EditorApp.hpp> #include <Editor/EditorApp.hpp>
#include "cmake-build-debug/_deps/rewindow-src/include/ReWindow/Logger.h" #include "ReWindow/Logger.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {

View File

@@ -1,18 +1,18 @@
#include <ReWindow/types/Window.h> #include <ReWindow/types/Window.h>
#include "ReWindow/Logger.h" #include "ReWindow/Logger.h"
#include <Data/Level.hpp> #include <Format/Level.hpp>
#include <JGL/JGL.h> #include <JGL/JGL.h>
#include <JUI/Widgets/FpsGraph.hpp> #include <JUI/Widgets/FpsGraph.hpp>
#include <JUI/Widgets/Scene.hpp> #include <JUI/Widgets/Scene.hpp>
#include <JUI/Widgets/Window.hpp> #include <JUI/Widgets/Window.hpp>
#include <SimpleAABBSolver.hpp> #include <SimpleAABBSolver.hpp>
#include "App/EditorCamera.hpp" #include "Editor/EditorCamera.hpp"
#include "JUI/Widgets/ListLayout.hpp" #include "JUI/Widgets/ListLayout.hpp"
#include "JUI/Widgets/Slider.hpp" #include "JUI/Widgets/Slider.hpp"
#include <TestGame/TestGameApp.hpp> #include <DemoGame/TestGameApp.hpp>
template <typename T> template <typename T>
struct Range { struct Range {

View File

@@ -1,7 +1,7 @@
#include <Data/Tileset.hpp> #include <Format/Tileset.hpp>
#include <Data/Level.hpp> #include <Format/Level.hpp>
#include <Data/Entity.hpp> #include <Format/Entity.hpp>
#include <Data/Layer.hpp> #include <Format/Layer.hpp>
void CreateSampleLevel() void CreateSampleLevel()
{ {

View File

@@ -5,9 +5,9 @@
"editor-version":1.000000, "editor-version":1.000000,
"entities":[ "entities":[
{ {
"color":"#C5549AA3", "color":"#FF8C00FF",
"flip-h":0.000000, "flip-h":-170504623958157066014014014511678226432.000000,
"flip-v":-0.000000, "flip-v":-171262699299503150847779466975744360448.000000,
"height":16.000000, "height":16.000000,
"metadata":null, "metadata":null,
"name":"Mr Bigg", "name":"Mr Bigg",
@@ -26,7 +26,7 @@
"cell-width":16.000000, "cell-width":16.000000,
"cols":64.000000, "cols":64.000000,
"name":"Colliding Tiles", "name":"Colliding Tiles",
"order":1.000000, "order":0.000000,
"rows":64.000000 "rows":64.000000
}, },
{ {
@@ -40,7 +40,7 @@
} }
], ],
"map-cols":0.000000, "map-cols":0.000000,
"map-rows":-962889206.000000, "map-rows":53.000000,
"map-type":true, "map-type":true,
"name":"Test Level", "name":"Test Level",
"tags":[ "tags":[

View File

@@ -13,58 +13,112 @@
"tile-width":16.000000, "tile-width":16.000000,
"tiles":[ "tiles":[
{ {
"id":896, "collides":false,
"collides": false, "id":710.000000,
"name":"Gate_Left", "metadata":null,
"quad":[0.000000, 0.000000, 16.000000, 16.000000] "name":"Truss1"
}, },
{ {
"id":897, "collides":false,
"collides": false, "id":714.000000,
"name":"Gate_Right", "metadata":null,
"quad":[0.000000, 0.000000, 16.000000, 16.000000] "name":"Truss2"
}, },
{ {
"id":777, "collides":true,
"collides": false, "id":768.000000,
"name":"Traffic_Cone", "metadata":null,
"quad":[0.000000, 0.000000, 16.000000, 16.000000] "name":"Screen1"
}, },
{ {
"id":838, "collides":true,
"collides": false, "id":770.000000,
"name":"SecurityCamera_South", "metadata":null,
"quad":[0.000000, 0.000000, 16.000000, 16.000000] "name":"tile_770"
}, },
{ {
"id":838, "collides":false,
"collides": false, "id":777.000000,
"name":"SecurityCamera_SouthWest", "metadata":null,
"quad":[0.000000, 0.000000, 16.000000, 16.000000] "name":"Traffic_Cone"
}, },
{ {
"id":710, "collides":false,
"collides": false, "id":798.000000,
"name":"Truss1", "metadata":null,
"quad":[0.000000, 0.000000, 16.000000, 16.000000] "name":"GrassA"
}, },
{ {
"id":714, "collides":false,
"collides": false, "id":799.000000,
"name":"Truss2", "metadata":null,
"quad":[0.000000, 0.000000, 16.000000, 16.000000] "name":"GrassB"
}, },
{ {
"id":798, "collides":true,
"collides": false, "id":833.000000,
"name":"GrassA", "metadata":null,
"quad":[0.000000, 0.000000, 16.000000, 16.000000] "name":"tile_833"
}, },
{ {
"id":799, "collides":false,
"collides": false, "id":836.000000,
"name":"GrassB", "metadata":null,
"quad":[0.000000, 0.000000, 16.000000, 16.000000] "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"
} }
] ]
} }

View File

@@ -1,7 +0,0 @@
#pragma once
namespace LevelFormat
{
};

View File

@@ -1,5 +0,0 @@
#include <Data/Entity.hpp>
#include <Data/Layer.hpp>
#include <Data/Tileset.hpp>
#include <Data/Level.hpp>
#include <Data/Tile.hpp>

View File

@@ -1,5 +1,5 @@
#pragma once #pragma once
#include "Data/Entity.hpp" #include "Format/Entity.hpp"
namespace TestGame { namespace TestGame {

View File

@@ -1,7 +1,7 @@
#include "GameEntity.hpp" #include "GameEntity.hpp"
#include "Player.hpp" #include "Player.hpp"
#include "App/EditorCamera.hpp" #include "Editor/EditorCamera.hpp"
#include "Data/Level.hpp" #include "Format/Level.hpp"
#include "JUI/Widgets/Scene.hpp" #include "JUI/Widgets/Scene.hpp"
#include "ReWindow/types/Window.h" #include "ReWindow/types/Window.h"

View File

@@ -13,11 +13,11 @@
#include "NewMapDialog.hpp" #include "NewMapDialog.hpp"
#include "JUI/Widgets/ColorPicker.hpp" #include "JUI/Widgets/ColorPicker.hpp"
#include "Preferences.hpp" #include "Preferences.hpp"
#include <Data/Level.hpp> #include <Format/Level.hpp>
#include <Data/Tileset.hpp> #include <Format/Tileset.hpp>
#include <JUI/Widgets/Checkbox.hpp> #include <JUI/Widgets/Checkbox.hpp>
#include <App/LayerView.hpp> #include <Editor/LayerView.hpp>
#include <App/TilesetView.hpp> #include <Editor/TilesetView.hpp>
#include "JUI/Widgets/FpsGraph.hpp" #include "JUI/Widgets/FpsGraph.hpp"
@@ -27,7 +27,7 @@
using namespace ReWindow; using namespace ReWindow;
using namespace JUI::UDimLiterals; using namespace JUI::UDimLiterals;
#include <App/EditorCamera.hpp> #include <Editor/EditorCamera.hpp>
// TODO: Support loading an entity_prefab.json file which defines template entities to copy. // TODO: Support loading an entity_prefab.json file which defines template entities to copy.
// TODO: Support sprites for these? // TODO: Support sprites for these?

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <J3ML/LinearAlgebra.hpp> #include <J3ML/LinearAlgebra.hpp>
#include <Utils.hpp> #include <Re2DLevelAPI.hpp>
struct EditorCamera { struct EditorCamera {
Lerped<Vector2> translation; Lerped<Vector2> translation;

View File

@@ -6,7 +6,7 @@
#include <JUI/Widgets/ListLayout.hpp> #include <JUI/Widgets/ListLayout.hpp>
#include <JUI/Widgets/Checkbox.hpp> #include <JUI/Widgets/Checkbox.hpp>
#include <Data/Level.hpp> #include <Format/Level.hpp>
using namespace JUI::UDimLiterals; using namespace JUI::UDimLiterals;

View File

@@ -1,5 +1,5 @@
#pragma once #pragma once
#include <Data/Tileset.hpp> #include <Format/Tileset.hpp>
#include <JUI/Base/Widget.hpp> #include <JUI/Base/Widget.hpp>
#include <JUI/Widgets/Window.hpp> #include <JUI/Widgets/Window.hpp>
#include <JUI/Widgets/Checkbox.hpp> #include <JUI/Widgets/Checkbox.hpp>

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include <App/Grid.hpp> #include <Editor/Grid.hpp>
#include "TileMetaDialog.hpp" #include "TileMetaDialog.hpp"

View File

@@ -1,11 +1,9 @@
#pragma once #pragma once
#include <string> #include <string>
#include <JJX/JSON.hpp> #include <json.hpp>
#include <Color4.hpp> #include <Color4.hpp>
#include <Utils.hpp> #include <Re2DLevelAPI.hpp>
using namespace JJX;
enum class EntityRepresentativeShape { enum class EntityRepresentativeShape {
Point, AABB, Sphere, OBB Point, AABB, Sphere, OBB

View File

@@ -0,0 +1,5 @@
#include <Format/Entity.hpp>
#include <Format/Layer.hpp>
#include <Format/Tileset.hpp>
#include <Format/Level.hpp>
#include <Format/Tile.hpp>

View File

@@ -1,12 +1,12 @@
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include <Data/Layer.hpp> #include <json.hpp>
#include <JJX/JSON.hpp>
#include <Colors.hpp> #include <Format/Layer.hpp>
#include <Utils.hpp>
#include <Re2DLevelAPI.hpp>
using namespace JJX;
enum class DataFormat enum class DataFormat
{ {

View File

@@ -1,15 +1,12 @@
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include <Data/Layer.hpp> #include <Format/Layer.hpp>
#include <Data/Entity.hpp> #include <Format/Entity.hpp>
#include <JJX/JSON.hpp> #include <json.hpp>
#include <Colors.hpp> #include <Re2DLevelAPI.hpp>
#include <Utils.hpp> #include <Format/Tileset.hpp>
#include "Tileset.hpp"
using namespace JJX;
const float REDACTED_EDITOR_LIB_VERSION = 1; const float REDACTED_EDITOR_LIB_VERSION = 1;

View File

@@ -0,0 +1,2 @@
#pragma once

View File

@@ -1,28 +1,52 @@
/// Redacted Software 2D Level Library
/// Level File Format Specification
///
#pragma once #pragma once
#include <vector> #include <vector>
#include <JJX/JSON.hpp> #include <json.hpp>
#include <filesystem> #include <filesystem>
#include <format> #include <format>
#include <Utils.hpp> #include <Re2DLevelAPI.hpp>
#include <J3ML/Geometry/AABB2D.hpp>
/// 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 <J3ML/Math.hpp>
#include <J3ML/LinearAlgebra.hpp>
#include "JGL/types/Texture.h"
using namespace JJX;
struct Quad {
int x;
int y;
int w;
int h;
};
struct Tile struct Tile
{ {
int id; int id;
std::string name; 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; Quad quad;
json::value metadata; json::value metadata;
bool collides; bool collides;
@@ -30,8 +54,6 @@ struct Tile
bool persistent = false; 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 /// @class Tileset
/// @brief Represents a collection of tiles, typically from a single texture atlas, used in a level. /// @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, /// 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 /// spacing, and how they are arranged within a source texture. It also provides metadata
/// about the tileset itself, such as its name and author. /// 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 { class Tileset {
public: public:
#pragma region json fields #pragma region json fields

View File

@@ -2,7 +2,7 @@
#include <Color4.hpp> #include <Color4.hpp>
#include <J3ML/LinearAlgebra.hpp> #include <J3ML/LinearAlgebra.hpp>
#include <JJX/JSON.hpp> #include <json.hpp>
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
@@ -11,6 +11,7 @@
#pragma once #pragma once
inline int CellToIndex(Vector2i cell, int width) inline int CellToIndex(Vector2i cell, int width)
{ {
return cell.y*width + cell.x; return cell.y*width + cell.x;
@@ -18,14 +19,12 @@ inline int CellToIndex(Vector2i cell, int width)
namespace JsonConversions namespace JsonConversions
{ {
using namespace JJX; Color4 parse_color(const json::value& v);
Color4 parse_color(const JJX::json::value& v); json::value deparse_color_to_hex(const Color4& color);
JJX::json::value deparse_color_to_hex(const Color4& color); std::vector<std::string> parse_string_list(const json::value& v);
std::vector<std::string> parse_string_list(const JJX::json::value& v); json::value deparse_string_list(const std::vector<std::string>& list);
JJX::json::value deparse_string_list(const std::vector<std::string>& list);
} // namespace JsonConversions } // namespace JsonConversions
template <typename T> template <typename T>

View File

@@ -1,5 +1,5 @@
#include <ReWindow/InputService.h> #include <ReWindow/InputService.h>
#include <TestGame/Player.hpp> #include <DemoGame/Player.hpp>
#include <JGL/JGL.h> #include <JGL/JGL.h>
TestGame::Player::Player(const Vector2 &spawn_pos): GameEntity(spawn_pos) { TestGame::Player::Player(const Vector2 &spawn_pos): GameEntity(spawn_pos) {

View File

@@ -1,4 +1,4 @@
#include <TestGame/TestGameApp.hpp> #include <DemoGame/TestGameApp.hpp>
#include "JUI/Widgets/FpsGraph.hpp" #include "JUI/Widgets/FpsGraph.hpp"
#include <JUI/Widgets/ListLayout.hpp> #include <JUI/Widgets/ListLayout.hpp>

View File

@@ -1,12 +1,12 @@
#include <JUI/Widgets/ImageRect.hpp> #include <JUI/Widgets/ImageRect.hpp>
#include <App/EditorApp.hpp> #include <Editor/EditorApp.hpp>
#include <App/NewMapDialog.hpp> #include <Editor/NewMapDialog.hpp>
#include <Data/Format.hpp> #include <Format/Format.hpp>
#include "JUI/Widgets/FpsGraph.hpp" #include "JUI/Widgets/FpsGraph.hpp"
#include <App/Grid.hpp> #include <Editor/Grid.hpp>
JUI::Window* EditorApp::CreateAppInfoDialogWindow(JUI::Widget* parent) JUI::Window* EditorApp::CreateAppInfoDialogWindow(JUI::Widget* parent)

View File

@@ -1,4 +1,4 @@
#include <App/EditorCamera.hpp> #include <Editor/EditorCamera.hpp>
Matrix4x4 EditorCamera::CurrentTranslationMatrix() const Matrix4x4 EditorCamera::CurrentTranslationMatrix() const
{ {

View File

@@ -1,4 +1,4 @@
#include <App/LayerView.hpp> #include <Editor/LayerView.hpp>
LayerView::LayerView(): JUI::Window() { LayerView::LayerView(): JUI::Window() {
this->Title("Layers"); this->Title("Layers");

View File

@@ -1,4 +1,4 @@
#include <App/TileMetaDialog.hpp> #include <Editor/TileMetaDialog.hpp>
TileMetaDialog::TileMetaDialog(): JUI::Window() { TileMetaDialog::TileMetaDialog(): JUI::Window() {

View File

@@ -1,4 +1,4 @@
#include <Data/Entity.hpp> #include <Format/Entity.hpp>
Entity::Entity(): Entity::Entity():
x(0), y(0), x(0), y(0),

View File

@@ -1,4 +1,4 @@
#include <Data/Layer.hpp> #include <Format/Layer.hpp>
Layer::Layer(): rows(0), cols(0), cell_width(0), cell_height(0), parallax_x(0), parallax_y(0), cells(nullptr), visible(true), order(0) Layer::Layer(): rows(0), cols(0), cell_width(0), cell_height(0), parallax_x(0), parallax_y(0), cells(nullptr), visible(true), order(0)
{ } { }

View File

@@ -1,4 +1,4 @@
#include <Data/Level.hpp> #include <Format/Level.hpp>
Level::Level(): rows(0), cols(0) Level::Level(): rows(0), cols(0)

View File

@@ -1,4 +1,4 @@
#include <Data/Tileset.hpp> #include <Format/Tileset.hpp>
Tileset::Tileset(): Tileset::Tileset():
tile_width(0),tile_height(0), tile_spacing(0), tile_width(0),tile_height(0), tile_spacing(0),

View File

@@ -1,9 +1,9 @@
#include <Colors.hpp> #include <Colors.hpp>
#include <Utils.hpp> #include <Re2DLevelAPI.hpp>
#include <fstream> #include <fstream>
Color4 JsonConversions::parse_color(const JJX::json::value& v) Color4 JsonConversions::parse_color(const json::value& v)
{ {
if (v.type == json::value_type::string) if (v.type == json::value_type::string)
return Color4::FromHex(v.string.value()); return Color4::FromHex(v.string.value());
@@ -35,12 +35,12 @@ Color4 JsonConversions::parse_color(const JJX::json::value& v)
return Colors::Transparent; 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<std::string> JsonConversions::parse_string_list(const JJX::json::value& v) std::vector<std::string> JsonConversions::parse_string_list(const json::value& v)
{ {
// TODO: Log an error if the json value is an invalid type. // TODO: Log an error if the json value is an invalid type.
if (v.type == json::value_type::string) if (v.type == json::value_type::string)
@@ -58,11 +58,11 @@ std::vector<std::string> JsonConversions::parse_string_list(const JJX::json::val
return {}; return {};
} }
JJX::json::value JsonConversions::deparse_string_list(const std::vector<std::string>& list) json::value JsonConversions::deparse_string_list(const std::vector<std::string>& list)
{ {
json::array strlist; json::array strlist;
for (auto& str : list) for (auto& str : list)
strlist.push_back(str); strlist.push_back(json::string(str));
return strlist; return strlist;
} }