mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge pull request #218 from DavidWyand-GG/ConsoleTypePoint3I
New console type for Point3I
This commit is contained in:
commit
5d6751cdd4
|
|
@ -55,6 +55,15 @@ IMPLEMENT_STRUCT( Point2F,
|
|||
FIELD( x, x, 1, "X coordinate." )
|
||||
FIELD( y, y, 1, "Y coordinate." )
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
IMPLEMENT_STRUCT( Point3I,
|
||||
Point3I, MathTypes,
|
||||
"" )
|
||||
|
||||
FIELD( x, x, 1, "X coordinate." )
|
||||
FIELD( y, y, 1, "Y coordinate." )
|
||||
FIELD( z, z, 1, "Z coordinate." )
|
||||
|
||||
END_IMPLEMENT_STRUCT;
|
||||
IMPLEMENT_STRUCT( Point3F,
|
||||
Point3F, MathTypes,
|
||||
|
|
@ -153,6 +162,30 @@ ConsoleSetType( TypePoint2F )
|
|||
Con::printf("Point2F must be set as { x, y } or \"x y\"");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// TypePoint3I
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleType( Point3I, TypePoint3I, Point3I )
|
||||
ImplementConsoleTypeCasters(TypePoint3I, Point3I)
|
||||
|
||||
ConsoleGetType( TypePoint3I )
|
||||
{
|
||||
Point3I *pt = (Point3I *) dptr;
|
||||
char* returnBuffer = Con::getReturnBuffer(256);
|
||||
dSprintf(returnBuffer, 256, "%d %d %d", pt->x, pt->y, pt->z);
|
||||
return returnBuffer;
|
||||
}
|
||||
|
||||
ConsoleSetType( TypePoint3I )
|
||||
{
|
||||
if(argc == 1)
|
||||
dSscanf(argv[0], "%d %d %d", &((Point3I *) dptr)->x, &((Point3I *) dptr)->y, &((Point3I *) dptr)->z);
|
||||
else if(argc == 3)
|
||||
*((Point3I *) dptr) = Point3I(dAtoi(argv[0]), dAtoi(argv[1]), dAtoi(argv[2]));
|
||||
else
|
||||
Con::printf("Point3I must be set as { x, y, z } or \"x y z\"");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// TypePoint3F
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ void RegisterMathFunctions(void);
|
|||
|
||||
class Point2I;
|
||||
class Point2F;
|
||||
class Point3I;
|
||||
class Point3F;
|
||||
class Point4F;
|
||||
class RectI;
|
||||
|
|
@ -49,6 +50,7 @@ DECLARE_SCOPE( MathTypes );
|
|||
|
||||
DECLARE_STRUCT( Point2I );
|
||||
DECLARE_STRUCT( Point2F );
|
||||
DECLARE_STRUCT( Point3I );
|
||||
DECLARE_STRUCT( Point3F );
|
||||
DECLARE_STRUCT( Point4F );
|
||||
DECLARE_STRUCT( RectI );
|
||||
|
|
@ -63,6 +65,7 @@ DECLARE_STRUCT( EaseF );
|
|||
// Legacy console types.
|
||||
DefineConsoleType( TypePoint2I, Point2I )
|
||||
DefineConsoleType( TypePoint2F, Point2F )
|
||||
DefineConsoleType( TypePoint3I, Point3I )
|
||||
DefineConsoleType( TypePoint3F, Point3F )
|
||||
DefineConsoleType( TypePoint4F, Point4F )
|
||||
DefineConsoleType( TypeRectI, RectI )
|
||||
|
|
|
|||
Loading…
Reference in a new issue