Skip to content

Commit abfa7f5

Browse files
committed
Merge branch 'main' of github.com:openpatch/scratch-for-java
2 parents d26aaa8 + 185a690 commit abfa7f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+904
-998
lines changed

.github/workflows/format.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ jobs:
99
formatting:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3 # v2 minimum required
13-
- uses: axel-op/googlejavaformat-action@v3
12+
- uses: actions/checkout@v4 # v2 minimum required
13+
- uses: actions/setup-java@v4
14+
with:
15+
distribution: 'temurin' # See 'Supported distributions' for available options
16+
java-version: '17'
17+
- name: Prettier Java Format
18+
uses: axel-op/googlejavaformat-action@v3
1419
with:
1520
args: "--replace"
16-
commit-message: "style: apply google format"
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package AnimatedSpriteAddAnimation;
2+
23
import org.openpatch.scratch.extensions.animation.AnimatedSprite;
34

45
public class MySprite extends AnimatedSprite {
5-
public MySprite() {
6-
this.addAnimation("idle", "assets/bee_idle.png", 6, 36, 34);
7-
}
6+
public MySprite() {
7+
this.addAnimation("idle", "assets/bee_idle.png", 6, 36, 34);
8+
}
89

9-
public void run() {
10-
this.playAnimation("idle");
11-
}
10+
public void run() {
11+
this.playAnimation("idle");
12+
}
1213
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package AnimatedSpriteAddAnimation;
2+
23
import org.openpatch.scratch.Stage;
34

45
public class MyStage extends Stage {
5-
public MyStage() {
6-
this.add(new MySprite());
7-
}
6+
public MyStage() {
7+
this.add(new MySprite());
8+
}
89
}
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
package AnimatedSpriteAddAnimation;
2+
23
import org.openpatch.scratch.Stage;
34
import org.openpatch.scratch.Window;
4-
import org.openpatch.scratch.extensions.recorder.Recorder;
55
import org.openpatch.scratch.extensions.recorder.GifRecorder;
6+
import org.openpatch.scratch.extensions.recorder.Recorder;
67

78
public class MyWindow extends Window {
8-
public MyWindow() {
9-
Stage myStage = new MyStage();
10-
this.setStage(myStage);
11-
Recorder recorder = new GifRecorder("examples/reference/" + this.getClass().getPackageName());
12-
recorder.start();
13-
// Wait for 5 seconds
14-
while(myStage.getTimer().forMillis(5000));
15-
recorder.stop();
16-
this.exit();
17-
}
9+
public MyWindow() {
10+
Stage myStage = new MyStage();
11+
this.setStage(myStage);
12+
Recorder recorder = new GifRecorder("examples/reference/" + this.getClass().getPackageName());
13+
recorder.start();
14+
// Wait for 5 seconds
15+
while (myStage.getTimer().forMillis(5000))
16+
;
17+
recorder.stop();
18+
this.exit();
19+
}
1820

19-
public static void main(String[] args) {
20-
new MyWindow();
21-
}
21+
public static void main(String[] args) {
22+
new MyWindow();
23+
}
2224
}
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package AnimatedSpriteGetAnimationFrame;
2+
23
import org.openpatch.scratch.extensions.animation.AnimatedSprite;
34

45
public class MySprite extends AnimatedSprite {
5-
public MySprite() {
6-
this.addAnimation("idle", "assets/bee_idle.png", 6, 36, 34);
7-
}
6+
public MySprite() {
7+
this.addAnimation("idle", "assets/bee_idle.png", 6, 36, 34);
8+
}
89

9-
public void run() {
10-
this.playAnimation("idle");
11-
this.say("Frame:" + this.getAnimationFrame());
12-
}
10+
public void run() {
11+
this.playAnimation("idle");
12+
this.say("Frame:" + this.getAnimationFrame());
13+
}
1314
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package AnimatedSpriteGetAnimationFrame;
2+
23
import org.openpatch.scratch.Stage;
34

45
public class MyStage extends Stage {
5-
public MyStage() {
6-
this.add(new MySprite());
7-
}
6+
public MyStage() {
7+
this.add(new MySprite());
8+
}
89
}
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
package AnimatedSpriteGetAnimationFrame;
2+
23
import org.openpatch.scratch.Stage;
34
import org.openpatch.scratch.Window;
4-
import org.openpatch.scratch.extensions.recorder.Recorder;
55
import org.openpatch.scratch.extensions.recorder.GifRecorder;
6+
import org.openpatch.scratch.extensions.recorder.Recorder;
67

78
public class MyWindow extends Window {
8-
public MyWindow() {
9-
Stage myStage = new MyStage();
10-
this.setStage(myStage);
11-
Recorder recorder = new GifRecorder("examples/reference/" + this.getClass().getPackageName());
12-
recorder.start();
13-
// Wait for 5 seconds
14-
while(myStage.getTimer().forMillis(5000));
15-
recorder.stop();
16-
this.exit();
17-
}
9+
public MyWindow() {
10+
Stage myStage = new MyStage();
11+
this.setStage(myStage);
12+
Recorder recorder = new GifRecorder("examples/reference/" + this.getClass().getPackageName());
13+
recorder.start();
14+
// Wait for 5 seconds
15+
while (myStage.getTimer().forMillis(5000))
16+
;
17+
recorder.stop();
18+
this.exit();
19+
}
1820

19-
public static void main(String[] args) {
20-
new MyWindow();
21-
}
21+
public static void main(String[] args) {
22+
new MyWindow();
23+
}
2224
}
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package AnimatedSpriteGetAnimationInterval;
2+
23
import org.openpatch.scratch.extensions.animation.AnimatedSprite;
34

45
public class MySprite extends AnimatedSprite {
5-
public MySprite() {
6-
this.addAnimation("idle", "assets/bee_idle.png", 6, 36, 34);
7-
}
6+
public MySprite() {
7+
this.addAnimation("idle", "assets/bee_idle.png", 6, 36, 34);
8+
}
89

9-
public void run() {
10-
this.playAnimation("idle");
11-
this.say("Interval:" + this.getAnimationInterval());
12-
}
10+
public void run() {
11+
this.playAnimation("idle");
12+
this.say("Interval:" + this.getAnimationInterval());
13+
}
1314
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package AnimatedSpriteGetAnimationInterval;
2+
23
import org.openpatch.scratch.Stage;
34

45
public class MyStage extends Stage {
5-
public MyStage() {
6-
this.add(new MySprite());
7-
}
6+
public MyStage() {
7+
this.add(new MySprite());
8+
}
89
}
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
package AnimatedSpriteGetAnimationInterval;
2+
23
import org.openpatch.scratch.Stage;
34
import org.openpatch.scratch.Window;
4-
import org.openpatch.scratch.extensions.recorder.Recorder;
55
import org.openpatch.scratch.extensions.recorder.GifRecorder;
6+
import org.openpatch.scratch.extensions.recorder.Recorder;
67

78
public class MyWindow extends Window {
8-
public MyWindow() {
9-
Stage myStage = new MyStage();
10-
this.setStage(myStage);
11-
Recorder recorder = new GifRecorder("examples/reference/" + this.getClass().getPackageName());
12-
recorder.start();
13-
// Wait for 5 seconds
14-
while(myStage.getTimer().forMillis(5000));
15-
recorder.stop();
16-
this.exit();
17-
}
9+
public MyWindow() {
10+
Stage myStage = new MyStage();
11+
this.setStage(myStage);
12+
Recorder recorder = new GifRecorder("examples/reference/" + this.getClass().getPackageName());
13+
recorder.start();
14+
// Wait for 5 seconds
15+
while (myStage.getTimer().forMillis(5000))
16+
;
17+
recorder.stop();
18+
this.exit();
19+
}
1820

19-
public static void main(String[] args) {
20-
new MyWindow();
21-
}
21+
public static void main(String[] args) {
22+
new MyWindow();
23+
}
2224
}

0 commit comments

Comments
 (0)