Skip to content

Commit

Permalink
add texture sampling mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebarkmin committed Jan 24, 2025
1 parent 76c1539 commit 3c3a5f2
Show file tree
Hide file tree
Showing 12 changed files with 645 additions and 406 deletions.
13 changes: 13 additions & 0 deletions docs/de/book/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ index: 4
lang: en
---

## 4.12.0

- 🚀 Feat: You can set the texture sampling mode. For pixel art games, you can set the texture sampling mode to nearest neighbor. This will prevent the textures from being interpolated.

```java
public class MyStage() {
public MyStage() {
super(800, 400);
setTextureSampling(2); // set the texture sampling to point sampling.
}
}
```

## 4.11.0

- 🚀 Feat: A broadcast and whenIReceive methods for the Object-class, which makes it possible to send anything as a broadcast.
Expand Down
1 change: 1 addition & 0 deletions examples/java/Robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
public class Robot extends Stage {
public Robot() {
super(800, 600);
this.setDebug(true);
this.add(new RobotSprite());
}

Expand Down
4 changes: 4 additions & 0 deletions examples/java/Tiled/Fireball.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ public void run() {

if (dir == "left") {
this.changeX(-speed);
this.setDirection(0);
} else if (dir == "right") {
this.changeX(speed);
this.setDirection(180);
} else if (dir == "up") {
this.setDirection(90);
this.changeY(speed);
} else if (dir == "down") {
this.setDirection(270);
this.changeY(-speed);
}

Expand Down
10 changes: 5 additions & 5 deletions examples/java/Tiled/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public World() {
GameState.load();
I18n.select(GameState.get().locale);
this.loadMap(GameState.get().map);
this.setTextureSampling(2);
}

public void whenKeyPressed(int keyCode) {
Expand Down Expand Up @@ -62,11 +63,10 @@ public void loadMap(String mapFile) {
}
} else if ("enemy".equals(object.type)) {
switch (object.name) {
case "bamboo":
{
this.add(new Bamboo(object.x, object.y));
break;
}
case "bamboo": {
this.add(new Bamboo(object.x, object.y));
break;
}
}
}
}
Expand Down
Binary file modified examples/reference/SpriteIfOnEdgeBounce.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions resources/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ author.url=https://openpatch.org
# This is NOT a direct link to where to download it.

library.url=https://github.com/openpatch/scratch-for-java
library.version=4.16.0
library.version=4.17.0


# Set the category (or categories) of your Library from the following list:
Expand Down Expand Up @@ -80,5 +80,5 @@ library.keywords=scratch
# Include javadoc references into your project's javadocs.

#javadoc.java.href=http://docs.oracle.com/javase/7/docs/api/
javadoc.java.href=http://docs.oracle.com/en/java/javase/17/docs/api/
javadoc.java.href=http://docs.oracle.com/en/java/javase/21/docs/api/
javadoc.processing.href=http://processing.github.io/processing-javadocs/core/
Loading

0 comments on commit 3c3a5f2

Please sign in to comment.