diff --git a/source/Base/Color3.cpp b/source/Base/Color3.cpp index fbc01e0b..f8dc0f4e 100644 --- a/source/Base/Color3.cpp +++ b/source/Base/Color3.cpp @@ -2,6 +2,7 @@ #include "Base/Color3.hpp" #include "Base/Color4.hpp" #include "Base/Shared.hpp" +#include "Base/DynArg.hpp" #include "Library/Numeric/Random.hpp" // ------------------------------------------------------------------------------------------------ @@ -732,13 +733,13 @@ void Register_Color3(HSQUIRRELVM vm) // Core Meta-methods .Func(_SC("_tostring"), &Color3::ToString) .SquirrelFunc(_SC("_typename"), &Color3::Typename) - .Func(_SC("_cmp"), &Color3::Cmp) + .SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >) // Meta-methods - .Func< Color3 (Color3::*)(const Color3 &) const >(_SC("_add"), &Color3::operator +) - .Func< Color3 (Color3::*)(const Color3 &) const >(_SC("_sub"), &Color3::operator -) - .Func< Color3 (Color3::*)(const Color3 &) const >(_SC("_mul"), &Color3::operator *) - .Func< Color3 (Color3::*)(const Color3 &) const >(_SC("_div"), &Color3::operator /) - .Func< Color3 (Color3::*)(const Color3 &) const >(_SC("_modulo"), &Color3::operator %) + .SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >) + .SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >) + .SquirrelFunc(_SC("_mul"), &SqDynArgFwd< SqDynArgMulFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >) + .SquirrelFunc(_SC("_div"), &SqDynArgFwd< SqDynArgDivFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >) + .SquirrelFunc(_SC("_modulo"), &SqDynArgFwd< SqDynArgModFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >) .Func< Color3 (Color3::*)(void) const >(_SC("_unm"), &Color3::operator -) // Properties .Prop(_SC("RGB"), &Color3::GetRGB, &Color3::SetRGB) diff --git a/source/Base/Color3.hpp b/source/Base/Color3.hpp index fbc2632c..5dc09afe 100644 --- a/source/Base/Color3.hpp +++ b/source/Base/Color3.hpp @@ -369,6 +369,30 @@ struct Color3 */ Int32 Cmp(const Color3 & c) const; + /* -------------------------------------------------------------------------------------------- + * Used by the script engine to compare an instance of this type with a scalar value. + */ + Int32 Cmp(Int32 s) const + { + return Cmp(Color3(static_cast< Value >(s))); + } + + /* -------------------------------------------------------------------------------------------- + * Used by the script engine to compare an instance of this type with a scalar value. + */ + Int32 Cmp(Float32 s) const + { + return Cmp(Color3(static_cast< Value >(s))); + } + + /* -------------------------------------------------------------------------------------------- + * Used by the script engine to compare an instance of this type with a scalar value. + */ + Int32 Cmp(std::nullptr_t) const + { + return Cmp(Color3(static_cast< Value >(0))); + } + /* -------------------------------------------------------------------------------------------- * Used by the script engine to convert an instance of this type to a string. */