Implement CLIPBOARD

This commit is contained in:
otya128 committed 2016-12-30 20:34:52 +09:00
1 parent a50e50c1e8
commit 537c0c1f75
2 files changed
+26

No files matched your search

+9
View File
@@ -3370,6 +3370,15 @@ class BuiltinFunction
{
p.console.scroll(x, y);
}
static void CLIPBOARD(PetitComputer p, wstring value)
{
p.clipboard = value;
}
static wstring CLIPBOARD(PetitComputer p)
{
return p.clipboard;
}
//alias void function(PetitComputer, Value[], Value[]) BuiltinFunc;
static BuiltinFunctions[wstring] builtinFunctions;
static wstring getBasicName(BFD)(const wstring def)
+17
View File
@@ -1483,6 +1483,7 @@ class PetitComputer
char* cl = SDL_GetClipboardText();
string an = cast(string)(cl[0..core.stdc.string.strlen(cl)]);
ks = an.to!wstring;
SDL_free(cl);
}
}
console.print(ks);
@@ -1668,7 +1669,23 @@ class PetitComputer
{
this.console.initGRPF();
}
}
wstring clipboard()
{
if(SDL_HasClipboardText())
{
char* cl = SDL_GetClipboardText();
string an = cast(string)(cl[0..core.stdc.string.strlen(cl)]);
auto ret = an.to!wstring;
SDL_free(cl);
return ret;
}
return "";
}
void clipboard(wstring ws)
{
SDL_SetClipboardText(ws.to!string.toStringz);
}
//プチコン内部表現はRGB5_A1