Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro.

This commit is contained in:
Vincent Gee 2014-11-03 22:42:51 -05:00
parent 378a933894
commit acb192e2a5
133 changed files with 1716 additions and 2087 deletions

View file

@ -21,6 +21,7 @@
//-----------------------------------------------------------------------------
#include "console/console.h"
#include "console/engineAPI.h"
#include "console/consoleTypes.h"
#include "terrain/terrData.h"
#include "gui/worldEditor/guiTerrPreviewCtrl.h"
@ -87,41 +88,35 @@ void GuiTerrPreviewCtrl::initPersistFields()
}
ConsoleMethod( GuiTerrPreviewCtrl, reset, void, 2, 2, "Reset the view of the terrain.")
DefineConsoleMethod( GuiTerrPreviewCtrl, reset, void, (), , "Reset the view of the terrain.")
{
object->reset();
}
ConsoleMethod( GuiTerrPreviewCtrl, setRoot, void, 2, 2, "Add the origin to the root and reset the origin.")
DefineConsoleMethod( GuiTerrPreviewCtrl, setRoot, void, (), , "Add the origin to the root and reset the origin.")
{
object->setRoot();
}
ConsoleMethod( GuiTerrPreviewCtrl, getRoot, const char *, 2, 2, "Return a Point2F representing the position of the root.")
DefineConsoleMethod( GuiTerrPreviewCtrl, getRoot, Point2F, (), , "Return a Point2F representing the position of the root.")
{
Point2F p = object->getRoot();
return object->getRoot();
static char rootbuf[32];
dSprintf(rootbuf,sizeof(rootbuf),"%g %g", p.x, -p.y);
return rootbuf;
}
ConsoleMethod( GuiTerrPreviewCtrl, setOrigin, void, 4, 4, "(float x, float y)"
DefineConsoleMethod( GuiTerrPreviewCtrl, setOrigin, void, (Point2F pos), , "(float x, float y)"
"Set the origin of the view.")
{
object->setOrigin( Point2F( dAtof(argv[2]), -dAtof(argv[3]) ) );
object->setOrigin( pos );
}
ConsoleMethod( GuiTerrPreviewCtrl, getOrigin, const char*, 2, 2, "Return a Point2F containing the position of the origin.")
DefineConsoleMethod( GuiTerrPreviewCtrl, getOrigin, Point2F, (), , "Return a Point2F containing the position of the origin.")
{
Point2F p = object->getOrigin();
return object->getOrigin();
static char originbuf[32];
dSprintf(originbuf,sizeof(originbuf),"%g %g", p.x, -p.y);
return originbuf;
}
ConsoleMethod( GuiTerrPreviewCtrl, getValue, const char*, 2, 2, "Returns a 4-tuple containing: root_x root_y origin_x origin_y")
DefineConsoleMethod( GuiTerrPreviewCtrl, getValue, const char*, (), , "Returns a 4-tuple containing: root_x root_y origin_x origin_y")
{
Point2F r = object->getRoot();
Point2F o = object->getOrigin();
@ -131,11 +126,11 @@ ConsoleMethod( GuiTerrPreviewCtrl, getValue, const char*, 2, 2, "Returns a 4-tup
return valuebuf;
}
ConsoleMethod( GuiTerrPreviewCtrl, setValue, void, 3, 3, "Accepts a 4-tuple in the same form as getValue returns.\n\n"
DefineConsoleMethod( GuiTerrPreviewCtrl, setValue, void, (const char * tuple), , "Accepts a 4-tuple in the same form as getValue returns.\n\n"
"@see GuiTerrPreviewCtrl::getValue()")
{
Point2F r,o;
dSscanf(argv[2],"%g %g %g %g", &r.x, &r.y, &o.x, &o.y);
dSscanf(tuple, "%g %g %g %g", &r.x, &r.y, &o.x, &o.y);
r.y = -r.y;
o.y = -o.y;
object->reset();