1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef BACKENDS_PLATFORM_IOS7_IOS7_COMMON_H
24 #define BACKENDS_PLATFORM_IOS7_IOS7_COMMON_H
25 
26 #include "graphics/surface.h"
27 
28 #define ENABLE_IOS7_SCALERS
29 
30 
31 enum InputEvent {
32 	kInputMouseDown,
33 	kInputMouseUp,
34 	kInputMouseDragged,
35 	kInputMouseSecondDragged,
36 	kInputMouseSecondDown,
37 	kInputMouseSecondUp,
38 	kInputOrientationChanged,
39 	kInputKeyPressed,
40 	kInputApplicationSuspended,
41 	kInputApplicationResumed,
42 	kInputSwipe,
43 	kInputTap,
44 	kInputMainMenu
45 };
46 
47 enum ScreenOrientation {
48 	kScreenOrientationPortrait,
49 	kScreenOrientationLandscape,
50 	kScreenOrientationFlippedLandscape
51 };
52 
53 enum UIViewSwipeDirection {
54 	kUIViewSwipeUp = 1,
55 	kUIViewSwipeDown = 2,
56 	kUIViewSwipeLeft = 4,
57 	kUIViewSwipeRight = 8
58 };
59 
60 enum UIViewTapDescription {
61 	kUIViewTapSingle = 1,
62 	kUIViewTapDouble = 2
63 };
64 
65 enum GraphicsModes {
66 	kGraphicsModeNone = 1,
67 
68 	kGraphicsMode2xSaI,
69 	kGraphicsModeSuper2xSaI,
70 	kGraphicsModeSuperEagle,
71 	kGraphicsModeAdvMame2x,
72 	kGraphicsModeAdvMame3x,
73 	kGraphicsModeHQ2x,
74 	kGraphicsModeHQ3x,
75 	kGraphicsModeTV2x,
76 	kGraphicsModeDotMatrix
77 };
78 
79 struct VideoContext {
VideoContextVideoContext80 	VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false),
81 	                 overlayWidth(), overlayHeight(), mouseX(), mouseY(),
82 	                 mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
83 	                 mouseIsVisible(), graphicsMode(kGraphicsModeNone), filtering(false),
84 	                 shakeXOffset(), shakeYOffset() {
85 	}
86 
87 	// Game screen state
88 	bool asprectRatioCorrection;
89 	uint screenWidth, screenHeight;
90 	Graphics::Surface screenTexture;
91 
92 	// Overlay state
93 	bool overlayVisible;
94 	uint overlayWidth, overlayHeight;
95 	Graphics::Surface overlayTexture;
96 
97 	// Mouse cursor state
98 	uint mouseX, mouseY;
99 	int mouseHotspotX, mouseHotspotY;
100 	uint mouseWidth, mouseHeight;
101 	bool mouseIsVisible;
102 	Graphics::Surface mouseTexture;
103 
104 	// Misc state
105 	GraphicsModes graphicsMode;
106 	bool filtering;
107 	int shakeXOffset;
108 	int shakeYOffset;
109 };
110 
111 struct InternalEvent {
InternalEventInternalEvent112 	InternalEvent() : type(), value1(), value2() {}
InternalEventInternalEvent113 	InternalEvent(InputEvent t, int v1, int v2) : type(t), value1(v1), value2(v2) {}
114 
115 	InputEvent type;
116 	int value1, value2;
117 };
118 
119 // On the ObjC side
120 
121 extern int iOS7_argc;
122 extern char **iOS7_argv;
123 
124 void iOS7_updateScreen();
125 bool iOS7_fetchEvent(InternalEvent *event);
126 bool iOS7_isBigDevice();
127 
128 void iOS7_buildSharedOSystemInstance();
129 void iOS7_main(int argc, char **argv);
130 const char *iOS7_getDocumentsDir();
131 bool iOS7_touchpadModeEnabled();
132 
133 uint getSizeNextPOT(uint size);
134 
135 #endif
136