[nostalgia/scene] Start Scene package

This commit is contained in:
Gary Talent 2020-06-29 12:13:19 -05:00
parent a199cf113a
commit c7e053668e
4 changed files with 90 additions and 0 deletions

View File

@ -13,6 +13,7 @@ endif()
add_subdirectory(core) add_subdirectory(core)
add_subdirectory(common) add_subdirectory(common)
add_subdirectory(scene)
add_subdirectory(world) add_subdirectory(world)
if(NOSTALGIA_BUILD_PLAYER) if(NOSTALGIA_BUILD_PLAYER)

View File

@ -0,0 +1,21 @@
add_library(
NostalgiaScene
scene.cpp
)
target_link_libraries(
NostalgiaScene PUBLIC
NostalgiaCore
)
install(
FILES
scene.hpp
DESTINATION
include/nostalgia/scene
)
#if(NOSTALGIA_BUILD_STUDIO)
# add_subdirectory(studio)
#endif()

View File

@ -0,0 +1,15 @@
/*
* Copyright 2016 - 2020 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "scene.hpp"
namespace nostalgia::scene {
}

View File

@ -0,0 +1,53 @@
/*
* Copyright 2016 - 2020 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <ox/std/types.hpp>
#include <ox/std/vector.hpp>
namespace nostalgia::scene {
struct TileDoc {
constexpr static auto Fields = 2;
constexpr static auto Preloadable = true;
constexpr static auto TypeName = "net.drinkingtea.nostalgia.scene.Tile";
constexpr static auto TypeVersion = 1;
uint16_t sheetIdx = 0;
uint8_t type = 0;
};
struct SceneDoc {
using TileMapRow = ox::Vector<TileDoc>;
using TileMapLayer = ox::Vector<TileMapRow>;
using TileMap = ox::Vector<TileMapLayer>;
constexpr static auto Fields = 1;
constexpr static auto Preloadable = true;
constexpr static auto TypeName = "net.drinkingtea.nostalgia.scene.Scene";
constexpr static auto TypeVersion = 1;
TileMap tiles;
};
struct SceneInstance {
uint16_t layers = 0;
uint16_t *columns = nullptr;
uint16_t *rows = nullptr;
uint16_t **tileMapIdx = nullptr;
uint8_t **tileType = nullptr;
};
}