aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Texture.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-08 19:49:41 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-08 19:49:41 +0100
commit519cc5d16e65ff501d330c03eeb35d2d095ead29 (patch)
tree3c7c3a64c922ec248f4136d1282530a6ec6647ac /src/crepe/api/Texture.cpp
parent63bcd54e0e0ea64cfef5950568b4253d5dae5c1e (diff)
made sdlcontext not a singleton anymore
Diffstat (limited to 'src/crepe/api/Texture.cpp')
-rw-r--r--src/crepe/api/Texture.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/crepe/api/Texture.cpp b/src/crepe/api/Texture.cpp
index 9d8e02d..2ac8606 100644
--- a/src/crepe/api/Texture.cpp
+++ b/src/crepe/api/Texture.cpp
@@ -3,27 +3,21 @@
#include "Asset.h"
#include "Resource.h"
#include "Texture.h"
+#include "facade/SDLContext.h"
+#include "manager/Mediator.h"
#include "types.h"
-#include <utility>
using namespace crepe;
using namespace std;
-Texture::Texture(const Asset & src) : Resource(src) {
+Texture::Texture(const Asset & src, Mediator & mediator) : Resource(src, mediator) {
dbg_trace();
+ SDLContext & ctx = mediator.sdl_context;
+ this->texture = ctx.texture_from_path(src.get_path());
+ this->size = ctx.get_size(*this);
}
Texture::~Texture() {
dbg_trace();
this->texture.reset();
}
-
-void Texture::load(std::unique_ptr<SDL_Texture, std::function<void(SDL_Texture *)>> texture) {
- this->texture = std::move(texture);
- this->loaded = true;
-}
-
-ivec2 Texture::get_size() const {
- if (this->texture == nullptr) return {};
- return {};
-}