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 
29 enum InputEvent {
30 	kInputMouseDown,
31 	kInputMouseUp,
32 	kInputMouseDragged,
33 	kInputMouseSecondDragged,
34 	kInputMouseSecondDown,
35 	kInputMouseSecondUp,
36 	kInputOrientationChanged,
37 	kInputKeyPressed,
38 	kInputApplicationSuspended,
39 	kInputApplicationResumed,
40 	kInputApplicationSaveState,
41 	kInputApplicationClearState,
42 	kInputApplicationRestoreState,
43 	kInputSwipe,
44 	kInputTap,
45 	kInputMainMenu
46 };
47 
48 enum ScreenOrientation {
49 	kScreenOrientationPortrait,
50 	kScreenOrientationFlippedPortrait,
51 	kScreenOrientationLandscape,
52 	kScreenOrientationFlippedLandscape
53 };
54 
55 enum UIViewSwipeDirection {
56 	kUIViewSwipeUp = 1,
57 	kUIViewSwipeDown = 2,
58 	kUIViewSwipeLeft = 4,
59 	kUIViewSwipeRight = 8
60 };
61 
62 enum UIViewTapDescription {
63 	kUIViewTapSingle = 1,
64 	kUIViewTapDouble = 2
65 };
66 
67 struct VideoContext {
VideoContextVideoContext68 	VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false),
69 	                 overlayWidth(), overlayHeight(), mouseX(), mouseY(),
70 	                 mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
71 	                 mouseIsVisible(), filtering(false), shakeXOffset(), shakeYOffset() {
72 	}
73 
74 	// Game screen state
75 	bool asprectRatioCorrection;
76 	uint screenWidth, screenHeight;
77 	Graphics::Surface screenTexture;
78 
79 	// Overlay state
80 	bool overlayVisible;
81 	uint overlayWidth, overlayHeight;
82 	Graphics::Surface overlayTexture;
83 
84 	// Mouse cursor state
85 	uint mouseX, mouseY;
86 	int mouseHotspotX, mouseHotspotY;
87 	uint mouseWidth, mouseHeight;
88 	bool mouseIsVisible;
89 	Graphics::Surface mouseTexture;
90 
91 	// Misc state
92 	bool filtering;
93 	int shakeXOffset;
94 	int shakeYOffset;
95 };
96 
97 struct InternalEvent {
InternalEventInternalEvent98 	InternalEvent() : type(), value1(), value2() {}
InternalEventInternalEvent99 	InternalEvent(InputEvent t, int v1, int v2) : type(t), value1(v1), value2(v2) {}
100 
101 	InputEvent type;
102 	int value1, value2;
103 };
104 
105 // On the ObjC side
106 
107 extern int iOS7_argc;
108 extern char **iOS7_argv;
109 
110 void iOS7_updateScreen();
111 bool iOS7_fetchEvent(InternalEvent *event);
112 bool iOS7_isBigDevice();
113 
114 void iOS7_buildSharedOSystemInstance();
115 void iOS7_main(int argc, char **argv);
116 const char *iOS7_getDocumentsDir();
117 bool iOS7_touchpadModeEnabled();
118 
119 uint getSizeNextPOT(uint size);
120 
121 #endif
122