diff options
-rw-r--r-- | engines/sword25/gfx/framecounter.cpp | 68 | ||||
-rw-r--r-- | engines/sword25/gfx/framecounter.h | 99 | ||||
-rw-r--r-- | engines/sword25/gfx/graphicengine.cpp | 4 | ||||
-rw-r--r-- | engines/sword25/gfx/graphicengine.h | 16 | ||||
-rw-r--r-- | engines/sword25/gfx/graphicengine_script.cpp | 6 | ||||
-rw-r--r-- | engines/sword25/kernel/resservice.h | 1 | ||||
-rw-r--r-- | engines/sword25/module.mk | 1 |
7 files changed, 4 insertions, 191 deletions
diff --git a/engines/sword25/gfx/framecounter.cpp b/engines/sword25/gfx/framecounter.cpp deleted file mode 100644 index 07415cc2dc..0000000000 --- a/engines/sword25/gfx/framecounter.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on Broken Sword 2.5 engine - * - * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer - * - * Licensed under GNU GPL v2 - * - */ - -#include "common/system.h" -#include "sword25/gfx/framecounter.h" - -namespace Sword25 { - -Framecounter::Framecounter(int updateFrequency) : - _FPS(0), - _FPSCount(0), - _lastUpdateTime(-1) { - setUpdateFrequency(updateFrequency); -} - -void Framecounter::update() { - // Aktuellen Systemtimerstand auslesen - 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 (_lastUpdateTime == -1) - _lastUpdateTime = timer; - else { - // Die Anzahl der Frames im aktuellen Messzeitraum wird erhöht. - _FPSCount++; - - // Falls der Messzeitraum verstrichen ist, wird die durchschnittliche Framerate berechnet und ein neuer Messzeitraum begonnen. - if (timer - _lastUpdateTime >= _updateDelay) { - _FPS = static_cast<int>((1000000 * (uint64)_FPSCount) / (timer - _lastUpdateTime)); - _lastUpdateTime = timer; - _FPSCount = 0; - } - } -} - -} // End of namespace Sword25 diff --git a/engines/sword25/gfx/framecounter.h b/engines/sword25/gfx/framecounter.h deleted file mode 100644 index 994950573f..0000000000 --- a/engines/sword25/gfx/framecounter.h +++ /dev/null @@ -1,99 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on Broken Sword 2.5 engine - * - * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer - * - * Licensed under GNU GPL v2 - * - */ - -#ifndef SWORD25_FRAMECOUNTER_H -#define SWORD25_FRAMECOUNTER_H - -// Includes -#include "sword25/kernel/common.h" - -namespace Sword25 { - -/** - * A simple class that implements a frame counter - */ -class Framecounter { -private: - - // TODO: This class should be rewritten based on Audio::Timestamp, - // which provides higher accuracy and avoids using 64 bit data types. - typedef unsigned long long uint64; - typedef signed long long int64; - - enum { - DEFAULT_UPDATE_FREQUENCY = 10 - }; - -public: - /** - * Creates a new BS_Framecounter object - * @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); - - /** - * 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); - - /** - * This method must be called once per frame. - */ - void update(); - - /** - * Returns the current FPS value. - */ - int getFPS() const { - return _FPS; - } - -private: - int _FPS; - int _FPSCount; - int64 _lastUpdateTime; - uint64 _updateDelay; -}; - -// Inlines -void Framecounter::setUpdateFrequency(int updateFrequency) { - // Frequency in time (converted to microseconds) - _updateDelay = 1000000 / updateFrequency; -} - -} // End of namespace Sword25 - -#endif diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index affd4306f0..1a5a92a291 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -72,7 +72,6 @@ GraphicEngine::GraphicEngine(Kernel *pKernel) : _lastFrameDuration(0), _timerActive(true), _frameTimeSampleSlot(0), - _repaintedPixels(0), _thumbnail(NULL), ResourceService(pKernel) { _frameTimeSamples.resize(FRAMETIME_SAMPLE_COUNT); @@ -183,9 +182,6 @@ bool GraphicEngine::endFrame() { _debugLines.clear(); } - // Framecounter aktualisieren - _FPSCounter.update(); - return true; } diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h index 3f75e8706a..6ddf8cbe05 100644 --- a/engines/sword25/gfx/graphicengine.h +++ b/engines/sword25/gfx/graphicengine.h @@ -52,7 +52,6 @@ #include "sword25/kernel/common.h" #include "sword25/kernel/resservice.h" #include "sword25/kernel/persistable.h" -#include "sword25/gfx/framecounter.h" #include "sword25/gfx/renderobjectptr.h" #include "sword25/math/vertex.h" @@ -266,15 +265,6 @@ public: */ bool fill(const Common::Rect *fillRectPtr = 0, uint color = BS_RGB(0, 0, 0)); - // Debugging Methods - - int getFPSCount() const { - return _FPSCounter.getFPS(); - } - int getRepaintedPixels() const { - return _repaintedPixels; - } - Graphics::Surface _backSurface; Graphics::Surface *getSurface() { return &_backSurface; } @@ -342,12 +332,6 @@ protected: int _bitDepth; bool _windowed; - // Debugging Variables - // ------------------- - Framecounter _FPSCounter; - - uint _repaintedPixels; - /** * Calculates the time since the last frame beginning has passed. */ diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 3888529a2a..f865400677 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -346,7 +346,8 @@ static int isWindowed(lua_State *L) { static int getFPSCount(lua_State *L) { GraphicEngine *pGE = getGE(); - lua_pushnumber(L, pGE->getFPSCount()); + // Used in a debug function + lua_pushnumber(L, 0); return 1; } @@ -395,7 +396,8 @@ static int saveThumbnailScreenshot(lua_State *L) { static int getRepaintedPixels(lua_State *L) { GraphicEngine *pGE = getGE(); - lua_pushnumber(L, static_cast<lua_Number>(pGE->getRepaintedPixels())); + // Used in a debug function. + lua_pushnumber(L, 0); return 1; } diff --git a/engines/sword25/kernel/resservice.h b/engines/sword25/kernel/resservice.h index a0f2669231..65b2dc4b36 100644 --- a/engines/sword25/kernel/resservice.h +++ b/engines/sword25/kernel/resservice.h @@ -53,7 +53,6 @@ public: virtual ~ResourceService() {} - /** * Loads a resource * @return Returns the resource if successful, otherwise NULL diff --git a/engines/sword25/module.mk b/engines/sword25/module.mk index a797d95ee9..da91c848b5 100644 --- a/engines/sword25/module.mk +++ b/engines/sword25/module.mk @@ -14,7 +14,6 @@ MODULE_OBJS := \ gfx/bitmap.o \ gfx/dynamicbitmap.o \ gfx/fontresource.o \ - gfx/framecounter.o \ gfx/graphicengine.o \ gfx/graphicengine_script.o \ gfx/panel.o \ |