2020-10-24 15:13:13 +02:00
|
|
|
//
|
|
|
|
// 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);
|
2020-10-24 18:01:44 +02:00
|
|
|
Image(SDL_Surface* surface);
|
2020-10-24 15:13:13 +02:00
|
|
|
|
|
|
|
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_
|