Skip to content

Commit 8038d3b

Browse files
committed
Update AS config to 2021.3.1.p1 and Fix the Tween error with queue actions.
1 parent 94167a3 commit 8038d3b

File tree

5 files changed

+51
-33
lines changed

5 files changed

+51
-33
lines changed

ChangeLog.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v0.7.1
2+
3+
_`2022.10.20 UTC+8 16:00`_
4+
5+
* Fix the `Tween` error with queue actions.
6+
7+
18
## v0.7.0
29

310
_`2021.8.18 UTC+8 10:42`_

Engine/Toolkit/Utils/Tween.c

+36-24
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* CodeStyle: https://github.com/scottcgi/Mojoc/blob/master/Docs/CodeStyle.md
1010
*
1111
* Since : 2016-6-8
12-
* Update : 2021-8-16
12+
* Update : 2022-10-19
1313
* Author : scott.cgi
1414
*/
1515

@@ -32,6 +32,11 @@ typedef struct
3232
* Target's current running actions.
3333
*/
3434
ArrayList(TweenAction*) current[1];
35+
36+
/**
37+
* A queue action currently is running in current list.
38+
*/
39+
TweenAction* queueAction;
3540
}
3641
Tween;
3742

@@ -61,6 +66,8 @@ static inline Tween* GetTween()
6166
AArrayList ->Clear(tween->current);
6267
}
6368

69+
tween->queueAction = NULL;
70+
6471
return tween;
6572
}
6673

@@ -132,20 +139,6 @@ static inline void SetActionValue(TweenAction* action)
132139
}
133140

134141

135-
static void DequeueAction(Tween* tween)
136-
{
137-
// get a queue action to run
138-
TweenAction* action = AArrayQueue_Dequeue(tween->queue, TweenAction*);
139-
140-
if (action != NULL)
141-
{
142-
// add the running queue action into current list
143-
AArrayList_Add(tween->current, action);
144-
SetActionValue(action);
145-
}
146-
}
147-
148-
149142
static void* RunActions(Array(TweenAction*)* actions, void* tweenID)
150143
{
151144
Tween* tween;
@@ -190,14 +183,17 @@ static void* RunActions(Array(TweenAction*)* actions, void* tweenID)
190183
}
191184
}
192185

193-
DequeueAction(tween);
194-
195186
return tweenID;
196187
}
197188

198189

199190
static void RemoveCurrentActionByIndex(Tween* tween, TweenAction* action, int index)
200191
{
192+
if (action == tween->queueAction)
193+
{
194+
tween->queueAction = NULL;
195+
}
196+
201197
AArrayList->RemoveByLast(tween->current, index);
202198
AArrayList_Add(actionCacheList, action);
203199
}
@@ -258,6 +254,10 @@ static bool TryRemoveAllActions(void* tweenID)
258254
AArrayList_Add(actionCacheList, action);
259255
}
260256

257+
// if queueAction not NULL it must be in tweenData->current
258+
// so just set NULL
259+
tween->queueAction = NULL;
260+
261261
return true;
262262
}
263263

@@ -308,6 +308,10 @@ static bool TryCompleteAllActions(void* tweenID, bool isFireOnComplete)
308308
AArrayList_Add(actionCacheList, action);
309309
}
310310

311+
// if queueAction not NULL it must be in tweenData->current
312+
// so just set NULL
313+
tween->queueAction = NULL;
314+
311315
return true;
312316
}
313317

@@ -340,7 +344,20 @@ static void Update(float deltaSeconds)
340344
for (int i = tweenRunningMap->elementList->size - 1; i > -1; --i)
341345
{
342346
Tween* tween = AArrayIntMap_GetAt(tweenRunningMap, i, Tween*);
343-
347+
348+
// get a queue action to run
349+
if (tween->queueAction == NULL)
350+
{
351+
tween->queueAction = AArrayQueue_Dequeue(tween->queue, TweenAction*);
352+
353+
if (tween->queueAction != NULL)
354+
{
355+
// add the running queue action into current list
356+
AArrayList_Add(tween->current, tween->queueAction);
357+
SetActionValue(tween->queueAction);
358+
}
359+
}
360+
344361
if (tween->current->size == 0)
345362
{
346363
// all actions complete so remove tweenData and push to cache
@@ -382,13 +399,8 @@ static void Update(float deltaSeconds)
382399
{
383400
action->OnComplete(action);
384401
}
385-
386-
RemoveCurrentActionByIndex(tween, action, j);
387402

388-
if (action->isQueue)
389-
{
390-
DequeueAction(tween);
391-
}
403+
RemoveCurrentActionByIndex(tween, action, j);
392404
}
393405
}
394406
}

README.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<img src="./Docs/Images/Logo.png" width="176" height="228" alt="Mojoc Logo" title="Mojoc Logo" />
22

33

4-
## Mojoc v0.7.0
4+
## Mojoc v0.7.1
55

66
Mojoc is an open-source, cross-platform, pure C game engine. It is based on OpenGLES3 and written in C99. It currently works on IOS and Android, but can easily be extended to other platforms, and will support more platforms in the future.
77

@@ -39,9 +39,6 @@ Less is more, simple is better, simplify complex ideas.
3939
## Published Games
4040
Mojoc has been used for a cross-platform Android and IOS game.
4141

42-
* **SuperLittleRed** is a bow and arrow shooting game, very challenging for your operation.
43-
* [App Store](https://itunes.apple.com/cn/app/id1242353775)
44-
* [Google Play](https://play.google.com/store/apps/details?id=com.SuperLittleRed)
4542

4643
## Samples
4744
The samples will show all aspects of the Mojoc features. Each platform will provide native building project for native platform editor. For example: Android provides AndroidStudio project, IOS provides XCode project.
@@ -50,7 +47,7 @@ Currently there is only one sample, which is a simplfied version of the publishe
5047

5148
The compiled and playable apk is here:
5249

53-
* [SuperLittleRed-2.2.0.apk](./Samples/Apk/SuperLittleRed-2.2.0.apk?raw=true)
50+
* [SuperLittleRed-2.2.0.apk](./Samples/Apk/SuperLittleRed-2.2.0.apk?raw=true) is a bow and arrow shooting game, very challenging for your operation.
5451

5552
<img src="./Docs/Images/SuperLittleRed-Sample.gif" width="400" height="225" alt="SuperLittleRed-Sample" title="SuperLittleRed-Sample" />
5653

Samples/SuperLittleRed/Android/app/build.gradle

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
apply plugin: "com.android.application"
22

33
android {
4-
compileSdkVersion 29
5-
buildToolsVersion "30.0.3"
4+
compileSdkVersion 32
5+
buildToolsVersion "33.0.0"
66
defaultConfig {
77
applicationId "com.Mojoc.Samples.SuperLittleRed"
8-
minSdkVersion 29
8+
minSdkVersion 30
99
ndk {
1010
abiFilters "armeabi-v7a", "arm64-v8a"
11+
ndkVersion "25.1.8937393"
1112
}
1213
externalNativeBuild {
1314
cmake {
@@ -32,6 +33,7 @@ android {
3233
}
3334
productFlavors {
3435
}
36+
namespace 'com.Mojoc.Samples.SuperLittleRed'
3537
}
3638

3739
dependencies {

Samples/SuperLittleRed/Android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.0.0'
9+
classpath 'com.android.tools.build:gradle:7.3.1'
1010
// NOTE: Do not place your application dependencies here; they belong
1111
}
1212

0 commit comments

Comments
 (0)