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:
parent
28f4575206
commit
50abffe9a9
@ -1,23 +1,25 @@
|
||||
#ifndef XNA_GRAPHICS_GRESOURCE_HPP
|
||||
#define XNA_GRAPHICS_GRESOURCE_HPP
|
||||
|
||||
#include "../default.hpp"
|
||||
#include <memory>
|
||||
|
||||
namespace xna {
|
||||
class GraphicsDevice;
|
||||
|
||||
//Queries and prepares resources.
|
||||
class GraphicsResource {
|
||||
public:
|
||||
GraphicsResource(sptr<GraphicsDevice> const& device);
|
||||
GraphicsResource(std::shared_ptr<GraphicsDevice> const& device);
|
||||
|
||||
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.
|
||||
sptr<xna::GraphicsDevice> Device() const;
|
||||
std::shared_ptr<GraphicsDevice> Device() const;
|
||||
|
||||
protected:
|
||||
sptr<GraphicsDevice> BaseGraphicsDevice = nullptr;
|
||||
std::shared_ptr<GraphicsDevice> BaseGraphicsDevice = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
19
sources/framework-dx/gresource.cpp
Normal file
19
sources/framework-dx/gresource.cpp
Normal 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;
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@ add_library (Xn65 STATIC
|
||||
"common/gjk.cpp"
|
||||
"common/numerics.cpp"
|
||||
"common/packedvalue.cpp"
|
||||
"graphics/gresource.cpp"
|
||||
"graphics/displaymode"
|
||||
"exception.cpp")
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user