File tree Expand file tree Collapse file tree 3 files changed +91
-3
lines changed Expand file tree Collapse file tree 3 files changed +91
-3
lines changed Original file line number Diff line number Diff line change
1
+ #include " jni_refs.hpp"
2
+ #include " helpers/general.hpp"
3
+
4
+ // From rive-cpp
5
+ #include " animation/layer_state.hpp"
6
+ #include " animation/exit_state.hpp"
7
+ #include " animation/entry_state.hpp"
8
+ #include " animation/any_state.hpp"
9
+ #include " animation/animation_state.hpp"
10
+
11
+ #ifdef __cplusplus
12
+ extern " C"
13
+ {
14
+ #endif
15
+
16
+ // ANIMATION
17
+ JNIEXPORT jboolean JNICALL Java_app_rive_runtime_kotlin_core_LayerState_cppIsExitState (
18
+ JNIEnv *env,
19
+ jobject thisObj,
20
+ jlong ref)
21
+ {
22
+
23
+ rive::LayerState *layerState = (rive::LayerState *)ref;
24
+ return layerState->is <rive::ExitState>();
25
+ }
26
+
27
+ JNIEXPORT jboolean JNICALL Java_app_rive_runtime_kotlin_core_LayerState_cppIsAnyState (
28
+ JNIEnv *env,
29
+ jobject thisObj,
30
+ jlong ref)
31
+ {
32
+
33
+ rive::LayerState *layerState = (rive::LayerState *)ref;
34
+ return layerState->is <rive::AnyState>();
35
+ }
36
+
37
+ JNIEXPORT jboolean JNICALL Java_app_rive_runtime_kotlin_core_LayerState_cppIsEntryState (
38
+ JNIEnv *env,
39
+ jobject thisObj,
40
+ jlong ref)
41
+ {
42
+
43
+ rive::LayerState *layerState = (rive::LayerState *)ref;
44
+ return layerState->is <rive::EntryState>();
45
+ }
46
+
47
+ JNIEXPORT jboolean JNICALL Java_app_rive_runtime_kotlin_core_LayerState_cppIsAnimationState (
48
+ JNIEnv *env,
49
+ jobject thisObj,
50
+ jlong ref)
51
+ {
52
+
53
+ rive::LayerState *layerState = (rive::LayerState *)ref;
54
+ return layerState->is <rive::AnimationState>();
55
+ }
56
+
57
+ JNIEXPORT jlong JNICALL Java_app_rive_runtime_kotlin_core_AnimationState_cppAnimation (
58
+ JNIEnv *env,
59
+ jobject thisObj,
60
+ jlong ref)
61
+ {
62
+
63
+ rive::AnimationState *animationState = (rive::AnimationState *)ref;
64
+ return (long )animationState->animation ();
65
+ }
66
+
67
+ #ifdef __cplusplus
68
+ }
69
+ #endif
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ extern "C"
24
24
rive::LinearAnimation *animation = (rive::LinearAnimation *)animationRef;
25
25
26
26
// TODO: delete this object?
27
- auto animationInstance = new rive::LinearAnimationInstance (animation);
27
+ rive::LinearAnimationInstance * animationInstance = new rive::LinearAnimationInstance (animation);
28
28
29
29
return (jlong)animationInstance;
30
30
}
@@ -44,7 +44,7 @@ extern "C"
44
44
45
45
if (didLoop)
46
46
{
47
- auto loopType = animationInstance->animation ()->loop ();
47
+ rive::Loop loopType = animationInstance->animation ()->loop ();
48
48
switch (loopType)
49
49
{
50
50
case rive::Loop::oneShot:
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ extern "C"
22
22
rive::StateMachine *animation = (rive::StateMachine *)stateMachineRef;
23
23
24
24
// TODO: delete this object?
25
- auto stateMachineInstance = new rive::StateMachineInstance (animation);
25
+ rive::StateMachineInstance * stateMachineInstance = new rive::StateMachineInstance (animation);
26
26
27
27
return (jlong)stateMachineInstance;
28
28
}
@@ -37,6 +37,25 @@ extern "C"
37
37
return stateMachineInstance->advance (elapsedTime);
38
38
}
39
39
40
+ JNIEXPORT jint JNICALL Java_app_rive_runtime_kotlin_core_StateMachineInstance_cppStateChangedCount (
41
+ JNIEnv *env,
42
+ jobject thisObj,
43
+ jlong ref)
44
+ {
45
+ rive::StateMachineInstance *stateMachineInstance = (rive::StateMachineInstance *)ref;
46
+ return stateMachineInstance->stateChangedCount ();
47
+ }
48
+
49
+ JNIEXPORT jlong JNICALL Java_app_rive_runtime_kotlin_core_StateMachineInstance_cppStateChangedByIndex (
50
+ JNIEnv *env,
51
+ jobject thisObj,
52
+ jlong ref,
53
+ jint index)
54
+ {
55
+ rive::StateMachineInstance *stateMachineInstance = (rive::StateMachineInstance *)ref;
56
+ return (jlong)stateMachineInstance->stateChangedByIndex (index);
57
+ }
58
+
40
59
JNIEXPORT void JNICALL Java_app_rive_runtime_kotlin_core_StateMachineInstance_cppApply (
41
60
JNIEnv *env,
42
61
jobject thisObj,
You can’t perform that action at this time.
0 commit comments