Skip to content

Commit 38efbe7

Browse files
committed
improve docs
1 parent 7342b8b commit 38efbe7

File tree

58 files changed

+853
-280
lines changed

Some content is hidden

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

58 files changed

+853
-280
lines changed

docs/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ done
2323
popd
2424

2525
npx hyperbook build
26+
27+
cp -R distribution/javadoc docs/.hyperbook/out/javadoc

docs/de/book/changelog.md

Lines changed: 213 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,205 @@
11
---
22
name: Changelog
33
index: 4
4+
lang: en
45
---
56

7+
## 4.11.0
8+
9+
- 🚀 Feat: A broadcast and whenIReceive methods for the Object-class, which makes it possible to send anything as a broadcast.
10+
11+
```java
12+
sprite1.broadcast(new Event());
13+
14+
class AnotherSprite extends Sprite {
15+
public void whenIReceive(Object message) {
16+
if (message instanceof Event) {
17+
// ...
18+
}
19+
}
20+
}
21+
```
22+
23+
## 4.10.0
24+
25+
- 🚀 Feat: Add new random methods for get a random position with respect to the window size.
26+
27+
```java
28+
Random.randomPosition();
29+
Random.randomX();
30+
Random.randomY();
31+
```
32+
33+
- 🐛 Fix: setSize not caching the new image, which lead to low framerates.
34+
35+
36+
## 4.9.0
37+
38+
- 🚀 Feat: Add fullscreen mode. You can now define in the constructor of your window, if you want to operate in fullscreen mode.
39+
40+
```java
41+
new Window(true); // fullscreen
42+
new Window(true, assets) // fullscreen with assets loading
43+
```
44+
45+
- 🐛 Fix: keyCodes for some keys were off.
46+
- 🐛 Fix: File extension not working on Windows.
47+
48+
## 4.8.3
49+
50+
- 🐛 Fix: pointTowardsSprite pointing to the opposite direction
51+
52+
## 4.8.2
53+
54+
- 🐛 Fix: Pen position and state when using the copy-constructor.
55+
56+
## 4.8.1
57+
58+
- 🐛 Fix: Debug text influencing text size of other texts.
59+
- 🐛 Fix: Mouse tracking not working correctly when zooming in and out.
60+
61+
## 4.8.0
62+
63+
- 💥 BREAKING CHANGE: Pen behavior was changed to work more similar to the behavior of the scratch pen.
64+
- You should double the size of your pen in your sketches to get the same visuals as in the previous versions.
65+
- You should also put the pen down after you have set the initial position, since the pen now draws an initial point, when it is put down.
66+
67+
## 4.7.0
68+
69+
- 🚀 Feat: Add methods to the text class to be more consistent with the sprite class in regard to positioning.
70+
- 🚀 Feat: Update sound library to add support for mp3 and ogg files
71+
- 🐛 Fix: Think- and say-bubble were not at the right place
72+
73+
## 4.6.0
74+
75+
- 🚀 Feat: Add setCursor method to the stage class.
76+
- 🚀 Feat: Add extension camera. The camera object allows you to move the view of the stage without manipulating the coordinates of e.g. sprites.
77+
78+
You can now get the camera from a stage object.
79+
80+
```java
81+
var myStage = new Stage();
82+
Camera myCamera = myStage.getCamera();
83+
```
84+
85+
The three main abilities of the camera are:
86+
87+
1. Set the position of the camera (setX, setY, changeX, changeY, setPosition)
88+
2. Set the zoom of the camera (setZoom, resetZoo, changeZoom, setZoomLimit)
89+
3. Transform coordinates from local (Camera-Space) to global (Window-Space) (toLocalPosition, toLocalX, toLocalY, toGlobalPosition, toGlobalX, toGlobalY)
90+
91+
## 4.5.0
92+
93+
- 💥 BREAKING CHANGE: Only use double for methods instead of supporting both float and doubles. This was unnecessary and cluttered the BlueJ interface with "duplicated" methods. This could potentially break your project if you were using floats, just replace them with doubles, and you are good to go.
94+
95+
## 4.4.0
96+
97+
- 🚀 Feat: Revert BREAKING CHANGE and add addStage, removeStage and getStage again.
98+
- 🚀 Feat: Add methods for counting sprites (countSprites, countSpritesOf), pens (countPens, countPensOf) and texts (countTexts, countTextsOf).
99+
- 🚀 Feat: Add more methods for finding sprites (findSpritesOf), pens (findPensOf) and texts (findTextsOf) of a given class.
100+
- 🚀 Feat: Add exit to Stage for easier access.
101+
- 🚀 Feat: Add getDeltaTime to the Sprite and Stage class.
102+
- 🚀 Feat: You can now stretch a backdrop to the window size by using `addBackdrop("name", "path", true)`.
103+
- 🐛 Fix: Path resolution of assets
104+
- 🐛 Fix: whenMouseMoved not working
105+
106+
## 4.3.0
107+
108+
- 🚀 Feat: Random can now create a new random unit vector (Random.randomVector2()).
109+
- 🚀 Feat: You can now set the width of a text after calling the constructor (text.setWidth(40)).
110+
111+
## 4.2.1
112+
113+
- 🐛 Fix: AnimatedSprite throws an error, because the animationFrame is too high.
114+
115+
## 4.2.0
116+
117+
- 💥 BREAKING CHANGE: Replace addStage, removeStage and getStage in favour of setStage, which simplifies the handling of multiple stages.
118+
- 🐛 Fix: First frame of an AnimatedSprite is skipped.
119+
120+
## 4.1.0
121+
122+
- 🚀 Feat: New extension tiled.
123+
- 🐛 Fix: Fix isTouchingMousePointer.
124+
125+
## 4.0.2
126+
127+
- 🐛 Fix: Missing stamp method on Sprite
128+
129+
## 4.0.1
130+
131+
- 🐛 Fix: Scratch for Java Window not creating on Windows
132+
133+
## 4.0.0
134+
135+
- 💥 BREAKING CHANGE: Move (0, 0) to the center of the stage to be in-line with Scratch.
136+
- 🚀 Feat: Add stamp method to the pen `pen.stamp()`. This is also available on a Sprite with `stamp()`, `stampToForeground()` or `stampToBackground()`.
137+
- 🚀 Feat: Unify constructors of Window and Stage.
138+
- 🚀 Feat: Load all tiles from a sprite sheet as costumes with addCostumes.
139+
- 🚀 Feat: Add goToMousePointer to the sprite class.
140+
- 🚀 Feat: Add goToRandomPosition to the sprite class.
141+
- 🚀 Feat: switchCostumes now also accepts an integer for switching to a specific index.
142+
- 🚀 Feat: Allow for custom sorting of sprites by providing a Comparator via the `setSorter`-method of the stage.
143+
- 🐛 Fix: Random.randomInt did not work correct.
144+
145+
## 3.9.0
146+
147+
- 🚀 Feat: Add support for broadcast and when i receive blocks to the Sprite and the Stage class.
148+
149+
## 3.8.0
150+
151+
- 🚀 Feat: Support for vertical sprite sheets was added.
152+
- 🚀 feat: Loading Animation got improved. The loading screen now shows the percentage of files, which are already loaded.
153+
154+
## 3.7.0
155+
156+
#scratch4j v3.7.0 got released:
157+
158+
- 💥 BREAKING CHANGE: AnimatedSprite, Hitbox, Text and Timer were moved into the org.openpatch.scratch.extensions package. Each extension got its package. For example, org.openpatch.scratch.extensions.animation. In the main package, we only want the classes with emulate the current Scratch behavior. This should lead to a smoother transition. The extensions package should be used, we the normal functionality is not enough.
159+
- 🚀 Feat: New class Vector2 for the math extension. Every so often, it is easier to work with vectors. Therefore, this class got introduced. The Sprite class was updated to make use of the Vector2 class. You can, for example, call the move and setDirection methods with a Vector2.
160+
- 🚀 Feat: New class Operators. This class has several simple methods for transforming data and working with mathematical operations – just like the Scratch operator blocks. For example, mapping values, lerping between values or using sine and cosine.
161+
- 🚀 Feat: New class Random in the math extension. This class contains several methods for generating random numbers. This makes working with randomness outside a Sprite or Stage class easier.
162+
- 🚀 Feat: Introduce the method ifOnEdgeBounce for the class Sprite. This method works like the if on edge, bounce-block in Scratch in is an alternative to the setOnEdgeBounce-method.
163+
- 🚀 Feat: Introduce pointTowardsMousePointer and pointTowardsSprite methods for the class Sprite.
164+
- 🐛 Fix: Jar files missing version information.
165+
- 🐛 Fix: Speak and Think-bubble rendering. Speak and Think-bubbles now behave like they do in Scratch. Meaning, they will ever leave the Stage.
166+
- 📝 Docs: Add more documentation
167+
168+
## 3.6.0
169+
170+
- 🚀 Feat: Add method `setTextSize` to the Text-class
171+
172+
```java
173+
Text myText = new Text();
174+
myText.setTextSize(48);
175+
```
176+
177+
- 🚀 Feat: Allow custom fonts for Text-objects. Custom fonts can be added like a costume for a Sprite-object. Each Text-object does have a default font named `default`.
178+
179+
```java
180+
Text myText = new Text();
181+
myText.addFont("playful", "opensans.odt");
182+
myText.switchFont("playful");
183+
184+
// get the text-object, which is used for the think and speak bubble
185+
Text spriteText = new Sprite().getText();
186+
```
187+
188+
- 📝 Docs: Add example `Shakespeare` which shows the usage of the new methods of the Text-class
189+
190+
## 3.5.0
191+
192+
- 💻 OS: Added Linux ARM 32-bit and ARM 64-bit versions
193+
194+
## 3.4.0
195+
196+
- 🧹 Chore: Update Processing core to version 4.2
197+
- 💻 OS: Added MacOS aarch64 version
198+
199+
## 3.3.0
200+
201+
- 🚀 Feat: Added `isSoundPlaying` and `stopSound` to the Sprite and Stage Class.
202+
6203
## 3.2.2
7204

8205
- 🎨 Visual: Improve Pen rendering
@@ -12,7 +209,7 @@ index: 4
12209

13210
## 3.2.1
14211

15-
- 🐛 Fix: Pen only drawing dots
212+
- 🐛 Fix: Pen only drawing dots
16213

17214
## 3.2.0
18215

@@ -33,8 +230,9 @@ public class Prog {
33230
```
34231

35232
- 🚀 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.
36-
- The background color can now be set by passing a Color-object. `setBackgroundColor(Color c)`
37-
- The text color can now be set by passing a Color-object. `setTextColor(Color c)`
233+
234+
- The background color can now be set by passing a Color-object. `setBackgroundColor(Color c)`
235+
- The text color can now be set by passing a Color-object. `setTextColor(Color c)`
38236

39237
- 🐎 Perf: Scratch for Java now used an OpenGL renderer, which increases the performance by many times.
40238
- 🐎 Perf: The collision detection got improved.
@@ -116,30 +314,30 @@ class AnimatedBee extends AnimatedSprite {
116314

117315
## 2.0.0
118316

119-
* BREAKING CHANGE: Rename package to `org.openpatch.scratch`
317+
- BREAKING CHANGE: Rename package to `org.openpatch.scratch`
120318

121319
## 1.15.0
122320

123-
* Add standalone version
321+
- Add standalone version
124322

125323
## 1.14.1
126324

127-
* Improve Text rendering
325+
- Improve Text rendering
128326

129327
## 1.14.0
130328

131-
* add think and say to Sprite
132-
* add display to Stage
133-
* add whenClicked to Sprite
134-
* add whenBackdropSwitches to Sprite
329+
- add think and say to Sprite
330+
- add display to Stage
331+
- add whenClicked to Sprite
332+
- add whenBackdropSwitches to Sprite
135333

136334
## 1.13.0
137335

138-
* add stage.removeSprites
139-
* add stage.findSprites
140-
* use CopyOnWriteArrayList instead of ArrayList
336+
- add stage.removeSprites
337+
- add stage.findSprites
338+
- use CopyOnWriteArrayList instead of ArrayList
141339

142340
## 1.4.0
143341

144-
* add more timer methods
145-
* add a timer example
342+
- add more timer methods
343+
- add a timer example

docs/de/hyperbook.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
},
1717
"repo": "https://github.com/openpatch/scratch-for-java/tree/main/docs/de",
1818
"links": [
19+
{
20+
"label": "JavaDoc",
21+
"href": "/javadoc"
22+
},
1923
{
2024
"label": "Kontakt",
2125
"links": [

docs/en/book/reference/extensions/animation/animated-sprite/looks/addAnimation.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"template": "method",
2+
"template": "class-method",
33
"related": [],
44
"name": "addAnimation()",
55
"scratchblock": "add animation (name) (pattern) (frames)",
@@ -13,9 +13,22 @@
1313
"returns": "void",
1414
"examples": [
1515
{
16-
"src": "AnimatedSpriteAddAnimation.java",
1716
"preview": "AnimatedSpriteAddAnimation.gif",
18-
"lines": "reg:[Rr]ecorder"
17+
"folder": "AnimatedSpriteAddAnimation",
18+
"files": [
19+
{
20+
"src": "MySprite.java",
21+
"lines": "reg:package"
22+
},
23+
{
24+
"src": "MyStage.java",
25+
"lines": "reg:package"
26+
},
27+
{
28+
"src": "MyWindow.java",
29+
"lines": "reg:([Rr]ecorder|package)"
30+
}
31+
]
1932
}
2033
],
2134
"parameters": [
@@ -51,4 +64,3 @@
5164
}
5265
]
5366
}
54-
Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"template": "method",
2+
"template": "class-method",
33
"related": [],
44
"scratchblock": "(animation frame)",
55
"name": "getAnimationFrame()",
@@ -9,9 +9,22 @@
99
"returns": "int",
1010
"examples": [
1111
{
12-
"src": "AnimatedSpriteGetAnimationFrame.java",
1312
"preview": "AnimatedSpriteGetAnimationFrame.gif",
14-
"lines": "reg:[Rr]ecorder"
13+
"folder": "AnimatedSpriteGetAnimationFrame",
14+
"files": [
15+
{
16+
"src": "MySprite.java",
17+
"lines": "reg:package"
18+
},
19+
{
20+
"src": "MyStage.java",
21+
"lines": "reg:package"
22+
},
23+
{
24+
"src": "MyWindow.java",
25+
"lines": "reg:([Rr]ecorder|package)"
26+
}
27+
]
1528
}
1629
]
1730
}
Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"template": "method",
2+
"template": "class-method",
33
"related": [],
44
"scratchblock": "(animation interval)",
55
"name": "getAnimationInterval()",
@@ -9,9 +9,22 @@
99
"returns": "int",
1010
"examples": [
1111
{
12-
"src": "AnimatedSpriteGetAnimationInterval.java",
1312
"preview": "AnimatedSpriteGetAnimationInterval.gif",
14-
"lines": "reg:[Rr]ecorder"
13+
"folder": "AnimatedSpriteGetAnimationInterval",
14+
"files": [
15+
{
16+
"src": "MySprite.java",
17+
"lines": "reg:package"
18+
},
19+
{
20+
"src": "MyStage.java",
21+
"lines": "reg:package"
22+
},
23+
{
24+
"src": "MyWindow.java",
25+
"lines": "reg:([Rr]ecorder|package)"
26+
}
27+
]
1528
}
1629
]
1730
}

0 commit comments

Comments
 (0)