diff options
author | Johannes Schickel | 2012-04-01 23:44:06 +0200 |
---|---|---|
committer | Johannes Schickel | 2012-04-02 00:03:28 +0200 |
commit | a92c54454f151377e0fc34be525b90c42b42d4af (patch) | |
tree | 96dd7d2e64ab1a2c2f5866aa786d5fef942cf0c4 /backends/platform/iphone | |
parent | 6626258e0f8330cf21be63763b8fb2ba7b02a113 (diff) | |
download | scummvm-rg350-a92c54454f151377e0fc34be525b90c42b42d4af.tar.gz scummvm-rg350-a92c54454f151377e0fc34be525b90c42b42d4af.tar.bz2 scummvm-rg350-a92c54454f151377e0fc34be525b90c42b42d4af.zip |
IPHONE: Move event fetching implementation to iPhoneView.
Diffstat (limited to 'backends/platform/iphone')
-rw-r--r-- | backends/platform/iphone/iphone_video.h | 2 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_video.mm | 31 |
2 files changed, 19 insertions, 14 deletions
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h index 0c70b1fe97..ed147eed2a 100644 --- a/backends/platform/iphone/iphone_video.h +++ b/backends/platform/iphone/iphone_video.h @@ -111,6 +111,8 @@ struct InternalEvent { - (void)applicationResume; +- (bool)fetchEvent:(int *)outEvent value1:(int *)v1 value2:(int *)v2; + @end extern iPhoneView *g_iPhoneViewInstance; diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm index 1984c7c36f..da328133c3 100644 --- a/backends/platform/iphone/iphone_video.mm +++ b/backends/platform/iphone/iphone_video.mm @@ -66,20 +66,7 @@ void iPhone_updateScreen() { } bool iPhone_fetchEvent(int *outEvent, int *outX, int *outY) { - [g_iPhoneViewInstance->_eventLock lock]; - Common::List<InternalEvent> &events = g_iPhoneViewInstance->_events; - if (events.empty()) { - [g_iPhoneViewInstance->_eventLock unlock]; - return false; - } - - const InternalEvent &front = *events.begin(); - *outEvent = front.type; - *outX = front.value1; - *outY = front.value2; - events.pop_front(); - [g_iPhoneViewInstance->_eventLock unlock]; - return true; + return [g_iPhoneViewInstance fetchEvent:outEvent value1:outX value2:outY]; } uint getSizeNextPOT(uint size) { @@ -582,6 +569,22 @@ const char *iPhone_getDocumentsDir() { [_eventLock unlock]; } +- (bool)fetchEvent:(int *)outEvent value1:(int *)v1 value2:(int *)v2 { + [_eventLock lock]; + if (_events.empty()) { + [_eventLock unlock]; + return false; + } + + const InternalEvent &front = *_events.begin(); + *outEvent = front.type; + *v1 = front.value1; + *v2 = front.value2; + _events.pop_front(); + [_eventLock unlock]; + return true; +} + /** * Converts portrait mode coordinates into rotated mode coordinates. */ |