Skip to content

Commit 46869b4

Browse files
committed
version 3.2.0
1 parent 37894cf commit 46869b4

File tree

428 files changed

+1774
-2330
lines changed

Some content is hidden

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

428 files changed

+1774
-2330
lines changed

.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function s4j_examples_run() {
2323
java_dir=${java_file_path%/*}
2424
pushd $java_dir;
2525
java_filename="${java_file%.*}"
26-
lib=$(s4j_workdir)/distribution/scratch-standalone-linux-amd64.jar
26+
lib=$(s4j_workdir)/distribution/scratch4j-linux-amd64.jar
2727
javac -cp "$lib:." $java_file
2828
echo $PWD
2929
echo $java_file
@@ -40,8 +40,8 @@ function s4j_examples_run_all() {
4040
java_dir=${f%/*}
4141
java_name="${java_file%.*}"
4242
pushd $java_dir
43-
javac -cp "$root/distribution/scratch-standalone-linux-amd64.jar:." $java_file
44-
java -cp "$root/distribution/scratch-standalone-linux-amd64.jar:." $java_name
43+
javac -cp "$root/distribution/scratch4j-linux-amd64.jar:." $java_file
44+
java -cp "$root/distribution/scratch4j-linux-amd64.jar:." $java_name
4545
popd
4646
done
4747
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ classes
77
*.class
88
*.ctxt
99
docs/en/public/reference
10+
docs/en/book/changelog.md

CHANGELOG.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,41 @@ name: Changelog
33
index: 4
44
---
55

6+
## 3.2.0
7+
8+
- 🚀 Feat: Introducing the new class `Window`. Every Scratch for Java program can have on `Window`-object. A `Window`-object contains one stage object, which can be change during the runtime. This allows for using multiple stages in your program. For example, you could have one stage for the menu, one for the game and one for the credits.
9+
10+
```java
11+
public class Prog {
12+
public static void main(String[] args) {
13+
Window myWindow = new Window();
14+
Stage stage1 = new Stage();
15+
Stage stage2 = new Stage();
16+
myWindow.addStage("one", stage1);
17+
myWindow.addStage("two", stage2);
18+
19+
myWindow.switchStage("two");
20+
}
21+
}
22+
```
23+
24+
- 🚀 Feat: The class Text became more usable as a standalone Drawable. You can now create a Text-object with the default constructor `new Text()`. The created Text-object will in `TextStyle.PLAIN`, meaning having nothing drawn around it and be freely placeable on the stage.
25+
- The background color can now be set by passing a Color-object. `setBackgroundColor(Color c)`
26+
- The text color can now be set by passing a Color-object. `setTextColor(Color c)`
27+
28+
- 🐎 Perf: Scratch for Java now used an OpenGL renderer, which increases the performance by many times.
29+
- 🐎 Perf: The collision detection got improved.
30+
- 💥 BREAKING: `setSize` got removed from the Stage class. Since the switch to the OpenGL Renderer you can only set the size of the Stage or Window at the constructor.
31+
32+
```java
33+
public class MyStage extends Stage {
34+
public MyStage() {
35+
super(800, 400)
36+
// this.setSize(800, 400);
37+
}
38+
}
39+
```
40+
641
## 3.1.1
742

843
- 🐛 Fix: setSize did not affect getWidth and getHeight.
@@ -14,7 +49,7 @@ index: 4
1449

1550
## 3.0.0
1651

17-
Scratch for Java will from now on focus on being a standalone library. Even though it can be used in processing.
52+
Scratch for Java will from now on focus on being a standalone library. Therefore, it can not be used in Processing anymore.
1853

1954
## 2.1.0
2055

build.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

data/loading.png

44.7 KB
Loading

docs/en/book/changelog.md

Lines changed: 0 additions & 99 deletions
This file was deleted.

docs/en/book/differences-scratch.md

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,104 @@
11
---
22
name: Differences to Scratch
33
index: 2
4-
---
4+
---
5+
6+
# Differences to Scratch
7+
8+
Probably the most noticeable differences to Scratch are the following:
9+
10+
- The coordinated start in the top left hand side corner and **not** in the center.
11+
- There is not wait-block on a Sprite-level, you need to use [Timers](/reference/sprite/sensing/getTimer).
12+
13+
If you want to achieve something like this inside a Sprite:
14+
15+
:::scratchblock
16+
when green flag clicked
17+
forever
18+
next costume
19+
wait (1) seconds
20+
:::
21+
22+
You can use a timer.
23+
24+
```java
25+
public class Cat extends Sprite {
26+
// executes 60-times a second, if the sprite is added to a stage.
27+
public void run() {
28+
if (this.getTimer().everyMillis(1000)) {
29+
this.nextCostume();
30+
}
31+
}
32+
}
33+
```
34+
35+
36+
- There is no Sprite library, you have to search the internet.
37+
- There is no Sound library, you have to search the internet.
38+
- There are not build-in editors, you have to use external tools like [GIMP](https://www.gimp.org/), [Inkscape](https://inkscape.org/), [Audacity](https://www.audacityteam.org/) and so on.
39+
- If you want to share your project with others, you have to used external sharing platforms like Nextcloud, iCloud, Dropbox or better a code sharing platform like GitHub.
40+
- You **can not** use a forever loop. This will halt you program.
41+
42+
If you want to achieve something like this inside a Sprite:
43+
44+
:::scratchblock
45+
when green flag clicked
46+
forever
47+
move (10) steps
48+
:::
49+
50+
You can use the run-method of the Sprite-class.
51+
52+
```java
53+
public class Cat extends Sprite {
54+
// executes 60-times a second, if the sprite is added to a stage.
55+
public void run() {
56+
this.move(10);
57+
}
58+
}
59+
```
60+
61+
- If you want to have a variable for all sprites, you have to use a static attribute. Static attributes are available across all objects.
62+
63+
```java
64+
public class Cat extends Sprite {
65+
public static int hitCounter = 1;
66+
}
67+
68+
public class MyProgram {
69+
public MyProgram() {
70+
Cat.hitCounter += 1;
71+
}
72+
}
73+
```
74+
75+
- There are no send, broadcast or receive message methods, you need to make use of custom-methods and object-references.
76+
77+
```java
78+
public class Sender extends Sprite {
79+
private Receiver receiver;
80+
81+
public Sender(Receiver aReceiver) {
82+
receiver = aReceiver;
83+
}
84+
85+
public whenClicked() {
86+
aReceiver.receive("Hello");
87+
}
88+
89+
}
90+
91+
public class Receiver extends Sprite {
92+
public void receive(String text) {
93+
this.say(text);
94+
}
95+
}
96+
97+
public class MyProgram {
98+
Stage myStage = new Stage();
99+
Receiver myReceiver = new Receiver();
100+
myStage.add(myReceiver);
101+
Sende mySender = new Sender(myReceiver);
102+
myStage.add(mySender);
103+
}
104+
```

docs/en/book/installation.md

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ You can install this library via three ways in BlueJ.
1111

1212
First, you need to download the Scratch for Java jar for your operating system.
1313

14-
::download[Windows Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch-standalone-windows-amd64.jar"}
14+
::download[Windows Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch4j-windows-amd64.jar"}
1515

16-
::download[Linux Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch-standalone-linux-amd64.jar"}
16+
::download[Linux Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch4j-linux-amd64.jar"}
1717

18-
::download[MacOS Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch-standalone-macosx-universal.jar"}
18+
::download[MacOS Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch4j-macosx-universal.jar"}
1919

2020
### Project-by-project
2121

@@ -37,48 +37,12 @@ If you have installed BlueJ via the installer you probably find the "userlib" fo
3737
- MacOS: `/Application/BlueJ/BlueJ.app/Resources/java/userlib`
3838
- Linux: `/usr/share/bluej/userlib/`
3939

40-
## Processing
41-
42-
### Install with the Contribution Manager
43-
44-
Add contributed Libraries by selecting the menu item _Sketch__Import Library...__Add Library..._ This will open the Contribution Manager, where you can browse for Scratch, or any other Library you want to install.
45-
46-
Not all available Libraries have been converted to show up in this menu. If a Library isn't there, it will need to be installed manually by following the instructions below.
47-
48-
### Manual Install
49-
50-
Contributed Libraries may be downloaded separately and manually placed within the `libraries` folder of your Processing sketchbook. To find (and change) the Processing sketchbook location on your computer, open the Preferences window from the Processing application (PDE) and look for the "Sketchbook location" item at the top.
51-
52-
By default, the following locations are used for your sketchbook folder:
53-
54-
- For Mac users, the sketchbook folder is located inside `~/Documents/Processing`
55-
- For Windows users, the sketchbook folder is located inside `My Documents/Processing`
56-
57-
Download Scratch from https://github.com/openpatch/scratch-for-java/releases/latest
58-
59-
Unzip and copy the contributed Library's folder into the `libraries` folder in the Processing sketchbook. You will need to create this `libraries` folder if it does not exist.
60-
61-
The folder structure for Library Scratch should be as follows:
62-
63-
```
64-
Processing
65-
libraries
66-
Scratch
67-
examples
68-
library
69-
Scratch.jar
70-
reference
71-
src
72-
```
73-
74-
Some folders like `examples` or `src` might be missing. After Library Scratch has been successfully installed, restart the Processing application.
75-
7640
## Standalone
7741

7842
You need to add the Jar file for your operating system to the classpath.
7943

80-
::download[Windows Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch-standalone-windows-amd64.jar"}
44+
::download[Windows Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch4j-windows-amd64.jar"}
8145

82-
::download[Linux Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch-standalone-linux-amd64.jar"}
46+
::download[Linux Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch4j-linux-amd64.jar"}
8347

84-
::download[MacOS Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch-standalone-macosx-universal.jar"}
48+
::download[MacOS Jar]{src="https://github.com/openpatch/scratch-for-java/releases/latest/download/scratch4j-macosx-universal.jar"}

0 commit comments

Comments
 (0)