MiniEngine/include/SDLWrapper/Texture.h

50 lines
1.1 KiB
C++
Raw Permalink Normal View History

#pragma once
#include "include.h"
2017-06-18 20:37:45 +08:00
#include "Rect.h"
#include "RGBA.h"
#include "ColorMode.h"
2018-03-04 15:10:49 +08:00
#include "BlendMode.h"
2017-07-01 17:11:06 +08:00
#include "__Plugin.h"
2017-06-18 20:37:45 +08:00
#include <memory>
2018-03-04 15:10:49 +08:00
namespace MiniEngine {
class Texture
{
public:
Texture();
~Texture() = default;
Rect getSize();
int getw() const;
int geth() const;
bool isReady() const;
int setBlendMode(BlendMode mode);
BlendMode getBlendMode() const;
/// Alpha: 0: Transparent 255: opaque
int setAlphaMode(int alpha);
int getAlphaMode() const;
ColorMode getColorMode() const;
int setColorMode(ColorMode mode);
RGBA getRGBA() const;
void setRGBA(const RGBA& pack);
void release();
protected:
/// updateInfo() must be called after Texture is changed.
void updateInfo();
private:
std::shared_ptr<SDL_Texture> _text;
void _set(SDL_Texture*);
/// Just used for "SDL_GetRenderTarget"
void _set_no_delete(SDL_Texture*);
void _clear();
SDL_Texture* _get() const;
2017-06-18 20:37:45 +08:00
Rect _rect;
friend class Renderer;
2017-07-01 17:11:06 +08:00
friend class _internal::Plugin;
};
2018-03-04 15:10:49 +08:00
} /// End of namespace MiniEngine