diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-05 15:47:29 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-05 15:47:29 +0200 |
| commit | 6731ab0243ba437595062558e56b800d5eca9cf5 (patch) | |
| tree | 39025a8ca381ff6f71cbe316c7d72b32f506a9bf /anim | |
| parent | 2c26d57dc97eb7105a6dca2089fd42847a8c2b37 (diff) | |
a
Diffstat (limited to 'anim')
| -rw-r--r-- | anim/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | anim/serialize.cpp | 32 | ||||
| -rw-r--r-- | anim/serialize.hpp | 41 |
3 files changed, 0 insertions, 85 deletions
diff --git a/anim/CMakeLists.txt b/anim/CMakeLists.txt deleted file mode 100644 index bc148a06..00000000 --- a/anim/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -find_package(OpenCV QUIET REQUIRED COMPONENTS core imgcodecs imgproc) -find_package(nlohmann_json QUIET REQUIRED) - -set(self "${PROJECT_NAME}-anim") - -include_directories(SYSTEM PRIVATE ${OpenCV_INCLUDE_DIRS}) -link_libraries(opencv_imgproc opencv_imgcodecs opencv_core) -link_libraries(Magnum::Magnum nlohmann_json::nlohmann_json) - -file(GLOB sources "*.cpp" CONFIGURE_ARGS) -add_library(${self} STATIC ${sources}) - diff --git a/anim/serialize.cpp b/anim/serialize.cpp deleted file mode 100644 index 8c027d9c..00000000 --- a/anim/serialize.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "serialize.hpp" - -#include <Corrade/Utility/Debug.h> -#include <Corrade/Utility/DebugStl.h> - -#include "json-magnum.hpp" - -using Corrade::Utility::Error; - -#if defined __clang__ || defined __CLION_IDE__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wweak-vtables" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_frame, ground, offset, size) -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_group, name, frames, ground) -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim, name, nframes, actionframe, fps, groups, width, height) - -#if defined __clang__ || defined __CLION_IDE__ -# pragma clang diagnostic pop -#endif - -std::tuple<anim, bool> anim::from_json(const std::filesystem::path& pathname) noexcept -{ - return json_helper<anim>::from_json(pathname); -} - -bool anim::to_json(const std::filesystem::path& pathname) const noexcept -{ - return json_helper<anim>::to_json(*this, pathname); -} diff --git a/anim/serialize.hpp b/anim/serialize.hpp deleted file mode 100644 index 3e039a96..00000000 --- a/anim/serialize.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include <string> -#include <array> -#include <vector> - -#include <Magnum/Magnum.h> -#include <Magnum/Math/Vector2.h> - -namespace std::filesystem { class path; } - -struct anim_frame final -{ - Magnum::Vector2i ground, offset, size; -}; - -enum class anim_direction : unsigned char -{ - N, NE, E, SE, S, SW, W, NW, - COUNT, -}; - -struct anim_group final -{ - std::string name; - std::vector<anim_frame> frames; - Magnum::Vector2i ground; -}; - -struct anim final -{ - static std::tuple<anim, bool> from_json(const std::filesystem::path& pathname) noexcept; - [[nodiscard]] bool to_json(const std::filesystem::path& pathname) const noexcept; - static constexpr int default_fps = 24; - - std::string name; - std::array<anim_group, (std::size_t)anim_direction::COUNT> groups; - int nframes = 0; - int width = 0, height = 0; - int actionframe = -1, fps = default_fps; -}; |
