mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Add Rendering-like functions in class Surface
This commit is contained in:
parent
40c5f0dc91
commit
a2a3e493c5
|
@ -266,6 +266,35 @@ namespace MiniEngine
|
||||||
return IMG_SavePNG(_get(),filename.c_str());
|
return IMG_SavePNG(_get(),filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Surface::blit(Surface s,Rect src,Rect dst)
|
||||||
|
{
|
||||||
|
SDL_Rect rsrc=src.toSDLRect();
|
||||||
|
SDL_Rect rdst=dst.toSDLRect();
|
||||||
|
return SDL_BlitSurface(s._get(),&rsrc,_get(),&rdst);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Surface::blitTo(Surface s,Rect dst)
|
||||||
|
{
|
||||||
|
SDL_Rect rdst=dst.toSDLRect();
|
||||||
|
return SDL_BlitSurface(s._get(),NULL,_get(),&rdst);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Surface::blitTo(Surface s,Point lupoint)
|
||||||
|
{
|
||||||
|
return blitTo(s,Rect(lupoint.x,lupoint.y,s.getw(),s.geth()));
|
||||||
|
}
|
||||||
|
|
||||||
|
int Surface::blitFill(Surface s,Rect src)
|
||||||
|
{
|
||||||
|
SDL_Rect rsrc=src.toSDLRect();
|
||||||
|
return SDL_BlitSurface(s._get(),&rsrc,_get(),NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Surface::blitFullFill(Surface s)
|
||||||
|
{
|
||||||
|
return SDL_BlitSurface(s._get(),NULL,_get(),NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void Texture::_set(SDL_Texture* p)//private
|
void Texture::_set(SDL_Texture* p)//private
|
||||||
{
|
{
|
||||||
_text.reset(p,SDL_DestroyTexture);
|
_text.reset(p,SDL_DestroyTexture);
|
||||||
|
|
|
@ -100,6 +100,12 @@ namespace MiniEngine
|
||||||
int geth();
|
int geth();
|
||||||
BlendMode getBlendMode();
|
BlendMode getBlendMode();
|
||||||
int setBlendMode(BlendMode mode);
|
int setBlendMode(BlendMode mode);
|
||||||
|
|
||||||
|
int blit(Surface s,Rect src,Rect dst);
|
||||||
|
int blitTo(Surface t, Rect dst);
|
||||||
|
int blitTo(Surface t, Point lupoint);
|
||||||
|
int blitFill(Surface t, Rect src);
|
||||||
|
int blitFullFill(Surface t);
|
||||||
protected:
|
protected:
|
||||||
Surface() = default;
|
Surface() = default;
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user