1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00

Correções em GraphicsResource

This commit is contained in:
Danilo 2024-11-15 11:47:33 -03:00
parent 28f4575206
commit 50abffe9a9
5 changed files with 28 additions and 25 deletions

View File

@ -1,23 +1,25 @@
#ifndef XNA_GRAPHICS_GRESOURCE_HPP #ifndef XNA_GRAPHICS_GRESOURCE_HPP
#define XNA_GRAPHICS_GRESOURCE_HPP #define XNA_GRAPHICS_GRESOURCE_HPP
#include "../default.hpp" #include <memory>
namespace xna { namespace xna {
class GraphicsDevice;
//Queries and prepares resources. //Queries and prepares resources.
class GraphicsResource { class GraphicsResource {
public: public:
GraphicsResource(sptr<GraphicsDevice> const& device); GraphicsResource(std::shared_ptr<GraphicsDevice> const& device);
virtual ~GraphicsResource(){} virtual ~GraphicsResource(){}
virtual bool Bind(sptr<GraphicsDevice> const& device); virtual bool Bind(std::shared_ptr<GraphicsDevice> const& device);
//Gets the GraphicsDevice associated with this GraphicsResource. //Gets the GraphicsDevice associated with this GraphicsResource.
sptr<xna::GraphicsDevice> Device() const; std::shared_ptr<GraphicsDevice> Device() const;
protected: protected:
sptr<GraphicsDevice> BaseGraphicsDevice = nullptr; std::shared_ptr<GraphicsDevice> BaseGraphicsDevice = nullptr;
}; };
} }

View File

@ -24,7 +24,8 @@ add_library (Xn65DX STATIC
"init.cpp" "init.cpp"
"audioengine.cpp" "audioengine.cpp"
"effect.cpp" "effect.cpp"
"screen.cpp" ) "screen.cpp"
"gresource.cpp")
if (CMAKE_VERSION VERSION_GREATER 3.12) if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET Xn65DX PROPERTY CXX_STANDARD 20) set_property(TARGET Xn65DX PROPERTY CXX_STANDARD 20)

View File

@ -0,0 +1,19 @@
#include "xna/graphics/gresource.hpp"
#include "xna-dx/framework.hpp"
namespace xna {
GraphicsResource::GraphicsResource(std::shared_ptr<GraphicsDevice> const& device) : BaseGraphicsDevice(device) {}
std::shared_ptr<GraphicsDevice> GraphicsResource::Device() const {
return BaseGraphicsDevice;
}
bool GraphicsResource::Bind(std::shared_ptr<GraphicsDevice> const& device) {
if (!device || device == BaseGraphicsDevice)
return false;
BaseGraphicsDevice = device;
return true;
}
}

View File

@ -17,7 +17,6 @@ add_library (Xn65 STATIC
"common/gjk.cpp" "common/gjk.cpp"
"common/numerics.cpp" "common/numerics.cpp"
"common/packedvalue.cpp" "common/packedvalue.cpp"
"graphics/gresource.cpp"
"graphics/displaymode" "graphics/displaymode"
"exception.cpp") "exception.cpp")

View File

@ -1,18 +0,0 @@
#include "xna/graphics/gresource.hpp"
namespace xna {
GraphicsResource::GraphicsResource(sptr<GraphicsDevice> const& device) : BaseGraphicsDevice(device) {}
sptr<GraphicsDevice> GraphicsResource::Device() const {
return BaseGraphicsDevice;
}
bool GraphicsResource::Bind(sptr<GraphicsDevice> const& device) {
if (!device || device == BaseGraphicsDevice)
return false;
BaseGraphicsDevice = device;
return true;
}
}