IPHONE: Move overlay visibility status to VideoContext.

This commit is contained in:
Johannes Schickel 2012-02-23 02:08:12 +01:00
parent e1edb20fed
commit ab15435ad0
2 changed files with 8 additions and 7 deletions

View File

@ -60,6 +60,7 @@ struct VideoContext {
int screenWidth, screenHeight;
// Overlay state
bool overlayVisible;
int overlayWidth, overlayHeight;
// Mouse cursor state
@ -85,7 +86,7 @@ const char *iPhone_getDocumentsDir();
bool iPhone_isHighResDevice();
int iPhone_getScreenHeight();
int iPhone_getScreenWidth();
void iPhone_enableOverlay(int state);
void iPhone_enableOverlay(bool state);
void iPhone_showCursor(int state);
void iPhone_setMouseCursor(unsigned short *buffer, int width, int height, int hotspotX, int hotspotY);

View File

@ -37,7 +37,6 @@ static int _overlayTexHeight = 0;
static CGRect _overlayRect;
static int _needsScreenUpdate = 0;
static int _overlayIsEnabled = 0;
static UITouch *_firstTouch = NULL;
static UITouch *_secondTouch = NULL;
@ -93,8 +92,8 @@ void iPhone_setMouseCursor(unsigned short *buffer, int width, int height, int ho
[sharedInstance performSelectorOnMainThread:@selector(updateMouseCursor) withObject:nil waitUntilDone: YES];
}
void iPhone_enableOverlay(int state) {
_overlayIsEnabled = state;
void iPhone_enableOverlay(bool state) {
_videoContext.overlayVisible = state;
[sharedInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES];
}
@ -272,6 +271,7 @@ const char *iPhone_getDocumentsDir() {
_mouseCursorTexture = 0;
_videoContext.graphicsMode = kGraphicsModeLinear;
_videoContext.overlayVisible = false;
_gameScreenVertCoords[0] = _gameScreenVertCoords[1] =
_gameScreenVertCoords[2] = _gameScreenVertCoords[3] =
@ -363,7 +363,7 @@ const char *iPhone_getDocumentsDir() {
[self updateMainSurface];
if (_overlayIsEnabled)
if (_videoContext.overlayVisible)
[self updateOverlaySurface];
if (_videoContext.mouseIsVisible)
@ -422,7 +422,7 @@ const char *iPhone_getDocumentsDir() {
CGRect *rect;
int maxWidth, maxHeight;
if (!_overlayIsEnabled) {
if (!_videoContext.overlayVisible) {
rect = &_gameScreenRect;
maxWidth = _videoContext.screenWidth;
maxHeight = _videoContext.screenHeight;
@ -695,7 +695,7 @@ const char *iPhone_getDocumentsDir() {
CGRect *area;
int width, height, offsetY;
if (_overlayIsEnabled) {
if (_videoContext.overlayVisible) {
area = &_overlayRect;
width = _videoContext.overlayWidth;
height = _videoContext.overlayHeight;