[Scummvm-cvs-logs] SF.net SVN: scummvm:[50795] scummvm/branches/gsoc2010-opengl/backends

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Sun Jul 11 00:47:29 CEST 2010


Revision: 50795
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50795&view=rev
Author:   vgvgf
Date:     2010-07-10 22:47:29 +0000 (Sat, 10 Jul 2010)

Log Message:
-----------
Added BaseSdlGraphicsManager. Added GLTexture. 

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/glerrorcheck.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/glerrorcheck.h
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
    scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h

Added Paths:
-----------
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.h
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/basesdl-graphics.h

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/glerrorcheck.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/glerrorcheck.cpp	2010-07-10 22:27:28 UTC (rev 50794)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/glerrorcheck.cpp	2010-07-10 22:47:29 UTC (rev 50795)
@@ -34,7 +34,7 @@
 #include <GL/gl.h>
 #endif
 
-static const char* getGlErrStr(GLenum error) {
+static const char *getGlErrStr(GLenum error) {
 	switch (error) {
 	case GL_NO_ERROR:		   return "GL_NO_ERROR";
 	case GL_INVALID_ENUM:	   return "GL_INVALID_ENUM";
@@ -49,7 +49,7 @@
 	return buf;
 }
 
-void checkGlError(const char* file, int line) {
+void checkGlError(const char *file, int line) {
 	GLenum error = glGetError();
 	if (error != GL_NO_ERROR)
 		warning("%s:%d: GL error: %s", file, line, getGlErrStr(error));

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/glerrorcheck.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/glerrorcheck.h	2010-07-10 22:27:28 UTC (rev 50794)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/glerrorcheck.h	2010-07-10 22:47:29 UTC (rev 50795)
@@ -33,6 +33,6 @@
 // If in debug, check for an error after a GL call
 #define CHECK_GL_ERROR(call) ((call), checkGlError(__FILE__, __LINE__))
 
-void checkGlError(const char* file, int line);
+void checkGlError(const char *file, int line);
 
 #endif

Added: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.cpp	2010-07-10 22:47:29 UTC (rev 50795)
@@ -0,0 +1,173 @@
+/* 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$
+ *
+ */
+
+#include "backends/graphics/opengl/gltexture.h"
+#include "backends/graphics/opengl/glerrorcheck.h"
+
+#include "common/rect.h"
+#include "common/array.h"
+#include "common/util.h"
+#include "common/tokenizer.h"
+
+// Supported GL extensions
+static bool npot_supported = false;
+
+static inline GLint xdiv(int numerator, int denominator) {
+	assert(numerator < (1 << 16));
+	return (numerator << 16) / denominator;
+}
+
+template <class T>
+static T nextHigher2(T k) {
+	if (k == 0)
+		return 1;
+	--k;
+	for (uint i = 1; i < sizeof(T) * CHAR_BIT; i <<= 1)
+		k = k | k >> i;
+	return k + 1;
+}
+
+void GLTexture::initGLExtensions() {
+	const char* ext_string =
+		reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
+	Common::StringTokenizer tokenizer(ext_string, " ");
+	while (!tokenizer.empty()) {
+		Common::String token = tokenizer.nextToken();
+		if (token == "GL_ARB_texture_non_power_of_two")
+			npot_supported = true;
+	}
+}
+
+GLTexture::GLTexture() :
+	_textureWidth(0),
+	_textureHeight(0) {
+
+	refresh();
+
+	// This all gets reset later in allocBuffer:
+	_surface.w = 0;
+	_surface.h = 0;
+	_surface.pitch = 0;
+	_surface.pixels = NULL;
+	_surface.bytesPerPixel = 0;
+}
+
+GLTexture::~GLTexture() {
+	debug("Destroying texture %u", _textureName);
+	CHECK_GL_ERROR( glDeleteTextures(1, &_textureName) );
+}
+
+void GLTexture::refresh() {
+	// Generates the texture ID for GL
+	CHECK_GL_ERROR( glGenTextures(1, &_textureName) );
+}
+
+void GLTexture::allocBuffer(GLuint w, GLuint h) {
+	int bpp = bytesPerPixel();
+	_surface.w = w;
+	_surface.h = h;
+	_surface.bytesPerPixel = bpp;
+
+	if (w <= _textureWidth && h <= _textureHeight)
+		// Already allocated a sufficiently large buffer
+		return;
+
+	if (npot_supported) {
+		_textureWidth = _surface.w;
+		_textureHeight = _surface.h;
+	} else {
+		_textureWidth = nextHigher2(_surface.w);
+		_textureHeight = nextHigher2(_surface.h);
+	}
+	_surface.pitch = _textureWidth * bpp;
+
+	_surface.create(w, h, bytesPerPixel());
+
+	// Allocate room for the texture now, but pixel data gets uploaded
+	// later (perhaps with multiple TexSubImage2D operations).
+	CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, _textureName) );
+	CHECK_GL_ERROR( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) );
+	CHECK_GL_ERROR( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) );
+	CHECK_GL_ERROR( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) );
+	CHECK_GL_ERROR( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) );
+	CHECK_GL_ERROR( glTexImage2D(GL_TEXTURE_2D, 0, glFormat(),
+		     _textureWidth, _textureHeight,
+		     0, glFormat(), glType(), NULL) );
+}
+
+void GLTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, const void* buf, int pitch) {
+	CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, _textureName) );
+
+	if (static_cast<int>(w) * bytesPerPixel() == pitch) {
+		CHECK_GL_ERROR( glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h,
+						glFormat(), glType(), buf) );
+		memcpy(_surface.pixels, buf, w * pitch);
+	} else {
+		// GLES removed the ability to specify pitch, so we
+		// have to do this row by row.
+		const byte* src = static_cast<const byte*>(buf);
+		do {
+			CHECK_GL_ERROR( glTexSubImage2D(GL_TEXTURE_2D, 0, x, y,
+							w, 1, glFormat(), glType(), src) );
+			memcpy(_surface.pixels, src, pitch);
+			++y;
+			src += pitch;
+		} while (--h);
+	}
+}
+
+void GLTexture::fillBuffer(byte x) {
+	byte* tmpbuf = new byte[_surface.h * _surface.w * bytesPerPixel()];
+	memset(tmpbuf, 0, _surface.h * _surface.w * bytesPerPixel());
+	CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, _textureName) );
+	CHECK_GL_ERROR( glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _surface.w, _surface.h,
+					glFormat(), glType(), tmpbuf) );
+	delete[] tmpbuf;
+}
+
+void GLTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
+	CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, _textureName) );
+
+	const GLint tex_width = xdiv(_surface.w, _textureWidth);
+	const GLint tex_height = xdiv(_surface.h, _textureHeight);
+	const GLint texcoords[] = {
+		0, 0,
+		tex_width, 0,
+		0, tex_height,
+		tex_width, tex_height,
+	};
+	CHECK_GL_ERROR( glTexCoordPointer(2, GL_INT, 0, texcoords) );
+
+	const GLshort vertices[] = {
+		x,	   y,
+		x + w, y,
+		x,	   y + h,
+		x + w, y + h,
+	};
+	CHECK_GL_ERROR( glVertexPointer(2, GL_SHORT, 0, vertices) );
+
+	assert(ARRAYSIZE(vertices) == ARRAYSIZE(texcoords));
+	CHECK_GL_ERROR( glDrawArrays(GL_TRIANGLE_STRIP, 0, ARRAYSIZE(vertices) / 2) );
+}


Property changes on: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.h	                        (rev 0)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.h	2010-07-10 22:47:29 UTC (rev 50795)
@@ -0,0 +1,112 @@
+/* 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$
+ *
+ */
+
+#ifdef WIN32
+#if defined(ARRAYSIZE) && !defined(_WINDOWS_)
+#undef ARRAYSIZE
+#endif
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef ARRAYSIZE
+#endif
+
+#ifdef USE_GLES
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+#else
+#include <GL/gl.h>
+#include <GL/glext.h>
+#endif
+
+#include "graphics/surface.h"
+
+#include "common/rect.h"
+#include "common/array.h"
+
+/**
+ * OpenGL texture manager class
+ */
+class GLTexture {
+public:
+	static void initGLExtensions();
+
+	GLTexture();
+	virtual ~GLTexture();
+
+	virtual void refresh();
+
+	virtual void allocBuffer(GLuint width, GLuint height);
+	virtual void fillBuffer(byte x);
+	virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
+							  const void* buf, int pitch);
+
+	virtual void drawTexture() { drawTexture(0, 0, _surface.w, _surface.h); }
+	virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
+
+	const Graphics::Surface* getSurface() const { return &_surface; }
+
+	GLuint getWidth() const { return _surface.w; }
+	GLuint getHeight() const { return _surface.h; }
+	GLuint getTextureName() const { return _textureName; }
+
+protected:
+	virtual byte bytesPerPixel() const = 0;
+	virtual GLenum glFormat() const = 0;
+	virtual GLenum glType() const = 0;
+	Graphics::Surface _surface;
+	GLuint _textureName;
+	GLuint _textureWidth;
+	GLuint _textureHeight;
+};
+
+/**
+ * OpenGL RGBA 32 bit texture
+ */
+class GL32Texture : public GLTexture {
+protected:
+	virtual byte bytesPerPixel() const { return 4; }
+	virtual GLenum glFormat() const { return GL_RGBA; }
+	virtual GLenum glType() const { return GL_UNSIGNED_BYTE; }
+};
+
+/**
+ * OpenGL RGBA4444 texture
+ */
+class GL4444Texture : public GLTexture {
+protected:
+	virtual byte bytesPerPixel() const { return 2; }
+	virtual GLenum glFormat() const { return GL_RGBA; }
+	virtual GLenum glType() const { return GL_UNSIGNED_SHORT_4_4_4_4; }
+};
+
+/**
+ * OpenGL RGB565 texture
+ */
+class GL565Texture : public GLTexture {
+protected:
+	virtual byte bytesPerPixel() const { return 2; }
+	virtual GLenum glFormat() const { return GL_RGB; }
+	virtual GLenum glType() const { return GL_UNSIGNED_SHORT_5_6_5; }
+};


Property changes on: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-07-10 22:27:28 UTC (rev 50794)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-07-10 22:47:29 UTC (rev 50795)
@@ -24,15 +24,21 @@
  */
 
 #include "backends/graphics/opengl/opengl-graphics.h"
+#include "common/mutex.h"
 
-OpenGLGraphicsManager::OpenGLGraphicsManager() {
-
+OpenGLGraphicsManager::OpenGLGraphicsManager()
+	:
+	_gameTexture(0), _overlayTexture(0), _mouseTexture(0) 	{
 }
 
 OpenGLGraphicsManager::~OpenGLGraphicsManager() {
 
 }
 
+void OpenGLGraphicsManager::init() {
+
+}
+
 //
 // Feature
 //
@@ -63,7 +69,7 @@
 }
 
 int OpenGLGraphicsManager::getDefaultGraphicsMode() const {
-	return 0;
+	return GFX_NORMAL;
 }
 
 bool OpenGLGraphicsManager::setGraphicsMode(int mode) {
@@ -226,3 +232,23 @@
 void OpenGLGraphicsManager::displayMessageOnOSD(const char *msg) {
 
 }
+
+//
+// Intern
+//
+
+void OpenGLGraphicsManager::internUpdateScreen() {
+
+}
+
+bool OpenGLGraphicsManager::loadGFXMode() {
+	return false;
+}
+
+void OpenGLGraphicsManager::unloadGFXMode() {
+
+}
+
+bool OpenGLGraphicsManager::hotswapGFXMode() {
+	return false;
+}

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h	2010-07-10 22:27:28 UTC (rev 50794)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h	2010-07-10 22:47:29 UTC (rev 50795)
@@ -26,10 +26,9 @@
 #ifndef BACKENDS_GRAPHICS_OPENGL_H
 #define BACKENDS_GRAPHICS_OPENGL_H
 
+#include "backends/graphics/opengl/gltexture.h"
 #include "backends/graphics/graphics.h"
 
-#include "graphics/surface.h"
-
 enum {
 	GFX_NORMAL = 0,
 };
@@ -42,6 +41,8 @@
 	OpenGLGraphicsManager();
 	virtual ~OpenGLGraphicsManager();
 
+	virtual void init();
+
 	virtual bool hasFeature(OSystem::Feature f);
 	virtual void setFeatureState(OSystem::Feature f, bool enable);
 	virtual bool getFeatureState(OSystem::Feature f);
@@ -91,7 +92,17 @@
 	virtual void displayMessageOnOSD(const char *msg);
 
 protected:
+	GLTexture* _gameTexture;
+	GLTexture* _overlayTexture;
+	GLTexture* _mouseTexture;
+
+
 	Graphics::Surface _lockedScreen;
+
+	virtual void internUpdateScreen();
+	virtual bool loadGFXMode();
+	virtual void unloadGFXMode();
+	virtual bool hotswapGFXMode();
 };
 
 #endif

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp	2010-07-10 22:27:28 UTC (rev 50794)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp	2010-07-10 22:47:29 UTC (rev 50795)
@@ -25,11 +25,10 @@
 
 #include "backends/graphics/openglsdl/openglsdl-graphics.h"
 
-#include <SDL.h>
-#include <SDL_opengl.h>
+OpenGLSDLGraphicsManager::OpenGLSDLGraphicsManager()
+	:
+	_hwscreen(0) {
 
-OpenGLSDLGraphicsManager::OpenGLSDLGraphicsManager() {
-
 }
 
 OpenGLSDLGraphicsManager::~OpenGLSDLGraphicsManager() {
@@ -41,6 +40,8 @@
 		error("Could not initialize SDL: %s", SDL_GetError());
 	}
 
+	SDL_ShowCursor(SDL_DISABLE);
+
 	OpenGLGraphicsManager::init();
 }
 
@@ -71,3 +72,23 @@
 bool OpenGLSDLGraphicsManager::saveScreenshot(const char *filename) {
 	return false;
 }
+
+//
+// Protected
+//
+
+bool OpenGLSDLGraphicsManager::loadGFXMode() {
+	return false;
+}
+
+void OpenGLSDLGraphicsManager::unloadGFXMode() {
+
+}
+
+bool OpenGLSDLGraphicsManager::hotswapGFXMode() {
+	return false;
+}
+
+void OpenGLSDLGraphicsManager::internUpdateScreen() {
+	
+}

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h	2010-07-10 22:27:28 UTC (rev 50794)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h	2010-07-10 22:47:29 UTC (rev 50795)
@@ -26,6 +26,12 @@
 #ifndef BACKENDS_GRAPHICS_OPENGLSDL_H
 #define BACKENDS_GRAPHICS_OPENGLSDL_H
 
+#include <SDL.h>
+#if defined(ARRAYSIZE) && !defined(_WINDOWS_)
+#undef ARRAYSIZE
+#endif
+#include <SDL_opengl.h>
+
 #include "backends/graphics/opengl/opengl-graphics.h"
 
 /**
@@ -45,6 +51,16 @@
 	virtual void setMousePos(int x, int y);
 	virtual void toggleFullScreen();
 	virtual bool saveScreenshot(const char *filename);
+
+protected:
+	virtual void internUpdateScreen();
+
+	virtual bool loadGFXMode();
+	virtual void unloadGFXMode();
+	virtual bool hotswapGFXMode();
+
+	// Hardware screen
+	SDL_Surface *_hwscreen;
 };
 
 #endif

Added: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/basesdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/basesdl-graphics.h	                        (rev 0)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/basesdl-graphics.h	2010-07-10 22:47:29 UTC (rev 50795)
@@ -0,0 +1,79 @@
+/* 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 BACKENDS_GRAPHICS_BASESDL_H
+#define BACKENDS_GRAPHICS_BASESDL_H
+
+#include "backends/graphics/graphics.h"
+
+#if defined(__SYMBIAN32__)
+#include <esdl\SDL.h>
+#else
+#include <SDL.h>
+#endif
+
+/**
+ * Base SDL graphics manager, contains common functions
+ * used by other SDL managers
+ */
+class BaseSdlGraphicsManager : public GraphicsManager {
+public:
+	/**
+	 * Marks the screen for a full redraw
+	 */
+	virtual void forceFullRedraw() = 0;
+
+	/**
+	 * Handles the scalar hotkeys
+	 */
+	virtual bool handleScalerHotkeys(const SDL_KeyboardEvent &key) = 0;
+
+	/**
+	 * Returns if the event passed is a hotkey for the graphics scalers
+	 */
+	virtual bool isScalerHotkey(const Common::Event &event) = 0;
+
+	/**
+	 * Adjusts mouse event coords for the current scaler
+	 */
+	virtual void adjustMouseEvent(Common::Event &event) = 0;
+
+	/**
+	 * Updates the mouse cursor position
+	 */
+	virtual void setMousePos(int x, int y) = 0;
+
+	/**
+	 * Toggles fullscreen
+	 */
+	virtual void toggleFullScreen() = 0;
+
+	/**
+	 * Saves a screenshot to a file
+	 */
+	virtual bool saveScreenshot(const char *filename) = 0;
+};
+
+#endif


Property changes on: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/basesdl-graphics.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h	2010-07-10 22:27:28 UTC (rev 50794)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h	2010-07-10 22:47:29 UTC (rev 50795)
@@ -26,16 +26,10 @@
 #ifndef BACKENDS_GRAPHICS_SDL_H
 #define BACKENDS_GRAPHICS_SDL_H
 
-#include "backends/graphics/graphics.h"
+#include "backends/graphics/sdl/basesdl-graphics.h"
 #include "common/system.h"
 #include "graphics/scaler.h"
 
-#if defined(__SYMBIAN32__)
-#include <esdl\SDL.h>
-#else
-#include <SDL.h>
-#endif
-
 #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
 // Uncomment this to enable the 'on screen display' code.
 #define USE_OSD	1
@@ -72,7 +66,7 @@
 /**
  * SDL graphics manager
  */
-class SdlGraphicsManager : public GraphicsManager {
+class SdlGraphicsManager : public BaseSdlGraphicsManager {
 public:
 	SdlGraphicsManager();
 	virtual ~SdlGraphicsManager();
@@ -127,39 +121,12 @@
 	virtual void displayMessageOnOSD(const char *msg);
 #endif
 
-	/**
-	 * Marks the screen for a full redraw
-	 */
 	virtual void forceFullRedraw();
-
-	/**
-	 * Handles the scalar hotkeys
-	 */
 	virtual bool handleScalerHotkeys(const SDL_KeyboardEvent &key);
-
-	/**
-	 * Returns if the event passed is a hotkey for the graphics scalers
-	 */
 	virtual bool isScalerHotkey(const Common::Event &event);
-
-	/**
-	 * Adjusts mouse event coords for the current scaler
-	 */
 	virtual void adjustMouseEvent(Common::Event &event);
-
-	/**
-	 * Updates the mouse cursor position
-	 */
 	virtual void setMousePos(int x, int y);
-
-	/**
-	 * Toggles fullscreen
-	 */
 	virtual void toggleFullScreen();
-
-	/**
-	 * Saves a screenshot to a file
-	 */
 	virtual bool saveScreenshot(const char *filename);
 
 protected:

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp	2010-07-10 22:27:28 UTC (rev 50794)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp	2010-07-10 22:47:29 UTC (rev 50795)
@@ -32,6 +32,8 @@
 #include "backends/events/sdl/sdl-events.h"
 #include "backends/mutex/sdl/sdl-mutex.h"
 #include "backends/timer/sdl/sdl-timer.h"
+//#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/openglsdl/openglsdl-graphics.h"
 
 #include "icons/scummvm.xpm"
 
@@ -81,9 +83,14 @@
 		_mixerManager->init();
 	}
 
-	if (_graphicsManager == 0)
-		_graphicsManager = new SdlGraphicsManager();
+	if (_graphicsManager == 0) {
+		// Changed to OpenGL for testing
+		//_graphicsManager = new SdlGraphicsManager();
+		_graphicsManager = new OpenGLSDLGraphicsManager();
 
+		((OpenGLSDLGraphicsManager *)_graphicsManager)->init();
+	}
+
 	if (_audiocdManager == 0)
 		_audiocdManager = new SdlAudioCDManager();
 
@@ -234,9 +241,9 @@
 	free(icon);
 }
 
-SdlGraphicsManager *OSystem_SDL::getGraphicsManager() {
+BaseSdlGraphicsManager *OSystem_SDL::getGraphicsManager() {
 	assert(_graphicsManager);
-	return (SdlGraphicsManager *)_graphicsManager;
+	return (BaseSdlGraphicsManager *)_graphicsManager;
 }
 
 bool OSystem_SDL::pollEvent(Common::Event &event) {

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h	2010-07-10 22:27:28 UTC (rev 50794)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h	2010-07-10 22:47:29 UTC (rev 50795)
@@ -33,7 +33,7 @@
 #endif
 
 #include "backends/modular-backend.h"
-#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/sdl/basesdl-graphics.h"
 #include "backends/mixer/sdl/sdl-mixer.h"
 
 /** 
@@ -54,7 +54,7 @@
 	/**
 	 * Get the Graphics Manager instance. Used by other managers.
 	 */
-	virtual SdlGraphicsManager *getGraphicsManager();
+	virtual BaseSdlGraphicsManager *getGraphicsManager();
 
 	/**
 	 * Get the Mixer Manager instance. Not to confuse with getMixer(),


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