aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx/graphicengine_script.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2010-10-19 20:51:21 +0000
committerEugene Sandulenko2010-10-19 20:51:21 +0000
commitd94435eebd8ab8e21a4a28a0274cae02910cb41d (patch)
treeed9986a645ad2a5d7c24c5c8763c81e1586c32c0 /engines/sword25/gfx/graphicengine_script.cpp
parent0d1d4818947c085cb3714b73024738cb99f5fca9 (diff)
downloadscummvm-rg350-d94435eebd8ab8e21a4a28a0274cae02910cb41d.tar.gz
scummvm-rg350-d94435eebd8ab8e21a4a28a0274cae02910cb41d.tar.bz2
scummvm-rg350-d94435eebd8ab8e21a4a28a0274cae02910cb41d.zip
SWORD25: Enforce code naming conventions in gfx/graphicengine*
svn-id: r53621
Diffstat (limited to 'engines/sword25/gfx/graphicengine_script.cpp')
-rw-r--r--engines/sword25/gfx/graphicengine_script.cpp1421
1 files changed, 583 insertions, 838 deletions
diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp
index 405bebdf89..e197a40337 100644
--- a/engines/sword25/gfx/graphicengine_script.cpp
+++ b/engines/sword25/gfx/graphicengine_script.cpp
@@ -32,10 +32,6 @@
*
*/
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/common.h"
#include "sword25/kernel/kernel.h"
#include "sword25/kernel/callbackregistry.h"
@@ -57,17 +53,11 @@ namespace Sword25 {
#define BS_LOG_PREFIX "GRAPHICENGINE"
-// -----------------------------------------------------------------------------
-// Callback-Objekte
-// -----------------------------------------------------------------------------
-
-static bool AnimationDeleteCallback(uint Data);
-static bool AnimationActionCallback(uint Data);
-static bool AnimationLoopPointCallback(uint Data);
+static bool animationDeleteCallback(uint Data);
+static bool animationActionCallback(uint Data);
+static bool animationLoopPointCallback(uint Data);
namespace {
-// -------------------------------------------------------------------------
-
class ActionCallback : public LuaCallback {
public:
ActionCallback(lua_State *L) : LuaCallback(L) {}
@@ -81,25 +71,19 @@ protected:
}
};
-Common::ScopedPtr<LuaCallback> LoopPointCallbackPtr;
-Common::ScopedPtr<ActionCallback> ActionCallbackPtr;
-
-// -------------------------------------------------------------------------
+Common::ScopedPtr<LuaCallback> loopPointCallbackPtr;
+Common::ScopedPtr<ActionCallback> actionCallbackPtr;
struct CallbackfunctionRegisterer {
CallbackfunctionRegisterer() {
- CallbackRegistry::instance().registerCallbackFunction("LuaLoopPointCB", (void ( *)(int))AnimationLoopPointCallback);
- CallbackRegistry::instance().registerCallbackFunction("LuaActionCB", (void ( *)(int))AnimationActionCallback);
- CallbackRegistry::instance().registerCallbackFunction("LuaDeleteCB", (void ( *)(int))AnimationDeleteCallback);
+ CallbackRegistry::instance().registerCallbackFunction("LuaLoopPointCB", (void ( *)(int))animationLoopPointCallback);
+ CallbackRegistry::instance().registerCallbackFunction("LuaActionCB", (void ( *)(int))animationActionCallback);
+ CallbackRegistry::instance().registerCallbackFunction("LuaDeleteCB", (void ( *)(int))animationDeleteCallback);
}
};
static CallbackfunctionRegisterer Instance;
}
-// -----------------------------------------------------------------------------
-// Constants
-// -----------------------------------------------------------------------------
-
// Die Strings werden als #defines definiert um Stringkomposition zur Compilezeit zu ermöglichen.
#define RENDEROBJECT_CLASS_NAME "Gfx.RenderObject"
#define BITMAP_CLASS_NAME "Gfx.Bitmap"
@@ -109,8 +93,6 @@ static CallbackfunctionRegisterer Instance;
#define ANIMATION_TEMPLATE_CLASS_NAME "Gfx.AnimationTemplate"
static const char *GFX_LIBRARY_NAME = "Gfx";
-// -----------------------------------------------------------------------------
-
// Wie luaL_checkudata, nur ohne dass kein Fehler erzeugt wird.
static void *my_checkudata(lua_State *L, int ud, const char *tname) {
int top = lua_gettop(L);
@@ -131,23 +113,19 @@ static void *my_checkudata(lua_State *L, int ud, const char *tname) {
return NULL;
}
-// -----------------------------------------------------------------------------
-
-static void NewUintUserData(lua_State *L, uint Value) {
- void *UserData = lua_newuserdata(L, sizeof(Value));
- memcpy(UserData, &Value, sizeof(Value));
+static void newUintUserData(lua_State *L, uint value) {
+ void *userData = lua_newuserdata(L, sizeof(value));
+ memcpy(userData, &value, sizeof(value));
}
-// -----------------------------------------------------------------------------
-
-static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) {
+static AnimationTemplate *checkAnimationTemplate(lua_State *L, int idx = 1) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.AnimationTemplate
- uint AnimationTemplateHandle;
- if ((AnimationTemplateHandle = *reinterpret_cast<uint *>(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) {
- AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::instance().resolveHandle(AnimationTemplateHandle);
- if (!AnimationTemplatePtr)
- luaL_error(L, "The animation template with the handle %d does no longer exist.", AnimationTemplateHandle);
- return AnimationTemplatePtr;
+ uint animationTemplateHandle;
+ if ((animationTemplateHandle = *reinterpret_cast<uint *>(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) {
+ AnimationTemplate *animationTemplatePtr = AnimationTemplateRegistry::instance().resolveHandle(animationTemplateHandle);
+ if (!animationTemplatePtr)
+ luaL_error(L, "The animation template with the handle %d does no longer exist.", animationTemplateHandle);
+ return animationTemplatePtr;
} else {
luaL_argcheck(L, 0, idx, "'" ANIMATION_TEMPLATE_CLASS_NAME "' expected");
return 0;
@@ -155,13 +133,11 @@ static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) {
}
-// -----------------------------------------------------------------------------
-
-static int NewAnimationTemplate(lua_State *L) {
- uint AnimationTemplateHandle = AnimationTemplate::create(luaL_checkstring(L, 1));
- AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::instance().resolveHandle(AnimationTemplateHandle);
- if (AnimationTemplatePtr && AnimationTemplatePtr->isValid()) {
- NewUintUserData(L, AnimationTemplateHandle);
+static int newAnimationTemplate(lua_State *L) {
+ uint animationTemplateHandle = AnimationTemplate::create(luaL_checkstring(L, 1));
+ AnimationTemplate *animationTemplatePtr = AnimationTemplateRegistry::instance().resolveHandle(animationTemplateHandle);
+ if (animationTemplatePtr && animationTemplatePtr->isValid()) {
+ newUintUserData(L, animationTemplateHandle);
//luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME);
LuaBindhelper::getMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME);
BS_ASSERT(!lua_isnil(L, -1));
@@ -173,45 +149,37 @@ static int NewAnimationTemplate(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int AT_AddFrame(lua_State *L) {
- AnimationTemplate *pAT = CheckAnimationTemplate(L);
+static int at_addFrame(lua_State *L) {
+ AnimationTemplate *pAT = checkAnimationTemplate(L);
pAT->addFrame(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int AT_SetFrame(lua_State *L) {
- AnimationTemplate *pAT = CheckAnimationTemplate(L);
+static int at_setFrame(lua_State *L) {
+ AnimationTemplate *pAT = checkAnimationTemplate(L);
pAT->setFrame(static_cast<int>(luaL_checknumber(L, 2)), static_cast<int>(luaL_checknumber(L, 3)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static bool AnimationTypeStringToNumber(const char *TypeString, Animation::ANIMATION_TYPES &Result) {
- if (strcmp(TypeString, "jojo") == 0) {
- Result = Animation::AT_JOJO;
+static bool animationTypeStringToNumber(const char *typeString, Animation::ANIMATION_TYPES &result) {
+ if (strcmp(typeString, "jojo") == 0) {
+ result = Animation::AT_JOJO;
return true;
- } else if (strcmp(TypeString, "loop") == 0) {
- Result = Animation::AT_LOOP;
+ } else if (strcmp(typeString, "loop") == 0) {
+ result = Animation::AT_LOOP;
return true;
- } else if (strcmp(TypeString, "oneshot") == 0) {
- Result = Animation::AT_ONESHOT;
+ } else if (strcmp(typeString, "oneshot") == 0) {
+ result = Animation::AT_ONESHOT;
return true;
} else
return false;
}
-// -----------------------------------------------------------------------------
-
-static int AT_SetAnimationType(lua_State *L) {
- AnimationTemplate *pAT = CheckAnimationTemplate(L);
- Animation::ANIMATION_TYPES AnimationType;
- if (AnimationTypeStringToNumber(luaL_checkstring(L, 2), AnimationType)) {
- pAT->setAnimationType(AnimationType);
+static int at_setAnimationType(lua_State *L) {
+ AnimationTemplate *pAT = checkAnimationTemplate(L);
+ Animation::ANIMATION_TYPES animationType;
+ if (animationTypeStringToNumber(luaL_checkstring(L, 2), animationType)) {
+ pAT->setAnimationType(animationType);
} else {
luaL_argcheck(L, 0, 2, "Invalid animation type");
}
@@ -219,36 +187,28 @@ static int AT_SetAnimationType(lua_State *L) {
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int AT_SetFPS(lua_State *L) {
- AnimationTemplate *pAT = CheckAnimationTemplate(L);
+static int at_setFPS(lua_State *L) {
+ AnimationTemplate *pAT = checkAnimationTemplate(L);
pAT->setFPS(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int AT_Finalize(lua_State *L) {
- AnimationTemplate *pAT = CheckAnimationTemplate(L);
+static int at_finalize(lua_State *L) {
+ AnimationTemplate *pAT = checkAnimationTemplate(L);
delete pAT;
return 0;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg ANIMATION_TEMPLATE_METHODS[] = {
- {"AddFrame", AT_AddFrame},
- {"SetFrame", AT_SetFrame},
- {"SetAnimationType", AT_SetAnimationType},
- {"SetFPS", AT_SetFPS},
- {"__gc", AT_Finalize},
+ {"AddFrame", at_addFrame},
+ {"SetFrame", at_setFrame},
+ {"SetAnimationType", at_setAnimationType},
+ {"SetFPS", at_setFPS},
+ {"__gc", at_finalize},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static GraphicEngine *GetGE() {
+static GraphicEngine *getGE() {
Kernel *pKernel = Kernel::GetInstance();
BS_ASSERT(pKernel);
GraphicEngine *pGE = pKernel->GetGfx();
@@ -256,31 +216,29 @@ static GraphicEngine *GetGE() {
return pGE;
}
-// -----------------------------------------------------------------------------
-
-static int Init(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int init(lua_State *L) {
+ GraphicEngine *pGE = getGE();
switch (lua_gettop(L)) {
case 0:
- lua_pushbooleancpp(L, pGE->Init());
+ lua_pushbooleancpp(L, pGE->init());
break;
case 1:
- lua_pushbooleancpp(L, pGE->Init(static_cast<int>(luaL_checknumber(L, 1))));
+ lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1))));
break;
case 2:
- lua_pushbooleancpp(L, pGE->Init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2))));
+ lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2))));
break;
case 3:
- lua_pushbooleancpp(L, pGE->Init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
+ lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
static_cast<int>(luaL_checknumber(L, 3))));
break;
case 4:
- lua_pushbooleancpp(L, pGE->Init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
+ lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
static_cast<int>(luaL_checknumber(L, 3)), static_cast<int>(luaL_checknumber(L, 4))));
break;
default:
- lua_pushbooleancpp(L, pGE->Init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
+ lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
static_cast<int>(luaL_checknumber(L, 3)), static_cast<int>(luaL_checknumber(L, 4)),
lua_tobooleancpp(L, 5)));
}
@@ -291,14 +249,14 @@ static int Init(lua_State *L) {
#endif
// Main-Panel zum Gfx-Modul hinzufügen
- RenderObjectPtr<Panel> MainPanelPtr(GetGE()->GetMainPanel());
- BS_ASSERT(MainPanelPtr.isValid());
+ RenderObjectPtr<Panel> mainPanelPtr(getGE()->getMainPanel());
+ BS_ASSERT(mainPanelPtr.isValid());
lua_pushstring(L, GFX_LIBRARY_NAME);
lua_gettable(L, LUA_GLOBALSINDEX);
BS_ASSERT(!lua_isnil(L, -1));
- NewUintUserData(L, MainPanelPtr->getHandle());
+ newUintUserData(L, mainPanelPtr->getHandle());
BS_ASSERT(!lua_isnil(L, -1));
// luaL_getmetatable(L, PANEL_CLASS_NAME);
LuaBindhelper::getMetatable(L, PANEL_CLASS_NAME);
@@ -318,213 +276,175 @@ static int Init(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int StartFrame(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int startFrame(lua_State *L) {
+ GraphicEngine *pGE = getGE();
if (lua_gettop(L) == 0)
- lua_pushbooleancpp(L, pGE->StartFrame());
+ lua_pushbooleancpp(L, pGE->startFrame());
else
- lua_pushbooleancpp(L, pGE->StartFrame(lua_tobooleancpp(L, 1)));
+ lua_pushbooleancpp(L, pGE->startFrame(lua_tobooleancpp(L, 1)));
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int EndFrame(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int endFrame(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushbooleancpp(L, pGE->EndFrame());
+ lua_pushbooleancpp(L, pGE->endFrame());
return 1;
}
-// -----------------------------------------------------------------------------
+static int drawDebugLine(lua_State *L) {
+ GraphicEngine *pGE = getGE();
-static int DrawDebugLine(lua_State *L) {
- GraphicEngine *pGE = GetGE();
-
- Vertex Start;
- Vertex End;
- Vertex::luaVertexToVertex(L, 1, Start);
- Vertex::luaVertexToVertex(L, 2, End);
- pGE->DrawDebugLine(Start, End, GraphicEngine::LuaColorToARGBColor(L, 3));
+ Vertex start;
+ Vertex end;
+ Vertex::luaVertexToVertex(L, 1, start);
+ Vertex::luaVertexToVertex(L, 2, end);
+ pGE->drawDebugLine(start, end, GraphicEngine::luaColorToARGBColor(L, 3));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int GetDisplayWidth(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int getDisplayWidth(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushnumber(L, pGE->GetDisplayWidth());
+ lua_pushnumber(L, pGE->getDisplayWidth());
return 1;
}
-// -----------------------------------------------------------------------------
+static int getDisplayHeight(lua_State *L) {
+ GraphicEngine *pGE = getGE();
-static int GetDisplayHeight(lua_State *L) {
- GraphicEngine *pGE = GetGE();
-
- lua_pushnumber(L, pGE->GetDisplayHeight());
+ lua_pushnumber(L, pGE->getDisplayHeight());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int GetBitDepth(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int getBitDepth(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushnumber(L, pGE->GetBitDepth());
+ lua_pushnumber(L, pGE->getBitDepth());
return 1;
}
-// -----------------------------------------------------------------------------
+static int setVsync(lua_State *L) {
+ GraphicEngine *pGE = getGE();
-static int SetVsync(lua_State *L) {
- GraphicEngine *pGE = GetGE();
-
- pGE->SetVsync(lua_tobooleancpp(L, 1));
+ pGE->setVsync(lua_tobooleancpp(L, 1));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int IsVsync(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int isVsync(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushbooleancpp(L, pGE->GetVsync());
+ lua_pushbooleancpp(L, pGE->getVsync());
return 1;
}
-// -----------------------------------------------------------------------------
+static int isWindowed(lua_State *L) {
+ GraphicEngine *pGE = getGE();
-static int IsWindowed(lua_State *L) {
- GraphicEngine *pGE = GetGE();
-
- lua_pushbooleancpp(L, pGE->IsWindowed());
+ lua_pushbooleancpp(L, pGE->isWindowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int GetFPSCount(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int getFPSCount(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushnumber(L, pGE->GetFPSCount());
+ lua_pushnumber(L, pGE->getFPSCount());
return 1;
}
-// -----------------------------------------------------------------------------
+static int getLastFrameDuration(lua_State *L) {
+ GraphicEngine *pGE = getGE();
-static int GetLastFrameDuration(lua_State *L) {
- GraphicEngine *pGE = GetGE();
-
- lua_pushnumber(L, pGE->GetLastFrameDuration());
+ lua_pushnumber(L, pGE->getLastFrameDuration());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int StopMainTimer(lua_State *L) {
- GraphicEngine *pGE = GetGE();
- pGE->StopMainTimer();
+static int stopMainTimer(lua_State *L) {
+ GraphicEngine *pGE = getGE();
+ pGE->stopMainTimer();
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int ResumeMainTimer(lua_State *L) {
- GraphicEngine *pGE = GetGE();
- pGE->ResumeMainTimer();
+static int resumeMainTimer(lua_State *L) {
+ GraphicEngine *pGE = getGE();
+ pGE->resumeMainTimer();
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int GetSecondaryFrameDuration(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int getSecondaryFrameDuration(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushnumber(L, pGE->GetSecondaryFrameDuration());
+ lua_pushnumber(L, pGE->getSecondaryFrameDuration());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int SaveScreenshot(lua_State *L) {
- GraphicEngine *pGE = GetGE();
- lua_pushbooleancpp(L, pGE->SaveScreenshot(luaL_checkstring(L, 1)));
+static int saveScreenshot(lua_State *L) {
+ GraphicEngine *pGE = getGE();
+ lua_pushbooleancpp(L, pGE->saveScreenshot(luaL_checkstring(L, 1)));
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int SaveThumbnailScreenshot(lua_State *L) {
- GraphicEngine *pGE = GetGE();
- lua_pushbooleancpp(L, pGE->SaveThumbnailScreenshot(luaL_checkstring(L, 1)));
+static int saveThumbnailScreenshot(lua_State *L) {
+ GraphicEngine *pGE = getGE();
+ lua_pushbooleancpp(L, pGE->saveThumbnailScreenshot(luaL_checkstring(L, 1)));
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int GetRepaintedPixels(lua_State *L) {
- GraphicEngine *pGE = GetGE();
- lua_pushnumber(L, static_cast<lua_Number>(pGE->GetRepaintedPixels()));
+static int getRepaintedPixels(lua_State *L) {
+ GraphicEngine *pGE = getGE();
+ lua_pushnumber(L, static_cast<lua_Number>(pGE->getRepaintedPixels()));
return 1;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg GFX_FUNCTIONS[] = {
- {"Init", Init},
- {"StartFrame", StartFrame},
- {"EndFrame", EndFrame},
- {"DrawDebugLine", DrawDebugLine},
- {"SetVsync", SetVsync},
- {"GetDisplayWidth", GetDisplayWidth},
- {"GetDisplayHeight", GetDisplayHeight},
- {"GetBitDepth", GetBitDepth},
- {"IsVsync", IsVsync},
- {"IsWindowed", IsWindowed},
- {"GetFPSCount", GetFPSCount},
- {"GetLastFrameDuration", GetLastFrameDuration},
- {"StopMainTimer", StopMainTimer},
- {"ResumeMainTimer", ResumeMainTimer},
- {"GetSecondaryFrameDuration", GetSecondaryFrameDuration},
- {"SaveScreenshot", SaveScreenshot},
- {"NewAnimationTemplate", NewAnimationTemplate},
- {"GetRepaintedPixels", GetRepaintedPixels},
- {"SaveThumbnailScreenshot", SaveThumbnailScreenshot},
+ {"Init", init},
+ {"StartFrame", startFrame},
+ {"EndFrame", endFrame},
+ {"DrawDebugLine", drawDebugLine},
+ {"SetVsync", setVsync},
+ {"GetDisplayWidth", getDisplayWidth},
+ {"GetDisplayHeight", getDisplayHeight},
+ {"GetBitDepth", getBitDepth},
+ {"IsVsync", isVsync},
+ {"IsWindowed", isWindowed},
+ {"GetFPSCount", getFPSCount},
+ {"GetLastFrameDuration", getLastFrameDuration},
+ {"StopMainTimer", stopMainTimer},
+ {"ResumeMainTimer", resumeMainTimer},
+ {"GetSecondaryFrameDuration", getSecondaryFrameDuration},
+ {"SaveScreenshot", saveScreenshot},
+ {"NewAnimationTemplate", newAnimationTemplate},
+ {"GetRepaintedPixels", getRepaintedPixels},
+ {"SaveThumbnailScreenshot", saveThumbnailScreenshot},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static RenderObjectPtr<RenderObject> CheckRenderObject(lua_State *L, bool ErrorIfRemoved = true) {
+static RenderObjectPtr<RenderObject> checkRenderObject(lua_State *L, bool errorIfRemoved = true) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable einer Klasse haben, die von Gfx.RenderObject "erbt".
- uint *UserDataPtr;
- if ((UserDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 ||
- (UserDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 ||
- (UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 ||
- (UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
- RenderObjectPtr<RenderObject> ROPtr(* UserDataPtr);
- if (ROPtr.isValid())
- return ROPtr;
+ uint *userDataPtr;
+ if ((userDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 ||
+ (userDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 ||
+ (userDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 ||
+ (userDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
+ RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
+ if (roPtr.isValid())
+ return roPtr;
else {
- if (ErrorIfRemoved)
- luaL_error(L, "The renderobject with the handle %d does no longer exist.", * UserDataPtr);
+ if (errorIfRemoved)
+ luaL_error(L, "The renderobject with the handle %d does no longer exist.", *userDataPtr);
}
} else {
luaL_argcheck(L, 0, 1, "'" RENDEROBJECT_CLASS_NAME "' expected");
@@ -533,143 +453,115 @@ static RenderObjectPtr<RenderObject> CheckRenderObject(lua_State *L, bool ErrorI
return RenderObjectPtr<RenderObject>();
}
-// -----------------------------------------------------------------------------
-
-static int RO_SetPos(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- Vertex Pos;
- Vertex::luaVertexToVertex(L, 2, Pos);
- ROPtr->setPos(Pos.x, Pos.y);
+static int ro_setPos(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ Vertex pos;
+ Vertex::luaVertexToVertex(L, 2, pos);
+ roPtr->setPos(pos.x, pos.y);
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int RO_SetX(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr->setX(static_cast<int>(luaL_checknumber(L, 2)));
+static int ro_setX(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr->setX(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int RO_SetY(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr->setY(static_cast<int>(luaL_checknumber(L, 2)));
+static int ro_setY(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr->setY(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int RO_SetZ(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr->setZ(static_cast<int>(luaL_checknumber(L, 2)));
+static int ro_setZ(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr->setZ(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int RO_SetVisible(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr->setVisible(lua_tobooleancpp(L, 2));
+static int ro_setVisible(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr->setVisible(lua_tobooleancpp(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetX(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getX());
+static int ro_getX(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getX());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetY(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getY());
+static int ro_getY(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getY());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetZ(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getZ());
+static int ro_getZ(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getZ());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetAbsoluteX(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getAbsoluteX());
+static int ro_getAbsoluteX(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getAbsoluteX());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetAbsoluteY(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getAbsoluteY());
+static int ro_getAbsoluteY(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getAbsoluteY());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetWidth(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getWidth());
+static int ro_getWidth(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getWidth());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetHeight(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getHeight());
+static int ro_getHeight(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getHeight());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_IsVisible(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushbooleancpp(L, ROPtr->isVisible());
+static int ro_isVisible(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushbooleancpp(L, roPtr->isVisible());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_AddPanel(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- RenderObjectPtr<Panel> PanelPtr = ROPtr->addPanel(static_cast<int>(luaL_checknumber(L, 2)),
+static int ro_addPanel(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ RenderObjectPtr<Panel> panelPtr = roPtr->addPanel(static_cast<int>(luaL_checknumber(L, 2)),
static_cast<int>(luaL_checknumber(L, 3)),
- GraphicEngine::LuaColorToARGBColor(L, 4));
- if (PanelPtr.isValid()) {
- NewUintUserData(L, PanelPtr->getHandle());
+ GraphicEngine::luaColorToARGBColor(L, 4));
+ if (panelPtr.isValid()) {
+ newUintUserData(L, panelPtr->getHandle());
// luaL_getmetatable(L, PANEL_CLASS_NAME);
LuaBindhelper::getMetatable(L, PANEL_CLASS_NAME);
BS_ASSERT(!lua_isnil(L, -1));
@@ -680,14 +572,12 @@ static int RO_AddPanel(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_AddBitmap(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- RenderObjectPtr<Bitmap> BitmaPtr = ROPtr->addBitmap(luaL_checkstring(L, 2));
- if (BitmaPtr.isValid()) {
- NewUintUserData(L, BitmaPtr->getHandle());
+static int ro_addBitmap(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ RenderObjectPtr<Bitmap> bitmaPtr = roPtr->addBitmap(luaL_checkstring(L, 2));
+ if (bitmaPtr.isValid()) {
+ newUintUserData(L, bitmaPtr->getHandle());
// luaL_getmetatable(L, BITMAP_CLASS_NAME);
LuaBindhelper::getMetatable(L, BITMAP_CLASS_NAME);
BS_ASSERT(!lua_isnil(L, -1));
@@ -698,18 +588,18 @@ static int RO_AddBitmap(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
+static int ro_addText(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
-static int RO_AddText(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
-
- RenderObjectPtr<Text> TextPtr;
- if (lua_gettop(L) >= 3) TextPtr = ROPtr->addText(luaL_checkstring(L, 2), luaL_checkstring(L, 3));
- else TextPtr = ROPtr->addText(luaL_checkstring(L, 2));
+ RenderObjectPtr<Text> textPtr;
+ if (lua_gettop(L) >= 3)
+ textPtr = roPtr->addText(luaL_checkstring(L, 2), luaL_checkstring(L, 3));
+ else
+ textPtr = roPtr->addText(luaL_checkstring(L, 2));
- if (TextPtr.isValid()) {
- NewUintUserData(L, TextPtr->getHandle());
+ if (textPtr.isValid()) {
+ newUintUserData(L, textPtr->getHandle());
// luaL_getmetatable(L, TEXT_CLASS_NAME);
LuaBindhelper::getMetatable(L, TEXT_CLASS_NAME);
BS_ASSERT(!lua_isnil(L, -1));
@@ -720,69 +610,63 @@ static int RO_AddText(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
+static int ro_addAnimation(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
-static int RO_AddAnimation(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
-
- RenderObjectPtr<Animation> AnimationPtr;
+ RenderObjectPtr<Animation> animationPtr;
if (lua_type(L, 2) == LUA_TUSERDATA)
- AnimationPtr = ROPtr->addAnimation(*CheckAnimationTemplate(L, 2));
+ animationPtr = roPtr->addAnimation(*checkAnimationTemplate(L, 2));
else
- AnimationPtr = ROPtr->addAnimation(luaL_checkstring(L, 2));
+ animationPtr = roPtr->addAnimation(luaL_checkstring(L, 2));
- if (AnimationPtr.isValid()) {
- NewUintUserData(L, AnimationPtr->getHandle());
+ if (animationPtr.isValid()) {
+ newUintUserData(L, animationPtr->getHandle());
// luaL_getmetatable(L, ANIMATION_CLASS_NAME);
LuaBindhelper::getMetatable(L, ANIMATION_CLASS_NAME);
BS_ASSERT(!lua_isnil(L, -1));
lua_setmetatable(L, -2);
// Alle Animationscallbacks registrieren.
- AnimationPtr->registerDeleteCallback(AnimationDeleteCallback, AnimationPtr->getHandle());
- AnimationPtr->registerLoopPointCallback(AnimationLoopPointCallback, AnimationPtr->getHandle());
- AnimationPtr->registerActionCallback(AnimationActionCallback, AnimationPtr->getHandle());
+ animationPtr->registerDeleteCallback(animationDeleteCallback, animationPtr->getHandle());
+ animationPtr->registerLoopPointCallback(animationLoopPointCallback, animationPtr->getHandle());
+ animationPtr->registerActionCallback(animationActionCallback, animationPtr->getHandle());
} else
lua_pushnil(L);
return 1;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg RENDEROBJECT_METHODS[] = {
- {"AddAnimation", RO_AddAnimation},
- {"AddText", RO_AddText},
- {"AddBitmap", RO_AddBitmap},
- {"AddPanel", RO_AddPanel},
- {"SetPos", RO_SetPos},
- {"SetX", RO_SetX},
- {"SetY", RO_SetY},
- {"SetZ", RO_SetZ},
- {"SetVisible", RO_SetVisible},
- {"GetX", RO_GetX},
- {"GetY", RO_GetY},
- {"GetZ", RO_GetZ},
- {"GetAbsoluteX", RO_GetAbsoluteX},
- {"GetAbsoluteY", RO_GetAbsoluteY},
- {"GetWidth", RO_GetWidth},
- {"GetHeight", RO_GetHeight},
- {"IsVisible", RO_IsVisible},
+ {"AddAnimation", ro_addAnimation},
+ {"AddText", ro_addText},
+ {"AddBitmap", ro_addBitmap},
+ {"AddPanel", ro_addPanel},
+ {"SetPos", ro_setPos},
+ {"SetX", ro_setX},
+ {"SetY", ro_setY},
+ {"SetZ", ro_setZ},
+ {"SetVisible", ro_setVisible},
+ {"GetX", ro_getX},
+ {"GetY", ro_getY},
+ {"GetZ", ro_getZ},
+ {"GetAbsoluteX", ro_getAbsoluteX},
+ {"GetAbsoluteY", ro_getAbsoluteY},
+ {"GetWidth", ro_getWidth},
+ {"GetHeight", ro_getHeight},
+ {"IsVisible", ro_isVisible},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static RenderObjectPtr<Panel> CheckPanel(lua_State *L) {
+static RenderObjectPtr<Panel> checkPanel(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Panel
- uint *UserDataPtr;
- if ((UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) {
- RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
- if (ROPtr.isValid()) {
- return ROPtr->toPanel();
+ uint *userDataPtr;
+ if ((userDataPtr = (uint *)my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) {
+ RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
+ if (roPtr.isValid()) {
+ return roPtr->toPanel();
} else
- luaL_error(L, "The panel with the handle %d does no longer exist.", *UserDataPtr);
+ luaL_error(L, "The panel with the handle %d does no longer exist.", *userDataPtr);
} else {
luaL_argcheck(L, 0, 1, "'" PANEL_CLASS_NAME "' expected");
}
@@ -790,54 +674,44 @@ static RenderObjectPtr<Panel> CheckPanel(lua_State *L) {
return RenderObjectPtr<Panel>();
}
-// -----------------------------------------------------------------------------
-
-static int P_GetColor(lua_State *L) {
- RenderObjectPtr<Panel> PanelPtr = CheckPanel(L);
+static int p_getColor(lua_State *L) {
+ RenderObjectPtr<Panel> PanelPtr = checkPanel(L);
BS_ASSERT(PanelPtr.isValid());
GraphicEngine::ARGBColorToLuaColor(L, PanelPtr->getColor());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int P_SetColor(lua_State *L) {
- RenderObjectPtr<Panel> PanelPtr = CheckPanel(L);
+static int p_setColor(lua_State *L) {
+ RenderObjectPtr<Panel> PanelPtr = checkPanel(L);
BS_ASSERT(PanelPtr.isValid());
- PanelPtr->setColor(GraphicEngine::LuaColorToARGBColor(L, 2));
+ PanelPtr->setColor(GraphicEngine::luaColorToARGBColor(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int P_Remove(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr.erase();
+static int p_remove(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr.erase();
return 0;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg PANEL_METHODS[] = {
- {"GetColor", P_GetColor},
- {"SetColor", P_SetColor},
- {"Remove", P_Remove},
+ {"GetColor", p_getColor},
+ {"SetColor", p_setColor},
+ {"Remove", p_remove},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static RenderObjectPtr<Bitmap> CheckBitmap(lua_State *L) {
+static RenderObjectPtr<Bitmap> checkBitmap(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Bitmap
- uint *UserDataPtr;
- if ((UserDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) {
- RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
- if (ROPtr.isValid()) {
- return ROPtr->toBitmap();
+ uint *userDataPtr;
+ if ((userDataPtr = (uint *)my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) {
+ RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
+ if (roPtr.isValid()) {
+ return roPtr->toBitmap();
} else
- luaL_error(L, "The bitmap with the handle %d does no longer exist.", *UserDataPtr);
+ luaL_error(L, "The bitmap with the handle %d does no longer exist.", *userDataPtr);
} else {
luaL_argcheck(L, 0, 1, "'" BITMAP_CLASS_NAME "' expected");
}
@@ -845,204 +719,165 @@ static RenderObjectPtr<Bitmap> CheckBitmap(lua_State *L) {
return RenderObjectPtr<Bitmap>();
}
-// -----------------------------------------------------------------------------
-
-static int B_SetAlpha(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setAlpha(static_cast<uint>(luaL_checknumber(L, 2)));
+static int b_setAlpha(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setAlpha(static_cast<uint>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetTintColor(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2));
+static int b_setTintColor(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setModulationColor(GraphicEngine::luaColorToARGBColor(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetScaleFactor(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 2)));
+static int b_setScaleFactor(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetScaleFactorX(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setScaleFactorX(static_cast<float>(luaL_checknumber(L, 2)));
+static int b_setScaleFactorX(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setScaleFactorX(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetScaleFactorY(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setScaleFactorY(static_cast<float>(luaL_checknumber(L, 2)));
+static int b_setScaleFactorY(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setScaleFactorY(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetFlipH(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setFlipH(lua_tobooleancpp(L, 2));
+static int b_setFlipH(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setFlipH(lua_tobooleancpp(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetFlipV(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setFlipV(lua_tobooleancpp(L, 2));
+static int b_setFlipV(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setFlipV(lua_tobooleancpp(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_GetAlpha(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushnumber(L, BitmapPtr->getAlpha());
+static int b_getAlpha(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushnumber(L, bitmapPtr->getAlpha());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_GetTintColor(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->getModulationColor());
+static int b_getTintColor(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ GraphicEngine::ARGBColorToLuaColor(L, bitmapPtr->getModulationColor());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_GetScaleFactorX(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushnumber(L, BitmapPtr->getScaleFactorX());
+static int b_getScaleFactorX(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushnumber(L, bitmapPtr->getScaleFactorX());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_GetScaleFactorY(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushnumber(L, BitmapPtr->getScaleFactorY());
+static int b_getScaleFactorY(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushnumber(L, bitmapPtr->getScaleFactorY());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_IsFlipH(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushbooleancpp(L, BitmapPtr->isFlipH());
+static int b_isFlipH(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushbooleancpp(L, bitmapPtr->isFlipH());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_IsFlipV(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushbooleancpp(L, BitmapPtr->isFlipV());
+static int b_isFlipV(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushbooleancpp(L, bitmapPtr->isFlipV());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_GetPixel(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
+static int b_getPixel(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
Vertex Pos;
Vertex::luaVertexToVertex(L, 2, Pos);
- GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->getPixel(Pos.x, Pos.y));
+ GraphicEngine::ARGBColorToLuaColor(L, bitmapPtr->getPixel(Pos.x, Pos.y));
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_IsScalingAllowed(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushbooleancpp(L, BitmapPtr->isScalingAllowed());
+static int b_isScalingAllowed(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushbooleancpp(L, bitmapPtr->isScalingAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_IsAlphaAllowed(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushbooleancpp(L, BitmapPtr->isAlphaAllowed());
+static int b_isAlphaAllowed(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushbooleancpp(L, bitmapPtr->isAlphaAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_IsTintingAllowed(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushbooleancpp(L, BitmapPtr->isColorModulationAllowed());
+static int b_isTintingAllowed(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushbooleancpp(L, bitmapPtr->isColorModulationAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-static int B_Remove(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr.erase();
+static int b_remove(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr.erase();
return 0;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg BITMAP_METHODS[] = {
- {"SetAlpha", B_SetAlpha},
- {"SetTintColor", B_SetTintColor},
- {"SetScaleFactor", B_SetScaleFactor},
- {"SetScaleFactorX", B_SetScaleFactorX},
- {"SetScaleFactorY", B_SetScaleFactorY},
- {"SetFlipH", B_SetFlipH},
- {"SetFlipV", B_SetFlipV},
- {"GetAlpha", B_GetAlpha},
- {"GetTintColor", B_GetTintColor},
- {"GetScaleFactorX", B_GetScaleFactorX},
- {"GetScaleFactorY", B_GetScaleFactorY},
- {"IsFlipH", B_IsFlipH},
- {"IsFlipV", B_IsFlipV},
- {"GetPixel", B_GetPixel},
- {"IsScalingAllowed", B_IsScalingAllowed},
- {"IsAlphaAllowed", B_IsAlphaAllowed},
- {"IsTintingAllowed", B_IsTintingAllowed},
- {"Remove", B_Remove},
+ {"SetAlpha", b_setAlpha},
+ {"SetTintColor", b_setTintColor},
+ {"SetScaleFactor", b_setScaleFactor},
+ {"SetScaleFactorX", b_setScaleFactorX},
+ {"SetScaleFactorY", b_setScaleFactorY},
+ {"SetFlipH", b_setFlipH},
+ {"SetFlipV", b_setFlipV},
+ {"GetAlpha", b_getAlpha},
+ {"GetTintColor", b_getTintColor},
+ {"GetScaleFactorX", b_getScaleFactorX},
+ {"GetScaleFactorY", b_getScaleFactorY},
+ {"IsFlipH", b_isFlipH},
+ {"IsFlipV", b_isFlipV},
+ {"GetPixel", b_getPixel},
+ {"IsScalingAllowed", b_isScalingAllowed},
+ {"IsAlphaAllowed", b_isAlphaAllowed},
+ {"IsTintingAllowed", b_isTintingAllowed},
+ {"Remove", b_remove},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static RenderObjectPtr<Animation> CheckAnimation(lua_State *L) {
+static RenderObjectPtr<Animation> checkAnimation(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Animation
- uint *UserDataPtr;
- if ((UserDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) {
- RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
- if (ROPtr.isValid())
- return ROPtr->toAnimation();
+ uint *userDataPtr;
+ if ((userDataPtr = (uint *)my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) {
+ RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
+ if (roPtr.isValid())
+ return roPtr->toAnimation();
else {
- luaL_error(L, "The animation with the handle %d does no longer exist.", *UserDataPtr);
+ luaL_error(L, "The animation with the handle %d does no longer exist.", *userDataPtr);
}
} else {
luaL_argcheck(L, 0, 1, "'" ANIMATION_CLASS_NAME "' expected");
@@ -1051,110 +886,87 @@ static RenderObjectPtr<Animation> CheckAnimation(lua_State *L) {
return RenderObjectPtr<Animation>();
}
-// -----------------------------------------------------------------------------
-
-static int A_Play(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->play();
+static int a_play(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->play();
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_Pause(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->pause();
+static int a_pause(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->pause();
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_Stop(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->stop();
+static int a_stop(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->stop();
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_SetFrame(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setFrame(static_cast<uint>(luaL_checknumber(L, 2)));
+static int a_setFrame(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setFrame(static_cast<uint>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_SetAlpha(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setAlpha(static_cast<int>(luaL_checknumber(L, 2)));
+static int a_setAlpha(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setAlpha(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-static int A_SetTintColor(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2));
+static int a_setTintColor(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setModulationColor(GraphicEngine::luaColorToARGBColor(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_SetScaleFactor(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 2)));
+static int a_setScaleFactor(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_SetScaleFactorX(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setScaleFactorX(static_cast<float>(luaL_checknumber(L, 2)));
+static int a_setScaleFactorX(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setScaleFactorX(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_SetScaleFactorY(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setScaleFactorY(static_cast<float>(luaL_checknumber(L, 2)));
+static int a_setScaleFactorY(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setScaleFactorY(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetScaleFactorX(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->getScaleFactorX());
+static int a_getScaleFactorX(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushnumber(L, animationPtr->getScaleFactorX());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetScaleFactorY(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->getScaleFactorY());
+static int a_getScaleFactorY(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushnumber(L, animationPtr->getScaleFactorY());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetAnimationType(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- switch (AnimationPtr->getAnimationType()) {
+static int a_getAnimationType(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ switch (animationPtr->getAnimationType()) {
case Animation::AT_JOJO:
lua_pushstring(L, "jojo");
break;
@@ -1170,213 +982,176 @@ static int A_GetAnimationType(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetFPS(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->getFPS());
+static int a_getFPS(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushnumber(L, animationPtr->getFPS());
return 1;
}
-
-// -----------------------------------------------------------------------------
-
-static int A_GetFrameCount(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->getFrameCount());
+static int a_getFrameCount(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushnumber(L, animationPtr->getFrameCount());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_IsScalingAllowed(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushbooleancpp(L, AnimationPtr->isScalingAllowed());
+static int a_isScalingAllowed(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushbooleancpp(L, animationPtr->isScalingAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_IsAlphaAllowed(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushbooleancpp(L, AnimationPtr->isAlphaAllowed());
+static int a_isAlphaAllowed(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushbooleancpp(L, animationPtr->isAlphaAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_IsTintingAllowed(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushbooleancpp(L, AnimationPtr->isColorModulationAllowed());
+static int a_isTintingAllowed(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushbooleancpp(L, animationPtr->isColorModulationAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetCurrentFrame(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->getCurrentFrame());
+static int a_getCurrentFrame(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushnumber(L, animationPtr->getCurrentFrame());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetCurrentAction(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushstring(L, AnimationPtr->getCurrentAction().c_str());
+static int a_getCurrentAction(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushstring(L, animationPtr->getCurrentAction().c_str());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_IsPlaying(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushbooleancpp(L, AnimationPtr->isRunning());
+static int a_isPlaying(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushbooleancpp(L, animationPtr->isRunning());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static bool AnimationLoopPointCallback(uint Handle) {
+static bool animationLoopPointCallback(uint handle) {
lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
- LoopPointCallbackPtr->invokeCallbackFunctions(L, Handle);
+ loopPointCallbackPtr->invokeCallbackFunctions(L, handle);
return true;
}
-// -----------------------------------------------------------------------------
-
-static int A_RegisterLoopPointCallback(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
+static int a_registerLoopPointCallback(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
luaL_checktype(L, 2, LUA_TFUNCTION);
lua_pushvalue(L, 2);
- LoopPointCallbackPtr->registerCallbackFunction(L, AnimationPtr->getHandle());
+ loopPointCallbackPtr->registerCallbackFunction(L, animationPtr->getHandle());
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_UnregisterLoopPointCallback(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
+static int a_unregisterLoopPointCallback(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
luaL_checktype(L, 2, LUA_TFUNCTION);
lua_pushvalue(L, 2);
- LoopPointCallbackPtr->unregisterCallbackFunction(L, AnimationPtr->getHandle());
+ loopPointCallbackPtr->unregisterCallbackFunction(L, animationPtr->getHandle());
return 0;
}
-// -----------------------------------------------------------------------------
-
-static bool AnimationActionCallback(uint Handle) {
- RenderObjectPtr<Animation> AnimationPtr(Handle);
- if (AnimationPtr.isValid()) {
- ActionCallbackPtr->Action = AnimationPtr->getCurrentAction();
+static bool animationActionCallback(uint Handle) {
+ RenderObjectPtr<Animation> animationPtr(Handle);
+ if (animationPtr.isValid()) {
+ actionCallbackPtr->Action = animationPtr->getCurrentAction();
lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
- ActionCallbackPtr->invokeCallbackFunctions(L, AnimationPtr->getHandle());
+ actionCallbackPtr->invokeCallbackFunctions(L, animationPtr->getHandle());
}
return true;
}
-// -----------------------------------------------------------------------------
-
-static int A_RegisterActionCallback(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
+static int a_registerActionCallback(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
luaL_checktype(L, 2, LUA_TFUNCTION);
lua_pushvalue(L, 2);
- ActionCallbackPtr->registerCallbackFunction(L, AnimationPtr->getHandle());
+ actionCallbackPtr->registerCallbackFunction(L, animationPtr->getHandle());
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_UnregisterActionCallback(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
+static int a_unregisterActionCallback(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
luaL_checktype(L, 2, LUA_TFUNCTION);
lua_pushvalue(L, 2);
- ActionCallbackPtr->unregisterCallbackFunction(L, AnimationPtr->getHandle());
+ actionCallbackPtr->unregisterCallbackFunction(L, animationPtr->getHandle());
return 0;
}
-// -----------------------------------------------------------------------------
-
-static bool AnimationDeleteCallback(uint Handle) {
+static bool animationDeleteCallback(uint Handle) {
lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
- LoopPointCallbackPtr->removeAllObjectCallbacks(L, Handle);
+ loopPointCallbackPtr->removeAllObjectCallbacks(L, Handle);
return true;
}
-// -----------------------------------------------------------------------------
-
-static int A_Remove(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr.erase();
+static int a_remove(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr.erase();
return 0;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg ANIMATION_METHODS[] = {
- {"Play", A_Play},
- {"Pause", A_Pause},
- {"Stop", A_Stop},
- {"SetFrame", A_SetFrame},
- {"SetAlpha", A_SetAlpha},
- {"SetTintColor", A_SetTintColor},
- {"SetScaleFactor", A_SetScaleFactor},
- {"SetScaleFactorX", A_SetScaleFactorX},
- {"SetScaleFactorY", A_SetScaleFactorY},
- {"GetScaleFactorX", A_GetScaleFactorX},
- {"GetScaleFactorY", A_GetScaleFactorY},
- {"GetAnimationType", A_GetAnimationType},
- {"GetFPS", A_GetFPS},
- {"GetFrameCount", A_GetFrameCount},
- {"IsScalingAllowed", A_IsScalingAllowed},
- {"IsAlphaAllowed", A_IsAlphaAllowed},
- {"IsTintingAllowed", A_IsTintingAllowed},
- {"GetCurrentFrame", A_GetCurrentFrame},
- {"GetCurrentAction", A_GetCurrentAction},
- {"IsPlaying", A_IsPlaying},
- {"RegisterLoopPointCallback", A_RegisterLoopPointCallback},
- {"UnregisterLoopPointCallback", A_UnregisterLoopPointCallback},
- {"RegisterActionCallback", A_RegisterActionCallback},
- {"UnregisterActionCallback", A_UnregisterActionCallback},
- {"Remove", A_Remove},
+ {"Play", a_play},
+ {"Pause", a_pause},
+ {"Stop", a_stop},
+ {"SetFrame", a_setFrame},
+ {"SetAlpha", a_setAlpha},
+ {"SetTintColor", a_setTintColor},
+ {"SetScaleFactor", a_setScaleFactor},
+ {"SetScaleFactorX", a_setScaleFactorX},
+ {"SetScaleFactorY", a_setScaleFactorY},
+ {"GetScaleFactorX", a_getScaleFactorX},
+ {"GetScaleFactorY", a_getScaleFactorY},
+ {"GetAnimationType", a_getAnimationType},
+ {"GetFPS", a_getFPS},
+ {"GetFrameCount", a_getFrameCount},
+ {"IsScalingAllowed", a_isScalingAllowed},
+ {"IsAlphaAllowed", a_isAlphaAllowed},
+ {"IsTintingAllowed", a_isTintingAllowed},
+ {"GetCurrentFrame", a_getCurrentFrame},
+ {"GetCurrentAction", a_getCurrentAction},
+ {"IsPlaying", a_isPlaying},
+ {"RegisterLoopPointCallback", a_registerLoopPointCallback},
+ {"UnregisterLoopPointCallback", a_unregisterLoopPointCallback},
+ {"RegisterActionCallback", a_registerActionCallback},
+ {"UnregisterActionCallback", a_unregisterActionCallback},
+ {"Remove", a_remove},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static RenderObjectPtr<Text> CheckText(lua_State *L) {
+static RenderObjectPtr<Text> checkText(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Text
- uint *UserDataPtr;
- if ((UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
- RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
- if (ROPtr.isValid())
- return ROPtr->toText();
+ uint *userDataPtr;
+ if ((userDataPtr = (uint *)my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
+ RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
+ if (roPtr.isValid())
+ return roPtr->toText();
else
- luaL_error(L, "The text with the handle %d does no longer exist.", *UserDataPtr);
+ luaL_error(L, "The text with the handle %d does no longer exist.", *userDataPtr);
} else {
luaL_argcheck(L, 0, 1, "'" TEXT_CLASS_NAME "' expected");
}
@@ -1384,145 +1159,115 @@ static RenderObjectPtr<Text> CheckText(lua_State *L) {
return RenderObjectPtr<Text>();
}
-// -----------------------------------------------------------------------------
-
-static int T_SetFont(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->SetFont(luaL_checkstring(L, 2));
+static int t_setFont(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->SetFont(luaL_checkstring(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_SetText(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->SetText(luaL_checkstring(L, 2));
+static int t_setText(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->SetText(luaL_checkstring(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_SetAlpha(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->setAlpha(static_cast<int>(luaL_checknumber(L, 2)));
+static int t_setAlpha(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->setAlpha(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_SetColor(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->setColor(GraphicEngine::LuaColorToARGBColor(L, 2));
+static int t_setColor(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->setColor(GraphicEngine::luaColorToARGBColor(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_SetAutoWrap(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->SetAutoWrap(lua_tobooleancpp(L, 2));
+static int t_setAutoWrap(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->SetAutoWrap(lua_tobooleancpp(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_SetAutoWrapThreshold(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->SetAutoWrapThreshold(static_cast<uint>(luaL_checknumber(L, 2)));
+static int t_setAutoWrapThreshold(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->SetAutoWrapThreshold(static_cast<uint>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_GetText(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushstring(L, TextPtr->GetText().c_str());
+static int t_getText(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushstring(L, textPtr->GetText().c_str());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_GetFont(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushstring(L, TextPtr->GetFont().c_str());
+static int t_getFont(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushstring(L, textPtr->GetFont().c_str());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_GetAlpha(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushnumber(L, TextPtr->getAlpha());
+static int t_getAlpha(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushnumber(L, textPtr->getAlpha());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_GetColor(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushnumber(L, TextPtr->getColor());
+static int t_getColor(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushnumber(L, textPtr->getColor());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_IsAutoWrap(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushbooleancpp(L, TextPtr->IsAutoWrapActive());
+static int t_isAutoWrap(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushbooleancpp(L, textPtr->IsAutoWrapActive());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_GetAutoWrapThreshold(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushnumber(L, TextPtr->GetAutoWrapThreshold());
+static int t_getAutoWrapThreshold(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushnumber(L, textPtr->GetAutoWrapThreshold());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_Remove(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr.erase();
+static int t_remove(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr.erase();
return 0;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg TEXT_METHODS[] = {
- {"SetFont", T_SetFont},
- {"SetText", T_SetText},
- {"SetAlpha", T_SetAlpha},
- {"SetColor", T_SetColor},
- {"SetAutoWrap", T_SetAutoWrap},
- {"SetAutoWrapThreshold", T_SetAutoWrapThreshold},
- {"GetText", T_GetText},
- {"GetFont", T_GetFont},
- {"GetAlpha", T_GetAlpha},
- {"GetColor", T_GetColor},
- {"IsAutoWrap", T_IsAutoWrap},
- {"GetAutoWrapThreshold", T_GetAutoWrapThreshold},
- {"Remove", T_Remove},
+ {"SetFont", t_setFont},
+ {"SetText", t_setText},
+ {"SetAlpha", t_setAlpha},
+ {"SetColor", t_setColor},
+ {"SetAutoWrap", t_setAutoWrap},
+ {"SetAutoWrapThreshold", t_setAutoWrapThreshold},
+ {"GetText", t_getText},
+ {"GetFont", t_getFont},
+ {"GetAlpha", t_getAlpha},
+ {"GetColor", t_getColor},
+ {"IsAutoWrap", t_isAutoWrap},
+ {"GetAutoWrapThreshold", t_getAutoWrapThreshold},
+ {"Remove", t_remove},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-bool GraphicEngine::RegisterScriptBindings() {
+bool GraphicEngine::registerScriptBindings() {
Kernel *pKernel = Kernel::GetInstance();
BS_ASSERT(pKernel);
ScriptEngine *pScript = pKernel->GetScript();
@@ -1544,8 +1289,8 @@ bool GraphicEngine::RegisterScriptBindings() {
if (!LuaBindhelper::addFunctionsToLib(L, GFX_LIBRARY_NAME, GFX_FUNCTIONS)) return false;
- LoopPointCallbackPtr.reset(new LuaCallback(L));
- ActionCallbackPtr.reset(new ActionCallback(L));
+ loopPointCallbackPtr.reset(new LuaCallback(L));
+ actionCallbackPtr.reset(new ActionCallback(L));
return true;
}