mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Implement the pure typename meta-methods in Color3 type using the standard method.
This commit is contained in:
parent
8d5efe524e
commit
dcc323202f
@ -11,6 +11,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMODE_DECL_TYPENAME(Typename, _SC("Color3"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const Color3 Color3::NIL = Color3();
|
||||
const Color3 Color3::MIN = Color3(std::numeric_limits< Color3::Value >::min());
|
||||
@ -19,14 +22,6 @@ const Color3 Color3::MAX = Color3(std::numeric_limits< Color3::Value >::max());
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQChar Color3::Delim = ',';
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger Color3::Typename(HSQUIRRELVM vm)
|
||||
{
|
||||
static const SQChar name[] = _SC("Color3");
|
||||
sq_pushstring(vm, name, sizeof(name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Color3::Color3()
|
||||
: r(0), g(0), b(0)
|
||||
@ -717,7 +712,7 @@ void Register_Color3(HSQUIRRELVM vm)
|
||||
{
|
||||
typedef Color3::Value Val;
|
||||
|
||||
RootTable(vm).Bind(_SC("Color3"), Class< Color3 >(vm, _SC("Color3"))
|
||||
RootTable(vm).Bind(Typename::Str, Class< Color3 >(vm, Typename::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< Val >()
|
||||
@ -731,9 +726,9 @@ void Register_Color3(HSQUIRRELVM vm)
|
||||
.Var(_SC("G"), &Color3::g)
|
||||
.Var(_SC("B"), &Color3::b)
|
||||
// Core Meta-methods
|
||||
.Func(_SC("_tostring"), &Color3::ToString)
|
||||
.SquirrelFunc(_SC("_typename"), &Color3::Typename)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Color3::ToString)
|
||||
// Meta-methods
|
||||
.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 >)
|
||||
|
@ -406,11 +406,6 @@ struct Color3
|
||||
*/
|
||||
CSStr ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to retrieve the name from instances of this type.
|
||||
*/
|
||||
static SQInteger Typename(HSQUIRRELVM vm);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set all components to the specified scalar value.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user