Skip to content

Commit

Permalink
feat(serialization): add serialization in cursor.[hpp/cpp]
Browse files Browse the repository at this point in the history
  • Loading branch information
Dacops committed Feb 1, 2024
1 parent fa22bcd commit 17a16a1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/include/cubos/core/io/cursor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#pragma once

#include <cubos/core/reflection/reflect.hpp>

#ifdef WITH_GLFW
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
Expand Down Expand Up @@ -43,3 +45,5 @@ namespace cubos::core::io
#endif
};
} // namespace cubos::core::io

CUBOS_REFLECT_EXTERNAL_DECL(cubos::core::io::Cursor::Standard);
21 changes: 21 additions & 0 deletions core/src/cubos/core/io/cursor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#include <cubos/core/io/cursor.hpp>
#include <cubos/core/reflection/traits/enum.hpp>
#include <cubos/core/reflection/type.hpp>

using namespace cubos::core;
using cubos::core::io::Cursor;
using cubos::core::reflection::EnumTrait;
using cubos::core::reflection::Type;

#ifdef WITH_GLFW
io::Cursor::Cursor(GLFWcursor* handle)
Expand All @@ -18,3 +23,19 @@ io::Cursor::~Cursor()
}
#endif
}

CUBOS_REFLECT_EXTERNAL_IMPL(Cursor::Standard)
{
return Type::create("Standard")
.with(EnumTrait{}
.withVariant<Cursor::Standard::Arrow>("Arrow")
.withVariant<Cursor::Standard::IBeam>("IBeam")
.withVariant<Cursor::Standard::Cross>("Cross")
.withVariant<Cursor::Standard::Hand>("Hand")
.withVariant<Cursor::Standard::EWResize>("EWResize")
.withVariant<Cursor::Standard::NSResize>("NSResize")
.withVariant<Cursor::Standard::NWSEResize>("NWSEResize")
.withVariant<Cursor::Standard::NESWResize>("NESWResize")
.withVariant<Cursor::Standard::AllResize>("AllResize")
.withVariant<Cursor::Standard::NotAllowed>("NotAllowed"));
}

0 comments on commit 17a16a1

Please sign in to comment.