From a683a420a9e43705c972b5e74d55e319729e1a81 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 29 Jul 2010 19:53:02 +0000 Subject: SWORD25: Importing original sources svn-id: r53171 --- engines/sword25/gfx/graphicengine_script.cpp | 1722 ++++++++++++++++++++++++++ 1 file changed, 1722 insertions(+) create mode 100755 engines/sword25/gfx/graphicengine_script.cpp (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp new file mode 100755 index 0000000000..5419f09f2c --- /dev/null +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -0,0 +1,1722 @@ +// ----------------------------------------------------------------------------- +// This file is part of Broken Sword 2.5 +// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdörfer +// +// Broken Sword 2.5 is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// Broken Sword 2.5 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Broken Sword 2.5; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Includes +// ----------------------------------------------------------------------------- + +#include +#include + +#include "kernel/common.h" +#include "kernel/kernel.h" +#include "kernel/callbackregistry.h" +#include "script/script.h" +#include "script/luabindhelper.h" +#include "script/luacallback.h" +#include "math/vertex.h" + +#include "graphicengine.h" +#include "renderobject.h" +#include "bitmap.h" +#include "animation.h" +#include "panel.h" +#include "text.h" +#include "animationtemplate.h" +#include "animationtemplateregistry.h" + +#define BS_LOG_PREFIX "GRAPHICENGINE" + +// ----------------------------------------------------------------------------- +// Callback-Objekte +// ----------------------------------------------------------------------------- + +static bool AnimationDeleteCallback(unsigned int Data); +static bool AnimationActionCallback(unsigned int Data); +static bool AnimationLoopPointCallback(unsigned int Data); + +namespace +{ + // ------------------------------------------------------------------------- + + class ActionCallback : public BS_LuaCallback + { + public: + ActionCallback(lua_State * L) : BS_LuaCallback(L) {}; + + std::string Action; + + protected: + virtual int PreFunctionInvokation(lua_State * L) + { + lua_pushstring(L, Action.c_str()); + return 1; + } + }; + + std::auto_ptr LoopPointCallbackPtr; + std::auto_ptr ActionCallbackPtr; + + // ------------------------------------------------------------------------- + + struct CallbackfunctionRegisterer + { + CallbackfunctionRegisterer() + { + BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaLoopPointCB", AnimationLoopPointCallback); + BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaActionCB", AnimationActionCallback); + BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaDeleteCB", 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" +#define PANEL_CLASS_NAME "Gfx.Panel" +#define TEXT_CLASS_NAME "Gfx.Text" +#define ANIMATION_CLASS_NAME "Gfx.Animation" +#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); + + void * p = lua_touserdata(L, ud); + if (p != NULL) /* value is a userdata? */ + { + if (lua_getmetatable(L, ud)) /* does it have a metatable? */ + { + // lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ + BS_LuaBindhelper::GetMetatable(L, tname); + if (lua_rawequal(L, -1, -2)) /* does it have the correct mt? */ + { + lua_settop(L, top); + return p; + } + } + } + + lua_settop(L, top); + return NULL; +} + +// ----------------------------------------------------------------------------- + +static void NewUintUserData(lua_State * L, unsigned int Value) +{ + void * UserData = lua_newuserdata(L, sizeof(Value)); + memcpy(UserData, &Value, sizeof(Value)); +} + +// ----------------------------------------------------------------------------- + +static BS_AnimationTemplate * CheckAnimationTemplate(lua_State * L, int idx = 1) +{ + // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.AnimationTemplate + unsigned int AnimationTemplateHandle; + if ((AnimationTemplateHandle = *reinterpret_cast(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) + { + BS_AnimationTemplate * AnimationTemplatePtr = BS_AnimationTemplateRegistry::GetInstance().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; + } +} + + +// ----------------------------------------------------------------------------- + +static int NewAnimationTemplate(lua_State * L) +{ + unsigned int AnimationTemplateHandle = BS_AnimationTemplate::Create(luaL_checkstring(L, 1)); + BS_AnimationTemplate * AnimationTemplatePtr = BS_AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); + if (AnimationTemplatePtr && AnimationTemplatePtr->IsValid()) + { + NewUintUserData(L, AnimationTemplateHandle); + //luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); + BS_LuaBindhelper::GetMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); + BS_ASSERT(!lua_isnil(L, -1)); + lua_setmetatable(L, -2); + } + else + { + lua_pushnil(L); + } + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int AT_AddFrame(lua_State * L) +{ + BS_AnimationTemplate * pAT = CheckAnimationTemplate(L); + pAT->AddFrame(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int AT_SetFrame(lua_State * L) +{ + BS_AnimationTemplate * pAT = CheckAnimationTemplate(L); + pAT->SetFrame(static_cast(luaL_checknumber(L, 2)), static_cast(luaL_checknumber(L, 3))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static bool AnimationTypeStringToNumber(const char * TypeString, BS_Animation::ANIMATION_TYPES & Result) +{ + if (strcmp(TypeString, "jojo") == 0) + { + Result = BS_Animation::AT_JOJO; + return true; + } + else if (strcmp(TypeString, "loop") == 0) + { + Result = BS_Animation::AT_LOOP; + return true; + } + else if (strcmp(TypeString, "oneshot") == 0) + { + Result = BS_Animation::AT_ONESHOT; + return true; + } + else + return false; +} + +// ----------------------------------------------------------------------------- + +static int AT_SetAnimationType(lua_State * L) +{ + BS_AnimationTemplate * pAT = CheckAnimationTemplate(L); + BS_Animation::ANIMATION_TYPES AnimationType; + if (AnimationTypeStringToNumber(luaL_checkstring(L, 2), AnimationType)) + { + pAT->SetAnimationType(AnimationType); + } + else + { + luaL_argcheck(L, 0, 2, "Invalid animation type"); + } + + return 0; +} + +// ----------------------------------------------------------------------------- + +static int AT_SetFPS(lua_State * L) +{ + BS_AnimationTemplate * pAT = CheckAnimationTemplate(L); + pAT->SetFPS(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int AT_Finalize(lua_State * L) +{ + BS_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, + 0, 0, +}; + +// ----------------------------------------------------------------------------- + +static BS_GraphicEngine * GetGE() +{ + BS_Kernel * pKernel = BS_Kernel::GetInstance(); + BS_ASSERT(pKernel); + BS_GraphicEngine * pGE = static_cast(pKernel->GetService("gfx")); + BS_ASSERT(pGE); + return pGE; +} + +// ----------------------------------------------------------------------------- + +static int Init(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + switch (lua_gettop(L)) + { + case 0: + lua_pushbooleancpp(L, pGE->Init()); + break; + case 1: + lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L, 1)))); + break; + case 2: + lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L,1)), static_cast(luaL_checknumber(L, 2)))); + break; + case 3: + lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L,1)), static_cast(luaL_checknumber(L, 2)), + static_cast(luaL_checknumber(L, 3)))); + break; + case 4: + lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L,1)), static_cast(luaL_checknumber(L, 2)), + static_cast(luaL_checknumber(L, 3)), static_cast(luaL_checknumber(L, 4)))); + break; + default: + lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L,1)), static_cast(luaL_checknumber(L, 2)), + static_cast(luaL_checknumber(L, 3)), static_cast(luaL_checknumber(L, 4)), + lua_tobooleancpp(L, 5))); + } + + +#ifdef DEBUG + int __startStackDepth = lua_gettop(L); +#endif + + // Main-Panel zum Gfx-Modul hinzufügen + BS_RenderObjectPtr 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()); + BS_ASSERT(!lua_isnil(L, -1)); + // luaL_getmetatable(L, PANEL_CLASS_NAME); + BS_LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); + BS_ASSERT(!lua_isnil(L, -1)); + lua_setmetatable(L, -2); + + lua_pushstring(L, "MainPanel"); + lua_insert(L, -2); + lua_settable(L, -3); + + lua_pop(L, 1); + +#ifdef DEBUG + BS_ASSERT(__startStackDepth == lua_gettop(L)); +#endif + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int StartFrame(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + if (lua_gettop(L) == 0) + lua_pushbooleancpp(L, pGE->StartFrame()); + else + lua_pushbooleancpp(L, pGE->StartFrame(lua_tobooleancpp(L, 1))); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int EndFrame(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + lua_pushbooleancpp(L, pGE->EndFrame()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int DrawDebugLine(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + BS_Vertex Start; + BS_Vertex End; + BS_Vertex::LuaVertexToVertex(L, 1, Start); + BS_Vertex::LuaVertexToVertex(L, 2, End); + pGE->DrawDebugLine(Start, End, BS_GraphicEngine::LuaColorToARGBColor(L, 3)); + + return 0; +} + +// ----------------------------------------------------------------------------- + +static int GetDisplayWidth(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + lua_pushnumber(L, pGE->GetDisplayWidth()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int GetDisplayHeight(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + lua_pushnumber(L, pGE->GetDisplayHeight()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int GetBitDepth(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + lua_pushnumber(L, pGE->GetBitDepth()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int SetVsync(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + pGE->SetVsync(lua_tobooleancpp(L, 1)); + + return 0; +} + +// ----------------------------------------------------------------------------- + +static int IsVsync(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + lua_pushbooleancpp(L, pGE->GetVsync()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int IsWindowed(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + lua_pushbooleancpp(L, pGE->IsWindowed()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int GetFPSCount(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + lua_pushnumber(L, pGE->GetFPSCount()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int GetLastFrameDuration(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + lua_pushnumber(L, pGE->GetLastFrameDuration()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int StopMainTimer(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + pGE->StopMainTimer(); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int ResumeMainTimer(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + pGE->ResumeMainTimer(); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int GetSecondaryFrameDuration(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + + lua_pushnumber(L, pGE->GetSecondaryFrameDuration()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int SaveScreenshot(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + lua_pushbooleancpp(L, pGE->SaveScreenshot(luaL_checkstring(L, 1))); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int SaveThumbnailScreenshot(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + lua_pushbooleancpp(L, pGE->SaveThumbnailScreenshot(luaL_checkstring(L, 1))); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int GetRepaintedPixels(lua_State * L) +{ + BS_GraphicEngine * pGE = GetGE(); + lua_pushnumber(L, static_cast(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, + 0, 0, +}; + +// ----------------------------------------------------------------------------- + +static BS_RenderObjectPtr 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". + unsigned int * UserDataPtr; + if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 || + (UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 || + (UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 || + (UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) + { + BS_RenderObjectPtr ROPtr(* UserDataPtr); + if (ROPtr.IsValid()) + return ROPtr; + else + { + 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"); + } + + return BS_RenderObjectPtr(); +} + +// ----------------------------------------------------------------------------- + +static int RO_SetPos(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + BS_Vertex Pos; + BS_Vertex::LuaVertexToVertex(L, 2, Pos); + ROPtr->SetPos(Pos.X, Pos.Y); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int RO_SetX(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + ROPtr->SetX(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int RO_SetY(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + ROPtr->SetY(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int RO_SetZ(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + ROPtr->SetZ(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int RO_SetVisible(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + ROPtr->SetVisible(lua_tobooleancpp(L, 2)); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int RO_GetX(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + lua_pushnumber(L, ROPtr->GetX()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_GetY(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + lua_pushnumber(L, ROPtr->GetY()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_GetZ(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + lua_pushnumber(L, ROPtr->GetZ()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_GetAbsoluteX(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + lua_pushnumber(L, ROPtr->GetAbsoluteX()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_GetAbsoluteY(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + lua_pushnumber(L, ROPtr->GetAbsoluteY()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_GetWidth(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + lua_pushnumber(L, ROPtr->GetWidth()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_GetHeight(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + lua_pushnumber(L, ROPtr->GetHeight()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_IsVisible(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + lua_pushbooleancpp(L, ROPtr->IsVisible()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_AddPanel(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + BS_RenderObjectPtr PanelPtr = ROPtr->AddPanel(static_cast(luaL_checknumber(L, 2)), + static_cast(luaL_checknumber(L, 3)), + BS_GraphicEngine::LuaColorToARGBColor(L, 4)); + if (PanelPtr.IsValid()) + { + NewUintUserData(L, PanelPtr->GetHandle()); + // luaL_getmetatable(L, PANEL_CLASS_NAME); + BS_LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); + BS_ASSERT(!lua_isnil(L, -1)); + lua_setmetatable(L, -2); + } + else + lua_pushnil(L); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_AddBitmap(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + BS_RenderObjectPtr BitmaPtr = ROPtr->AddBitmap(luaL_checkstring(L, 2)); + if (BitmaPtr.IsValid()) + { + NewUintUserData(L, BitmaPtr->GetHandle()); + // luaL_getmetatable(L, BITMAP_CLASS_NAME); + BS_LuaBindhelper::GetMetatable(L, BITMAP_CLASS_NAME); + BS_ASSERT(!lua_isnil(L, -1)); + lua_setmetatable(L, -2); + } + else + lua_pushnil(L); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_AddText(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + + BS_RenderObjectPtr 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()); + // luaL_getmetatable(L, TEXT_CLASS_NAME); + BS_LuaBindhelper::GetMetatable(L, TEXT_CLASS_NAME); + BS_ASSERT(!lua_isnil(L, -1)); + lua_setmetatable(L, -2); + } + else + lua_pushnil(L); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_AddAnimation(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + BS_ASSERT(ROPtr.IsValid()); + + BS_RenderObjectPtr AnimationPtr; + if (lua_type(L, 2) == LUA_TUSERDATA) + AnimationPtr = ROPtr->AddAnimation(*CheckAnimationTemplate(L, 2)); + else + AnimationPtr = ROPtr->AddAnimation(luaL_checkstring(L, 2)); + + if (AnimationPtr.IsValid()) + { + NewUintUserData(L, AnimationPtr->GetHandle()); + // luaL_getmetatable(L, ANIMATION_CLASS_NAME); + BS_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()); + } + else + lua_pushnil(L); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int RO_Remove(lua_State * L) +{ + BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + ROPtr.Erase(); + return 0; +} + +// ----------------------------------------------------------------------------- + +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, + 0, 0, +}; + +// ----------------------------------------------------------------------------- + +static BS_RenderObjectPtr CheckPanel(lua_State * L) +{ + // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Panel + unsigned int * UserDataPtr; + if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) + { + BS_RenderObjectPtr ROPtr(*UserDataPtr); + if (ROPtr.IsValid()) + { + return ROPtr->ToPanel(); + } + else + luaL_error(L, "The panel with the handle %d does no longer exist.", *UserDataPtr); + } + else + { + luaL_argcheck(L, 0, 1, "'" PANEL_CLASS_NAME "' expected"); + } + + return BS_RenderObjectPtr(); +} + +// ----------------------------------------------------------------------------- + +static int P_GetColor(lua_State * L) +{ + BS_RenderObjectPtr PanelPtr = CheckPanel(L); + BS_ASSERT(PanelPtr.IsValid()); + BS_GraphicEngine::ARGBColorToLuaColor(L, PanelPtr->GetColor()); + + return 1; +} + +// ----------------------------------------------------------------------------- + +static int P_SetColor(lua_State * L) +{ + BS_RenderObjectPtr PanelPtr = CheckPanel(L); + BS_ASSERT(PanelPtr.IsValid()); + PanelPtr->SetColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int P_Remove(lua_State * L) +{ + BS_RenderObjectPtr 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, + 0, 0, +}; + +// ----------------------------------------------------------------------------- + +static BS_RenderObjectPtr CheckBitmap(lua_State * L) +{ + // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Bitmap + unsigned int * UserDataPtr; + if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) + { + BS_RenderObjectPtr ROPtr(*UserDataPtr); + if (ROPtr.IsValid()) + { + return ROPtr->ToBitmap(); + } + else + luaL_error(L, "The bitmap with the handle %d does no longer exist.", *UserDataPtr); + } + else + { + luaL_argcheck(L, 0, 1, "'" BITMAP_CLASS_NAME "' expected"); + } + + return BS_RenderObjectPtr(); +} + +// ----------------------------------------------------------------------------- + +static int B_SetAlpha(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + BitmapPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int B_SetTintColor(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + BitmapPtr->SetModulationColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int B_SetScaleFactor(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + BitmapPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int B_SetScaleFactorX(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + BitmapPtr->SetScaleFactorX(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int B_SetScaleFactorY(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + BitmapPtr->SetScaleFactorY(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int B_SetFlipH(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + BitmapPtr->SetFlipH(lua_tobooleancpp(L, 2)); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int B_SetFlipV(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + BitmapPtr->SetFlipV(lua_tobooleancpp(L, 2)); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int B_GetAlpha(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + lua_pushnumber(L, BitmapPtr->GetAlpha()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int B_GetTintColor(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + BS_GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->GetModulationColor()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int B_GetScaleFactorX(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + lua_pushnumber(L, BitmapPtr->GetScaleFactorX()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int B_GetScaleFactorY(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + lua_pushnumber(L, BitmapPtr->GetScaleFactorY()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int B_IsFlipH(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + lua_pushbooleancpp(L, BitmapPtr->IsFlipH()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int B_IsFlipV(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + lua_pushbooleancpp(L, BitmapPtr->IsFlipV()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int B_GetPixel(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + BS_Vertex Pos; + BS_Vertex::LuaVertexToVertex(L, 2, Pos); + BS_GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->GetPixel(Pos.X, Pos.Y)); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int B_IsScalingAllowed(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + lua_pushbooleancpp(L, BitmapPtr->IsScalingAllowed()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int B_IsAlphaAllowed(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + lua_pushbooleancpp(L, BitmapPtr->IsAlphaAllowed()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int B_IsTintingAllowed(lua_State * L) +{ + BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + BS_ASSERT(BitmapPtr.IsValid()); + lua_pushbooleancpp(L, BitmapPtr->IsColorModulationAllowed()); + return 1; +} +// ----------------------------------------------------------------------------- + +static int B_Remove(lua_State * L) +{ + BS_RenderObjectPtr 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, + 0, 0, +}; + +// ----------------------------------------------------------------------------- + +static BS_RenderObjectPtr CheckAnimation(lua_State * L) +{ + // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Animation + unsigned int * UserDataPtr; + if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) + { + BS_RenderObjectPtr ROPtr(*UserDataPtr); + if (ROPtr.IsValid()) + return ROPtr->ToAnimation(); + else + { + luaL_error(L, "The animation with the handle %d does no longer exist.", *UserDataPtr); + } + } + else + { + luaL_argcheck(L, 0, 1, "'" ANIMATION_CLASS_NAME "' expected"); + } + + return BS_RenderObjectPtr(); +} + +// ----------------------------------------------------------------------------- + +static int A_Play(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + AnimationPtr->Play(); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int A_Pause(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + AnimationPtr->Pause(); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int A_Stop(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + AnimationPtr->Stop(); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int A_SetFrame(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + AnimationPtr->SetFrame(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int A_SetAlpha(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + AnimationPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); + return 0; +} +// ----------------------------------------------------------------------------- + +static int A_SetTintColor(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + AnimationPtr->SetModulationColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int A_SetScaleFactor(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + AnimationPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int A_SetScaleFactorX(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + AnimationPtr->SetScaleFactorX(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int A_SetScaleFactorY(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + AnimationPtr->SetScaleFactorY(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int A_GetScaleFactorX(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + lua_pushnumber(L, AnimationPtr->GetScaleFactorX()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int A_GetScaleFactorY(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + lua_pushnumber(L, AnimationPtr->GetScaleFactorY()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int A_GetAnimationType(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + switch (AnimationPtr->GetAnimationType()) + { + case BS_Animation::AT_JOJO: + lua_pushstring(L, "jojo"); + break; + case BS_Animation::AT_LOOP: + lua_pushstring(L, "loop"); + break; + case BS_Animation::AT_ONESHOT: + lua_pushstring(L, "oneshot"); + break; + default: + BS_ASSERT(false); + } + return 1; +} + +// ----------------------------------------------------------------------------- + +static int A_GetFPS(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + lua_pushnumber(L, AnimationPtr->GetFPS()); + return 1; +} + + +// ----------------------------------------------------------------------------- + +static int A_GetFrameCount(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + lua_pushnumber(L, AnimationPtr->GetFrameCount()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int A_IsScalingAllowed(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + lua_pushbooleancpp(L, AnimationPtr->IsScalingAllowed()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int A_IsAlphaAllowed(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + lua_pushbooleancpp(L, AnimationPtr->IsAlphaAllowed()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int A_IsTintingAllowed(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + lua_pushbooleancpp(L, AnimationPtr->IsColorModulationAllowed()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int A_GetCurrentFrame(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + lua_pushnumber(L, AnimationPtr->GetCurrentFrame()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int A_GetCurrentAction(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + lua_pushstring(L, AnimationPtr->GetCurrentAction().c_str()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int A_IsPlaying(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + lua_pushbooleancpp(L, AnimationPtr->IsRunning()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static bool AnimationLoopPointCallback(unsigned int Handle) +{ + lua_State * L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); + LoopPointCallbackPtr->InvokeCallbackFunctions(L, Handle); + + return true; +} + +// ----------------------------------------------------------------------------- + +static int A_RegisterLoopPointCallback(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + luaL_checktype(L, 2, LUA_TFUNCTION); + + lua_pushvalue(L, 2); + LoopPointCallbackPtr->RegisterCallbackFunction(L, AnimationPtr->GetHandle()); + + return 0; +} + +// ----------------------------------------------------------------------------- + +static int A_UnregisterLoopPointCallback(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + luaL_checktype(L, 2, LUA_TFUNCTION); + + lua_pushvalue(L, 2); + LoopPointCallbackPtr->UnregisterCallbackFunction(L, AnimationPtr->GetHandle()); + + return 0; +} + +// ----------------------------------------------------------------------------- + +static bool AnimationActionCallback(unsigned int Handle) +{ + BS_RenderObjectPtr AnimationPtr(Handle); + if (AnimationPtr.IsValid()) + { + ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction(); + lua_State * L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); + ActionCallbackPtr->InvokeCallbackFunctions(L, AnimationPtr->GetHandle()); + } + + return true; +} + +// ----------------------------------------------------------------------------- + +static int A_RegisterActionCallback(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + luaL_checktype(L, 2, LUA_TFUNCTION); + + lua_pushvalue(L, 2); + ActionCallbackPtr->RegisterCallbackFunction(L, AnimationPtr->GetHandle()); + + return 0; +} + +// ----------------------------------------------------------------------------- + +static int A_UnregisterActionCallback(lua_State * L) +{ + BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + BS_ASSERT(AnimationPtr.IsValid()); + luaL_checktype(L, 2, LUA_TFUNCTION); + + lua_pushvalue(L, 2); + ActionCallbackPtr->UnregisterCallbackFunction(L, AnimationPtr->GetHandle()); + + return 0; +} + +// ----------------------------------------------------------------------------- + +static bool AnimationDeleteCallback(unsigned int Handle) +{ + lua_State * L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); + LoopPointCallbackPtr->RemoveAllObjectCallbacks(L, Handle); + + return true; +} + +// ----------------------------------------------------------------------------- + +static int A_Remove(lua_State * L) +{ + BS_RenderObjectPtr 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, + 0, 0, +}; + +// ----------------------------------------------------------------------------- + +static BS_RenderObjectPtr CheckText(lua_State * L) +{ + // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Text + unsigned int * UserDataPtr; + if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) + { + BS_RenderObjectPtr ROPtr(*UserDataPtr); + if (ROPtr.IsValid()) + return ROPtr->ToText(); + else + luaL_error(L, "The text with the handle %d does no longer exist.", *UserDataPtr); + } + else + { + luaL_argcheck(L, 0, 1, "'" TEXT_CLASS_NAME "' expected"); + } + + return BS_RenderObjectPtr(); +} + +// ----------------------------------------------------------------------------- + +static int T_SetFont(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + TextPtr->SetFont(luaL_checkstring(L, 2)); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int T_SetText(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + TextPtr->SetText(luaL_checkstring(L, 2)); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int T_SetAlpha(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + TextPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int T_SetColor(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + TextPtr->SetColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int T_SetAutoWrap(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + TextPtr->SetAutoWrap(lua_tobooleancpp(L, 2)); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int T_SetAutoWrapThreshold(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + TextPtr->SetAutoWrapThreshold(static_cast(luaL_checknumber(L, 2))); + return 0; +} + +// ----------------------------------------------------------------------------- + +static int T_GetText(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + lua_pushstring(L, TextPtr->GetText().c_str()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int T_GetFont(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + lua_pushstring(L, TextPtr->GetFont().c_str()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int T_GetAlpha(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + lua_pushnumber(L, TextPtr->GetAlpha()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int T_GetColor(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + lua_pushnumber(L, TextPtr->GetColor()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int T_IsAutoWrap(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + lua_pushbooleancpp(L, TextPtr->IsAutoWrapActive()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int T_GetAutoWrapThreshold(lua_State * L) +{ + BS_RenderObjectPtr TextPtr = CheckText(L); + BS_ASSERT(TextPtr.IsValid()); + lua_pushnumber(L, TextPtr->GetAutoWrapThreshold()); + return 1; +} + +// ----------------------------------------------------------------------------- + +static int T_Remove(lua_State * L) +{ + BS_RenderObjectPtr 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, + 0, 0, +}; + +// ----------------------------------------------------------------------------- + +bool BS_GraphicEngine::RegisterScriptBindings() +{ + BS_Kernel * pKernel = BS_Kernel::GetInstance(); + BS_ASSERT(pKernel); + BS_ScriptEngine * pScript = static_cast(pKernel->GetService("script")); + BS_ASSERT(pScript); + lua_State * L = static_cast(pScript->GetScriptObject()); + BS_ASSERT(L); + + if (!BS_LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!BS_LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!BS_LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!BS_LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + + if (!BS_LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, PANEL_METHODS)) return false; + if (!BS_LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, BITMAP_METHODS)) return false; + if (!BS_LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, TEXT_METHODS)) return false; + if (!BS_LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, ANIMATION_METHODS)) return false; + + if (!BS_LuaBindhelper::AddMethodsToClass(L, ANIMATION_TEMPLATE_CLASS_NAME, ANIMATION_TEMPLATE_METHODS)) return false; + + if (!BS_LuaBindhelper::AddFunctionsToLib(L, GFX_LIBRARY_NAME, GFX_FUNCTIONS)) return false; + + LoopPointCallbackPtr.reset(new BS_LuaCallback(L)); + ActionCallbackPtr.reset(new ActionCallback(L)); + + return true; +} -- cgit v1.2.3 From e8bca8b8fe0f80e0d5053b190840b034f50ae163 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 30 Jul 2010 09:02:39 +0000 Subject: SWORD25: Fixed rest of the include paths svn-id: r53181 --- engines/sword25/gfx/graphicengine_script.cpp | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 5419f09f2c..13189e1efb 100755 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -24,22 +24,22 @@ #include #include -#include "kernel/common.h" -#include "kernel/kernel.h" -#include "kernel/callbackregistry.h" -#include "script/script.h" -#include "script/luabindhelper.h" -#include "script/luacallback.h" -#include "math/vertex.h" - -#include "graphicengine.h" -#include "renderobject.h" -#include "bitmap.h" -#include "animation.h" -#include "panel.h" -#include "text.h" -#include "animationtemplate.h" -#include "animationtemplateregistry.h" +#include "sword25/kernel/common.h" +#include "sword25/kernel/kernel.h" +#include "sword25/kernel/callbackregistry.h" +#include "sword25/script/script.h" +#include "sword25/script/luabindhelper.h" +#include "sword25/script/luacallback.h" +#include "sword25/math/vertex.h" + +#include "sword25/gfx/graphicengine.h" +#include "sword25/gfx/renderobject.h" +#include "sword25/gfx/bitmap.h" +#include "sword25/gfx/animation.h" +#include "sword25/gfx/panel.h" +#include "sword25/gfx/text.h" +#include "sword25/gfx/animationtemplate.h" +#include "sword25/gfx/animationtemplateregistry.h" #define BS_LOG_PREFIX "GRAPHICENGINE" -- cgit v1.2.3 From 293bf95c01f76c8d812a300eb038854f1246ab3d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 31 Jul 2010 09:53:02 +0000 Subject: SWORD25: Replacing headers with ScummVM ones plus original (C) svn-id: r53188 --- engines/sword25/gfx/graphicengine_script.cpp | 51 ++++++++++++++++++---------- 1 file changed, 33 insertions(+), 18 deletions(-) mode change 100755 => 100644 engines/sword25/gfx/graphicengine_script.cpp (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp old mode 100755 new mode 100644 index 13189e1efb..78100e94c7 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -1,21 +1,36 @@ -// ----------------------------------------------------------------------------- -// This file is part of Broken Sword 2.5 -// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdörfer -// -// Broken Sword 2.5 is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// Broken Sword 2.5 is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Broken Sword 2.5; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// ----------------------------------------------------------------------------- +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +/* + * This code is based on Broken Sword 2.5 engine + * + * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer + * + * Licensed under GNU GPL v2 + * + */ // ----------------------------------------------------------------------------- // Includes -- cgit v1.2.3 From de0fe1db4939bbb787de60231dd30a7b5391f269 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 5 Aug 2010 12:48:19 +0000 Subject: SWORD25: Mass-putting of all files in gfx/ into Sword25 namespace svn-id: r53214 --- engines/sword25/gfx/graphicengine_script.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 78100e94c7..34a464169e 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -56,6 +56,8 @@ #include "sword25/gfx/animationtemplate.h" #include "sword25/gfx/animationtemplateregistry.h" +namespace Sword25 { + #define BS_LOG_PREFIX "GRAPHICENGINE" // ----------------------------------------------------------------------------- @@ -1735,3 +1737,5 @@ bool BS_GraphicEngine::RegisterScriptBindings() return true; } + +} // End of namespace Sword25 -- cgit v1.2.3 From 6dcf9f0ee557e692df3c70a263ca35068ff45380 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 6 Aug 2010 10:59:35 +0000 Subject: SWORD25: std::string -> Common::String in gfx/ svn-id: r53218 --- engines/sword25/gfx/graphicengine_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 34a464169e..3ce41f34e7 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -77,7 +77,7 @@ namespace public: ActionCallback(lua_State * L) : BS_LuaCallback(L) {}; - std::string Action; + Common::String Action; protected: virtual int PreFunctionInvokation(lua_State * L) -- cgit v1.2.3 From a17ec87b7dd09e7b251a3f578d1f788917550451 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 6 Aug 2010 10:59:50 +0000 Subject: SWORD25: Number of compilation and warning fixes svn-id: r53219 --- engines/sword25/gfx/graphicengine_script.cpp | 220 +++++++++++++-------------- 1 file changed, 110 insertions(+), 110 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 3ce41f34e7..74a008d1fc 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -96,9 +96,9 @@ namespace { CallbackfunctionRegisterer() { - BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaLoopPointCB", AnimationLoopPointCallback); - BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaActionCB", AnimationActionCallback); - BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaDeleteCB", AnimationDeleteCallback); + BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaLoopPointCB", (void (*)(int))AnimationLoopPointCallback); + BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaActionCB", (void (*)(int))AnimationActionCallback); + BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaDeleteCB", (void (*)(int))AnimationDeleteCallback); } }; static CallbackfunctionRegisterer Instance; @@ -275,12 +275,12 @@ static int AT_Finalize(lua_State * L) static const luaL_reg ANIMATION_TEMPLATE_METHODS[] = { - "AddFrame", AT_AddFrame, - "SetFrame", AT_SetFrame, - "SetAnimationType", AT_SetAnimationType, - "SetFPS", AT_SetFPS, - "__gc", AT_Finalize, - 0, 0, + {"AddFrame", AT_AddFrame}, + {"SetFrame", AT_SetFrame}, + {"SetAnimationType", AT_SetAnimationType}, + {"SetFPS", AT_SetFPS}, + {"__gc", AT_Finalize}, + {0, 0} }; // ----------------------------------------------------------------------------- @@ -546,26 +546,26 @@ static int GetRepaintedPixels(lua_State * L) 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, - 0, 0, + {"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} }; // ----------------------------------------------------------------------------- @@ -850,24 +850,24 @@ static int RO_Remove(lua_State * L) 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, - 0, 0, + {"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} }; // ----------------------------------------------------------------------------- @@ -929,10 +929,10 @@ static int P_Remove(lua_State * L) static const luaL_reg PANEL_METHODS[] = { - "GetColor", P_GetColor, - "SetColor", P_SetColor, - "Remove", P_Remove, - 0, 0, + {"GetColor", P_GetColor}, + {"SetColor", P_SetColor}, + {"Remove", P_Remove}, + {0, 0} }; // ----------------------------------------------------------------------------- @@ -1144,25 +1144,25 @@ static int B_Remove(lua_State * L) 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, - 0, 0, + {"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} }; // ----------------------------------------------------------------------------- @@ -1507,32 +1507,32 @@ static int A_Remove(lua_State * L) 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, - 0, 0, + {"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} }; // ----------------------------------------------------------------------------- @@ -1691,20 +1691,20 @@ static int T_Remove(lua_State * L) 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, - 0, 0, + {"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} }; // ----------------------------------------------------------------------------- -- cgit v1.2.3 From 47904bc7b2992189bb554833f00a79ff0fea9fb8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 6 Aug 2010 13:13:25 +0000 Subject: SWORD25: Mass-astyle. svn-id: r53222 --- engines/sword25/gfx/graphicengine_script.cpp | 721 ++++++++++----------------- 1 file changed, 272 insertions(+), 449 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 74a008d1fc..d009916f32 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -23,7 +23,7 @@ * */ -/* +/* * This code is based on Broken Sword 2.5 engine * * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer @@ -68,40 +68,35 @@ static bool AnimationDeleteCallback(unsigned int Data); static bool AnimationActionCallback(unsigned int Data); static bool AnimationLoopPointCallback(unsigned int Data); -namespace -{ - // ------------------------------------------------------------------------- +namespace { +// ------------------------------------------------------------------------- - class ActionCallback : public BS_LuaCallback - { - public: - ActionCallback(lua_State * L) : BS_LuaCallback(L) {}; +class ActionCallback : public BS_LuaCallback { +public: + ActionCallback(lua_State *L) : BS_LuaCallback(L) {}; - Common::String Action; + Common::String Action; - protected: - virtual int PreFunctionInvokation(lua_State * L) - { - lua_pushstring(L, Action.c_str()); - return 1; - } - }; +protected: + virtual int PreFunctionInvokation(lua_State *L) { + lua_pushstring(L, Action.c_str()); + return 1; + } +}; - std::auto_ptr LoopPointCallbackPtr; - std::auto_ptr ActionCallbackPtr; +std::auto_ptr LoopPointCallbackPtr; +std::auto_ptr ActionCallbackPtr; - // ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- - struct CallbackfunctionRegisterer - { - CallbackfunctionRegisterer() - { - BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaLoopPointCB", (void (*)(int))AnimationLoopPointCallback); - BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaActionCB", (void (*)(int))AnimationActionCallback); - BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaDeleteCB", (void (*)(int))AnimationDeleteCallback); - } - }; - static CallbackfunctionRegisterer Instance; +struct CallbackfunctionRegisterer { + CallbackfunctionRegisterer() { + BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaLoopPointCB", (void ( *)(int))AnimationLoopPointCallback); + BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaActionCB", (void ( *)(int))AnimationActionCallback); + BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaDeleteCB", (void ( *)(int))AnimationDeleteCallback); + } +}; +static CallbackfunctionRegisterer Instance; } // ----------------------------------------------------------------------------- @@ -115,24 +110,20 @@ namespace #define TEXT_CLASS_NAME "Gfx.Text" #define ANIMATION_CLASS_NAME "Gfx.Animation" #define ANIMATION_TEMPLATE_CLASS_NAME "Gfx.AnimationTemplate" -static const char * GFX_LIBRARY_NAME = "Gfx"; +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) -{ +static void *my_checkudata(lua_State *L, int ud, const char *tname) { int top = lua_gettop(L); - void * p = lua_touserdata(L, ud); - if (p != NULL) /* value is a userdata? */ - { - if (lua_getmetatable(L, ud)) /* does it have a metatable? */ - { + void *p = lua_touserdata(L, ud); + if (p != NULL) { /* value is a userdata? */ + if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ // lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ BS_LuaBindhelper::GetMetatable(L, tname); - if (lua_rawequal(L, -1, -2)) /* does it have the correct mt? */ - { + if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ lua_settop(L, top); return p; } @@ -145,27 +136,22 @@ static void * my_checkudata (lua_State *L, int ud, const char *tname) // ----------------------------------------------------------------------------- -static void NewUintUserData(lua_State * L, unsigned int Value) -{ - void * UserData = lua_newuserdata(L, sizeof(Value)); +static void NewUintUserData(lua_State *L, unsigned int Value) { + void *UserData = lua_newuserdata(L, sizeof(Value)); memcpy(UserData, &Value, sizeof(Value)); } // ----------------------------------------------------------------------------- -static BS_AnimationTemplate * CheckAnimationTemplate(lua_State * L, int idx = 1) -{ +static BS_AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.AnimationTemplate unsigned int AnimationTemplateHandle; - if ((AnimationTemplateHandle = *reinterpret_cast(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) - { - BS_AnimationTemplate * AnimationTemplatePtr = BS_AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); + if ((AnimationTemplateHandle = *reinterpret_cast(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) { + BS_AnimationTemplate *AnimationTemplatePtr = BS_AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); if (!AnimationTemplatePtr) luaL_error(L, "The animation template with the handle %d does no longer exist.", AnimationTemplateHandle); return AnimationTemplatePtr; - } - else - { + } else { luaL_argcheck(L, 0, idx, "'" ANIMATION_TEMPLATE_CLASS_NAME "' expected"); return 0; } @@ -174,20 +160,16 @@ static BS_AnimationTemplate * CheckAnimationTemplate(lua_State * L, int idx = 1) // ----------------------------------------------------------------------------- -static int NewAnimationTemplate(lua_State * L) -{ +static int NewAnimationTemplate(lua_State *L) { unsigned int AnimationTemplateHandle = BS_AnimationTemplate::Create(luaL_checkstring(L, 1)); - BS_AnimationTemplate * AnimationTemplatePtr = BS_AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); - if (AnimationTemplatePtr && AnimationTemplatePtr->IsValid()) - { + BS_AnimationTemplate *AnimationTemplatePtr = BS_AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); + if (AnimationTemplatePtr && AnimationTemplatePtr->IsValid()) { NewUintUserData(L, AnimationTemplateHandle); //luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); BS_LuaBindhelper::GetMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); - } - else - { + } else { lua_pushnil(L); } @@ -196,85 +178,69 @@ static int NewAnimationTemplate(lua_State * L) // ----------------------------------------------------------------------------- -static int AT_AddFrame(lua_State * L) -{ - BS_AnimationTemplate * pAT = CheckAnimationTemplate(L); +static int AT_AddFrame(lua_State *L) { + BS_AnimationTemplate *pAT = CheckAnimationTemplate(L); pAT->AddFrame(static_cast(luaL_checknumber(L, 2))); return 0; } // ----------------------------------------------------------------------------- -static int AT_SetFrame(lua_State * L) -{ - BS_AnimationTemplate * pAT = CheckAnimationTemplate(L); +static int AT_SetFrame(lua_State *L) { + BS_AnimationTemplate *pAT = CheckAnimationTemplate(L); pAT->SetFrame(static_cast(luaL_checknumber(L, 2)), static_cast(luaL_checknumber(L, 3))); return 0; } // ----------------------------------------------------------------------------- -static bool AnimationTypeStringToNumber(const char * TypeString, BS_Animation::ANIMATION_TYPES & Result) -{ - if (strcmp(TypeString, "jojo") == 0) - { +static bool AnimationTypeStringToNumber(const char *TypeString, BS_Animation::ANIMATION_TYPES &Result) { + if (strcmp(TypeString, "jojo") == 0) { Result = BS_Animation::AT_JOJO; return true; - } - else if (strcmp(TypeString, "loop") == 0) - { + } else if (strcmp(TypeString, "loop") == 0) { Result = BS_Animation::AT_LOOP; return true; - } - else if (strcmp(TypeString, "oneshot") == 0) - { + } else if (strcmp(TypeString, "oneshot") == 0) { Result = BS_Animation::AT_ONESHOT; return true; - } - else + } else return false; } // ----------------------------------------------------------------------------- -static int AT_SetAnimationType(lua_State * L) -{ - BS_AnimationTemplate * pAT = CheckAnimationTemplate(L); +static int AT_SetAnimationType(lua_State *L) { + BS_AnimationTemplate *pAT = CheckAnimationTemplate(L); BS_Animation::ANIMATION_TYPES AnimationType; - if (AnimationTypeStringToNumber(luaL_checkstring(L, 2), AnimationType)) - { + if (AnimationTypeStringToNumber(luaL_checkstring(L, 2), AnimationType)) { pAT->SetAnimationType(AnimationType); - } - else - { + } else { luaL_argcheck(L, 0, 2, "Invalid animation type"); } - + return 0; } // ----------------------------------------------------------------------------- -static int AT_SetFPS(lua_State * L) -{ - BS_AnimationTemplate * pAT = CheckAnimationTemplate(L); +static int AT_SetFPS(lua_State *L) { + BS_AnimationTemplate *pAT = CheckAnimationTemplate(L); pAT->SetFPS(static_cast(luaL_checknumber(L, 2))); return 0; } // ----------------------------------------------------------------------------- -static int AT_Finalize(lua_State * L) -{ - BS_AnimationTemplate * pAT = CheckAnimationTemplate(L); +static int AT_Finalize(lua_State *L) { + BS_AnimationTemplate *pAT = CheckAnimationTemplate(L); delete pAT; return 0; } // ----------------------------------------------------------------------------- -static const luaL_reg ANIMATION_TEMPLATE_METHODS[] = -{ +static const luaL_reg ANIMATION_TEMPLATE_METHODS[] = { {"AddFrame", AT_AddFrame}, {"SetFrame", AT_SetFrame}, {"SetAnimationType", AT_SetAnimationType}, @@ -285,47 +251,44 @@ static const luaL_reg ANIMATION_TEMPLATE_METHODS[] = // ----------------------------------------------------------------------------- -static BS_GraphicEngine * GetGE() -{ - BS_Kernel * pKernel = BS_Kernel::GetInstance(); +static BS_GraphicEngine *GetGE() { + BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_GraphicEngine * pGE = static_cast(pKernel->GetService("gfx")); + BS_GraphicEngine *pGE = static_cast(pKernel->GetService("gfx")); BS_ASSERT(pGE); return pGE; } // ----------------------------------------------------------------------------- -static int Init(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); - - switch (lua_gettop(L)) - { - case 0: - lua_pushbooleancpp(L, pGE->Init()); - break; - case 1: - lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L, 1)))); - break; - case 2: - lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L,1)), static_cast(luaL_checknumber(L, 2)))); - break; - case 3: - lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L,1)), static_cast(luaL_checknumber(L, 2)), - static_cast(luaL_checknumber(L, 3)))); - break; - case 4: - lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L,1)), static_cast(luaL_checknumber(L, 2)), - static_cast(luaL_checknumber(L, 3)), static_cast(luaL_checknumber(L, 4)))); - break; - default: - lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L,1)), static_cast(luaL_checknumber(L, 2)), - static_cast(luaL_checknumber(L, 3)), static_cast(luaL_checknumber(L, 4)), - lua_tobooleancpp(L, 5))); +static int Init(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); + + switch (lua_gettop(L)) { + case 0: + lua_pushbooleancpp(L, pGE->Init()); + break; + case 1: + lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L, 1)))); + break; + case 2: + lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2)))); + break; + case 3: + lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2)), + static_cast(luaL_checknumber(L, 3)))); + break; + case 4: + lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2)), + static_cast(luaL_checknumber(L, 3)), static_cast(luaL_checknumber(L, 4)))); + break; + default: + lua_pushbooleancpp(L, pGE->Init(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2)), + static_cast(luaL_checknumber(L, 3)), static_cast(luaL_checknumber(L, 4)), + lua_tobooleancpp(L, 5))); } - + #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -345,7 +308,7 @@ static int Init(lua_State * L) BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); - lua_pushstring(L, "MainPanel"); + lua_pushstring(L, "MainPanel"); lua_insert(L, -2); lua_settable(L, -3); @@ -360,9 +323,8 @@ static int Init(lua_State * L) // ----------------------------------------------------------------------------- -static int StartFrame(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int StartFrame(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); if (lua_gettop(L) == 0) lua_pushbooleancpp(L, pGE->StartFrame()); @@ -374,9 +336,8 @@ static int StartFrame(lua_State * L) // ----------------------------------------------------------------------------- -static int EndFrame(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int EndFrame(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushbooleancpp(L, pGE->EndFrame()); @@ -385,9 +346,8 @@ static int EndFrame(lua_State * L) // ----------------------------------------------------------------------------- -static int DrawDebugLine(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int DrawDebugLine(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); BS_Vertex Start; BS_Vertex End; @@ -400,9 +360,8 @@ static int DrawDebugLine(lua_State * L) // ----------------------------------------------------------------------------- -static int GetDisplayWidth(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int GetDisplayWidth(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetDisplayWidth()); @@ -411,9 +370,8 @@ static int GetDisplayWidth(lua_State * L) // ----------------------------------------------------------------------------- -static int GetDisplayHeight(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int GetDisplayHeight(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetDisplayHeight()); @@ -422,9 +380,8 @@ static int GetDisplayHeight(lua_State * L) // ----------------------------------------------------------------------------- -static int GetBitDepth(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int GetBitDepth(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetBitDepth()); @@ -433,9 +390,8 @@ static int GetBitDepth(lua_State * L) // ----------------------------------------------------------------------------- -static int SetVsync(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int SetVsync(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); pGE->SetVsync(lua_tobooleancpp(L, 1)); @@ -444,9 +400,8 @@ static int SetVsync(lua_State * L) // ----------------------------------------------------------------------------- -static int IsVsync(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int IsVsync(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushbooleancpp(L, pGE->GetVsync()); @@ -455,9 +410,8 @@ static int IsVsync(lua_State * L) // ----------------------------------------------------------------------------- -static int IsWindowed(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int IsWindowed(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushbooleancpp(L, pGE->IsWindowed()); @@ -466,9 +420,8 @@ static int IsWindowed(lua_State * L) // ----------------------------------------------------------------------------- -static int GetFPSCount(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int GetFPSCount(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetFPSCount()); @@ -477,9 +430,8 @@ static int GetFPSCount(lua_State * L) // ----------------------------------------------------------------------------- -static int GetLastFrameDuration(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int GetLastFrameDuration(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetLastFrameDuration()); @@ -488,27 +440,24 @@ static int GetLastFrameDuration(lua_State * L) // ----------------------------------------------------------------------------- -static int StopMainTimer(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int StopMainTimer(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); pGE->StopMainTimer(); return 0; } // ----------------------------------------------------------------------------- -static int ResumeMainTimer(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int ResumeMainTimer(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); pGE->ResumeMainTimer(); return 0; } // ----------------------------------------------------------------------------- -static int GetSecondaryFrameDuration(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int GetSecondaryFrameDuration(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetSecondaryFrameDuration()); @@ -517,35 +466,31 @@ static int GetSecondaryFrameDuration(lua_State * L) // ----------------------------------------------------------------------------- -static int SaveScreenshot(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int SaveScreenshot(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushbooleancpp(L, pGE->SaveScreenshot(luaL_checkstring(L, 1))); return 1; } // ----------------------------------------------------------------------------- -static int SaveThumbnailScreenshot(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int SaveThumbnailScreenshot(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushbooleancpp(L, pGE->SaveThumbnailScreenshot(luaL_checkstring(L, 1))); return 1; } // ----------------------------------------------------------------------------- -static int GetRepaintedPixels(lua_State * L) -{ - BS_GraphicEngine * pGE = GetGE(); +static int GetRepaintedPixels(lua_State *L) { + BS_GraphicEngine *pGE = GetGE(); lua_pushnumber(L, static_cast(pGE->GetRepaintedPixels())); return 1; } // ----------------------------------------------------------------------------- -static const luaL_reg GFX_FUNCTIONS[] = -{ +static const luaL_reg GFX_FUNCTIONS[] = { {"Init", Init}, {"StartFrame", StartFrame}, {"EndFrame", EndFrame}, @@ -570,26 +515,21 @@ static const luaL_reg GFX_FUNCTIONS[] = // ----------------------------------------------------------------------------- -static BS_RenderObjectPtr CheckRenderObject(lua_State * L, bool ErrorIfRemoved = true) -{ +static BS_RenderObjectPtr 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". - unsigned int * UserDataPtr; + unsigned int *UserDataPtr; if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 || - (UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 || - (UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 || - (UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) - { + (UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 || + (UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 || + (UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { BS_RenderObjectPtr ROPtr(* UserDataPtr); if (ROPtr.IsValid()) return ROPtr; - else - { + else { if (ErrorIfRemoved) luaL_error(L, "The renderobject with the handle %d does no longer exist.", * UserDataPtr); } - } - else - { + } else { luaL_argcheck(L, 0, 1, "'" RENDEROBJECT_CLASS_NAME "' expected"); } @@ -598,8 +538,7 @@ static BS_RenderObjectPtr CheckRenderObject(lua_State * L, bool // ----------------------------------------------------------------------------- -static int RO_SetPos(lua_State * L) -{ +static int RO_SetPos(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); BS_Vertex Pos; @@ -610,8 +549,7 @@ static int RO_SetPos(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_SetX(lua_State * L) -{ +static int RO_SetX(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr->SetX(static_cast(luaL_checknumber(L, 2))); @@ -620,8 +558,7 @@ static int RO_SetX(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_SetY(lua_State * L) -{ +static int RO_SetY(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr->SetY(static_cast(luaL_checknumber(L, 2))); @@ -630,8 +567,7 @@ static int RO_SetY(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_SetZ(lua_State * L) -{ +static int RO_SetZ(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr->SetZ(static_cast(luaL_checknumber(L, 2))); @@ -640,8 +576,7 @@ static int RO_SetZ(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_SetVisible(lua_State * L) -{ +static int RO_SetVisible(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr->SetVisible(lua_tobooleancpp(L, 2)); @@ -650,8 +585,7 @@ static int RO_SetVisible(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_GetX(lua_State * L) -{ +static int RO_GetX(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetX()); @@ -661,8 +595,7 @@ static int RO_GetX(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_GetY(lua_State * L) -{ +static int RO_GetY(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetY()); @@ -672,8 +605,7 @@ static int RO_GetY(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_GetZ(lua_State * L) -{ +static int RO_GetZ(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetZ()); @@ -683,8 +615,7 @@ static int RO_GetZ(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_GetAbsoluteX(lua_State * L) -{ +static int RO_GetAbsoluteX(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetAbsoluteX()); @@ -694,66 +625,59 @@ static int RO_GetAbsoluteX(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_GetAbsoluteY(lua_State * L) -{ +static int RO_GetAbsoluteY(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetAbsoluteY()); - + return 1; } // ----------------------------------------------------------------------------- -static int RO_GetWidth(lua_State * L) -{ +static int RO_GetWidth(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetWidth()); - + return 1; } // ----------------------------------------------------------------------------- -static int RO_GetHeight(lua_State * L) -{ +static int RO_GetHeight(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetHeight()); - + return 1; } // ----------------------------------------------------------------------------- -static int RO_IsVisible(lua_State * L) -{ +static int RO_IsVisible(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushbooleancpp(L, ROPtr->IsVisible()); - + return 1; } // ----------------------------------------------------------------------------- -static int RO_AddPanel(lua_State * L) -{ +static int RO_AddPanel(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); BS_RenderObjectPtr PanelPtr = ROPtr->AddPanel(static_cast(luaL_checknumber(L, 2)), - static_cast(luaL_checknumber(L, 3)), - BS_GraphicEngine::LuaColorToARGBColor(L, 4)); - if (PanelPtr.IsValid()) - { + static_cast(luaL_checknumber(L, 3)), + BS_GraphicEngine::LuaColorToARGBColor(L, 4)); + if (PanelPtr.IsValid()) { NewUintUserData(L, PanelPtr->GetHandle()); // luaL_getmetatable(L, PANEL_CLASS_NAME); BS_LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); - } - else + } else lua_pushnil(L); return 1; @@ -761,20 +685,17 @@ static int RO_AddPanel(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_AddBitmap(lua_State * L) -{ +static int RO_AddBitmap(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); BS_RenderObjectPtr BitmaPtr = ROPtr->AddBitmap(luaL_checkstring(L, 2)); - if (BitmaPtr.IsValid()) - { + if (BitmaPtr.IsValid()) { NewUintUserData(L, BitmaPtr->GetHandle()); // luaL_getmetatable(L, BITMAP_CLASS_NAME); BS_LuaBindhelper::GetMetatable(L, BITMAP_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); - } - else + } else lua_pushnil(L); return 1; @@ -782,8 +703,7 @@ static int RO_AddBitmap(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_AddText(lua_State * L) -{ +static int RO_AddText(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); @@ -791,15 +711,13 @@ static int RO_AddText(lua_State * L) 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()) - { + if (TextPtr.IsValid()) { NewUintUserData(L, TextPtr->GetHandle()); // luaL_getmetatable(L, TEXT_CLASS_NAME); BS_LuaBindhelper::GetMetatable(L, TEXT_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); - } - else + } else lua_pushnil(L); return 1; @@ -807,8 +725,7 @@ static int RO_AddText(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_AddAnimation(lua_State * L) -{ +static int RO_AddAnimation(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); @@ -818,8 +735,7 @@ static int RO_AddAnimation(lua_State * L) else AnimationPtr = ROPtr->AddAnimation(luaL_checkstring(L, 2)); - if (AnimationPtr.IsValid()) - { + if (AnimationPtr.IsValid()) { NewUintUserData(L, AnimationPtr->GetHandle()); // luaL_getmetatable(L, ANIMATION_CLASS_NAME); BS_LuaBindhelper::GetMetatable(L, ANIMATION_CLASS_NAME); @@ -830,8 +746,7 @@ static int RO_AddAnimation(lua_State * L) AnimationPtr->RegisterDeleteCallback(AnimationDeleteCallback, AnimationPtr->GetHandle()); AnimationPtr->RegisterLoopPointCallback(AnimationLoopPointCallback, AnimationPtr->GetHandle()); AnimationPtr->RegisterActionCallback(AnimationActionCallback, AnimationPtr->GetHandle()); - } - else + } else lua_pushnil(L); return 1; @@ -839,8 +754,7 @@ static int RO_AddAnimation(lua_State * L) // ----------------------------------------------------------------------------- -static int RO_Remove(lua_State * L) -{ +static int RO_Remove(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); ROPtr.Erase(); return 0; @@ -848,8 +762,7 @@ static int RO_Remove(lua_State * L) // ----------------------------------------------------------------------------- -static const luaL_reg RENDEROBJECT_METHODS[] = -{ +static const luaL_reg RENDEROBJECT_METHODS[] = { {"AddAnimation", RO_AddAnimation}, {"AddText", RO_AddText}, {"AddBitmap", RO_AddBitmap}, @@ -872,22 +785,16 @@ static const luaL_reg RENDEROBJECT_METHODS[] = // ----------------------------------------------------------------------------- -static BS_RenderObjectPtr CheckPanel(lua_State * L) -{ +static BS_RenderObjectPtr CheckPanel(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Panel - unsigned int * UserDataPtr; - if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) - { + unsigned int *UserDataPtr; + if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) { BS_RenderObjectPtr ROPtr(*UserDataPtr); - if (ROPtr.IsValid()) - { + if (ROPtr.IsValid()) { return ROPtr->ToPanel(); - } - else + } else luaL_error(L, "The panel with the handle %d does no longer exist.", *UserDataPtr); - } - else - { + } else { luaL_argcheck(L, 0, 1, "'" PANEL_CLASS_NAME "' expected"); } @@ -896,19 +803,17 @@ static BS_RenderObjectPtr CheckPanel(lua_State * L) // ----------------------------------------------------------------------------- -static int P_GetColor(lua_State * L) -{ +static int P_GetColor(lua_State *L) { BS_RenderObjectPtr PanelPtr = CheckPanel(L); BS_ASSERT(PanelPtr.IsValid()); BS_GraphicEngine::ARGBColorToLuaColor(L, PanelPtr->GetColor()); - + return 1; } // ----------------------------------------------------------------------------- -static int P_SetColor(lua_State * L) -{ +static int P_SetColor(lua_State *L) { BS_RenderObjectPtr PanelPtr = CheckPanel(L); BS_ASSERT(PanelPtr.IsValid()); PanelPtr->SetColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); @@ -917,8 +822,7 @@ static int P_SetColor(lua_State * L) // ----------------------------------------------------------------------------- -static int P_Remove(lua_State * L) -{ +static int P_Remove(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr.Erase(); @@ -927,8 +831,7 @@ static int P_Remove(lua_State * L) // ----------------------------------------------------------------------------- -static const luaL_reg PANEL_METHODS[] = -{ +static const luaL_reg PANEL_METHODS[] = { {"GetColor", P_GetColor}, {"SetColor", P_SetColor}, {"Remove", P_Remove}, @@ -937,22 +840,16 @@ static const luaL_reg PANEL_METHODS[] = // ----------------------------------------------------------------------------- -static BS_RenderObjectPtr CheckBitmap(lua_State * L) -{ +static BS_RenderObjectPtr CheckBitmap(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Bitmap - unsigned int * UserDataPtr; - if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) - { + unsigned int *UserDataPtr; + if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) { BS_RenderObjectPtr ROPtr(*UserDataPtr); - if (ROPtr.IsValid()) - { + if (ROPtr.IsValid()) { return ROPtr->ToBitmap(); - } - else + } else luaL_error(L, "The bitmap with the handle %d does no longer exist.", *UserDataPtr); - } - else - { + } else { luaL_argcheck(L, 0, 1, "'" BITMAP_CLASS_NAME "' expected"); } @@ -961,8 +858,7 @@ static BS_RenderObjectPtr CheckBitmap(lua_State * L) // ----------------------------------------------------------------------------- -static int B_SetAlpha(lua_State * L) -{ +static int B_SetAlpha(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); @@ -971,8 +867,7 @@ static int B_SetAlpha(lua_State * L) // ----------------------------------------------------------------------------- -static int B_SetTintColor(lua_State * L) -{ +static int B_SetTintColor(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetModulationColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); @@ -981,8 +876,7 @@ static int B_SetTintColor(lua_State * L) // ----------------------------------------------------------------------------- -static int B_SetScaleFactor(lua_State * L) -{ +static int B_SetScaleFactor(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 2))); @@ -991,8 +885,7 @@ static int B_SetScaleFactor(lua_State * L) // ----------------------------------------------------------------------------- -static int B_SetScaleFactorX(lua_State * L) -{ +static int B_SetScaleFactorX(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetScaleFactorX(static_cast(luaL_checknumber(L, 2))); @@ -1001,8 +894,7 @@ static int B_SetScaleFactorX(lua_State * L) // ----------------------------------------------------------------------------- -static int B_SetScaleFactorY(lua_State * L) -{ +static int B_SetScaleFactorY(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetScaleFactorY(static_cast(luaL_checknumber(L, 2))); @@ -1011,8 +903,7 @@ static int B_SetScaleFactorY(lua_State * L) // ----------------------------------------------------------------------------- -static int B_SetFlipH(lua_State * L) -{ +static int B_SetFlipH(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetFlipH(lua_tobooleancpp(L, 2)); @@ -1021,8 +912,7 @@ static int B_SetFlipH(lua_State * L) // ----------------------------------------------------------------------------- -static int B_SetFlipV(lua_State * L) -{ +static int B_SetFlipV(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetFlipV(lua_tobooleancpp(L, 2)); @@ -1031,8 +921,7 @@ static int B_SetFlipV(lua_State * L) // ----------------------------------------------------------------------------- -static int B_GetAlpha(lua_State * L) -{ +static int B_GetAlpha(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushnumber(L, BitmapPtr->GetAlpha()); @@ -1041,8 +930,7 @@ static int B_GetAlpha(lua_State * L) // ----------------------------------------------------------------------------- -static int B_GetTintColor(lua_State * L) -{ +static int B_GetTintColor(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BS_GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->GetModulationColor()); @@ -1051,8 +939,7 @@ static int B_GetTintColor(lua_State * L) // ----------------------------------------------------------------------------- -static int B_GetScaleFactorX(lua_State * L) -{ +static int B_GetScaleFactorX(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushnumber(L, BitmapPtr->GetScaleFactorX()); @@ -1061,8 +948,7 @@ static int B_GetScaleFactorX(lua_State * L) // ----------------------------------------------------------------------------- -static int B_GetScaleFactorY(lua_State * L) -{ +static int B_GetScaleFactorY(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushnumber(L, BitmapPtr->GetScaleFactorY()); @@ -1071,8 +957,7 @@ static int B_GetScaleFactorY(lua_State * L) // ----------------------------------------------------------------------------- -static int B_IsFlipH(lua_State * L) -{ +static int B_IsFlipH(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushbooleancpp(L, BitmapPtr->IsFlipH()); @@ -1081,8 +966,7 @@ static int B_IsFlipH(lua_State * L) // ----------------------------------------------------------------------------- -static int B_IsFlipV(lua_State * L) -{ +static int B_IsFlipV(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushbooleancpp(L, BitmapPtr->IsFlipV()); @@ -1091,8 +975,7 @@ static int B_IsFlipV(lua_State * L) // ----------------------------------------------------------------------------- -static int B_GetPixel(lua_State * L) -{ +static int B_GetPixel(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BS_Vertex Pos; @@ -1103,8 +986,7 @@ static int B_GetPixel(lua_State * L) // ----------------------------------------------------------------------------- -static int B_IsScalingAllowed(lua_State * L) -{ +static int B_IsScalingAllowed(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushbooleancpp(L, BitmapPtr->IsScalingAllowed()); @@ -1113,8 +995,7 @@ static int B_IsScalingAllowed(lua_State * L) // ----------------------------------------------------------------------------- -static int B_IsAlphaAllowed(lua_State * L) -{ +static int B_IsAlphaAllowed(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushbooleancpp(L, BitmapPtr->IsAlphaAllowed()); @@ -1123,8 +1004,7 @@ static int B_IsAlphaAllowed(lua_State * L) // ----------------------------------------------------------------------------- -static int B_IsTintingAllowed(lua_State * L) -{ +static int B_IsTintingAllowed(lua_State *L) { BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushbooleancpp(L, BitmapPtr->IsColorModulationAllowed()); @@ -1132,8 +1012,7 @@ static int B_IsTintingAllowed(lua_State * L) } // ----------------------------------------------------------------------------- -static int B_Remove(lua_State * L) -{ +static int B_Remove(lua_State *L) { BS_RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr.Erase(); @@ -1142,8 +1021,7 @@ static int B_Remove(lua_State * L) // ----------------------------------------------------------------------------- -static const luaL_reg BITMAP_METHODS[] = -{ +static const luaL_reg BITMAP_METHODS[] = { {"SetAlpha", B_SetAlpha}, {"SetTintColor", B_SetTintColor}, {"SetScaleFactor", B_SetScaleFactor}, @@ -1167,22 +1045,17 @@ static const luaL_reg BITMAP_METHODS[] = // ----------------------------------------------------------------------------- -static BS_RenderObjectPtr CheckAnimation(lua_State * L) -{ +static BS_RenderObjectPtr CheckAnimation(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Animation - unsigned int * UserDataPtr; - if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) - { + unsigned int *UserDataPtr; + if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) { BS_RenderObjectPtr ROPtr(*UserDataPtr); if (ROPtr.IsValid()) return ROPtr->ToAnimation(); - else - { + else { luaL_error(L, "The animation with the handle %d does no longer exist.", *UserDataPtr); } - } - else - { + } else { luaL_argcheck(L, 0, 1, "'" ANIMATION_CLASS_NAME "' expected"); } @@ -1191,8 +1064,7 @@ static BS_RenderObjectPtr CheckAnimation(lua_State * L) // ----------------------------------------------------------------------------- -static int A_Play(lua_State * L) -{ +static int A_Play(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->Play(); @@ -1201,8 +1073,7 @@ static int A_Play(lua_State * L) // ----------------------------------------------------------------------------- -static int A_Pause(lua_State * L) -{ +static int A_Pause(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->Pause(); @@ -1211,8 +1082,7 @@ static int A_Pause(lua_State * L) // ----------------------------------------------------------------------------- -static int A_Stop(lua_State * L) -{ +static int A_Stop(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->Stop(); @@ -1221,8 +1091,7 @@ static int A_Stop(lua_State * L) // ----------------------------------------------------------------------------- -static int A_SetFrame(lua_State * L) -{ +static int A_SetFrame(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetFrame(static_cast(luaL_checknumber(L, 2))); @@ -1231,8 +1100,7 @@ static int A_SetFrame(lua_State * L) // ----------------------------------------------------------------------------- -static int A_SetAlpha(lua_State * L) -{ +static int A_SetAlpha(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); @@ -1240,8 +1108,7 @@ static int A_SetAlpha(lua_State * L) } // ----------------------------------------------------------------------------- -static int A_SetTintColor(lua_State * L) -{ +static int A_SetTintColor(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetModulationColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); @@ -1250,8 +1117,7 @@ static int A_SetTintColor(lua_State * L) // ----------------------------------------------------------------------------- -static int A_SetScaleFactor(lua_State * L) -{ +static int A_SetScaleFactor(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 2))); @@ -1260,8 +1126,7 @@ static int A_SetScaleFactor(lua_State * L) // ----------------------------------------------------------------------------- -static int A_SetScaleFactorX(lua_State * L) -{ +static int A_SetScaleFactorX(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetScaleFactorX(static_cast(luaL_checknumber(L, 2))); @@ -1270,8 +1135,7 @@ static int A_SetScaleFactorX(lua_State * L) // ----------------------------------------------------------------------------- -static int A_SetScaleFactorY(lua_State * L) -{ +static int A_SetScaleFactorY(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetScaleFactorY(static_cast(luaL_checknumber(L, 2))); @@ -1280,8 +1144,7 @@ static int A_SetScaleFactorY(lua_State * L) // ----------------------------------------------------------------------------- -static int A_GetScaleFactorX(lua_State * L) -{ +static int A_GetScaleFactorX(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushnumber(L, AnimationPtr->GetScaleFactorX()); @@ -1290,8 +1153,7 @@ static int A_GetScaleFactorX(lua_State * L) // ----------------------------------------------------------------------------- -static int A_GetScaleFactorY(lua_State * L) -{ +static int A_GetScaleFactorY(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushnumber(L, AnimationPtr->GetScaleFactorY()); @@ -1300,31 +1162,28 @@ static int A_GetScaleFactorY(lua_State * L) // ----------------------------------------------------------------------------- -static int A_GetAnimationType(lua_State * L) -{ +static int A_GetAnimationType(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); - switch (AnimationPtr->GetAnimationType()) - { - case BS_Animation::AT_JOJO: - lua_pushstring(L, "jojo"); - break; - case BS_Animation::AT_LOOP: - lua_pushstring(L, "loop"); - break; - case BS_Animation::AT_ONESHOT: - lua_pushstring(L, "oneshot"); - break; - default: - BS_ASSERT(false); + switch (AnimationPtr->GetAnimationType()) { + case BS_Animation::AT_JOJO: + lua_pushstring(L, "jojo"); + break; + case BS_Animation::AT_LOOP: + lua_pushstring(L, "loop"); + break; + case BS_Animation::AT_ONESHOT: + lua_pushstring(L, "oneshot"); + break; + default: + BS_ASSERT(false); } return 1; } // ----------------------------------------------------------------------------- -static int A_GetFPS(lua_State * L) -{ +static int A_GetFPS(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushnumber(L, AnimationPtr->GetFPS()); @@ -1334,8 +1193,7 @@ static int A_GetFPS(lua_State * L) // ----------------------------------------------------------------------------- -static int A_GetFrameCount(lua_State * L) -{ +static int A_GetFrameCount(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushnumber(L, AnimationPtr->GetFrameCount()); @@ -1344,8 +1202,7 @@ static int A_GetFrameCount(lua_State * L) // ----------------------------------------------------------------------------- -static int A_IsScalingAllowed(lua_State * L) -{ +static int A_IsScalingAllowed(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushbooleancpp(L, AnimationPtr->IsScalingAllowed()); @@ -1354,8 +1211,7 @@ static int A_IsScalingAllowed(lua_State * L) // ----------------------------------------------------------------------------- -static int A_IsAlphaAllowed(lua_State * L) -{ +static int A_IsAlphaAllowed(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushbooleancpp(L, AnimationPtr->IsAlphaAllowed()); @@ -1364,8 +1220,7 @@ static int A_IsAlphaAllowed(lua_State * L) // ----------------------------------------------------------------------------- -static int A_IsTintingAllowed(lua_State * L) -{ +static int A_IsTintingAllowed(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushbooleancpp(L, AnimationPtr->IsColorModulationAllowed()); @@ -1374,8 +1229,7 @@ static int A_IsTintingAllowed(lua_State * L) // ----------------------------------------------------------------------------- -static int A_GetCurrentFrame(lua_State * L) -{ +static int A_GetCurrentFrame(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushnumber(L, AnimationPtr->GetCurrentFrame()); @@ -1384,8 +1238,7 @@ static int A_GetCurrentFrame(lua_State * L) // ----------------------------------------------------------------------------- -static int A_GetCurrentAction(lua_State * L) -{ +static int A_GetCurrentAction(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushstring(L, AnimationPtr->GetCurrentAction().c_str()); @@ -1394,8 +1247,7 @@ static int A_GetCurrentAction(lua_State * L) // ----------------------------------------------------------------------------- -static int A_IsPlaying(lua_State * L) -{ +static int A_IsPlaying(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushbooleancpp(L, AnimationPtr->IsRunning()); @@ -1404,9 +1256,8 @@ static int A_IsPlaying(lua_State * L) // ----------------------------------------------------------------------------- -static bool AnimationLoopPointCallback(unsigned int Handle) -{ - lua_State * L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); +static bool AnimationLoopPointCallback(unsigned int Handle) { + lua_State *L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); LoopPointCallbackPtr->InvokeCallbackFunctions(L, Handle); return true; @@ -1414,8 +1265,7 @@ static bool AnimationLoopPointCallback(unsigned int Handle) // ----------------------------------------------------------------------------- -static int A_RegisterLoopPointCallback(lua_State * L) -{ +static int A_RegisterLoopPointCallback(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); luaL_checktype(L, 2, LUA_TFUNCTION); @@ -1428,8 +1278,7 @@ static int A_RegisterLoopPointCallback(lua_State * L) // ----------------------------------------------------------------------------- -static int A_UnregisterLoopPointCallback(lua_State * L) -{ +static int A_UnregisterLoopPointCallback(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); luaL_checktype(L, 2, LUA_TFUNCTION); @@ -1442,13 +1291,11 @@ static int A_UnregisterLoopPointCallback(lua_State * L) // ----------------------------------------------------------------------------- -static bool AnimationActionCallback(unsigned int Handle) -{ +static bool AnimationActionCallback(unsigned int Handle) { BS_RenderObjectPtr AnimationPtr(Handle); - if (AnimationPtr.IsValid()) - { + if (AnimationPtr.IsValid()) { ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction(); - lua_State * L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); + lua_State *L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); ActionCallbackPtr->InvokeCallbackFunctions(L, AnimationPtr->GetHandle()); } @@ -1457,8 +1304,7 @@ static bool AnimationActionCallback(unsigned int Handle) // ----------------------------------------------------------------------------- -static int A_RegisterActionCallback(lua_State * L) -{ +static int A_RegisterActionCallback(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); luaL_checktype(L, 2, LUA_TFUNCTION); @@ -1471,8 +1317,7 @@ static int A_RegisterActionCallback(lua_State * L) // ----------------------------------------------------------------------------- -static int A_UnregisterActionCallback(lua_State * L) -{ +static int A_UnregisterActionCallback(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); luaL_checktype(L, 2, LUA_TFUNCTION); @@ -1485,9 +1330,8 @@ static int A_UnregisterActionCallback(lua_State * L) // ----------------------------------------------------------------------------- -static bool AnimationDeleteCallback(unsigned int Handle) -{ - lua_State * L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); +static bool AnimationDeleteCallback(unsigned int Handle) { + lua_State *L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); LoopPointCallbackPtr->RemoveAllObjectCallbacks(L, Handle); return true; @@ -1495,8 +1339,7 @@ static bool AnimationDeleteCallback(unsigned int Handle) // ----------------------------------------------------------------------------- -static int A_Remove(lua_State * L) -{ +static int A_Remove(lua_State *L) { BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr.Erase(); @@ -1505,8 +1348,7 @@ static int A_Remove(lua_State * L) // ----------------------------------------------------------------------------- -static const luaL_reg ANIMATION_METHODS[] = -{ +static const luaL_reg ANIMATION_METHODS[] = { {"Play", A_Play}, {"Pause", A_Pause}, {"Stop", A_Stop}, @@ -1537,20 +1379,16 @@ static const luaL_reg ANIMATION_METHODS[] = // ----------------------------------------------------------------------------- -static BS_RenderObjectPtr CheckText(lua_State * L) -{ +static BS_RenderObjectPtr CheckText(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Text - unsigned int * UserDataPtr; - if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) - { + unsigned int *UserDataPtr; + if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { BS_RenderObjectPtr ROPtr(*UserDataPtr); if (ROPtr.IsValid()) return ROPtr->ToText(); else luaL_error(L, "The text with the handle %d does no longer exist.", *UserDataPtr); - } - else - { + } else { luaL_argcheck(L, 0, 1, "'" TEXT_CLASS_NAME "' expected"); } @@ -1559,8 +1397,7 @@ static BS_RenderObjectPtr CheckText(lua_State * L) // ----------------------------------------------------------------------------- -static int T_SetFont(lua_State * L) -{ +static int T_SetFont(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetFont(luaL_checkstring(L, 2)); @@ -1569,8 +1406,7 @@ static int T_SetFont(lua_State * L) // ----------------------------------------------------------------------------- -static int T_SetText(lua_State * L) -{ +static int T_SetText(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetText(luaL_checkstring(L, 2)); @@ -1579,8 +1415,7 @@ static int T_SetText(lua_State * L) // ----------------------------------------------------------------------------- -static int T_SetAlpha(lua_State * L) -{ +static int T_SetAlpha(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); @@ -1589,8 +1424,7 @@ static int T_SetAlpha(lua_State * L) // ----------------------------------------------------------------------------- -static int T_SetColor(lua_State * L) -{ +static int T_SetColor(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); @@ -1599,8 +1433,7 @@ static int T_SetColor(lua_State * L) // ----------------------------------------------------------------------------- -static int T_SetAutoWrap(lua_State * L) -{ +static int T_SetAutoWrap(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetAutoWrap(lua_tobooleancpp(L, 2)); @@ -1609,8 +1442,7 @@ static int T_SetAutoWrap(lua_State * L) // ----------------------------------------------------------------------------- -static int T_SetAutoWrapThreshold(lua_State * L) -{ +static int T_SetAutoWrapThreshold(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetAutoWrapThreshold(static_cast(luaL_checknumber(L, 2))); @@ -1619,8 +1451,7 @@ static int T_SetAutoWrapThreshold(lua_State * L) // ----------------------------------------------------------------------------- -static int T_GetText(lua_State * L) -{ +static int T_GetText(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushstring(L, TextPtr->GetText().c_str()); @@ -1629,8 +1460,7 @@ static int T_GetText(lua_State * L) // ----------------------------------------------------------------------------- -static int T_GetFont(lua_State * L) -{ +static int T_GetFont(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushstring(L, TextPtr->GetFont().c_str()); @@ -1639,8 +1469,7 @@ static int T_GetFont(lua_State * L) // ----------------------------------------------------------------------------- -static int T_GetAlpha(lua_State * L) -{ +static int T_GetAlpha(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushnumber(L, TextPtr->GetAlpha()); @@ -1649,8 +1478,7 @@ static int T_GetAlpha(lua_State * L) // ----------------------------------------------------------------------------- -static int T_GetColor(lua_State * L) -{ +static int T_GetColor(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushnumber(L, TextPtr->GetColor()); @@ -1659,8 +1487,7 @@ static int T_GetColor(lua_State * L) // ----------------------------------------------------------------------------- -static int T_IsAutoWrap(lua_State * L) -{ +static int T_IsAutoWrap(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushbooleancpp(L, TextPtr->IsAutoWrapActive()); @@ -1669,8 +1496,7 @@ static int T_IsAutoWrap(lua_State * L) // ----------------------------------------------------------------------------- -static int T_GetAutoWrapThreshold(lua_State * L) -{ +static int T_GetAutoWrapThreshold(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushnumber(L, TextPtr->GetAutoWrapThreshold()); @@ -1679,8 +1505,7 @@ static int T_GetAutoWrapThreshold(lua_State * L) // ----------------------------------------------------------------------------- -static int T_Remove(lua_State * L) -{ +static int T_Remove(lua_State *L) { BS_RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr.Erase(); @@ -1689,8 +1514,7 @@ static int T_Remove(lua_State * L) // ----------------------------------------------------------------------------- -static const luaL_reg TEXT_METHODS[] = -{ +static const luaL_reg TEXT_METHODS[] = { {"SetFont", T_SetFont}, {"SetText", T_SetText}, {"SetAlpha", T_SetAlpha}, @@ -1709,13 +1533,12 @@ static const luaL_reg TEXT_METHODS[] = // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::RegisterScriptBindings() -{ - BS_Kernel * pKernel = BS_Kernel::GetInstance(); +bool BS_GraphicEngine::RegisterScriptBindings() { + BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_ScriptEngine * pScript = static_cast(pKernel->GetService("script")); + BS_ScriptEngine *pScript = static_cast(pKernel->GetService("script")); BS_ASSERT(pScript); - lua_State * L = static_cast(pScript->GetScriptObject()); + lua_State *L = static_cast(pScript->GetScriptObject()); BS_ASSERT(L); if (!BS_LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, RENDEROBJECT_METHODS)) return false; -- cgit v1.2.3 From a1d22a063b2a9de47cf3f23cac1cd73777eea321 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 16 Aug 2010 20:23:53 +0000 Subject: SWORD25: Fix warnings svn-id: r53254 --- engines/sword25/gfx/graphicengine_script.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index d009916f32..af558e6578 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -754,14 +754,6 @@ static int RO_AddAnimation(lua_State *L) { // ----------------------------------------------------------------------------- -static int RO_Remove(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); - ROPtr.Erase(); - return 0; -} - -// ----------------------------------------------------------------------------- - static const luaL_reg RENDEROBJECT_METHODS[] = { {"AddAnimation", RO_AddAnimation}, {"AddText", RO_AddText}, -- cgit v1.2.3 From e71337861ffece83ca8fe254e411557249118d43 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 10:52:00 +0000 Subject: SWORD25: brought CallBackRegisry class to our naming standards svn-id: r53257 --- engines/sword25/gfx/graphicengine_script.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index af558e6578..07a867bf6c 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -91,9 +91,9 @@ std::auto_ptr ActionCallbackPtr; struct CallbackfunctionRegisterer { CallbackfunctionRegisterer() { - BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaLoopPointCB", (void ( *)(int))AnimationLoopPointCallback); - BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaActionCB", (void ( *)(int))AnimationActionCallback); - BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaDeleteCB", (void ( *)(int))AnimationDeleteCallback); + CallbackRegistry::getInstance().registerCallbackFunction("LuaLoopPointCB", (void ( *)(int))AnimationLoopPointCallback); + CallbackRegistry::getInstance().registerCallbackFunction("LuaActionCB", (void ( *)(int))AnimationActionCallback); + CallbackRegistry::getInstance().registerCallbackFunction("LuaDeleteCB", (void ( *)(int))AnimationDeleteCallback); } }; static CallbackfunctionRegisterer Instance; -- cgit v1.2.3 From 485ff15d23b3ae9545f5c9df794f1326185eae7a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 10:52:24 +0000 Subject: SWORD25: Mass-eliminating of BS_ prefix in fmv/ and gfx/ svn-id: r53258 --- engines/sword25/gfx/graphicengine_script.cpp | 288 +++++++++++++-------------- 1 file changed, 144 insertions(+), 144 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 07a867bf6c..7447e0237b 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -143,11 +143,11 @@ static void NewUintUserData(lua_State *L, unsigned int Value) { // ----------------------------------------------------------------------------- -static BS_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 unsigned int AnimationTemplateHandle; if ((AnimationTemplateHandle = *reinterpret_cast(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) { - BS_AnimationTemplate *AnimationTemplatePtr = BS_AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); + AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); if (!AnimationTemplatePtr) luaL_error(L, "The animation template with the handle %d does no longer exist.", AnimationTemplateHandle); return AnimationTemplatePtr; @@ -161,8 +161,8 @@ static BS_AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) { // ----------------------------------------------------------------------------- static int NewAnimationTemplate(lua_State *L) { - unsigned int AnimationTemplateHandle = BS_AnimationTemplate::Create(luaL_checkstring(L, 1)); - BS_AnimationTemplate *AnimationTemplatePtr = BS_AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); + unsigned int AnimationTemplateHandle = AnimationTemplate::Create(luaL_checkstring(L, 1)); + AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); if (AnimationTemplatePtr && AnimationTemplatePtr->IsValid()) { NewUintUserData(L, AnimationTemplateHandle); //luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); @@ -179,7 +179,7 @@ static int NewAnimationTemplate(lua_State *L) { // ----------------------------------------------------------------------------- static int AT_AddFrame(lua_State *L) { - BS_AnimationTemplate *pAT = CheckAnimationTemplate(L); + AnimationTemplate *pAT = CheckAnimationTemplate(L); pAT->AddFrame(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -187,22 +187,22 @@ static int AT_AddFrame(lua_State *L) { // ----------------------------------------------------------------------------- static int AT_SetFrame(lua_State *L) { - BS_AnimationTemplate *pAT = CheckAnimationTemplate(L); + AnimationTemplate *pAT = CheckAnimationTemplate(L); pAT->SetFrame(static_cast(luaL_checknumber(L, 2)), static_cast(luaL_checknumber(L, 3))); return 0; } // ----------------------------------------------------------------------------- -static bool AnimationTypeStringToNumber(const char *TypeString, BS_Animation::ANIMATION_TYPES &Result) { +static bool AnimationTypeStringToNumber(const char *TypeString, Animation::ANIMATION_TYPES &Result) { if (strcmp(TypeString, "jojo") == 0) { - Result = BS_Animation::AT_JOJO; + Result = Animation::AT_JOJO; return true; } else if (strcmp(TypeString, "loop") == 0) { - Result = BS_Animation::AT_LOOP; + Result = Animation::AT_LOOP; return true; } else if (strcmp(TypeString, "oneshot") == 0) { - Result = BS_Animation::AT_ONESHOT; + Result = Animation::AT_ONESHOT; return true; } else return false; @@ -211,8 +211,8 @@ static bool AnimationTypeStringToNumber(const char *TypeString, BS_Animation::AN // ----------------------------------------------------------------------------- static int AT_SetAnimationType(lua_State *L) { - BS_AnimationTemplate *pAT = CheckAnimationTemplate(L); - BS_Animation::ANIMATION_TYPES AnimationType; + AnimationTemplate *pAT = CheckAnimationTemplate(L); + Animation::ANIMATION_TYPES AnimationType; if (AnimationTypeStringToNumber(luaL_checkstring(L, 2), AnimationType)) { pAT->SetAnimationType(AnimationType); } else { @@ -225,7 +225,7 @@ static int AT_SetAnimationType(lua_State *L) { // ----------------------------------------------------------------------------- static int AT_SetFPS(lua_State *L) { - BS_AnimationTemplate *pAT = CheckAnimationTemplate(L); + AnimationTemplate *pAT = CheckAnimationTemplate(L); pAT->SetFPS(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -233,7 +233,7 @@ static int AT_SetFPS(lua_State *L) { // ----------------------------------------------------------------------------- static int AT_Finalize(lua_State *L) { - BS_AnimationTemplate *pAT = CheckAnimationTemplate(L); + AnimationTemplate *pAT = CheckAnimationTemplate(L); delete pAT; return 0; } @@ -251,10 +251,10 @@ static const luaL_reg ANIMATION_TEMPLATE_METHODS[] = { // ----------------------------------------------------------------------------- -static BS_GraphicEngine *GetGE() { +static GraphicEngine *GetGE() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_GraphicEngine *pGE = static_cast(pKernel->GetService("gfx")); + GraphicEngine *pGE = static_cast(pKernel->GetService("gfx")); BS_ASSERT(pGE); return pGE; } @@ -262,7 +262,7 @@ static BS_GraphicEngine *GetGE() { // ----------------------------------------------------------------------------- static int Init(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); switch (lua_gettop(L)) { case 0: @@ -294,7 +294,7 @@ static int Init(lua_State *L) { #endif // Main-Panel zum Gfx-Modul hinzufügen - BS_RenderObjectPtr MainPanelPtr(GetGE()->GetMainPanel()); + RenderObjectPtr MainPanelPtr(GetGE()->GetMainPanel()); BS_ASSERT(MainPanelPtr.IsValid()); lua_pushstring(L, GFX_LIBRARY_NAME); @@ -324,7 +324,7 @@ static int Init(lua_State *L) { // ----------------------------------------------------------------------------- static int StartFrame(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); if (lua_gettop(L) == 0) lua_pushbooleancpp(L, pGE->StartFrame()); @@ -337,7 +337,7 @@ static int StartFrame(lua_State *L) { // ----------------------------------------------------------------------------- static int EndFrame(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushbooleancpp(L, pGE->EndFrame()); @@ -347,13 +347,13 @@ static int EndFrame(lua_State *L) { // ----------------------------------------------------------------------------- static int DrawDebugLine(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); BS_Vertex Start; BS_Vertex End; BS_Vertex::LuaVertexToVertex(L, 1, Start); BS_Vertex::LuaVertexToVertex(L, 2, End); - pGE->DrawDebugLine(Start, End, BS_GraphicEngine::LuaColorToARGBColor(L, 3)); + pGE->DrawDebugLine(Start, End, GraphicEngine::LuaColorToARGBColor(L, 3)); return 0; } @@ -361,7 +361,7 @@ static int DrawDebugLine(lua_State *L) { // ----------------------------------------------------------------------------- static int GetDisplayWidth(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetDisplayWidth()); @@ -371,7 +371,7 @@ static int GetDisplayWidth(lua_State *L) { // ----------------------------------------------------------------------------- static int GetDisplayHeight(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetDisplayHeight()); @@ -381,7 +381,7 @@ static int GetDisplayHeight(lua_State *L) { // ----------------------------------------------------------------------------- static int GetBitDepth(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetBitDepth()); @@ -391,7 +391,7 @@ static int GetBitDepth(lua_State *L) { // ----------------------------------------------------------------------------- static int SetVsync(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); pGE->SetVsync(lua_tobooleancpp(L, 1)); @@ -401,7 +401,7 @@ static int SetVsync(lua_State *L) { // ----------------------------------------------------------------------------- static int IsVsync(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushbooleancpp(L, pGE->GetVsync()); @@ -411,7 +411,7 @@ static int IsVsync(lua_State *L) { // ----------------------------------------------------------------------------- static int IsWindowed(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushbooleancpp(L, pGE->IsWindowed()); @@ -421,7 +421,7 @@ static int IsWindowed(lua_State *L) { // ----------------------------------------------------------------------------- static int GetFPSCount(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetFPSCount()); @@ -431,7 +431,7 @@ static int GetFPSCount(lua_State *L) { // ----------------------------------------------------------------------------- static int GetLastFrameDuration(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetLastFrameDuration()); @@ -441,7 +441,7 @@ static int GetLastFrameDuration(lua_State *L) { // ----------------------------------------------------------------------------- static int StopMainTimer(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); pGE->StopMainTimer(); return 0; } @@ -449,7 +449,7 @@ static int StopMainTimer(lua_State *L) { // ----------------------------------------------------------------------------- static int ResumeMainTimer(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); pGE->ResumeMainTimer(); return 0; } @@ -457,7 +457,7 @@ static int ResumeMainTimer(lua_State *L) { // ----------------------------------------------------------------------------- static int GetSecondaryFrameDuration(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushnumber(L, pGE->GetSecondaryFrameDuration()); @@ -467,7 +467,7 @@ static int GetSecondaryFrameDuration(lua_State *L) { // ----------------------------------------------------------------------------- static int SaveScreenshot(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushbooleancpp(L, pGE->SaveScreenshot(luaL_checkstring(L, 1))); return 1; } @@ -475,7 +475,7 @@ static int SaveScreenshot(lua_State *L) { // ----------------------------------------------------------------------------- static int SaveThumbnailScreenshot(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushbooleancpp(L, pGE->SaveThumbnailScreenshot(luaL_checkstring(L, 1))); return 1; } @@ -483,7 +483,7 @@ static int SaveThumbnailScreenshot(lua_State *L) { // ----------------------------------------------------------------------------- static int GetRepaintedPixels(lua_State *L) { - BS_GraphicEngine *pGE = GetGE(); + GraphicEngine *pGE = GetGE(); lua_pushnumber(L, static_cast(pGE->GetRepaintedPixels())); return 1; } @@ -515,14 +515,14 @@ static const luaL_reg GFX_FUNCTIONS[] = { // ----------------------------------------------------------------------------- -static BS_RenderObjectPtr CheckRenderObject(lua_State *L, bool ErrorIfRemoved = true) { +static RenderObjectPtr 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". unsigned int *UserDataPtr; if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 || (UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 || (UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 || (UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { - BS_RenderObjectPtr ROPtr(* UserDataPtr); + RenderObjectPtr ROPtr(* UserDataPtr); if (ROPtr.IsValid()) return ROPtr; else { @@ -533,13 +533,13 @@ static BS_RenderObjectPtr CheckRenderObject(lua_State *L, bool luaL_argcheck(L, 0, 1, "'" RENDEROBJECT_CLASS_NAME "' expected"); } - return BS_RenderObjectPtr(); + return RenderObjectPtr(); } // ----------------------------------------------------------------------------- static int RO_SetPos(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); BS_Vertex Pos; BS_Vertex::LuaVertexToVertex(L, 2, Pos); @@ -550,7 +550,7 @@ static int RO_SetPos(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_SetX(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr->SetX(static_cast(luaL_checknumber(L, 2))); return 0; @@ -559,7 +559,7 @@ static int RO_SetX(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_SetY(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr->SetY(static_cast(luaL_checknumber(L, 2))); return 0; @@ -568,7 +568,7 @@ static int RO_SetY(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_SetZ(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr->SetZ(static_cast(luaL_checknumber(L, 2))); return 0; @@ -577,7 +577,7 @@ static int RO_SetZ(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_SetVisible(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr->SetVisible(lua_tobooleancpp(L, 2)); return 0; @@ -586,7 +586,7 @@ static int RO_SetVisible(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_GetX(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetX()); @@ -596,7 +596,7 @@ static int RO_GetX(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_GetY(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetY()); @@ -606,7 +606,7 @@ static int RO_GetY(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_GetZ(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetZ()); @@ -616,7 +616,7 @@ static int RO_GetZ(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_GetAbsoluteX(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetAbsoluteX()); @@ -626,7 +626,7 @@ static int RO_GetAbsoluteX(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_GetAbsoluteY(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetAbsoluteY()); @@ -636,7 +636,7 @@ static int RO_GetAbsoluteY(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_GetWidth(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetWidth()); @@ -646,7 +646,7 @@ static int RO_GetWidth(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_GetHeight(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushnumber(L, ROPtr->GetHeight()); @@ -656,7 +656,7 @@ static int RO_GetHeight(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_IsVisible(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); lua_pushbooleancpp(L, ROPtr->IsVisible()); @@ -666,11 +666,11 @@ static int RO_IsVisible(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_AddPanel(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); - BS_RenderObjectPtr PanelPtr = ROPtr->AddPanel(static_cast(luaL_checknumber(L, 2)), + RenderObjectPtr PanelPtr = ROPtr->AddPanel(static_cast(luaL_checknumber(L, 2)), static_cast(luaL_checknumber(L, 3)), - BS_GraphicEngine::LuaColorToARGBColor(L, 4)); + GraphicEngine::LuaColorToARGBColor(L, 4)); if (PanelPtr.IsValid()) { NewUintUserData(L, PanelPtr->GetHandle()); // luaL_getmetatable(L, PANEL_CLASS_NAME); @@ -686,9 +686,9 @@ static int RO_AddPanel(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_AddBitmap(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); - BS_RenderObjectPtr BitmaPtr = ROPtr->AddBitmap(luaL_checkstring(L, 2)); + RenderObjectPtr BitmaPtr = ROPtr->AddBitmap(luaL_checkstring(L, 2)); if (BitmaPtr.IsValid()) { NewUintUserData(L, BitmaPtr->GetHandle()); // luaL_getmetatable(L, BITMAP_CLASS_NAME); @@ -704,10 +704,10 @@ static int RO_AddBitmap(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_AddText(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); - BS_RenderObjectPtr TextPtr; + RenderObjectPtr 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)); @@ -726,10 +726,10 @@ static int RO_AddText(lua_State *L) { // ----------------------------------------------------------------------------- static int RO_AddAnimation(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); - BS_RenderObjectPtr AnimationPtr; + RenderObjectPtr AnimationPtr; if (lua_type(L, 2) == LUA_TUSERDATA) AnimationPtr = ROPtr->AddAnimation(*CheckAnimationTemplate(L, 2)); else @@ -777,11 +777,11 @@ static const luaL_reg RENDEROBJECT_METHODS[] = { // ----------------------------------------------------------------------------- -static BS_RenderObjectPtr CheckPanel(lua_State *L) { +static RenderObjectPtr CheckPanel(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Panel unsigned int *UserDataPtr; if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) { - BS_RenderObjectPtr ROPtr(*UserDataPtr); + RenderObjectPtr ROPtr(*UserDataPtr); if (ROPtr.IsValid()) { return ROPtr->ToPanel(); } else @@ -790,15 +790,15 @@ static BS_RenderObjectPtr CheckPanel(lua_State *L) { luaL_argcheck(L, 0, 1, "'" PANEL_CLASS_NAME "' expected"); } - return BS_RenderObjectPtr(); + return RenderObjectPtr(); } // ----------------------------------------------------------------------------- static int P_GetColor(lua_State *L) { - BS_RenderObjectPtr PanelPtr = CheckPanel(L); + RenderObjectPtr PanelPtr = CheckPanel(L); BS_ASSERT(PanelPtr.IsValid()); - BS_GraphicEngine::ARGBColorToLuaColor(L, PanelPtr->GetColor()); + GraphicEngine::ARGBColorToLuaColor(L, PanelPtr->GetColor()); return 1; } @@ -806,16 +806,16 @@ static int P_GetColor(lua_State *L) { // ----------------------------------------------------------------------------- static int P_SetColor(lua_State *L) { - BS_RenderObjectPtr PanelPtr = CheckPanel(L); + RenderObjectPtr PanelPtr = CheckPanel(L); BS_ASSERT(PanelPtr.IsValid()); - PanelPtr->SetColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); + PanelPtr->SetColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } // ----------------------------------------------------------------------------- static int P_Remove(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr.Erase(); return 0; @@ -832,11 +832,11 @@ static const luaL_reg PANEL_METHODS[] = { // ----------------------------------------------------------------------------- -static BS_RenderObjectPtr CheckBitmap(lua_State *L) { +static RenderObjectPtr CheckBitmap(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Bitmap unsigned int *UserDataPtr; if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) { - BS_RenderObjectPtr ROPtr(*UserDataPtr); + RenderObjectPtr ROPtr(*UserDataPtr); if (ROPtr.IsValid()) { return ROPtr->ToBitmap(); } else @@ -845,13 +845,13 @@ static BS_RenderObjectPtr CheckBitmap(lua_State *L) { luaL_argcheck(L, 0, 1, "'" BITMAP_CLASS_NAME "' expected"); } - return BS_RenderObjectPtr(); + return RenderObjectPtr(); } // ----------------------------------------------------------------------------- static int B_SetAlpha(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); return 0; @@ -860,16 +860,16 @@ static int B_SetAlpha(lua_State *L) { // ----------------------------------------------------------------------------- static int B_SetTintColor(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetModulationColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); + BitmapPtr->SetModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } // ----------------------------------------------------------------------------- static int B_SetScaleFactor(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 2))); return 0; @@ -878,7 +878,7 @@ static int B_SetScaleFactor(lua_State *L) { // ----------------------------------------------------------------------------- static int B_SetScaleFactorX(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetScaleFactorX(static_cast(luaL_checknumber(L, 2))); return 0; @@ -887,7 +887,7 @@ static int B_SetScaleFactorX(lua_State *L) { // ----------------------------------------------------------------------------- static int B_SetScaleFactorY(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetScaleFactorY(static_cast(luaL_checknumber(L, 2))); return 0; @@ -896,7 +896,7 @@ static int B_SetScaleFactorY(lua_State *L) { // ----------------------------------------------------------------------------- static int B_SetFlipH(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetFlipH(lua_tobooleancpp(L, 2)); return 0; @@ -905,7 +905,7 @@ static int B_SetFlipH(lua_State *L) { // ----------------------------------------------------------------------------- static int B_SetFlipV(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BitmapPtr->SetFlipV(lua_tobooleancpp(L, 2)); return 0; @@ -914,7 +914,7 @@ static int B_SetFlipV(lua_State *L) { // ----------------------------------------------------------------------------- static int B_GetAlpha(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushnumber(L, BitmapPtr->GetAlpha()); return 1; @@ -923,16 +923,16 @@ static int B_GetAlpha(lua_State *L) { // ----------------------------------------------------------------------------- static int B_GetTintColor(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); - BS_GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->GetModulationColor()); + GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->GetModulationColor()); return 1; } // ----------------------------------------------------------------------------- static int B_GetScaleFactorX(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushnumber(L, BitmapPtr->GetScaleFactorX()); return 1; @@ -941,7 +941,7 @@ static int B_GetScaleFactorX(lua_State *L) { // ----------------------------------------------------------------------------- static int B_GetScaleFactorY(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushnumber(L, BitmapPtr->GetScaleFactorY()); return 1; @@ -950,7 +950,7 @@ static int B_GetScaleFactorY(lua_State *L) { // ----------------------------------------------------------------------------- static int B_IsFlipH(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushbooleancpp(L, BitmapPtr->IsFlipH()); return 1; @@ -959,7 +959,7 @@ static int B_IsFlipH(lua_State *L) { // ----------------------------------------------------------------------------- static int B_IsFlipV(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushbooleancpp(L, BitmapPtr->IsFlipV()); return 1; @@ -968,18 +968,18 @@ static int B_IsFlipV(lua_State *L) { // ----------------------------------------------------------------------------- static int B_GetPixel(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); BS_Vertex Pos; BS_Vertex::LuaVertexToVertex(L, 2, Pos); - BS_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) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushbooleancpp(L, BitmapPtr->IsScalingAllowed()); return 1; @@ -988,7 +988,7 @@ static int B_IsScalingAllowed(lua_State *L) { // ----------------------------------------------------------------------------- static int B_IsAlphaAllowed(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushbooleancpp(L, BitmapPtr->IsAlphaAllowed()); return 1; @@ -997,7 +997,7 @@ static int B_IsAlphaAllowed(lua_State *L) { // ----------------------------------------------------------------------------- static int B_IsTintingAllowed(lua_State *L) { - BS_RenderObjectPtr BitmapPtr = CheckBitmap(L); + RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); lua_pushbooleancpp(L, BitmapPtr->IsColorModulationAllowed()); return 1; @@ -1005,7 +1005,7 @@ static int B_IsTintingAllowed(lua_State *L) { // ----------------------------------------------------------------------------- static int B_Remove(lua_State *L) { - BS_RenderObjectPtr ROPtr = CheckRenderObject(L); + RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); ROPtr.Erase(); return 0; @@ -1037,11 +1037,11 @@ static const luaL_reg BITMAP_METHODS[] = { // ----------------------------------------------------------------------------- -static BS_RenderObjectPtr CheckAnimation(lua_State *L) { +static RenderObjectPtr CheckAnimation(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Animation unsigned int *UserDataPtr; if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) { - BS_RenderObjectPtr ROPtr(*UserDataPtr); + RenderObjectPtr ROPtr(*UserDataPtr); if (ROPtr.IsValid()) return ROPtr->ToAnimation(); else { @@ -1051,13 +1051,13 @@ static BS_RenderObjectPtr CheckAnimation(lua_State *L) { luaL_argcheck(L, 0, 1, "'" ANIMATION_CLASS_NAME "' expected"); } - return BS_RenderObjectPtr(); + return RenderObjectPtr(); } // ----------------------------------------------------------------------------- static int A_Play(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->Play(); return 0; @@ -1066,7 +1066,7 @@ static int A_Play(lua_State *L) { // ----------------------------------------------------------------------------- static int A_Pause(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->Pause(); return 0; @@ -1075,7 +1075,7 @@ static int A_Pause(lua_State *L) { // ----------------------------------------------------------------------------- static int A_Stop(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->Stop(); return 0; @@ -1084,7 +1084,7 @@ static int A_Stop(lua_State *L) { // ----------------------------------------------------------------------------- static int A_SetFrame(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetFrame(static_cast(luaL_checknumber(L, 2))); return 0; @@ -1093,7 +1093,7 @@ static int A_SetFrame(lua_State *L) { // ----------------------------------------------------------------------------- static int A_SetAlpha(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); return 0; @@ -1101,16 +1101,16 @@ static int A_SetAlpha(lua_State *L) { // ----------------------------------------------------------------------------- static int A_SetTintColor(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetModulationColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); + AnimationPtr->SetModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } // ----------------------------------------------------------------------------- static int A_SetScaleFactor(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 2))); return 0; @@ -1119,7 +1119,7 @@ static int A_SetScaleFactor(lua_State *L) { // ----------------------------------------------------------------------------- static int A_SetScaleFactorX(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetScaleFactorX(static_cast(luaL_checknumber(L, 2))); return 0; @@ -1128,7 +1128,7 @@ static int A_SetScaleFactorX(lua_State *L) { // ----------------------------------------------------------------------------- static int A_SetScaleFactorY(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr->SetScaleFactorY(static_cast(luaL_checknumber(L, 2))); return 0; @@ -1137,7 +1137,7 @@ static int A_SetScaleFactorY(lua_State *L) { // ----------------------------------------------------------------------------- static int A_GetScaleFactorX(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushnumber(L, AnimationPtr->GetScaleFactorX()); return 1; @@ -1146,7 +1146,7 @@ static int A_GetScaleFactorX(lua_State *L) { // ----------------------------------------------------------------------------- static int A_GetScaleFactorY(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushnumber(L, AnimationPtr->GetScaleFactorY()); return 1; @@ -1155,16 +1155,16 @@ static int A_GetScaleFactorY(lua_State *L) { // ----------------------------------------------------------------------------- static int A_GetAnimationType(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); switch (AnimationPtr->GetAnimationType()) { - case BS_Animation::AT_JOJO: + case Animation::AT_JOJO: lua_pushstring(L, "jojo"); break; - case BS_Animation::AT_LOOP: + case Animation::AT_LOOP: lua_pushstring(L, "loop"); break; - case BS_Animation::AT_ONESHOT: + case Animation::AT_ONESHOT: lua_pushstring(L, "oneshot"); break; default: @@ -1176,7 +1176,7 @@ static int A_GetAnimationType(lua_State *L) { // ----------------------------------------------------------------------------- static int A_GetFPS(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushnumber(L, AnimationPtr->GetFPS()); return 1; @@ -1186,7 +1186,7 @@ static int A_GetFPS(lua_State *L) { // ----------------------------------------------------------------------------- static int A_GetFrameCount(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushnumber(L, AnimationPtr->GetFrameCount()); return 1; @@ -1195,7 +1195,7 @@ static int A_GetFrameCount(lua_State *L) { // ----------------------------------------------------------------------------- static int A_IsScalingAllowed(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushbooleancpp(L, AnimationPtr->IsScalingAllowed()); return 1; @@ -1204,7 +1204,7 @@ static int A_IsScalingAllowed(lua_State *L) { // ----------------------------------------------------------------------------- static int A_IsAlphaAllowed(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushbooleancpp(L, AnimationPtr->IsAlphaAllowed()); return 1; @@ -1213,7 +1213,7 @@ static int A_IsAlphaAllowed(lua_State *L) { // ----------------------------------------------------------------------------- static int A_IsTintingAllowed(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushbooleancpp(L, AnimationPtr->IsColorModulationAllowed()); return 1; @@ -1222,7 +1222,7 @@ static int A_IsTintingAllowed(lua_State *L) { // ----------------------------------------------------------------------------- static int A_GetCurrentFrame(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushnumber(L, AnimationPtr->GetCurrentFrame()); return 1; @@ -1231,7 +1231,7 @@ static int A_GetCurrentFrame(lua_State *L) { // ----------------------------------------------------------------------------- static int A_GetCurrentAction(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushstring(L, AnimationPtr->GetCurrentAction().c_str()); return 1; @@ -1240,7 +1240,7 @@ static int A_GetCurrentAction(lua_State *L) { // ----------------------------------------------------------------------------- static int A_IsPlaying(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); lua_pushbooleancpp(L, AnimationPtr->IsRunning()); return 1; @@ -1258,7 +1258,7 @@ static bool AnimationLoopPointCallback(unsigned int Handle) { // ----------------------------------------------------------------------------- static int A_RegisterLoopPointCallback(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); luaL_checktype(L, 2, LUA_TFUNCTION); @@ -1271,7 +1271,7 @@ static int A_RegisterLoopPointCallback(lua_State *L) { // ----------------------------------------------------------------------------- static int A_UnregisterLoopPointCallback(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); luaL_checktype(L, 2, LUA_TFUNCTION); @@ -1284,7 +1284,7 @@ static int A_UnregisterLoopPointCallback(lua_State *L) { // ----------------------------------------------------------------------------- static bool AnimationActionCallback(unsigned int Handle) { - BS_RenderObjectPtr AnimationPtr(Handle); + RenderObjectPtr AnimationPtr(Handle); if (AnimationPtr.IsValid()) { ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction(); lua_State *L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); @@ -1297,7 +1297,7 @@ static bool AnimationActionCallback(unsigned int Handle) { // ----------------------------------------------------------------------------- static int A_RegisterActionCallback(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); luaL_checktype(L, 2, LUA_TFUNCTION); @@ -1310,7 +1310,7 @@ static int A_RegisterActionCallback(lua_State *L) { // ----------------------------------------------------------------------------- static int A_UnregisterActionCallback(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); luaL_checktype(L, 2, LUA_TFUNCTION); @@ -1332,7 +1332,7 @@ static bool AnimationDeleteCallback(unsigned int Handle) { // ----------------------------------------------------------------------------- static int A_Remove(lua_State *L) { - BS_RenderObjectPtr AnimationPtr = CheckAnimation(L); + RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); AnimationPtr.Erase(); return 0; @@ -1371,11 +1371,11 @@ static const luaL_reg ANIMATION_METHODS[] = { // ----------------------------------------------------------------------------- -static BS_RenderObjectPtr CheckText(lua_State *L) { +static RenderObjectPtr CheckText(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Text unsigned int *UserDataPtr; if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { - BS_RenderObjectPtr ROPtr(*UserDataPtr); + RenderObjectPtr ROPtr(*UserDataPtr); if (ROPtr.IsValid()) return ROPtr->ToText(); else @@ -1384,13 +1384,13 @@ static BS_RenderObjectPtr CheckText(lua_State *L) { luaL_argcheck(L, 0, 1, "'" TEXT_CLASS_NAME "' expected"); } - return BS_RenderObjectPtr(); + return RenderObjectPtr(); } // ----------------------------------------------------------------------------- static int T_SetFont(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetFont(luaL_checkstring(L, 2)); return 0; @@ -1399,7 +1399,7 @@ static int T_SetFont(lua_State *L) { // ----------------------------------------------------------------------------- static int T_SetText(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetText(luaL_checkstring(L, 2)); return 0; @@ -1408,7 +1408,7 @@ static int T_SetText(lua_State *L) { // ----------------------------------------------------------------------------- static int T_SetAlpha(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); return 0; @@ -1417,16 +1417,16 @@ static int T_SetAlpha(lua_State *L) { // ----------------------------------------------------------------------------- static int T_SetColor(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); - TextPtr->SetColor(BS_GraphicEngine::LuaColorToARGBColor(L, 2)); + TextPtr->SetColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } // ----------------------------------------------------------------------------- static int T_SetAutoWrap(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetAutoWrap(lua_tobooleancpp(L, 2)); return 0; @@ -1435,7 +1435,7 @@ static int T_SetAutoWrap(lua_State *L) { // ----------------------------------------------------------------------------- static int T_SetAutoWrapThreshold(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr->SetAutoWrapThreshold(static_cast(luaL_checknumber(L, 2))); return 0; @@ -1444,7 +1444,7 @@ static int T_SetAutoWrapThreshold(lua_State *L) { // ----------------------------------------------------------------------------- static int T_GetText(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushstring(L, TextPtr->GetText().c_str()); return 1; @@ -1453,7 +1453,7 @@ static int T_GetText(lua_State *L) { // ----------------------------------------------------------------------------- static int T_GetFont(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushstring(L, TextPtr->GetFont().c_str()); return 1; @@ -1462,7 +1462,7 @@ static int T_GetFont(lua_State *L) { // ----------------------------------------------------------------------------- static int T_GetAlpha(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushnumber(L, TextPtr->GetAlpha()); return 1; @@ -1471,7 +1471,7 @@ static int T_GetAlpha(lua_State *L) { // ----------------------------------------------------------------------------- static int T_GetColor(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushnumber(L, TextPtr->GetColor()); return 1; @@ -1480,7 +1480,7 @@ static int T_GetColor(lua_State *L) { // ----------------------------------------------------------------------------- static int T_IsAutoWrap(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushbooleancpp(L, TextPtr->IsAutoWrapActive()); return 1; @@ -1489,7 +1489,7 @@ static int T_IsAutoWrap(lua_State *L) { // ----------------------------------------------------------------------------- static int T_GetAutoWrapThreshold(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); lua_pushnumber(L, TextPtr->GetAutoWrapThreshold()); return 1; @@ -1498,7 +1498,7 @@ static int T_GetAutoWrapThreshold(lua_State *L) { // ----------------------------------------------------------------------------- static int T_Remove(lua_State *L) { - BS_RenderObjectPtr TextPtr = CheckText(L); + RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); TextPtr.Erase(); return 0; @@ -1525,7 +1525,7 @@ static const luaL_reg TEXT_METHODS[] = { // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::RegisterScriptBindings() { +bool GraphicEngine::RegisterScriptBindings() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); BS_ScriptEngine *pScript = static_cast(pKernel->GetService("script")); -- cgit v1.2.3 From be44216e5c1d74879d7843215ce1cd3f488b4db8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 12:57:47 +0000 Subject: SWORD25: eliminated BS_ prefix in all but kernel/ svn-id: r53259 --- engines/sword25/gfx/graphicengine_script.cpp | 60 ++++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 7447e0237b..92f5750d25 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -71,9 +71,9 @@ static bool AnimationLoopPointCallback(unsigned int Data); namespace { // ------------------------------------------------------------------------- -class ActionCallback : public BS_LuaCallback { +class ActionCallback : public LuaCallback { public: - ActionCallback(lua_State *L) : BS_LuaCallback(L) {}; + ActionCallback(lua_State *L) : LuaCallback(L) {}; Common::String Action; @@ -84,7 +84,7 @@ protected: } }; -std::auto_ptr LoopPointCallbackPtr; +std::auto_ptr LoopPointCallbackPtr; std::auto_ptr ActionCallbackPtr; // ------------------------------------------------------------------------- @@ -122,7 +122,7 @@ static void *my_checkudata(lua_State *L, int ud, const char *tname) { if (p != NULL) { /* value is a userdata? */ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ // lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ - BS_LuaBindhelper::GetMetatable(L, tname); + LuaBindhelper::GetMetatable(L, tname); if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ lua_settop(L, top); return p; @@ -166,7 +166,7 @@ static int NewAnimationTemplate(lua_State *L) { if (AnimationTemplatePtr && AnimationTemplatePtr->IsValid()) { NewUintUserData(L, AnimationTemplateHandle); //luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); + LuaBindhelper::GetMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else { @@ -304,7 +304,7 @@ static int Init(lua_State *L) { NewUintUserData(L, MainPanelPtr->GetHandle()); BS_ASSERT(!lua_isnil(L, -1)); // luaL_getmetatable(L, PANEL_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); + LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); @@ -349,10 +349,10 @@ static int EndFrame(lua_State *L) { static int DrawDebugLine(lua_State *L) { GraphicEngine *pGE = GetGE(); - BS_Vertex Start; - BS_Vertex End; - BS_Vertex::LuaVertexToVertex(L, 1, Start); - BS_Vertex::LuaVertexToVertex(L, 2, End); + Vertex Start; + Vertex End; + Vertex::LuaVertexToVertex(L, 1, Start); + Vertex::LuaVertexToVertex(L, 2, End); pGE->DrawDebugLine(Start, End, GraphicEngine::LuaColorToARGBColor(L, 3)); return 0; @@ -541,8 +541,8 @@ static RenderObjectPtr CheckRenderObject(lua_State *L, bool ErrorI static int RO_SetPos(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.IsValid()); - BS_Vertex Pos; - BS_Vertex::LuaVertexToVertex(L, 2, Pos); + Vertex Pos; + Vertex::LuaVertexToVertex(L, 2, Pos); ROPtr->SetPos(Pos.X, Pos.Y); return 0; } @@ -674,7 +674,7 @@ static int RO_AddPanel(lua_State *L) { if (PanelPtr.IsValid()) { NewUintUserData(L, PanelPtr->GetHandle()); // luaL_getmetatable(L, PANEL_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); + LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else @@ -692,7 +692,7 @@ static int RO_AddBitmap(lua_State *L) { if (BitmaPtr.IsValid()) { NewUintUserData(L, BitmaPtr->GetHandle()); // luaL_getmetatable(L, BITMAP_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, BITMAP_CLASS_NAME); + LuaBindhelper::GetMetatable(L, BITMAP_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else @@ -714,7 +714,7 @@ static int RO_AddText(lua_State *L) { if (TextPtr.IsValid()) { NewUintUserData(L, TextPtr->GetHandle()); // luaL_getmetatable(L, TEXT_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, TEXT_CLASS_NAME); + LuaBindhelper::GetMetatable(L, TEXT_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else @@ -738,7 +738,7 @@ static int RO_AddAnimation(lua_State *L) { if (AnimationPtr.IsValid()) { NewUintUserData(L, AnimationPtr->GetHandle()); // luaL_getmetatable(L, ANIMATION_CLASS_NAME); - BS_LuaBindhelper::GetMetatable(L, ANIMATION_CLASS_NAME); + LuaBindhelper::GetMetatable(L, ANIMATION_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); @@ -970,8 +970,8 @@ static int B_IsFlipV(lua_State *L) { static int B_GetPixel(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); - BS_Vertex Pos; - BS_Vertex::LuaVertexToVertex(L, 2, Pos); + Vertex Pos; + Vertex::LuaVertexToVertex(L, 2, Pos); GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->GetPixel(Pos.X, Pos.Y)); return 1; } @@ -1528,26 +1528,26 @@ static const luaL_reg TEXT_METHODS[] = { bool GraphicEngine::RegisterScriptBindings() { BS_Kernel *pKernel = BS_Kernel::GetInstance(); BS_ASSERT(pKernel); - BS_ScriptEngine *pScript = static_cast(pKernel->GetService("script")); + ScriptEngine *pScript = static_cast(pKernel->GetService("script")); BS_ASSERT(pScript); lua_State *L = static_cast(pScript->GetScriptObject()); BS_ASSERT(L); - if (!BS_LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, PANEL_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, BITMAP_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, TEXT_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, ANIMATION_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, PANEL_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, BITMAP_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, TEXT_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, ANIMATION_METHODS)) return false; - if (!BS_LuaBindhelper::AddMethodsToClass(L, ANIMATION_TEMPLATE_CLASS_NAME, ANIMATION_TEMPLATE_METHODS)) return false; + if (!LuaBindhelper::AddMethodsToClass(L, ANIMATION_TEMPLATE_CLASS_NAME, ANIMATION_TEMPLATE_METHODS)) return false; - if (!BS_LuaBindhelper::AddFunctionsToLib(L, GFX_LIBRARY_NAME, GFX_FUNCTIONS)) return false; + if (!LuaBindhelper::AddFunctionsToLib(L, GFX_LIBRARY_NAME, GFX_FUNCTIONS)) return false; - LoopPointCallbackPtr.reset(new BS_LuaCallback(L)); + LoopPointCallbackPtr.reset(new LuaCallback(L)); ActionCallbackPtr.reset(new ActionCallback(L)); return true; -- cgit v1.2.3 From b01994a53bbc96da907a4c28934e644184291017 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 12:58:22 +0000 Subject: SWORD25: removed BS_ prefix from rest of the classes. The things which are intentionally left with the prefix: BS_LOG, BS_ASSERT, BS_Rect, BS_String. svn-id: r53261 --- engines/sword25/gfx/graphicengine_script.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 92f5750d25..67cbf31889 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -252,7 +252,7 @@ static const luaL_reg ANIMATION_TEMPLATE_METHODS[] = { // ----------------------------------------------------------------------------- static GraphicEngine *GetGE() { - BS_Kernel *pKernel = BS_Kernel::GetInstance(); + Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); GraphicEngine *pGE = static_cast(pKernel->GetService("gfx")); BS_ASSERT(pGE); @@ -1249,7 +1249,7 @@ static int A_IsPlaying(lua_State *L) { // ----------------------------------------------------------------------------- static bool AnimationLoopPointCallback(unsigned int Handle) { - lua_State *L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); + lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->GetScriptObject()); LoopPointCallbackPtr->InvokeCallbackFunctions(L, Handle); return true; @@ -1287,7 +1287,7 @@ static bool AnimationActionCallback(unsigned int Handle) { RenderObjectPtr AnimationPtr(Handle); if (AnimationPtr.IsValid()) { ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction(); - lua_State *L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); + lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->GetScriptObject()); ActionCallbackPtr->InvokeCallbackFunctions(L, AnimationPtr->GetHandle()); } @@ -1323,7 +1323,7 @@ static int A_UnregisterActionCallback(lua_State *L) { // ----------------------------------------------------------------------------- static bool AnimationDeleteCallback(unsigned int Handle) { - lua_State *L = static_cast(BS_Kernel::GetInstance()->GetScript()->GetScriptObject()); + lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->GetScriptObject()); LoopPointCallbackPtr->RemoveAllObjectCallbacks(L, Handle); return true; @@ -1526,7 +1526,7 @@ static const luaL_reg TEXT_METHODS[] = { // ----------------------------------------------------------------------------- bool GraphicEngine::RegisterScriptBindings() { - BS_Kernel *pKernel = BS_Kernel::GetInstance(); + Kernel *pKernel = Kernel::GetInstance(); BS_ASSERT(pKernel); ScriptEngine *pScript = static_cast(pKernel->GetService("script")); BS_ASSERT(pScript); -- cgit v1.2.3 From 3fb0e9383b7da395d2d715c6f1abeb0252cac229 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 12:58:45 +0000 Subject: SWORD25: Removed last traces of STL svn-id: r53262 --- engines/sword25/gfx/graphicengine_script.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 67cbf31889..5c88ce8924 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -36,9 +36,6 @@ // Includes // ----------------------------------------------------------------------------- -#include -#include - #include "sword25/kernel/common.h" #include "sword25/kernel/kernel.h" #include "sword25/kernel/callbackregistry.h" @@ -84,8 +81,8 @@ protected: } }; -std::auto_ptr LoopPointCallbackPtr; -std::auto_ptr ActionCallbackPtr; +Common::ScopedPtr LoopPointCallbackPtr; +Common::ScopedPtr ActionCallbackPtr; // ------------------------------------------------------------------------- -- cgit v1.2.3 From 086f5961b6575c50bb386750b6e9a3ed1efdd8cd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 2 Sep 2010 12:14:04 +0000 Subject: SWORD25: unsigned int -> uint svn-id: r53309 --- engines/sword25/gfx/graphicengine_script.cpp | 52 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 5c88ce8924..810a8ed549 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -61,9 +61,9 @@ namespace Sword25 { // Callback-Objekte // ----------------------------------------------------------------------------- -static bool AnimationDeleteCallback(unsigned int Data); -static bool AnimationActionCallback(unsigned int Data); -static bool AnimationLoopPointCallback(unsigned int Data); +static bool AnimationDeleteCallback(uint Data); +static bool AnimationActionCallback(uint Data); +static bool AnimationLoopPointCallback(uint Data); namespace { // ------------------------------------------------------------------------- @@ -133,7 +133,7 @@ static void *my_checkudata(lua_State *L, int ud, const char *tname) { // ----------------------------------------------------------------------------- -static void NewUintUserData(lua_State *L, unsigned int Value) { +static void NewUintUserData(lua_State *L, uint Value) { void *UserData = lua_newuserdata(L, sizeof(Value)); memcpy(UserData, &Value, sizeof(Value)); } @@ -142,8 +142,8 @@ static void NewUintUserData(lua_State *L, unsigned int Value) { static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.AnimationTemplate - unsigned int AnimationTemplateHandle; - if ((AnimationTemplateHandle = *reinterpret_cast(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) { + uint AnimationTemplateHandle; + if ((AnimationTemplateHandle = *reinterpret_cast(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) { AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); if (!AnimationTemplatePtr) luaL_error(L, "The animation template with the handle %d does no longer exist.", AnimationTemplateHandle); @@ -158,7 +158,7 @@ static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) { // ----------------------------------------------------------------------------- static int NewAnimationTemplate(lua_State *L) { - unsigned int AnimationTemplateHandle = AnimationTemplate::Create(luaL_checkstring(L, 1)); + uint AnimationTemplateHandle = AnimationTemplate::Create(luaL_checkstring(L, 1)); AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); if (AnimationTemplatePtr && AnimationTemplatePtr->IsValid()) { NewUintUserData(L, AnimationTemplateHandle); @@ -514,11 +514,11 @@ static const luaL_reg GFX_FUNCTIONS[] = { static RenderObjectPtr 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". - unsigned int *UserDataPtr; - if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 || - (UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 || - (UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 || - (UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { + 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 ROPtr(* UserDataPtr); if (ROPtr.IsValid()) return ROPtr; @@ -776,8 +776,8 @@ static const luaL_reg RENDEROBJECT_METHODS[] = { static RenderObjectPtr CheckPanel(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Panel - unsigned int *UserDataPtr; - if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) { + uint *UserDataPtr; + if ((UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); if (ROPtr.IsValid()) { return ROPtr->ToPanel(); @@ -831,8 +831,8 @@ static const luaL_reg PANEL_METHODS[] = { static RenderObjectPtr CheckBitmap(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Bitmap - unsigned int *UserDataPtr; - if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) { + uint *UserDataPtr; + if ((UserDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); if (ROPtr.IsValid()) { return ROPtr->ToBitmap(); @@ -850,7 +850,7 @@ static RenderObjectPtr CheckBitmap(lua_State *L) { static int B_SetAlpha(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); + BitmapPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1036,8 +1036,8 @@ static const luaL_reg BITMAP_METHODS[] = { static RenderObjectPtr CheckAnimation(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Animation - unsigned int *UserDataPtr; - if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) { + uint *UserDataPtr; + if ((UserDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); if (ROPtr.IsValid()) return ROPtr->ToAnimation(); @@ -1083,7 +1083,7 @@ static int A_Stop(lua_State *L) { static int A_SetFrame(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetFrame(static_cast(luaL_checknumber(L, 2))); + AnimationPtr->SetFrame(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1245,7 +1245,7 @@ static int A_IsPlaying(lua_State *L) { // ----------------------------------------------------------------------------- -static bool AnimationLoopPointCallback(unsigned int Handle) { +static bool AnimationLoopPointCallback(uint Handle) { lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->GetScriptObject()); LoopPointCallbackPtr->InvokeCallbackFunctions(L, Handle); @@ -1280,7 +1280,7 @@ static int A_UnregisterLoopPointCallback(lua_State *L) { // ----------------------------------------------------------------------------- -static bool AnimationActionCallback(unsigned int Handle) { +static bool AnimationActionCallback(uint Handle) { RenderObjectPtr AnimationPtr(Handle); if (AnimationPtr.IsValid()) { ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction(); @@ -1319,7 +1319,7 @@ static int A_UnregisterActionCallback(lua_State *L) { // ----------------------------------------------------------------------------- -static bool AnimationDeleteCallback(unsigned int Handle) { +static bool AnimationDeleteCallback(uint Handle) { lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->GetScriptObject()); LoopPointCallbackPtr->RemoveAllObjectCallbacks(L, Handle); @@ -1370,8 +1370,8 @@ static const luaL_reg ANIMATION_METHODS[] = { static RenderObjectPtr CheckText(lua_State *L) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Text - unsigned int *UserDataPtr; - if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { + uint *UserDataPtr; + if ((UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); if (ROPtr.IsValid()) return ROPtr->ToText(); @@ -1434,7 +1434,7 @@ static int T_SetAutoWrap(lua_State *L) { static int T_SetAutoWrapThreshold(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); BS_ASSERT(TextPtr.IsValid()); - TextPtr->SetAutoWrapThreshold(static_cast(luaL_checknumber(L, 2))); + TextPtr->SetAutoWrapThreshold(static_cast(luaL_checknumber(L, 2))); return 0; } -- cgit v1.2.3 From 06bce68860696f67f0a0ac1e9682635081918801 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 2 Sep 2010 17:11:45 +0000 Subject: SWORD25: Comply to the code conventions for several classes svn-id: r53310 --- engines/sword25/gfx/graphicengine_script.cpp | 332 +++++++++++++-------------- 1 file changed, 166 insertions(+), 166 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 810a8ed549..9d3a0665f2 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -144,7 +144,7 @@ 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(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) { - AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); + AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().resolveHandle(AnimationTemplateHandle); if (!AnimationTemplatePtr) luaL_error(L, "The animation template with the handle %d does no longer exist.", AnimationTemplateHandle); return AnimationTemplatePtr; @@ -159,8 +159,8 @@ 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::GetInstance().ResolveHandle(AnimationTemplateHandle); - if (AnimationTemplatePtr && AnimationTemplatePtr->IsValid()) { + AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().resolveHandle(AnimationTemplateHandle); + if (AnimationTemplatePtr && AnimationTemplatePtr->isValid()) { NewUintUserData(L, AnimationTemplateHandle); //luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); LuaBindhelper::GetMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); @@ -292,13 +292,13 @@ static int Init(lua_State *L) { // Main-Panel zum Gfx-Modul hinzufügen RenderObjectPtr MainPanelPtr(GetGE()->GetMainPanel()); - BS_ASSERT(MainPanelPtr.IsValid()); + 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); @@ -520,7 +520,7 @@ static RenderObjectPtr CheckRenderObject(lua_State *L, bool ErrorI (UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 || (UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(* UserDataPtr); - if (ROPtr.IsValid()) + if (ROPtr.isValid()) return ROPtr; else { if (ErrorIfRemoved) @@ -537,10 +537,10 @@ static RenderObjectPtr CheckRenderObject(lua_State *L, bool ErrorI static int RO_SetPos(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); + BS_ASSERT(ROPtr.isValid()); Vertex Pos; Vertex::LuaVertexToVertex(L, 2, Pos); - ROPtr->SetPos(Pos.X, Pos.Y); + ROPtr->setPos(Pos.X, Pos.Y); return 0; } @@ -548,8 +548,8 @@ static int RO_SetPos(lua_State *L) { static int RO_SetX(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr->SetX(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(ROPtr.isValid()); + ROPtr->setX(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -557,8 +557,8 @@ static int RO_SetX(lua_State *L) { static int RO_SetY(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr->SetY(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(ROPtr.isValid()); + ROPtr->setY(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -566,8 +566,8 @@ static int RO_SetY(lua_State *L) { static int RO_SetZ(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr->SetZ(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(ROPtr.isValid()); + ROPtr->setZ(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -575,8 +575,8 @@ static int RO_SetZ(lua_State *L) { static int RO_SetVisible(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr->SetVisible(lua_tobooleancpp(L, 2)); + BS_ASSERT(ROPtr.isValid()); + ROPtr->setVisible(lua_tobooleancpp(L, 2)); return 0; } @@ -584,8 +584,8 @@ static int RO_SetVisible(lua_State *L) { static int RO_GetX(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetX()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getX()); return 1; } @@ -594,8 +594,8 @@ static int RO_GetX(lua_State *L) { static int RO_GetY(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetY()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getY()); return 1; } @@ -604,8 +604,8 @@ static int RO_GetY(lua_State *L) { static int RO_GetZ(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetZ()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getZ()); return 1; } @@ -614,8 +614,8 @@ static int RO_GetZ(lua_State *L) { static int RO_GetAbsoluteX(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetAbsoluteX()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getAbsoluteX()); return 1; } @@ -624,8 +624,8 @@ static int RO_GetAbsoluteX(lua_State *L) { static int RO_GetAbsoluteY(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetAbsoluteY()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getAbsoluteY()); return 1; } @@ -634,8 +634,8 @@ static int RO_GetAbsoluteY(lua_State *L) { static int RO_GetWidth(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetWidth()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getWidth()); return 1; } @@ -644,8 +644,8 @@ static int RO_GetWidth(lua_State *L) { static int RO_GetHeight(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetHeight()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getHeight()); return 1; } @@ -654,8 +654,8 @@ static int RO_GetHeight(lua_State *L) { static int RO_IsVisible(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushbooleancpp(L, ROPtr->IsVisible()); + BS_ASSERT(ROPtr.isValid()); + lua_pushbooleancpp(L, ROPtr->isVisible()); return 1; } @@ -664,12 +664,12 @@ static int RO_IsVisible(lua_State *L) { static int RO_AddPanel(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - RenderObjectPtr PanelPtr = ROPtr->AddPanel(static_cast(luaL_checknumber(L, 2)), + BS_ASSERT(ROPtr.isValid()); + RenderObjectPtr PanelPtr = ROPtr->addPanel(static_cast(luaL_checknumber(L, 2)), static_cast(luaL_checknumber(L, 3)), GraphicEngine::LuaColorToARGBColor(L, 4)); - if (PanelPtr.IsValid()) { - NewUintUserData(L, PanelPtr->GetHandle()); + 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)); @@ -684,10 +684,10 @@ static int RO_AddPanel(lua_State *L) { static int RO_AddBitmap(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - RenderObjectPtr BitmaPtr = ROPtr->AddBitmap(luaL_checkstring(L, 2)); - if (BitmaPtr.IsValid()) { - NewUintUserData(L, BitmaPtr->GetHandle()); + BS_ASSERT(ROPtr.isValid()); + RenderObjectPtr 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)); @@ -702,14 +702,14 @@ static int RO_AddBitmap(lua_State *L) { static int RO_AddText(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); + BS_ASSERT(ROPtr.isValid()); RenderObjectPtr 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 (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)); @@ -724,25 +724,25 @@ static int RO_AddText(lua_State *L) { static int RO_AddAnimation(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); + BS_ASSERT(ROPtr.isValid()); RenderObjectPtr 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); @@ -779,8 +779,8 @@ static RenderObjectPtr CheckPanel(lua_State *L) { uint *UserDataPtr; if ((UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); - if (ROPtr.IsValid()) { - return ROPtr->ToPanel(); + if (ROPtr.isValid()) { + return ROPtr->toPanel(); } else luaL_error(L, "The panel with the handle %d does no longer exist.", *UserDataPtr); } else { @@ -794,8 +794,8 @@ static RenderObjectPtr CheckPanel(lua_State *L) { static int P_GetColor(lua_State *L) { RenderObjectPtr PanelPtr = CheckPanel(L); - BS_ASSERT(PanelPtr.IsValid()); - GraphicEngine::ARGBColorToLuaColor(L, PanelPtr->GetColor()); + BS_ASSERT(PanelPtr.isValid()); + GraphicEngine::ARGBColorToLuaColor(L, PanelPtr->getColor()); return 1; } @@ -804,8 +804,8 @@ static int P_GetColor(lua_State *L) { static int P_SetColor(lua_State *L) { RenderObjectPtr PanelPtr = CheckPanel(L); - BS_ASSERT(PanelPtr.IsValid()); - PanelPtr->SetColor(GraphicEngine::LuaColorToARGBColor(L, 2)); + BS_ASSERT(PanelPtr.isValid()); + PanelPtr->setColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } @@ -813,8 +813,8 @@ static int P_SetColor(lua_State *L) { static int P_Remove(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr.Erase(); + BS_ASSERT(ROPtr.isValid()); + ROPtr.erase(); return 0; } @@ -834,8 +834,8 @@ static RenderObjectPtr CheckBitmap(lua_State *L) { uint *UserDataPtr; if ((UserDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); - if (ROPtr.IsValid()) { - return ROPtr->ToBitmap(); + if (ROPtr.isValid()) { + return ROPtr->toBitmap(); } else luaL_error(L, "The bitmap with the handle %d does no longer exist.", *UserDataPtr); } else { @@ -849,8 +849,8 @@ static RenderObjectPtr CheckBitmap(lua_State *L) { static int B_SetAlpha(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setAlpha(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -858,8 +858,8 @@ static int B_SetAlpha(lua_State *L) { static int B_SetTintColor(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2)); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } @@ -867,8 +867,8 @@ static int B_SetTintColor(lua_State *L) { static int B_SetScaleFactor(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setScaleFactor(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -876,8 +876,8 @@ static int B_SetScaleFactor(lua_State *L) { static int B_SetScaleFactorX(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetScaleFactorX(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setScaleFactorX(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -885,8 +885,8 @@ static int B_SetScaleFactorX(lua_State *L) { static int B_SetScaleFactorY(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetScaleFactorY(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setScaleFactorY(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -894,8 +894,8 @@ static int B_SetScaleFactorY(lua_State *L) { static int B_SetFlipH(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetFlipH(lua_tobooleancpp(L, 2)); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setFlipH(lua_tobooleancpp(L, 2)); return 0; } @@ -903,8 +903,8 @@ static int B_SetFlipH(lua_State *L) { static int B_SetFlipV(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetFlipV(lua_tobooleancpp(L, 2)); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setFlipV(lua_tobooleancpp(L, 2)); return 0; } @@ -912,8 +912,8 @@ static int B_SetFlipV(lua_State *L) { static int B_GetAlpha(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushnumber(L, BitmapPtr->GetAlpha()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushnumber(L, BitmapPtr->getAlpha()); return 1; } @@ -921,8 +921,8 @@ static int B_GetAlpha(lua_State *L) { static int B_GetTintColor(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->GetModulationColor()); + BS_ASSERT(BitmapPtr.isValid()); + GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->getModulationColor()); return 1; } @@ -930,8 +930,8 @@ static int B_GetTintColor(lua_State *L) { static int B_GetScaleFactorX(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushnumber(L, BitmapPtr->GetScaleFactorX()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushnumber(L, BitmapPtr->getScaleFactorX()); return 1; } @@ -939,8 +939,8 @@ static int B_GetScaleFactorX(lua_State *L) { static int B_GetScaleFactorY(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushnumber(L, BitmapPtr->GetScaleFactorY()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushnumber(L, BitmapPtr->getScaleFactorY()); return 1; } @@ -948,8 +948,8 @@ static int B_GetScaleFactorY(lua_State *L) { static int B_IsFlipH(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushbooleancpp(L, BitmapPtr->IsFlipH()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushbooleancpp(L, BitmapPtr->isFlipH()); return 1; } @@ -957,8 +957,8 @@ static int B_IsFlipH(lua_State *L) { static int B_IsFlipV(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushbooleancpp(L, BitmapPtr->IsFlipV()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushbooleancpp(L, BitmapPtr->isFlipV()); return 1; } @@ -966,10 +966,10 @@ static int B_IsFlipV(lua_State *L) { static int B_GetPixel(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); + 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; } @@ -977,8 +977,8 @@ static int B_GetPixel(lua_State *L) { static int B_IsScalingAllowed(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushbooleancpp(L, BitmapPtr->IsScalingAllowed()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushbooleancpp(L, BitmapPtr->isScalingAllowed()); return 1; } @@ -986,8 +986,8 @@ static int B_IsScalingAllowed(lua_State *L) { static int B_IsAlphaAllowed(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushbooleancpp(L, BitmapPtr->IsAlphaAllowed()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushbooleancpp(L, BitmapPtr->isAlphaAllowed()); return 1; } @@ -995,16 +995,16 @@ static int B_IsAlphaAllowed(lua_State *L) { static int B_IsTintingAllowed(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushbooleancpp(L, BitmapPtr->IsColorModulationAllowed()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushbooleancpp(L, BitmapPtr->isColorModulationAllowed()); return 1; } // ----------------------------------------------------------------------------- static int B_Remove(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr.Erase(); + BS_ASSERT(ROPtr.isValid()); + ROPtr.erase(); return 0; } @@ -1039,8 +1039,8 @@ static RenderObjectPtr CheckAnimation(lua_State *L) { uint *UserDataPtr; if ((UserDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); - if (ROPtr.IsValid()) - return ROPtr->ToAnimation(); + if (ROPtr.isValid()) + return ROPtr->toAnimation(); else { luaL_error(L, "The animation with the handle %d does no longer exist.", *UserDataPtr); } @@ -1055,7 +1055,7 @@ static RenderObjectPtr CheckAnimation(lua_State *L) { static int A_Play(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); AnimationPtr->Play(); return 0; } @@ -1064,7 +1064,7 @@ static int A_Play(lua_State *L) { static int A_Pause(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); AnimationPtr->Pause(); return 0; } @@ -1073,7 +1073,7 @@ static int A_Pause(lua_State *L) { static int A_Stop(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); AnimationPtr->Stop(); return 0; } @@ -1082,7 +1082,7 @@ static int A_Stop(lua_State *L) { static int A_SetFrame(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); AnimationPtr->SetFrame(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1091,16 +1091,16 @@ static int A_SetFrame(lua_State *L) { static int A_SetAlpha(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr->setAlpha(static_cast(luaL_checknumber(L, 2))); return 0; } // ----------------------------------------------------------------------------- static int A_SetTintColor(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2)); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr->setModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } @@ -1108,8 +1108,8 @@ static int A_SetTintColor(lua_State *L) { static int A_SetScaleFactor(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr->setScaleFactor(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1117,8 +1117,8 @@ static int A_SetScaleFactor(lua_State *L) { static int A_SetScaleFactorX(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetScaleFactorX(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr->setScaleFactorX(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1126,8 +1126,8 @@ static int A_SetScaleFactorX(lua_State *L) { static int A_SetScaleFactorY(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetScaleFactorY(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr->setScaleFactorY(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1135,8 +1135,8 @@ static int A_SetScaleFactorY(lua_State *L) { static int A_GetScaleFactorX(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushnumber(L, AnimationPtr->GetScaleFactorX()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushnumber(L, AnimationPtr->getScaleFactorX()); return 1; } @@ -1144,8 +1144,8 @@ static int A_GetScaleFactorX(lua_State *L) { static int A_GetScaleFactorY(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushnumber(L, AnimationPtr->GetScaleFactorY()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushnumber(L, AnimationPtr->getScaleFactorY()); return 1; } @@ -1153,8 +1153,8 @@ static int A_GetScaleFactorY(lua_State *L) { static int A_GetAnimationType(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - switch (AnimationPtr->GetAnimationType()) { + BS_ASSERT(AnimationPtr.isValid()); + switch (AnimationPtr->getAnimationType()) { case Animation::AT_JOJO: lua_pushstring(L, "jojo"); break; @@ -1174,8 +1174,8 @@ static int A_GetAnimationType(lua_State *L) { static int A_GetFPS(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushnumber(L, AnimationPtr->GetFPS()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushnumber(L, AnimationPtr->getFPS()); return 1; } @@ -1184,8 +1184,8 @@ static int A_GetFPS(lua_State *L) { static int A_GetFrameCount(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushnumber(L, AnimationPtr->GetFrameCount()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushnumber(L, AnimationPtr->getFrameCount()); return 1; } @@ -1193,8 +1193,8 @@ static int A_GetFrameCount(lua_State *L) { static int A_IsScalingAllowed(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushbooleancpp(L, AnimationPtr->IsScalingAllowed()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushbooleancpp(L, AnimationPtr->isScalingAllowed()); return 1; } @@ -1202,8 +1202,8 @@ static int A_IsScalingAllowed(lua_State *L) { static int A_IsAlphaAllowed(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushbooleancpp(L, AnimationPtr->IsAlphaAllowed()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushbooleancpp(L, AnimationPtr->isAlphaAllowed()); return 1; } @@ -1211,8 +1211,8 @@ static int A_IsAlphaAllowed(lua_State *L) { static int A_IsTintingAllowed(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushbooleancpp(L, AnimationPtr->IsColorModulationAllowed()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushbooleancpp(L, AnimationPtr->isColorModulationAllowed()); return 1; } @@ -1220,7 +1220,7 @@ static int A_IsTintingAllowed(lua_State *L) { static int A_GetCurrentFrame(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); lua_pushnumber(L, AnimationPtr->GetCurrentFrame()); return 1; } @@ -1229,7 +1229,7 @@ static int A_GetCurrentFrame(lua_State *L) { static int A_GetCurrentAction(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); lua_pushstring(L, AnimationPtr->GetCurrentAction().c_str()); return 1; } @@ -1238,7 +1238,7 @@ static int A_GetCurrentAction(lua_State *L) { static int A_IsPlaying(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); lua_pushbooleancpp(L, AnimationPtr->IsRunning()); return 1; } @@ -1256,11 +1256,11 @@ static bool AnimationLoopPointCallback(uint Handle) { static int A_RegisterLoopPointCallback(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + 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; } @@ -1269,11 +1269,11 @@ static int A_RegisterLoopPointCallback(lua_State *L) { static int A_UnregisterLoopPointCallback(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + 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; } @@ -1282,10 +1282,10 @@ static int A_UnregisterLoopPointCallback(lua_State *L) { static bool AnimationActionCallback(uint Handle) { RenderObjectPtr AnimationPtr(Handle); - if (AnimationPtr.IsValid()) { + if (AnimationPtr.isValid()) { ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction(); lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->GetScriptObject()); - ActionCallbackPtr->InvokeCallbackFunctions(L, AnimationPtr->GetHandle()); + ActionCallbackPtr->InvokeCallbackFunctions(L, AnimationPtr->getHandle()); } return true; @@ -1295,11 +1295,11 @@ static bool AnimationActionCallback(uint Handle) { static int A_RegisterActionCallback(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + 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; } @@ -1308,11 +1308,11 @@ static int A_RegisterActionCallback(lua_State *L) { static int A_UnregisterActionCallback(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + 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; } @@ -1330,8 +1330,8 @@ static bool AnimationDeleteCallback(uint Handle) { static int A_Remove(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr.Erase(); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr.erase(); return 0; } @@ -1373,8 +1373,8 @@ static RenderObjectPtr CheckText(lua_State *L) { uint *UserDataPtr; if ((UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); - if (ROPtr.IsValid()) - return ROPtr->ToText(); + if (ROPtr.isValid()) + return ROPtr->toText(); else luaL_error(L, "The text with the handle %d does no longer exist.", *UserDataPtr); } else { @@ -1388,7 +1388,7 @@ static RenderObjectPtr CheckText(lua_State *L) { static int T_SetFont(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); TextPtr->SetFont(luaL_checkstring(L, 2)); return 0; } @@ -1397,7 +1397,7 @@ static int T_SetFont(lua_State *L) { static int T_SetText(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); TextPtr->SetText(luaL_checkstring(L, 2)); return 0; } @@ -1406,8 +1406,8 @@ static int T_SetText(lua_State *L) { static int T_SetAlpha(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); - TextPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(TextPtr.isValid()); + TextPtr->setAlpha(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1415,8 +1415,8 @@ static int T_SetAlpha(lua_State *L) { static int T_SetColor(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); - TextPtr->SetColor(GraphicEngine::LuaColorToARGBColor(L, 2)); + BS_ASSERT(TextPtr.isValid()); + TextPtr->setColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } @@ -1424,7 +1424,7 @@ static int T_SetColor(lua_State *L) { static int T_SetAutoWrap(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); TextPtr->SetAutoWrap(lua_tobooleancpp(L, 2)); return 0; } @@ -1433,7 +1433,7 @@ static int T_SetAutoWrap(lua_State *L) { static int T_SetAutoWrapThreshold(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); TextPtr->SetAutoWrapThreshold(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1442,7 +1442,7 @@ static int T_SetAutoWrapThreshold(lua_State *L) { static int T_GetText(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); lua_pushstring(L, TextPtr->GetText().c_str()); return 1; } @@ -1451,7 +1451,7 @@ static int T_GetText(lua_State *L) { static int T_GetFont(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); lua_pushstring(L, TextPtr->GetFont().c_str()); return 1; } @@ -1460,8 +1460,8 @@ static int T_GetFont(lua_State *L) { static int T_GetAlpha(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); - lua_pushnumber(L, TextPtr->GetAlpha()); + BS_ASSERT(TextPtr.isValid()); + lua_pushnumber(L, TextPtr->getAlpha()); return 1; } @@ -1469,8 +1469,8 @@ static int T_GetAlpha(lua_State *L) { static int T_GetColor(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); - lua_pushnumber(L, TextPtr->GetColor()); + BS_ASSERT(TextPtr.isValid()); + lua_pushnumber(L, TextPtr->getColor()); return 1; } @@ -1478,7 +1478,7 @@ static int T_GetColor(lua_State *L) { static int T_IsAutoWrap(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); lua_pushbooleancpp(L, TextPtr->IsAutoWrapActive()); return 1; } @@ -1487,7 +1487,7 @@ static int T_IsAutoWrap(lua_State *L) { static int T_GetAutoWrapThreshold(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); lua_pushnumber(L, TextPtr->GetAutoWrapThreshold()); return 1; } @@ -1496,8 +1496,8 @@ static int T_GetAutoWrapThreshold(lua_State *L) { static int T_Remove(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); - TextPtr.Erase(); + BS_ASSERT(TextPtr.isValid()); + TextPtr.erase(); return 0; } -- cgit v1.2.3 From 54ccc8f4c906cd4f84c955581c0368886a7a9c78 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 3 Oct 2010 13:25:22 +0000 Subject: SWORD25: Enforced code naming conventions in script/* svn-id: r53391 --- engines/sword25/gfx/graphicengine_script.cpp | 56 ++++++++++++++-------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 9d3a0665f2..ba0c0cf506 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -119,7 +119,7 @@ static void *my_checkudata(lua_State *L, int ud, const char *tname) { if (p != NULL) { /* value is a userdata? */ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ // lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ - LuaBindhelper::GetMetatable(L, tname); + LuaBindhelper::getMetatable(L, tname); if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ lua_settop(L, top); return p; @@ -163,7 +163,7 @@ static int NewAnimationTemplate(lua_State *L) { if (AnimationTemplatePtr && AnimationTemplatePtr->isValid()) { NewUintUserData(L, AnimationTemplateHandle); //luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); - LuaBindhelper::GetMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); + LuaBindhelper::getMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else { @@ -301,7 +301,7 @@ static int Init(lua_State *L) { NewUintUserData(L, MainPanelPtr->getHandle()); BS_ASSERT(!lua_isnil(L, -1)); // luaL_getmetatable(L, PANEL_CLASS_NAME); - LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); + LuaBindhelper::getMetatable(L, PANEL_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); @@ -671,7 +671,7 @@ static int RO_AddPanel(lua_State *L) { if (PanelPtr.isValid()) { NewUintUserData(L, PanelPtr->getHandle()); // luaL_getmetatable(L, PANEL_CLASS_NAME); - LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); + LuaBindhelper::getMetatable(L, PANEL_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else @@ -689,7 +689,7 @@ static int RO_AddBitmap(lua_State *L) { if (BitmaPtr.isValid()) { NewUintUserData(L, BitmaPtr->getHandle()); // luaL_getmetatable(L, BITMAP_CLASS_NAME); - LuaBindhelper::GetMetatable(L, BITMAP_CLASS_NAME); + LuaBindhelper::getMetatable(L, BITMAP_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else @@ -711,7 +711,7 @@ static int RO_AddText(lua_State *L) { if (TextPtr.isValid()) { NewUintUserData(L, TextPtr->getHandle()); // luaL_getmetatable(L, TEXT_CLASS_NAME); - LuaBindhelper::GetMetatable(L, TEXT_CLASS_NAME); + LuaBindhelper::getMetatable(L, TEXT_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); } else @@ -735,7 +735,7 @@ static int RO_AddAnimation(lua_State *L) { if (AnimationPtr.isValid()) { NewUintUserData(L, AnimationPtr->getHandle()); // luaL_getmetatable(L, ANIMATION_CLASS_NAME); - LuaBindhelper::GetMetatable(L, ANIMATION_CLASS_NAME); + LuaBindhelper::getMetatable(L, ANIMATION_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); lua_setmetatable(L, -2); @@ -1246,8 +1246,8 @@ static int A_IsPlaying(lua_State *L) { // ----------------------------------------------------------------------------- static bool AnimationLoopPointCallback(uint Handle) { - lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->GetScriptObject()); - LoopPointCallbackPtr->InvokeCallbackFunctions(L, Handle); + lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->getScriptObject()); + LoopPointCallbackPtr->invokeCallbackFunctions(L, Handle); return true; } @@ -1260,7 +1260,7 @@ static int A_RegisterLoopPointCallback(lua_State *L) { luaL_checktype(L, 2, LUA_TFUNCTION); lua_pushvalue(L, 2); - LoopPointCallbackPtr->RegisterCallbackFunction(L, AnimationPtr->getHandle()); + LoopPointCallbackPtr->registerCallbackFunction(L, AnimationPtr->getHandle()); return 0; } @@ -1273,7 +1273,7 @@ static int A_UnregisterLoopPointCallback(lua_State *L) { luaL_checktype(L, 2, LUA_TFUNCTION); lua_pushvalue(L, 2); - LoopPointCallbackPtr->UnregisterCallbackFunction(L, AnimationPtr->getHandle()); + LoopPointCallbackPtr->unregisterCallbackFunction(L, AnimationPtr->getHandle()); return 0; } @@ -1284,8 +1284,8 @@ static bool AnimationActionCallback(uint Handle) { RenderObjectPtr AnimationPtr(Handle); if (AnimationPtr.isValid()) { ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction(); - lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->GetScriptObject()); - ActionCallbackPtr->InvokeCallbackFunctions(L, AnimationPtr->getHandle()); + lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->getScriptObject()); + ActionCallbackPtr->invokeCallbackFunctions(L, AnimationPtr->getHandle()); } return true; @@ -1299,7 +1299,7 @@ static int A_RegisterActionCallback(lua_State *L) { luaL_checktype(L, 2, LUA_TFUNCTION); lua_pushvalue(L, 2); - ActionCallbackPtr->RegisterCallbackFunction(L, AnimationPtr->getHandle()); + ActionCallbackPtr->registerCallbackFunction(L, AnimationPtr->getHandle()); return 0; } @@ -1312,7 +1312,7 @@ static int A_UnregisterActionCallback(lua_State *L) { luaL_checktype(L, 2, LUA_TFUNCTION); lua_pushvalue(L, 2); - ActionCallbackPtr->UnregisterCallbackFunction(L, AnimationPtr->getHandle()); + ActionCallbackPtr->unregisterCallbackFunction(L, AnimationPtr->getHandle()); return 0; } @@ -1320,8 +1320,8 @@ static int A_UnregisterActionCallback(lua_State *L) { // ----------------------------------------------------------------------------- static bool AnimationDeleteCallback(uint Handle) { - lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->GetScriptObject()); - LoopPointCallbackPtr->RemoveAllObjectCallbacks(L, Handle); + lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->getScriptObject()); + LoopPointCallbackPtr->removeAllObjectCallbacks(L, Handle); return true; } @@ -1527,22 +1527,22 @@ bool GraphicEngine::RegisterScriptBindings() { BS_ASSERT(pKernel); ScriptEngine *pScript = static_cast(pKernel->GetService("script")); BS_ASSERT(pScript); - lua_State *L = static_cast(pScript->GetScriptObject()); + lua_State *L = static_cast(pScript->getScriptObject()); BS_ASSERT(L); - if (!LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::addMethodsToClass(L, BITMAP_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::addMethodsToClass(L, ANIMATION_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::addMethodsToClass(L, PANEL_CLASS_NAME, RENDEROBJECT_METHODS)) return false; + if (!LuaBindhelper::addMethodsToClass(L, TEXT_CLASS_NAME, RENDEROBJECT_METHODS)) return false; - if (!LuaBindhelper::AddMethodsToClass(L, PANEL_CLASS_NAME, PANEL_METHODS)) return false; - if (!LuaBindhelper::AddMethodsToClass(L, BITMAP_CLASS_NAME, BITMAP_METHODS)) return false; - if (!LuaBindhelper::AddMethodsToClass(L, TEXT_CLASS_NAME, TEXT_METHODS)) return false; - if (!LuaBindhelper::AddMethodsToClass(L, ANIMATION_CLASS_NAME, ANIMATION_METHODS)) return false; + if (!LuaBindhelper::addMethodsToClass(L, PANEL_CLASS_NAME, PANEL_METHODS)) return false; + if (!LuaBindhelper::addMethodsToClass(L, BITMAP_CLASS_NAME, BITMAP_METHODS)) return false; + if (!LuaBindhelper::addMethodsToClass(L, TEXT_CLASS_NAME, TEXT_METHODS)) return false; + if (!LuaBindhelper::addMethodsToClass(L, ANIMATION_CLASS_NAME, ANIMATION_METHODS)) return false; - if (!LuaBindhelper::AddMethodsToClass(L, ANIMATION_TEMPLATE_CLASS_NAME, ANIMATION_TEMPLATE_METHODS)) return false; + if (!LuaBindhelper::addMethodsToClass(L, ANIMATION_TEMPLATE_CLASS_NAME, ANIMATION_TEMPLATE_METHODS)) return false; - if (!LuaBindhelper::AddFunctionsToLib(L, GFX_LIBRARY_NAME, GFX_FUNCTIONS)) return false; + if (!LuaBindhelper::addFunctionsToLib(L, GFX_LIBRARY_NAME, GFX_FUNCTIONS)) return false; LoopPointCallbackPtr.reset(new LuaCallback(L)); ActionCallbackPtr.reset(new ActionCallback(L)); -- cgit v1.2.3 From 063cb5d84ca5846ac0eff9388759a9b6662e764f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 3 Oct 2010 13:25:36 +0000 Subject: SWORD25: Enforced code naming conventions in math/* svn-id: r53392 --- engines/sword25/gfx/graphicengine_script.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index ba0c0cf506..51a6a75111 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -144,7 +144,7 @@ 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(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) { - AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().resolveHandle(AnimationTemplateHandle); + AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::getInstance().resolveHandle(AnimationTemplateHandle); if (!AnimationTemplatePtr) luaL_error(L, "The animation template with the handle %d does no longer exist.", AnimationTemplateHandle); return AnimationTemplatePtr; @@ -159,7 +159,7 @@ 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::GetInstance().resolveHandle(AnimationTemplateHandle); + AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::getInstance().resolveHandle(AnimationTemplateHandle); if (AnimationTemplatePtr && AnimationTemplatePtr->isValid()) { NewUintUserData(L, AnimationTemplateHandle); //luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); @@ -348,8 +348,8 @@ static int DrawDebugLine(lua_State *L) { Vertex Start; Vertex End; - Vertex::LuaVertexToVertex(L, 1, Start); - Vertex::LuaVertexToVertex(L, 2, End); + Vertex::luaVertexToVertex(L, 1, Start); + Vertex::luaVertexToVertex(L, 2, End); pGE->DrawDebugLine(Start, End, GraphicEngine::LuaColorToARGBColor(L, 3)); return 0; @@ -539,8 +539,8 @@ static int RO_SetPos(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); BS_ASSERT(ROPtr.isValid()); Vertex Pos; - Vertex::LuaVertexToVertex(L, 2, Pos); - ROPtr->setPos(Pos.X, Pos.Y); + Vertex::luaVertexToVertex(L, 2, Pos); + ROPtr->setPos(Pos.x, Pos.y); return 0; } @@ -968,8 +968,8 @@ static int B_GetPixel(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); BS_ASSERT(BitmapPtr.isValid()); Vertex Pos; - Vertex::LuaVertexToVertex(L, 2, Pos); - GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->getPixel(Pos.X, Pos.Y)); + Vertex::luaVertexToVertex(L, 2, Pos); + GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->getPixel(Pos.x, Pos.y)); return 1; } -- cgit v1.2.3 From eb66750137c1f32276ed4d66512deca2ee6aae93 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 12 Oct 2010 19:38:40 +0000 Subject: SWORD25: Enforce code naming conventions in gfx/animation* svn-id: r53393 --- engines/sword25/gfx/graphicengine_script.cpp | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'engines/sword25/gfx/graphicengine_script.cpp') diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 51a6a75111..d443023436 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -158,7 +158,7 @@ static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) { // ----------------------------------------------------------------------------- static int NewAnimationTemplate(lua_State *L) { - uint AnimationTemplateHandle = AnimationTemplate::Create(luaL_checkstring(L, 1)); + uint AnimationTemplateHandle = AnimationTemplate::create(luaL_checkstring(L, 1)); AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::getInstance().resolveHandle(AnimationTemplateHandle); if (AnimationTemplatePtr && AnimationTemplatePtr->isValid()) { NewUintUserData(L, AnimationTemplateHandle); @@ -177,7 +177,7 @@ static int NewAnimationTemplate(lua_State *L) { static int AT_AddFrame(lua_State *L) { AnimationTemplate *pAT = CheckAnimationTemplate(L); - pAT->AddFrame(static_cast(luaL_checknumber(L, 2))); + pAT->addFrame(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -185,7 +185,7 @@ static int AT_AddFrame(lua_State *L) { static int AT_SetFrame(lua_State *L) { AnimationTemplate *pAT = CheckAnimationTemplate(L); - pAT->SetFrame(static_cast(luaL_checknumber(L, 2)), static_cast(luaL_checknumber(L, 3))); + pAT->setFrame(static_cast(luaL_checknumber(L, 2)), static_cast(luaL_checknumber(L, 3))); return 0; } @@ -211,7 +211,7 @@ 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); + pAT->setAnimationType(AnimationType); } else { luaL_argcheck(L, 0, 2, "Invalid animation type"); } @@ -223,7 +223,7 @@ static int AT_SetAnimationType(lua_State *L) { static int AT_SetFPS(lua_State *L) { AnimationTemplate *pAT = CheckAnimationTemplate(L); - pAT->SetFPS(static_cast(luaL_checknumber(L, 2))); + pAT->setFPS(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -740,9 +740,9 @@ static int RO_AddAnimation(lua_State *L) { 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); @@ -1056,7 +1056,7 @@ static RenderObjectPtr CheckAnimation(lua_State *L) { static int A_Play(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.isValid()); - AnimationPtr->Play(); + AnimationPtr->play(); return 0; } @@ -1065,7 +1065,7 @@ static int A_Play(lua_State *L) { static int A_Pause(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.isValid()); - AnimationPtr->Pause(); + AnimationPtr->pause(); return 0; } @@ -1074,7 +1074,7 @@ static int A_Pause(lua_State *L) { static int A_Stop(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.isValid()); - AnimationPtr->Stop(); + AnimationPtr->stop(); return 0; } @@ -1083,7 +1083,7 @@ static int A_Stop(lua_State *L) { static int A_SetFrame(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.isValid()); - AnimationPtr->SetFrame(static_cast(luaL_checknumber(L, 2))); + AnimationPtr->setFrame(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1221,7 +1221,7 @@ static int A_IsTintingAllowed(lua_State *L) { static int A_GetCurrentFrame(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.isValid()); - lua_pushnumber(L, AnimationPtr->GetCurrentFrame()); + lua_pushnumber(L, AnimationPtr->getCurrentFrame()); return 1; } @@ -1230,7 +1230,7 @@ static int A_GetCurrentFrame(lua_State *L) { static int A_GetCurrentAction(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.isValid()); - lua_pushstring(L, AnimationPtr->GetCurrentAction().c_str()); + lua_pushstring(L, AnimationPtr->getCurrentAction().c_str()); return 1; } @@ -1239,7 +1239,7 @@ static int A_GetCurrentAction(lua_State *L) { static int A_IsPlaying(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); BS_ASSERT(AnimationPtr.isValid()); - lua_pushbooleancpp(L, AnimationPtr->IsRunning()); + lua_pushbooleancpp(L, AnimationPtr->isRunning()); return 1; } @@ -1283,7 +1283,7 @@ static int A_UnregisterLoopPointCallback(lua_State *L) { static bool AnimationActionCallback(uint Handle) { RenderObjectPtr AnimationPtr(Handle); if (AnimationPtr.isValid()) { - ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction(); + ActionCallbackPtr->Action = AnimationPtr->getCurrentAction(); lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->getScriptObject()); ActionCallbackPtr->invokeCallbackFunctions(L, AnimationPtr->getHandle()); } -- cgit v1.2.3