diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-12 13:43:34 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-12 17:47:30 +0100 |
commit | d481edb3619e251285c238c05f47a121ecd96df7 (patch) | |
tree | ff81314fbcb75ad1272285b827b6c2e8f3ac694e /loader | |
parent | 58bf715b7932be0e6e611cbde0c6aa6fe82a6f70 (diff) |
cmake: add targets for loader, serialize, draw
Diffstat (limited to 'loader')
-rw-r--r-- | loader/CMakeLists.txt | 16 | ||||
-rw-r--r-- | loader/impl.cpp (renamed from loader/loader-impl.cpp) | 2 | ||||
-rw-r--r-- | loader/loader.cpp | 5 | ||||
-rw-r--r-- | loader/loader.hpp | 36 | ||||
-rw-r--r-- | loader/precomp.hpp | 7 |
5 files changed, 65 insertions, 1 deletions
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt new file mode 100644 index 00000000..9c0b6ee7 --- /dev/null +++ b/loader/CMakeLists.txt @@ -0,0 +1,16 @@ +set(self floormat-loader) +file(GLOB sources "*.cpp" CONFIGURE_ARGS) +add_library(${self} STATIC "${sources}") +target_link_libraries( + ${self} PUBLIC + floormat-serialize + floormat + Magnum::Magnum + Magnum::Trade +) +if(WIN32) + target_link_libraries(${self} PUBLIC ntdll) +endif() +if(FLOORMAT_PRECOMPILED-HEADERS) + target_precompile_headers(${self} PRIVATE precomp.hpp) +endif() diff --git a/loader/loader-impl.cpp b/loader/impl.cpp index 955ccf03..99be0be6 100644 --- a/loader/loader-impl.cpp +++ b/loader/impl.cpp @@ -1,5 +1,5 @@ #include "impl.hpp" -#include "src/loader.hpp" +#include "loader/loader.hpp" #include "src/tile-atlas.hpp" #include "compat/assert.hpp" #include "compat/alloca.hpp" diff --git a/loader/loader.cpp b/loader/loader.cpp new file mode 100644 index 00000000..83c3eed2 --- /dev/null +++ b/loader/loader.cpp @@ -0,0 +1,5 @@ +#include "loader.hpp" +namespace floormat { +loader_::loader_() = default; +loader_::~loader_() = default; +} // namespace floormat diff --git a/loader/loader.hpp b/loader/loader.hpp new file mode 100644 index 00000000..32158675 --- /dev/null +++ b/loader/loader.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include <memory> +#include <Corrade/Containers/ArrayView.h> +#include <Corrade/Containers/StringView.h> +#include <Magnum/Trade/ImageData.h> + +#define FM_IMAGE_PATH "share/floormat/images/" +#define FM_ANIM_PATH "share/floormat/anim/" + +namespace floormat { + +struct tile_atlas; +struct anim_atlas; + +struct loader_ +{ + virtual StringView shader(StringView filename) = 0; + virtual std::shared_ptr<struct tile_atlas> tile_atlas(StringView filename, Vector2ub size) = 0; + virtual ArrayView<String> anim_atlas_list() = 0; + virtual std::shared_ptr<struct anim_atlas> anim_atlas(StringView name) = 0; + static void destroy(); + static loader_& default_loader() noexcept; + + loader_(const loader_&) = delete; + loader_& operator=(const loader_&) = delete; + + virtual ~loader_(); + +protected: + loader_(); +}; + +extern loader_& loader; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) + +} // namespace floormat diff --git a/loader/precomp.hpp b/loader/precomp.hpp new file mode 100644 index 00000000..4ebd56b2 --- /dev/null +++ b/loader/precomp.hpp @@ -0,0 +1,7 @@ +#pragma once +#include "../src/precomp.hpp" +#include <Corrade/PluginManager/PluginManager.h> +#include <Corrade/Utility/Implementation/ErrorString.h> +#include <Magnum/Trade/AbstractImporter.h> +#include <Magnum/Trade/ImageData.h> +#include <Magnum/Trade/AbstractImageConverter.h> |