aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25
diff options
context:
space:
mode:
authorEugene Sandulenko2010-10-19 20:51:21 +0000
committerEugene Sandulenko2010-10-19 20:51:21 +0000
commitd94435eebd8ab8e21a4a28a0274cae02910cb41d (patch)
treeed9986a645ad2a5d7c24c5c8763c81e1586c32c0 /engines/sword25
parent0d1d4818947c085cb3714b73024738cb99f5fca9 (diff)
downloadscummvm-rg350-d94435eebd8ab8e21a4a28a0274cae02910cb41d.tar.gz
scummvm-rg350-d94435eebd8ab8e21a4a28a0274cae02910cb41d.tar.bz2
scummvm-rg350-d94435eebd8ab8e21a4a28a0274cae02910cb41d.zip
SWORD25: Enforce code naming conventions in gfx/graphicengine*
svn-id: r53621
Diffstat (limited to 'engines/sword25')
-rw-r--r--engines/sword25/fmv/movieplayer.cpp18
-rw-r--r--engines/sword25/gfx/framecounter.cpp28
-rw-r--r--engines/sword25/gfx/framecounter.h23
-rw-r--r--engines/sword25/gfx/graphicengine.cpp193
-rw-r--r--engines/sword25/gfx/graphicengine.h140
-rw-r--r--engines/sword25/gfx/graphicengine_script.cpp1421
-rw-r--r--engines/sword25/gfx/image/pngloader.cpp2
-rw-r--r--engines/sword25/gfx/renderobjectmanager.cpp2
-rw-r--r--engines/sword25/math/geometry_script.cpp8
9 files changed, 785 insertions, 1050 deletions
diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp
index d58c630759..29d84ba87b 100644
--- a/engines/sword25/fmv/movieplayer.cpp
+++ b/engines/sword25/fmv/movieplayer.cpp
@@ -73,15 +73,15 @@ bool MoviePlayer::loadMovie(const Common::String &filename, uint z) {
GraphicEngine *pGfx = Kernel::GetInstance()->GetGfx();
#if INDIRECTRENDERING
- _outputBitmap = pGfx->GetMainPanel()->addDynamicBitmap(_decoder.getWidth(), _decoder.getHeight());
+ _outputBitmap = pGfx->getMainPanel()->addDynamicBitmap(_decoder.getWidth(), _decoder.getHeight());
if (!_outputBitmap.isValid()) {
BS_LOG_ERRORLN("Output bitmap for movie playback could not be created.");
return false;
}
// Skalierung des Ausgabebitmaps berechnen, so dass es möglichst viel Bildschirmfläche einnimmt.
- float screenToVideoWidth = (float)pGfx->GetDisplayWidth() / (float)_outputBitmap->getWidth();
- float screenToVideoHeight = (float)pGfx->GetDisplayHeight() / (float)_outputBitmap->getHeight();
+ float screenToVideoWidth = (float)pGfx->getDisplayWidth() / (float)_outputBitmap->getWidth();
+ float screenToVideoHeight = (float)pGfx->getDisplayHeight() / (float)_outputBitmap->getHeight();
float scaleFactor = MIN(screenToVideoWidth, screenToVideoHeight);
if (abs((int)(scaleFactor - 1.0f)) < FLT_EPSILON)
@@ -93,13 +93,13 @@ bool MoviePlayer::loadMovie(const Common::String &filename, uint z) {
_outputBitmap->setZ(z);
// Ausgabebitmap auf dem Bildschirm zentrieren
- _outputBitmap->setX((pGfx->GetDisplayWidth() - _outputBitmap->getWidth()) / 2);
- _outputBitmap->setY((pGfx->GetDisplayHeight() - _outputBitmap->getHeight()) / 2);
+ _outputBitmap->setX((pGfx->getDisplayWidth() - _outputBitmap->getWidth()) / 2);
+ _outputBitmap->setY((pGfx->getDisplayHeight() - _outputBitmap->getHeight()) / 2);
#else
_backSurface = pGfx->getSurface();
- _outX = (pGfx->GetDisplayWidth() - _decoder.getWidth()) / 2;
- _outY = (pGfx->GetDisplayHeight() - _decoder.getHeight()) / 2;
+ _outX = (pGfx->getDisplayWidth() - _decoder.getWidth()) / 2;
+ _outY = (pGfx->getDisplayHeight() - _decoder.getHeight()) / 2;
if (_outX < 0)
_outX = 0;
@@ -169,8 +169,8 @@ void MoviePlayer::setScaleFactor(float scaleFactor) {
// Ausgabebitmap auf dem Bildschirm zentrieren
GraphicEngine *gfxPtr = Kernel::GetInstance()->GetGfx();
- _outputBitmap->setX((gfxPtr->GetDisplayWidth() - _outputBitmap->getWidth()) / 2);
- _outputBitmap->setY((gfxPtr->GetDisplayHeight() - _outputBitmap->getHeight()) / 2);
+ _outputBitmap->setX((gfxPtr->getDisplayWidth() - _outputBitmap->getWidth()) / 2);
+ _outputBitmap->setY((gfxPtr->getDisplayHeight() - _outputBitmap->getHeight()) / 2);
}
}
diff --git a/engines/sword25/gfx/framecounter.cpp b/engines/sword25/gfx/framecounter.cpp
index e152e4429e..07415cc2dc 100644
--- a/engines/sword25/gfx/framecounter.cpp
+++ b/engines/sword25/gfx/framecounter.cpp
@@ -37,30 +37,30 @@
namespace Sword25 {
-Framecounter::Framecounter(int UpdateFrequency) :
- m_FPS(0),
- m_FPSCount(0),
- m_LastUpdateTime(-1) {
- SetUpdateFrequency(UpdateFrequency);
+Framecounter::Framecounter(int updateFrequency) :
+ _FPS(0),
+ _FPSCount(0),
+ _lastUpdateTime(-1) {
+ setUpdateFrequency(updateFrequency);
}
-void Framecounter::Update() {
+void Framecounter::update() {
// Aktuellen Systemtimerstand auslesen
- uint64 Timer = g_system->getMillis() * 1000;
+ uint64 timer = g_system->getMillis() * 1000;
// Falls m_LastUpdateTime == -1 ist, wird der Frame-Counter zum ersten Mal aufgerufen und der aktuelle Systemtimer als erster
// Messzeitpunkt genommen.
- if (m_LastUpdateTime == -1)
- m_LastUpdateTime = Timer;
+ if (_lastUpdateTime == -1)
+ _lastUpdateTime = timer;
else {
// Die Anzahl der Frames im aktuellen Messzeitraum wird erhöht.
- m_FPSCount++;
+ _FPSCount++;
// Falls der Messzeitraum verstrichen ist, wird die durchschnittliche Framerate berechnet und ein neuer Messzeitraum begonnen.
- if (Timer - m_LastUpdateTime >= m_UpdateDelay) {
- m_FPS = static_cast<int>((1000000 * (uint64)m_FPSCount) / (Timer - m_LastUpdateTime));
- m_LastUpdateTime = Timer;
- m_FPSCount = 0;
+ if (timer - _lastUpdateTime >= _updateDelay) {
+ _FPS = static_cast<int>((1000000 * (uint64)_FPSCount) / (timer - _lastUpdateTime));
+ _lastUpdateTime = timer;
+ _FPSCount = 0;
}
}
}
diff --git a/engines/sword25/gfx/framecounter.h b/engines/sword25/gfx/framecounter.h
index dcfae8acbf..994950573f 100644
--- a/engines/sword25/gfx/framecounter.h
+++ b/engines/sword25/gfx/framecounter.h
@@ -40,7 +40,6 @@
namespace Sword25 {
-
/**
* A simple class that implements a frame counter
*/
@@ -62,37 +61,37 @@ public:
* @param UpdateFrequency Specifies how often the frame counter should be updated in a sceond.
* The default value is 10.
*/
- Framecounter(int UpdateFrequency = DEFAULT_UPDATE_FREQUENCY);
+ Framecounter(int updateFrequency = DEFAULT_UPDATE_FREQUENCY);
/**
* Determines how often the frame counter should be updated in a second.
* @param UpdateFrequency Specifies how often the frame counter should be updated in a second.
*/
- inline void SetUpdateFrequency(int UpdateFrequency);
+ inline void setUpdateFrequency(int updateFrequency);
/**
* This method must be called once per frame.
*/
- void Update();
+ void update();
/**
* Returns the current FPS value.
*/
- int GetFPS() const {
- return m_FPS;
+ int getFPS() const {
+ return _FPS;
}
private:
- int m_FPS;
- int m_FPSCount;
- int64 m_LastUpdateTime;
- uint64 m_UpdateDelay;
+ int _FPS;
+ int _FPSCount;
+ int64 _lastUpdateTime;
+ uint64 _updateDelay;
};
// Inlines
-void Framecounter::SetUpdateFrequency(int UpdateFrequency) {
+void Framecounter::setUpdateFrequency(int updateFrequency) {
// Frequency in time (converted to microseconds)
- m_UpdateDelay = 1000000 / UpdateFrequency;
+ _updateDelay = 1000000 / updateFrequency;
}
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index c16107c81c..14dabf9cc4 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -68,17 +68,17 @@ GraphicEngine::GraphicEngine(Kernel *pKernel) :
_width(0),
_height(0),
_bitDepth(0),
- m_Windowed(0),
- m_LastTimeStamp((uint) -1), // max. BS_INT64 um beim ersten Aufruf von _UpdateLastFrameDuration() einen Reset zu erzwingen
- m_LastFrameDuration(0),
- m_TimerActive(true),
- m_FrameTimeSampleSlot(0),
- m_RepaintedPixels(0),
+ _windowed(0),
+ _lastTimeStamp((uint) -1), // max. BS_INT64 um beim ersten Aufruf von _UpdateLastFrameDuration() einen Reset zu erzwingen
+ _lastFrameDuration(0),
+ _timerActive(true),
+ _frameTimeSampleSlot(0),
+ _repaintedPixels(0),
_thumbnail(NULL),
ResourceService(pKernel) {
- m_FrameTimeSamples.resize(FRAMETIME_SAMPLE_COUNT);
+ _frameTimeSamples.resize(FRAMETIME_SAMPLE_COUNT);
- if (!RegisterScriptBindings())
+ if (!registerScriptBindings())
BS_LOG_ERRORLN("Script bindings could not be registered.");
else
BS_LOGLN("Script bindings registered.");
@@ -94,7 +94,7 @@ Service *GraphicEngine_CreateObject(Kernel *pKernel) {
return new GraphicEngine(pKernel);
}
-bool GraphicEngine::Init(int width, int height, int bitDepth, int backbufferCount, bool isWindowed) {
+bool GraphicEngine::init(int width, int height, int bitDepth, int backbufferCount, bool isWindowed_) {
// Warnung ausgeben, wenn eine nicht unterstützte Bittiefe gewählt wurde.
if (bitDepth != BIT_DEPTH) {
BS_LOG_WARNINGLN("Can't use a bit depth of %d (not supported). Falling back to %d.", bitDepth, BIT_DEPTH);
@@ -111,7 +111,7 @@ bool GraphicEngine::Init(int width, int height, int bitDepth, int backbufferCoun
_width = width;
_height = height;
_bitDepth = bitDepth;
- m_Windowed = isWindowed;
+ _windowed = isWindowed_;
_screenRect.left = 0;
_screenRect.top = 0;
_screenRect.right = _width;
@@ -121,26 +121,24 @@ bool GraphicEngine::Init(int width, int height, int bitDepth, int backbufferCoun
_frameBuffer.create(width, height, 4);
// Standardmäßig ist Vsync an.
- SetVsync(true);
+ setVsync(true);
// Layer-Manager initialisieren.
_renderObjectManagerPtr.reset(new RenderObjectManager(width, height, backbufferCount + 1));
// Hauptpanel erstellen
- m_MainPanelPtr = _renderObjectManagerPtr->getTreeRoot()->addPanel(width, height, BS_ARGB(0, 0, 0, 0));
- if (!m_MainPanelPtr.isValid())
+ _mainPanelPtr = _renderObjectManagerPtr->getTreeRoot()->addPanel(width, height, BS_ARGB(0, 0, 0, 0));
+ if (!_mainPanelPtr.isValid())
return false;
- m_MainPanelPtr->setVisible(true);
+ _mainPanelPtr->setVisible(true);
return true;
}
-// -----------------------------------------------------------------------------
-
-bool GraphicEngine::StartFrame(bool UpdateAll) {
+bool GraphicEngine::startFrame(bool updateAll) {
// Berechnen, wie viel Zeit seit dem letzten Frame vergangen ist.
// Dieser Wert kann über GetLastFrameDuration() von Modulen abgefragt werden, die zeitabhängig arbeiten.
- UpdateLastFrameDuration();
+ updateLastFrameDuration();
// Den Layer-Manager auf den nächsten Frame vorbereiten
_renderObjectManagerPtr->startFrame();
@@ -148,9 +146,7 @@ bool GraphicEngine::StartFrame(bool UpdateAll) {
return true;
}
-// -----------------------------------------------------------------------------
-
-bool GraphicEngine::EndFrame() {
+bool GraphicEngine::endFrame() {
// Scene zeichnen
_renderObjectManagerPtr->render();
@@ -166,7 +162,7 @@ bool GraphicEngine::EndFrame() {
g_system->updateScreen();
// Debug-Lines zeichnen
- if (!m_DebugLines.empty()) {
+ if (!_debugLines.empty()) {
#if 0
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINES);
@@ -188,37 +184,29 @@ bool GraphicEngine::EndFrame() {
warning("STUB: Drawing debug lines");
- m_DebugLines.clear();
+ _debugLines.clear();
}
// Framecounter aktualisieren
- m_FPSCounter.Update();
+ _FPSCounter.update();
return true;
}
-// -----------------------------------------------------------------------------
-
-RenderObjectPtr<Panel> GraphicEngine::GetMainPanel() {
- return m_MainPanelPtr;
+RenderObjectPtr<Panel> GraphicEngine::getMainPanel() {
+ return _mainPanelPtr;
}
-// -----------------------------------------------------------------------------
-
-void GraphicEngine::SetVsync(bool Vsync) {
- warning("STUB: SetVsync(%d)", Vsync);
+void GraphicEngine::setVsync(bool vsync) {
+ warning("STUB: SetVsync(%d)", vsync);
}
-// -----------------------------------------------------------------------------
-
-bool GraphicEngine::GetVsync() const {
- warning("STUB: GetVsync()");
+bool GraphicEngine::getVsync() const {
+ warning("STUB: getVsync()");
return true;
}
-// -----------------------------------------------------------------------------
-
bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
Common::Rect rect(_width - 1, _height - 1);
@@ -268,9 +256,7 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
return true;
}
-// -----------------------------------------------------------------------------
-
-Graphics::Surface *GraphicEngine::GetScreenshot() {
+Graphics::Surface *GraphicEngine::getScreenshot() {
return &_frameBuffer;
}
@@ -283,9 +269,9 @@ Resource *GraphicEngine::loadResource(const Common::String &filename) {
// Load image for "software buffer" (FIXME: Whatever that means?)
if (filename.hasSuffix("_s.png")) {
- bool Result = false;
- SWImage *pImage = new SWImage(filename, Result);
- if (!Result) {
+ bool result = false;
+ SWImage *pImage = new SWImage(filename, result);
+ if (!result) {
delete pImage;
return 0;
}
@@ -301,9 +287,9 @@ Resource *GraphicEngine::loadResource(const Common::String &filename) {
// Load sprite image
if (filename.hasSuffix(".png") || filename.hasSuffix(".b25s")) {
- bool Result = false;
- RenderedImage *pImage = new RenderedImage(filename, Result);
- if (!Result) {
+ bool result = false;
+ RenderedImage *pImage = new RenderedImage(filename, result);
+ if (!result) {
delete pImage;
return 0;
}
@@ -328,17 +314,17 @@ Resource *GraphicEngine::loadResource(const Common::String &filename) {
// Datei laden
byte *pFileData;
- uint FileSize;
- if (!(pFileData = static_cast<byte *>(pPackage->getFile(filename, &FileSize)))) {
+ uint fileSize;
+ if (!(pFileData = static_cast<byte *>(pPackage->getFile(filename, &fileSize)))) {
BS_LOG_ERRORLN("File \"%s\" could not be loaded.", filename.c_str());
return 0;
}
- bool Result = false;
- VectorImage *pImage = new VectorImage(pFileData, FileSize, Result, filename);
- if (!Result) {
+ bool result = false;
+ VectorImage *pImage = new VectorImage(pFileData, fileSize, result, filename);
+ if (!result) {
delete pImage;
- delete [] pFileData;
+ delete[] pFileData;
return 0;
}
@@ -394,35 +380,35 @@ bool GraphicEngine::canLoadResource(const Common::String &filename) {
// DEBUGGING
// -----------------------------------------------------------------------------
-void GraphicEngine::DrawDebugLine(const Vertex &Start, const Vertex &End, uint Color) {
- m_DebugLines.push_back(DebugLine(Start, End, Color));
+void GraphicEngine::drawDebugLine(const Vertex &start, const Vertex &end, uint color) {
+ _debugLines.push_back(DebugLine(start, end, color));
}
-void GraphicEngine::UpdateLastFrameDuration() {
+void GraphicEngine::updateLastFrameDuration() {
// Record current time
const uint currentTime = Kernel::GetInstance()->GetMilliTicks();
// Compute the elapsed time since the last frame and prevent too big ( > 250 msecs) time jumps.
// These can occur when loading save states, during debugging or due to hardware inaccuracies.
- m_FrameTimeSamples[m_FrameTimeSampleSlot] = static_cast<uint>(currentTime - m_LastTimeStamp);
- if (m_FrameTimeSamples[m_FrameTimeSampleSlot] > 250000)
- m_FrameTimeSamples[m_FrameTimeSampleSlot] = 250000;
- m_FrameTimeSampleSlot = (m_FrameTimeSampleSlot + 1) % FRAMETIME_SAMPLE_COUNT;
+ _frameTimeSamples[_frameTimeSampleSlot] = static_cast<uint>(currentTime - _lastTimeStamp);
+ if (_frameTimeSamples[_frameTimeSampleSlot] > 250000)
+ _frameTimeSamples[_frameTimeSampleSlot] = 250000;
+ _frameTimeSampleSlot = (_frameTimeSampleSlot + 1) % FRAMETIME_SAMPLE_COUNT;
// Compute the average frame duration over multiple frames to eliminate outliers.
- Common::Array<uint>::const_iterator it = m_FrameTimeSamples.begin();
+ Common::Array<uint>::const_iterator it = _frameTimeSamples.begin();
uint sum = *it;
- for (it++; it != m_FrameTimeSamples.end(); it++)
+ for (it++; it != _frameTimeSamples.end(); it++)
sum += *it;
- m_LastFrameDuration = sum * 1000 / FRAMETIME_SAMPLE_COUNT;
+ _lastFrameDuration = sum * 1000 / FRAMETIME_SAMPLE_COUNT;
// Update m_LastTimeStamp with the current frame's timestamp
- m_LastTimeStamp = currentTime;
+ _lastTimeStamp = currentTime;
}
namespace {
-bool DoSaveScreenshot(GraphicEngine &graphicEngine, const Common::String &filename) {
- Graphics::Surface *data = graphicEngine.GetScreenshot();
+bool doSaveScreenshot(GraphicEngine &graphicEngine, const Common::String &filename) {
+ Graphics::Surface *data = graphicEngine.getScreenshot();
if (!data) {
BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot.");
return false;
@@ -442,11 +428,11 @@ bool DoSaveScreenshot(GraphicEngine &graphicEngine, const Common::String &filena
}
}
-bool GraphicEngine::SaveScreenshot(const Common::String &filename) {
- return DoSaveScreenshot(*this, filename);
+bool GraphicEngine::saveScreenshot(const Common::String &filename) {
+ return doSaveScreenshot(*this, filename);
}
-bool GraphicEngine::SaveThumbnailScreenshot(const Common::String &filename) {
+bool GraphicEngine::saveThumbnailScreenshot(const Common::String &filename) {
// Note: In ScumMVM, rather than saivng the thumbnail to a file, we store it in memory
// until needed when creating savegame files
delete _thumbnail;
@@ -454,59 +440,64 @@ bool GraphicEngine::SaveThumbnailScreenshot(const Common::String &filename) {
return true;
}
-void GraphicEngine::ARGBColorToLuaColor(lua_State *L, uint Color) {
- lua_Number Components[4] = {
- (Color >> 16) & 0xff, // Rot
- (Color >> 8) & 0xff, // Grün
- Color & 0xff, // Blau
- Color >> 24, // Alpha
+void GraphicEngine::ARGBColorToLuaColor(lua_State *L, uint color) {
+ lua_Number components[4] = {
+ (color >> 16) & 0xff, // Rot
+ (color >> 8) & 0xff, // Grün
+ color & 0xff, // Blau
+ color >> 24, // Alpha
};
lua_newtable(L);
for (uint i = 1; i <= 4; i++) {
lua_pushnumber(L, i);
- lua_pushnumber(L, Components[i - 1]);
+ lua_pushnumber(L, components[i - 1]);
lua_settable(L, -3);
}
}
-uint GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) {
+uint GraphicEngine::luaColorToARGBColor(lua_State *L, int stackIndex) {
#ifdef DEBUG
int __startStackDepth = lua_gettop(L);
#endif
// Sicherstellen, dass wir wirklich eine Tabelle betrachten
- luaL_checktype(L, StackIndex, LUA_TTABLE);
+ luaL_checktype(L, stackIndex, LUA_TTABLE);
// Größe der Tabelle auslesen
- uint n = luaL_getn(L, StackIndex);
+ uint n = luaL_getn(L, stackIndex);
// RGB oder RGBA Farben werden unterstützt und sonst keine
- if (n != 3 && n != 4) luaL_argcheck(L, 0, StackIndex, "at least 3 of the 4 color components have to be specified");
-
- // Rote Farbkomponente auslesen
- lua_rawgeti(L, StackIndex, 1);
- uint Red = static_cast<uint>(lua_tonumber(L, -1));
- if (!lua_isnumber(L, -1) || Red >= 256) luaL_argcheck(L, 0, StackIndex, "red color component must be an integer between 0 and 255");
+ if (n != 3 && n != 4)
+ luaL_argcheck(L, 0, stackIndex, "at least 3 of the 4 color components have to be specified");
+
+ // Red color component reading
+ lua_rawgeti(L, stackIndex, 1);
+ uint red = static_cast<uint>(lua_tonumber(L, -1));
+ if (!lua_isnumber(L, -1) || red >= 256)
+ luaL_argcheck(L, 0, stackIndex, "red color component must be an integer between 0 and 255");
lua_pop(L, 1);
- // Grüne Farbkomponente auslesen
- lua_rawgeti(L, StackIndex, 2);
- uint Green = static_cast<uint>(lua_tonumber(L, -1));
- if (!lua_isnumber(L, -1) || Green >= 256) luaL_argcheck(L, 0, StackIndex, "green color component must be an integer between 0 and 255");
+ // Green color component reading
+ lua_rawgeti(L, stackIndex, 2);
+ uint green = static_cast<uint>(lua_tonumber(L, -1));
+ if (!lua_isnumber(L, -1) || green >= 256)
+ luaL_argcheck(L, 0, stackIndex, "green color component must be an integer between 0 and 255");
lua_pop(L, 1);
- // Blaue Farbkomponente auslesen
- lua_rawgeti(L, StackIndex, 3);
- uint Blue = static_cast<uint>(lua_tonumber(L, -1));
- if (!lua_isnumber(L, -1) || Blue >= 256) luaL_argcheck(L, 0, StackIndex, "blue color component must be an integer between 0 and 255");
+ // Blue color component reading
+ lua_rawgeti(L, stackIndex, 3);
+ uint blue = static_cast<uint>(lua_tonumber(L, -1));
+ if (!lua_isnumber(L, -1) || blue >= 256)
+ luaL_argcheck(L, 0, stackIndex, "blue color component must be an integer between 0 and 255");
lua_pop(L, 1);
- // Alpha Farbkomponente auslesen
- uint Alpha = 0xff;
+ // Alpha color component reading
+ uint alpha = 0xff;
if (n == 4) {
- lua_rawgeti(L, StackIndex, 4);
- Alpha = static_cast<uint>(lua_tonumber(L, -1));
- if (!lua_isnumber(L, -1) || Alpha >= 256) luaL_argcheck(L, 0, StackIndex, "alpha color component must be an integer between 0 and 255");
+ lua_rawgeti(L, stackIndex, 4);
+ alpha = static_cast<uint>(lua_tonumber(L, -1));
+ if (!lua_isnumber(L, -1) || alpha >= 256)
+ luaL_argcheck(L, 0, stackIndex, "alpha color component must be an integer between 0 and 255");
lua_pop(L, 1);
}
@@ -514,11 +505,11 @@ uint GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) {
BS_ASSERT(__startStackDepth == lua_gettop(L));
#endif
- return (Alpha << 24) | (Red << 16) | (Green << 8) | Blue;
+ return (alpha << 24) | (red << 16) | (green << 8) | blue;
}
bool GraphicEngine::persist(OutputPersistenceBlock &writer) {
- writer.write(m_TimerActive);
+ writer.write(_timerActive);
bool result = _renderObjectManagerPtr->persist(writer);
@@ -526,7 +517,7 @@ bool GraphicEngine::persist(OutputPersistenceBlock &writer) {
}
bool GraphicEngine::unpersist(InputPersistenceBlock &reader) {
- reader.read(m_TimerActive);
+ reader.read(_timerActive);
_renderObjectManagerPtr->unpersist(reader);
return reader.isGood();
diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h
index c55a97f3c8..5820a8d420 100644
--- a/engines/sword25/gfx/graphicengine.h
+++ b/engines/sword25/gfx/graphicengine.h
@@ -33,7 +33,7 @@
*/
/*
- * BS_GraphicEngine
+ * GraphicEngine
* ----------------
* This the graphics engine interface.
*
@@ -64,10 +64,8 @@ class Panel;
class Screenshot;
class RenderObjectManager;
-// Types
typedef uint BS_COLOR;
-// Macros
#define BS_RGB(R,G,B) (0xFF000000 | ((R) << 16) | ((G) << 8) | (B))
#define BS_ARGB(A,R,G,B) (((A) << 24) | ((R) << 16) | ((G) << 8) | (B))
@@ -122,7 +120,7 @@ public:
* @param BackbufferCount The number of back buffers to be created. The default value is 2
* @param Windowed Indicates whether the engine is to run in windowed mode.
*/
- bool Init(int Width = 800, int Height = 600, int BitDepth = 16, int BackbufferCount = 2, bool Windowed = false);
+ bool init(int width = 800, int height = 600, int bitDepth = 16, int backbufferCount = 2, bool windowed = false);
/**
* Begins rendering a new frame.
@@ -131,7 +129,7 @@ public:
* @param UpdateAll Specifies whether the renderer should redraw everything on the next frame.
* This feature can be useful if the renderer with Dirty Rectangles works, but sometimes the client may
*/
- bool StartFrame(bool UpdateAll = false);
+ bool startFrame(bool updateAll = false);
/**
* Ends the rendering of a frame and draws it on the screen.
@@ -139,7 +137,7 @@ public:
* This method must be at the end of the main loop. After this call, no further Render method may be called.
* This should only be called once for a given previous call to #StartFrame.
*/
- bool EndFrame();
+ bool endFrame();
// Debug methods
@@ -153,7 +151,7 @@ public:
* @param End The ending point of the line
* @param Color The colour of the line. The default is BS_RGB (255,255,255) (White)
*/
- void DrawDebugLine(const Vertex &Start, const Vertex &End, uint Color = BS_RGB(255, 255, 255));
+ void drawDebugLine(const Vertex &start, const Vertex &end, uint color = BS_RGB(255, 255, 255));
/**
* Creates a screenshot of the current frame buffer and writes it to a graphic file in PNG format.
@@ -161,7 +159,7 @@ public:
* Notes: This method should only be called after a call to EndFrame(), and before the next call to StartFrame().
* @param Filename The filename for the screenshot
*/
- bool SaveScreenshot(const Common::String &Filename);
+ bool saveScreenshot(const Common::String &filename);
/**
* Creates a thumbnail with the dimensions of 200x125. This will not include the top and bottom of the screen..
@@ -170,7 +168,7 @@ public:
* The frame buffer must have a resolution of 800x600.
* @param Filename The filename for the screenshot
*/
- bool SaveThumbnailScreenshot(const Common::String &Filename);
+ bool saveThumbnailScreenshot(const Common::String &filename);
/**
* Reads the current contents of the frame buffer
@@ -180,37 +178,39 @@ public:
* @param Height Returns the height of the frame buffer
* @param Data Returns the raw data of the frame buffer as an array of 32-bit colour values.
*/
- Graphics::Surface *GetScreenshot();
+ Graphics::Surface *getScreenshot();
- RenderObjectPtr<Panel> GetMainPanel();
+ RenderObjectPtr<Panel> getMainPanel();
/**
* Specifies the time (in microseconds) since the last frame has passed
*/
- int GetLastFrameDurationMicro() const {
- if (!m_TimerActive)
+ int getLastFrameDurationMicro() const {
+ if (!_timerActive)
return 0;
- return m_LastFrameDuration;
+ return _lastFrameDuration;
}
/**
* Specifies the time (in microseconds) the previous frame took
*/
- float GetLastFrameDuration() const {
- if (!m_TimerActive)
+ float getLastFrameDuration() const {
+ if (!_timerActive)
return 0;
- return static_cast<float>(m_LastFrameDuration) / 1000000.0f;
+ return static_cast<float>(_lastFrameDuration) / 1000000.0f;
}
- void StopMainTimer() {
- m_TimerActive = false;
+ void stopMainTimer() {
+ _timerActive = false;
}
- void ResumeMainTimer() {
- m_TimerActive = true;
+
+ void resumeMainTimer() {
+ _timerActive = true;
}
- float GetSecondaryFrameDuration() const {
- return static_cast<float>(m_LastFrameDuration) / 1000000.0f;
+
+ float getSecondaryFrameDuration() const {
+ return static_cast<float>(_lastFrameDuration) / 1000000.0f;
}
// Accessor methods
@@ -218,28 +218,28 @@ public:
/**
* Returns the width of the output buffer in pixels
*/
- int GetDisplayWidth() const {
+ int getDisplayWidth() const {
return _width;
}
/**
* Returns the height of the output buffer in pixels
*/
- int GetDisplayHeight() const {
+ int getDisplayHeight() const {
return _height;
}
/**
* Returns the bounding box of the output buffer: (0, 0, Width, Height)
*/
- Common::Rect &GetDisplayRect() {
+ Common::Rect &getDisplayRect() {
return _screenRect;
}
/**
* Returns the bit depth of the output buffer
*/
- int GetBitDepth() {
+ int getBitDepth() {
return _bitDepth;
}
@@ -248,19 +248,19 @@ public:
* Notes: In windowed mode, this setting has no effect.
* @param Vsync Indicates whether the frame buffer changes are to be synchronised with Vsync.
*/
- void SetVsync(bool Vsync);
+ void setVsync(bool vsync);
/**
* Returns true if V-Sync is on.
* Notes: In windowed mode, this setting has no effect.
*/
- bool GetVsync() const;
+ bool getVsync() const;
/**
* Returns true if the engine is running in Windowed mode.
*/
- bool IsWindowed() {
- return m_Windowed;
+ bool isWindowed() {
+ return _windowed;
}
/**
@@ -272,15 +272,15 @@ public:
* @param Color The 32-bit colour with which the area is to be filled. The default is BS_RGB(0, 0, 0) (black)
* @note FIf the rectangle is not completely inside the screen, it is automatically clipped.
*/
- bool fill(const Common::Rect *FillRectPtr = 0, uint Color = BS_RGB(0, 0, 0));
+ bool fill(const Common::Rect *fillRectPtr = 0, uint color = BS_RGB(0, 0, 0));
// Debugging Methods
- int GetFPSCount() const {
- return m_FPSCounter.GetFPS();
+ int getFPSCount() const {
+ return _FPSCounter.getFPS();
}
- int GetRepaintedPixels() const {
- return m_RepaintedPixels;
+ int getRepaintedPixels() const {
+ return _repaintedPixels;
}
Graphics::Surface _backSurface;
@@ -299,8 +299,8 @@ public:
* @param ColorFormat The desired colour format. The parameter must be of type COLOR_FORMATS
* @return Returns the size of a pixel in bytes. If the colour format is unknown, -1 is returned.
*/
- static int GetPixelSize(GraphicEngine::COLOR_FORMATS ColorFormat) {
- switch (ColorFormat) {
+ static int getPixelSize(GraphicEngine::COLOR_FORMATS colorFormat) {
+ switch (colorFormat) {
case GraphicEngine::CF_ARGB32:
return 4;
default:
@@ -315,10 +315,10 @@ public:
* @return Reflects the length of the line in bytes. If the colour format is
* unknown, -1 is returned
*/
- static int CalcPitch(GraphicEngine::COLOR_FORMATS ColorFormat, int Width) {
- switch (ColorFormat) {
+ static int calcPitch(GraphicEngine::COLOR_FORMATS colorFormat, int width) {
+ switch (colorFormat) {
case GraphicEngine::CF_ARGB32:
- return Width * 4;
+ return width * 4;
default:
BS_ASSERT(false);
@@ -329,69 +329,69 @@ public:
// Resource-Managing Methods
// --------------------------
- virtual Resource *loadResource(const Common::String &fileName);
- virtual bool canLoadResource(const Common::String &fileName);
+ virtual Resource *loadResource(const Common::String &fileName);
+ virtual bool canLoadResource(const Common::String &fileName);
// Persistence Methods
// -------------------
- virtual bool persist(OutputPersistenceBlock &Writer);
- virtual bool unpersist(InputPersistenceBlock &Reader);
+ virtual bool persist(OutputPersistenceBlock &writer);
+ virtual bool unpersist(InputPersistenceBlock &reader);
- static void ARGBColorToLuaColor(lua_State *L, uint Color);
- static uint LuaColorToARGBColor(lua_State *L, int StackIndex);
+ static void ARGBColorToLuaColor(lua_State *L, uint color);
+ static uint luaColorToARGBColor(lua_State *L, int stackIndex);
protected:
// Display Variables
// -----------------
- int _width;
- int _height;
+ int _width;
+ int _height;
Common::Rect _screenRect;
- int _bitDepth;
- bool m_Windowed;
+ int _bitDepth;
+ bool _windowed;
// Debugging Variables
// -------------------
- Framecounter m_FPSCounter;
+ Framecounter _FPSCounter;
- uint m_RepaintedPixels;
+ uint _repaintedPixels;
/**
* Calculates the time since the last frame beginning has passed.
*/
- void UpdateLastFrameDuration();
+ void updateLastFrameDuration();
private:
- bool RegisterScriptBindings();
+ bool registerScriptBindings();
// LastFrameDuration Variables
// ---------------------------
- uint m_LastTimeStamp;
- uint m_LastFrameDuration;
- bool m_TimerActive;
- Common::Array<uint> m_FrameTimeSamples;
- uint m_FrameTimeSampleSlot;
+ uint _lastTimeStamp;
+ uint _lastFrameDuration;
+ bool _timerActive;
+ Common::Array<uint> _frameTimeSamples;
+ uint _frameTimeSampleSlot;
private:
byte *_backBuffer;
- RenderObjectPtr<Panel> m_MainPanelPtr;
+ RenderObjectPtr<Panel> _mainPanelPtr;
- Common::ScopedPtr<RenderObjectManager> _renderObjectManagerPtr;
+ Common::ScopedPtr<RenderObjectManager> _renderObjectManagerPtr;
struct DebugLine {
- DebugLine(const Vertex &_Start, const Vertex &_End, uint _Color) :
- Start(_Start),
- End(_End),
- Color(_Color) {}
+ DebugLine(const Vertex &start, const Vertex &end, uint color) :
+ _start(start),
+ _end(end),
+ _color(color) {}
DebugLine() {}
- Vertex Start;
- Vertex End;
- uint Color;
+ Vertex _start;
+ Vertex _end;
+ uint _color;
};
- Common::Array<DebugLine> m_DebugLines;
+ Common::Array<DebugLine> _debugLines;
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp
index 405bebdf89..e197a40337 100644
--- a/engines/sword25/gfx/graphicengine_script.cpp
+++ b/engines/sword25/gfx/graphicengine_script.cpp
@@ -32,10 +32,6 @@
*
*/
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/common.h"
#include "sword25/kernel/kernel.h"
#include "sword25/kernel/callbackregistry.h"
@@ -57,17 +53,11 @@ namespace Sword25 {
#define BS_LOG_PREFIX "GRAPHICENGINE"
-// -----------------------------------------------------------------------------
-// Callback-Objekte
-// -----------------------------------------------------------------------------
-
-static bool AnimationDeleteCallback(uint Data);
-static bool AnimationActionCallback(uint Data);
-static bool AnimationLoopPointCallback(uint Data);
+static bool animationDeleteCallback(uint Data);
+static bool animationActionCallback(uint Data);
+static bool animationLoopPointCallback(uint Data);
namespace {
-// -------------------------------------------------------------------------
-
class ActionCallback : public LuaCallback {
public:
ActionCallback(lua_State *L) : LuaCallback(L) {}
@@ -81,25 +71,19 @@ protected:
}
};
-Common::ScopedPtr<LuaCallback> LoopPointCallbackPtr;
-Common::ScopedPtr<ActionCallback> ActionCallbackPtr;
-
-// -------------------------------------------------------------------------
+Common::ScopedPtr<LuaCallback> loopPointCallbackPtr;
+Common::ScopedPtr<ActionCallback> actionCallbackPtr;
struct CallbackfunctionRegisterer {
CallbackfunctionRegisterer() {
- CallbackRegistry::instance().registerCallbackFunction("LuaLoopPointCB", (void ( *)(int))AnimationLoopPointCallback);
- CallbackRegistry::instance().registerCallbackFunction("LuaActionCB", (void ( *)(int))AnimationActionCallback);
- CallbackRegistry::instance().registerCallbackFunction("LuaDeleteCB", (void ( *)(int))AnimationDeleteCallback);
+ CallbackRegistry::instance().registerCallbackFunction("LuaLoopPointCB", (void ( *)(int))animationLoopPointCallback);
+ CallbackRegistry::instance().registerCallbackFunction("LuaActionCB", (void ( *)(int))animationActionCallback);
+ CallbackRegistry::instance().registerCallbackFunction("LuaDeleteCB", (void ( *)(int))animationDeleteCallback);
}
};
static CallbackfunctionRegisterer Instance;
}
-// -----------------------------------------------------------------------------
-// Constants
-// -----------------------------------------------------------------------------
-
// Die Strings werden als #defines definiert um Stringkomposition zur Compilezeit zu ermöglichen.
#define RENDEROBJECT_CLASS_NAME "Gfx.RenderObject"
#define BITMAP_CLASS_NAME "Gfx.Bitmap"
@@ -109,8 +93,6 @@ static CallbackfunctionRegisterer Instance;
#define ANIMATION_TEMPLATE_CLASS_NAME "Gfx.AnimationTemplate"
static const char *GFX_LIBRARY_NAME = "Gfx";
-// -----------------------------------------------------------------------------
-
// Wie luaL_checkudata, nur ohne dass kein Fehler erzeugt wird.
static void *my_checkudata(lua_State *L, int ud, const char *tname) {
int top = lua_gettop(L);
@@ -131,23 +113,19 @@ static void *my_checkudata(lua_State *L, int ud, const char *tname) {
return NULL;
}
-// -----------------------------------------------------------------------------
-
-static void NewUintUserData(lua_State *L, uint Value) {
- void *UserData = lua_newuserdata(L, sizeof(Value));
- memcpy(UserData, &Value, sizeof(Value));
+static void newUintUserData(lua_State *L, uint value) {
+ void *userData = lua_newuserdata(L, sizeof(value));
+ memcpy(userData, &value, sizeof(value));
}
-// -----------------------------------------------------------------------------
-
-static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) {
+static AnimationTemplate *checkAnimationTemplate(lua_State *L, int idx = 1) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.AnimationTemplate
- uint AnimationTemplateHandle;
- if ((AnimationTemplateHandle = *reinterpret_cast<uint *>(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) {
- AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::instance().resolveHandle(AnimationTemplateHandle);
- if (!AnimationTemplatePtr)
- luaL_error(L, "The animation template with the handle %d does no longer exist.", AnimationTemplateHandle);
- return AnimationTemplatePtr;
+ uint animationTemplateHandle;
+ if ((animationTemplateHandle = *reinterpret_cast<uint *>(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) {
+ AnimationTemplate *animationTemplatePtr = AnimationTemplateRegistry::instance().resolveHandle(animationTemplateHandle);
+ if (!animationTemplatePtr)
+ luaL_error(L, "The animation template with the handle %d does no longer exist.", animationTemplateHandle);
+ return animationTemplatePtr;
} else {
luaL_argcheck(L, 0, idx, "'" ANIMATION_TEMPLATE_CLASS_NAME "' expected");
return 0;
@@ -155,13 +133,11 @@ static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) {
}
-// -----------------------------------------------------------------------------
-
-static int NewAnimationTemplate(lua_State *L) {
- uint AnimationTemplateHandle = AnimationTemplate::create(luaL_checkstring(L, 1));
- AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::instance().resolveHandle(AnimationTemplateHandle);
- if (AnimationTemplatePtr && AnimationTemplatePtr->isValid()) {
- NewUintUserData(L, AnimationTemplateHandle);
+static int newAnimationTemplate(lua_State *L) {
+ uint animationTemplateHandle = AnimationTemplate::create(luaL_checkstring(L, 1));
+ AnimationTemplate *animationTemplatePtr = AnimationTemplateRegistry::instance().resolveHandle(animationTemplateHandle);
+ if (animationTemplatePtr && animationTemplatePtr->isValid()) {
+ newUintUserData(L, animationTemplateHandle);
//luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME);
LuaBindhelper::getMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME);
BS_ASSERT(!lua_isnil(L, -1));
@@ -173,45 +149,37 @@ static int NewAnimationTemplate(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int AT_AddFrame(lua_State *L) {
- AnimationTemplate *pAT = CheckAnimationTemplate(L);
+static int at_addFrame(lua_State *L) {
+ AnimationTemplate *pAT = checkAnimationTemplate(L);
pAT->addFrame(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int AT_SetFrame(lua_State *L) {
- AnimationTemplate *pAT = CheckAnimationTemplate(L);
+static int at_setFrame(lua_State *L) {
+ AnimationTemplate *pAT = checkAnimationTemplate(L);
pAT->setFrame(static_cast<int>(luaL_checknumber(L, 2)), static_cast<int>(luaL_checknumber(L, 3)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static bool AnimationTypeStringToNumber(const char *TypeString, Animation::ANIMATION_TYPES &Result) {
- if (strcmp(TypeString, "jojo") == 0) {
- Result = Animation::AT_JOJO;
+static bool animationTypeStringToNumber(const char *typeString, Animation::ANIMATION_TYPES &result) {
+ if (strcmp(typeString, "jojo") == 0) {
+ result = Animation::AT_JOJO;
return true;
- } else if (strcmp(TypeString, "loop") == 0) {
- Result = Animation::AT_LOOP;
+ } else if (strcmp(typeString, "loop") == 0) {
+ result = Animation::AT_LOOP;
return true;
- } else if (strcmp(TypeString, "oneshot") == 0) {
- Result = Animation::AT_ONESHOT;
+ } else if (strcmp(typeString, "oneshot") == 0) {
+ result = Animation::AT_ONESHOT;
return true;
} else
return false;
}
-// -----------------------------------------------------------------------------
-
-static int AT_SetAnimationType(lua_State *L) {
- AnimationTemplate *pAT = CheckAnimationTemplate(L);
- Animation::ANIMATION_TYPES AnimationType;
- if (AnimationTypeStringToNumber(luaL_checkstring(L, 2), AnimationType)) {
- pAT->setAnimationType(AnimationType);
+static int at_setAnimationType(lua_State *L) {
+ AnimationTemplate *pAT = checkAnimationTemplate(L);
+ Animation::ANIMATION_TYPES animationType;
+ if (animationTypeStringToNumber(luaL_checkstring(L, 2), animationType)) {
+ pAT->setAnimationType(animationType);
} else {
luaL_argcheck(L, 0, 2, "Invalid animation type");
}
@@ -219,36 +187,28 @@ static int AT_SetAnimationType(lua_State *L) {
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int AT_SetFPS(lua_State *L) {
- AnimationTemplate *pAT = CheckAnimationTemplate(L);
+static int at_setFPS(lua_State *L) {
+ AnimationTemplate *pAT = checkAnimationTemplate(L);
pAT->setFPS(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int AT_Finalize(lua_State *L) {
- AnimationTemplate *pAT = CheckAnimationTemplate(L);
+static int at_finalize(lua_State *L) {
+ AnimationTemplate *pAT = checkAnimationTemplate(L);
delete pAT;
return 0;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg ANIMATION_TEMPLATE_METHODS[] = {
- {"AddFrame", AT_AddFrame},
- {"SetFrame", AT_SetFrame},
- {"SetAnimationType", AT_SetAnimationType},
- {"SetFPS", AT_SetFPS},
- {"__gc", AT_Finalize},
+ {"AddFrame", at_addFrame},
+ {"SetFrame", at_setFrame},
+ {"SetAnimationType", at_setAnimationType},
+ {"SetFPS", at_setFPS},
+ {"__gc", at_finalize},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static GraphicEngine *GetGE() {
+static GraphicEngine *getGE() {
Kernel *pKernel = Kernel::GetInstance();
BS_ASSERT(pKernel);
GraphicEngine *pGE = pKernel->GetGfx();
@@ -256,31 +216,29 @@ static GraphicEngine *GetGE() {
return pGE;
}
-// -----------------------------------------------------------------------------
-
-static int Init(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int init(lua_State *L) {
+ GraphicEngine *pGE = getGE();
switch (lua_gettop(L)) {
case 0:
- lua_pushbooleancpp(L, pGE->Init());
+ lua_pushbooleancpp(L, pGE->init());
break;
case 1:
- lua_pushbooleancpp(L, pGE->Init(static_cast<int>(luaL_checknumber(L, 1))));
+ lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1))));
break;
case 2:
- lua_pushbooleancpp(L, pGE->Init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2))));
+ lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2))));
break;
case 3:
- lua_pushbooleancpp(L, pGE->Init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
+ lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
static_cast<int>(luaL_checknumber(L, 3))));
break;
case 4:
- lua_pushbooleancpp(L, pGE->Init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
+ lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
static_cast<int>(luaL_checknumber(L, 3)), static_cast<int>(luaL_checknumber(L, 4))));
break;
default:
- lua_pushbooleancpp(L, pGE->Init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
+ lua_pushbooleancpp(L, pGE->init(static_cast<int>(luaL_checknumber(L, 1)), static_cast<int>(luaL_checknumber(L, 2)),
static_cast<int>(luaL_checknumber(L, 3)), static_cast<int>(luaL_checknumber(L, 4)),
lua_tobooleancpp(L, 5)));
}
@@ -291,14 +249,14 @@ static int Init(lua_State *L) {
#endif
// Main-Panel zum Gfx-Modul hinzufügen
- RenderObjectPtr<Panel> MainPanelPtr(GetGE()->GetMainPanel());
- BS_ASSERT(MainPanelPtr.isValid());
+ RenderObjectPtr<Panel> mainPanelPtr(getGE()->getMainPanel());
+ BS_ASSERT(mainPanelPtr.isValid());
lua_pushstring(L, GFX_LIBRARY_NAME);
lua_gettable(L, LUA_GLOBALSINDEX);
BS_ASSERT(!lua_isnil(L, -1));
- NewUintUserData(L, MainPanelPtr->getHandle());
+ newUintUserData(L, mainPanelPtr->getHandle());
BS_ASSERT(!lua_isnil(L, -1));
// luaL_getmetatable(L, PANEL_CLASS_NAME);
LuaBindhelper::getMetatable(L, PANEL_CLASS_NAME);
@@ -318,213 +276,175 @@ static int Init(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int StartFrame(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int startFrame(lua_State *L) {
+ GraphicEngine *pGE = getGE();
if (lua_gettop(L) == 0)
- lua_pushbooleancpp(L, pGE->StartFrame());
+ lua_pushbooleancpp(L, pGE->startFrame());
else
- lua_pushbooleancpp(L, pGE->StartFrame(lua_tobooleancpp(L, 1)));
+ lua_pushbooleancpp(L, pGE->startFrame(lua_tobooleancpp(L, 1)));
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int EndFrame(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int endFrame(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushbooleancpp(L, pGE->EndFrame());
+ lua_pushbooleancpp(L, pGE->endFrame());
return 1;
}
-// -----------------------------------------------------------------------------
+static int drawDebugLine(lua_State *L) {
+ GraphicEngine *pGE = getGE();
-static int DrawDebugLine(lua_State *L) {
- GraphicEngine *pGE = GetGE();
-
- Vertex Start;
- Vertex End;
- Vertex::luaVertexToVertex(L, 1, Start);
- Vertex::luaVertexToVertex(L, 2, End);
- pGE->DrawDebugLine(Start, End, GraphicEngine::LuaColorToARGBColor(L, 3));
+ Vertex start;
+ Vertex end;
+ Vertex::luaVertexToVertex(L, 1, start);
+ Vertex::luaVertexToVertex(L, 2, end);
+ pGE->drawDebugLine(start, end, GraphicEngine::luaColorToARGBColor(L, 3));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int GetDisplayWidth(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int getDisplayWidth(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushnumber(L, pGE->GetDisplayWidth());
+ lua_pushnumber(L, pGE->getDisplayWidth());
return 1;
}
-// -----------------------------------------------------------------------------
+static int getDisplayHeight(lua_State *L) {
+ GraphicEngine *pGE = getGE();
-static int GetDisplayHeight(lua_State *L) {
- GraphicEngine *pGE = GetGE();
-
- lua_pushnumber(L, pGE->GetDisplayHeight());
+ lua_pushnumber(L, pGE->getDisplayHeight());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int GetBitDepth(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int getBitDepth(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushnumber(L, pGE->GetBitDepth());
+ lua_pushnumber(L, pGE->getBitDepth());
return 1;
}
-// -----------------------------------------------------------------------------
+static int setVsync(lua_State *L) {
+ GraphicEngine *pGE = getGE();
-static int SetVsync(lua_State *L) {
- GraphicEngine *pGE = GetGE();
-
- pGE->SetVsync(lua_tobooleancpp(L, 1));
+ pGE->setVsync(lua_tobooleancpp(L, 1));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int IsVsync(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int isVsync(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushbooleancpp(L, pGE->GetVsync());
+ lua_pushbooleancpp(L, pGE->getVsync());
return 1;
}
-// -----------------------------------------------------------------------------
+static int isWindowed(lua_State *L) {
+ GraphicEngine *pGE = getGE();
-static int IsWindowed(lua_State *L) {
- GraphicEngine *pGE = GetGE();
-
- lua_pushbooleancpp(L, pGE->IsWindowed());
+ lua_pushbooleancpp(L, pGE->isWindowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int GetFPSCount(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int getFPSCount(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushnumber(L, pGE->GetFPSCount());
+ lua_pushnumber(L, pGE->getFPSCount());
return 1;
}
-// -----------------------------------------------------------------------------
+static int getLastFrameDuration(lua_State *L) {
+ GraphicEngine *pGE = getGE();
-static int GetLastFrameDuration(lua_State *L) {
- GraphicEngine *pGE = GetGE();
-
- lua_pushnumber(L, pGE->GetLastFrameDuration());
+ lua_pushnumber(L, pGE->getLastFrameDuration());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int StopMainTimer(lua_State *L) {
- GraphicEngine *pGE = GetGE();
- pGE->StopMainTimer();
+static int stopMainTimer(lua_State *L) {
+ GraphicEngine *pGE = getGE();
+ pGE->stopMainTimer();
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int ResumeMainTimer(lua_State *L) {
- GraphicEngine *pGE = GetGE();
- pGE->ResumeMainTimer();
+static int resumeMainTimer(lua_State *L) {
+ GraphicEngine *pGE = getGE();
+ pGE->resumeMainTimer();
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int GetSecondaryFrameDuration(lua_State *L) {
- GraphicEngine *pGE = GetGE();
+static int getSecondaryFrameDuration(lua_State *L) {
+ GraphicEngine *pGE = getGE();
- lua_pushnumber(L, pGE->GetSecondaryFrameDuration());
+ lua_pushnumber(L, pGE->getSecondaryFrameDuration());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int SaveScreenshot(lua_State *L) {
- GraphicEngine *pGE = GetGE();
- lua_pushbooleancpp(L, pGE->SaveScreenshot(luaL_checkstring(L, 1)));
+static int saveScreenshot(lua_State *L) {
+ GraphicEngine *pGE = getGE();
+ lua_pushbooleancpp(L, pGE->saveScreenshot(luaL_checkstring(L, 1)));
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int SaveThumbnailScreenshot(lua_State *L) {
- GraphicEngine *pGE = GetGE();
- lua_pushbooleancpp(L, pGE->SaveThumbnailScreenshot(luaL_checkstring(L, 1)));
+static int saveThumbnailScreenshot(lua_State *L) {
+ GraphicEngine *pGE = getGE();
+ lua_pushbooleancpp(L, pGE->saveThumbnailScreenshot(luaL_checkstring(L, 1)));
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int GetRepaintedPixels(lua_State *L) {
- GraphicEngine *pGE = GetGE();
- lua_pushnumber(L, static_cast<lua_Number>(pGE->GetRepaintedPixels()));
+static int getRepaintedPixels(lua_State *L) {
+ GraphicEngine *pGE = getGE();
+ lua_pushnumber(L, static_cast<lua_Number>(pGE->getRepaintedPixels()));
return 1;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg GFX_FUNCTIONS[] = {
- {"Init", Init},
- {"StartFrame", StartFrame},
- {"EndFrame", EndFrame},
- {"DrawDebugLine", DrawDebugLine},
- {"SetVsync", SetVsync},
- {"GetDisplayWidth", GetDisplayWidth},
- {"GetDisplayHeight", GetDisplayHeight},
- {"GetBitDepth", GetBitDepth},
- {"IsVsync", IsVsync},
- {"IsWindowed", IsWindowed},
- {"GetFPSCount", GetFPSCount},
- {"GetLastFrameDuration", GetLastFrameDuration},
- {"StopMainTimer", StopMainTimer},
- {"ResumeMainTimer", ResumeMainTimer},
- {"GetSecondaryFrameDuration", GetSecondaryFrameDuration},
- {"SaveScreenshot", SaveScreenshot},
- {"NewAnimationTemplate", NewAnimationTemplate},
- {"GetRepaintedPixels", GetRepaintedPixels},
- {"SaveThumbnailScreenshot", SaveThumbnailScreenshot},
+ {"Init", init},
+ {"StartFrame", startFrame},
+ {"EndFrame", endFrame},
+ {"DrawDebugLine", drawDebugLine},
+ {"SetVsync", setVsync},
+ {"GetDisplayWidth", getDisplayWidth},
+ {"GetDisplayHeight", getDisplayHeight},
+ {"GetBitDepth", getBitDepth},
+ {"IsVsync", isVsync},
+ {"IsWindowed", isWindowed},
+ {"GetFPSCount", getFPSCount},
+ {"GetLastFrameDuration", getLastFrameDuration},
+ {"StopMainTimer", stopMainTimer},
+ {"ResumeMainTimer", resumeMainTimer},
+ {"GetSecondaryFrameDuration", getSecondaryFrameDuration},
+ {"SaveScreenshot", saveScreenshot},
+ {"NewAnimationTemplate", newAnimationTemplate},
+ {"GetRepaintedPixels", getRepaintedPixels},
+ {"SaveThumbnailScreenshot", saveThumbnailScreenshot},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static RenderObjectPtr<RenderObject> CheckRenderObject(lua_State *L, bool ErrorIfRemoved = true) {
+static RenderObjectPtr<RenderObject> checkRenderObject(lua_State *L, bool errorIfRemoved = true) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable einer Klasse haben, die von Gfx.RenderObject "erbt".
- uint *UserDataPtr;
- if ((UserDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 ||
- (UserDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 ||
- (UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 ||
- (UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
- RenderObjectPtr<RenderObject> ROPtr(* UserDataPtr);
- if (ROPtr.isValid())
- return ROPtr;
+ uint *userDataPtr;
+ if ((userDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 ||
+ (userDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 ||
+ (userDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 ||
+ (userDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
+ RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
+ if (roPtr.isValid())
+ return roPtr;
else {
- if (ErrorIfRemoved)
- luaL_error(L, "The renderobject with the handle %d does no longer exist.", * UserDataPtr);
+ if (errorIfRemoved)
+ luaL_error(L, "The renderobject with the handle %d does no longer exist.", *userDataPtr);
}
} else {
luaL_argcheck(L, 0, 1, "'" RENDEROBJECT_CLASS_NAME "' expected");
@@ -533,143 +453,115 @@ static RenderObjectPtr<RenderObject> CheckRenderObject(lua_State *L, bool ErrorI
return RenderObjectPtr<RenderObject>();
}
-// -----------------------------------------------------------------------------
-
-static int RO_SetPos(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- Vertex Pos;
- Vertex::luaVertexToVertex(L, 2, Pos);
- ROPtr->setPos(Pos.x, Pos.y);
+static int ro_setPos(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ Vertex pos;
+ Vertex::luaVertexToVertex(L, 2, pos);
+ roPtr->setPos(pos.x, pos.y);
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int RO_SetX(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr->setX(static_cast<int>(luaL_checknumber(L, 2)));
+static int ro_setX(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr->setX(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int RO_SetY(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr->setY(static_cast<int>(luaL_checknumber(L, 2)));
+static int ro_setY(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr->setY(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int RO_SetZ(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr->setZ(static_cast<int>(luaL_checknumber(L, 2)));
+static int ro_setZ(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr->setZ(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int RO_SetVisible(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr->setVisible(lua_tobooleancpp(L, 2));
+static int ro_setVisible(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr->setVisible(lua_tobooleancpp(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetX(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getX());
+static int ro_getX(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getX());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetY(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getY());
+static int ro_getY(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getY());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetZ(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getZ());
+static int ro_getZ(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getZ());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetAbsoluteX(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getAbsoluteX());
+static int ro_getAbsoluteX(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getAbsoluteX());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetAbsoluteY(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getAbsoluteY());
+static int ro_getAbsoluteY(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getAbsoluteY());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetWidth(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getWidth());
+static int ro_getWidth(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getWidth());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_GetHeight(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushnumber(L, ROPtr->getHeight());
+static int ro_getHeight(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushnumber(L, roPtr->getHeight());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_IsVisible(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- lua_pushbooleancpp(L, ROPtr->isVisible());
+static int ro_isVisible(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ lua_pushbooleancpp(L, roPtr->isVisible());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_AddPanel(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- RenderObjectPtr<Panel> PanelPtr = ROPtr->addPanel(static_cast<int>(luaL_checknumber(L, 2)),
+static int ro_addPanel(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ RenderObjectPtr<Panel> panelPtr = roPtr->addPanel(static_cast<int>(luaL_checknumber(L, 2)),
static_cast<int>(luaL_checknumber(L, 3)),
- GraphicEngine::LuaColorToARGBColor(L, 4));
- if (PanelPtr.isValid()) {
- NewUintUserData(L, PanelPtr->getHandle());
+ GraphicEngine::luaColorToARGBColor(L, 4));
+ if (panelPtr.isValid()) {
+ newUintUserData(L, panelPtr->getHandle());
// luaL_getmetatable(L, PANEL_CLASS_NAME);
LuaBindhelper::getMetatable(L, PANEL_CLASS_NAME);
BS_ASSERT(!lua_isnil(L, -1));
@@ -680,14 +572,12 @@ static int RO_AddPanel(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int RO_AddBitmap(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- RenderObjectPtr<Bitmap> BitmaPtr = ROPtr->addBitmap(luaL_checkstring(L, 2));
- if (BitmaPtr.isValid()) {
- NewUintUserData(L, BitmaPtr->getHandle());
+static int ro_addBitmap(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ RenderObjectPtr<Bitmap> bitmaPtr = roPtr->addBitmap(luaL_checkstring(L, 2));
+ if (bitmaPtr.isValid()) {
+ newUintUserData(L, bitmaPtr->getHandle());
// luaL_getmetatable(L, BITMAP_CLASS_NAME);
LuaBindhelper::getMetatable(L, BITMAP_CLASS_NAME);
BS_ASSERT(!lua_isnil(L, -1));
@@ -698,18 +588,18 @@ static int RO_AddBitmap(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
+static int ro_addText(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
-static int RO_AddText(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
-
- RenderObjectPtr<Text> TextPtr;
- if (lua_gettop(L) >= 3) TextPtr = ROPtr->addText(luaL_checkstring(L, 2), luaL_checkstring(L, 3));
- else TextPtr = ROPtr->addText(luaL_checkstring(L, 2));
+ RenderObjectPtr<Text> textPtr;
+ if (lua_gettop(L) >= 3)
+ textPtr = roPtr->addText(luaL_checkstring(L, 2), luaL_checkstring(L, 3));
+ else
+ textPtr = roPtr->addText(luaL_checkstring(L, 2));
- if (TextPtr.isValid()) {
- NewUintUserData(L, TextPtr->getHandle());
+ if (textPtr.isValid()) {
+ newUintUserData(L, textPtr->getHandle());
// luaL_getmetatable(L, TEXT_CLASS_NAME);
LuaBindhelper::getMetatable(L, TEXT_CLASS_NAME);
BS_ASSERT(!lua_isnil(L, -1));
@@ -720,69 +610,63 @@ static int RO_AddText(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
+static int ro_addAnimation(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
-static int RO_AddAnimation(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
-
- RenderObjectPtr<Animation> AnimationPtr;
+ RenderObjectPtr<Animation> animationPtr;
if (lua_type(L, 2) == LUA_TUSERDATA)
- AnimationPtr = ROPtr->addAnimation(*CheckAnimationTemplate(L, 2));
+ animationPtr = roPtr->addAnimation(*checkAnimationTemplate(L, 2));
else
- AnimationPtr = ROPtr->addAnimation(luaL_checkstring(L, 2));
+ animationPtr = roPtr->addAnimation(luaL_checkstring(L, 2));
- if (AnimationPtr.isValid()) {
- NewUintUserData(L, AnimationPtr->getHandle());
+ if (animationPtr.isValid()) {
+ newUintUserData(L, animationPtr->getHandle());
// luaL_getmetatable(L, ANIMATION_CLASS_NAME);
LuaBindhelper::getMetatable(L, ANIMATION_CLASS_NAME);
BS_ASSERT(!lua_isnil(L, -1));
lua_setmetatable(L, -2);
// Alle Animationscallbacks registrieren.
- AnimationPtr->registerDeleteCallback(AnimationDeleteCallback, AnimationPtr->getHandle());
- AnimationPtr->registerLoopPointCallback(AnimationLoopPointCallback, AnimationPtr->getHandle());
- AnimationPtr->registerActionCallback(AnimationActionCallback, AnimationPtr->getHandle());
+ animationPtr->registerDeleteCallback(animationDeleteCallback, animationPtr->getHandle());
+ animationPtr->registerLoopPointCallback(animationLoopPointCallback, animationPtr->getHandle());
+ animationPtr->registerActionCallback(animationActionCallback, animationPtr->getHandle());
} else
lua_pushnil(L);
return 1;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg RENDEROBJECT_METHODS[] = {
- {"AddAnimation", RO_AddAnimation},
- {"AddText", RO_AddText},
- {"AddBitmap", RO_AddBitmap},
- {"AddPanel", RO_AddPanel},
- {"SetPos", RO_SetPos},
- {"SetX", RO_SetX},
- {"SetY", RO_SetY},
- {"SetZ", RO_SetZ},
- {"SetVisible", RO_SetVisible},
- {"GetX", RO_GetX},
- {"GetY", RO_GetY},
- {"GetZ", RO_GetZ},
- {"GetAbsoluteX", RO_GetAbsoluteX},
- {"GetAbsoluteY", RO_GetAbsoluteY},
- {"GetWidth", RO_GetWidth},
- {"GetHeight", RO_GetHeight},
- {"IsVisible", RO_IsVisible},
+ {"AddAnimation", ro_addAnimation},
+ {"AddText", ro_addText},
+ {"AddBitmap", ro_addBitmap},
+ {"AddPanel", ro_addPanel},
+ {"SetPos", ro_setPos},
+ {"SetX", ro_setX},
+ {"SetY", ro_setY},
+ {"SetZ", ro_setZ},
+ {"SetVisible", ro_setVisible},
+ {"GetX", ro_getX},
+ {"GetY", ro_getY},
+ {"GetZ", ro_getZ},
+ {"GetAbsoluteX", ro_getAbsoluteX},
+ {"GetAbsoluteY", ro_getAbsoluteY},
+ {"GetWidth", ro_getWidth},
+ {"GetHeight", ro_getHeight},
+ {"IsVisible", ro_isVisible},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static RenderObjectPtr<Panel> CheckPanel(lua_State *L) {
+static RenderObjectPtr<Panel> checkPanel(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Panel
- uint *UserDataPtr;
- if ((UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) {
- RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
- if (ROPtr.isValid()) {
- return ROPtr->toPanel();
+ uint *userDataPtr;
+ if ((userDataPtr = (uint *)my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) {
+ RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
+ if (roPtr.isValid()) {
+ return roPtr->toPanel();
} else
- luaL_error(L, "The panel with the handle %d does no longer exist.", *UserDataPtr);
+ luaL_error(L, "The panel with the handle %d does no longer exist.", *userDataPtr);
} else {
luaL_argcheck(L, 0, 1, "'" PANEL_CLASS_NAME "' expected");
}
@@ -790,54 +674,44 @@ static RenderObjectPtr<Panel> CheckPanel(lua_State *L) {
return RenderObjectPtr<Panel>();
}
-// -----------------------------------------------------------------------------
-
-static int P_GetColor(lua_State *L) {
- RenderObjectPtr<Panel> PanelPtr = CheckPanel(L);
+static int p_getColor(lua_State *L) {
+ RenderObjectPtr<Panel> PanelPtr = checkPanel(L);
BS_ASSERT(PanelPtr.isValid());
GraphicEngine::ARGBColorToLuaColor(L, PanelPtr->getColor());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int P_SetColor(lua_State *L) {
- RenderObjectPtr<Panel> PanelPtr = CheckPanel(L);
+static int p_setColor(lua_State *L) {
+ RenderObjectPtr<Panel> PanelPtr = checkPanel(L);
BS_ASSERT(PanelPtr.isValid());
- PanelPtr->setColor(GraphicEngine::LuaColorToARGBColor(L, 2));
+ PanelPtr->setColor(GraphicEngine::luaColorToARGBColor(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int P_Remove(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr.erase();
+static int p_remove(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr.erase();
return 0;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg PANEL_METHODS[] = {
- {"GetColor", P_GetColor},
- {"SetColor", P_SetColor},
- {"Remove", P_Remove},
+ {"GetColor", p_getColor},
+ {"SetColor", p_setColor},
+ {"Remove", p_remove},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static RenderObjectPtr<Bitmap> CheckBitmap(lua_State *L) {
+static RenderObjectPtr<Bitmap> checkBitmap(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Bitmap
- uint *UserDataPtr;
- if ((UserDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) {
- RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
- if (ROPtr.isValid()) {
- return ROPtr->toBitmap();
+ uint *userDataPtr;
+ if ((userDataPtr = (uint *)my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) {
+ RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
+ if (roPtr.isValid()) {
+ return roPtr->toBitmap();
} else
- luaL_error(L, "The bitmap with the handle %d does no longer exist.", *UserDataPtr);
+ luaL_error(L, "The bitmap with the handle %d does no longer exist.", *userDataPtr);
} else {
luaL_argcheck(L, 0, 1, "'" BITMAP_CLASS_NAME "' expected");
}
@@ -845,204 +719,165 @@ static RenderObjectPtr<Bitmap> CheckBitmap(lua_State *L) {
return RenderObjectPtr<Bitmap>();
}
-// -----------------------------------------------------------------------------
-
-static int B_SetAlpha(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setAlpha(static_cast<uint>(luaL_checknumber(L, 2)));
+static int b_setAlpha(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setAlpha(static_cast<uint>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetTintColor(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2));
+static int b_setTintColor(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setModulationColor(GraphicEngine::luaColorToARGBColor(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetScaleFactor(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 2)));
+static int b_setScaleFactor(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetScaleFactorX(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setScaleFactorX(static_cast<float>(luaL_checknumber(L, 2)));
+static int b_setScaleFactorX(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setScaleFactorX(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetScaleFactorY(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setScaleFactorY(static_cast<float>(luaL_checknumber(L, 2)));
+static int b_setScaleFactorY(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setScaleFactorY(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetFlipH(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setFlipH(lua_tobooleancpp(L, 2));
+static int b_setFlipH(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setFlipH(lua_tobooleancpp(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_SetFlipV(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- BitmapPtr->setFlipV(lua_tobooleancpp(L, 2));
+static int b_setFlipV(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ bitmapPtr->setFlipV(lua_tobooleancpp(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int B_GetAlpha(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushnumber(L, BitmapPtr->getAlpha());
+static int b_getAlpha(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushnumber(L, bitmapPtr->getAlpha());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_GetTintColor(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->getModulationColor());
+static int b_getTintColor(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ GraphicEngine::ARGBColorToLuaColor(L, bitmapPtr->getModulationColor());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_GetScaleFactorX(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushnumber(L, BitmapPtr->getScaleFactorX());
+static int b_getScaleFactorX(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushnumber(L, bitmapPtr->getScaleFactorX());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_GetScaleFactorY(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushnumber(L, BitmapPtr->getScaleFactorY());
+static int b_getScaleFactorY(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushnumber(L, bitmapPtr->getScaleFactorY());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_IsFlipH(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushbooleancpp(L, BitmapPtr->isFlipH());
+static int b_isFlipH(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushbooleancpp(L, bitmapPtr->isFlipH());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_IsFlipV(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushbooleancpp(L, BitmapPtr->isFlipV());
+static int b_isFlipV(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushbooleancpp(L, bitmapPtr->isFlipV());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_GetPixel(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
+static int b_getPixel(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
Vertex Pos;
Vertex::luaVertexToVertex(L, 2, Pos);
- GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->getPixel(Pos.x, Pos.y));
+ GraphicEngine::ARGBColorToLuaColor(L, bitmapPtr->getPixel(Pos.x, Pos.y));
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_IsScalingAllowed(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushbooleancpp(L, BitmapPtr->isScalingAllowed());
+static int b_isScalingAllowed(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushbooleancpp(L, bitmapPtr->isScalingAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_IsAlphaAllowed(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushbooleancpp(L, BitmapPtr->isAlphaAllowed());
+static int b_isAlphaAllowed(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushbooleancpp(L, bitmapPtr->isAlphaAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int B_IsTintingAllowed(lua_State *L) {
- RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
- BS_ASSERT(BitmapPtr.isValid());
- lua_pushbooleancpp(L, BitmapPtr->isColorModulationAllowed());
+static int b_isTintingAllowed(lua_State *L) {
+ RenderObjectPtr<Bitmap> bitmapPtr = checkBitmap(L);
+ BS_ASSERT(bitmapPtr.isValid());
+ lua_pushbooleancpp(L, bitmapPtr->isColorModulationAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-static int B_Remove(lua_State *L) {
- RenderObjectPtr<RenderObject> ROPtr = CheckRenderObject(L);
- BS_ASSERT(ROPtr.isValid());
- ROPtr.erase();
+static int b_remove(lua_State *L) {
+ RenderObjectPtr<RenderObject> roPtr = checkRenderObject(L);
+ BS_ASSERT(roPtr.isValid());
+ roPtr.erase();
return 0;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg BITMAP_METHODS[] = {
- {"SetAlpha", B_SetAlpha},
- {"SetTintColor", B_SetTintColor},
- {"SetScaleFactor", B_SetScaleFactor},
- {"SetScaleFactorX", B_SetScaleFactorX},
- {"SetScaleFactorY", B_SetScaleFactorY},
- {"SetFlipH", B_SetFlipH},
- {"SetFlipV", B_SetFlipV},
- {"GetAlpha", B_GetAlpha},
- {"GetTintColor", B_GetTintColor},
- {"GetScaleFactorX", B_GetScaleFactorX},
- {"GetScaleFactorY", B_GetScaleFactorY},
- {"IsFlipH", B_IsFlipH},
- {"IsFlipV", B_IsFlipV},
- {"GetPixel", B_GetPixel},
- {"IsScalingAllowed", B_IsScalingAllowed},
- {"IsAlphaAllowed", B_IsAlphaAllowed},
- {"IsTintingAllowed", B_IsTintingAllowed},
- {"Remove", B_Remove},
+ {"SetAlpha", b_setAlpha},
+ {"SetTintColor", b_setTintColor},
+ {"SetScaleFactor", b_setScaleFactor},
+ {"SetScaleFactorX", b_setScaleFactorX},
+ {"SetScaleFactorY", b_setScaleFactorY},
+ {"SetFlipH", b_setFlipH},
+ {"SetFlipV", b_setFlipV},
+ {"GetAlpha", b_getAlpha},
+ {"GetTintColor", b_getTintColor},
+ {"GetScaleFactorX", b_getScaleFactorX},
+ {"GetScaleFactorY", b_getScaleFactorY},
+ {"IsFlipH", b_isFlipH},
+ {"IsFlipV", b_isFlipV},
+ {"GetPixel", b_getPixel},
+ {"IsScalingAllowed", b_isScalingAllowed},
+ {"IsAlphaAllowed", b_isAlphaAllowed},
+ {"IsTintingAllowed", b_isTintingAllowed},
+ {"Remove", b_remove},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static RenderObjectPtr<Animation> CheckAnimation(lua_State *L) {
+static RenderObjectPtr<Animation> checkAnimation(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Animation
- uint *UserDataPtr;
- if ((UserDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) {
- RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
- if (ROPtr.isValid())
- return ROPtr->toAnimation();
+ uint *userDataPtr;
+ if ((userDataPtr = (uint *)my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) {
+ RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
+ if (roPtr.isValid())
+ return roPtr->toAnimation();
else {
- luaL_error(L, "The animation with the handle %d does no longer exist.", *UserDataPtr);
+ luaL_error(L, "The animation with the handle %d does no longer exist.", *userDataPtr);
}
} else {
luaL_argcheck(L, 0, 1, "'" ANIMATION_CLASS_NAME "' expected");
@@ -1051,110 +886,87 @@ static RenderObjectPtr<Animation> CheckAnimation(lua_State *L) {
return RenderObjectPtr<Animation>();
}
-// -----------------------------------------------------------------------------
-
-static int A_Play(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->play();
+static int a_play(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->play();
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_Pause(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->pause();
+static int a_pause(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->pause();
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_Stop(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->stop();
+static int a_stop(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->stop();
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_SetFrame(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setFrame(static_cast<uint>(luaL_checknumber(L, 2)));
+static int a_setFrame(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setFrame(static_cast<uint>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_SetAlpha(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setAlpha(static_cast<int>(luaL_checknumber(L, 2)));
+static int a_setAlpha(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setAlpha(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-static int A_SetTintColor(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2));
+static int a_setTintColor(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setModulationColor(GraphicEngine::luaColorToARGBColor(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_SetScaleFactor(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 2)));
+static int a_setScaleFactor(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_SetScaleFactorX(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setScaleFactorX(static_cast<float>(luaL_checknumber(L, 2)));
+static int a_setScaleFactorX(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setScaleFactorX(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_SetScaleFactorY(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->setScaleFactorY(static_cast<float>(luaL_checknumber(L, 2)));
+static int a_setScaleFactorY(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr->setScaleFactorY(static_cast<float>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetScaleFactorX(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->getScaleFactorX());
+static int a_getScaleFactorX(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushnumber(L, animationPtr->getScaleFactorX());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetScaleFactorY(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->getScaleFactorY());
+static int a_getScaleFactorY(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushnumber(L, animationPtr->getScaleFactorY());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetAnimationType(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- switch (AnimationPtr->getAnimationType()) {
+static int a_getAnimationType(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ switch (animationPtr->getAnimationType()) {
case Animation::AT_JOJO:
lua_pushstring(L, "jojo");
break;
@@ -1170,213 +982,176 @@ static int A_GetAnimationType(lua_State *L) {
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetFPS(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->getFPS());
+static int a_getFPS(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushnumber(L, animationPtr->getFPS());
return 1;
}
-
-// -----------------------------------------------------------------------------
-
-static int A_GetFrameCount(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->getFrameCount());
+static int a_getFrameCount(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushnumber(L, animationPtr->getFrameCount());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_IsScalingAllowed(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushbooleancpp(L, AnimationPtr->isScalingAllowed());
+static int a_isScalingAllowed(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushbooleancpp(L, animationPtr->isScalingAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_IsAlphaAllowed(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushbooleancpp(L, AnimationPtr->isAlphaAllowed());
+static int a_isAlphaAllowed(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushbooleancpp(L, animationPtr->isAlphaAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_IsTintingAllowed(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushbooleancpp(L, AnimationPtr->isColorModulationAllowed());
+static int a_isTintingAllowed(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushbooleancpp(L, animationPtr->isColorModulationAllowed());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetCurrentFrame(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->getCurrentFrame());
+static int a_getCurrentFrame(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushnumber(L, animationPtr->getCurrentFrame());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_GetCurrentAction(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushstring(L, AnimationPtr->getCurrentAction().c_str());
+static int a_getCurrentAction(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushstring(L, animationPtr->getCurrentAction().c_str());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int A_IsPlaying(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- lua_pushbooleancpp(L, AnimationPtr->isRunning());
+static int a_isPlaying(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ lua_pushbooleancpp(L, animationPtr->isRunning());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static bool AnimationLoopPointCallback(uint Handle) {
+static bool animationLoopPointCallback(uint handle) {
lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
- LoopPointCallbackPtr->invokeCallbackFunctions(L, Handle);
+ loopPointCallbackPtr->invokeCallbackFunctions(L, handle);
return true;
}
-// -----------------------------------------------------------------------------
-
-static int A_RegisterLoopPointCallback(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
+static int a_registerLoopPointCallback(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
luaL_checktype(L, 2, LUA_TFUNCTION);
lua_pushvalue(L, 2);
- LoopPointCallbackPtr->registerCallbackFunction(L, AnimationPtr->getHandle());
+ loopPointCallbackPtr->registerCallbackFunction(L, animationPtr->getHandle());
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_UnregisterLoopPointCallback(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
+static int a_unregisterLoopPointCallback(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
luaL_checktype(L, 2, LUA_TFUNCTION);
lua_pushvalue(L, 2);
- LoopPointCallbackPtr->unregisterCallbackFunction(L, AnimationPtr->getHandle());
+ loopPointCallbackPtr->unregisterCallbackFunction(L, animationPtr->getHandle());
return 0;
}
-// -----------------------------------------------------------------------------
-
-static bool AnimationActionCallback(uint Handle) {
- RenderObjectPtr<Animation> AnimationPtr(Handle);
- if (AnimationPtr.isValid()) {
- ActionCallbackPtr->Action = AnimationPtr->getCurrentAction();
+static bool animationActionCallback(uint Handle) {
+ RenderObjectPtr<Animation> animationPtr(Handle);
+ if (animationPtr.isValid()) {
+ actionCallbackPtr->Action = animationPtr->getCurrentAction();
lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
- ActionCallbackPtr->invokeCallbackFunctions(L, AnimationPtr->getHandle());
+ actionCallbackPtr->invokeCallbackFunctions(L, animationPtr->getHandle());
}
return true;
}
-// -----------------------------------------------------------------------------
-
-static int A_RegisterActionCallback(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
+static int a_registerActionCallback(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
luaL_checktype(L, 2, LUA_TFUNCTION);
lua_pushvalue(L, 2);
- ActionCallbackPtr->registerCallbackFunction(L, AnimationPtr->getHandle());
+ actionCallbackPtr->registerCallbackFunction(L, animationPtr->getHandle());
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int A_UnregisterActionCallback(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
+static int a_unregisterActionCallback(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
luaL_checktype(L, 2, LUA_TFUNCTION);
lua_pushvalue(L, 2);
- ActionCallbackPtr->unregisterCallbackFunction(L, AnimationPtr->getHandle());
+ actionCallbackPtr->unregisterCallbackFunction(L, animationPtr->getHandle());
return 0;
}
-// -----------------------------------------------------------------------------
-
-static bool AnimationDeleteCallback(uint Handle) {
+static bool animationDeleteCallback(uint Handle) {
lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
- LoopPointCallbackPtr->removeAllObjectCallbacks(L, Handle);
+ loopPointCallbackPtr->removeAllObjectCallbacks(L, Handle);
return true;
}
-// -----------------------------------------------------------------------------
-
-static int A_Remove(lua_State *L) {
- RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
- BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr.erase();
+static int a_remove(lua_State *L) {
+ RenderObjectPtr<Animation> animationPtr = checkAnimation(L);
+ BS_ASSERT(animationPtr.isValid());
+ animationPtr.erase();
return 0;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg ANIMATION_METHODS[] = {
- {"Play", A_Play},
- {"Pause", A_Pause},
- {"Stop", A_Stop},
- {"SetFrame", A_SetFrame},
- {"SetAlpha", A_SetAlpha},
- {"SetTintColor", A_SetTintColor},
- {"SetScaleFactor", A_SetScaleFactor},
- {"SetScaleFactorX", A_SetScaleFactorX},
- {"SetScaleFactorY", A_SetScaleFactorY},
- {"GetScaleFactorX", A_GetScaleFactorX},
- {"GetScaleFactorY", A_GetScaleFactorY},
- {"GetAnimationType", A_GetAnimationType},
- {"GetFPS", A_GetFPS},
- {"GetFrameCount", A_GetFrameCount},
- {"IsScalingAllowed", A_IsScalingAllowed},
- {"IsAlphaAllowed", A_IsAlphaAllowed},
- {"IsTintingAllowed", A_IsTintingAllowed},
- {"GetCurrentFrame", A_GetCurrentFrame},
- {"GetCurrentAction", A_GetCurrentAction},
- {"IsPlaying", A_IsPlaying},
- {"RegisterLoopPointCallback", A_RegisterLoopPointCallback},
- {"UnregisterLoopPointCallback", A_UnregisterLoopPointCallback},
- {"RegisterActionCallback", A_RegisterActionCallback},
- {"UnregisterActionCallback", A_UnregisterActionCallback},
- {"Remove", A_Remove},
+ {"Play", a_play},
+ {"Pause", a_pause},
+ {"Stop", a_stop},
+ {"SetFrame", a_setFrame},
+ {"SetAlpha", a_setAlpha},
+ {"SetTintColor", a_setTintColor},
+ {"SetScaleFactor", a_setScaleFactor},
+ {"SetScaleFactorX", a_setScaleFactorX},
+ {"SetScaleFactorY", a_setScaleFactorY},
+ {"GetScaleFactorX", a_getScaleFactorX},
+ {"GetScaleFactorY", a_getScaleFactorY},
+ {"GetAnimationType", a_getAnimationType},
+ {"GetFPS", a_getFPS},
+ {"GetFrameCount", a_getFrameCount},
+ {"IsScalingAllowed", a_isScalingAllowed},
+ {"IsAlphaAllowed", a_isAlphaAllowed},
+ {"IsTintingAllowed", a_isTintingAllowed},
+ {"GetCurrentFrame", a_getCurrentFrame},
+ {"GetCurrentAction", a_getCurrentAction},
+ {"IsPlaying", a_isPlaying},
+ {"RegisterLoopPointCallback", a_registerLoopPointCallback},
+ {"UnregisterLoopPointCallback", a_unregisterLoopPointCallback},
+ {"RegisterActionCallback", a_registerActionCallback},
+ {"UnregisterActionCallback", a_unregisterActionCallback},
+ {"Remove", a_remove},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-static RenderObjectPtr<Text> CheckText(lua_State *L) {
+static RenderObjectPtr<Text> checkText(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Text
- uint *UserDataPtr;
- if ((UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
- RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
- if (ROPtr.isValid())
- return ROPtr->toText();
+ uint *userDataPtr;
+ if ((userDataPtr = (uint *)my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
+ RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
+ if (roPtr.isValid())
+ return roPtr->toText();
else
- luaL_error(L, "The text with the handle %d does no longer exist.", *UserDataPtr);
+ luaL_error(L, "The text with the handle %d does no longer exist.", *userDataPtr);
} else {
luaL_argcheck(L, 0, 1, "'" TEXT_CLASS_NAME "' expected");
}
@@ -1384,145 +1159,115 @@ static RenderObjectPtr<Text> CheckText(lua_State *L) {
return RenderObjectPtr<Text>();
}
-// -----------------------------------------------------------------------------
-
-static int T_SetFont(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->SetFont(luaL_checkstring(L, 2));
+static int t_setFont(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->SetFont(luaL_checkstring(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_SetText(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->SetText(luaL_checkstring(L, 2));
+static int t_setText(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->SetText(luaL_checkstring(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_SetAlpha(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->setAlpha(static_cast<int>(luaL_checknumber(L, 2)));
+static int t_setAlpha(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->setAlpha(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_SetColor(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->setColor(GraphicEngine::LuaColorToARGBColor(L, 2));
+static int t_setColor(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->setColor(GraphicEngine::luaColorToARGBColor(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_SetAutoWrap(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->SetAutoWrap(lua_tobooleancpp(L, 2));
+static int t_setAutoWrap(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->SetAutoWrap(lua_tobooleancpp(L, 2));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_SetAutoWrapThreshold(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr->SetAutoWrapThreshold(static_cast<uint>(luaL_checknumber(L, 2)));
+static int t_setAutoWrapThreshold(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr->SetAutoWrapThreshold(static_cast<uint>(luaL_checknumber(L, 2)));
return 0;
}
-// -----------------------------------------------------------------------------
-
-static int T_GetText(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushstring(L, TextPtr->GetText().c_str());
+static int t_getText(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushstring(L, textPtr->GetText().c_str());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_GetFont(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushstring(L, TextPtr->GetFont().c_str());
+static int t_getFont(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushstring(L, textPtr->GetFont().c_str());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_GetAlpha(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushnumber(L, TextPtr->getAlpha());
+static int t_getAlpha(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushnumber(L, textPtr->getAlpha());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_GetColor(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushnumber(L, TextPtr->getColor());
+static int t_getColor(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushnumber(L, textPtr->getColor());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_IsAutoWrap(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushbooleancpp(L, TextPtr->IsAutoWrapActive());
+static int t_isAutoWrap(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushbooleancpp(L, textPtr->IsAutoWrapActive());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_GetAutoWrapThreshold(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- lua_pushnumber(L, TextPtr->GetAutoWrapThreshold());
+static int t_getAutoWrapThreshold(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ lua_pushnumber(L, textPtr->GetAutoWrapThreshold());
return 1;
}
-// -----------------------------------------------------------------------------
-
-static int T_Remove(lua_State *L) {
- RenderObjectPtr<Text> TextPtr = CheckText(L);
- BS_ASSERT(TextPtr.isValid());
- TextPtr.erase();
+static int t_remove(lua_State *L) {
+ RenderObjectPtr<Text> textPtr = checkText(L);
+ BS_ASSERT(textPtr.isValid());
+ textPtr.erase();
return 0;
}
-// -----------------------------------------------------------------------------
-
static const luaL_reg TEXT_METHODS[] = {
- {"SetFont", T_SetFont},
- {"SetText", T_SetText},
- {"SetAlpha", T_SetAlpha},
- {"SetColor", T_SetColor},
- {"SetAutoWrap", T_SetAutoWrap},
- {"SetAutoWrapThreshold", T_SetAutoWrapThreshold},
- {"GetText", T_GetText},
- {"GetFont", T_GetFont},
- {"GetAlpha", T_GetAlpha},
- {"GetColor", T_GetColor},
- {"IsAutoWrap", T_IsAutoWrap},
- {"GetAutoWrapThreshold", T_GetAutoWrapThreshold},
- {"Remove", T_Remove},
+ {"SetFont", t_setFont},
+ {"SetText", t_setText},
+ {"SetAlpha", t_setAlpha},
+ {"SetColor", t_setColor},
+ {"SetAutoWrap", t_setAutoWrap},
+ {"SetAutoWrapThreshold", t_setAutoWrapThreshold},
+ {"GetText", t_getText},
+ {"GetFont", t_getFont},
+ {"GetAlpha", t_getAlpha},
+ {"GetColor", t_getColor},
+ {"IsAutoWrap", t_isAutoWrap},
+ {"GetAutoWrapThreshold", t_getAutoWrapThreshold},
+ {"Remove", t_remove},
{0, 0}
};
-// -----------------------------------------------------------------------------
-
-bool GraphicEngine::RegisterScriptBindings() {
+bool GraphicEngine::registerScriptBindings() {
Kernel *pKernel = Kernel::GetInstance();
BS_ASSERT(pKernel);
ScriptEngine *pScript = pKernel->GetScript();
@@ -1544,8 +1289,8 @@ bool GraphicEngine::RegisterScriptBindings() {
if (!LuaBindhelper::addFunctionsToLib(L, GFX_LIBRARY_NAME, GFX_FUNCTIONS)) return false;
- LoopPointCallbackPtr.reset(new LuaCallback(L));
- ActionCallbackPtr.reset(new ActionCallback(L));
+ loopPointCallbackPtr.reset(new LuaCallback(L));
+ actionCallbackPtr.reset(new ActionCallback(L));
return true;
}
diff --git a/engines/sword25/gfx/image/pngloader.cpp b/engines/sword25/gfx/image/pngloader.cpp
index a2a63fdef0..1136b94006 100644
--- a/engines/sword25/gfx/image/pngloader.cpp
+++ b/engines/sword25/gfx/image/pngloader.cpp
@@ -108,7 +108,7 @@ bool PNGLoader::DoDecodeImage(const byte *FileDataPtr, uint FileSize, GraphicEn
png_get_IHDR(png_ptr, info_ptr, (png_uint_32 *)&Width, (png_uint_32 *)&Height, &BitDepth, &ColorType, &InterlaceType, NULL, NULL);
// Pitch des Ausgabebildes berechnen
- Pitch = GraphicEngine::CalcPitch(ColorFormat, Width);
+ Pitch = GraphicEngine::calcPitch(ColorFormat, Width);
// Speicher für die endgültigen Bilddaten reservieren
// Dieses geschieht vor dem reservieren von Speicher für temporäre Bilddaten um die Fragmentierung des Speichers gering zu halten
diff --git a/engines/sword25/gfx/renderobjectmanager.cpp b/engines/sword25/gfx/renderobjectmanager.cpp
index 3e142c627e..74a69a5d0a 100644
--- a/engines/sword25/gfx/renderobjectmanager.cpp
+++ b/engines/sword25/gfx/renderobjectmanager.cpp
@@ -63,7 +63,7 @@ void RenderObjectManager::startFrame() {
_frameStarted = true;
// Verstrichene Zeit bestimmen
- int timeElapsed = Kernel::GetInstance()->GetGfx()->GetLastFrameDurationMicro();
+ int timeElapsed = Kernel::GetInstance()->GetGfx()->getLastFrameDurationMicro();
// Alle BS_TimedRenderObject Objekte über den Framestart und die verstrichene Zeit in Kenntnis setzen
RenderObjectList::iterator iter = _timedRenderObjects.begin();
diff --git a/engines/sword25/math/geometry_script.cpp b/engines/sword25/math/geometry_script.cpp
index dc89428d95..d15b4550f7 100644
--- a/engines/sword25/math/geometry_script.cpp
+++ b/engines/sword25/math/geometry_script.cpp
@@ -368,9 +368,9 @@ static void drawPolygon(const Polygon &polygon, uint color, const Vertex &offset
BS_ASSERT(pGE);
for (int i = 0; i < polygon.vertexCount - 1; i++)
- pGE->DrawDebugLine(polygon.vertices[i] + offset, polygon.vertices[i + 1] + offset, color);
+ pGE->drawDebugLine(polygon.vertices[i] + offset, polygon.vertices[i + 1] + offset, color);
- pGE->DrawDebugLine(polygon.vertices[polygon.vertexCount - 1] + offset, polygon.vertices[0] + offset, color);
+ pGE->drawDebugLine(polygon.vertices[polygon.vertexCount - 1] + offset, polygon.vertices[0] + offset, color);
}
static void drawRegion(const Region &region, uint color, const Vertex &offset) {
@@ -387,12 +387,12 @@ static int r_draw(lua_State *L) {
case 3: {
Vertex offset;
Vertex::luaVertexToVertex(L, 3, offset);
- drawRegion(*pR, GraphicEngine::LuaColorToARGBColor(L, 2), offset);
+ drawRegion(*pR, GraphicEngine::luaColorToARGBColor(L, 2), offset);
}
break;
case 2:
- drawRegion(*pR, GraphicEngine::LuaColorToARGBColor(L, 2), Vertex(0, 0));
+ drawRegion(*pR, GraphicEngine::luaColorToARGBColor(L, 2), Vertex(0, 0));
break;
default: