-
Notifications
You must be signed in to change notification settings - Fork 4
/
Hardware.hx
53 lines (46 loc) · 1.27 KB
/
Hardware.hx
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
package;
#if cpp
import cpp.Lib;
#elseif neko
import neko.Lib;
#end
#if (android && openfl)
import openfl.utils.JNI;
#end
class Hardware
{
#if (android && openfl)
private static var vibrate_jni = JNI.createStaticMethod ("org.haxe.extension.Hardware", "vibrate", "(I)V");
private static var wakeUp_jni = JNI.createStaticMethod ("org.haxe.extension.Hardware", "wakeUp", "()V");
private static var get_screen_width_jni = JNI.createStaticMethod ("org.haxe.extension.Hardware", "getScreenWidth", "()I");
private static var get_screen_height_jni = JNI.createStaticMethod ("org.haxe.extension.Hardware", "getScreenHeight", "()I");
#end
public static function vibrate(inputValue:Int)
{
#if (android && openfl)
vibrate_jni(inputValue);
#end
}
public static function wakeUp():Void
{
#if (android && openfl)
wakeUp_jni();
#end
}
public static function getScreenWidth():Int
{
var out = -1;
#if (android && openfl)
out = get_screen_width_jni();
#end
return out;
}
public static function getScreenHeight():Int
{
var out = -1;
#if (android && openfl)
out = get_screen_height_jni();
#end
return out;
}
}