[Scummvm-cvs-logs] CVS: residual driver.h,1.6,1.7 driver_gl.h,1.19,1.20 driver_gl.cpp,1.42,1.43 driver_tinygl.h,1.6,1.7 driver_tinygl.cpp,1.12,1.13 engine.cpp,1.68,1.69 main.cpp,1.47,1.48
Daniel Schepler
dschepler at users.sourceforge.net
Sun Mar 27 17:56:10 CEST 2005
- Previous message: [Scummvm-cvs-logs] CVS: web downloads.php,1.118,1.119
- Next message: [Scummvm-cvs-logs] CVS: residual actor.cpp,1.47,1.48 actor.h,1.22,1.23 lua.cpp,1.113,1.114 vector3d.h,1.9,1.10 walkplane.cpp,1.13,1.14 walkplane.h,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17892
Modified Files:
driver.h driver_gl.h driver_gl.cpp driver_tinygl.h
driver_tinygl.cpp engine.cpp main.cpp
Log Message:
Implement a fullscreen mode.
Index: driver.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- driver.h 20 Mar 2005 14:03:08 -0000 1.6
+++ driver.h 28 Mar 2005 01:54:21 -0000 1.7
@@ -32,7 +32,12 @@
class Driver {
public:
Driver() { ; }
- Driver(int screenW, int screenH, int screenBPP) { ; }
+ Driver(int screenW, int screenH, int screenBPP, bool fullscreen = false) {
+ _screenWidth = screenW;
+ _screenHeight = screenH;
+ _screenBPP = screenBPP;
+ _isFullscreen = fullscreen;
+ }
struct TextObjectHandle {
uint16 *bitmapData;
@@ -43,6 +48,8 @@
int height;
};
+ virtual void toggleFullscreenMode() = 0;
+
virtual void setupCamera(float fov, float nclip, float fclip, float roll) = 0;
virtual void positionCamera(Vector3d pos, Vector3d interest) = 0;
@@ -78,6 +85,10 @@
virtual void prepareSmushFrame(int width, int height, byte *bitmap) = 0;
virtual void drawSmushFrame(int offsetX, int offsetY) = 0;
+
+protected:
+ int _screenWidth, _screenHeight, _screenBPP;
+ bool _isFullscreen;
};
extern Driver *g_driver;
Index: driver_gl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- driver_gl.h 20 Mar 2005 14:03:08 -0000 1.19
+++ driver_gl.h 28 Mar 2005 01:54:21 -0000 1.20
@@ -31,11 +31,13 @@
class DriverGL : public Driver {
public:
- DriverGL(int screenW, int screenH, int screenBPP);
+ DriverGL(int screenW, int screenH, int screenBPP, bool fullscreen = false);
void setupCamera(float fov, float nclip, float fclip, float roll);
void positionCamera(Vector3d pos, Vector3d interest);
+ void toggleFullscreenMode();
+
void clearScreen();
void flipBuffer();
Index: driver_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- driver_gl.cpp 20 Mar 2005 18:43:56 -0000 1.42
+++ driver_gl.cpp 28 Mar 2005 01:54:21 -0000 1.43
@@ -20,7 +20,8 @@
#include "material.h"
#include "driver_gl.h"
-DriverGL::DriverGL(int screenW, int screenH, int screenBPP) {
+// Constructor. Should create the driver and open screens, etc.
+DriverGL::DriverGL(int screenW, int screenH, int screenBPP, bool fullscreen) {
char GLDriver[1024];
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
@@ -29,8 +30,15 @@
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- if (SDL_SetVideoMode(screenW, screenH, screenBPP, SDL_OPENGL) == 0)
+ Uint32 flags = SDL_OPENGL;
+ if (fullscreen)
+ flags |= SDL_FULLSCREEN;
+ if (SDL_SetVideoMode(screenW, screenH, screenBPP, flags) == 0)
error("Could not initialize video");
+ _screenWidth = screenW;
+ _screenHeight = screenH;
+ _screenBPP = screenBPP;
+ _isFullscreen = fullscreen;
sprintf(GLDriver, "Residual: %s/%s", glGetString(GL_VENDOR), glGetString(GL_RENDERER));
SDL_WM_SetCaption(GLDriver, "Residual");
@@ -41,6 +49,17 @@
_smushNumTex = 0;
}
+void DriverGL::toggleFullscreenMode() {
+ Uint32 flags = SDL_OPENGL;
+
+ if (! _isFullscreen)
+ flags |= SDL_FULLSCREEN;
+ if (SDL_SetVideoMode(_screenWidth, _screenHeight, _screenBPP, flags) == 0)
+ warning("Could not change fullscreen mode");
+ else
+ _isFullscreen = ! _isFullscreen;
+}
+
void DriverGL::setupCamera(float fov, float nclip, float fclip, float roll) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -289,7 +308,7 @@
GLuint *textures;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glOrtho(0, 640, 480, 0, 0, 1);
+ glOrtho(0, _screenWidth, _screenHeight, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_TEXTURE);
@@ -307,7 +326,7 @@
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glEnable(GL_SCISSOR_TEST);
- glScissor(bitmap->_x, 480 - (bitmap->_y + bitmap->_height), bitmap->_width, bitmap->_height);
+ glScissor(bitmap->_x, _screenHeight - (bitmap->_y + bitmap->_height), bitmap->_width, bitmap->_height);
int cur_tex_idx = bitmap->_numTex * (bitmap->_currImage - 1);
for (int y = bitmap->_y; y < (bitmap->_y + bitmap->_height); y += BITMAP_TEXTURE_SIZE) {
for (int x = bitmap->_x; x < (bitmap->_x + bitmap->_width); x += BITMAP_TEXTURE_SIZE) {
@@ -403,7 +422,7 @@
// }
if (y + h == 480) {
- glRasterPos2i(x, 479);
+ glRasterPos2i(x, _screenHeight - 1);
glBitmap(0, 0, 0, 0, 0, -1, NULL);
} else
glRasterPos2i(x, y + h);
@@ -465,7 +484,7 @@
// prepare view
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glOrtho(0, 640, 480, 0, 0, 1);
+ glOrtho(0, _screenWidth, _screenHeight, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_TEXTURE);
@@ -481,7 +500,7 @@
glDepthMask(GL_FALSE);
glEnable(GL_SCISSOR_TEST);
- glScissor(offsetX, 480 - (offsetY + _smushHeight), _smushWidth, _smushHeight);
+ glScissor(offsetX, _screenHeight - (offsetY + _smushHeight), _smushWidth, _smushHeight);
int curTexIdx = 0;
for (int y = 0; y < _smushHeight; y += BITMAP_TEXTURE_SIZE) {
@@ -523,7 +542,7 @@
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
- glOrtho(0, 640, 480, 0, 0, 1);
+ glOrtho(0, _screenWidth, _screenHeight, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
Index: driver_tinygl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_tinygl.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- driver_tinygl.h 20 Mar 2005 14:03:08 -0000 1.6
+++ driver_tinygl.h 28 Mar 2005 01:54:21 -0000 1.7
@@ -33,12 +33,13 @@
class DriverTinyGL : public Driver {
public:
- DriverTinyGL(int screenW, int screenH, int screenBPP);
+ DriverTinyGL(int screenW, int screenH, int screenBPP, bool fullscreen = false);
virtual ~DriverTinyGL();
void setupCamera(float fov, float nclip, float fclip, float roll);
void positionCamera(Vector3d pos, Vector3d interest);
+ void toggleFullscreenMode();
void clearScreen();
void flipBuffer();
Index: driver_tinygl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_tinygl.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- driver_tinygl.cpp 20 Mar 2005 18:43:56 -0000 1.12
+++ driver_tinygl.cpp 28 Mar 2005 01:54:21 -0000 1.13
@@ -93,10 +93,17 @@
tglTranslatef(-eyex, -eyey, -eyez);
}
-DriverTinyGL::DriverTinyGL(int screenW, int screenH, int screenBPP) {
- _screen = SDL_SetVideoMode(screenW, screenH, screenBPP, SDL_HWSURFACE);
+DriverTinyGL::DriverTinyGL(int screenW, int screenH, int screenBPP, bool fullscreen) {
+ Uint32 flags = SDL_HWSURFACE;
+ if (fullscreen)
+ flags |= SDL_FULLSCREEN;
+ _screen = SDL_SetVideoMode(screenW, screenH, screenBPP, flags);
if (_screen == NULL)
error("Could not initialize video");
+ _screenWidth = screenW;
+ _screenHeight = screenH;
+ _screenBPP = screenBPP;
+ _isFullscreen = fullscreen;
SDL_WM_SetCaption("Residual: Modified TinyGL - Software Renderer", "Residual");
@@ -116,6 +123,17 @@
ZB_close(_zb);
}
+void DriverTinyGL::toggleFullscreenMode() {
+ Uint32 flags = SDL_HWSURFACE;
+
+ if (! _isFullscreen)
+ flags |= SDL_FULLSCREEN;
+ if (SDL_SetVideoMode(_screenWidth, _screenHeight, _screenBPP, flags) == 0)
+ warning("Could not change fullscreen mode");
+ else
+ _isFullscreen = ! _isFullscreen;
+}
+
void DriverTinyGL::setupCamera(float fov, float nclip, float fclip, float roll) {
tglMatrixMode(TGL_PROJECTION);
tglLoadIdentity();
Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- engine.cpp 20 Mar 2005 16:54:42 -0000 1.68
+++ engine.cpp 28 Mar 2005 01:54:21 -0000 1.69
@@ -131,6 +131,10 @@
lua_endblock();
}
if (event.type == SDL_KEYDOWN) {
+ if ((event.key.keysym.sym == SDLK_RETURN ||
+ event.key.keysym.sym == SDLK_KP_ENTER) &&
+ (event.key.keysym.mod & KMOD_ALT))
+ g_driver->toggleFullscreenMode();
if (event.key.keysym.sym == SDLK_q)
return;
}
Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/main.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- main.cpp 12 Jan 2005 18:12:11 -0000 1.47
+++ main.cpp 28 Mar 2005 01:54:21 -0000 1.48
@@ -89,6 +89,7 @@
ZBUFFER_GLOBAL = parseBoolStr(g_registry->get("zbuffer"));
SHOWFPS_GLOBAL = parseBoolStr(g_registry->get("fps"));
TINYGL_GLOBAL = parseBoolStr(g_registry->get("soft"));
+ bool fullscreen = parseBoolStr(g_registry->get("fullscreen"));
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-zbuffer") == 0)
ZBUFFER_GLOBAL = true;
@@ -98,6 +99,10 @@
SHOWFPS_GLOBAL = true;
else if (strcmp(argv[i], "-nofps") == 0)
SHOWFPS_GLOBAL = false;
+ else if (strcmp(argv[i], "-fullscreen") == 0)
+ fullscreen = true;
+ else if (strcmp(argv[i], "-nofullscreen") == 0)
+ fullscreen = false;
else if (strcmp(argv[i], "-soft") == 0)
TINYGL_GLOBAL = true;
else if (strcmp(argv[i], "-nosoft") == 0)
@@ -108,6 +113,7 @@
printf("Recognised options:\n");
printf("\t-[no]zbuffer\t\tEnable/disable ZBuffers (Very slow on older cards)\n");
printf("\t-[no]fps\t\tEnable/disable fps display in upper right corner\n");
+ printf("\t-[no]fullscreen\tEnable/disable fullscreen mode at startup\n");
printf("\t-[no]soft\t\tEnable/disable software renderer\n");
exit(-1);
}
@@ -126,9 +132,9 @@
g_timer = new Timer();
g_smush = new Smush();
if (TINYGL_GLOBAL)
- g_driver = new DriverTinyGL(640, 480, 16);
+ g_driver = new DriverTinyGL(640, 480, 16, fullscreen);
else
- g_driver = new DriverGL(640, 480, 24);
+ g_driver = new DriverGL(640, 480, 24, fullscreen);
g_imuse = new Imuse(20);
Bitmap *splash_bm = g_resourceloader->loadBitmap("splash.bm");
- Previous message: [Scummvm-cvs-logs] CVS: web downloads.php,1.118,1.119
- Next message: [Scummvm-cvs-logs] CVS: residual actor.cpp,1.47,1.48 actor.h,1.22,1.23 lua.cpp,1.113,1.114 vector3d.h,1.9,1.10 walkplane.cpp,1.13,1.14 walkplane.h,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list