16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 *) |
17 *) |
18 |
18 |
19 {$INCLUDE "options.inc"} |
19 {$INCLUDE "options.inc"} |
20 |
20 |
|
21 (* |
|
22 * This unit contains a lot of useful functions when hw is running on mobile |
|
23 * Unlike HwLibrary when you declare functions that you will call from your code, |
|
24 * here you need to provide functions that Pascall code will call. |
|
25 *) |
|
26 |
21 unit uMobile; |
27 unit uMobile; |
22 interface |
28 interface |
23 |
29 |
|
30 function isPhone: Boolean; inline; |
|
31 procedure performRumble; inline; |
|
32 |
|
33 procedure GameLoading; inline; |
|
34 procedure GameLoaded; inline; |
|
35 procedure SaveLoadingEnded; inline; |
|
36 |
|
37 implementation |
|
38 uses uVariables, uConsole; |
|
39 |
|
40 // add here any external call that you need |
24 {$IFDEF IPHONEOS} |
41 {$IFDEF IPHONEOS} |
25 (* iOS calls written in ObjcExports.m *) |
42 (* iOS calls written in ObjcExports.m *) |
26 procedure clearView; cdecl; external; |
|
27 procedure startLoadingIndicator; cdecl; external; |
43 procedure startLoadingIndicator; cdecl; external; |
28 procedure stopLoadingIndicator; cdecl; external; |
44 procedure stopLoadingIndicator; cdecl; external; |
29 procedure saveFinishedSynching; cdecl; external; |
45 procedure saveFinishedSynching; cdecl; external; |
30 function isApplePhone: Boolean; cdecl; external; |
46 function isApplePhone: Boolean; cdecl; external; |
31 procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external; |
47 procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external; |
32 {$ENDIF} |
48 {$ENDIF} |
33 function isPhone: Boolean; inline; |
|
34 procedure performRumble; inline; |
|
35 |
|
36 procedure GameLoading; inline; |
|
37 procedure GameLoaded; inline; |
|
38 procedure NewTurnBeginning; inline; |
|
39 procedure SaveLoadingEnded; inline; |
|
40 |
|
41 implementation |
|
42 uses uVariables, uConsole; |
|
43 |
49 |
44 // this function is just to determine whether we are running on a limited screen device |
50 // this function is just to determine whether we are running on a limited screen device |
45 function isPhone: Boolean; inline; |
51 function isPhone: Boolean; inline; |
46 begin |
52 begin |
47 isPhone:= false; |
53 isPhone:= false; |
54 isPhone:= true; |
60 isPhone:= true; |
55 {$ENDIF} |
61 {$ENDIF} |
56 end; |
62 end; |
57 |
63 |
58 // this function should make the device vibrate in some way |
64 // this function should make the device vibrate in some way |
59 procedure performRumble; inline; |
65 procedure PerformRumble; inline; |
60 const kSystemSoundID_Vibrate = $00000FFF; |
66 {$IFDEF IPHONEOS}const kSystemSoundID_Vibrate = $00000FFF;{$ENDIF} |
61 begin |
67 begin |
62 // do not vibrate while synchronising a demo/save |
68 // do not vibrate while synchronising a demo/save |
63 if not fastUntilLag then |
69 if not fastUntilLag then |
64 begin |
70 begin |
65 {$IFDEF IPHONEOS} |
71 {$IFDEF IPHONEOS} |
66 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); |
72 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); |
67 {$ENDIF} |
73 {$ENDIF} |
68 end; |
74 end; |
69 end; |
75 end; |
70 |
76 |
71 procedure GameLoading; inline; |
77 procedure GameLoading; inline; |
72 begin |
78 begin |
73 {$IFDEF IPHONEOS} |
79 {$IFDEF IPHONEOS} |