mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Add More Functions to class Surface
This commit is contained in:
parent
709e67a40f
commit
7822544701
|
@ -651,6 +651,24 @@ namespace MiniEngine
|
||||||
return SDL_BlitScaled(s._get(),NULL,_get(),NULL);
|
return SDL_BlitScaled(s._get(),NULL,_get(),NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Surface::setClipRect(const Rect& clipRect)
|
||||||
|
{
|
||||||
|
auto m=clipRect.toSDLRect();
|
||||||
|
return (SDL_SetClipRect(_get(),&m) == SDL_TRUE) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect Surface::getClipRect() const
|
||||||
|
{
|
||||||
|
SDL_Rect rect;
|
||||||
|
SDL_GetClipRect(_get(),&rect);
|
||||||
|
return Rect(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Surface::disableClipping()
|
||||||
|
{
|
||||||
|
SDL_SetClipRect(_get(),NULL);
|
||||||
|
}
|
||||||
|
|
||||||
int Surface::setAlphaMode(int alpha)
|
int Surface::setAlphaMode(int alpha)
|
||||||
{
|
{
|
||||||
return SDL_SetSurfaceAlphaMod(_get(),alpha);
|
return SDL_SetSurfaceAlphaMod(_get(),alpha);
|
||||||
|
@ -716,7 +734,7 @@ namespace MiniEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Experimental
|
/// Experimental
|
||||||
SDL_Surface* Surface::getRawPointer()
|
SDL_Surface* Surface::getRawPointer() const
|
||||||
{
|
{
|
||||||
return _get();
|
return _get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,10 @@ namespace MiniEngine
|
||||||
int blitScaledFill(Surface t, Rect src);
|
int blitScaledFill(Surface t, Rect src);
|
||||||
int blitScaledFullFill(Surface t);
|
int blitScaledFullFill(Surface t);
|
||||||
|
|
||||||
|
int setClipRect(const Rect& clipRect);
|
||||||
|
Rect getClipRect() const;
|
||||||
|
void disableClipping();
|
||||||
|
|
||||||
int setAlphaMode(int alpha);
|
int setAlphaMode(int alpha);
|
||||||
int getAlphaMode();
|
int getAlphaMode();
|
||||||
|
|
||||||
|
@ -144,7 +148,7 @@ namespace MiniEngine
|
||||||
void release();
|
void release();
|
||||||
|
|
||||||
/// Experimental : Get SDL_Surface Pointer and then do anything you want!
|
/// Experimental : Get SDL_Surface Pointer and then do anything you want!
|
||||||
SDL_Surface* getRawPointer();
|
SDL_Surface* getRawPointer() const;
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<SDL_Surface> _surf;
|
std::shared_ptr<SDL_Surface> _surf;
|
||||||
void _set(SDL_Surface*);
|
void _set(SDL_Surface*);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user