diff options
author | Johannes Schickel | 2012-02-19 21:18:17 +0100 |
---|---|---|
committer | Johannes Schickel | 2012-02-19 21:30:53 +0100 |
commit | 3d0316ccd215cbb1530f665ff195554e46559efe (patch) | |
tree | 4d0ed0988213228f931dc836055c70bd878f9ca9 | |
parent | 4244663020c0462eb3fb4f621efcdaac586c84f1 (diff) | |
download | scummvm-rg350-3d0316ccd215cbb1530f665ff195554e46559efe.tar.gz scummvm-rg350-3d0316ccd215cbb1530f665ff195554e46559efe.tar.bz2 scummvm-rg350-3d0316ccd215cbb1530f665ff195554e46559efe.zip |
IPHONE: Formatting fixes.
-rw-r--r-- | backends/platform/iphone/iphone_common.h | 14 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_keyboard.h | 2 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_keyboard.m | 8 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_main.m | 49 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_video.h | 15 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_video.m | 55 | ||||
-rw-r--r-- | backends/platform/iphone/osys_events.cpp | 358 | ||||
-rw-r--r-- | backends/platform/iphone/osys_main.cpp | 5 | ||||
-rw-r--r-- | backends/platform/iphone/osys_main.h | 22 | ||||
-rw-r--r-- | backends/platform/iphone/osys_video.cpp | 14 |
10 files changed, 264 insertions, 278 deletions
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h index 0cbcb77bcb..9bf559860e 100644 --- a/backends/platform/iphone/iphone_common.h +++ b/backends/platform/iphone/iphone_common.h @@ -20,7 +20,6 @@ * */ - enum InputEvent { kInputMouseDown, kInputMouseUp, @@ -41,13 +40,12 @@ enum ScreenOrientation { kScreenOrientationFlippedLandscape }; -typedef enum -{ +enum UIViewSwipeDirection { kUIViewSwipeUp = 1, kUIViewSwipeDown = 2, kUIViewSwipeLeft = 4, kUIViewSwipeRight = 8 -} UIViewSwipeDirection; +}; #ifdef IPHONE_OFFICIAL void iphone_main(int argc, char **argv); @@ -65,16 +63,16 @@ void iphone_main(int argc, char *argv[]); // On the ObjC side 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_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); -const char* iPhone_getDocumentsDir(); +const char *iPhone_getDocumentsDir(); bool iPhone_isHighResDevice(); int iPhone_getScreenHeight(); int iPhone_getScreenWidth(); void iPhone_enableOverlay(int state); -void iPhone_setMouseCursor(short* buffer, int width, int height); +void iPhone_setMouseCursor(short *buffer, int width, int height); uint getSizeNextPOT(uint size); diff --git a/backends/platform/iphone/iphone_keyboard.h b/backends/platform/iphone/iphone_keyboard.h index c4b4a9a2a7..6d64f90ffd 100644 --- a/backends/platform/iphone/iphone_keyboard.h +++ b/backends/platform/iphone/iphone_keyboard.h @@ -25,7 +25,7 @@ @interface SoftKeyboard : UIView { id inputDelegate; - UITextView* inputView; + UITextView *inputView; } - (id)initWithFrame:(CGRect)frame; diff --git a/backends/platform/iphone/iphone_keyboard.m b/backends/platform/iphone/iphone_keyboard.m index 1624d02977..4d92b15450 100644 --- a/backends/platform/iphone/iphone_keyboard.m +++ b/backends/platform/iphone/iphone_keyboard.m @@ -29,17 +29,17 @@ @end @interface TextInputHandler : UITextView { - SoftKeyboard* softKeyboard; + SoftKeyboard *softKeyboard; } -- (id)initWithKeyboard:(SoftKeyboard*)keyboard; +- (id)initWithKeyboard:(SoftKeyboard *)keyboard; @end @implementation TextInputHandler -- (id)initWithKeyboard:(SoftKeyboard*)keyboard; { +- (id)initWithKeyboard:(SoftKeyboard *)keyboard; { self = [super initWithFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)]; softKeyboard = keyboard; @@ -80,7 +80,7 @@ return self; } -- (UITextView*)inputView { +- (UITextView *)inputView { return inputView; } diff --git a/backends/platform/iphone/iphone_main.m b/backends/platform/iphone/iphone_main.m index c2ec328bf5..1b555f849f 100644 --- a/backends/platform/iphone/iphone_main.m +++ b/backends/platform/iphone/iphone_main.m @@ -28,30 +28,30 @@ void iphone_main(int argc, char *argv[]); @interface iPhoneMain : UIApplication { - UIWindow* _window; - iPhoneView* _view; + UIWindow *_window; + iPhoneView *_view; } -- (void) mainLoop: (id)param; -- (iPhoneView*) getView; -- (UIWindow*) getWindow; +- (void)mainLoop:(id)param; +- (iPhoneView *)getView; +- (UIWindow *)getWindow; - (void)didRotate:(NSNotification *)notification; @end static int gArgc; -static char** gArgv; +static char **gArgv; -int main(int argc, char** argv) { +int main(int argc, char **argv) { gArgc = argc; gArgv = argv; - NSAutoreleasePool *autoreleasePool = [ - [ NSAutoreleasePool alloc ] init - ]; + NSAutoreleasePool *autoreleasePool = [ + [NSAutoreleasePool alloc] init + ]; - int returnCode = UIApplicationMain(argc, argv, @"iPhoneMain", @"iPhoneMain"); - [ autoreleasePool release ]; - return returnCode; + int returnCode = UIApplicationMain(argc, argv, @"iPhoneMain", @"iPhoneMain"); + [autoreleasePool release]; + return returnCode; } @implementation iPhoneMain @@ -63,14 +63,14 @@ int main(int argc, char** argv) { return self; } -- (void) mainLoop: (id)param { +- (void)mainLoop:(id)param { [[NSAutoreleasePool alloc] init]; iphone_main(gArgc, gArgv); exit(0); } -- (iPhoneView*) getView { +- (iPhoneView *)getView { return _view; } @@ -78,8 +78,8 @@ int main(int argc, char** argv) { CGRect rect = [[UIScreen mainScreen] bounds]; // hide the status bar - [application setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO]; - [application setStatusBarHidden:YES animated:YES]; + [application setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO]; + [application setStatusBarHidden:YES animated:YES]; _window = [[UIWindow alloc] initWithFrame:rect]; [_window retain]; @@ -100,16 +100,13 @@ int main(int argc, char** argv) { [NSThread detachNewThreadSelector:@selector(mainLoop:) toTarget:self withObject:nil]; } -- (void)applicationDidResume -{ +- (void)applicationDidResume { } -- (void)applicationWillSuspend -{ +- (void)applicationWillSuspend { } -- (void)applicationWillTerminate -{ +- (void)applicationWillTerminate { } - (void)applicationSuspend:(struct __GSEvent *)event { @@ -122,9 +119,9 @@ int main(int argc, char** argv) { // Workaround, need to "hide" and unhide the statusbar to properly remove it, // since the Springboard has put it back without apparently flagging our application. - [self setStatusBarHidden:YES animated:YES]; - [self setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO]; - [self setStatusBarHidden:YES animated:YES]; + [self setStatusBarHidden:YES animated:YES]; + [self setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO]; + [self setStatusBarHidden:YES animated:YES]; } - (void)didRotate:(NSNotification *)notification { diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h index 223f025978..21593b2c3d 100644 --- a/backends/platform/iphone/iphone_video.h +++ b/backends/platform/iphone/iphone_video.h @@ -33,17 +33,16 @@ #import "iphone_keyboard.h" -@interface iPhoneView : UIView -{ - void* _screenSurface; - NSMutableArray* _events; - SoftKeyboard* _keyboardView; - CALayer* _screenLayer; +@interface iPhoneView : UIView { + void *_screenSurface; + NSMutableArray *_events; + SoftKeyboard *_keyboardView; + CALayer *_screenLayer; int _widthOffset; int _heightOffset; - EAGLContext* _context; + EAGLContext *_context; GLuint _viewRenderbuffer; GLuint _viewFramebuffer; GLint _backingWidth; @@ -69,7 +68,7 @@ - (void)updateMouseSurface; - (void)clearColorBuffer; --(void)updateMouseCursor; +- (void)updateMouseCursor; - (id)getEvent; diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index eb16676428..4ef43f20df 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -30,25 +30,25 @@ static int _fullWidth; static int _fullHeight; static CGRect _screenRect; -static char* _textureBuffer = 0; +static char *_textureBuffer = 0; static int _textureWidth = 0; static int _textureHeight = 0; -static char* _overlayTexBuffer = 0; +static char *_overlayTexBuffer = 0; static int _overlayTexWidth = 0; static int _overlayTexHeight = 0; static int _overlayWidth = 0; static int _overlayHeight = 0; static float _overlayPortraitRatio = 1.0f; -NSLock* _lock = nil; +NSLock *_lock = nil; static int _needsScreenUpdate = 0; static int _overlayIsEnabled = 0; -static UITouch* _firstTouch = NULL; -static UITouch* _secondTouch = NULL; +static UITouch *_firstTouch = NULL; +static UITouch *_secondTouch = NULL; -static short* _mouseCursor = NULL; +static short *_mouseCursor = NULL; static int _mouseCursorHeight = 0; static int _mouseCursorWidth = 0; static int _mouseX = 0; @@ -59,14 +59,12 @@ static int _mouseY = 0; #define printOpenGLError() printOglError(__FILE__, __LINE__) -int printOglError(const char *file, int line) -{ +int printOglError(const char *file, int line) { int retCode = 0; // returns 1 if an OpenGL error occurred, 0 otherwise. GLenum glErr = glGetError(); - while( glErr != GL_NO_ERROR) - { + while (glErr != GL_NO_ERROR) { fprintf(stderr, "glError: %u (%s: %d)\n", glErr, file, line ); retCode = 1; glErr = glGetError(); @@ -74,7 +72,7 @@ int printOglError(const char *file, int line) return retCode; } -void iPhone_setMouseCursor(short* buffer, int width, int height) { +void iPhone_setMouseCursor(short *buffer, int width, int height) { _mouseCursor = buffer; _mouseCursorWidth = width; @@ -119,13 +117,13 @@ void iPhone_updateScreen(int mouseX, int mouseY) { } } -void iPhone_updateScreenRect(unsigned short* screen, int x1, int y1, int x2, int y2) { +void iPhone_updateScreenRect(unsigned short *screen, int x1, int y1, int x2, int y2) { int y; for (y = y1; y < y2; ++y) memcpy(&_textureBuffer[(y * _textureWidth + x1 )* 2], &screen[y * _width + x1], (x2 - x1) * 2); } -void iPhone_updateOverlayRect(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) { int y; //printf("Overlaywidth: %u, fullwidth %u\n", _overlayWidth, _fullWidth); for (y = y1; y < y2; ++y) @@ -158,19 +156,19 @@ bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY) { } uint getSizeNextPOT(uint size) { - if ((size & (size - 1)) || !size) { - int log = 0; + if ((size & (size - 1)) || !size) { + int log = 0; - while (size >>= 1) - ++log; + while (size >>= 1) + ++log; - size = (2 << log); - } + size = (2 << log); + } - return size; + return size; } -const char* iPhone_getDocumentsDir() { +const char *iPhone_getDocumentsDir() { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; return [documentsDirectory UTF8String]; @@ -196,18 +194,15 @@ bool getLocalMouseCoords(CGPoint *point) { @implementation iPhoneView -+ (Class) layerClass -{ ++ (Class) layerClass { return [CAEAGLLayer class]; } - (id)initWithFrame:(struct CGRect)frame { self = [super initWithFrame: frame]; - if([[UIScreen mainScreen] respondsToSelector: NSSelectorFromString(@"scale")]) - { - if([self respondsToSelector: NSSelectorFromString(@"contentScaleFactor")]) - { + if ([[UIScreen mainScreen] respondsToSelector: NSSelectorFromString(@"scale")]) { + if ([self respondsToSelector: NSSelectorFromString(@"contentScaleFactor")]) { //self.contentScaleFactor = [[UIScreen mainScreen] scale]; } } @@ -395,7 +390,7 @@ bool getLocalMouseCoords(CGPoint *point) { if (_context == nil) { orientation = UIDeviceOrientationLandscapeRight; - CAEAGLLayer *eaglLayer = (CAEAGLLayer*) self.layer; + CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer; eaglLayer.opaque = YES; eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: @@ -475,7 +470,7 @@ bool getLocalMouseCoords(CGPoint *point) { } int textureSize = _textureWidth * _textureHeight * 2; - _textureBuffer = (char*)malloc(textureSize); + _textureBuffer = (char *)malloc(textureSize); memset(_textureBuffer, 0, textureSize); glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError(); @@ -554,7 +549,7 @@ bool getLocalMouseCoords(CGPoint *point) { return event; } -- (void)addEvent:(NSDictionary*)event { +- (void)addEvent:(NSDictionary *)event { if (_events == nil) _events = [[NSMutableArray alloc] init]; diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp index a3075e23cb..5beba8a397 100644 --- a/backends/platform/iphone/osys_events.cpp +++ b/backends/platform/iphone/osys_events.cpp @@ -53,85 +53,85 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { 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; + 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; } switch ((InputEvent)eventType) { - case kInputMouseDown: - if (!handleEvent_mouseDown(event, x, y)) - return false; - break; + case kInputMouseDown: + if (!handleEvent_mouseDown(event, x, y)) + return false; + break; - case kInputMouseUp: + case kInputMouseUp: if (!handleEvent_mouseUp(event, x, y)) return false; - break; - - case kInputMouseDragged: - if (!handleEvent_mouseDragged(event, x, y)) - return false; - break; - case kInputMouseSecondDragged: - if (!handleEvent_mouseSecondDragged(event, x, y)) - return false; - break; - case kInputMouseSecondDown: - _secondaryTapped = true; - if (!handleEvent_secondMouseDown(event, x, y)) - return false; - break; - case kInputMouseSecondUp: - _secondaryTapped = false; - if (!handleEvent_secondMouseUp(event, x, y)) - return false; - break; - case kInputOrientationChanged: - handleEvent_orientationChanged((int)xUnit); - return false; - break; + break; - case kInputApplicationSuspended: - suspendLoop(); + case kInputMouseDragged: + if (!handleEvent_mouseDragged(event, x, y)) + return false; + break; + case kInputMouseSecondDragged: + if (!handleEvent_mouseSecondDragged(event, x, y)) + return false; + break; + case kInputMouseSecondDown: + _secondaryTapped = true; + if (!handleEvent_secondMouseDown(event, x, y)) + return false; + break; + case kInputMouseSecondUp: + _secondaryTapped = false; + if (!handleEvent_secondMouseUp(event, x, y)) return false; - break; + break; + case kInputOrientationChanged: + handleEvent_orientationChanged((int)xUnit); + return false; + break; - case kInputKeyPressed: - handleEvent_keyPressed(event, (int)xUnit); - break; + case kInputApplicationSuspended: + suspendLoop(); + return false; + break; - case kInputSwipe: - if (!handleEvent_swipe(event, (int)xUnit)) - return false; - break; + case kInputKeyPressed: + handleEvent_keyPressed(event, (int)xUnit); + break; + + case kInputSwipe: + if (!handleEvent_swipe(event, (int)xUnit)) + return false; + break; - default: - break; + default: + break; } return true; @@ -170,8 +170,7 @@ bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) { _secondaryTapped = false; if (!handleEvent_secondMouseUp(event, x, y)) return false; - } - else if (_mouseClickAndDragEnabled) { + } else if (_mouseClickAndDragEnabled) { event.type = Common::EVENT_LBUTTONUP; event.mouse.x = _mouseX; event.mouse.y = _mouseY; @@ -206,8 +205,7 @@ bool OSystem_IPHONE::handleEvent_secondMouseDown(Common::Event &event, int x, in _queuedInputEvent.type = Common::EVENT_RBUTTONDOWN; _queuedInputEvent.mouse.x = _mouseX; _queuedInputEvent.mouse.y = _mouseY; - } - else + } else return false; return true; @@ -216,7 +214,7 @@ bool OSystem_IPHONE::handleEvent_secondMouseDown(Common::Event &event, int x, in bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int y) { int curTime = getMillis(); - if (curTime - _lastSecondaryDown < 400 ) { + if (curTime - _lastSecondaryDown < 400) { //printf("Right tap!\n"); if (curTime - _lastSecondaryTap < 400 && !_overlayVisible) { //printf("Right escape!\n"); @@ -262,7 +260,7 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y //printf("Mouse dragged at (%u, %u)\n", x, y); int mouseNewPosX; int mouseNewPosY; - if (_touchpadModeEnabled ) { + if (_touchpadModeEnabled) { int deltaX = _lastPadX - x; int deltaY = _lastPadY - y; _lastPadX = x; @@ -368,17 +366,17 @@ void OSystem_IPHONE::handleEvent_orientationChanged(int orientation) { ScreenOrientation newOrientation; switch (orientation) { - case 1: - newOrientation = kScreenOrientationPortrait; - break; - case 3: - newOrientation = kScreenOrientationLandscape; - break; - case 4: - newOrientation = kScreenOrientationFlippedLandscape; - break; - default: - return; + case 1: + newOrientation = kScreenOrientationPortrait; + break; + case 3: + newOrientation = kScreenOrientationLandscape; + break; + case 4: + newOrientation = kScreenOrientationFlippedLandscape; + break; + default: + return; } @@ -400,50 +398,50 @@ void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPresse // We remap some of the iPhone keyboard keys. // The first ten here are the row of symbols below the numeric keys. switch (keyPressed) { - case 45: - keyPressed = Common::KEYCODE_F1; - ascii = Common::ASCII_F1; - break; - case 47: - keyPressed = Common::KEYCODE_F2; - ascii = Common::ASCII_F2; - break; - case 58: - keyPressed = Common::KEYCODE_F3; - ascii = Common::ASCII_F3; - break; - case 59: - keyPressed = Common::KEYCODE_F4; - ascii = Common::ASCII_F4; - break; - case 40: - keyPressed = Common::KEYCODE_F5; - ascii = Common::ASCII_F5; - break; - case 41: - keyPressed = Common::KEYCODE_F6; - ascii = Common::ASCII_F6; - break; - case 36: - keyPressed = Common::KEYCODE_F7; - ascii = Common::ASCII_F7; - break; - case 38: - keyPressed = Common::KEYCODE_F8; - ascii = Common::ASCII_F8; - break; - case 64: - keyPressed = Common::KEYCODE_F9; - ascii = Common::ASCII_F9; - break; - case 34: - keyPressed = Common::KEYCODE_F10; - ascii = Common::ASCII_F10; - break; - case 10: - keyPressed = Common::KEYCODE_RETURN; - ascii = Common::ASCII_RETURN; - break; + case 45: + keyPressed = Common::KEYCODE_F1; + ascii = Common::ASCII_F1; + break; + case 47: + keyPressed = Common::KEYCODE_F2; + ascii = Common::ASCII_F2; + break; + case 58: + keyPressed = Common::KEYCODE_F3; + ascii = Common::ASCII_F3; + break; + case 59: + keyPressed = Common::KEYCODE_F4; + ascii = Common::ASCII_F4; + break; + case 40: + keyPressed = Common::KEYCODE_F5; + ascii = Common::ASCII_F5; + break; + case 41: + keyPressed = Common::KEYCODE_F6; + ascii = Common::ASCII_F6; + break; + case 36: + keyPressed = Common::KEYCODE_F7; + ascii = Common::ASCII_F7; + break; + case 38: + keyPressed = Common::KEYCODE_F8; + ascii = Common::ASCII_F8; + break; + case 64: + keyPressed = Common::KEYCODE_F9; + ascii = Common::ASCII_F9; + break; + case 34: + keyPressed = Common::KEYCODE_F10; + ascii = Common::ASCII_F10; + break; + case 10: + keyPressed = Common::KEYCODE_RETURN; + ascii = Common::ASCII_RETURN; + break; } event.type = Common::EVENT_KEYDOWN; _queuedInputEvent.type = Common::EVENT_KEYUP; @@ -457,60 +455,60 @@ void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPresse bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) { Common::KeyCode keycode = Common::KEYCODE_INVALID; switch (_screenOrientation) { - case kScreenOrientationPortrait: - switch ((UIViewSwipeDirection)direction) { - case kUIViewSwipeUp: - keycode = Common::KEYCODE_UP; - break; - case kUIViewSwipeDown: - keycode = Common::KEYCODE_DOWN; - break; - case kUIViewSwipeLeft: - keycode = Common::KEYCODE_LEFT; - break; - case kUIViewSwipeRight: - keycode = Common::KEYCODE_RIGHT; - break; - default: - return false; - } + case kScreenOrientationPortrait: + switch ((UIViewSwipeDirection)direction) { + case kUIViewSwipeUp: + keycode = Common::KEYCODE_UP; break; - case kScreenOrientationLandscape: - switch ((UIViewSwipeDirection)direction) { - case kUIViewSwipeUp: - keycode = Common::KEYCODE_LEFT; - break; - case kUIViewSwipeDown: - keycode = Common::KEYCODE_RIGHT; - break; - case kUIViewSwipeLeft: - keycode = Common::KEYCODE_DOWN; - break; - case kUIViewSwipeRight: - keycode = Common::KEYCODE_UP; - break; - default: - return false; - } + case kUIViewSwipeDown: + keycode = Common::KEYCODE_DOWN; break; - case kScreenOrientationFlippedLandscape: - switch ((UIViewSwipeDirection)direction) { - case kUIViewSwipeUp: - keycode = Common::KEYCODE_RIGHT; - break; - case kUIViewSwipeDown: - keycode = Common::KEYCODE_LEFT; - break; - case kUIViewSwipeLeft: - keycode = Common::KEYCODE_UP; - break; - case kUIViewSwipeRight: - keycode = Common::KEYCODE_DOWN; - break; - default: - return false; - } + case kUIViewSwipeLeft: + keycode = Common::KEYCODE_LEFT; break; + case kUIViewSwipeRight: + keycode = Common::KEYCODE_RIGHT; + break; + default: + return false; + } + break; + case kScreenOrientationLandscape: + switch ((UIViewSwipeDirection)direction) { + case kUIViewSwipeUp: + keycode = Common::KEYCODE_LEFT; + break; + case kUIViewSwipeDown: + keycode = Common::KEYCODE_RIGHT; + break; + case kUIViewSwipeLeft: + keycode = Common::KEYCODE_DOWN; + break; + case kUIViewSwipeRight: + keycode = Common::KEYCODE_UP; + break; + default: + return false; + } + break; + case kScreenOrientationFlippedLandscape: + switch ((UIViewSwipeDirection)direction) { + case kUIViewSwipeUp: + keycode = Common::KEYCODE_RIGHT; + break; + case kUIViewSwipeDown: + keycode = Common::KEYCODE_LEFT; + break; + case kUIViewSwipeLeft: + keycode = Common::KEYCODE_UP; + break; + case kUIViewSwipeRight: + keycode = Common::KEYCODE_DOWN; + break; + default: + return false; + } + break; } event.kbd.keycode = _queuedInputEvent.kbd.keycode = keycode; diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp index b0f475b6ea..ba1604f435 100644 --- a/backends/platform/iphone/osys_main.cpp +++ b/backends/platform/iphone/osys_main.cpp @@ -60,8 +60,7 @@ OSystem_IPHONE::OSystem_IPHONE() : _screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false), _gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false), _mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0), - _overlayHeight(0), _overlayWidth(0), _overlayBuffer(0) -{ + _overlayHeight(0), _overlayWidth(0), _overlayBuffer(0) { _queuedInputEvent.type = Common::EVENT_INVALID; _lastDrawnMouseRect = Common::Rect(0, 0, 0, 0); @@ -272,7 +271,7 @@ void iphone_main(int argc, char *argv[]) { } #ifdef IPHONE_OFFICIAL - chdir( iPhone_getDocumentsDir() ); + chdir(iPhone_getDocumentsDir()); #else system("mkdir " SCUMMVM_ROOT_PATH); system("mkdir " SCUMMVM_SAVE_PATH); diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index 37896cceeb..04b82ab5e4 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -42,12 +42,12 @@ typedef void (*SoundProc)(void *param, byte *buf, int len); typedef int (*TimerProc)(int interval); -typedef struct AQCallbackStruct { - AudioQueueRef queue; - uint32 frameCount; - AudioQueueBufferRef buffers[AUDIO_BUFFERS]; - AudioStreamBasicDescription dataFormat; -} AQCallbackStruct; +struct AQCallbackStruct { + AudioQueueRef queue; + uint32 frameCount; + AudioQueueBufferRef buffers[AUDIO_BUFFERS]; + AudioStreamBasicDescription dataFormat; +}; class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager { protected: @@ -167,7 +167,7 @@ public: static void mixCallback(void *sys, byte *samples, int len); virtual void setupMixer(void); virtual void setTimerCallback(TimerProc callback, int interval); - virtual int getScreenChangeID() const { return _screenChangeCount; } + virtual int getScreenChangeID() const { return _screenChangeCount; } virtual void quit(); virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); @@ -188,10 +188,10 @@ protected: void dirtyFullOverlayScreen(); void clipRectToScreen(int16 &x, int16 &y, int16 &w, int16 &h); void suspendLoop(); - void drawDirtyRect(const Common::Rect& dirtyRect); - void drawDirtyOverlayRect(const Common::Rect& dirtyRect); - void drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect, const Common::Rect& mouseRect); - void updateHardwareSurfaceForRect(const Common::Rect& updatedRect); + void drawDirtyRect(const Common::Rect &dirtyRect); + void drawDirtyOverlayRect(const Common::Rect &dirtyRect); + void drawMouseCursorOnRectUpdate(const Common::Rect &updatedRect, const Common::Rect &mouseRect); + void updateHardwareSurfaceForRect(const Common::Rect &updatedRect); static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB); static int timerHandler(int t); diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp index f9ae5ea06b..8aabe4e6e9 100644 --- a/backends/platform/iphone/osys_video.cpp +++ b/backends/platform/iphone/osys_video.cpp @@ -25,7 +25,7 @@ #include "osys_main.h" -const OSystem::GraphicsMode* OSystem_IPHONE::getSupportedGraphicsModes() const { +const OSystem::GraphicsMode *OSystem_IPHONE::getSupportedGraphicsModes() const { return s_supportedGraphicsModes; } @@ -248,7 +248,7 @@ void OSystem_IPHONE::internUpdateScreen() { } } -void OSystem_IPHONE::drawDirtyRect(const Common::Rect& dirtyRect) { +void OSystem_IPHONE::drawDirtyRect(const Common::Rect &dirtyRect) { int h = dirtyRect.bottom - dirtyRect.top; int w = dirtyRect.right - dirtyRect.left; @@ -263,7 +263,7 @@ void OSystem_IPHONE::drawDirtyRect(const Common::Rect& dirtyRect) { } } -void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect& dirtyRect) { +void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect &dirtyRect) { // int h = dirtyRect.bottom - dirtyRect.top; // // uint16 *src = (uint16 *)&_overlayBuffer[dirtyRect.top * _screenWidth + dirtyRect.left]; @@ -277,7 +277,7 @@ void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect& dirtyRect) { iPhone_updateOverlayRect(_overlayBuffer, dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom); } -void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect, const Common::Rect& mouseRect) { +void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect &updatedRect, const Common::Rect &mouseRect) { //draw mouse on top if (_mouseVisible && (updatedRect.intersects(mouseRect))) { int srcX = 0; @@ -320,8 +320,8 @@ void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect } } -void OSystem_IPHONE::updateHardwareSurfaceForRect(const Common::Rect& updatedRect) { - iPhone_updateScreenRect(_fullscreen, updatedRect.left, updatedRect.top, updatedRect.right, updatedRect.bottom ); +void OSystem_IPHONE::updateHardwareSurfaceForRect(const Common::Rect &updatedRect) { + iPhone_updateScreenRect(_fullscreen, updatedRect.left, updatedRect.top, updatedRect.right, updatedRect.bottom); } Graphics::Surface *OSystem_IPHONE::lockScreen() { @@ -466,7 +466,7 @@ void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspot int texWidth = getSizeNextPOT(w); int texHeight = getSizeNextPOT(h); int bufferSize = texWidth * texHeight * sizeof(int16); - int16* mouseBuf = (int16 *)malloc(bufferSize); + int16 *mouseBuf = (int16 *)malloc(bufferSize); memset(mouseBuf, 0, bufferSize); for (uint x = 0; x < w; ++x) { |