mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-21 20:27:13 +01:00
Implement the pure typename meta-methods in Color4 type using the standard method.
This commit is contained in:
parent
dcc323202f
commit
b04b7c6d84
@ -11,6 +11,9 @@
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
SQMODE_DECL_TYPENAME(Typename, _SC("Color4"))
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
const Color4 Color4::NIL = Color4();
|
const Color4 Color4::NIL = Color4();
|
||||||
const Color4 Color4::MIN = Color4(std::numeric_limits< Color4::Value >::min());
|
const Color4 Color4::MIN = Color4(std::numeric_limits< Color4::Value >::min());
|
||||||
@ -19,14 +22,6 @@ const Color4 Color4::MAX = Color4(std::numeric_limits< Color4::Value >::max());
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
SQChar Color4::Delim = ',';
|
SQChar Color4::Delim = ',';
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
SQInteger Color4::Typename(HSQUIRRELVM vm)
|
|
||||||
{
|
|
||||||
static const SQChar name[] = _SC("Color4");
|
|
||||||
sq_pushstring(vm, name, sizeof(name));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Color4::Color4()
|
Color4::Color4()
|
||||||
: r(0), g(0), b(0), a(0)
|
: r(0), g(0), b(0), a(0)
|
||||||
@ -762,7 +757,7 @@ void Register_Color4(HSQUIRRELVM vm)
|
|||||||
{
|
{
|
||||||
typedef Color4::Value Val;
|
typedef Color4::Value Val;
|
||||||
|
|
||||||
RootTable(vm).Bind(_SC("Color4"), Class< Color4 >(vm, _SC("Color4"))
|
RootTable(vm).Bind(Typename::Str, Class< Color4 >(vm, Typename::Str)
|
||||||
// Constructors
|
// Constructors
|
||||||
.Ctor()
|
.Ctor()
|
||||||
.Ctor< Val >()
|
.Ctor< Val >()
|
||||||
@ -778,9 +773,9 @@ void Register_Color4(HSQUIRRELVM vm)
|
|||||||
.Var(_SC("B"), &Color4::b)
|
.Var(_SC("B"), &Color4::b)
|
||||||
.Var(_SC("A"), &Color4::a)
|
.Var(_SC("A"), &Color4::a)
|
||||||
// Core Meta-methods
|
// Core Meta-methods
|
||||||
.Func(_SC("_tostring"), &Color4::ToString)
|
|
||||||
.SquirrelFunc(_SC("_typename"), &Color4::Typename)
|
|
||||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
|
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
|
||||||
|
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||||
|
.Func(_SC("_tostring"), &Color4::ToString)
|
||||||
// Meta-methods
|
// Meta-methods
|
||||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
|
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
|
||||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
|
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
|
||||||
|
@ -406,11 +406,6 @@ struct Color4
|
|||||||
*/
|
*/
|
||||||
CSStr ToString() const;
|
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.
|
* Set all components to the specified scalar value.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user