This commit is contained in:
MihailRis 2024-05-06 03:15:27 +03:00
parent 91aacafecb
commit f27a418dbe
81 changed files with 310 additions and 302 deletions

View File

@ -1,4 +1,4 @@
#include "Assets.h"
#include "Assets.hpp"
#include "../audio/audio.hpp"
#include "../graphics/core/Texture.hpp"
@ -12,76 +12,76 @@ Assets::~Assets() {
}
Texture* Assets::getTexture(std::string name) const {
auto found = textures.find(name);
if (found == textures.end())
return nullptr;
return found->second.get();
auto found = textures.find(name);
if (found == textures.end())
return nullptr;
return found->second.get();
}
void Assets::store(Texture* texture, std::string name){
textures.emplace(name, texture);
textures.emplace(name, texture);
}
Shader* Assets::getShader(std::string name) const{
auto found = shaders.find(name);
if (found == shaders.end())
return nullptr;
return found->second.get();
auto found = shaders.find(name);
if (found == shaders.end())
return nullptr;
return found->second.get();
}
void Assets::store(Shader* shader, std::string name){
shaders.emplace(name, shader);
shaders.emplace(name, shader);
}
Font* Assets::getFont(std::string name) const {
auto found = fonts.find(name);
if (found == fonts.end())
return nullptr;
return found->second.get();
auto found = fonts.find(name);
if (found == fonts.end())
return nullptr;
return found->second.get();
}
void Assets::store(Font* font, std::string name){
fonts.emplace(name, font);
fonts.emplace(name, font);
}
Atlas* Assets::getAtlas(std::string name) const {
auto found = atlases.find(name);
if (found == atlases.end())
return nullptr;
return found->second.get();
auto found = atlases.find(name);
if (found == atlases.end())
return nullptr;
return found->second.get();
}
void Assets::store(Atlas* atlas, std::string name){
atlases.emplace(name, atlas);
atlases.emplace(name, atlas);
}
audio::Sound* Assets::getSound(std::string name) const {
auto found = sounds.find(name);
if (found == sounds.end())
return nullptr;
return found->second.get();
auto found = sounds.find(name);
if (found == sounds.end())
return nullptr;
return found->second.get();
}
void Assets::store(audio::Sound* sound, std::string name) {
sounds.emplace(name, sound);
sounds.emplace(name, sound);
}
const std::vector<TextureAnimation>& Assets::getAnimations() {
return animations;
return animations;
}
void Assets::store(const TextureAnimation& animation) {
animations.emplace_back(animation);
animations.emplace_back(animation);
}
UiDocument* Assets::getLayout(std::string name) const {
auto found = layouts.find(name);
if (found == layouts.end())
return nullptr;
return found->second.get();
auto found = layouts.find(name);
if (found == layouts.end())
return nullptr;
return found->second.get();
}
void Assets::store(UiDocument* layout, std::string name) {
layouts[name] = std::shared_ptr<UiDocument>(layout);
layouts[name] = std::shared_ptr<UiDocument>(layout);
}

View File

@ -1,63 +0,0 @@
#ifndef ASSETS_ASSETS_H_
#define ASSETS_ASSETS_H_
#include "../graphics/core/TextureAnimation.hpp"
#include <string>
#include <memory>
#include <functional>
#include <unordered_map>
#include <vector>
class Texture;
class Shader;
class Font;
class Atlas;
class Assets;
class UiDocument;
namespace audio {
class Sound;
}
namespace assetload {
/// @brief final work to do in the main thread
using postfunc = std::function<void(Assets*)>;
}
class Assets {
std::unordered_map<std::string, std::shared_ptr<Texture>> textures;
std::unordered_map<std::string, std::shared_ptr<Shader>> shaders;
std::unordered_map<std::string, std::shared_ptr<Font>> fonts;
std::unordered_map<std::string, std::shared_ptr<Atlas>> atlases;
std::unordered_map<std::string, std::shared_ptr<UiDocument>> layouts;
std::unordered_map<std::string, std::shared_ptr<audio::Sound>> sounds;
std::vector<TextureAnimation> animations;
public:
Assets() {}
Assets(const Assets&) = delete;
~Assets();
Texture* getTexture(std::string name) const;
void store(Texture* texture, std::string name);
Shader* getShader(std::string name) const;
void store(Shader* shader, std::string name);
Font* getFont(std::string name) const;
void store(Font* font, std::string name);
Atlas* getAtlas(std::string name) const;
void store(Atlas* atlas, std::string name);
audio::Sound* getSound(std::string name) const;
void store(audio::Sound* sound, std::string name);
const std::vector<TextureAnimation>& getAnimations();
void store(const TextureAnimation& animation);
UiDocument* getLayout(std::string name) const;
void store(UiDocument* layout, std::string name);
};
#endif /* ASSETS_ASSETS_H_ */

63
src/assets/Assets.hpp Normal file
View File

@ -0,0 +1,63 @@
#ifndef ASSETS_ASSETS_HPP_
#define ASSETS_ASSETS_HPP_
#include "../graphics/core/TextureAnimation.hpp"
#include <string>
#include <memory>
#include <functional>
#include <unordered_map>
#include <vector>
class Texture;
class Shader;
class Font;
class Atlas;
class Assets;
class UiDocument;
namespace audio {
class Sound;
}
namespace assetload {
/// @brief final work to do in the main thread
using postfunc = std::function<void(Assets*)>;
}
class Assets {
std::unordered_map<std::string, std::shared_ptr<Texture>> textures;
std::unordered_map<std::string, std::shared_ptr<Shader>> shaders;
std::unordered_map<std::string, std::shared_ptr<Font>> fonts;
std::unordered_map<std::string, std::shared_ptr<Atlas>> atlases;
std::unordered_map<std::string, std::shared_ptr<UiDocument>> layouts;
std::unordered_map<std::string, std::shared_ptr<audio::Sound>> sounds;
std::vector<TextureAnimation> animations;
public:
Assets() {}
Assets(const Assets&) = delete;
~Assets();
Texture* getTexture(std::string name) const;
void store(Texture* texture, std::string name);
Shader* getShader(std::string name) const;
void store(Shader* shader, std::string name);
Font* getFont(std::string name) const;
void store(Font* font, std::string name);
Atlas* getAtlas(std::string name) const;
void store(Atlas* atlas, std::string name);
audio::Sound* getSound(std::string name) const;
void store(audio::Sound* sound, std::string name);
const std::vector<TextureAnimation>& getAnimations();
void store(const TextureAnimation& animation);
UiDocument* getLayout(std::string name) const;
void store(UiDocument* layout, std::string name);
};
#endif // ASSETS_ASSETS_HPP_

View File

@ -1,6 +1,6 @@
#include "AssetsLoader.hpp"
#include "Assets.h"
#include "Assets.hpp"
#include "assetload_funcs.hpp"
#include "../util/ThreadPool.hpp"
#include "../constants.h"

View File

@ -1,7 +1,7 @@
#ifndef ASSETS_ASSETS_LOADER_HPP_
#define ASSETS_ASSETS_LOADER_HPP_
#include "Assets.h"
#include "Assets.hpp"
#include "../interfaces/Task.hpp"
#include "../typedefs.h"
#include "../delegates.h"

View File

@ -1,6 +1,6 @@
#include "assetload_funcs.hpp"
#include "Assets.h"
#include "Assets.hpp"
#include "AssetsLoader.hpp"
#include "../audio/audio.hpp"
#include "../files/files.h"

View File

@ -1,7 +1,7 @@
#ifndef ASSETS_ASSET_LOADERS_HPP_
#define ASSETS_ASSET_LOADERS_HPP_
#include "Assets.h"
#include "Assets.hpp"
#include <string>
#include <memory>

View File

@ -1,6 +1,6 @@
#include "GLSLExtension.hpp"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
#include "../typedefs.h"
#include "../files/files.h"
#include "../files/engine_paths.h"

View File

@ -1,10 +1,10 @@
#include "binary_json.h"
#include "binary_json.hpp"
#include "gzip.hpp"
#include "byte_utils.hpp"
#include <stdexcept>
#include "gzip.h"
#include "byte_utils.h"
using namespace json;
using namespace dynamic;

View File

@ -1,5 +1,5 @@
#ifndef CODERS_BINARY_JSON_H_
#define CODERS_BINARY_JSON_H_
#ifndef CODERS_BINARY_JSON_HPP_
#define CODERS_BINARY_JSON_HPP_
#include <vector>
#include <memory>
@ -25,4 +25,4 @@ namespace json {
extern std::unique_ptr<dynamic::Map> from_binary(const ubyte* src, size_t size);
}
#endif // CODERS_BINARY_JSON_H_
#endif // CODERS_BINARY_JSON_HPP_

View File

@ -1,4 +1,4 @@
#include "byte_utils.h"
#include "byte_utils.hpp"
#include <cstring>
#include <limits>

View File

@ -1,9 +1,10 @@
#ifndef CODERS_BYTE_UTILS_H_
#define CODERS_BYTE_UTILS_H_
#ifndef CODERS_BYTE_UTILS_HPP_
#define CODERS_BYTE_UTILS_HPP_
#include "../typedefs.h"
#include <string>
#include <vector>
#include "../typedefs.h"
/* byteorder: little-endian */
class ByteBuilder {
@ -44,7 +45,7 @@ public:
std::vector<ubyte> build();
};
/* byteorder: little-endian */
/// byteorder: little-endian
class ByteReader {
const ubyte* data;
size_t size;
@ -54,26 +55,29 @@ public:
ByteReader(const ubyte* data);
void checkMagic(const char* data, size_t size);
/* Read one byte (unsigned 8 bit integer) */
/// @brief Read one byte (unsigned 8 bit integer)
ubyte get();
/* Read one byte (unsigned 8 bit integer) without pointer move */
/// @brief Read one byte (unsigned 8 bit integer) without pointer move
ubyte peek();
/* Read signed 16 bit integer */
/// @brief Read signed 16 bit integer
int16_t getInt16();
/* Read signed 32 bit integer */
/// @brief Read signed 32 bit integer
int32_t getInt32();
/* Read signed 64 bit integer */
/// @brief Read signed 64 bit integer
int64_t getInt64();
/* Read 32 bit floating-point number */
/// @brief Read 32 bit floating-point number
float getFloat32();
/* Read 64 bit floating-point number */
/// @brief Read 64 bit floating-point number
double getFloat64();
/// @brief Read C-String
const char* getCString();
/// @brief Read string with unsigned 32 bit number before (length)
std::string getString();
/// @return true if there is at least one byte remains
bool hasNext() const;
const ubyte* pointer() const;
void skip(size_t n);
};
#endif // CODERS_BYTE_UTILS_H_
#endif // CODERS_BYTE_UTILS_HPP_

View File

@ -1,6 +1,6 @@
#include "commons.h"
#include "commons.hpp"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
#include <sstream>
#include <stdexcept>

View File

@ -1,10 +1,11 @@
#include "gzip.h"
#include "gzip.hpp"
#include "byte_utils.hpp"
#define ZLIB_CONST
#include <zlib.h>
#include <math.h>
#include <memory>
#include "byte_utils.h"
std::vector<ubyte> gzip::compress(const ubyte* src, size_t size) {
size_t buffer_size = 23+size*1.01;

View File

@ -1,8 +1,8 @@
#ifndef CODERS_GZIP_H_
#define CODERS_GZIP_H_
#ifndef CODERS_GZIP_HPP_
#define CODERS_GZIP_HPP_
#include <vector>
#include "../typedefs.h"
#include <vector>
namespace gzip {
const unsigned char MAGIC[] = "\x1F\x8B";
@ -18,4 +18,4 @@ namespace gzip {
std::vector<ubyte> decompress(const ubyte* src, size_t size);
}
#endif // CODERS_GZIP_H_
#endif // CODERS_GZIP_HPP_

View File

@ -5,9 +5,8 @@
#include <iomanip>
#include <memory>
#include "commons.h"
#include "../data/dynamic.h"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
using namespace json;
using namespace dynamic;

View File

@ -1,17 +1,17 @@
#ifndef CODERS_JSON_H_
#define CODERS_JSON_H_
#include "commons.hpp"
#include "binary_json.hpp"
#include "../typedefs.h"
#include <vector>
#include <string>
#include <stdint.h>
#include <stdexcept>
#include <unordered_map>
#include "commons.h"
#include "../typedefs.h"
#include "binary_json.h"
namespace dynamic {
class Map;
class List;

View File

@ -1,8 +1,9 @@
#include "toml.hpp"
#include "commons.h"
#include "commons.hpp"
#include "../data/setting.hpp"
#include "../data/dynamic.h"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
#include "../files/settings_io.hpp"
#include <math.h>

View File

@ -1,11 +1,9 @@
#ifndef CODERS_TOML_HPP_
#define CODERS_TOML_HPP_
#include <string>
#include <vector>
#include <unordered_map>
#include "commons.hpp"
#include "commons.h"
#include <string>
class SettingsHandler;

View File

@ -1,6 +1,6 @@
#include "xml.hpp"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
#include <charconv>
#include <stdexcept>

View File

@ -1,14 +1,14 @@
#ifndef CODERS_XML_HPP_
#define CODERS_XML_HPP_
#include "commons.hpp"
#include <string>
#include <memory>
#include <vector>
#include <glm/glm.hpp>
#include <unordered_map>
#include "commons.h"
namespace xml {
class Node;
class Attribute;

View File

@ -1,5 +1,5 @@
#ifndef SRC_CONSTANTS_H_
#define SRC_CONSTANTS_H_
#ifndef CONSTANTS_H_
#define CONSTANTS_H_
#include <limits>
#include <string>
@ -26,15 +26,17 @@ inline constexpr int CHUNK_D = 16;
inline constexpr uint VOXEL_USER_BITS = 8;
inline constexpr uint VOXEL_USER_BITS_OFFSET = sizeof(blockstate_t)*8-VOXEL_USER_BITS;
/// @brief pixel size of an item inventory icon
inline constexpr int ITEM_ICON_SIZE = 48;
/* Chunk volume (count of voxels per Chunk) */
/// @brief chunk volume (count of voxels per Chunk)
inline constexpr int CHUNK_VOL = (CHUNK_W * CHUNK_H * CHUNK_D);
/* BLOCK_VOID is block id used to mark non-existing voxel (voxel of missing chunk) */
/// @brief block id used to mark non-existing voxel (voxel of missing chunk)
inline constexpr blockid_t BLOCK_VOID = std::numeric_limits<blockid_t>::max();
/// @brief item id used to mark non-existing item (error)
inline constexpr itemid_t ITEM_VOID = std::numeric_limits<itemid_t>::max();
/// @brief max number of block definitions possible
inline constexpr blockid_t MAX_BLOCKS = BLOCK_VOID;
inline constexpr uint vox_index(uint x, uint y, uint z, uint w=CHUNK_W, uint d=CHUNK_D) {
@ -47,4 +49,4 @@ inline const std::string FONTS_FOLDER = "fonts";
inline const std::string LAYOUTS_FOLDER = "layouts";
inline const std::string SOUNDS_FOLDER = "sounds";
#endif // SRC_CONSTANTS_H_
#endif // CONSTANTS_H_

View File

@ -1,6 +1,4 @@
#include "ContentLUT.h"
#include <memory>
#include "ContentLUT.hpp"
#include "Content.h"
#include "../constants.h"
@ -8,9 +6,10 @@
#include "../coders/json.h"
#include "../voxels/Block.h"
#include "../items/ItemDef.h"
#include "../data/dynamic.h"
#include <memory>
ContentLUT::ContentLUT(const Content* content, size_t blocksCount, size_t itemsCount) {
auto* indices = content->getIndices();
for (size_t i = 0; i < blocksCount; i++) {

View File

@ -1,14 +1,14 @@
#ifndef CONTENT_CONTENT_LUT_H_
#define CONTENT_CONTENT_LUT_H_
#ifndef CONTENT_CONTENT_LUT_HPP_
#define CONTENT_CONTENT_LUT_HPP_
#include <string>
#include <vector>
#include <filesystem>
#include "Content.h"
#include "../typedefs.h"
#include "../constants.h"
#include "Content.h"
#include <string>
#include <vector>
#include <filesystem>
namespace fs = std::filesystem;
@ -93,4 +93,4 @@ public:
std::vector<contententry> getMissingContent() const;
};
#endif // CONTENT_CONTENT_LUT_H_
#endif // CONTENT_CONTENT_LUT_HPP_

View File

@ -1,25 +1,24 @@
#include "ContentLoader.h"
#include "Content.h"
#include "ContentPack.h"
#include "../coders/json.h"
#include "../core_defs.hpp"
#include "../data/dynamic.h"
#include "../debug/Logger.hpp"
#include "../files/files.h"
#include "../items/ItemDef.h"
#include "../logic/scripting/scripting.h"
#include "../typedefs.h"
#include "../util/listutil.hpp"
#include "../voxels/Block.h"
#include <iostream>
#include <string>
#include <memory>
#include <algorithm>
#include <glm/glm.hpp>
#include "Content.h"
#include "../debug/Logger.hpp"
#include "../items/ItemDef.h"
#include "../util/listutil.h"
#include "../voxels/Block.h"
#include "../files/files.h"
#include "../coders/json.h"
#include "../typedefs.h"
#include "../core_defs.h"
#include "../data/dynamic.h"
#include "ContentPack.h"
#include "../logic/scripting/scripting.h"
namespace fs = std::filesystem;
static debug::Logger logger("content-loader");

View File

@ -1,6 +1,6 @@
#include "PacksManager.hpp"
#include "../util/listutil.h"
#include "../util/listutil.hpp"
#include <queue>
#include <sstream>

View File

@ -1,4 +1,4 @@
#include "core_defs.h"
#include "core_defs.hpp"
#include "items/ItemDef.h"
#include "content/Content.h"

View File

@ -1,5 +1,5 @@
#ifndef CORE_DEFS_H_
#define CORE_DEFS_H_
#ifndef CORE_DEFS_HPP_
#define CORE_DEFS_HPP_
#include <string>
@ -8,7 +8,7 @@ inline const std::string CORE_AIR = "core:air";
inline const std::string TEXTURE_NOTFOUND = "notfound";
// bindings used in engine code
// built-in bindings
inline const std::string BIND_MOVE_FORWARD = "movement.forward";
inline const std::string BIND_MOVE_BACK = "movement.back";
inline const std::string BIND_MOVE_LEFT = "movement.left";
@ -33,4 +33,4 @@ namespace corecontent {
void setup(ContentBuilder* builder);
}
#endif // CORE_DEFS_H_
#endif // CORE_DEFS_HPP_

View File

@ -1,6 +1,6 @@
#include "setting.hpp"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
std::string NumberSetting::toString() const {
switch (getFormat()) {

View File

@ -10,7 +10,7 @@
#include "coders/json.h"
#include "coders/toml.hpp"
#include "content/ContentLoader.h"
#include "core_defs.h"
#include "core_defs.hpp"
#include "files/files.h"
#include "files/settings_io.hpp"
#include "frontend/locale.hpp"
@ -24,8 +24,8 @@
#include "graphics/ui/GUI.hpp"
#include "logic/EngineController.hpp"
#include "logic/scripting/scripting.h"
#include "util/listutil.h"
#include "util/platform.h"
#include "util/listutil.hpp"
#include "util/platform.hpp"
#include "voxels/DefaultWorldGenerator.h"
#include "voxels/FlatWorldGenerator.h"
#include "window/Camera.hpp"

View File

@ -5,7 +5,7 @@
#include "settings.h"
#include "typedefs.h"
#include "assets/Assets.h"
#include "assets/Assets.hpp"
#include "content/Content.h"
#include "content/ContentPack.h"
#include "content/PacksManager.hpp"

View File

@ -1,17 +1,18 @@
#include "WorldConverter.h"
#include "WorldFiles.h"
#include "../content/ContentLUT.hpp"
#include "../data/dynamic.h"
#include "../debug/Logger.hpp"
#include "../files/files.h"
#include "../objects/Player.h"
#include "../util/ThreadPool.hpp"
#include "../voxels/Chunk.h"
#include <memory>
#include <iostream>
#include <stdexcept>
#include "WorldFiles.h"
#include "../data/dynamic.h"
#include "../files/files.h"
#include "../voxels/Chunk.h"
#include "../content/ContentLUT.h"
#include "../objects/Player.h"
#include "../debug/Logger.hpp"
#include "../util/ThreadPool.hpp"
namespace fs = std::filesystem;

View File

@ -1,10 +1,10 @@
#include "WorldFiles.h"
#include "../coders/byte_utils.h"
#include "../coders/byte_utils.hpp"
#include "../coders/json.h"
#include "../constants.h"
#include "../content/Content.h"
#include "../core_defs.h"
#include "../core_defs.hpp"
#include "../data/dynamic.h"
#include "../items/Inventory.h"
#include "../items/ItemDef.h"
@ -13,7 +13,7 @@
#include "../objects/Player.h"
#include "../physics/Hitbox.h"
#include "../typedefs.h"
#include "../util/data_io.h"
#include "../util/data_io.hpp"
#include "../voxels/Block.h"
#include "../voxels/Chunk.h"
#include "../voxels/voxel.h"

View File

@ -1,8 +1,8 @@
#include "WorldRegions.hpp"
#include "../coders/rle.hpp"
#include "../util/data_io.h"
#include "../coders/byte_utils.h"
#include "../util/data_io.hpp"
#include "../coders/byte_utils.hpp"
#include "../maths/voxmaths.h"
#include "../items/Inventory.h"

View File

@ -5,7 +5,7 @@
#include <filesystem>
#include <algorithm>
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
#include "../typedefs.h"
#include "WorldFiles.h"

View File

@ -1,14 +1,15 @@
#include "files.h"
#include "../coders/json.h"
#include "../coders/gzip.hpp"
#include "../util/stringutil.hpp"
#include "../data/dynamic.h"
#include <fstream>
#include <iostream>
#include <memory>
#include <stdint.h>
#include <stdexcept>
#include "../coders/json.h"
#include "../coders/gzip.h"
#include "../util/stringutil.h"
#include "../data/dynamic.h"
namespace fs = std::filesystem;

View File

@ -2,10 +2,10 @@
#include "UiDocument.hpp"
#include "../assets/Assets.h"
#include "../assets/Assets.hpp"
#include "../content/Content.h"
#include "../content/ContentPack.h"
#include "../core_defs.h"
#include "../core_defs.hpp"
#include "../graphics/core/Atlas.hpp"
#include "../maths/UVRegion.hpp"
#include "../voxels/Block.h"

View File

@ -2,7 +2,7 @@
#include "ContentGfxCache.hpp"
#include "../assets/Assets.h"
#include "../assets/Assets.hpp"
#include "../audio/audio.hpp"
#include "../content/Content.h"
#include "../graphics/core/Atlas.hpp"

View File

@ -9,7 +9,7 @@
#include "../graphics/render/WorldRenderer.hpp"
#include "../objects/Player.h"
#include "../physics/Hitbox.h"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
#include "../voxels/Block.h"
#include "../voxels/Chunk.h"
#include "../voxels/Chunks.h"

View File

@ -4,9 +4,9 @@
#include "LevelFrontend.hpp"
#include "UiDocument.hpp"
#include "../assets/Assets.h"
#include "../assets/Assets.hpp"
#include "../content/Content.h"
#include "../core_defs.h"
#include "../core_defs.hpp"
#include "../delegates.h"
#include "../engine.h"
#include "../graphics/core/Atlas.hpp"
@ -33,7 +33,7 @@
#include "../objects/Player.h"
#include "../physics/Hitbox.h"
#include "../typedefs.h"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
#include "../voxels/Block.h"
#include "../voxels/Chunk.h"
#include "../voxels/Chunks.h"

View File

@ -1,10 +1,10 @@
#include "locale.hpp"
#include "../coders/json.h"
#include "../coders/commons.h"
#include "../coders/commons.hpp"
#include "../content/ContentPack.h"
#include "../files/files.h"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
#include "../data/dynamic.h"
#include "../debug/Logger.hpp"

View File

@ -13,8 +13,8 @@
#include "../graphics/ui/GUI.hpp"
#include "../logic/scripting/scripting.h"
#include "../settings.h"
#include "../coders/commons.h"
#include "../util/stringutil.h"
#include "../coders/commons.hpp"
#include "../util/stringutil.hpp"
#include "../window/Window.hpp"
#include <filesystem>

View File

@ -1,6 +1,6 @@
#include "BlocksPreview.hpp"
#include "../../assets/Assets.h"
#include "../../assets/Assets.hpp"
#include "../../constants.h"
#include "../../content/Content.h"
#include "../../frontend/ContentGfxCache.hpp"

View File

@ -1,5 +1,5 @@
#include "Skybox.hpp"
#include "../../assets/Assets.h"
#include "../../assets/Assets.hpp"
#include "../../graphics/core/Shader.hpp"
#include "../../graphics/core/Mesh.hpp"
#include "../../graphics/core/Batch3D.hpp"

View File

@ -3,7 +3,7 @@
#include "ChunksRenderer.hpp"
#include "Skybox.hpp"
#include "../../assets/Assets.h"
#include "../../assets/Assets.hpp"
#include "../../content/Content.h"
#include "../../engine.h"
#include "../../frontend/LevelFrontend.hpp"

View File

@ -2,10 +2,7 @@
#include "elements/UINode.hpp"
#include "elements/Menu.hpp"
#include <iostream>
#include <algorithm>
#include "../../assets/Assets.h"
#include "../../assets/Assets.hpp"
#include "../../frontend/UiDocument.hpp"
#include "../../graphics/core/Batch2D.hpp"
#include "../../graphics/core/Shader.hpp"
@ -14,6 +11,9 @@
#include "../../window/input.hpp"
#include "../../window/Camera.hpp"
#include <iostream>
#include <algorithm>
using namespace gui;
GUI::GUI() {

View File

@ -3,7 +3,7 @@
#include "../../core/DrawContext.hpp"
#include "../../core/Batch2D.hpp"
#include "../../core/Texture.hpp"
#include "../../../assets/Assets.h"
#include "../../../assets/Assets.hpp"
#include "../../../maths/UVRegion.hpp"
using namespace gui;

View File

@ -3,7 +3,7 @@
#include "Label.hpp"
#include "../../core/DrawContext.hpp"
#include "../../core/Batch2D.hpp"
#include "../../../util/stringutil.h"
#include "../../../util/stringutil.hpp"
using namespace gui;

View File

@ -1,5 +1,5 @@
#include "InventoryView.hpp"
#include "../../../assets/Assets.h"
#include "../../../assets/Assets.hpp"
#include "../../../content/Content.h"
#include "../../../frontend/LevelFrontend.hpp"
#include "../../../items/Inventories.h"
@ -9,7 +9,7 @@
#include "../../../logic/scripting/scripting.h"
#include "../../../maths/voxmaths.h"
#include "../../../objects/Player.h"
#include "../../../util/stringutil.h"
#include "../../../util/stringutil.hpp"
#include "../../../voxels/Block.h"
#include "../../../window/Events.hpp"
#include "../../../window/input.hpp"

View File

@ -2,8 +2,8 @@
#include "../../core/DrawContext.hpp"
#include "../../core/Batch2D.hpp"
#include "../../core/Font.hpp"
#include "../../../assets/Assets.h"
#include "../../../util/stringutil.h"
#include "../../../assets/Assets.hpp"
#include "../../../util/stringutil.hpp"
using namespace gui;

View File

@ -3,8 +3,8 @@
#include "../../core/Batch2D.hpp"
#include "../../core/Font.hpp"
#include "../../core/DrawContext.hpp"
#include "../../../assets/Assets.h"
#include "../../../util/stringutil.h"
#include "../../../assets/Assets.hpp"
#include "../../../util/stringutil.hpp"
using namespace gui;

View File

@ -4,8 +4,8 @@
#include "../../core/DrawContext.hpp"
#include "../../core/Batch2D.hpp"
#include "../../core/Font.hpp"
#include "../../../assets/Assets.h"
#include "../../../util/stringutil.h"
#include "../../../assets/Assets.hpp"
#include "../../../util/stringutil.hpp"
#include "../../../window/Events.hpp"
using namespace gui;

View File

@ -2,7 +2,7 @@
#include "../../core/DrawContext.hpp"
#include "../../core/Batch2D.hpp"
#include "../../../assets/Assets.h"
#include "../../../assets/Assets.hpp"
using namespace gui;

View File

@ -1,16 +1,17 @@
#include "gui_util.hpp"
#include "elements/Label.hpp"
#include "elements/Menu.hpp"
#include "elements/Button.hpp"
#include "gui_xml.hpp"
#include <glm/glm.hpp>
#include "../../logic/scripting/scripting.h"
#include "../../frontend/locale.hpp"
#include "../../util/stringutil.h"
#include "../../util/stringutil.hpp"
#include "../../delegates.h"
#include <glm/glm.hpp>
using namespace gui;
std::shared_ptr<Button> guiutil::backButton(std::shared_ptr<Menu> menu) {

View File

@ -15,7 +15,7 @@
#include "../../items/Inventory.h"
#include "../../logic/scripting/scripting.h"
#include "../../maths/voxmaths.h"
#include "../../util/stringutil.h"
#include "../../util/stringutil.hpp"
#include "../../window/Events.hpp"
#include <stdexcept>

View File

@ -1,6 +1,6 @@
#include "Inventory.h"
#include "../content/ContentLUT.h"
#include "../content/ContentLUT.hpp"
Inventory::Inventory(int64_t id, size_t size) : id(id), slots(size) {
}

View File

@ -1,5 +1,5 @@
#include "ItemDef.h"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
ItemDef::ItemDef(std::string name) : name(name) {
caption = util::id_to_caption(name);

View File

@ -1,7 +1,8 @@
#include "Lightmap.h"
#include <assert.h>
#include "../util/data_io.h"
#include "../util/data_io.hpp"
#include <assert.h>
void Lightmap::set(const Lightmap* lightmap) {
set(lightmap->map);

View File

@ -1,6 +1,6 @@
#include "EngineController.hpp"
#include "../content/ContentLUT.h"
#include "../content/ContentLUT.hpp"
#include "../debug/Logger.hpp"
#include "../engine.h"
#include "../files/WorldFiles.h"
@ -12,7 +12,7 @@
#include "../graphics/ui/elements/Menu.hpp"
#include "../graphics/ui/gui_util.hpp"
#include "../interfaces/Task.hpp"
#include "../util/stringutil.h"
#include "../util/stringutil.hpp"
#include "../world/World.h"
#include "../world/Level.h"
#include "LevelController.h"

View File

@ -2,6 +2,8 @@
#include <cmath>
#include "PlayerController.h"
#include "BlocksController.h"
#include "scripting/scripting.h"
#include "../objects/Player.h"
#include "../physics/PhysicsSolver.h"
@ -19,10 +21,7 @@
#include "../items/ItemDef.h"
#include "../items/ItemStack.h"
#include "../items/Inventory.h"
#include "scripting/scripting.h"
#include "BlocksController.h"
#include "../core_defs.h"
#include "../core_defs.hpp"
const float CAM_SHAKE_OFFSET = 0.025f;
const float CAM_SHAKE_OFFSET_Y = 0.031f;

View File

@ -3,7 +3,7 @@
#include "lua_util.hpp"
#include "api_lua.hpp"
#include "../../../debug/Logger.hpp"
#include "../../../util/stringutil.h"
#include "../../../util/stringutil.hpp"
#include <iomanip>
#include <iostream>

View File

@ -5,7 +5,7 @@
#include "../scripting.h"
#include "../../../engine.h"
#include "../../../assets/Assets.h"
#include "../../../assets/Assets.hpp"
#include "../../../items/Inventories.h"
#include "../../../graphics/ui/gui_util.hpp"
#include "../../../graphics/ui/elements/UINode.hpp"
@ -18,7 +18,7 @@
#include "../../../graphics/ui/elements/InventoryView.hpp"
#include "../../../frontend/UiDocument.hpp"
#include "../../../frontend/locale.hpp"
#include "../../../util/stringutil.h"
#include "../../../util/stringutil.hpp"
#include "../../../world/Level.h"
using namespace gui;

View File

@ -2,7 +2,7 @@
#include "api_lua.hpp"
#include "LuaState.hpp"
#include "../../../assets/Assets.h"
#include "../../../assets/Assets.hpp"
#include "../../../content/Content.h"
#include "../../../engine.h"
#include "../../../frontend/hud.hpp"

View File

@ -2,7 +2,7 @@
#include "api_lua.hpp"
#include "../scripting.h"
#include "../../../assets/Assets.h"
#include "../../../assets/Assets.hpp"
#include "../../../assets/AssetsLoader.hpp"
#include "../../../files/engine_paths.h"
#include "../../../world/Level.h"

View File

@ -11,7 +11,7 @@
#include "../../logic/BlocksController.h"
#include "../../logic/LevelController.h"
#include "../../objects/Player.h"
#include "../../util/stringutil.h"
#include "../../util/stringutil.hpp"
#include "../../util/timeutil.h"
#include "../../util/timeutil.h"
#include "../../voxels/Block.h"

View File

@ -2,7 +2,7 @@
#include "lua/LuaState.hpp"
#include "../../debug/Logger.hpp"
#include "../../util/stringutil.h"
#include "../../util/stringutil.hpp"
namespace scripting {
extern lua::LuaState* state;

View File

@ -1,5 +1,6 @@
#include "Player.h"
#include "../content/ContentLUT.h"
#include "../content/ContentLUT.hpp"
#include "../physics/Hitbox.h"
#include "../physics/PhysicsSolver.h"
#include "../voxels/Chunks.h"

View File

@ -1,5 +1,5 @@
#ifndef UTIL_DATA_IO_H_
#define UTIL_DATA_IO_H_
#ifndef UTIL_DATA_IO_HPP_
#define UTIL_DATA_IO_HPP_
#include "../typedefs.h"
@ -53,4 +53,4 @@ namespace dataio {
}
}
#endif // UTIL_DATA_IO_H_
#endif // UTIL_DATA_IO_HPP_

View File

@ -1,5 +1,5 @@
#include "listutil.h"
#include "../util/stringutil.h"
#include "listutil.hpp"
#include "../util/stringutil.hpp"
#include <sstream>

View File

@ -1,12 +1,12 @@
#include "platform.h"
#include "platform.hpp"
#include "../typedefs.h"
#include <sstream>
#include <iomanip>
#include <time.h>
#include <iostream>
#include "../typedefs.h"
#ifdef _WIN32
#include <Windows.h>

View File

@ -1,5 +1,5 @@
#ifndef UTIL_PLATFORM_H_
#define UTIL_PLATFORM_H_
#ifndef UTIL_PLATFORM_HPP_
#define UTIL_PLATFORM_HPP_
#include <string>
@ -9,4 +9,4 @@ namespace platform {
std::string detect_locale();
}
#endif // UTIL_PLATFORM_H_
#endif // UTIL_PLATFORM_HPP_

View File

@ -1,7 +1,6 @@
#include "stringutil.h"
#include "stringutil.hpp"
#include <cmath>
#include <vector>
#include <locale>
#include <iomanip>
#include <sstream>

View File

@ -1,9 +1,10 @@
#ifndef UTIL_STRINGUTIL_H_
#define UTIL_STRINGUTIL_H_
#ifndef UTIL_STRINGUTIL_HPP_
#define UTIL_STRINGUTIL_HPP_
#include "../typedefs.h"
#include <string>
#include <vector>
#include "../typedefs.h"
namespace util {
/// @brief Function used for string serialization in text formats
@ -58,4 +59,4 @@ namespace util {
std::string format_data_size(size_t size);
}
#endif // UTIL_STRINGUTIL_H_
#endif // UTIL_STRINGUTIL_HPP_

View File

@ -1,15 +1,15 @@
#include <stdexcept>
#include "core_defs.h"
#include "core_defs.hpp"
#include "engine.h"
#include "files/files.h"
#include "files/settings_io.hpp"
#include "files/engine_paths.h"
#include "util/platform.h"
#include "util/platform.hpp"
#include "util/command_line.hpp"
#include "window/Events.hpp"
#include "debug/Logger.hpp"
#include <stdexcept>
static debug::Logger logger("main");
int main(int argc, char** argv) {

View File

@ -1,7 +1,7 @@
#include "Block.h"
#include "../core_defs.h"
#include "../util/stringutil.h"
#include "../core_defs.hpp"
#include "../util/stringutil.hpp"
CoordSystem::CoordSystem(glm::ivec3 axisX, glm::ivec3 axisY, glm::ivec3 axisZ)
: axisX(axisX), axisY(axisY), axisZ(axisZ)

View File

@ -3,7 +3,7 @@
#include "voxel.h"
#include "../items/Inventory.h"
#include "../content/ContentLUT.h"
#include "../content/ContentLUT.hpp"
#include "../lighting/Lightmap.h"
Chunk::Chunk(int xpos, int zpos) : x(xpos), z(zpos){

View File

@ -3,6 +3,14 @@
#include "Chunk.h"
#include "Block.h"
#define FNL_IMPL
#include "../maths/FastNoiseLite.h"
#include "../content/Content.h"
#include "../maths/voxmaths.h"
#include "../maths/util.h"
#include "../core_defs.hpp"
#include <iostream>
#include <vector>
#include <time.h>
@ -10,13 +18,6 @@
#include <math.h>
#include <glm/glm.hpp>
#include <glm/gtc/noise.hpp>
#define FNL_IMPL
#include "../maths/FastNoiseLite.h"
#include "../content/Content.h"
#include "../maths/voxmaths.h"
#include "../maths/util.h"
#include "../core_defs.h"
// will be refactored in generators update

View File

@ -3,7 +3,7 @@
#include "Chunk.h"
#include "../content/Content.h"
#include "../core_defs.h"
#include "../core_defs.hpp"
void FlatWorldGenerator::generate(voxel* voxels, int cx, int cz, int seed) {
for (int z = 0; z < CHUNK_D; z++) {
@ -25,4 +25,4 @@ void FlatWorldGenerator::generate(voxel* voxels, int cx, int cz, int seed) {
}
}
}
}
}

View File

@ -1,21 +1,21 @@
#include "World.h"
#include "Level.h"
#include "../content/Content.h"
#include "../content/ContentLUT.hpp"
#include "../files/WorldFiles.h"
#include "../items/Inventories.h"
#include "../objects/Player.h"
#include "../voxels/Chunk.h"
#include "../voxels/Chunks.h"
#include "../voxels/ChunksStorage.h"
#include "../window/Camera.hpp"
#include "../world/WorldGenerators.h"
#include <memory>
#include <iostream>
#include <glm/glm.hpp>
#include "Level.h"
#include "../files/WorldFiles.h"
#include "../content/Content.h"
#include "../world/WorldGenerators.h"
#include "../content/ContentLUT.h"
#include "../voxels/Chunk.h"
#include "../voxels/Chunks.h"
#include "../voxels/ChunksStorage.h"
#include "../objects/Player.h"
#include "../window/Camera.hpp"
#include "../items/Inventories.h"
world_load_error::world_load_error(std::string message)
: std::runtime_error(message) {
}