IPHONE: Use VideoContext in OSystem_IPHONE.
This commit is contained in:
parent
ab15435ad0
commit
99ffbfedbc
4 changed files with 95 additions and 101 deletions
|
@ -122,8 +122,8 @@ bool OSystem_IPHONE::handleEvent_mouseDown(Common::Event &event, int x, int y) {
|
||||||
|
|
||||||
if (_mouseClickAndDragEnabled) {
|
if (_mouseClickAndDragEnabled) {
|
||||||
event.type = Common::EVENT_LBUTTONDOWN;
|
event.type = Common::EVENT_LBUTTONDOWN;
|
||||||
event.mouse.x = _mouseX;
|
event.mouse.x = _videoContext.mouseX;
|
||||||
event.mouse.y = _mouseY;
|
event.mouse.y = _videoContext.mouseY;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
_lastMouseDown = getMillis();
|
_lastMouseDown = getMillis();
|
||||||
|
@ -140,17 +140,17 @@ bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) {
|
||||||
return false;
|
return false;
|
||||||
} else if (_mouseClickAndDragEnabled) {
|
} else if (_mouseClickAndDragEnabled) {
|
||||||
event.type = Common::EVENT_LBUTTONUP;
|
event.type = Common::EVENT_LBUTTONUP;
|
||||||
event.mouse.x = _mouseX;
|
event.mouse.x = _videoContext.mouseX;
|
||||||
event.mouse.y = _mouseY;
|
event.mouse.y = _videoContext.mouseY;
|
||||||
} else {
|
} else {
|
||||||
if (getMillis() - _lastMouseDown < 250) {
|
if (getMillis() - _lastMouseDown < 250) {
|
||||||
event.type = Common::EVENT_LBUTTONDOWN;
|
event.type = Common::EVENT_LBUTTONDOWN;
|
||||||
event.mouse.x = _mouseX;
|
event.mouse.x = _videoContext.mouseX;
|
||||||
event.mouse.y = _mouseY;
|
event.mouse.y = _videoContext.mouseY;
|
||||||
|
|
||||||
_queuedInputEvent.type = Common::EVENT_LBUTTONUP;
|
_queuedInputEvent.type = Common::EVENT_LBUTTONUP;
|
||||||
_queuedInputEvent.mouse.x = _mouseX;
|
_queuedInputEvent.mouse.x = _videoContext.mouseX;
|
||||||
_queuedInputEvent.mouse.y = _mouseY;
|
_queuedInputEvent.mouse.y = _videoContext.mouseY;
|
||||||
_lastMouseTap = getMillis();
|
_lastMouseTap = getMillis();
|
||||||
_queuedEventTime = _lastMouseTap + kQueuedInputEventDelay;
|
_queuedEventTime = _lastMouseTap + kQueuedInputEventDelay;
|
||||||
} else
|
} else
|
||||||
|
@ -167,12 +167,12 @@ bool OSystem_IPHONE::handleEvent_secondMouseDown(Common::Event &event, int x, in
|
||||||
|
|
||||||
if (_mouseClickAndDragEnabled) {
|
if (_mouseClickAndDragEnabled) {
|
||||||
event.type = Common::EVENT_LBUTTONUP;
|
event.type = Common::EVENT_LBUTTONUP;
|
||||||
event.mouse.x = _mouseX;
|
event.mouse.x = _videoContext.mouseX;
|
||||||
event.mouse.y = _mouseY;
|
event.mouse.y = _videoContext.mouseY;
|
||||||
|
|
||||||
_queuedInputEvent.type = Common::EVENT_RBUTTONDOWN;
|
_queuedInputEvent.type = Common::EVENT_RBUTTONDOWN;
|
||||||
_queuedInputEvent.mouse.x = _mouseX;
|
_queuedInputEvent.mouse.x = _videoContext.mouseX;
|
||||||
_queuedInputEvent.mouse.y = _mouseY;
|
_queuedInputEvent.mouse.y = _videoContext.mouseY;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int
|
||||||
|
|
||||||
if (curTime - _lastSecondaryDown < 400) {
|
if (curTime - _lastSecondaryDown < 400) {
|
||||||
//printf("Right tap!\n");
|
//printf("Right tap!\n");
|
||||||
if (curTime - _lastSecondaryTap < 400 && !_overlayVisible) {
|
if (curTime - _lastSecondaryTap < 400 && !_videoContext.overlayVisible) {
|
||||||
//printf("Right escape!\n");
|
//printf("Right escape!\n");
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
event.type = Common::EVENT_KEYDOWN;
|
||||||
_queuedInputEvent.type = Common::EVENT_KEYUP;
|
_queuedInputEvent.type = Common::EVENT_KEYUP;
|
||||||
|
@ -197,11 +197,11 @@ bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int
|
||||||
} else if (!_mouseClickAndDragEnabled) {
|
} else if (!_mouseClickAndDragEnabled) {
|
||||||
//printf("Rightclick!\n");
|
//printf("Rightclick!\n");
|
||||||
event.type = Common::EVENT_RBUTTONDOWN;
|
event.type = Common::EVENT_RBUTTONDOWN;
|
||||||
event.mouse.x = _mouseX;
|
event.mouse.x = _videoContext.mouseX;
|
||||||
event.mouse.y = _mouseY;
|
event.mouse.y = _videoContext.mouseY;
|
||||||
_queuedInputEvent.type = Common::EVENT_RBUTTONUP;
|
_queuedInputEvent.type = Common::EVENT_RBUTTONUP;
|
||||||
_queuedInputEvent.mouse.x = _mouseX;
|
_queuedInputEvent.mouse.x = _videoContext.mouseX;
|
||||||
_queuedInputEvent.mouse.y = _mouseY;
|
_queuedInputEvent.mouse.y = _videoContext.mouseY;
|
||||||
_lastSecondaryTap = curTime;
|
_lastSecondaryTap = curTime;
|
||||||
_queuedEventTime = curTime + kQueuedInputEventDelay;
|
_queuedEventTime = curTime + kQueuedInputEventDelay;
|
||||||
} else {
|
} else {
|
||||||
|
@ -211,8 +211,8 @@ bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int
|
||||||
}
|
}
|
||||||
if (_mouseClickAndDragEnabled) {
|
if (_mouseClickAndDragEnabled) {
|
||||||
event.type = Common::EVENT_RBUTTONUP;
|
event.type = Common::EVENT_RBUTTONUP;
|
||||||
event.mouse.x = _mouseX;
|
event.mouse.x = _videoContext.mouseX;
|
||||||
event.mouse.y = _mouseY;
|
event.mouse.y = _videoContext.mouseY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -234,11 +234,11 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y
|
||||||
_lastPadX = x;
|
_lastPadX = x;
|
||||||
_lastPadY = y;
|
_lastPadY = y;
|
||||||
|
|
||||||
mouseNewPosX = (int)(_mouseX - deltaX / 0.5f);
|
mouseNewPosX = (int)(_videoContext.mouseX - deltaX / 0.5f);
|
||||||
mouseNewPosY = (int)(_mouseY - deltaY / 0.5f);
|
mouseNewPosY = (int)(_videoContext.mouseY - deltaY / 0.5f);
|
||||||
|
|
||||||
int widthCap = _overlayVisible ? _overlayWidth : _screenWidth;
|
int widthCap = _videoContext.overlayVisible ? _videoContext.overlayWidth : _videoContext.screenWidth;
|
||||||
int heightCap = _overlayVisible ? _overlayHeight : _screenHeight;
|
int heightCap = _videoContext.overlayVisible ? _videoContext.overlayHeight : _videoContext.screenHeight;
|
||||||
|
|
||||||
if (mouseNewPosX < 0)
|
if (mouseNewPosX < 0)
|
||||||
mouseNewPosX = 0;
|
mouseNewPosX = 0;
|
||||||
|
@ -350,10 +350,10 @@ void OSystem_IPHONE::handleEvent_orientationChanged(int orientation) {
|
||||||
|
|
||||||
if (_screenOrientation != newOrientation) {
|
if (_screenOrientation != newOrientation) {
|
||||||
_screenOrientation = newOrientation;
|
_screenOrientation = newOrientation;
|
||||||
iPhone_initSurface(_screenWidth, _screenHeight);
|
iPhone_initSurface(_videoContext.screenWidth, _videoContext.screenHeight);
|
||||||
|
|
||||||
dirtyFullScreen();
|
dirtyFullScreen();
|
||||||
if (_overlayVisible)
|
if (_videoContext.overlayVisible)
|
||||||
dirtyFullOverlayScreen();
|
dirtyFullOverlayScreen();
|
||||||
updateScreen();
|
updateScreen();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,18 +55,21 @@ SoundProc OSystem_IPHONE::s_soundCallback = NULL;
|
||||||
void *OSystem_IPHONE::s_soundParam = NULL;
|
void *OSystem_IPHONE::s_soundParam = NULL;
|
||||||
|
|
||||||
OSystem_IPHONE::OSystem_IPHONE() :
|
OSystem_IPHONE::OSystem_IPHONE() :
|
||||||
_mixer(NULL), _gameScreenRaw(NULL),
|
_mixer(NULL), _gameScreenRaw(NULL), _gameScreenConverted(NULL),
|
||||||
_overlayVisible(false), _gameScreenConverted(NULL),
|
_mouseBuf(NULL), _lastMouseTap(0), _queuedEventTime(0),
|
||||||
_mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0), _queuedEventTime(0),
|
|
||||||
_mouseNeedTextureUpdate(false), _secondaryTapped(false), _lastSecondaryTap(0),
|
_mouseNeedTextureUpdate(false), _secondaryTapped(false), _lastSecondaryTap(0),
|
||||||
_screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
|
_screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
|
||||||
_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false),
|
_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false),
|
||||||
_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
|
_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
|
||||||
_overlayHeight(0), _overlayWidth(0), _overlayBuffer(0), _mouseCursorPaletteEnabled(false),
|
_overlayBuffer(0), _mouseCursorPaletteEnabled(false) {
|
||||||
_currentGraphicsMode(kGraphicsModeLinear) {
|
|
||||||
_queuedInputEvent.type = Common::EVENT_INVALID;
|
_queuedInputEvent.type = Common::EVENT_INVALID;
|
||||||
_touchpadModeEnabled = !iPhone_isHighResDevice();
|
_touchpadModeEnabled = !iPhone_isHighResDevice();
|
||||||
_fsFactory = new POSIXFilesystemFactory();
|
_fsFactory = new POSIXFilesystemFactory();
|
||||||
|
|
||||||
|
_videoContext.mouseWidth = _videoContext.mouseHeight = 0;
|
||||||
|
_videoContext.overlayWidth = _videoContext.overlayHeight = 0;
|
||||||
|
_videoContext.overlayVisible = false;
|
||||||
|
_videoContext.graphicsMode = kGraphicsModeLinear;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSystem_IPHONE::~OSystem_IPHONE() {
|
OSystem_IPHONE::~OSystem_IPHONE() {
|
||||||
|
|
|
@ -59,15 +59,13 @@ protected:
|
||||||
static SoundProc s_soundCallback;
|
static SoundProc s_soundCallback;
|
||||||
static void *s_soundParam;
|
static void *s_soundParam;
|
||||||
|
|
||||||
int _currentGraphicsMode;
|
|
||||||
|
|
||||||
Audio::MixerImpl *_mixer;
|
Audio::MixerImpl *_mixer;
|
||||||
|
|
||||||
|
VideoContext _videoContext;
|
||||||
|
|
||||||
Graphics::Surface _framebuffer;
|
Graphics::Surface _framebuffer;
|
||||||
byte *_gameScreenRaw;
|
byte *_gameScreenRaw;
|
||||||
OverlayColor *_overlayBuffer;
|
OverlayColor *_overlayBuffer;
|
||||||
uint16 _overlayHeight;
|
|
||||||
uint16 _overlayWidth;
|
|
||||||
|
|
||||||
uint16 *_gameScreenConverted;
|
uint16 *_gameScreenConverted;
|
||||||
|
|
||||||
|
@ -75,21 +73,14 @@ protected:
|
||||||
uint16 _gamePalette[256];
|
uint16 _gamePalette[256];
|
||||||
// For use with the mouse texture
|
// For use with the mouse texture
|
||||||
uint16 _gamePaletteRGBA5551[256];
|
uint16 _gamePaletteRGBA5551[256];
|
||||||
bool _overlayVisible;
|
|
||||||
uint16 _screenWidth;
|
|
||||||
uint16 _screenHeight;
|
|
||||||
|
|
||||||
struct timeval _startTime;
|
struct timeval _startTime;
|
||||||
uint32 _timeSuspended;
|
uint32 _timeSuspended;
|
||||||
|
|
||||||
bool _mouseVisible;
|
|
||||||
bool _mouseCursorPaletteEnabled;
|
bool _mouseCursorPaletteEnabled;
|
||||||
uint16 _mouseCursorPalette[256];
|
uint16 _mouseCursorPalette[256];
|
||||||
byte *_mouseBuf;
|
byte *_mouseBuf;
|
||||||
byte _mouseKeyColor;
|
byte _mouseKeyColor;
|
||||||
uint _mouseWidth, _mouseHeight;
|
|
||||||
uint _mouseX, _mouseY;
|
|
||||||
int _mouseHotspotX, _mouseHotspotY;
|
|
||||||
bool _mouseDirty;
|
bool _mouseDirty;
|
||||||
bool _mouseNeedTextureUpdate;
|
bool _mouseNeedTextureUpdate;
|
||||||
long _lastMouseDown;
|
long _lastMouseDown;
|
||||||
|
|
|
@ -38,7 +38,7 @@ bool OSystem_IPHONE::setGraphicsMode(int mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case kGraphicsModeNone:
|
case kGraphicsModeNone:
|
||||||
case kGraphicsModeLinear:
|
case kGraphicsModeLinear:
|
||||||
_currentGraphicsMode = mode;
|
_videoContext.graphicsMode = (GraphicsModes)mode;
|
||||||
iPhone_setGraphicsMode((GraphicsModes)mode);
|
iPhone_setGraphicsMode((GraphicsModes)mode);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -48,14 +48,14 @@ bool OSystem_IPHONE::setGraphicsMode(int mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int OSystem_IPHONE::getGraphicsMode() const {
|
int OSystem_IPHONE::getGraphicsMode() const {
|
||||||
return _currentGraphicsMode;
|
return _videoContext.graphicsMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
|
void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
|
||||||
//printf("initSize(%i, %i)\n", width, height);
|
//printf("initSize(%i, %i)\n", width, height);
|
||||||
|
|
||||||
_screenWidth = width;
|
_videoContext.screenWidth = width;
|
||||||
_screenHeight = height;
|
_videoContext.screenHeight = height;
|
||||||
|
|
||||||
free(_gameScreenRaw);
|
free(_gameScreenRaw);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
|
||||||
|
|
||||||
//free(_overlayBuffer);
|
//free(_overlayBuffer);
|
||||||
|
|
||||||
int fullSize = _screenWidth * _screenHeight * sizeof(OverlayColor);
|
int fullSize = _videoContext.screenWidth * _videoContext.screenHeight * sizeof(OverlayColor);
|
||||||
//_overlayBuffer = (OverlayColor *)malloc(fullSize);
|
//_overlayBuffer = (OverlayColor *)malloc(fullSize);
|
||||||
clearOverlay();
|
clearOverlay();
|
||||||
|
|
||||||
|
@ -76,27 +76,27 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
|
||||||
iPhone_initSurface(width, height);
|
iPhone_initSurface(width, height);
|
||||||
|
|
||||||
if (_overlayBuffer == NULL) {
|
if (_overlayBuffer == NULL) {
|
||||||
_overlayHeight = iPhone_getScreenHeight();
|
_videoContext.overlayHeight = iPhone_getScreenHeight();
|
||||||
_overlayWidth = iPhone_getScreenWidth();
|
_videoContext.overlayWidth = iPhone_getScreenWidth();
|
||||||
|
|
||||||
printf("Overlay: (%u x %u)\n", _overlayWidth, _overlayHeight);
|
printf("Overlay: (%u x %u)\n", _videoContext.overlayWidth, _videoContext.overlayHeight);
|
||||||
_overlayBuffer = new OverlayColor[_overlayHeight * _overlayWidth];
|
_overlayBuffer = new OverlayColor[_videoContext.overlayHeight * _videoContext.overlayWidth];
|
||||||
}
|
}
|
||||||
|
|
||||||
_fullScreenIsDirty = false;
|
_fullScreenIsDirty = false;
|
||||||
dirtyFullScreen();
|
dirtyFullScreen();
|
||||||
_mouseVisible = false;
|
_videoContext.mouseIsVisible = false;
|
||||||
_mouseCursorPaletteEnabled = false;
|
_mouseCursorPaletteEnabled = false;
|
||||||
_screenChangeCount++;
|
_screenChangeCount++;
|
||||||
updateScreen();
|
updateScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 OSystem_IPHONE::getHeight() {
|
int16 OSystem_IPHONE::getHeight() {
|
||||||
return _screenHeight;
|
return _videoContext.screenHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 OSystem_IPHONE::getWidth() {
|
int16 OSystem_IPHONE::getWidth() {
|
||||||
return _screenWidth;
|
return _videoContext.screenWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
|
void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
|
||||||
|
@ -137,12 +137,12 @@ void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y,
|
||||||
y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w > _screenWidth - x) {
|
if (w > _videoContext.screenWidth - x) {
|
||||||
w = _screenWidth - x;
|
w = _videoContext.screenWidth - x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h > _screenHeight - y) {
|
if (h > _videoContext.screenHeight - y) {
|
||||||
h = _screenHeight - y;
|
h = _videoContext.screenHeight - y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w <= 0 || h <= 0)
|
if (w <= 0 || h <= 0)
|
||||||
|
@ -153,14 +153,14 @@ void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
byte *dst = _gameScreenRaw + y * _screenWidth + x;
|
byte *dst = _gameScreenRaw + y * _videoContext.screenWidth + x;
|
||||||
if (_screenWidth == pitch && pitch == w)
|
if (_videoContext.screenWidth == pitch && pitch == w)
|
||||||
memcpy(dst, buf, h * w);
|
memcpy(dst, buf, h * w);
|
||||||
else {
|
else {
|
||||||
do {
|
do {
|
||||||
memcpy(dst, buf, w);
|
memcpy(dst, buf, w);
|
||||||
buf += pitch;
|
buf += pitch;
|
||||||
dst += _screenWidth;
|
dst += _videoContext.screenWidth;
|
||||||
} while (--h);
|
} while (--h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ void OSystem_IPHONE::updateScreen() {
|
||||||
_fullScreenIsDirty = false;
|
_fullScreenIsDirty = false;
|
||||||
_fullScreenOverlayIsDirty = false;
|
_fullScreenOverlayIsDirty = false;
|
||||||
|
|
||||||
iPhone_updateScreen(_mouseX, _mouseY);
|
iPhone_updateScreen(_videoContext.mouseX, _videoContext.mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_IPHONE::internUpdateScreen() {
|
void OSystem_IPHONE::internUpdateScreen() {
|
||||||
|
@ -193,7 +193,7 @@ void OSystem_IPHONE::internUpdateScreen() {
|
||||||
updateHardwareSurfaceForRect(dirtyRect);
|
updateHardwareSurfaceForRect(dirtyRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_overlayVisible) {
|
if (_videoContext.overlayVisible) {
|
||||||
while (_dirtyOverlayRects.size()) {
|
while (_dirtyOverlayRects.size()) {
|
||||||
Common::Rect dirtyRect = _dirtyOverlayRects.remove_at(_dirtyOverlayRects.size() - 1);
|
Common::Rect dirtyRect = _dirtyOverlayRects.remove_at(_dirtyOverlayRects.size() - 1);
|
||||||
|
|
||||||
|
@ -207,14 +207,14 @@ void OSystem_IPHONE::drawDirtyRect(const Common::Rect &dirtyRect) {
|
||||||
int h = dirtyRect.bottom - dirtyRect.top;
|
int h = dirtyRect.bottom - dirtyRect.top;
|
||||||
int w = dirtyRect.right - dirtyRect.left;
|
int w = dirtyRect.right - dirtyRect.left;
|
||||||
|
|
||||||
byte *src = &_gameScreenRaw[dirtyRect.top * _screenWidth + dirtyRect.left];
|
byte *src = &_gameScreenRaw[dirtyRect.top * _videoContext.screenWidth + dirtyRect.left];
|
||||||
uint16 *dst = &_gameScreenConverted[dirtyRect.top * _screenWidth + dirtyRect.left];
|
uint16 *dst = &_gameScreenConverted[dirtyRect.top * _videoContext.screenWidth + dirtyRect.left];
|
||||||
for (int y = h; y > 0; y--) {
|
for (int y = h; y > 0; y--) {
|
||||||
for (int x = w; x > 0; x--)
|
for (int x = w; x > 0; x--)
|
||||||
*dst++ = _gamePalette[*src++];
|
*dst++ = _gamePalette[*src++];
|
||||||
|
|
||||||
dst += _screenWidth - w;
|
dst += _videoContext.screenWidth - w;
|
||||||
src += _screenWidth - w;
|
src += _videoContext.screenWidth - w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,9 +230,9 @@ Graphics::Surface *OSystem_IPHONE::lockScreen() {
|
||||||
//printf("lockScreen()\n");
|
//printf("lockScreen()\n");
|
||||||
|
|
||||||
_framebuffer.pixels = _gameScreenRaw;
|
_framebuffer.pixels = _gameScreenRaw;
|
||||||
_framebuffer.w = _screenWidth;
|
_framebuffer.w = _videoContext.screenWidth;
|
||||||
_framebuffer.h = _screenHeight;
|
_framebuffer.h = _videoContext.screenHeight;
|
||||||
_framebuffer.pitch = _screenWidth;
|
_framebuffer.pitch = _videoContext.screenWidth;
|
||||||
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
|
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
|
||||||
|
|
||||||
return &_framebuffer;
|
return &_framebuffer;
|
||||||
|
@ -252,7 +252,7 @@ void OSystem_IPHONE::setShakePos(int shakeOffset) {
|
||||||
|
|
||||||
void OSystem_IPHONE::showOverlay() {
|
void OSystem_IPHONE::showOverlay() {
|
||||||
//printf("showOverlay()\n");
|
//printf("showOverlay()\n");
|
||||||
_overlayVisible = true;
|
_videoContext.overlayVisible = true;
|
||||||
dirtyFullOverlayScreen();
|
dirtyFullOverlayScreen();
|
||||||
updateScreen();
|
updateScreen();
|
||||||
iPhone_enableOverlay(true);
|
iPhone_enableOverlay(true);
|
||||||
|
@ -260,7 +260,7 @@ void OSystem_IPHONE::showOverlay() {
|
||||||
|
|
||||||
void OSystem_IPHONE::hideOverlay() {
|
void OSystem_IPHONE::hideOverlay() {
|
||||||
//printf("hideOverlay()\n");
|
//printf("hideOverlay()\n");
|
||||||
_overlayVisible = false;
|
_videoContext.overlayVisible = false;
|
||||||
_dirtyOverlayRects.clear();
|
_dirtyOverlayRects.clear();
|
||||||
dirtyFullScreen();
|
dirtyFullScreen();
|
||||||
iPhone_enableOverlay(false);
|
iPhone_enableOverlay(false);
|
||||||
|
@ -268,18 +268,18 @@ void OSystem_IPHONE::hideOverlay() {
|
||||||
|
|
||||||
void OSystem_IPHONE::clearOverlay() {
|
void OSystem_IPHONE::clearOverlay() {
|
||||||
//printf("clearOverlay()\n");
|
//printf("clearOverlay()\n");
|
||||||
bzero(_overlayBuffer, _overlayWidth * _overlayHeight * sizeof(OverlayColor));
|
bzero(_overlayBuffer, _videoContext.overlayWidth * _videoContext.overlayHeight * sizeof(OverlayColor));
|
||||||
dirtyFullOverlayScreen();
|
dirtyFullOverlayScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
|
void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
|
||||||
//printf("grabOverlay()\n");
|
//printf("grabOverlay()\n");
|
||||||
int h = _overlayHeight;
|
int h = _videoContext.overlayHeight;
|
||||||
OverlayColor *src = _overlayBuffer;
|
OverlayColor *src = _overlayBuffer;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
memcpy(buf, src, _overlayWidth * sizeof(OverlayColor));
|
memcpy(buf, src, _videoContext.overlayWidth * sizeof(OverlayColor));
|
||||||
src += _overlayWidth;
|
src += _videoContext.overlayWidth;
|
||||||
buf += pitch;
|
buf += pitch;
|
||||||
} while (--h);
|
} while (--h);
|
||||||
}
|
}
|
||||||
|
@ -300,11 +300,11 @@ void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x
|
||||||
y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w > _overlayWidth - x)
|
if (w > _videoContext.overlayWidth - x)
|
||||||
w = _overlayWidth - x;
|
w = _videoContext.overlayWidth - x;
|
||||||
|
|
||||||
if (h > _overlayHeight - y)
|
if (h > _videoContext.overlayHeight - y)
|
||||||
h = _overlayHeight - y;
|
h = _videoContext.overlayHeight - y;
|
||||||
|
|
||||||
if (w <= 0 || h <= 0)
|
if (w <= 0 || h <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -313,29 +313,29 @@ void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x
|
||||||
_dirtyOverlayRects.push_back(Common::Rect(x, y, x + w, y + h));
|
_dirtyOverlayRects.push_back(Common::Rect(x, y, x + w, y + h));
|
||||||
}
|
}
|
||||||
|
|
||||||
OverlayColor *dst = _overlayBuffer + (y * _overlayWidth + x);
|
OverlayColor *dst = _overlayBuffer + (y * _videoContext.overlayWidth + x);
|
||||||
if (_overlayWidth == pitch && pitch == w)
|
if (_videoContext.overlayWidth == pitch && pitch == w)
|
||||||
memcpy(dst, buf, h * w * sizeof(OverlayColor));
|
memcpy(dst, buf, h * w * sizeof(OverlayColor));
|
||||||
else {
|
else {
|
||||||
do {
|
do {
|
||||||
memcpy(dst, buf, w * sizeof(OverlayColor));
|
memcpy(dst, buf, w * sizeof(OverlayColor));
|
||||||
buf += pitch;
|
buf += pitch;
|
||||||
dst += _overlayWidth;
|
dst += _videoContext.overlayWidth;
|
||||||
} while (--h);
|
} while (--h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 OSystem_IPHONE::getOverlayHeight() {
|
int16 OSystem_IPHONE::getOverlayHeight() {
|
||||||
return _overlayHeight;
|
return _videoContext.overlayHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 OSystem_IPHONE::getOverlayWidth() {
|
int16 OSystem_IPHONE::getOverlayWidth() {
|
||||||
return _overlayWidth;
|
return _videoContext.overlayWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OSystem_IPHONE::showMouse(bool visible) {
|
bool OSystem_IPHONE::showMouse(bool visible) {
|
||||||
bool last = _mouseVisible;
|
bool last = _videoContext.mouseIsVisible;
|
||||||
_mouseVisible = visible;
|
_videoContext.mouseIsVisible = visible;
|
||||||
iPhone_showCursor(visible);
|
iPhone_showCursor(visible);
|
||||||
_mouseDirty = true;
|
_mouseDirty = true;
|
||||||
|
|
||||||
|
@ -345,15 +345,15 @@ bool OSystem_IPHONE::showMouse(bool visible) {
|
||||||
void OSystem_IPHONE::warpMouse(int x, int y) {
|
void OSystem_IPHONE::warpMouse(int x, int y) {
|
||||||
//printf("warpMouse()\n");
|
//printf("warpMouse()\n");
|
||||||
|
|
||||||
_mouseX = x;
|
_videoContext.mouseX = x;
|
||||||
_mouseY = y;
|
_videoContext.mouseY = y;
|
||||||
_mouseDirty = true;
|
_mouseDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_IPHONE::dirtyFullScreen() {
|
void OSystem_IPHONE::dirtyFullScreen() {
|
||||||
if (!_fullScreenIsDirty) {
|
if (!_fullScreenIsDirty) {
|
||||||
_dirtyRects.clear();
|
_dirtyRects.clear();
|
||||||
_dirtyRects.push_back(Common::Rect(0, 0, _screenWidth, _screenHeight));
|
_dirtyRects.push_back(Common::Rect(0, 0, _videoContext.screenWidth, _videoContext.screenHeight));
|
||||||
_fullScreenIsDirty = true;
|
_fullScreenIsDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ void OSystem_IPHONE::dirtyFullScreen() {
|
||||||
void OSystem_IPHONE::dirtyFullOverlayScreen() {
|
void OSystem_IPHONE::dirtyFullOverlayScreen() {
|
||||||
if (!_fullScreenOverlayIsDirty) {
|
if (!_fullScreenOverlayIsDirty) {
|
||||||
_dirtyOverlayRects.clear();
|
_dirtyOverlayRects.clear();
|
||||||
_dirtyOverlayRects.push_back(Common::Rect(0, 0, _overlayWidth, _overlayHeight));
|
_dirtyOverlayRects.push_back(Common::Rect(0, 0, _videoContext.overlayWidth, _videoContext.overlayHeight));
|
||||||
_fullScreenOverlayIsDirty = true;
|
_fullScreenOverlayIsDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ void OSystem_IPHONE::dirtyFullOverlayScreen() {
|
||||||
void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
|
void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
|
||||||
//printf("setMouseCursor(%i, %i, scale %u)\n", hotspotX, hotspotY, cursorTargetScale);
|
//printf("setMouseCursor(%i, %i, scale %u)\n", hotspotX, hotspotY, cursorTargetScale);
|
||||||
|
|
||||||
if (_mouseBuf != NULL && (_mouseWidth != w || _mouseHeight != h)) {
|
if (_mouseBuf != NULL && (_videoContext.mouseWidth != w || _videoContext.mouseHeight != h)) {
|
||||||
free(_mouseBuf);
|
free(_mouseBuf);
|
||||||
_mouseBuf = NULL;
|
_mouseBuf = NULL;
|
||||||
}
|
}
|
||||||
|
@ -377,11 +377,11 @@ void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspot
|
||||||
if (_mouseBuf == NULL)
|
if (_mouseBuf == NULL)
|
||||||
_mouseBuf = (byte *)malloc(w * h);
|
_mouseBuf = (byte *)malloc(w * h);
|
||||||
|
|
||||||
_mouseWidth = w;
|
_videoContext.mouseWidth = w;
|
||||||
_mouseHeight = h;
|
_videoContext.mouseHeight = h;
|
||||||
|
|
||||||
_mouseHotspotX = hotspotX;
|
_videoContext.mouseHotspotX = hotspotX;
|
||||||
_mouseHotspotY = hotspotY;
|
_videoContext.mouseHotspotY = hotspotY;
|
||||||
|
|
||||||
_mouseKeyColor = (byte)keycolor;
|
_mouseKeyColor = (byte)keycolor;
|
||||||
|
|
||||||
|
@ -406,8 +406,8 @@ void OSystem_IPHONE::setCursorPalette(const byte *colors, uint start, uint num)
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_IPHONE::updateMouseTexture() {
|
void OSystem_IPHONE::updateMouseTexture() {
|
||||||
int texWidth = getSizeNextPOT(_mouseWidth);
|
int texWidth = getSizeNextPOT(_videoContext.mouseWidth);
|
||||||
int texHeight = getSizeNextPOT(_mouseHeight);
|
int texHeight = getSizeNextPOT(_videoContext.mouseHeight);
|
||||||
int bufferSize = texWidth * texHeight * sizeof(int16);
|
int bufferSize = texWidth * texHeight * sizeof(int16);
|
||||||
uint16 *mouseBuf = (uint16 *)malloc(bufferSize);
|
uint16 *mouseBuf = (uint16 *)malloc(bufferSize);
|
||||||
memset(mouseBuf, 0, bufferSize);
|
memset(mouseBuf, 0, bufferSize);
|
||||||
|
@ -418,9 +418,9 @@ void OSystem_IPHONE::updateMouseTexture() {
|
||||||
else
|
else
|
||||||
palette = _gamePaletteRGBA5551;
|
palette = _gamePaletteRGBA5551;
|
||||||
|
|
||||||
for (uint x = 0; x < _mouseWidth; ++x) {
|
for (uint x = 0; x < _videoContext.mouseWidth; ++x) {
|
||||||
for (uint y = 0; y < _mouseHeight; ++y) {
|
for (uint y = 0; y < _videoContext.mouseHeight; ++y) {
|
||||||
const byte color = _mouseBuf[y * _mouseWidth + x];
|
const byte color = _mouseBuf[y * _videoContext.mouseWidth + x];
|
||||||
if (color != _mouseKeyColor)
|
if (color != _mouseKeyColor)
|
||||||
mouseBuf[y * texWidth + x] = palette[color] | 0x1;
|
mouseBuf[y * texWidth + x] = palette[color] | 0x1;
|
||||||
else
|
else
|
||||||
|
@ -428,5 +428,5 @@ void OSystem_IPHONE::updateMouseTexture() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iPhone_setMouseCursor(mouseBuf, _mouseWidth, _mouseHeight, _mouseHotspotX, _mouseHotspotY);
|
iPhone_setMouseCursor(mouseBuf, _videoContext.mouseWidth, _videoContext.mouseHeight, _videoContext.mouseHotspotX, _videoContext.mouseHotspotY);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue