aboutsummaryrefslogtreecommitdiff
path: root/resource-manager/Image_asset.cpp
diff options
context:
space:
mode:
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;
}