mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Update MiniEngine_Simple.hpp
This commit is contained in:
parent
0639018d11
commit
4811d01c82
|
@ -324,6 +324,10 @@ public:
|
||||||
SDL_Rect d = dst.toSDLRect();
|
SDL_Rect d = dst.toSDLRect();
|
||||||
return SDL_RenderCopy(rnd.get(), t.text.get(), NULL, &d);
|
return SDL_RenderCopy(rnd.get(), t.text.get(), NULL, &d);
|
||||||
}
|
}
|
||||||
|
int copyTo(Texture t,Point lupoint)
|
||||||
|
{
|
||||||
|
return copyTo(t,Rect(lupoint.x,lupoint.y,t.getw(),t.geth()));
|
||||||
|
}
|
||||||
int copyFill(Texture t, Rect src)
|
int copyFill(Texture t, Rect src)
|
||||||
{
|
{
|
||||||
SDL_Rect s = src.toSDLRect();
|
SDL_Rect s = src.toSDLRect();
|
||||||
|
@ -540,15 +544,50 @@ public:
|
||||||
{
|
{
|
||||||
Surface surf;
|
Surface surf;
|
||||||
surf.surf.reset(TTF_RenderText_Blended(font.get(), Text.c_str(), fg.toSDLColor()));
|
surf.surf.reset(TTF_RenderText_Blended(font.get(), Text.c_str(), fg.toSDLColor()));
|
||||||
Texture t = rnd.render(surf);
|
return rnd.render(surf);
|
||||||
return t;
|
|
||||||
}
|
}
|
||||||
|
Texture renderTextWrapped(Renderer rnd,std::string Text,RGBA fg,int WrapLength)
|
||||||
|
{
|
||||||
|
Surface surf;
|
||||||
|
surf.surf.reset(TTF_RenderText_Blended_Wrapped(font.get(),Text.c_str(),fg.toSDLColor(),WrapLength));
|
||||||
|
return rnd.render(surf);
|
||||||
|
}
|
||||||
|
Texture renderTextShaded(Renderer rnd,std::string Text,RGBA fg,RGBA bg)
|
||||||
|
{
|
||||||
|
Surface surf;
|
||||||
|
surf.surf.reset(TTF_RenderText_Shaded(font.get(),Text.c_str(),fg.toSDLColor(),bg.toSDLColor()));
|
||||||
|
return rnd.render(surf);
|
||||||
|
}
|
||||||
|
Texture renderTextSolid(Renderer rnd,std::string Text,RGBA fg)
|
||||||
|
{
|
||||||
|
Surface surf;
|
||||||
|
surf.surf.reset(TTF_RenderText_Solid(font.get(),Text.c_str(),fg.toSDLColor()));
|
||||||
|
return rnd.render(surf);
|
||||||
|
}
|
||||||
|
|
||||||
Texture renderUTF8(Renderer rnd, std::string Text, RGBA fg)
|
Texture renderUTF8(Renderer rnd, std::string Text, RGBA fg)
|
||||||
{
|
{
|
||||||
Surface surf;
|
Surface surf;
|
||||||
surf.surf.reset(TTF_RenderUTF8_Blended(font.get(), Text.c_str(), fg.toSDLColor()));
|
surf.surf.reset(TTF_RenderUTF8_Blended(font.get(), Text.c_str(), fg.toSDLColor()));
|
||||||
Texture t = rnd.render(surf);
|
return rnd.render(surf);
|
||||||
return t;
|
}
|
||||||
|
Texture renderUTF8Wrapped(Renderer rnd,std::string Text,RGBA fg,int WrapLength)
|
||||||
|
{
|
||||||
|
Surface surf;
|
||||||
|
surf.surf.reset(TTF_RenderUTF8_Blended_Wrapped(font.get(),Text.c_str(),fg.toSDLColor(),WrapLength));
|
||||||
|
return rnd.render(surf);
|
||||||
|
}
|
||||||
|
Texture renderUTF8Shaded(Renderer rnd,std::string Text,RGBA fg,RGBA bg)
|
||||||
|
{
|
||||||
|
Surface surf;
|
||||||
|
surf.surf.reset(TTF_RenderUTF8_Shaded(font.get(),Text.c_str(),fg.toSDLColor(),bg.toSDLColor()));
|
||||||
|
return rnd.render(surf);
|
||||||
|
}
|
||||||
|
Texture renderUTF8Solid(Renderer rnd,std::string Text,RGBA fg)
|
||||||
|
{
|
||||||
|
Surface surf;
|
||||||
|
surf.surf.reset(TTF_RenderUTF8_Solid(font.get(),Text.c_str(),fg.toSDLColor()));
|
||||||
|
return rnd.render(surf);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<TTF_Font> font;
|
std::shared_ptr<TTF_Font> font;
|
||||||
|
@ -979,19 +1018,18 @@ void Loop(Renderer& rnd)
|
||||||
|
|
||||||
}/// End of namespace MiniEngine
|
}/// End of namespace MiniEngine
|
||||||
|
|
||||||
namespace App
|
|
||||||
{
|
|
||||||
|
|
||||||
int main(int argc,char* argv[]);
|
/// Your Program Should Start Here
|
||||||
|
int AppMain();
|
||||||
}/// End of namespace App
|
|
||||||
|
|
||||||
|
|
||||||
/// Default Setup Code
|
/// Default Setup Code
|
||||||
int main(int argc,char* argv[])
|
int main(int argc,char* argv[])
|
||||||
{
|
{
|
||||||
MiniEngine::SDLSystem::Init();
|
MiniEngine::SDLSystem::Init();
|
||||||
int ret=App::main(argc,argv);
|
int ret=AppMain();
|
||||||
MiniEngine::SDLSystem::Quit();
|
MiniEngine::SDLSystem::Quit();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user