mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
class Renderer supports getting rendering target now.
This commit is contained in:
parent
f0cbeb9702
commit
4608508476
|
@ -779,6 +779,13 @@ namespace MiniEngine
|
|||
updateInfo();
|
||||
}
|
||||
|
||||
//private
|
||||
void Texture::_set_no_delete(SDL_Texture* p)
|
||||
{
|
||||
_text.reset(p,[](SDL_Texture*){});
|
||||
updateInfo();
|
||||
}
|
||||
|
||||
//private
|
||||
void Texture::_clear()
|
||||
{
|
||||
|
@ -940,6 +947,13 @@ namespace MiniEngine
|
|||
return SDL_SetRenderTarget(_get(), nullptr);
|
||||
}
|
||||
|
||||
Texture Renderer::getTarget()
|
||||
{
|
||||
Texture t;
|
||||
t._set_no_delete(SDL_GetRenderTarget(_get()));
|
||||
return t;
|
||||
}
|
||||
|
||||
int Renderer::fillRect(const Rect& rect)
|
||||
{
|
||||
auto inr = rect.toSDLRect();
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace MiniEngine
|
|||
public:
|
||||
int x, y, w, h;
|
||||
Rect(int X, int Y, int W, int H);
|
||||
Rect(const SDL_Rect&);
|
||||
explicit Rect(const SDL_Rect&);
|
||||
Rect();
|
||||
SDL_Rect toSDLRect() const;
|
||||
bool isEmpty();
|
||||
|
@ -199,6 +199,8 @@ namespace MiniEngine
|
|||
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;
|
||||
Rect rect;
|
||||
|
@ -220,6 +222,7 @@ namespace MiniEngine
|
|||
|
||||
int setTarget(Texture& t);
|
||||
int setTarget();
|
||||
Texture getTarget();
|
||||
|
||||
int fillRect(const Rect& rect);
|
||||
int drawRect(const Rect& rect);
|
||||
|
|
Loading…
Reference in New Issue
Block a user