Move clipboard functions to SDLSystem

This commit is contained in:
Kirigaya Kazuto 2017-07-01 15:39:51 +08:00
parent 5eb66f6d0d
commit 46204ba517
2 changed files with 33 additions and 0 deletions

View File

@ -244,4 +244,33 @@ int SDLSystem::GetSystemRAM()
{ {
return SDL_GetSystemRAM(); return SDL_GetSystemRAM();
} }
//static
int SDLSystem::SetClipboardText(const std::string& str)
{
return SDL_SetClipboardText(str.c_str());
}
//static
std::string SDLSystem::GetClipboardText()
{
char* pstr=SDL_GetClipboardText();
if(pstr==nullptr)
{
return std::string();
}
else
{
std::string s(pstr);
SDL_free(pstr);
return s;
}
}
//static
bool SDLSystem::HasClipboardText()
{
return SDL_HasClipboardText()==SDL_TRUE;
}
#include "end_code.h" #include "end_code.h"

View File

@ -52,6 +52,10 @@ public:
/// RAM is calculated in MB. /// RAM is calculated in MB.
static int GetSystemRAM(); static int GetSystemRAM();
static int SetClipboardText(const std::string& str);
static std::string GetClipboardText();
static bool HasClipboardText();
class Android class Android
{ {
public: public: