mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-22 04:37:13 +01:00
Implement the pure typename meta-methods in AABB type using the standard method.
This commit is contained in:
parent
60d6a96e07
commit
2cce140e1b
@ -7,6 +7,9 @@
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
SQMODE_DECL_TYPENAME(Typename, _SC("AABB"))
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
const AABB AABB::NIL = AABB(0, 0);
|
const AABB AABB::NIL = AABB(0, 0);
|
||||||
const AABB AABB::MIN = AABB(-1, -1, -1, 1, 1, 1);
|
const AABB AABB::MIN = AABB(-1, -1, -1, 1, 1, 1);
|
||||||
@ -15,14 +18,6 @@ const AABB AABB::MAX = AABB(HUGE_VALF, -HUGE_VALF);
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
SQChar AABB::Delim = ',';
|
SQChar AABB::Delim = ',';
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
SQInteger AABB::Typename(HSQUIRRELVM vm)
|
|
||||||
{
|
|
||||||
static const SQChar name[] = _SC("AABB");
|
|
||||||
sq_pushstring(vm, name, sizeof(name));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
AABB::AABB()
|
AABB::AABB()
|
||||||
: min(HUGE_VALF), max(-HUGE_VALF)
|
: min(HUGE_VALF), max(-HUGE_VALF)
|
||||||
@ -822,7 +817,7 @@ void Register_AABB(HSQUIRRELVM vm)
|
|||||||
{
|
{
|
||||||
typedef AABB::Value Val;
|
typedef AABB::Value Val;
|
||||||
|
|
||||||
RootTable(vm).Bind(_SC("AABB"), Class< AABB >(vm, _SC("AABB"))
|
RootTable(vm).Bind(Typename::Str, Class< AABB >(vm, Typename::Str)
|
||||||
// Constructors
|
// Constructors
|
||||||
.Ctor()
|
.Ctor()
|
||||||
.Ctor< const AABB & >()
|
.Ctor< const AABB & >()
|
||||||
@ -835,10 +830,9 @@ void Register_AABB(HSQUIRRELVM vm)
|
|||||||
.Var(_SC("Min"), &AABB::min)
|
.Var(_SC("Min"), &AABB::min)
|
||||||
.Var(_SC("Max"), &AABB::max)
|
.Var(_SC("Max"), &AABB::max)
|
||||||
// Core Meta-methods
|
// Core Meta-methods
|
||||||
.Func(_SC("_tostring"), &AABB::ToString)
|
|
||||||
.SquirrelFunc(_SC("_typename"), &AABB::Typename)
|
|
||||||
// We cannot set _cmp for c++ classes so we use this instead
|
|
||||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< AABB >, SQFloat, SQInteger, bool, std::nullptr_t, AABB >)
|
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< AABB >, SQFloat, SQInteger, bool, std::nullptr_t, AABB >)
|
||||||
|
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||||
|
.Func(_SC("_tostring"), &AABB::ToString)
|
||||||
// Meta-methods
|
// Meta-methods
|
||||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< AABB >, SQFloat, SQInteger, bool, std::nullptr_t, AABB >)
|
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< AABB >, SQFloat, SQInteger, bool, std::nullptr_t, AABB >)
|
||||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< AABB >, SQFloat, SQInteger, bool, std::nullptr_t, AABB >)
|
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< AABB >, SQFloat, SQInteger, bool, std::nullptr_t, AABB >)
|
||||||
|
@ -297,11 +297,6 @@ struct AABB
|
|||||||
*/
|
*/
|
||||||
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 the values extracted from the specified string using the specified delimiter.
|
* Set the values extracted from the specified string using the specified delimiter.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user