aboutsummaryrefslogtreecommitdiff
path: root/resource-manager/Image_asset.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-09-22 10:58:21 +0200
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-09-22 10:58:21 +0200
commit765485ced528ca2f4cf644a1503b9446c5826731 (patch)
treee9d35c04a8768afb38873daa31d1b47a3da93e54 /resource-manager/Image_asset.cpp
parent507a97739726feb74ffa91e317ead1773183ccbf (diff)
spritesheet werkt
Diffstat (limited to 'resource-manager/Image_asset.cpp')
-rw-r--r--resource-manager/Image_asset.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/resource-manager/Image_asset.cpp b/resource-manager/Image_asset.cpp
index 77eee2f..10b35f8 100644
--- a/resource-manager/Image_asset.cpp
+++ b/resource-manager/Image_asset.cpp
@@ -1,12 +1,21 @@
#include "Image_asset.h"
+#include "spritesheet.h"
#include <SDL2/SDL_surface.h>
+#include <SDL_image.h>
+#include <string>
+Image::Image(const std::string& path){
+ surface = IMG_Load(path.c_str());
+}
+
Image::~Image(){
- if (surface) {
- SDL_FreeSurface(surface);
- }
+ SDL_FreeSurface(surface);
+}
+
+SDL_Surface* Image::getSurface() const {
+ return surface;
}