diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index f762ab0..586c481 100644 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt @@ -41,7 +41,7 @@ add_library (Xn65 STATIC "platform-dx/displaymode.cpp" "platform-dx/init.cpp" "platform-dx/buffer.cpp" -"platform-dx/audioengine.cpp" ) +"platform-dx/audioengine.cpp" "graphics/gresource.cpp") if (CMAKE_VERSION VERSION_GREATER 3.12) set_property(TARGET Xn65 PROPERTY CXX_STANDARD 20) diff --git a/framework/graphics/gresource.cpp b/framework/graphics/gresource.cpp new file mode 100644 index 0000000..5219809 --- /dev/null +++ b/framework/graphics/gresource.cpp @@ -0,0 +1,18 @@ +#include "xna/graphics/gresource.hpp" + +namespace xna { + GraphicsResource::GraphicsResource(sptr const& device) : m_device(device) {} + + sptr GraphicsResource::Device() const { + return m_device; + } + + bool GraphicsResource::Bind(sptr const& device) { + if (!device || device == m_device) + return false; + + m_device = device; + + return true; + } +} \ No newline at end of file diff --git a/inc/xna/graphics/gresource.hpp b/inc/xna/graphics/gresource.hpp index 13e6e2a..0c02ab5 100644 --- a/inc/xna/graphics/gresource.hpp +++ b/inc/xna/graphics/gresource.hpp @@ -4,20 +4,17 @@ #include "../default.hpp" namespace xna { + //Queries and prepares resources. class GraphicsResource { public: - GraphicsResource(sptr const& device) : m_device(device){} + GraphicsResource(sptr const& device); virtual ~GraphicsResource(){} - virtual bool Bind(sptr const& device) { - if (!device || device == m_device) - return false; + virtual bool Bind(sptr const& device); - m_device = device; - - return true; - } + //Gets the GraphicsDevice associated with this GraphicsResource. + sptr Device() const; protected: sptr m_device = nullptr;