mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Add SuperCopy.
Use: SDL_RenderCopyEx
This commit is contained in:
parent
2c1f055a49
commit
7ae6b3442a
|
@ -306,6 +306,46 @@ namespace MiniEngine
|
||||||
return SDL_RenderCopy(rnd.get(), t.text.get(), NULL, NULL);
|
return SDL_RenderCopy(rnd.get(), t.text.get(), NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Renderer::supercopy(Texture t,bool srcfull,Rect src,bool dstfull,Rect dst,double angle,bool haspoint,Point center,FlipMode mode)
|
||||||
|
{
|
||||||
|
SDL_Rect R1,R2;
|
||||||
|
SDL_Point P;
|
||||||
|
SDL_Rect* pR1=nullptr;
|
||||||
|
SDL_Rect* pR2=nullptr;
|
||||||
|
SDL_Point* pPoint=nullptr;
|
||||||
|
SDL_RendererFlip flip;
|
||||||
|
if(srcfull)
|
||||||
|
{
|
||||||
|
R1=src.toSDLRect();
|
||||||
|
pR1=&R1;
|
||||||
|
}
|
||||||
|
if(dstfull)
|
||||||
|
{
|
||||||
|
R2=dst.toSDLRect();
|
||||||
|
pR2=&R2;
|
||||||
|
}
|
||||||
|
if(haspoint)
|
||||||
|
{
|
||||||
|
P=center.toSDLPoint();
|
||||||
|
pPoint=&P;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(mode)
|
||||||
|
{
|
||||||
|
case FlipMode::None:
|
||||||
|
flip=SDL_FLIP_NONE;
|
||||||
|
break;
|
||||||
|
case FlipMode::Horizontal:
|
||||||
|
flip=SDL_FLIP_HORIZONTAL;
|
||||||
|
break;
|
||||||
|
case FlipMode::Vertical:
|
||||||
|
flip=SDL_FLIP_VERTICAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SDL_RenderCopyEx(rnd.get(),t.text.get(),pR1,pR2,angle,pPoint,flip);
|
||||||
|
}
|
||||||
|
|
||||||
Surface Renderer::loadSurface(std::string FileName) throw(ErrorViewer)
|
Surface Renderer::loadSurface(std::string FileName) throw(ErrorViewer)
|
||||||
{
|
{
|
||||||
Surface surf;
|
Surface surf;
|
||||||
|
|
12
MiniEngine.h
12
MiniEngine.h
|
@ -129,6 +129,8 @@ namespace MiniEngine
|
||||||
TargetTexture = SDL_RENDERER_TARGETTEXTURE
|
TargetTexture = SDL_RENDERER_TARGETTEXTURE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class FlipMode { None, Horizontal, Vertical };
|
||||||
|
|
||||||
class Renderer
|
class Renderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -143,13 +145,18 @@ namespace MiniEngine
|
||||||
int fillRect(Rect rect);
|
int fillRect(Rect rect);
|
||||||
int drawRect(Rect rect);
|
int drawRect(Rect rect);
|
||||||
int drawPoint(Point p);
|
int drawPoint(Point p);
|
||||||
|
|
||||||
int clear();
|
int clear();
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
int copy(Texture t, Rect src, Rect dst);
|
int copy(Texture t, Rect src, Rect dst);
|
||||||
int copyTo(Texture t, Rect dst);
|
int copyTo(Texture t, Rect dst);
|
||||||
int copyTo(Texture t, Point lupoint);
|
int copyTo(Texture t, Point lupoint);
|
||||||
int copyFill(Texture t, Rect src);
|
int copyFill(Texture t, Rect src);
|
||||||
int copyFullFill(Texture t);
|
int copyFullFill(Texture t);
|
||||||
|
|
||||||
|
int supercopy(Texture t,bool srcfull,Rect src,bool dstfull,Rect dst,double angle,bool haspoint,Point center,FlipMode mode);
|
||||||
|
|
||||||
Surface loadSurface(std::string FileName) throw(ErrorViewer);
|
Surface loadSurface(std::string FileName) throw(ErrorViewer);
|
||||||
Texture render(Surface surf) throw (ErrorViewer);
|
Texture render(Surface surf) throw (ErrorViewer);
|
||||||
Texture loadTexture(std::string FileName) throw(ErrorViewer);
|
Texture loadTexture(std::string FileName) throw(ErrorViewer);
|
||||||
|
@ -261,7 +268,6 @@ namespace MiniEngine
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class AudioPlayer
|
class AudioPlayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -279,8 +285,6 @@ namespace MiniEngine
|
||||||
static int _sysAudioCounter;
|
static int _sysAudioCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Forward Declaration
|
/// Forward Declaration
|
||||||
class Music
|
class Music
|
||||||
{
|
{
|
||||||
|
@ -370,8 +374,6 @@ namespace MiniEngine
|
||||||
Event waitfor(int ms);
|
Event waitfor(int ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace EventHandle
|
namespace EventHandle
|
||||||
{
|
{
|
||||||
using DispatcherType = std::function<void(SDL_Event e, int& running, int& update)>;
|
using DispatcherType = std::function<void(SDL_Event e, int& running, int& update)>;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user