mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Implement the pure typename meta-methods in Vector4 type using the standard method.
This commit is contained in:
parent
6860019457
commit
f3a485177b
@ -12,6 +12,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMODE_DECL_TYPENAME(Typename, _SC("Vector4"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const Vector4 Vector4::NIL = Vector4(0);
|
||||
const Vector4 Vector4::MIN = Vector4(std::numeric_limits< Vector4::Value >::min());
|
||||
@ -20,14 +23,6 @@ const Vector4 Vector4::MAX = Vector4(std::numeric_limits< Vector4::Value >::max(
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQChar Vector4::Delim = ',';
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger Vector4::Typename(HSQUIRRELVM vm)
|
||||
{
|
||||
static const SQChar name[] = _SC("Vector4");
|
||||
sq_pushstring(vm, name, sizeof(name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Vector4::Vector4()
|
||||
: x(0.0), y(0.0), z(0.0), w(0.0)
|
||||
@ -543,7 +538,7 @@ void Register_Vector4(HSQUIRRELVM vm)
|
||||
{
|
||||
typedef Vector4::Value Val;
|
||||
|
||||
RootTable(vm).Bind(_SC("Vector4"), Class< Vector4 >(vm, _SC("Vector4"))
|
||||
RootTable(vm).Bind(Typename::Str, Class< Vector4 >(vm, Typename::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< Val >()
|
||||
@ -559,9 +554,9 @@ void Register_Vector4(HSQUIRRELVM vm)
|
||||
.Var(_SC("Z"), &Vector4::z)
|
||||
.Var(_SC("W"), &Vector4::w)
|
||||
// Core Meta-methods
|
||||
.Func(_SC("_tostring"), &Vector4::ToString)
|
||||
.SquirrelFunc(_SC("_typename"), &Vector4::Typename)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Vector4 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector4 >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Vector4::ToString)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Vector4 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector4 >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Vector4 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector4 >)
|
||||
|
@ -296,11 +296,6 @@ struct Vector4
|
||||
*/
|
||||
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