Implement CLIPBOARD
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user