[Scummvm-cvs-logs] SF.net SVN: scummvm:[53476] scummvm/trunk/engines/sword25/gfx

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Oct 15 14:17:20 CEST 2010


Revision: 53476
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53476&view=rev
Author:   fingolfin
Date:     2010-10-15 12:17:20 +0000 (Fri, 15 Oct 2010)

Log Message:
-----------
SWORD25: Adapted a few things to our code formatting conventions; translated rest of graphicengine.h to german

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/graphicengine.cpp
    scummvm/trunk/engines/sword25/gfx/graphicengine.h

Modified: scummvm/trunk/engines/sword25/gfx/graphicengine.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine.cpp	2010-10-15 12:16:57 UTC (rev 53475)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine.cpp	2010-10-15 12:17:20 UTC (rev 53476)
@@ -73,9 +73,9 @@
 static const uint FRAMETIME_SAMPLE_COUNT = 5;       // Anzahl der Framezeiten \xFCber die, die Framezeit gemittelt wird
 
 GraphicEngine::GraphicEngine(Kernel *pKernel) :
-	m_Width(0),
-	m_Height(0),
-	m_BitDepth(0),
+	_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),
@@ -102,41 +102,42 @@
 	return new GraphicEngine(pKernel);
 }
 
-bool GraphicEngine::Init(int Width, int Height, int BitDepth, int BackbufferCount, bool Windowed) {
+bool GraphicEngine::Init(int width, int height, int bitDepth, int backbufferCount, bool isWindowed) {
 	// Warnung ausgeben, wenn eine nicht unterst\xFCtzte Bittiefe gew\xE4hlt 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);
-		m_BitDepth = BIT_DEPTH;
+	if (bitDepth != BIT_DEPTH) {
+		BS_LOG_WARNINGLN("Can't use a bit depth of %d (not supported). Falling back to %d.", bitDepth, BIT_DEPTH);
+		_bitDepth = BIT_DEPTH;
 	}
 
 	// Warnung ausgeben, wenn nicht genau ein Backbuffer gew\xE4hlt wurde.
-	if (BackbufferCount != BACKBUFFER_COUNT) {
-		BS_LOG_WARNINGLN("Can't use %d backbuffers (not supported). Falling back to %d.", BackbufferCount, BACKBUFFER_COUNT);
-		BackbufferCount = BACKBUFFER_COUNT;
+	if (backbufferCount != BACKBUFFER_COUNT) {
+		BS_LOG_WARNINGLN("Can't use %d backbuffers (not supported). Falling back to %d.", backbufferCount, BACKBUFFER_COUNT);
+		backbufferCount = BACKBUFFER_COUNT;
 	}
 
 	// Parameter in lokale Variablen kopieren
-	m_Width = Width;
-	m_Height = Height;
-	m_BitDepth = BitDepth;
-	m_Windowed = Windowed;
-	m_ScreenRect.left = 0;
-	m_ScreenRect.top = 0;
-	m_ScreenRect.right = m_Width;
-	m_ScreenRect.bottom = m_Height;
+	_width = width;
+	_height = height;
+	_bitDepth = bitDepth;
+	m_Windowed = isWindowed;
+	_screenRect.left = 0;
+	_screenRect.top = 0;
+	_screenRect.right = _width;
+	_screenRect.bottom = _height;
 
-	_backSurface.create(Width, Height, 4);
-	_frameBuffer.create(Width, Height, 4);
+	_backSurface.create(width, height, 4);
+	_frameBuffer.create(width, height, 4);
 
 	// Standardm\xE4\xDFig ist Vsync an.
 	SetVsync(true);
 
 	// Layer-Manager initialisieren.
-	_renderObjectManagerPtr.reset(new RenderObjectManager(Width, Height, BackbufferCount + 1));
+	_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()) return false;
+	m_MainPanelPtr = _renderObjectManagerPtr->getTreeRoot()->addPanel(width, height, BS_ARGB(0, 0, 0, 0));
+	if (!m_MainPanelPtr.isValid())
+		return false;
 	m_MainPanelPtr->setVisible(true);
 
 	return true;
@@ -227,7 +228,7 @@
 // -----------------------------------------------------------------------------
 
 bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
-	Common::Rect rect(m_Width - 1, m_Height - 1);
+	Common::Rect rect(_width - 1, _height - 1);
 
 	if (fillRectPtr) {
 		rect = *fillRectPtr;
@@ -251,19 +252,19 @@
 // RESOURCE MANAGING
 // -----------------------------------------------------------------------------
 
-Resource *GraphicEngine::loadResource(const Common::String &FileName) {
-	BS_ASSERT(canLoadResource(FileName));
+Resource *GraphicEngine::loadResource(const Common::String &filename) {
+	BS_ASSERT(canLoadResource(filename));
 
-	// Bild f\xFCr den Softwarebuffer laden
-	if (FileName.hasSuffix("_s.png")) {
+	// Load image for "software buffer" (FIXME: Whatever that means?)
+	if (filename.hasSuffix("_s.png")) {
 		bool Result = false;
-		SWImage *pImage = new SWImage(FileName, Result);
+		SWImage *pImage = new SWImage(filename, Result);
 		if (!Result) {
 			delete pImage;
 			return 0;
 		}
 
-		BitmapResource *pResource = new BitmapResource(FileName, pImage);
+		BitmapResource *pResource = new BitmapResource(filename, pImage);
 		if (!pResource->isValid()) {
 			delete pResource;
 			return 0;
@@ -272,16 +273,16 @@
 		return pResource;
 	}
 
-	// Sprite-Bild laden
-	if (FileName.hasSuffix(".png") || FileName.hasSuffix(".b25s")) {
+	// Load sprite image
+	if (filename.hasSuffix(".png") || filename.hasSuffix(".b25s")) {
 		bool Result = false;
-		RenderedImage *pImage = new RenderedImage(FileName, Result);
+		RenderedImage *pImage = new RenderedImage(filename, Result);
 		if (!Result) {
 			delete pImage;
 			return 0;
 		}
 
-		BitmapResource *pResource = new BitmapResource(FileName, pImage);
+		BitmapResource *pResource = new BitmapResource(filename, pImage);
 		if (!pResource->isValid()) {
 			delete pResource;
 			return 0;
@@ -291,9 +292,9 @@
 	}
 
 
-	// Vectorgraphik laden
-	if (FileName.hasSuffix(".swf")) {
-		debug(2, "VectorImage: %s", FileName.c_str());
+	// Load vector graphics
+	if (filename.hasSuffix(".swf")) {
+		debug(2, "VectorImage: %s", filename.c_str());
 
 		// Pointer auf Package-Manager holen
 		PackageManager *pPackage = Kernel::GetInstance()->GetPackage();
@@ -302,20 +303,20 @@
 		// Datei laden
 		byte *pFileData;
 		uint FileSize;
-		if (!(pFileData = static_cast<byte *>(pPackage->getFile(FileName, &FileSize)))) {
-			BS_LOG_ERRORLN("File \"%s\" could not be loaded.", FileName.c_str());
+		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);
+		VectorImage *pImage = new VectorImage(pFileData, FileSize, Result, filename);
 		if (!Result) {
 			delete pImage;
 			delete [] pFileData;
 			return 0;
 		}
 
-		BitmapResource *pResource = new BitmapResource(FileName, pImage);
+		BitmapResource *pResource = new BitmapResource(filename, pImage);
 		if (!pResource->isValid()) {
 			delete pResource;
 			delete[] pFileData;
@@ -326,9 +327,9 @@
 		return pResource;
 	}
 
-	// Animation laden
-	if (FileName.hasSuffix("_ani.xml")) {
-		AnimationResource *pResource = new AnimationResource(FileName);
+	// Load animation
+	if (filename.hasSuffix("_ani.xml")) {
+		AnimationResource *pResource = new AnimationResource(filename);
 		if (pResource->isValid())
 			return pResource;
 		else {
@@ -337,9 +338,9 @@
 		}
 	}
 
-	// Font laden
-	if (FileName.hasSuffix("_fnt.xml")) {
-		FontResource *pResource = new FontResource(Kernel::GetInstance(), FileName);
+	// Load font
+	if (filename.hasSuffix("_fnt.xml")) {
+		FontResource *pResource = new FontResource(Kernel::GetInstance(), filename);
 		if (pResource->IsValid())
 			return pResource;
 		else {
@@ -348,18 +349,18 @@
 		}
 	}
 
-	BS_LOG_ERRORLN("Service cannot load \"%s\".", FileName.c_str());
+	BS_LOG_ERRORLN("Service cannot load \"%s\".", filename.c_str());
 	return 0;
 }
 
 // -----------------------------------------------------------------------------
 
-bool GraphicEngine::canLoadResource(const Common::String &FileName) {
-	return FileName.hasSuffix(".png") ||
-		FileName.hasSuffix("_ani.xml") ||
-		FileName.hasSuffix("_fnt.xml") ||
-		FileName.hasSuffix(".swf") ||
-		FileName.hasSuffix(".b25s");
+bool GraphicEngine::canLoadResource(const Common::String &filename) {
+	return filename.hasSuffix(".png") ||
+		filename.hasSuffix("_ani.xml") ||
+		filename.hasSuffix("_fnt.xml") ||
+		filename.hasSuffix(".swf") ||
+		filename.hasSuffix(".b25s");
 }
 
 
@@ -394,14 +395,14 @@
 }
 
 namespace {
-bool DoSaveScreenshot(GraphicEngine &graphicEngine, const Common::String &Filename) {
+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;
 	}
 
-	Common::FSNode f(Filename);
+	Common::FSNode f(filename);
 	Common::WriteStream *stream = f.createWriteStream();
 	if (!stream) {
 		BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot.");
@@ -415,11 +416,11 @@
 }
 }
 
-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;

Modified: scummvm/trunk/engines/sword25/gfx/graphicengine.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine.h	2010-10-15 12:16:57 UTC (rev 53475)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine.h	2010-10-15 12:17:20 UTC (rev 53476)
@@ -64,21 +64,18 @@
 class Screenshot;
 class RenderObjectManager;
 
-// Typen
+// Types
 typedef uint BS_COLOR;
 
-// Makros
+// 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))
 
 /**
-    @brief Dies ist das Graphik-Engine Interface, dass alle Methoden und Klassen enth\xE4lt, die eine Graphik-Engine implementieren muss.
-
-    Hier sind nur wenige Rumpffunktionen realisiert, wie z.B. das Abfragen der Parameter des Ausgabepuffers.
-    Die Hauptfunktionen muss eine Implementation dieses Inferfaces stellen.<br>
-    Die bisher einzige Implementation ist BS_DDrawGfx.
-*/
-
+ * This is the graphics engine. Unlike the original code, this is not
+ * an interface that needs to be subclasses, but rather already contains
+ * all required functionality.
+ */
 class GraphicEngine : public ResourceService, public Persistable {
 public:
 	// Enums
@@ -115,8 +112,10 @@
 	// ---------
 
 	/**
-	 * 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.
+	 * Initialises the graphics engine and sets the screen mode. Returns
+	 * true if initialisation failed.
+	 * @note 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
@@ -220,28 +219,28 @@
 	 * Returns the width of the output buffer in pixels
 	 */
 	int         GetDisplayWidth() const {
-		return m_Width;
+		return _width;
 	}
 
 	/**
 	 * Returns the height of the output buffer in pixels
 	 */
 	int         GetDisplayHeight() const {
-		return m_Height;
+		return _height;
 	}
 
 	/**
 	 * Returns the bounding box of the output buffer: (0, 0, Width, Height)
 	 */
 	Common::Rect    &GetDisplayRect() {
-		return m_ScreenRect;
+		return _screenRect;
 	}
 
 	/**
 	 * Returns the bit depth of the output buffer
 	 */
 	int         GetBitDepth() {
-		return m_BitDepth;
+		return _bitDepth;
 	}
 
 	/**
@@ -271,7 +270,7 @@
 	 * 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\xF6llig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt.
+	 * @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));
 
@@ -345,10 +344,10 @@
 
 	// Display Variables
 	// -----------------
-	int     m_Width;
-	int     m_Height;
-	Common::Rect m_ScreenRect;
-	int     m_BitDepth;
+	int     _width;
+	int     _height;
+	Common::Rect _screenRect;
+	int     _bitDepth;
 	bool    m_Windowed;
 
 	// Debugging Variables


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list