[Scummvm-cvs-logs] scummvm master -> 7957cc956e8bf66bd6f7a588d70150de70ef8917
lordhoto
lordhoto at gmail.com
Mon Feb 20 18:41:03 CET 2012
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5cc3d754f7 IPHONE: Even more slight formatting fixes.
d4c167414d IPHONE: Refactor event code a bit.
624d5547dc IPHONE: Don't overwrite orientation when the OpenGL ES context is created.
87fb115def IPHONE: Rename _backing[Width,Height] to _renderBuffer[Width,Height].
d91268c4c1 IPHONE: Rename _screenRect to _gameScreenRect.
7957cc956e IPHONE: Use render buffer size instead of application frame size for video size calculations.
Commit: 5cc3d754f72c640f905b535f662b742c8b3794dc
https://github.com/scummvm/scummvm/commit/5cc3d754f72c640f905b535f662b742c8b3794dc
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-20T09:39:57-08:00
Commit Message:
IPHONE: Even more slight formatting fixes.
Changed paths:
backends/platform/iphone/iphone_main.m
backends/platform/iphone/osys_main.cpp
diff --git a/backends/platform/iphone/iphone_main.m b/backends/platform/iphone/iphone_main.m
index 1b555f8..a72b2fd 100644
--- a/backends/platform/iphone/iphone_main.m
+++ b/backends/platform/iphone/iphone_main.m
@@ -84,18 +84,19 @@ int main(int argc, char **argv) {
_window = [[UIWindow alloc] initWithFrame:rect];
[_window retain];
- _view = [[iPhoneView alloc] initWithFrame: rect];
+ _view = [[iPhoneView alloc] initWithFrame:rect];
_view.multipleTouchEnabled = YES;
- [_window setContentView: _view];
+ [_window setContentView:_view];
[_window addSubview:_view];
[_window makeKeyAndVisible];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(didRotate:)
- name:@"UIDeviceOrientationDidChangeNotification" object:nil];
+ selector:@selector(didRotate:)
+ name:@"UIDeviceOrientationDidChangeNotification"
+ object:nil];
[NSThread detachNewThreadSelector:@selector(mainLoop:) toTarget:self withObject:nil];
}
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 3395ea6..36f2136 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -250,7 +250,6 @@ Common::String OSystem_IPHONE::getDefaultConfigFileName() {
#endif
}
-
void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
// Get URL of the Resource directory of the .app bundle
CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
Commit: d4c167414d13bab393f95ec430d717a0413a1b82
https://github.com/scummvm/scummvm/commit/d4c167414d13bab393f95ec430d717a0413a1b82
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-20T09:39:57-08:00
Commit Message:
IPHONE: Refactor event code a bit.
Now mouse x/y coordinates are passed as int.
Changed paths:
backends/platform/iphone/iphone_common.h
backends/platform/iphone/iphone_main.m
backends/platform/iphone/iphone_video.h
backends/platform/iphone/iphone_video.m
backends/platform/iphone/osys_events.cpp
backends/platform/iphone/osys_main.cpp
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h
index 75a83a0..2f03309 100644
--- a/backends/platform/iphone/iphone_common.h
+++ b/backends/platform/iphone/iphone_common.h
@@ -75,7 +75,7 @@ void iPhone_updateScreen(int mouseX, int mouseY);
void iPhone_updateScreenRect(unsigned short *screen, int x1, int y1, int x2, int y2);
void iPhone_updateOverlayRect(unsigned short *screen, int x1, int y1, int x2, int y2);
void iPhone_initSurface(int width, int height);
-bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY);
+bool iPhone_fetchEvent(int *outEvent, int *outX, int *outY);
const char *iPhone_getDocumentsDir();
bool iPhone_isHighResDevice();
int iPhone_getScreenHeight();
diff --git a/backends/platform/iphone/iphone_main.m b/backends/platform/iphone/iphone_main.m
index a72b2fd..051da41 100644
--- a/backends/platform/iphone/iphone_main.m
+++ b/backends/platform/iphone/iphone_main.m
@@ -126,8 +126,8 @@ int main(int argc, char **argv) {
}
- (void)didRotate:(NSNotification *)notification {
- int screenOrientation = [[UIDevice currentDevice] orientation];
- [_view deviceOrientationChanged: screenOrientation];
+ UIDeviceOrientation screenOrientation = [[UIDevice currentDevice] orientation];
+ [_view deviceOrientationChanged:screenOrientation];
}
- (UIWindow*) getWindow {
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 5b4e0fd..173814a 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -51,6 +51,8 @@
GLuint _screenTexture;
GLuint _overlayTexture;
GLuint _mouseCursorTexture;
+
+ UIDeviceOrientation _orientation;
}
- (id)initWithFrame:(struct CGRect)frame;
@@ -73,7 +75,7 @@
- (id)getEvent;
-- (void)deviceOrientationChanged:(int)orientation;
+- (void)deviceOrientationChanged:(UIDeviceOrientation)orientation;
- (void)applicationSuspend;
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 5d57b6d..977dcce 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -148,7 +148,7 @@ void iPhone_initSurface(int width, int height) {
[sharedInstance performSelectorOnMainThread:@selector(initSurface) withObject:nil waitUntilDone: YES];
}
-bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY) {
+bool iPhone_fetchEvent(int *outEvent, int *outX, int *outY) {
id event = [sharedInstance getEvent];
if (event == nil) {
return false;
@@ -162,8 +162,8 @@ bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY) {
}
*outEvent = [type intValue];
- *outX = [[event objectForKey:@"x"] floatValue];
- *outY = [[event objectForKey:@"y"] floatValue];
+ *outX = [[event objectForKey:@"x"] intValue];
+ *outY = [[event objectForKey:@"y"] intValue];
return true;
}
@@ -186,18 +186,55 @@ const char *iPhone_getDocumentsDir() {
return [documentsDirectory UTF8String];
}
-bool getLocalMouseCoords(CGPoint *point) {
+static bool getMouseCoords(UIDeviceOrientation orientation, CGPoint point, int *x, int *y) {
if (_overlayIsEnabled) {
- point->x = point->x / _overlayHeight;
- point->y = point->y / _overlayWidth;
+ switch (orientation) {
+ case UIDeviceOrientationLandscapeLeft:
+ *x = (int)point.y;
+ *y = _overlayHeight - (int)point.x;
+ break;
+
+ case UIDeviceOrientationLandscapeRight:
+ *x = _overlayWidth - (int)point.y;
+ *y = (int)point.x;
+ break;
+
+ case UIDeviceOrientationPortrait:
+ *x = (int)point.x;
+ *y = (int)point.y;
+ break;
+
+ default:
+ return false;
+ }
} else {
- if (point->x < _screenRect.origin.x || point->x >= _screenRect.origin.x + _screenRect.size.width ||
- point->y < _screenRect.origin.y || point->y >= _screenRect.origin.y + _screenRect.size.height) {
+ if (point.x < _screenRect.origin.x || point.x >= _screenRect.origin.x + _screenRect.size.width ||
+ point.y < _screenRect.origin.y || point.y >= _screenRect.origin.y + _screenRect.size.height) {
return false;
}
- point->x = (point->x - _screenRect.origin.x) / _screenRect.size.width;
- point->y = (point->y - _screenRect.origin.y) / _screenRect.size.height;
+ point.x = (point.x - _screenRect.origin.x) / _screenRect.size.width;
+ point.y = (point.y - _screenRect.origin.y) / _screenRect.size.height;
+
+ switch (orientation) {
+ case UIDeviceOrientationLandscapeLeft:
+ *x = point.y * _width;
+ *y = (1.0f - point.x) * _height;
+ break;
+
+ case UIDeviceOrientationLandscapeRight:
+ *x = (1.0f - point.y) * _width;
+ *y = point.x * _height;
+ break;
+
+ case UIDeviceOrientationPortrait:
+ *x = point.x * _width;
+ *y = point.y * _height;
+ break;
+
+ default:
+ return false;
+ }
}
return true;
@@ -442,12 +479,22 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
_gameScreenTextureWidth = getSizeNextPOT(_width);
_gameScreenTextureHeight = getSizeNextPOT(_height);
- UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
+ _orientation = [[UIDevice currentDevice] orientation];
+
+ switch (_orientation) {
+ case UIDeviceOrientationLandscapeLeft:
+ case UIDeviceOrientationLandscapeRight:
+ case UIDeviceOrientationPortrait:
+ break;
+
+ default:
+ _orientation = UIDeviceOrientationLandscapeRight;
+ }
//printf("Window: (%d, %d), Surface: (%d, %d), Texture(%d, %d)\n", _fullWidth, _fullHeight, _width, _height, _gameScreenTextureWidth, _gameScreenTextureHeight);
if (_context == nil) {
- orientation = UIDeviceOrientationLandscapeRight;
+ _orientation = UIDeviceOrientationLandscapeRight;
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
eaglLayer.opaque = YES;
@@ -496,9 +543,9 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- if (orientation == UIDeviceOrientationLandscapeRight) {
+ if (_orientation == UIDeviceOrientationLandscapeRight) {
glRotatef(-90, 0, 0, 1); printOpenGLError();
- } else if (orientation == UIDeviceOrientationLandscapeLeft) {
+ } else if (_orientation == UIDeviceOrientationLandscapeLeft) {
glRotatef(90, 0, 0, 1); printOpenGLError();
} else {
glRotatef(180, 0, 0, 1); printOpenGLError();
@@ -534,7 +581,7 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
[[_keyboardView inputView] removeFromSuperview];
}
- if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) {
+ if (_orientation == UIDeviceOrientationLandscapeLeft || _orientation == UIDeviceOrientationLandscapeRight) {
_visibleHeight = _backingHeight;
_visibleWidth = _backingWidth;
@@ -607,12 +654,23 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
[_events addObject: event];
}
-- (void)deviceOrientationChanged:(int)orientation {
+- (void)deviceOrientationChanged:(UIDeviceOrientation)orientation {
+ switch (orientation) {
+ case UIDeviceOrientationLandscapeLeft:
+ case UIDeviceOrientationLandscapeRight:
+ case UIDeviceOrientationPortrait:
+ _orientation = orientation;
+ break;
+
+ default:
+ return;
+ }
+
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputOrientationChanged], @"type",
- [NSNumber numberWithFloat:(float)orientation], @"x",
- [NSNumber numberWithFloat:0], @"y",
+ [NSNumber numberWithInt:orientation], @"x",
+ [NSNumber numberWithInt:0], @"y",
nil
]
];
@@ -620,20 +678,21 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSSet *allTouches = [event allTouches];
+ int x, y;
switch ([allTouches count]) {
case 1: {
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
+ if (!getMouseCoords(_orientation, point, &x, &y))
return;
_firstTouch = touch;
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputMouseDown], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
nil
]
];
@@ -643,15 +702,15 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
case 2: {
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
+ if (!getMouseCoords(_orientation, point, &x, &y))
return;
_secondTouch = touch;
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputMouseSecondDown], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
nil
]
];
@@ -662,31 +721,32 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
//NSSet *allTouches = [event allTouches];
+ int x, y;
for (UITouch *touch in touches) {
if (touch == _firstTouch) {
CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
+ if (!getMouseCoords(_orientation, point, &x, &y))
return;
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputMouseDragged], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
nil
]
];
} else if (touch == _secondTouch) {
CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
+ if (!getMouseCoords(_orientation, point, &x, &y))
return;
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputMouseSecondDragged], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
nil
]
];
@@ -696,19 +756,20 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSSet *allTouches = [event allTouches];
+ int x, y;
switch ([allTouches count]) {
case 1: {
UITouch *touch = [[allTouches allObjects] objectAtIndex:0];
CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
+ if (!getMouseCoords(_orientation, point, &x, &y))
return;
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputMouseUp], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
nil
]
];
@@ -718,14 +779,14 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
case 2: {
UITouch *touch = [[allTouches allObjects] objectAtIndex:1];
CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
+ if (!getMouseCoords(_orientation, point, &x, &y))
return;
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputMouseSecondUp], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
nil
]
];
@@ -741,8 +802,8 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputKeyPressed], @"type",
- [NSNumber numberWithFloat:(float)c], @"x",
- [NSNumber numberWithFloat:0], @"y",
+ [NSNumber numberWithInt:c], @"x",
+ [NSNumber numberWithInt:0], @"y",
nil
]
];
@@ -758,8 +819,8 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputSwipe], @"type",
- [NSNumber numberWithFloat:(float)num], @"x",
- [NSNumber numberWithFloat:0], @"y",
+ [NSNumber numberWithInt:num], @"x",
+ [NSNumber numberWithInt:0], @"y",
nil
]
];
@@ -769,8 +830,8 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputApplicationSuspended], @"type",
- [NSNumber numberWithFloat:0], @"x",
- [NSNumber numberWithFloat:0], @"y",
+ [NSNumber numberWithInt:0], @"x",
+ [NSNumber numberWithInt:0], @"y",
nil
]
];
@@ -780,8 +841,8 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputApplicationResumed], @"type",
- [NSNumber numberWithFloat:0], @"x",
- [NSNumber numberWithFloat:0], @"y",
+ [NSNumber numberWithInt:0], @"x",
+ [NSNumber numberWithInt:0], @"y",
nil
]
];
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp
index 5beba8a3..c167da3 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -47,41 +47,9 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
}
int eventType;
- float xUnit, yUnit;
-
- if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit)) {
- int x = 0;
- int y = 0;
- switch (_screenOrientation) {
- case kScreenOrientationPortrait:
- if (_overlayVisible) {
- x = (int)(xUnit * _overlayWidth);
- y = (int)(yUnit * _overlayHeight);
- } else {
- x = (int)(xUnit * _screenWidth);
- y = (int)(yUnit * _screenHeight);
- }
- break;
- case kScreenOrientationLandscape:
- if (_overlayVisible) {
- x = (int)(yUnit * _overlayWidth);
- y = (int)((1.0 - xUnit) * _overlayHeight);
- } else {
- x = (int)(yUnit * _screenWidth);
- y = (int)((1.0 - xUnit) * _screenHeight);
- }
- break;
- case kScreenOrientationFlippedLandscape:
- if (_overlayVisible) {
- x = (int)((1.0 - yUnit) * _overlayWidth);
- y = (int)(xUnit * _overlayHeight);
- } else {
- x = (int)((1.0 - yUnit) * _screenWidth);
- y = (int)(xUnit * _screenHeight);
- }
- break;
- }
+ int x, y;
+ if (iPhone_fetchEvent(&eventType, &x, &y)) {
switch ((InputEvent)eventType) {
case kInputMouseDown:
if (!handleEvent_mouseDown(event, x, y))
@@ -112,7 +80,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
return false;
break;
case kInputOrientationChanged:
- handleEvent_orientationChanged((int)xUnit);
+ handleEvent_orientationChanged(x);
return false;
break;
@@ -122,11 +90,11 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
break;
case kInputKeyPressed:
- handleEvent_keyPressed(event, (int)xUnit);
+ handleEvent_keyPressed(event, x);
break;
case kInputSwipe:
- if (!handleEvent_swipe(event, (int)xUnit))
+ if (!handleEvent_swipe(event, x))
return false;
break;
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 36f2136..2bdc09c 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -139,13 +139,13 @@ bool OSystem_IPHONE::getFeatureState(Feature f) {
void OSystem_IPHONE::suspendLoop() {
bool done = false;
int eventType;
- float xUnit, yUnit;
+ int x, y;
uint32 startTime = getMillis();
stopSoundsystem();
while (!done) {
- if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit))
+ if (iPhone_fetchEvent(&eventType, &x, &y))
if ((InputEvent)eventType == kInputApplicationResumed)
done = true;
usleep(100000);
Commit: 624d5547dc691952b92f2317e252264dab7399d8
https://github.com/scummvm/scummvm/commit/624d5547dc691952b92f2317e252264dab7399d8
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-20T09:39:57-08:00
Commit Message:
IPHONE: Don't overwrite orientation when the OpenGL ES context is created.
Changed paths:
backends/platform/iphone/iphone_video.m
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 977dcce..c917dcc 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -494,7 +494,6 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
//printf("Window: (%d, %d), Surface: (%d, %d), Texture(%d, %d)\n", _fullWidth, _fullHeight, _width, _height, _gameScreenTextureWidth, _gameScreenTextureHeight);
if (_context == nil) {
- _orientation = UIDeviceOrientationLandscapeRight;
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
eaglLayer.opaque = YES;
Commit: 87fb115def77cba564215e75f52bf6154211d1ec
https://github.com/scummvm/scummvm/commit/87fb115def77cba564215e75f52bf6154211d1ec
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-20T09:39:57-08:00
Commit Message:
IPHONE: Rename _backing[Width,Height] to _renderBuffer[Width,Height].
Changed paths:
backends/platform/iphone/iphone_video.h
backends/platform/iphone/iphone_video.m
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 173814a..d6ef469 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -44,8 +44,8 @@
EAGLContext *_context;
GLuint _viewRenderbuffer;
GLuint _viewFramebuffer;
- GLint _backingWidth;
- GLint _backingHeight;
+ GLint _renderBufferWidth;
+ GLint _renderBufferHeight;
GLint _visibleWidth;
GLint _visibleHeight;
GLuint _screenTexture;
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index c917dcc..6b96874 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -438,12 +438,12 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
width = width / (float)_width * gameHeight;
height = height / (float)_height * gameWidth;
} else {
- mouseX = (_overlayWidth - mouseX) / (float)_overlayWidth * _backingWidth;
- mouseY = mouseY / (float)_overlayHeight * _backingHeight;
- hotspotX = hotspotX / (float)_overlayWidth * _backingWidth;
- hotspotY = hotspotY / (float)_overlayHeight * _backingHeight;
- width = width / (float)_overlayWidth * _backingWidth;
- height = height / (float)_overlayHeight * _backingHeight;
+ mouseX = (_overlayWidth - mouseX) / (float)_overlayWidth * _renderBufferWidth;
+ mouseY = mouseY / (float)_overlayHeight * _renderBufferHeight;
+ hotspotX = hotspotX / (float)_overlayWidth * _renderBufferWidth;
+ hotspotY = hotspotY / (float)_overlayHeight * _renderBufferHeight;
+ width = width / (float)_overlayWidth * _renderBufferWidth;
+ height = height / (float)_overlayHeight * _renderBufferHeight;
}
mouseX -= hotspotX;
@@ -510,16 +510,16 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
[_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id<EAGLDrawable>)self.layer];
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &_backingWidth); printOpenGLError();
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &_backingHeight); printOpenGLError();
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &_renderBufferWidth); printOpenGLError();
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &_renderBufferHeight); printOpenGLError();
if (glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
NSLog(@"Failed to make complete framebuffer object %x.", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
return;
}
- _overlayHeight = _backingWidth;
- _overlayWidth = _backingHeight;
+ _overlayHeight = _renderBufferWidth;
+ _overlayWidth = _renderBufferHeight;
_overlayTexWidth = getSizeNextPOT(_overlayHeight);
_overlayTexHeight = getSizeNextPOT(_overlayWidth);
@@ -527,7 +527,7 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
_overlayTexBuffer = (char *)malloc(textureSize);
memset(_overlayTexBuffer, 0, textureSize);
- glViewport(0, 0, _backingWidth, _backingHeight); printOpenGLError();
+ glViewport(0, 0, _renderBufferWidth, _renderBufferHeight); printOpenGLError();
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); printOpenGLError();
glEnable(GL_BLEND);
@@ -550,7 +550,7 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
glRotatef(180, 0, 0, 1); printOpenGLError();
}
- glOrthof(0, _backingWidth, 0, _backingHeight, 0, 1); printOpenGLError();
+ glOrthof(0, _renderBufferWidth, 0, _renderBufferHeight, 0, 1); printOpenGLError();
if (_screenTexture > 0) {
glDeleteTextures(1, &_screenTexture); printOpenGLError();
@@ -581,8 +581,8 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
}
if (_orientation == UIDeviceOrientationLandscapeLeft || _orientation == UIDeviceOrientationLandscapeRight) {
- _visibleHeight = _backingHeight;
- _visibleWidth = _backingWidth;
+ _visibleHeight = _renderBufferHeight;
+ _visibleWidth = _renderBufferWidth;
float ratioDifference = ((float)_height / (float)_width) / ((float)_fullWidth / (float)_fullHeight);
int rectWidth, rectHeight;
@@ -608,7 +608,7 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
_screenRect = CGRectMake(0, 0, _fullWidth - 1, height - 1);
_visibleHeight = height;
- _visibleWidth = _backingWidth;
+ _visibleWidth = _renderBufferWidth;
_heightOffset = 0.0f;
_widthOffset = 0.0f;
Commit: d91268c4c1e3e0b830e97d144a0548d9d7929bb8
https://github.com/scummvm/scummvm/commit/d91268c4c1e3e0b830e97d144a0548d9d7929bb8
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-20T09:39:57-08:00
Commit Message:
IPHONE: Rename _screenRect to _gameScreenRect.
Changed paths:
backends/platform/iphone/iphone_video.m
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 6b96874..49c66a6 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -29,7 +29,7 @@ static int _width = 0;
static int _height = 0;
static int _fullWidth;
static int _fullHeight;
-static CGRect _screenRect;
+static CGRect _gameScreenRect;
static char *_gameScreenTextureBuffer = 0;
static int _gameScreenTextureWidth = 0;
@@ -208,13 +208,13 @@ static bool getMouseCoords(UIDeviceOrientation orientation, CGPoint point, int *
return false;
}
} else {
- if (point.x < _screenRect.origin.x || point.x >= _screenRect.origin.x + _screenRect.size.width ||
- point.y < _screenRect.origin.y || point.y >= _screenRect.origin.y + _screenRect.size.height) {
+ if (point.x < _gameScreenRect.origin.x || point.x >= _gameScreenRect.origin.x + _gameScreenRect.size.width ||
+ point.y < _gameScreenRect.origin.y || point.y >= _gameScreenRect.origin.y + _gameScreenRect.size.height) {
return false;
}
- point.x = (point.x - _screenRect.origin.x) / _screenRect.size.width;
- point.y = (point.y - _screenRect.origin.y) / _screenRect.size.height;
+ point.x = (point.x - _gameScreenRect.origin.x) / _gameScreenRect.size.width;
+ point.y = (point.y - _gameScreenRect.origin.y) / _gameScreenRect.size.height;
switch (orientation) {
case UIDeviceOrientationLandscapeLeft:
@@ -599,13 +599,13 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
}
//printf("Rect: %i, %i, %i, %i\n", _widthOffset, _heightOffset, rectWidth, rectHeight);
- _screenRect = CGRectMake(_widthOffset, _heightOffset, rectWidth, rectHeight);
+ _gameScreenRect = CGRectMake(_widthOffset, _heightOffset, rectWidth, rectHeight);
_overlayPortraitRatio = 1.0f;
} else {
float ratio = (float)_height / (float)_width;
int height = _fullWidth * ratio;
//printf("Making rect (%u, %u)\n", _fullWidth, height);
- _screenRect = CGRectMake(0, 0, _fullWidth - 1, height - 1);
+ _gameScreenRect = CGRectMake(0, 0, _fullWidth - 1, height - 1);
_visibleHeight = height;
_visibleWidth = _renderBufferWidth;
Commit: 7957cc956e8bf66bd6f7a588d70150de70ef8917
https://github.com/scummvm/scummvm/commit/7957cc956e8bf66bd6f7a588d70150de70ef8917
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-20T09:39:57-08:00
Commit Message:
IPHONE: Use render buffer size instead of application frame size for video size calculations.
These match as far as I can tell, but in case they don't match, the render
buffer size should be the correct thing to use.
Changed paths:
backends/platform/iphone/iphone_video.m
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 49c66a6..a27234b 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -584,17 +584,17 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
_visibleHeight = _renderBufferHeight;
_visibleWidth = _renderBufferWidth;
- float ratioDifference = ((float)_height / (float)_width) / ((float)_fullWidth / (float)_fullHeight);
+ float ratioDifference = ((float)_height / (float)_width) / ((float)_renderBufferWidth / (float)_renderBufferHeight);
int rectWidth, rectHeight;
if (ratioDifference < 1.0f) {
- rectWidth = _fullWidth * ratioDifference;
- rectHeight = _fullHeight;
- _widthOffset = (_fullWidth - rectWidth) / 2;
+ rectWidth = _renderBufferWidth * ratioDifference;
+ rectHeight = _renderBufferHeight;
+ _widthOffset = (_renderBufferWidth - rectWidth) / 2;
_heightOffset = 0;
} else {
- rectWidth = _fullWidth;
- rectHeight = _fullHeight / ratioDifference;
- _heightOffset = (_fullHeight - rectHeight) / 2;
+ rectWidth = _renderBufferWidth;
+ rectHeight = _renderBufferHeight / ratioDifference;
+ _heightOffset = (_renderBufferHeight - rectHeight) / 2;
_widthOffset = 0;
}
@@ -603,9 +603,9 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
_overlayPortraitRatio = 1.0f;
} else {
float ratio = (float)_height / (float)_width;
- int height = _fullWidth * ratio;
- //printf("Making rect (%u, %u)\n", _fullWidth, height);
- _gameScreenRect = CGRectMake(0, 0, _fullWidth - 1, height - 1);
+ int height = _renderBufferWidth * ratio;
+ //printf("Making rect (%u, %u)\n", _renderBufferWidth, height);
+ _gameScreenRect = CGRectMake(0, 0, _renderBufferWidth - 1, height - 1);
_visibleHeight = height;
_visibleWidth = _renderBufferWidth;
More information about the Scummvm-git-logs
mailing list