mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-04-19 18:57:12 +02:00
Update the Color3 type to use the new dynamic dispatching system for metamethods.
This commit is contained in:
parent
64ed87f4b4
commit
778b6ea59d
@ -2,6 +2,7 @@
|
|||||||
#include "Base/Color3.hpp"
|
#include "Base/Color3.hpp"
|
||||||
#include "Base/Color4.hpp"
|
#include "Base/Color4.hpp"
|
||||||
#include "Base/Shared.hpp"
|
#include "Base/Shared.hpp"
|
||||||
|
#include "Base/DynArg.hpp"
|
||||||
#include "Library/Numeric/Random.hpp"
|
#include "Library/Numeric/Random.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
@ -732,13 +733,13 @@ void Register_Color3(HSQUIRRELVM vm)
|
|||||||
// Core Meta-methods
|
// Core Meta-methods
|
||||||
.Func(_SC("_tostring"), &Color3::ToString)
|
.Func(_SC("_tostring"), &Color3::ToString)
|
||||||
.SquirrelFunc(_SC("_typename"), &Color3::Typename)
|
.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
|
// Meta-methods
|
||||||
.Func< Color3 (Color3::*)(const Color3 &) const >(_SC("_add"), &Color3::operator +)
|
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >)
|
||||||
.Func< Color3 (Color3::*)(const Color3 &) const >(_SC("_sub"), &Color3::operator -)
|
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >)
|
||||||
.Func< Color3 (Color3::*)(const Color3 &) const >(_SC("_mul"), &Color3::operator *)
|
.SquirrelFunc(_SC("_mul"), &SqDynArgFwd< SqDynArgMulFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >)
|
||||||
.Func< Color3 (Color3::*)(const Color3 &) const >(_SC("_div"), &Color3::operator /)
|
.SquirrelFunc(_SC("_div"), &SqDynArgFwd< SqDynArgDivFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >)
|
||||||
.Func< Color3 (Color3::*)(const Color3 &) const >(_SC("_modulo"), &Color3::operator %)
|
.SquirrelFunc(_SC("_modulo"), &SqDynArgFwd< SqDynArgModFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >)
|
||||||
.Func< Color3 (Color3::*)(void) const >(_SC("_unm"), &Color3::operator -)
|
.Func< Color3 (Color3::*)(void) const >(_SC("_unm"), &Color3::operator -)
|
||||||
// Properties
|
// Properties
|
||||||
.Prop(_SC("RGB"), &Color3::GetRGB, &Color3::SetRGB)
|
.Prop(_SC("RGB"), &Color3::GetRGB, &Color3::SetRGB)
|
||||||
|
@ -369,6 +369,30 @@ struct Color3
|
|||||||
*/
|
*/
|
||||||
Int32 Cmp(const Color3 & c) const;
|
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.
|
* Used by the script engine to convert an instance of this type to a string.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user