diff options
author | Paul Gilbert | 2010-07-31 06:23:38 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-12 21:55:38 +0000 |
commit | e78b19a650e27fe9a24d0e4c9c938294c7b08650 (patch) | |
tree | d61751dd6dbefe6834742ff9cc5d10f61be4dc02 /engines/sword25/gfx | |
parent | 1842de4b0035854f271a40dcaa514cdba66bcf57 (diff) | |
download | scummvm-rg350-e78b19a650e27fe9a24d0e4c9c938294c7b08650.tar.gz scummvm-rg350-e78b19a650e27fe9a24d0e4c9c938294c7b08650.tar.bz2 scummvm-rg350-e78b19a650e27fe9a24d0e4c9c938294c7b08650.zip |
SWORD25: Converted kernel/kernel.cpp to compile under ScummVM
This commit creates a skeleton detection and engine class, as well as code necessary to call the kernel initiation.
The kernel/kernel.cpp has been converted to compile under ScummVM, along with all dependant header files.
svn-id: r53184
Diffstat (limited to 'engines/sword25/gfx')
-rwxr-xr-x | engines/sword25/gfx/framecounter.h | 83 | ||||
-rwxr-xr-x | engines/sword25/gfx/graphicengine.h | 370 |
2 files changed, 210 insertions, 243 deletions
diff --git a/engines/sword25/gfx/framecounter.h b/engines/sword25/gfx/framecounter.h index 650a2e9068..e91b3b0cda 100755 --- a/engines/sword25/gfx/framecounter.h +++ b/engines/sword25/gfx/framecounter.h @@ -1,21 +1,27 @@ -// ----------------------------------------------------------------------------- -// This file is part of Broken Sword 2.5 -// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdörfer -// -// Broken Sword 2.5 is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// Broken Sword 2.5 is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Broken Sword 2.5; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// ----------------------------------------------------------------------------- +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ #ifndef SWORD25_FRAMECOUNTER_H #define SWORD25_FRAMECOUNTER_H @@ -24,39 +30,39 @@ #include "sword25/kernel/common.h" #include "sword25/kernel/bs_stdint.h" +namespace Sword25 { + /** - @brief Eine einfache Klasse die einen Framecounter implementiert. -*/ -class BS_Framecounter -{ + * A simple class that implements a frame counter + */ +class BS_Framecounter { private: - enum - { + enum { DEFAULT_UPDATE_FREQUENCY = 10 }; public: /** - @brief Erzeugt ein neues BS_Framecounter Objekt. - @param UpdateFrequency gibt an wie oft der Framecounter in einer Sekunde aktualisiert werden soll.<br> - Der Standardwert ist 10. - */ + * 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. + */ BS_Framecounter(int UpdateFrequency = DEFAULT_UPDATE_FREQUENCY); /** - @brief Bestimmt wie oft der Framecounter in einer Sekunde aktualisiert werden soll. - @param UpdateFrequency gibt an wie oft der Framecounter in einer Sekunde aktualisiert werden soll. - */ + * 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); /** - @brief Diese Methode muss einmal pro Frame aufgerufen werden. - */ + * This method must be called once per frame. + */ void Update(); /** - @brief Gibt den aktuellen FPS-Wert zurück. - */ + * Returns the current FPS value. + */ int GetFPS() const { return m_FPS; } private: @@ -67,10 +73,11 @@ private: }; // Inlines -void BS_Framecounter::SetUpdateFrequency(int UpdateFrequency) -{ - // Frequenz in Laufzeit (in Microsekunden) umrechnen. +void BS_Framecounter::SetUpdateFrequency(int UpdateFrequency) { + // Frequency in time (converted to microseconds) m_UpdateDelay = 1000000 / UpdateFrequency; } +} // End of namespace Sword25 + #endif diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h index b6cd758a9e..836eacdba6 100755 --- a/engines/sword25/gfx/graphicengine.h +++ b/engines/sword25/gfx/graphicengine.h @@ -1,39 +1,37 @@ -// ----------------------------------------------------------------------------- -// This file is part of Broken Sword 2.5 -// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdörfer -// -// Broken Sword 2.5 is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// Broken Sword 2.5 is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Broken Sword 2.5; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// ----------------------------------------------------------------------------- - -/* - BS_GraphicEngine - ---------------- - Dies ist das Graphik-Engine Interface, dass alle Methoden und Klassen enthält, die eine - Graphik-Engine implementieren muss. - - Autor: Malte Thiesen -*/ +/* 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$ + * + * BS_GraphicEngine + * ---------------- + * This the graphics engine interface. + * + * Autor: Malte Thiesen + */ #ifndef SWORD25_GRAPHICENGINE_H #define SWORD25_GRAPHICENGINE_H // Includes -#include "sword25/kernel/memlog_off.h" -#include <vector> -#include "sword25/kernel/memlog_on.h" - #include "sword25/kernel/common.h" #include "sword25/kernel/bs_stdint.h" #include "sword25/kernel/resservice.h" @@ -42,6 +40,8 @@ #include "sword25/gfx/framecounter.h" #include "sword25/gfx/renderobjectptr.h" +namespace Sword25 { + class BS_Kernel; class BS_Image; class BS_Panel; @@ -62,54 +62,55 @@ typedef unsigned int BS_COLOR; Die bisher einzige Implementation ist BS_DDrawGfx. */ -class BS_GraphicEngine : public BS_ResourceService, public BS_Persistable -{ +class BS_GraphicEngine : public BS_ResourceService, public BS_Persistable { public: // Enums // ----- - // Farbformate + // Colour formats + // /** - @brief Die von der Engine benutzten Farbformate - */ - enum COLOR_FORMATS - { - /// Undefiniertes/unbekanntes Farbformat + * The colour format used by the engine + */ + enum COLOR_FORMATS { + /// Undefined/unknown colour format CF_UNKNOWN = 0, - /// 16 Bit Farbformat (5 Bit Rot, 5 Bit Grün, 5 Bit Blau) + /// 16-bit colour format (R5G5B5) CF_RGB15, - /// 16 Bit Farbformat (5 Bit Rot, 6 Bit Grün, 5 Bit Blau) + /// 16-bit colour format (R5G6R5) CF_RGB16, /** - Spezielles Alpha-Farbformat der Engine, welches besonders schnelles Darstellen unter Benutzung von MMX-Befehlen unterstützt.<br> - Die Pixel sind 16 Bit breit und haben das selbe Format wie #CF_RGB15. Zusätzlich besitzt jeder Pixel noch einen 8 Bit Alphawert.<br> - Es werden jeweils 4 Pixel und 4 Alphawerte zu einem 12 Byte großen Datenblock zusammengefasst.<br> - Dabei werden die Daten in folgender Reihenfolge abgelegt: - Alpha0 Alpha1 Alpha2 Alpha3 Pixel0 Pixel1 Pixel2 Pixel3 - Falls die Pixelanzahl einer Zeile nicht durch 4 teilbar ist, wird der letzte Pixelblock trotzdem komplett abgespeichert, die - nicht verwendeten Pixel- und Alphawerte können beliebige Werte haben. - */ + * Special alpha colour format of the engine, which supports very quick display using MMX instructions. + * The pixels are 16-bits wide and have the same format as #CF_RGB15. In addition, each pixel has an 8-bit + * alpha value. + * It summarises groupings of pixels pixels and four alpha values in a 12-byte data block. + * The data is stored in the following order: + * Alpha0 Alpha1 Alpha2 Alpha3 Pixel0 Pixel1 Pixel2 Pixel3 + * If the number of pixels in a line is not divisible by 4, then unused pixels and alpha values can have + * arbitrary values. + */ CF_RGB15_INTERLEAVED, /** - Spezielles Alpha-Farbformat der Engine, welches besonders schnelles Darstellen unter Benutzung von MMX-Befehlen unterstützt.<br> - Die Pixel sind 16 Bit breit und haben das selbe Format wie #CF_RGB16. Zusätzlich besitzt jeder Pixel noch einen 8 Bit Alphawert.<br> - Es werden jeweils 4 Pixel und 4 Alphawerte zu einem 12 Byte großen Datenblock zusammengefasst.<br> - Dabei werden die Daten in folgender Reihenfolge abgelegt: - Alpha0 Alpha1 Alpha2 Alpha3 Pixel0 Pixel1 Pixel2 Pixel3 - Falls die Pixelanzahl einer Zeile nicht durch 4 teilbar ist, wird der letzte Pixelblock trotzdem komplett abgespeichert, die - nicht verwendeten Pixel- und Alphawerte können beliebige Werte haben. - */ + * Special alpha colour format of the engine, which supports very quick display using MMX instructions. + * The pixels are 16-bits wide and have the same format as #CF_RGB16. In addition, each pixel has an 8-bit + * alpha value. + * It summarises groupings of pixels pixels and four alpha values in a 12-byte data block. + * The data is stored in the following order: + * Alpha0 Alpha1 Alpha2 Alpha3 Pixel0 Pixel1 Pixel2 Pixel3 + * If the number of pixels in a line is not divisible by 4, then unused pixels and alpha values can have + * arbitrary values. + */ CF_RGB16_INTERLEAVED, /** - 24 Bit Farbformat (8 Bit Rot, 8 Bit Grün, 8 Bit Blau) - */ + * 24-bit colour format (R8G8B8) + */ CF_RGB24, /** - 32 Bit Farbformat (8 Bit Alpha, 8 Bit Rot, 8 Bit Grün, 8 Bit Blau) (little endian) + * 32-bit colour format (A8R8G8B8) (little endian) */ CF_ARGB32, /** - 32 Bit Farbformat (8 Bit Alpha, 8 Bit Blau, 8 Bit Grün, 8 Bit Rot) (little endian) + 32-bit colour format (A8B8G8R8) (little endian) */ CF_ABGR32 }; @@ -118,109 +119,84 @@ public: // --------- /** - @brief Initialisiert die Graphikengine und setzt den Bildschirmmodus. - @param Width die Breite des Ausgabepuffers in Pixeln.<br>Der Standardwert ist 800. - @param Height die Höhe des Ausgabepuffers in Pixeln.<br>Der Standardwert ist 600. - @param BitDepth die Bittiefe des gewünschten Ausgabepuffers in Bit.<br>Der Standardwert ist 16. - @param BackbufferCount die Anzahl an Backbuffern die erzeugt werden soll.<br>Der Standardwert ist 2. - @param Windowed gibt an, ob die Engine im Fenstermodus laufen soll. Falls true angegeben wird, wird ein Fenster geöffnet in das - die Ausgaben gerendert werden. Ansonsten wird ein Vollbildmodus gesetzt der den Parametern das Ausgabepuffers - entspricht. - @return Gibt false zurück, falls die Initialisierung fehlgeschlagen ist. - @remark Der Fenstermodus sollte nur zu Debuggingzwecken benutzt werden und ist nicht dafür gedacht im endgültigen Produkt benutzt - zu werden. - @remark Diese Methode sollte direkt nach der Initialisierung aller Services aufgerufen werden. - */ + * Initialises the graphics engine and sets the screen mode. Returns true if initialisation failed. + * Notes: This method should be called immediately after the initialisation of all services. + * + * @param Height The height of the output buffer in pixels. The default value is 600 + * @param BitDepth The bit depth of the desired output buffer in bits. The default value is 16 + * @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. + */ virtual bool Init(int Width = 800, int Height = 600, int BitDepth = 16, int BackbufferCount = 2, bool Windowed = false) = 0; - //@{ - /** @name Frame-Methoden */ /** - @brief Beginnt das Rendern eines neuen Frames. - @param UpdateAll gibt an, ob der Renderer im nächsten Frame alles neu zeichnen soll.<br> - Diese Funktion kann nützlich sein, wenn der Renderer mit Dirty-Rectangles arbeitet, der Benutzer aber gelegentlich - darauf angewiesen ist, dass der gesamte Bildschirminhalt neu gezeichnet werden soll.<br> - Der Standardwert ist false. - Diese Methode muss am Anfang das Main-Loops aufgerufen werden und vor dem Aufruf jeglicher Rendermethoden. - @return Gibt false zurück, falls ein Fehler aufgetreten ist. - @remark Implementationen dieser Methode müssen _UpdateLastFrameDuration() aufrufen. + * Begins rendering a new frame. + * Notes: This method must be called at the beginning of the main loop, before any rendering methods are used. + * Notes: Implementations of this method must call _UpdateLastFrameDuration() + * @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 */ virtual bool StartFrame(bool UpdateAll = false) = 0; /** - @brief Beendet das Rendern des Frames und stellt diesen auf dem Bildschirm dar. - - Diese Methode muss am Ende des Main-Loops aufgerufen werden. Nach dem Aufruf dürfen keine weiteren Rendermethoden mehr aufgerufen - werden. Dafür muss erst wieder ein Aufruf von #StartFrame erfolgen. - @return Gibt false zurück, falls ein Fehler aufgetreten ist: + * Ends the rendering of a frame and draws it on the screen. + * + * 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. */ virtual bool EndFrame() = 0; - //@} - - //@{ - /** @name Debug-Methoden */ + // Debug methods /** - @brief Zeichnet eine Line in den Framebuffer. - - Diese Methode muss zwischen StartFrame() und EndFrame() aufgerufen werden und ist nur für Debugzwecke gedacht. - Die Linie erscheint nur für einen Frame. Wenn die Linie dauerhaft zu sehen sein soll, muss sie jeden Frame neu - gezeichnet werden. - - @param Start der Startpunkt der Linie - @param End der Endpunkt der Linie - @param Color die Farbe der Linie. Der Standardwert ist BS_RGB(255, 255, 255) (Weiß). + * Draws a line in the frame buffer + * + * This method must be called between calls to StartFrame() and EndFrame(), and is intended only for debugging + * purposes. The line will only appear for a single frame. If the line is to be shown permanently, it must be + * called for every frame. + * @param Start The starting point of the line + * @param End The ending point of the line + * @param Color The colour of the line. The default is BS_RGB (255,255,255) (White) */ - virtual void DrawDebugLine(const BS_Vertex & Start, const BS_Vertex & End, unsigned int Color = BS_RGB(255, 255, 255)) = 0; + virtual void DrawDebugLine(const BS_Vertex &Start, const BS_Vertex &End, unsigned int Color = BS_RGB(255, 255, 255)) = 0; /** - @brief Erstellt einen Screenshot. - - Erstellt einen Screenshot vom aktuellen Framebuffer und schreibt ihn in eine Grafikdatei.<br> - Das verwendete Dateiformat ist PNG. - - @param Der Dateiname des Screenshots. - @return Gibt true zurück, wenn der Screenshot gespeichert werden konnte, ansonsten false. - @remark Diese Methode darf erst nach einem Aufruf von EndFrame() und vor dem nächsten Aufruf von StartFrame() aufgerufen werden. - */ + * Creates a screenshot of the current frame buffer and writes it to a graphic file in PNG format. + * Returns true if the screenshot was saved successfully. + * 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 std::string & Filename); /** - @Brief Erstellt einen kleinen Screenshot. - - Erstellt einen Screenshot mit den Maßen 200x125. Hierfür werden am oberen und unteren Bildschirmrand die Interfaceleisten abgeschnitten und - das Bild auf ein 16tel seiner Ursprungsgröße verkleinert. - - @param Der Dateiname des Screenshots. - @return Gibt true zurück, wenn der Screenshot gespeichert werden konnte, ansonsten false. - @remark Diese Methode darf erst nach einem Aufruf von EndFrame() und vor dem nächsten Aufruf von StartFrame() aufgerufen werden. - @remark Der Framebuffer muss eine Auflösung von 800x600 haben. - */ + * Creates a thumbnail with the dimensions of 200x125. This will not include the top and bottom of the screen.. + * the interface boards the the image as a 16th of it's original size. + * Notes: This method should only be called after a call to EndFrame(), and before the next call to StartFrame(). + * The frame buffer must have a resolution of 800x600. + * @param Filename The filename for the screenshot + */ bool SaveThumbnailScreenshot(const std::string & Filename); /** - @brief Liest den aktuellen Inhalt des Framebuffer aus. - @param Width enthält nach einem erfolgreichen Aufruf die Breite des Framebuffers. - @param Height enthält nach einem erfolgreichen Aufruf die Höhe des Framebuffers. - @param Data enthält nach einem erfolgreichen Aufruf den Inhalt des Framebuffers als 32-Bit Farbwerte. - @return Gibt true zurück, wenn der Aufruf erfolgreich war, ansonsten false. - @remark Diese Methode ist für das Erstellen von Screenshots gedacht. Sie muss also nicht sehr effizient sein. - @remark Diese Methode darf erst nach einem Aufruf von EndFrame() und vor dem nächsten Aufruf von StartFrame() aufgerufen werden. + * Reads the current contents of the frame buffer + * Notes: This method is for creating screenshots. It is not very optimised. It should only be called + * after a call to EndFrame(), and before the next call to StartFrame(). + * @param Width Returns the width of the frame buffer + * @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. */ virtual bool GetScreenshot(unsigned int & Width, unsigned int & Height, std::vector<unsigned int> & Data) = 0; - //@} virtual BS_RenderObjectPtr<BS_Panel> GetMainPanel() = 0; /** - @brief Gibt die Zeit (in Microsekunden) zurück die seit dem letzten Frame vergangen ist. - */ + * Specifies the time (in microseconds) since the last frame has passed + */ int GetLastFrameDurationMicro() { if (m_TimerActive) return m_LastFrameDuration; else return 0; } /** - @brief Gibt die Zeit (in Sekunden) zurück die seit dem letzten Frame vergangen ist. + * Specifies the time (in microseconds) the previous frame took */ float GetLastFrameDuration() { if (m_TimerActive) return static_cast<float>(m_LastFrameDuration) / 1000000.0f; else return 0; } @@ -228,85 +204,71 @@ public: void ResumeMainTimer() { m_TimerActive = true; } float GetSecondaryFrameDuration() { return static_cast<float>(m_LastFrameDuration) / 1000000.0f; } - //@{ - /** @name Accessor-Methoden */ + // Accessor methods /** - @brief Gibt die Breite des Ausgabepuffers in Pixeln zurück. - */ + * Returns the width of the output buffer in pixels + */ int GetDisplayWidth() { return m_Width; } /** - @brief Gibt die Höhe des Ausgabepuffers in Pixeln zurück. - */ + * Returns the height of the output buffer in pixels + */ int GetDisplayHeight() { return m_Height; } /** - @brief Gibt die Bounding-Box des Ausgabepuffers zurück. (0, 0, Width, Height) - */ + * Returns the bounding box of the output buffer: (0, 0, Width, Height) + */ BS_Rect& GetDisplayRect() { return m_ScreenRect; } /** - @brief Gibt die Bittiefe des Ausgabepuffers zurück. - */ + * Returns the bit depth of the output buffer + */ int GetBitDepth() { return m_BitDepth; } /** - @brief Legt fest ob der Framebufferwechsel mit dem vertikalen Strahlenrücklauf synchronisiert werden soll.<br> - Vsync ist standardmäßig eingeschaltet. - @param Vsync gibt an, ob der Framebufferwechsel mit dem vertikalen Strahlenrücklauf synchronisiert werden soll. - @remark Im Fenstermodus hat diese Einstellung keine Auswirkung. - */ + * Determines whether the frame buffer change is to be synchronised with Vsync. This is turned on by default. + * Notes: In windowed mode, this setting has no effect. + * @param Vsync Indicates whether the frame buffer changes are to be synchronised with Vsync. + */ virtual void SetVsync(bool Vsync) = 0; /** - @brief Gibt true zurück, wenn V-Sync an ist. - @remark Im Fenstermodus hat diese Einstellung keine Auswirkung. - */ + * Returns true if V-Sync is on. + * Notes: In windowed mode, this setting has no effect. + */ virtual bool GetVsync() const = 0; /** - @brief Gibt true zurück, falls die Engine im Fenstermodus läuft. - */ + * Returns true if the engine is running in Windowed mode. + */ bool IsWindowed() { return m_Windowed; } /** - @brief Füllt einen Rechteckigen Bereich des Framebuffers mit einer Farbe. - @param FillRectPtr Pointer auf ein BS_Rect, welches den Ausschnitt des Framebuffers spezifiziert, der gefüllt - werden soll oder 0, falls das gesamte Bild gefüllt werden soll.<br> - Der Standardwert ist 0. - @param Color der 32 Bit Farbwert mit dem der Bildbereich gefüllt werden soll.<br> - Der Standardwert ist BS_RGB(0, 0, 0) (Schwarz). - @return Gibt true zurück, wenn der Aufruf erfolgreich war, ansonsten false. - @remark Es ist möglich über die Methode transparente Rechtecke darzustellen, indem man eine Farbe mit einem - Alphawert ungleich 255 angibt. + * Fills a rectangular area of the frame buffer with a colour. + * Notes: It is possible to create transparent rectangles by passing a colour with an Alpha value of 255. + * @param FillRectPtr Pointer to a BS_Rect, which specifies the section of the frame buffer to be filled. + * If the rectangle falls partly off-screen, then it is automatically trimmed. + * If a NULL value is passed, then the entire image is to be filled. + * @param Color The 32-bit colour with which the area is to be filled. The default is BS_RGB(0, 0, 0) (black) @remark Falls das Rechteck nicht völlig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt. - */ + */ virtual bool Fill(const BS_Rect * FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0)) = 0; - //@} - - //@{ - /** @name Debugging-Methoden */ + // Debugging Methods int GetFPSCount() const { return m_FPSCounter.GetFPS(); } int GetRepaintedPixels() const { return m_RepaintedPixels; } - //@} - - //@{ - /** @name Auskunfts-Methoden */ + // Access methods /** - @brief Gibt die Größe eines Pixeleintrages in Byte für ein bestimmtes Farbformat zurück - @param ColorFormat das gewünschte Farbformat. Der Parameter muss vom Typ COLOR_FORMATS sein. - @return Gibt die Größe eines Pixeleintrages in Byte des Farbsformates ColorFormat zurück.<br> - Falls das Farbformat unbekannt ist, wird -1 zurückgegeben. - */ - static int GetPixelSize(BS_GraphicEngine::COLOR_FORMATS ColorFormat) - { - switch (ColorFormat) - { + * Returns the size of a pixel entry in bytes for a particular colour format + * @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(BS_GraphicEngine::COLOR_FORMATS ColorFormat) { + switch (ColorFormat) { case BS_GraphicEngine::CF_RGB16: case BS_GraphicEngine::CF_RGB15: return 2; @@ -323,16 +285,14 @@ public: } /** - @brief Berechnet die Länge einer Bildzeile eines Bilder in Byte, abhängig vom Farbformat. - @param ColorFormat das Farbformat des Bildes. - @param Width die Länge einer Bildzeile in Pixel. - @return Gibt die Länge einer Bildzeile in Byte wieder.<br> - Falls das Farbformat unbekannt ist, wird -1 zurückgegeben. - */ - static int CalcPitch(BS_GraphicEngine::COLOR_FORMATS ColorFormat, int Width) - { - switch (ColorFormat) - { + * Calculates the length of an image line in bytes, depending on a given colour format. + * @param ColorFormat The colour format + * @param Width The width of the line in pixels + * @return Reflects the length of the line in bytes. If the colour format is + * unknown, -1 is returned + */ + static int CalcPitch(BS_GraphicEngine::COLOR_FORMATS ColorFormat, int Width) { + switch (ColorFormat){ case BS_GraphicEngine::CF_RGB16: case BS_GraphicEngine::CF_RGB15: return Width * 2; @@ -352,22 +312,20 @@ public: return -1; } - //@} - - // Persistenz Methoden + // Persistence Methods // ------------------- - virtual bool Persist(BS_OutputPersistenceBlock & Writer); - virtual bool Unpersist(BS_InputPersistenceBlock & Reader); + virtual bool Persist(BS_OutputPersistenceBlock &Writer); + virtual bool Unpersist(BS_InputPersistenceBlock &Reader); - static void ARGBColorToLuaColor(lua_State * L, unsigned int Color); - static unsigned int LuaColorToARGBColor(lua_State * L, int StackIndex); + static void ARGBColorToLuaColor(lua_State *L, unsigned int Color); + static unsigned int LuaColorToARGBColor(lua_State *L, int StackIndex); protected: - // Konstruktor + // Constructor // ----------- BS_GraphicEngine(BS_Kernel* pKernel); - // Display Variablen + // Display Variables // ----------------- int m_Width; int m_Height; @@ -375,27 +333,29 @@ protected: int m_BitDepth; bool m_Windowed; - // Debugging-Variablen + // Debugging Variables // ------------------- BS_Framecounter m_FPSCounter; unsigned int m_RepaintedPixels; /** - @brief Berechnet die Zeit die seit dem letzten Framebeginn vergangen ist. - */ + * Calculates the time since the last frame beginning has passed. + */ void UpdateLastFrameDuration(); private: bool RegisterScriptBindings(); - // LastFrameDuration-Variablen + // LastFrameDuration Variables // --------------------------- - uint64_t m_LastTimeStamp; + uint64 m_LastTimeStamp; unsigned int m_LastFrameDuration; bool m_TimerActive; - std::vector<unsigned int> m_FrameTimeSamples; + Common::Array<unsigned int> m_FrameTimeSamples; unsigned int m_FrameTimeSampleSlot; }; +} // End of namespace Sword25 + #endif |