diff options
Diffstat (limited to 'backends/platform/iphone/iphone_common.h')
-rw-r--r-- | backends/platform/iphone/iphone_common.h | 66 |
1 files changed, 40 insertions, 26 deletions
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h index 0cbcb77bcb..19e4f2ce9b 100644 --- a/backends/platform/iphone/iphone_common.h +++ b/backends/platform/iphone/iphone_common.h @@ -20,6 +20,10 @@ * */ +#ifndef BACKENDS_PLATFORM_IPHONE_IPHONE_COMMON_H +#define BACKENDS_PLATFORM_IPHONE_IPHONE_COMMON_H + +#include "graphics/surface.h" enum InputEvent { kInputMouseDown, @@ -41,43 +45,53 @@ enum ScreenOrientation { kScreenOrientationFlippedLandscape }; -typedef enum -{ +enum UIViewSwipeDirection { kUIViewSwipeUp = 1, kUIViewSwipeDown = 2, kUIViewSwipeLeft = 4, kUIViewSwipeRight = 8 -} UIViewSwipeDirection; +}; -#ifdef IPHONE_OFFICIAL -void iphone_main(int argc, char **argv); -#endif +enum GraphicsModes { + kGraphicsModeLinear = 0, + kGraphicsModeNone = 1 +}; -// We need this to be able to call functions from/in Objective-C. -#ifdef __cplusplus -extern "C" { -#endif +struct VideoContext { + VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false), + overlayWidth(), overlayHeight(), mouseX(), mouseY(), + mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(), + mouseIsVisible(), graphicsMode(kGraphicsModeLinear), shakeOffsetY() { + } -// On the C++ side -#ifndef IPHONE_OFFICIAL -void iphone_main(int argc, char *argv[]); -#endif + // Game screen state + bool asprectRatioCorrection; + uint screenWidth, screenHeight; + Graphics::Surface screenTexture; + + // Overlay state + bool overlayVisible; + uint overlayWidth, overlayHeight; + Graphics::Surface overlayTexture; + + // Mouse cursor state + uint mouseX, mouseY; + int mouseHotspotX, mouseHotspotY; + uint mouseWidth, mouseHeight; + bool mouseIsVisible; + Graphics::Surface mouseTexture; + + // Misc state + GraphicsModes graphicsMode; + int shakeOffsetY; +}; // On the ObjC side -void iPhone_updateScreen(int mouseX, int mouseY); -void iPhone_updateScreenRect(unsigned short* screen, int x1, int y1, int x2, int y2); -void iPhone_updateOverlayRect(unsigned short* screen, int x1, int y1, int x2, int y2); -void iPhone_initSurface(int width, int height); -bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY); -const char* iPhone_getDocumentsDir(); +void iPhone_updateScreen(); +bool iPhone_fetchEvent(int *outEvent, int *outX, int *outY); +const char *iPhone_getDocumentsDir(); bool iPhone_isHighResDevice(); -int iPhone_getScreenHeight(); -int iPhone_getScreenWidth(); -void iPhone_enableOverlay(int state); -void iPhone_setMouseCursor(short* buffer, int width, int height); uint getSizeNextPOT(uint size); -#ifdef __cplusplus -} #endif |