diff options
author | Matthew Hoops | 2011-06-13 13:12:23 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-06-13 13:12:23 -0400 |
commit | d355475a0416897ed254fa85f4d63d0f75d9c7ea (patch) | |
tree | 184892480ebb704b28163c51999e50c414e85f8a /backends/platform/iphone | |
parent | 224c71e483e09931ba386555ff3b436b9defe63d (diff) | |
parent | bfa26ffc44f80e4eb3d8590f5f865cda6a5188b7 (diff) | |
download | scummvm-rg350-d355475a0416897ed254fa85f4d63d0f75d9c7ea.tar.gz scummvm-rg350-d355475a0416897ed254fa85f4d63d0f75d9c7ea.tar.bz2 scummvm-rg350-d355475a0416897ed254fa85f4d63d0f75d9c7ea.zip |
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'backends/platform/iphone')
-rw-r--r-- | backends/platform/iphone/iphone_video.h | 1 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_video.m | 18 | ||||
-rw-r--r-- | backends/platform/iphone/osys_main.cpp | 46 | ||||
-rw-r--r-- | backends/platform/iphone/osys_main.h | 11 | ||||
-rw-r--r-- | backends/platform/iphone/osys_video.cpp | 3 |
5 files changed, 27 insertions, 52 deletions
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h index 8e0ffc19cb..223f025978 100644 --- a/backends/platform/iphone/iphone_video.h +++ b/backends/platform/iphone/iphone_video.h @@ -67,6 +67,7 @@ - (void)updateMainSurface; - (void)updateOverlaySurface; - (void)updateMouseSurface; +- (void)clearColorBuffer; -(void)updateMouseCursor; diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index 006603df64..04d25cebf8 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -85,6 +85,8 @@ void iPhone_setMouseCursor(short* buffer, int width, int height) { void iPhone_enableOverlay(int state) { _overlayIsEnabled = state; + + [sharedInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES]; } int iPhone_getScreenHeight() { @@ -478,12 +480,7 @@ bool getLocalMouseCoords(CGPoint *point) { glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError(); - // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later. - int clearCount = 5; - while (clearCount-- > 0) { - glClear(GL_COLOR_BUFFER_BIT); printOpenGLError(); - [_context presentRenderbuffer:GL_RENDERBUFFER_OES]; - } + [self clearColorBuffer]; if (_keyboardView != nil) { [_keyboardView removeFromSuperview]; @@ -535,6 +532,15 @@ bool getLocalMouseCoords(CGPoint *point) { } } +- (void)clearColorBuffer { + // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later. + int clearCount = 5; + while (clearCount-- > 0) { + glClear(GL_COLOR_BUFFER_BIT); printOpenGLError(); + [_context presentRenderbuffer:GL_RENDERBUFFER_OES]; + } +} + - (id)getEvent { if (_events == nil || [_events count] == 0) { return nil; diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp index 12317ad935..9325ed50bf 100644 --- a/backends/platform/iphone/osys_main.cpp +++ b/backends/platform/iphone/osys_main.cpp @@ -53,7 +53,7 @@ SoundProc OSystem_IPHONE::s_soundCallback = NULL; void *OSystem_IPHONE::s_soundParam = NULL; OSystem_IPHONE::OSystem_IPHONE() : - _savefile(NULL), _mixer(NULL), _timer(NULL), _offscreen(NULL), + _mixer(NULL), _offscreen(NULL), _overlayVisible(false), _fullscreen(NULL), _mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0), _queuedEventTime(0), _secondaryTapped(false), _lastSecondaryTap(0), @@ -72,10 +72,7 @@ OSystem_IPHONE::OSystem_IPHONE() : OSystem_IPHONE::~OSystem_IPHONE() { AudioQueueDispose(s_AudioQueue.queue, true); - delete _fsFactory; - delete _savefile; delete _mixer; - delete _timer; delete _offscreen; delete _fullscreen; } @@ -88,12 +85,12 @@ int OSystem_IPHONE::timerHandler(int t) { void OSystem_IPHONE::initBackend() { #ifdef IPHONE_OFFICIAL - _savefile = new DefaultSaveFileManager(iPhone_getDocumentsDir()); + _savefileManager = new DefaultSaveFileManager(iPhone_getDocumentsDir()); #else - _savefile = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH); + _savefileManager = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH); #endif - _timer = new DefaultTimerManager(); + _timerManager = new DefaultTimerManager(); gettimeofday(&_startTime, NULL); @@ -101,7 +98,7 @@ void OSystem_IPHONE::initBackend() { setTimerCallback(&OSystem_IPHONE::timerHandler, 10); - OSystem::initBackend(); + EventsBaseBackend::initBackend(); } bool OSystem_IPHONE::hasFeature(Feature f) { @@ -210,48 +207,25 @@ void OSystem_IPHONE::getTimeAndDate(TimeDate &td) const { td.tm_year = t.tm_year; } -Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() { - assert(_savefile); - return _savefile; -} - Audio::Mixer *OSystem_IPHONE::getMixer() { assert(_mixer); return _mixer; } -Common::TimerManager *OSystem_IPHONE::getTimerManager() { - assert(_timer); - return _timer; -} - OSystem *OSystem_IPHONE_create() { return new OSystem_IPHONE(); } -Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() { +Common::String OSystem_IPHONE::getDefaultConfigFileName() { #ifdef IPHONE_OFFICIAL - char buf[256]; - strncpy(buf, iPhone_getDocumentsDir(), 256); - strncat(buf, "/Preferences", 256 - strlen(buf) ); - Common::FSNode file(buf); + Common::String path = iPhone_getDocumentsDir(); + path += "/Preferences"; + return path; #else - Common::FSNode file(SCUMMVM_PREFS_PATH); + return SCUMMVM_PREFS_PATH; #endif - return file.createReadStream(); } -Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() { -#ifdef IPHONE_OFFICIAL - char buf[256]; - strncpy(buf, iPhone_getDocumentsDir(), 256); - strncat(buf, "/Preferences", 256 - strlen(buf) ); - Common::FSNode file(buf); -#else - Common::FSNode file(SCUMMVM_PREFS_PATH); -#endif - return file.createWriteStream(); -} void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { // Get URL of the Resource directory of the .app bundle diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index 1ff87967a1..14325f8090 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -49,7 +49,7 @@ typedef struct AQCallbackStruct { AudioStreamBasicDescription dataFormat; } AQCallbackStruct; -class OSystem_IPHONE : public BaseBackend, public PaletteManager { +class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager { protected: static const OSystem::GraphicsMode s_supportedGraphicsModes[]; @@ -57,9 +57,7 @@ protected: static SoundProc s_soundCallback; static void *s_soundParam; - Common::SaveFileManager *_savefile; Audio::MixerImpl *_mixer; - Common::TimerManager *_timer; Graphics::Surface _framebuffer; byte *_offscreen; @@ -110,7 +108,6 @@ protected: bool _fullScreenIsDirty; bool _fullScreenOverlayIsDirty; int _screenChangeCount; - FilesystemFactory *_fsFactory; public: @@ -173,19 +170,15 @@ public: virtual int getScreenChangeID() const { return _screenChangeCount; } virtual void quit(); - FilesystemFactory *getFilesystemFactory() { return _fsFactory; } virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); virtual void getTimeAndDate(TimeDate &t) const; - virtual Common::SaveFileManager *getSavefileManager(); virtual Audio::Mixer *getMixer(); - virtual Common::TimerManager *getTimerManager(); void startSoundsystem(); void stopSoundsystem(); - virtual Common::SeekableReadStream *createConfigReadStream(); - virtual Common::WriteStream *createConfigWriteStream(); + virtual Common::String getDefaultConfigFileName(); protected: void internUpdateScreen(); diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp index 263cbd2bcc..fa425b108a 100644 --- a/backends/platform/iphone/osys_video.cpp +++ b/backends/platform/iphone/osys_video.cpp @@ -349,6 +349,7 @@ void OSystem_IPHONE::showOverlay() { //printf("showOverlay()\n"); _overlayVisible = true; dirtyFullOverlayScreen(); + updateScreen(); iPhone_enableOverlay(true); } @@ -368,7 +369,7 @@ void OSystem_IPHONE::clearOverlay() { void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) { //printf("grabOverlay()\n"); - int h = _screenHeight; + int h = _overlayHeight; OverlayColor *src = _overlayBuffer; do { |