diff --git a/MiniEngine.cpp b/MiniEngine.cpp index f0fd209..3177b97 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -266,6 +266,35 @@ namespace MiniEngine 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 { _text.reset(p,SDL_DestroyTexture); diff --git a/MiniEngine.h b/MiniEngine.h index 6a9ee1b..32830fd 100644 --- a/MiniEngine.h +++ b/MiniEngine.h @@ -100,6 +100,12 @@ namespace MiniEngine int geth(); BlendMode getBlendMode(); 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: Surface() = default; private: