aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/iphone
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/iphone')
-rw-r--r--backends/platform/iphone/iphone_video.h1
-rw-r--r--backends/platform/iphone/iphone_video.m18
-rw-r--r--backends/platform/iphone/osys_events.cpp4
-rw-r--r--backends/platform/iphone/osys_main.cpp58
-rw-r--r--backends/platform/iphone/osys_main.h13
-rw-r--r--backends/platform/iphone/osys_video.cpp3
6 files changed, 43 insertions, 54 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_events.cpp b/backends/platform/iphone/osys_events.cpp
index 6e2a4b7e1e..1ab1db0f27 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -335,9 +335,9 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x,
const char *dialogMsg;
if (_mouseClickAndDragEnabled) {
_touchpadModeEnabled = false;
- dialogMsg = "Mouse-click-and-drag mode enabled.";
+ dialogMsg = _("Mouse-click-and-drag mode enabled.");
} else
- dialogMsg = "Mouse-click-and-drag mode disabled.";
+ dialogMsg = _("Mouse-click-and-drag mode disabled.");
GUI::TimedMessageDialog dialog(dialogMsg, 1500);
dialog.runModal();
return false;
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 12317ad935..4bc567c39d 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
@@ -268,6 +242,18 @@ void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit
}
}
+void OSystem_IPHONE::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+}
+
void iphone_main(int argc, char *argv[]) {
//OSystem_IPHONE::migrateApp();
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 1ff87967a1..37896cceeb 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,17 @@ 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();
+
+ virtual void logMessage(LogMessageType::Type type, const char *message);
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 {