This repository has been archived by the owner on Jan 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcftFunctions.monkey
executable file
·209 lines (193 loc) · 7.49 KB
/
cftFunctions.monkey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#rem
Title: fantomEngine
Description: A 2D game framework for the Monkey programming language
Author: Michael Hartlef
Contact: michaelhartlef@gmail.com
Website: http://www.fantomgl.com
License: MIT
#End
#Rem
'nav:<blockquote><nav><b>fantomEngine documentation</b> | <a href="index.html">Home</a> | <a href="classes.html">Classes</a> | <a href="3rdpartytools.html">3rd party tools</a> | <a href="examples.html">Examples</a> | <a href="changes.html">Changes</a></nav></blockquote>
#End
'header:The module cftFunctions is a collection of several functions for IOS, ANDROID and HTML5 targets to retrieve some device and browser informations.
#if HOST="macos" And TARGET="glfw"
'Import "native/fantomengine.${TARGET}.mac.${LANG}"
#elseif TARGET="android" Or TARGET="ios" Or TARGET="html5"
Import "native/fantomengine.${TARGET}.${LANG}"
#else
'Import "native/fantomengine.${TARGET}.${LANG}"
#end
'Import mojo
Extern
'#DOCOFF#
#If TARGET = "android" Then
Function GetDeviceName:String() = "fantomengine.DeviceName"
Function GetHardware:String() = "fantomengine.Hardware"
Function GetUser:String() = "fantomengine.User"
Function GetProduct:String() = "fantomengine.Product"
Function GetSerial:String() = "fantomengine.Serial"
Function GetBrowserName:String() = "fantomengine.GetBrowserName"
Function GetBrowserVersion:String() = "fantomengine.GetBrowserVersion"
Function GetBrowserPlatform:String() = "fantomengine.GetBrowserPlatform"
#ElseIf TARGET = "ios" Then
Function GetDeviceName:String() = "fantomengine::DeviceName"
Function GetHardware:String() = "fantomengine::Hardware"
Function GetUser:String() = "fantomengine::User"
Function GetProduct:String() = "fantomengine::Product"
Function GetSerial:String() = "fantomengine::Serial"
Function GetBrowserName:String() = "fantomengine::GetBrowserName"
Function GetBrowserVersion:String() = "fantomengine::GetBrowserVersion"
Function GetBrowserPlatform:String() = "fantomengine::GetBrowserPlatform"
#ElseIf TARGET = "html5" Then
Function GetDeviceName:String() = "fantomengine.DeviceName"
Function GetHardware:String() = "fantomengine.Hardware"
Function GetUser:String() = "fantomengine.User"
Function GetProduct:String() = "fantomengine.Product"
Function GetSerial:String() = "fantomengine.Serial"
Function GetBrowserName:String() = "fantomengine.GetBrowserName"
Function GetBrowserVersion:String() = "fantomengine.GetBrowserVersion"
Function GetBrowserPlatform:String() = "fantomengine.GetBrowserPlatform"
Function MaximizeCanvas:Void() = "fantomengine.MaximizeCanvas"
Function ResizeCanvas:Void(x:Int, y:Int) = "fantomengine.ResizeCanvas"
Function ResizeConsole:Void(x:Int, y:Int) = "fantomengine.ResizeConsole"
Function HideConsole:Void() = "fantomengine.HideConsole"
Function IsMobileBrowser:Bool() = "fantomengine.IsMobileBrowser"
Function GetLanguage:String() = "fantomengine.GetLanguage"
Function GetDomain:String() = "fantomengine.GetDomain"
#Endif
Public
'#DOCON#
#If TARGET <> "android" And TARGET <> "ios" And TARGET <> "html5" Then
'------------------------------------------
#Rem
'summery:Returns the name of the device.
'Returns valid information on Android/iOS only.
#End
Function GetDeviceName:String()
Local s:String = "---"
Return s
End
'------------------------------------------
#Rem
'summery:Returns the hardware of the device.
'Returns valid information on Android/iOS only.
#End
Function GetHardware:String()
Local s:String = "---"
Return s
End
'------------------------------------------
#Rem
'summery:Returns the name of the device user.
'Returns valid information on Android/iOS only.
#End
Function GetUser:String()
Local s:String = "---"
Return s
End
'------------------------------------------
#Rem
'summery:Return the product of the device.
'Returns valid information on Android only.
#End
Function GetProduct:String()
Local s:String = "---"
Return s
End
'------------------------------------------
#Rem
'summery:Return the serial number of the device.
'Returns valid information on Android/iOS only.
#End
Function GetSerial:String()
Local s:String = "---"
Return s
End
'------------------------------------------
#Rem
'summery:Returns the name of the HTML5 browser.
'Returns valid information on HTML5 only.
#End
Function GetBrowserName:String()
Local s:String = "---"
Return s
End
'------------------------------------------
#Rem
'summery:Returns the version of the HTML5 browser.
'Returns valid information on HTML5 only.
#End
Function GetBrowserVersion:String()
Local s:String = "---"
Return s
End
'------------------------------------------
#Rem
'summery:Returns the platform the HTML5 browser is running on.
'Returns valid information on HTML5 only.
#End
Function GetBrowserPlatform:String()
Local s:String = "---"
Return s
End
'------------------------------------------
#Rem
'summery:Maximizes the HTML5 canvas.
'HTML5 only.
'Attention: You need to set the variable CANVAS_RESIZE_MODE to 0 in your exported MonkeyGame.html file to make this work correctly!
#End
Function MaximizeCanvas:Void()
'
End
'------------------------------------------
#Rem
'summery:Resizes the HTML5 canvas to the given proportions.
'HTML5 only.
'Attention: You need to set the variable CANVAS_RESIZE_MODE to 0 in your exported MonkeyGame.html file to make this work correctly!
#End
Function ResizeCanvas:Void(x:Int, y:Int)
'
End
'------------------------------------------
#Rem
'summery:Resizes the HTML5 console to the given proportions.
'HTML5 only.
'Attention: You need to set the variable CANVAS_RESIZE_MODE to 0 in your exported MonkeyGame.html file to make this work correctly!
#End
Function ResizeConsole:Void(x:Int, y:Int)
'
End
'------------------------------------------
#Rem
'summery:Hides the HTML5 console.
'HTML5 only.
'Attention: You need to set the variable CANVAS_RESIZE_MODE to 0 in your exported MonkeyGame.html file to make this work correctly!
#End
Function HideConsole:Void()
'
End
'------------------------------------------
#Rem
'summery:Returns TRUE, if your HTML5 runs on a mobile browser.
'Returns valid information on HTML5 only.
#End
Function IsMobileBrowser:Bool()
Return False
End
'------------------------------------------
#Rem
'summery:Returns the language of a browser.
'Returns valid information on HTML5 only.
#End
Function GetLanguage:String()
Return "---"
End
#End
#rem
footer:This fantomEngine framework is released under the MIT license:
[quote]Copyright (c) 2011-2016 Michael Hartlef
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, and to permit persons to whom the software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[/quote]
#end