diff --git a/Image.cpp b/Image.cpp index 604636f..afe30a6 100644 --- a/Image.cpp +++ b/Image.cpp @@ -35,3 +35,7 @@ Image::Image(const std::string& path) { if (!loaded) throw std::runtime_error(IMG_GetError()); _s.reset(loaded); } + +Image::Image(SDL_Surface* surface) { + _s.reset(surface); +} diff --git a/Image.hpp b/Image.hpp index debad3b..43204f9 100644 --- a/Image.hpp +++ b/Image.hpp @@ -19,6 +19,7 @@ namespace sc { public: Image(int w, int h); Image(const std::string& path); + Image(SDL_Surface* surface); SDL_Surface* surface() const { return _s.get(); } int width() const { return _s.get()->w; }