libscgui/Image.hpp

34 lines
731 B
C++

//
// Image.hpp
// libscgui
//
// Created by Bob Polis at 2020-10-23
// Copyright (c) 2020 SwiftCoder. All rights reserved.
//
#ifndef _Image_H_
#define _Image_H_
#include <string>
#include <memory>
#include <SDL2/SDL.h>
namespace sc {
namespace gui {
class Image {
public:
Image(int w, int h);
Image(const std::string& path);
SDL_Surface* surface() const { return _s.get(); }
int width() const { return _s.get()->w; }
int height() const { return _s.get()->h; }
private:
std::unique_ptr<SDL_Surface, void(*)(SDL_Surface*)> _s {nullptr, SDL_FreeSurface};
};
}
}
#endif // _Image_H_