Add Clipboard Support

This commit is contained in:
Kirigaya Kazuto 2017-05-22 18:27:56 +08:00
parent ee8780fe30
commit 08a858acf0
2 changed files with 29 additions and 0 deletions

View File

@ -2074,6 +2074,31 @@ namespace MiniEngine
delete pimpl;
}
int SetClipboardText(const std::string& str)
{
return SDL_SetClipboardText(str.c_str());
}
std::string GetClipboardText()
{
char* pstr=SDL_GetClipboardText();
if(pstr==nullptr)
{
return std::string();
}
else
{
std::string s(pstr);
SDL_free(pstr);
return s;
}
}
bool HasClipboardText()
{
return SDL_HasClipboardText()==SDL_TRUE;
}
}/// End of namespace MiniEngine
/// The Following Functions are not avaliable in Visual Studio

View File

@ -650,6 +650,10 @@ namespace MiniEngine
impl* pimpl;
};
int SetClipboardText(const std::string& str);
std::string GetClipboardText();
bool HasClipboardText();
}/// End of namespace MiniEngine
std::string UTF8ToGBK(std::string UTF8String);