added constructor for external surfaces
This commit is contained in:
parent
027b9ba84a
commit
84a196ab1a
@ -35,3 +35,7 @@ Image::Image(const std::string& path) {
|
|||||||
if (!loaded) throw std::runtime_error(IMG_GetError());
|
if (!loaded) throw std::runtime_error(IMG_GetError());
|
||||||
_s.reset(loaded);
|
_s.reset(loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Image::Image(SDL_Surface* surface) {
|
||||||
|
_s.reset(surface);
|
||||||
|
}
|
||||||
|
@ -19,6 +19,7 @@ namespace sc {
|
|||||||
public:
|
public:
|
||||||
Image(int w, int h);
|
Image(int w, int h);
|
||||||
Image(const std::string& path);
|
Image(const std::string& path);
|
||||||
|
Image(SDL_Surface* surface);
|
||||||
|
|
||||||
SDL_Surface* surface() const { return _s.get(); }
|
SDL_Surface* surface() const { return _s.get(); }
|
||||||
int width() const { return _s.get()->w; }
|
int width() const { return _s.get()->w; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user