Confusing refactor of library (Trust me it'll come out making sense)
This commit is contained in:
@@ -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)
|
||||
|
@@ -2,9 +2,9 @@
|
||||
// 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) {
|
||||
|
@@ -1,18 +1,18 @@
|
||||
#include <ReWindow/types/Window.h>
|
||||
|
||||
#include "ReWindow/Logger.h"
|
||||
#include <Data/Level.hpp>
|
||||
#include <Format/Level.hpp>
|
||||
#include <JGL/JGL.h>
|
||||
#include <JUI/Widgets/FpsGraph.hpp>
|
||||
#include <JUI/Widgets/Scene.hpp>
|
||||
#include <JUI/Widgets/Window.hpp>
|
||||
#include <SimpleAABBSolver.hpp>
|
||||
|
||||
#include "App/EditorCamera.hpp"
|
||||
#include "Editor/EditorCamera.hpp"
|
||||
#include "JUI/Widgets/ListLayout.hpp"
|
||||
#include "JUI/Widgets/Slider.hpp"
|
||||
|
||||
#include <TestGame/TestGameApp.hpp>
|
||||
#include <DemoGame/TestGameApp.hpp>
|
||||
|
||||
template <typename T>
|
||||
struct Range {
|
@@ -1,7 +1,7 @@
|
||||
#include <Data/Tileset.hpp>
|
||||
#include <Data/Level.hpp>
|
||||
#include <Data/Entity.hpp>
|
||||
#include <Data/Layer.hpp>
|
||||
#include <Format/Tileset.hpp>
|
||||
#include <Format/Level.hpp>
|
||||
#include <Format/Entity.hpp>
|
||||
#include <Format/Layer.hpp>
|
||||
|
||||
void CreateSampleLevel()
|
||||
{
|
@@ -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":[
|
||||
|
@@ -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]
|
||||
"id":710.000000,
|
||||
"metadata":null,
|
||||
"name":"Truss1"
|
||||
},
|
||||
{
|
||||
"id":897,
|
||||
"collides":false,
|
||||
"name":"Gate_Right",
|
||||
"quad":[0.000000, 0.000000, 16.000000, 16.000000]
|
||||
"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]
|
||||
"id":777.000000,
|
||||
"metadata":null,
|
||||
"name":"Traffic_Cone"
|
||||
},
|
||||
{
|
||||
"id":710,
|
||||
"collides":false,
|
||||
"name":"Truss1",
|
||||
"quad":[0.000000, 0.000000, 16.000000, 16.000000]
|
||||
"id":798.000000,
|
||||
"metadata":null,
|
||||
"name":"GrassA"
|
||||
},
|
||||
{
|
||||
"id":714,
|
||||
"collides":false,
|
||||
"name":"Truss2",
|
||||
"quad":[0.000000, 0.000000, 16.000000, 16.000000]
|
||||
"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]
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace LevelFormat
|
||||
{
|
||||
|
||||
};
|
@@ -1,5 +0,0 @@
|
||||
#include <Data/Entity.hpp>
|
||||
#include <Data/Layer.hpp>
|
||||
#include <Data/Tileset.hpp>
|
||||
#include <Data/Level.hpp>
|
||||
#include <Data/Tile.hpp>
|
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "Data/Entity.hpp"
|
||||
#include "Format/Entity.hpp"
|
||||
|
||||
|
||||
namespace TestGame {
|
@@ -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"
|
||||
|
@@ -13,11 +13,11 @@
|
||||
#include "NewMapDialog.hpp"
|
||||
#include "JUI/Widgets/ColorPicker.hpp"
|
||||
#include "Preferences.hpp"
|
||||
#include <Data/Level.hpp>
|
||||
#include <Data/Tileset.hpp>
|
||||
#include <Format/Level.hpp>
|
||||
#include <Format/Tileset.hpp>
|
||||
#include <JUI/Widgets/Checkbox.hpp>
|
||||
#include <App/LayerView.hpp>
|
||||
#include <App/TilesetView.hpp>
|
||||
#include <Editor/LayerView.hpp>
|
||||
#include <Editor/TilesetView.hpp>
|
||||
|
||||
#include "JUI/Widgets/FpsGraph.hpp"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
using namespace ReWindow;
|
||||
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 sprites for these?
|
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <J3ML/LinearAlgebra.hpp>
|
||||
#include <Utils.hpp>
|
||||
#include <Re2DLevelAPI.hpp>
|
||||
|
||||
struct EditorCamera {
|
||||
Lerped<Vector2> translation;
|
@@ -6,7 +6,7 @@
|
||||
#include <JUI/Widgets/ListLayout.hpp>
|
||||
#include <JUI/Widgets/Checkbox.hpp>
|
||||
|
||||
#include <Data/Level.hpp>
|
||||
#include <Format/Level.hpp>
|
||||
|
||||
using namespace JUI::UDimLiterals;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include <Data/Tileset.hpp>
|
||||
#include <Format/Tileset.hpp>
|
||||
#include <JUI/Base/Widget.hpp>
|
||||
#include <JUI/Widgets/Window.hpp>
|
||||
#include <JUI/Widgets/Checkbox.hpp>
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <App/Grid.hpp>
|
||||
#include <Editor/Grid.hpp>
|
||||
|
||||
#include "TileMetaDialog.hpp"
|
||||
|
@@ -1,11 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <JJX/JSON.hpp>
|
||||
#include <json.hpp>
|
||||
#include <Color4.hpp>
|
||||
#include <Utils.hpp>
|
||||
|
||||
using namespace JJX;
|
||||
#include <Re2DLevelAPI.hpp>
|
||||
|
||||
enum class EntityRepresentativeShape {
|
||||
Point, AABB, Sphere, OBB
|
5
include/Format/Format.hpp
Normal file
5
include/Format/Format.hpp
Normal 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>
|
@@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <Data/Layer.hpp>
|
||||
#include <JJX/JSON.hpp>
|
||||
#include <Colors.hpp>
|
||||
#include <Utils.hpp>
|
||||
#include <json.hpp>
|
||||
|
||||
#include <Format/Layer.hpp>
|
||||
|
||||
#include <Re2DLevelAPI.hpp>
|
||||
|
||||
using namespace JJX;
|
||||
|
||||
enum class DataFormat
|
||||
{
|
@@ -1,15 +1,12 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <Data/Layer.hpp>
|
||||
#include <Data/Entity.hpp>
|
||||
#include <JJX/JSON.hpp>
|
||||
#include <Colors.hpp>
|
||||
#include <Utils.hpp>
|
||||
#include <Format/Layer.hpp>
|
||||
#include <Format/Entity.hpp>
|
||||
#include <json.hpp>
|
||||
#include <Re2DLevelAPI.hpp>
|
||||
#include <Format/Tileset.hpp>
|
||||
|
||||
#include "Tileset.hpp"
|
||||
|
||||
using namespace JJX;
|
||||
|
||||
const float REDACTED_EDITOR_LIB_VERSION = 1;
|
||||
|
2
include/Format/LevelFormat.hpp
Normal file
2
include/Format/LevelFormat.hpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
|
@@ -1,28 +1,52 @@
|
||||
/// Redacted Software 2D Level Library
|
||||
/// Level File Format Specification
|
||||
///
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <JJX/JSON.hpp>
|
||||
#include <json.hpp>
|
||||
#include <filesystem>
|
||||
#include <format>
|
||||
#include <Utils.hpp>
|
||||
#include <Re2DLevelAPI.hpp>
|
||||
#include <J3ML/Geometry/AABB2D.hpp>
|
||||
|
||||
#include <J3ML/Math.hpp>
|
||||
#include <J3ML/LinearAlgebra.hpp>
|
||||
#include "JGL/types/Texture.h"
|
||||
|
||||
using namespace JJX;
|
||||
|
||||
/// 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;
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <Color4.hpp>
|
||||
#include <J3ML/LinearAlgebra.hpp>
|
||||
#include <JJX/JSON.hpp>
|
||||
#include <json.hpp>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
@@ -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<std::string> parse_string_list(const json::value& v);
|
||||
|
||||
std::vector<std::string> parse_string_list(const JJX::json::value& v);
|
||||
|
||||
JJX::json::value deparse_string_list(const std::vector<std::string>& list);
|
||||
json::value deparse_string_list(const std::vector<std::string>& list);
|
||||
} // namespace JsonConversions
|
||||
|
||||
template <typename T>
|
@@ -1,5 +1,5 @@
|
||||
#include <ReWindow/InputService.h>
|
||||
#include <TestGame/Player.hpp>
|
||||
#include <DemoGame/Player.hpp>
|
||||
#include <JGL/JGL.h>
|
||||
|
||||
TestGame::Player::Player(const Vector2 &spawn_pos): GameEntity(spawn_pos) {
|
@@ -1,4 +1,4 @@
|
||||
#include <TestGame/TestGameApp.hpp>
|
||||
#include <DemoGame/TestGameApp.hpp>
|
||||
|
||||
#include "JUI/Widgets/FpsGraph.hpp"
|
||||
#include <JUI/Widgets/ListLayout.hpp>
|
@@ -1,12 +1,12 @@
|
||||
#include <JUI/Widgets/ImageRect.hpp>
|
||||
|
||||
#include <App/EditorApp.hpp>
|
||||
#include <App/NewMapDialog.hpp>
|
||||
#include <Editor/EditorApp.hpp>
|
||||
#include <Editor/NewMapDialog.hpp>
|
||||
|
||||
#include <Data/Format.hpp>
|
||||
#include <Format/Format.hpp>
|
||||
|
||||
#include "JUI/Widgets/FpsGraph.hpp"
|
||||
#include <App/Grid.hpp>
|
||||
#include <Editor/Grid.hpp>
|
||||
|
||||
|
||||
JUI::Window* EditorApp::CreateAppInfoDialogWindow(JUI::Widget* parent)
|
@@ -1,4 +1,4 @@
|
||||
#include <App/EditorCamera.hpp>
|
||||
#include <Editor/EditorCamera.hpp>
|
||||
|
||||
Matrix4x4 EditorCamera::CurrentTranslationMatrix() const
|
||||
{
|
@@ -1,4 +1,4 @@
|
||||
#include <App/LayerView.hpp>
|
||||
#include <Editor/LayerView.hpp>
|
||||
|
||||
LayerView::LayerView(): JUI::Window() {
|
||||
this->Title("Layers");
|
@@ -1,4 +1,4 @@
|
||||
#include <App/TileMetaDialog.hpp>
|
||||
#include <Editor/TileMetaDialog.hpp>
|
||||
|
||||
|
||||
TileMetaDialog::TileMetaDialog(): JUI::Window() {
|
@@ -1,4 +1,4 @@
|
||||
#include <Data/Entity.hpp>
|
||||
#include <Format/Entity.hpp>
|
||||
|
||||
Entity::Entity():
|
||||
x(0), y(0),
|
@@ -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)
|
||||
{ }
|
@@ -1,4 +1,4 @@
|
||||
#include <Data/Level.hpp>
|
||||
#include <Format/Level.hpp>
|
||||
|
||||
|
||||
Level::Level(): rows(0), cols(0)
|
@@ -1,4 +1,4 @@
|
||||
#include <Data/Tileset.hpp>
|
||||
#include <Format/Tileset.hpp>
|
||||
|
||||
Tileset::Tileset():
|
||||
tile_width(0),tile_height(0), tile_spacing(0),
|
@@ -1,9 +1,9 @@
|
||||
#include <Colors.hpp>
|
||||
#include <Utils.hpp>
|
||||
#include <Re2DLevelAPI.hpp>
|
||||
#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)
|
||||
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<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.
|
||||
if (v.type == json::value_type::string)
|
||||
@@ -58,11 +58,11 @@ std::vector<std::string> JsonConversions::parse_string_list(const JJX::json::val
|
||||
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;
|
||||
for (auto& str : list)
|
||||
strlist.push_back(str);
|
||||
strlist.push_back(json::string(str));
|
||||
|
||||
return strlist;
|
||||
}
|
Reference in New Issue
Block a user