commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
122
include/modules/script_squirrel/cobject/uv_impl.cpp
Normal file
122
include/modules/script_squirrel/cobject/uv_impl.cpp
Normal file
@ -0,0 +1,122 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "script_squirrel/cobject/uv_decl.h"
|
||||
#include "script_squirrel/cobject/vector_decl.h"
|
||||
|
||||
using namespace GS;
|
||||
|
||||
#ifndef _T
|
||||
#define _T
|
||||
#endif
|
||||
|
||||
|
||||
_IMPL_NATIVE_CONSTRUCTION(UV, GS::Vector2);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
_MEMBER_FUNCTION_IMPL(UV, constructor)
|
||||
Vector2 temp;
|
||||
int nparams = sa.GetParamCount();
|
||||
|
||||
switch (nparams)
|
||||
{
|
||||
case 1: temp.Set(0, 0); break;
|
||||
case 2:
|
||||
if (sa.GetType(2) == OT_INSTANCE)
|
||||
{
|
||||
_GetTypedParam(uv, 2, Vector2, UV);
|
||||
if (uv)
|
||||
temp = *uv;
|
||||
else return sa.ThrowError("Invalid instance type");
|
||||
}
|
||||
else temp.Set(sa.GetFloat(2), 0);
|
||||
break;
|
||||
case 3: temp.Set(sa.GetFloat(2), sa.GetFloat(3)); break;
|
||||
|
||||
default:
|
||||
return sa.ThrowError("Wrong parameter count");
|
||||
}
|
||||
return construct_UV(v, new Vector2(temp));
|
||||
_END_IMPL
|
||||
|
||||
_MEMBER_FUNCTION_IMPL(UV, _cloned)
|
||||
_GetTypedParam(uv, 2, Vector2, UV);
|
||||
return construct_UV(v, new Vector2(*uv));
|
||||
_END_IMPL
|
||||
|
||||
_MEMBER_FUNCTION_IMPL(UV, _set)
|
||||
_GetSelf(Vector2, UV);
|
||||
|
||||
const SQChar *s = sa.GetString(2);
|
||||
int index = s ? s[0] : sa.GetInt(2);
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0: case 'u': case 'x':
|
||||
return sa.Return(self->x = sa.GetFloat(3));
|
||||
case 1: case 'v': case 'y':
|
||||
return sa.Return(self->y = sa.GetFloat(3));
|
||||
}
|
||||
return SQ_ERROR;
|
||||
_END_IMPL
|
||||
|
||||
_MEMBER_FUNCTION_IMPL(UV, _get)
|
||||
_GetSelf(Vector2, UV);
|
||||
const SQChar *s = sa.GetString(2);
|
||||
if (s && (s[1] != 0))
|
||||
return SQ_ERROR;
|
||||
int index = s && (s[1] == 0) ? s[0] : sa.GetInt(2);
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0: case 'u': case 'x':
|
||||
return sa.Return(self->x);
|
||||
case 1: case 'v': case 'y':
|
||||
return sa.Return(self->y);
|
||||
}
|
||||
return SQ_ERROR;
|
||||
_END_IMPL
|
||||
|
||||
_MEMBER_FUNCTION_IMPL(UV, Set)
|
||||
_GetSelf(Vector2, UV);
|
||||
switch (sa.GetParamCount())
|
||||
{
|
||||
case 1: self->Set(0, 0); break;
|
||||
case 2: self->Set(sa.GetFloat(2), 0); break;
|
||||
case 3: self->Set(sa.GetFloat(2), sa.GetFloat(3)); break;
|
||||
default:
|
||||
return sa.ThrowError("Wrong parameter count");
|
||||
}
|
||||
return 0;
|
||||
_END_IMPL
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/*#
|
||||
Topic: UV
|
||||
Type: UV
|
||||
#*/
|
||||
|
||||
/*#
|
||||
Section: UVGeneric
|
||||
Desc: Generic
|
||||
#*/
|
||||
_BEGIN_CLASS(UV)
|
||||
|
||||
_MEMBER_FUNCTION(UV, constructor, -1, _T(".n|xn"))
|
||||
_MEMBER_FUNCTION(UV, _cloned, 2, _T(".x"))
|
||||
_MEMBER_FUNCTION(UV, _set, 3, _T("xs|n"))
|
||||
_MEMBER_FUNCTION(UV, _get, 2, _T("xs|n"))
|
||||
|
||||
/*#
|
||||
Func: Set
|
||||
Proto: void:float x = 0,float y = 0
|
||||
Desc: Set UV values.
|
||||
#*/
|
||||
_MEMBER_FUNCTION(UV, Set, -1, _T("xnn"))
|
||||
|
||||
_END_CLASS(UV)
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user