[Scummvm-cvs-logs] scummvm master -> 323899d70baaf76a9ad51713f9c0f36f5c8d3def

lordhoto lordhoto at gmail.com
Mon Mar 5 20:48:15 CET 2012


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
dec6082590 IPHONE: Prefix all global variables with "g_".
323899d70b IPOHNE: Move touch related global variables to iPhoneView.


Commit: dec6082590a16e1b440f66a78724521cc85c6cf4
    https://github.com/scummvm/scummvm/commit/dec6082590a16e1b440f66a78724521cc85c6cf4
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-03-05T11:44:41-08:00

Commit Message:
IPHONE: Prefix all global variables with "g_".

Changed paths:
    backends/platform/iphone/iphone_main.mm
    backends/platform/iphone/iphone_video.mm



diff --git a/backends/platform/iphone/iphone_main.mm b/backends/platform/iphone/iphone_main.mm
index 20406e6..e76ffe8 100644
--- a/backends/platform/iphone/iphone_main.mm
+++ b/backends/platform/iphone/iphone_main.mm
@@ -41,12 +41,12 @@ void iphone_main(int argc, char *argv[]);
 - (void)didRotate:(NSNotification *)notification;
 @end
 
-static int gArgc;
-static char **gArgv;
+static int g_argc;
+static char **g_argv;
 
 int main(int argc, char **argv) {
-	gArgc = argc;
-	gArgv = argv;
+	g_argc = argc;
+	g_argv = argv;
 
 	NSAutoreleasePool *autoreleasePool = [
 		[NSAutoreleasePool alloc] init
@@ -69,7 +69,7 @@ int main(int argc, char **argv) {
 - (void)mainLoop:(id)param {
 	[[NSAutoreleasePool alloc] init];
 
-	iphone_main(gArgc, gArgv);
+	iphone_main(g_argc, g_argv);
 	exit(0);
 }
 
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
index 04aaf59..1c86a20 100644
--- a/backends/platform/iphone/iphone_video.mm
+++ b/backends/platform/iphone/iphone_video.mm
@@ -28,17 +28,17 @@
 #include "graphics/colormasks.h"
 
 iPhoneView *g_iPhoneViewInstance = nil;
-static int _fullWidth;
-static int _fullHeight;
+static int g_fullWidth;
+static int g_fullHeight;
 
-static int _needsScreenUpdate = 0;
+static int g_needsScreenUpdate = 0;
 
-static UITouch *_firstTouch = NULL;
-static UITouch *_secondTouch = NULL;
+static UITouch *g_firstTouch = NULL;
+static UITouch *g_secondTouch = NULL;
 
 #if 0
-static long lastTick = 0;
-static int frames = 0;
+static long g_lastTick = 0;
+static int g_frames = 0;
 #endif
 
 #define printOpenGLError() printOglError(__FILE__, __LINE__)
@@ -57,13 +57,13 @@ int printOglError(const char *file, int line) {
 }
 
 bool iPhone_isHighResDevice() {
-	return _fullHeight > 480;
+	return g_fullHeight > 480;
 }
 
 void iPhone_updateScreen() {
 	//printf("Mouse: (%i, %i)\n", mouseX, mouseY);
-	if (!_needsScreenUpdate) {
-		_needsScreenUpdate = 1;
+	if (!g_needsScreenUpdate) {
+		g_needsScreenUpdate = 1;
 		[g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateSurface) withObject:nil waitUntilDone: NO];
 	}
 }
@@ -142,7 +142,7 @@ const char *iPhone_getDocumentsDir() {
 		glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
 
 		// Retrieve the render buffer size. This *should* match the frame size,
-		// i.e. _fullWidth and _fullHeight.
+		// i.e. g_fullWidth and g_fullHeight.
 		glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &_renderBufferWidth); printOpenGLError();
 		glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &_renderBufferHeight); printOpenGLError();
 
@@ -185,8 +185,8 @@ const char *iPhone_getDocumentsDir() {
 		}
 	}
 
-	_fullWidth = (int)frame.size.width;
-	_fullHeight = (int)frame.size.height;
+	g_fullWidth = (int)frame.size.width;
+	g_fullHeight = (int)frame.size.height;
 
 	g_iPhoneViewInstance = self;
 
@@ -247,15 +247,15 @@ const char *iPhone_getDocumentsDir() {
 
 - (void)drawRect:(CGRect)frame {
 #if 0
-	if (lastTick == 0) {
-		lastTick = time(0);
+	if (g_lastTick == 0) {
+		g_lastTick = time(0);
 	}
 
-	frames++;
-	if (time(0) > lastTick) {
-		lastTick = time(0);
-		printf("FPS: %i\n", frames);
-		frames = 0;
+	g_frames++;
+	if (time(0) > g_lastTick) {
+		g_lastTick = time(0);
+		printf("FPS: %i\n", g_frames);
+		g_frames = 0;
 	}
 #endif
 }
@@ -289,10 +289,10 @@ const char *iPhone_getDocumentsDir() {
 }
 
 - (void)updateSurface {
-	if (!_needsScreenUpdate) {
+	if (!g_needsScreenUpdate) {
 		return;
 	}
-	_needsScreenUpdate = 0;
+	g_needsScreenUpdate = 0;
 
 	glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
 
@@ -685,7 +685,7 @@ const char *iPhone_getDocumentsDir() {
 		if (![self getMouseCoords:point eventX:&x eventY:&y])
 			return;
 
-		_firstTouch = touch;
+		g_firstTouch = touch;
 		[self addEvent:
 		 [[NSDictionary alloc] initWithObjectsAndKeys:
 		  [NSNumber numberWithInt:kInputMouseDown], @"type",
@@ -703,7 +703,7 @@ const char *iPhone_getDocumentsDir() {
 		if (![self getMouseCoords:point eventX:&x eventY:&y])
 			return;
 
-		_secondTouch = touch;
+		g_secondTouch = touch;
 		[self addEvent:
 		 [[NSDictionary alloc] initWithObjectsAndKeys:
 		  [NSNumber numberWithInt:kInputMouseSecondDown], @"type",
@@ -722,7 +722,7 @@ const char *iPhone_getDocumentsDir() {
 	int x, y;
 
 	for (UITouch *touch in touches) {
-		if (touch == _firstTouch) {
+		if (touch == g_firstTouch) {
 			CGPoint point = [touch locationInView:self];
 			if (![self getMouseCoords:point eventX:&x eventY:&y])
 				return;
@@ -735,7 +735,7 @@ const char *iPhone_getDocumentsDir() {
 			  nil
 			  ]
 			 ];
-		} else if (touch == _secondTouch) {
+		} else if (touch == g_secondTouch) {
 			CGPoint point = [touch locationInView:self];
 			if (![self getMouseCoords:point eventX:&x eventY:&y])
 				return;


Commit: 323899d70baaf76a9ad51713f9c0f36f5c8d3def
    https://github.com/scummvm/scummvm/commit/323899d70baaf76a9ad51713f9c0f36f5c8d3def
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-03-05T11:46:45-08:00

Commit Message:
IPOHNE: Move touch related global variables to iPhoneView.

Changed paths:
    backends/platform/iphone/iphone_video.h
    backends/platform/iphone/iphone_video.mm



diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 55a4acb..1405fe3 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -67,6 +67,9 @@
 	GLfloat _mouseScaleX, _mouseScaleY;
 
 	int _scaledShakeOffsetY;
+
+	UITouch *_firstTouch;
+	UITouch *_secondTouch;
 }
 
 - (id)initWithFrame:(struct CGRect)frame;
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
index 1c86a20..5b8d28e 100644
--- a/backends/platform/iphone/iphone_video.mm
+++ b/backends/platform/iphone/iphone_video.mm
@@ -33,9 +33,6 @@ static int g_fullHeight;
 
 static int g_needsScreenUpdate = 0;
 
-static UITouch *g_firstTouch = NULL;
-static UITouch *g_secondTouch = NULL;
-
 #if 0
 static long g_lastTick = 0;
 static int g_frames = 0;
@@ -197,6 +194,9 @@ const char *iPhone_getDocumentsDir() {
 
 	_scaledShakeOffsetY = 0;
 
+	_firstTouch = NULL;
+	_secondTouch = NULL;
+
 	_gameScreenVertCoords[0] = _gameScreenVertCoords[1] =
 	    _gameScreenVertCoords[2] = _gameScreenVertCoords[3] =
 	    _gameScreenVertCoords[4] = _gameScreenVertCoords[5] =
@@ -685,7 +685,7 @@ const char *iPhone_getDocumentsDir() {
 		if (![self getMouseCoords:point eventX:&x eventY:&y])
 			return;
 
-		g_firstTouch = touch;
+		_firstTouch = touch;
 		[self addEvent:
 		 [[NSDictionary alloc] initWithObjectsAndKeys:
 		  [NSNumber numberWithInt:kInputMouseDown], @"type",
@@ -703,7 +703,7 @@ const char *iPhone_getDocumentsDir() {
 		if (![self getMouseCoords:point eventX:&x eventY:&y])
 			return;
 
-		g_secondTouch = touch;
+		_secondTouch = touch;
 		[self addEvent:
 		 [[NSDictionary alloc] initWithObjectsAndKeys:
 		  [NSNumber numberWithInt:kInputMouseSecondDown], @"type",
@@ -722,7 +722,7 @@ const char *iPhone_getDocumentsDir() {
 	int x, y;
 
 	for (UITouch *touch in touches) {
-		if (touch == g_firstTouch) {
+		if (touch == _firstTouch) {
 			CGPoint point = [touch locationInView:self];
 			if (![self getMouseCoords:point eventX:&x eventY:&y])
 				return;
@@ -735,7 +735,7 @@ const char *iPhone_getDocumentsDir() {
 			  nil
 			  ]
 			 ];
-		} else if (touch == g_secondTouch) {
+		} else if (touch == _secondTouch) {
 			CGPoint point = [touch locationInView:self];
 			if (![self getMouseCoords:point eventX:&x eventY:&y])
 				return;






More information about the Scummvm-git-logs mailing list