2017-06-18 17:36:13 +08:00
|
|
|
#pragma once
|
|
|
|
#include "include.h"
|
2017-06-18 20:37:45 +08:00
|
|
|
#include "Rect.h"
|
|
|
|
#include "RGBA.h"
|
|
|
|
#include "ColorMode.h"
|
|
|
|
#include "_BlendMode.h"
|
2017-07-01 17:11:06 +08:00
|
|
|
#include "__Plugin.h"
|
2017-06-18 20:37:45 +08:00
|
|
|
#include <memory>
|
2017-07-31 00:18:10 +08:00
|
|
|
namespace MiniEngine
|
|
|
|
{
|
2017-06-18 17:36:13 +08:00
|
|
|
|
|
|
|
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;
|
2017-06-18 17:36:13 +08:00
|
|
|
friend class Renderer;
|
2017-07-01 17:11:06 +08:00
|
|
|
|
|
|
|
friend class _internal::Plugin;
|
2017-06-18 17:36:13 +08:00
|
|
|
};
|
|
|
|
|
2017-07-31 00:18:10 +08:00
|
|
|
} /// End of namespace MiniEngine
|
|
|
|
|