diff options
| author | Bojidar Marinov | 2016-11-10 23:06:00 +0200 |
|---|---|---|
| committer | Rémi Verschelde | 2017-01-12 19:15:27 +0100 |
| commit | 85585c7fc5ef314d42fcc7b28583b22aaff424be (patch) | |
| tree | 85b10fddb5c8b6af2a39ba8e4fc8ff3c00e25377 /modules/gdscript/gd_functions.cpp | |
| parent | c5bff5073e04a6ee1dea0a965185b2b2a1c80036 (diff) | |
| download | godot-85585c7fc5ef314d42fcc7b28583b22aaff424be.tar.gz godot-85585c7fc5ef314d42fcc7b28583b22aaff424be.tar.zst godot-85585c7fc5ef314d42fcc7b28583b22aaff424be.zip | |
Diffstat (limited to 'modules/gdscript/gd_functions.cpp')
| -rw-r--r-- | modules/gdscript/gd_functions.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index e224ce471..507e6b768 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -104,6 +104,7 @@ const char *GDFunctions::get_func_name(Function p_func) { "dict2inst", "hash", "Color8", + "ColorN", "print_stack", "instance_from_id", }; @@ -1054,6 +1055,36 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va r_ret=color; } break; + case COLORN: { + + if (p_arg_count<1) { + r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.argument=1; + r_ret=Variant(); + return; + } + + if (p_arg_count>2) { + r_error.error=Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.argument=2; + r_ret=Variant(); + return; + } + + if (p_args[0]->get_type()!=Variant::STRING) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_ret=Variant(); + } else { + Color color = Color::named(*p_args[0]); + if (p_arg_count==2) { + VALIDATE_ARG_NUM(1); + color.a=*p_args[1]; + } + r_ret=color; + } + + } break; case PRINT_STACK: { @@ -1507,6 +1538,12 @@ MethodInfo GDFunctions::get_info(Function p_func) { mi.return_val.type=Variant::COLOR; return mi; } break; + case COLORN: { + + MethodInfo mi("ColorN",PropertyInfo(Variant::STRING,"name"),PropertyInfo(Variant::REAL,"alpha")); + mi.return_val.type=Variant::COLOR; + return mi; + } break; case PRINT_STACK: { MethodInfo mi("print_stack"); |
