mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-22 17:17:17 +01:00
Ported: Add Color + alpha constructor for Color
- timothyqiu
3544cd1dad
This commit is contained in:
parent
381aa1a140
commit
464b0b5e08
@ -1831,11 +1831,8 @@ struct _VariantCall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void Color_init3(Variant &r_ret, const Variant **p_args) {
|
static void Color_init3(Variant &r_ret, const Variant **p_args) {
|
||||||
r_ret = Color::html(*p_args[0]);
|
Color c = *p_args[0];
|
||||||
}
|
r_ret = Color(c.r, c.g, c.b, *p_args[1]);
|
||||||
|
|
||||||
static void Color_init4(Variant &r_ret, const Variant **p_args) {
|
|
||||||
r_ret = Color::hex(*p_args[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_constructor(VariantConstructFunc p_func, const Variant::Type p_type,
|
static void add_constructor(VariantConstructFunc p_func, const Variant::Type p_type,
|
||||||
@ -3456,6 +3453,7 @@ void register_variant_methods() {
|
|||||||
|
|
||||||
_VariantCall::add_constructor(_VariantCall::Color_init1, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL, "a", Variant::REAL);
|
_VariantCall::add_constructor(_VariantCall::Color_init1, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL, "a", Variant::REAL);
|
||||||
_VariantCall::add_constructor(_VariantCall::Color_init2, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL);
|
_VariantCall::add_constructor(_VariantCall::Color_init2, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL);
|
||||||
|
_VariantCall::add_constructor(_VariantCall::Color_init3, Variant::COLOR, "from", Variant::COLOR, "alpha", Variant::REAL);
|
||||||
|
|
||||||
_VariantCall::add_constructor(_VariantCall::AABB_init1, Variant::AABB, "position", Variant::VECTOR3, "size", Variant::VECTOR3);
|
_VariantCall::add_constructor(_VariantCall::AABB_init1, Variant::AABB, "position", Variant::VECTOR3, "size", Variant::VECTOR3);
|
||||||
|
|
||||||
|
@ -40,6 +40,17 @@
|
|||||||
[/codeblock]
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="Color">
|
||||||
|
<return type="Color" />
|
||||||
|
<argument index="0" name="from" type="Color" />
|
||||||
|
<argument index="1" name="alpha" type="float" />
|
||||||
|
<description>
|
||||||
|
Constructs a color from the existing color, with [member a] set to the given [code]alpha[/code] value.
|
||||||
|
[codeblock]
|
||||||
|
var red = Color(Color.red, 0.2) # 20% opaque red.
|
||||||
|
[/codeblock]
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="Color">
|
<method name="Color">
|
||||||
<return type="Color" />
|
<return type="Color" />
|
||||||
<argument index="0" name="r" type="float" />
|
<argument index="0" name="r" type="float" />
|
||||||
|
Loading…
Reference in New Issue
Block a user