This commit is contained in:
Adam D. Ruppe 2018-11-23 19:57:22 -05:00
parent 0d2caa735b
commit 5e6e03537e
2 changed files with 10 additions and 4 deletions

View File

@ -1722,7 +1722,7 @@ WrappedNativeObject wrapNativeObject(Class)(Class obj) if(is(Class == class)) {
} }
import std.traits; import std.traits;
class WrappedOpaque(T) : PrototypeObject if(isPointer!T) { class WrappedOpaque(T) : PrototypeObject if(isPointer!T || is(T == class)) {
T wrapped; T wrapped;
this(T t) { this(T t) {
wrapped = t; wrapped = t;
@ -1731,7 +1731,7 @@ class WrappedOpaque(T) : PrototypeObject if(isPointer!T) {
return wrapped; return wrapped;
} }
} }
class WrappedOpaque(T) : PrototypeObject if(!isPointer!T) { class WrappedOpaque(T) : PrototypeObject if(!isPointer!T && !is(T == class)) {
T* wrapped; T* wrapped;
this(T t) { this(T t) {
wrapped = new T; wrapped = new T;

View File

@ -109,8 +109,14 @@ void loadMiniguiPublicClasses() {
Parameters!(__traits(getMember, Member, "__ctor")) params; Parameters!(__traits(getMember, Member, "__ctor")) params;
foreach(idx, param; params[0 .. $-1]) { foreach(idx, param; params[0 .. $-1]) {
if(auto arg = paramNames[idx] in args) if(auto arg = paramNames[idx] in args) {
params[idx] = to!(typeof(param))(*arg); static if(is(typeof(param) == MemoryImage)) {
} else static if(is(typeof(param) == Color)) {
params[idx] = Color.fromString(*arg);
} else
params[idx] = to!(typeof(param))(*arg);
}
} }
params[$-1] = parent; params[$-1] = parent;