mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-21 12:17:12 +01:00
Update the Circle type to use the new dynamic dispatching system for metamethods.
This commit is contained in:
parent
67e8fa650f
commit
64ed87f4b4
@ -1,6 +1,7 @@
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#include "Base/Circle.hpp"
|
#include "Base/Circle.hpp"
|
||||||
#include "Base/Shared.hpp"
|
#include "Base/Shared.hpp"
|
||||||
|
#include "Base/DynArg.hpp"
|
||||||
#include "Library/Numeric/Random.hpp"
|
#include "Library/Numeric/Random.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
@ -558,13 +559,13 @@ void Register_Circle(HSQUIRRELVM vm)
|
|||||||
// Core Meta-methods
|
// Core Meta-methods
|
||||||
.Func(_SC("_tostring"), &Circle::ToString)
|
.Func(_SC("_tostring"), &Circle::ToString)
|
||||||
.SquirrelFunc(_SC("_typename"), &Circle::Typename)
|
.SquirrelFunc(_SC("_typename"), &Circle::Typename)
|
||||||
.Func(_SC("_cmp"), &Circle::Cmp)
|
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Circle >, SQFloat, SQInteger, bool, std::nullptr_t, Circle >)
|
||||||
// Meta-methods
|
// Meta-methods
|
||||||
.Func< Circle (Circle::*)(const Circle &) const >(_SC("_add"), &Circle::operator +)
|
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Circle >, SQFloat, SQInteger, bool, std::nullptr_t, Circle >)
|
||||||
.Func< Circle (Circle::*)(const Circle &) const >(_SC("_sub"), &Circle::operator -)
|
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Circle >, SQFloat, SQInteger, bool, std::nullptr_t, Circle >)
|
||||||
.Func< Circle (Circle::*)(const Circle &) const >(_SC("_mul"), &Circle::operator *)
|
.SquirrelFunc(_SC("_mul"), &SqDynArgFwd< SqDynArgMulFn< Circle >, SQFloat, SQInteger, bool, std::nullptr_t, Circle >)
|
||||||
.Func< Circle (Circle::*)(const Circle &) const >(_SC("_div"), &Circle::operator /)
|
.SquirrelFunc(_SC("_div"), &SqDynArgFwd< SqDynArgDivFn< Circle >, SQFloat, SQInteger, bool, std::nullptr_t, Circle >)
|
||||||
.Func< Circle (Circle::*)(const Circle &) const >(_SC("_modulo"), &Circle::operator %)
|
.SquirrelFunc(_SC("_modulo"), &SqDynArgFwd< SqDynArgModFn< Circle >, SQFloat, SQInteger, bool, std::nullptr_t, Circle >)
|
||||||
.Func< Circle (Circle::*)(void) const >(_SC("_unm"), &Circle::operator -)
|
.Func< Circle (Circle::*)(void) const >(_SC("_unm"), &Circle::operator -)
|
||||||
// Properties
|
// Properties
|
||||||
.Prop(_SC("Abs"), &Circle::Abs)
|
.Prop(_SC("Abs"), &Circle::Abs)
|
||||||
|
@ -306,6 +306,30 @@ struct Circle
|
|||||||
*/
|
*/
|
||||||
Int32 Cmp(const Circle & c) const;
|
Int32 Cmp(const Circle & c) const;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Used by the script engine to compare an instance of this type with a scalar value.
|
||||||
|
*/
|
||||||
|
Int32 Cmp(Value s) const
|
||||||
|
{
|
||||||
|
return Cmp(Circle(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Used by the script engine to compare an instance of this type with a scalar value.
|
||||||
|
*/
|
||||||
|
Int32 Cmp(Int32 s) const
|
||||||
|
{
|
||||||
|
return Cmp(Circle(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(Circle(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