-
Notifications
You must be signed in to change notification settings - Fork 0
/
AptiekaExtension.hx
60 lines (37 loc) · 1.14 KB
/
AptiekaExtension.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
54
55
56
57
58
59
60
package;
#if cpp
import cpp.Lib;
#elseif neko
import neko.Lib;
#end
#if (android && openfl)
import openfl.utils.JNI;
#end
class AptiekaExtension
{
public static function init()
{
aptiekaextension_init();
}
public static function sampleMethod (inputValue:Int):Int {
#if (android && openfl)
var resultJNI = aptiekaextension_sample_method_jni(inputValue);
var resultNative = aptiekaextension_sample_method(inputValue);
if (resultJNI != resultNative) {
throw "Fuzzy math!";
}
return resultNative;
#else
return aptiekaextension_sample_method(inputValue);
#end
}
public static function insert(inputValue:Int):Int
{
return aptiekaextension_sample_method(inputValue);
}
private static var aptiekaextension_sample_method = Lib.load("aptiekaextension", "aptiekaextension_sample_method", 1);
private static var aptiekaextension_init = Lib.load("aptiekaextension", "aptiekaextension_init", 0);
#if (android && openfl)
private static var aptiekaextension_sample_method_jni = JNI.createStaticMethod ("org.haxe.extension.AptiekaExtension", "sampleMethod", "(I)I");
#end
}