diff --git a/includes/xna/graphics/gresource.hpp b/includes/xna/graphics/gresource.hpp index 6877284..ecf9755 100644 --- a/includes/xna/graphics/gresource.hpp +++ b/includes/xna/graphics/gresource.hpp @@ -1,23 +1,25 @@ #ifndef XNA_GRAPHICS_GRESOURCE_HPP #define XNA_GRAPHICS_GRESOURCE_HPP -#include "../default.hpp" +#include namespace xna { + class GraphicsDevice; + //Queries and prepares resources. class GraphicsResource { public: - GraphicsResource(sptr const& device); + GraphicsResource(std::shared_ptr const& device); virtual ~GraphicsResource(){} - virtual bool Bind(sptr const& device); + virtual bool Bind(std::shared_ptr const& device); //Gets the GraphicsDevice associated with this GraphicsResource. - sptr Device() const; + std::shared_ptr Device() const; protected: - sptr BaseGraphicsDevice = nullptr; + std::shared_ptr BaseGraphicsDevice = nullptr; }; } diff --git a/sources/framework-dx/CMakeLists.txt b/sources/framework-dx/CMakeLists.txt index 04bb679..16a9d58 100644 --- a/sources/framework-dx/CMakeLists.txt +++ b/sources/framework-dx/CMakeLists.txt @@ -24,7 +24,8 @@ add_library (Xn65DX STATIC "init.cpp" "audioengine.cpp" "effect.cpp" -"screen.cpp" ) +"screen.cpp" +"gresource.cpp") if (CMAKE_VERSION VERSION_GREATER 3.12) set_property(TARGET Xn65DX PROPERTY CXX_STANDARD 20) diff --git a/sources/framework-dx/gresource.cpp b/sources/framework-dx/gresource.cpp new file mode 100644 index 0000000..98547a4 --- /dev/null +++ b/sources/framework-dx/gresource.cpp @@ -0,0 +1,19 @@ +#include "xna/graphics/gresource.hpp" +#include "xna-dx/framework.hpp" + +namespace xna { + GraphicsResource::GraphicsResource(std::shared_ptr const& device) : BaseGraphicsDevice(device) {} + + std::shared_ptr GraphicsResource::Device() const { + return BaseGraphicsDevice; + } + + bool GraphicsResource::Bind(std::shared_ptr const& device) { + if (!device || device == BaseGraphicsDevice) + return false; + + BaseGraphicsDevice = device; + + return true; + } +} \ No newline at end of file diff --git a/sources/framework/CMakeLists.txt b/sources/framework/CMakeLists.txt index 65c899e..0574a84 100644 --- a/sources/framework/CMakeLists.txt +++ b/sources/framework/CMakeLists.txt @@ -17,7 +17,6 @@ add_library (Xn65 STATIC "common/gjk.cpp" "common/numerics.cpp" "common/packedvalue.cpp" -"graphics/gresource.cpp" "graphics/displaymode" "exception.cpp") diff --git a/sources/framework/graphics/gresource.cpp b/sources/framework/graphics/gresource.cpp deleted file mode 100644 index 9be7a35..0000000 --- a/sources/framework/graphics/gresource.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "xna/graphics/gresource.hpp" - -namespace xna { - GraphicsResource::GraphicsResource(sptr const& device) : BaseGraphicsDevice(device) {} - - sptr GraphicsResource::Device() const { - return BaseGraphicsDevice; - } - - bool GraphicsResource::Bind(sptr const& device) { - if (!device || device == BaseGraphicsDevice) - return false; - - BaseGraphicsDevice = device; - - return true; - } -} \ No newline at end of file