diff --git a/.changeset/gamepad-extension.md b/.changeset/gamepad-extension.md new file mode 100644 index 00000000..8ccadd0d --- /dev/null +++ b/.changeset/gamepad-extension.md @@ -0,0 +1,9 @@ +--- +type: minor +--- + +Add the `scratch-gamepad` extension: controller support for up to four gamepads. `Gamepad` asks +anywhere for buttons, sticks (y up, as on the stage, with a dead zone), triggers and connections; +stages and sprites implementing `GamepadListener` are told about button presses, releases and +controllers connecting, at the same point of the tick as key events. Buttons are named in Xbox +positions (A, B, X, Y); controllers without a known layout are skipped and there is no rumble. diff --git a/.changeset/lwjgl.md b/.changeset/lwjgl.md new file mode 100644 index 00000000..e878745c --- /dev/null +++ b/.changeset/lwjgl.md @@ -0,0 +1,11 @@ +--- +type: major +--- + +Scratch for Java no longer runs on Processing. It draws with its own renderer on LWJGL (OpenGL 3.3, 4.1 on macOS), plays sound through OpenAL and needs no `java.desktop`. `run()` is called exactly 60 times per second of game time on every computer, and what a program sees (collisions, colour sensing, text layout) no longer depends on the graphics card or the screen. + +The extensions are jars of their own: `scratch-tiled`, `scratch-save`, `scratch-recorder` and `scratch-drawing`, with short packages (`org.openpatch.scratch.tiled`, …). Camera, shaders, sound, pixels and sorting are part of `org.openpatch.scratch`. The `-all` jar still contains everything, and a public extension API lets others write extensions. + +The API was cleaned up for learners, and programs written for 6.x need changes: time is in seconds everywhere (`say("Hi", 2)`, `waitSeconds(0.5)`, `timer.every(0.5)`), animations and nine-slicing are on every sprite (`AnimatedSprite` and `UISprite` are gone), `createClone()` replaces `clone()`, layers replace the UI flags, `Color` cannot be changed, the colour effect and the tint are separate, and shaders have a new, shorter format. The page "Moving from 6.x to 7.0" lists every change, and `scripts/migrate-7.py` makes the mechanical ones. + +BlueJ is no longer supported; Scratch for Java Studio is the IDE. diff --git a/.changeset/smooth-pixel-art-letterbox.md b/.changeset/smooth-pixel-art-letterbox.md new file mode 100644 index 00000000..77b3bd09 --- /dev/null +++ b/.changeset/smooth-pixel-art-letterbox.md @@ -0,0 +1,7 @@ +--- +type: patch +--- + +Smooth pixel art scales the window's letterbox to fit, like its camera zoom, instead of whole +numbers: with `Window.useSmoothPixelArt()` the stage fills the window at any size, while plain +`usePixelArt()` keeps stepping whole pixels. diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index a5260a4e..8622503c 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,199 +1,158 @@ # Copilot Instructions for Scratch for Java -## Repository Overview +Taken from `AGENTS.md`, which is the maintained description of the repository: change both together. + +## 7.0 rewrite (branch `v7`) — read this first + +7.0 replaces Processing with LWJGL and moves the extensions into jars of their own. Where they +exist, `plan.md` (specification and decision log) and `v7-execution.md` (requirements, evidence, +log) are local working notes and are not committed. 7.0 breaks 6.x on purpose wherever the design needs it +(`docs/book/migrate-to-7.md` lists every change). The 6.x sources are on `main` and in the +history; everything in them has been ported. + +## What this is + +Scratch for Java (`org.openpatch.scratch`) is a Java library that ports the Scratch (scratch.mit.edu) +block-based programming model to Java, so learners can move from blocks to text-based code while +keeping the same mental model (Window / Stage / Sprite, costumes, backdrops, broadcasts, etc.). + +## Build & commands + +- **Never `mvn install` on `v7`.** The version is still the released one (6.5.0, managed by the + release workflow), so an install overwrites the real `org.openpatch:scratch:6.5.0` in `~/.m2` + with 7.0 code, and every other project on the machine (Studio) silently builds against it. + Build inside the reactor instead (`-pl -am`). +- `mvn test` — all modules, no window needed. If a test fails with "Unresolved compilation + problems", an IDE (Eclipse compiler) wrote into `target/`: run `mvn clean test`. +- `mvn verify` — additionally builds the fat jar `all/target/scratch--all.jar` and runs + `all/src/build/BuildChecks.java` (no `java.desktop` in shipped code, extensions use no + `internal`, no NRW-sensitive calls or GLFW callbacks in extensions, fat-jar + manifest/natives/notices). +- `mvn package -pl all,examples -am -DskipTests` — the fat jar and the examples, quickly. +- `mvn package -Pnrw` — the NRW fat jar (`scratch--nrw-all.jar`): sources rewritten by + `core/src/build/NrwVariant.java` from the `// nrw:` markers in Stage and Sprite, so `find`, + `getAll` and `getTouchingSprites` return the `List` of the NRW Zentralabitur. +- `mvn deploy -Pcentral` — release to Maven Central; done by the release workflow, not by hand. +- `./scripts/run.sh` — pick a demo or reference example and run it (`--each` runs every demo, + `-- ` passes JVM arguments); builds in the reactor first. +- `./scripts/benchmark.sh [--quick] [--xvfb] [--with-6x]` — the stress test, collision and + colour checks; appends the results with the commit to `scripts/benchmark/history.csv` + (commit that with the change it measures). `--with-6x` builds `main` in a worktree for comparison. +- `python3 scripts/migrate-7.py --out <6.x folder>` migrates 6.x code, shaders and the + ```java blocks of Markdown pages (run once per project; it marks what needs a person with + `// TODO 7.0:`). +- `./build.sh` — full doc site build (reference pages, demo pages, asset pages, version + substitution, then `npx hyperbook build` in `docs/`); `cd docs && npx hyperbook@latest dev` runs + the site locally (always the newest Hyperbook, as in CI). + +Java 17 builds the library (`maven.compiler.release`), but the tests want Java 25: the +documentation's interactive examples are compact source files (`void main()` beside the classes), +and the tests that compile them skip on anything older. CI runs 25. + +## Seeing and testing without a window + +- Scene logic is tested headless: `Game.headless(480, 360)`, `game.setStage(stage)`, + `game.runTicks(n)`, `game.drawList()` (see `core/src/test/.../SceneTest.java`). Sprites, + costumes, hitboxes, clones, pens, colour sensing (`Pixels.of(stage)`), text layout, timers and + transitions all work there. +- To see a frame: run a program with `-Dscratch4j.preview=` (writes `frame.png` and the + sprites in `stage.json`, then ends). `-Dscratch4j.capture=` does the same per stage while the + program keeps running (Studio uses it for its stage designer). +- Under Xvfb in a Wayland session: `XDG_SESSION_TYPE=x11 xvfb-run -a java -Dscratch4j.platform=x11 …` + (GLFW picks Wayland otherwise). Under Xvfb the window is exactly the render size, so letterbox + and HiDPI bugs do not reproduce there. `-Dscratch4j.debugGl` prints window, framebuffer, monitor + and letterbox geometry and vsync switches. +- Reference examples load their assets relative to `examples/src/main/java/reference`: run them + from there (`run.sh` does). +- Parity: `ParityTest` and `LifecycleParityTest` (core, headless; `./scripts/parity.sh --record`), + `./scripts/visual-parity.sh [--record]` (23 frames under Xvfb, compared exactly). +- Documentation guards in the examples module: `DocumentationSnippetsTest` compiles every + ```java block on the hand-written pages under `docs/book` — **if you change a public API, this + tells you which tutorial you just broke**; `DemoPagesTest` checks that `docs/book/examples/*.md` + match the demos they are generated from (a page opts in with `` above its + `:::onlineide` block). **After changing a demo, run `./scripts/update-demo-pages.sh`** and commit + the pages it touches (it also copies the demos' assets to `docs/public/examples`, ignored). + `OnlineExampleTest` compiles the interactive examples. + +## Source layout -**Scratch for Java** is a Java library that replicates the functionality and concepts of Scratch, helping learners transition from block-based programming to text-based coding in Java. The library provides an approachable API inspired by Scratch blocks, making it easier for beginners to understand programming concepts while gaining experience with real Java syntax and tools. - -- **Main Package**: `org.openpatch.scratch` -- **Version**: see `` in `pom.xml` — managed automatically by the changeset release flow, do not hand-edit it -- **Java Version**: 17 -- **Build Tool**: Maven -- **Documentation Site**: https://scratch4j.openpatch.org -- **Tests**: none — there is no JUnit dependency and no `*Test.java` files under `src/main`. Validate changes with `mvn compile` and by checking the relevant demo/reference example still behaves correctly. - -## High-Level Architecture - -The library is structured around three core concepts: -1. **Window**: the singleton application window (`Window` class) — owns the render loop and the current `Stage` -2. **Stage**: the active scene, holding sprites, backdrops, and `when*` event handlers (key press, mouse click, broadcasts, ...) -3. **Sprite**: interactive objects that can move, detect collisions, play sounds, etc., with a `run()` method invoked every frame - -### Key Dependencies (see `pom.xml`) -- **Processing** (`org.processing:core`) — core graphics and windowing framework -- **Jackson** (`tools.jackson.*` + `com.fasterxml.jackson.core:jackson-annotations`) — JSON/XML processing, used e.g. in `extensions/fs` and `extensions/tiled` -- **word-wrap** (`com.github.davidmoten:word-wrap`) — text wrapping for `extensions/text` - -## Build Instructions - -### Prerequisites -- Java 17+ to compile/run the library; Java 25 for generating and checking shared catalogs (CI documentation, validation, and release jobs use Temurin 25; `maven.compiler.release=17` preserves runtime compatibility) -- Maven (release publication uses pinned Maven 3.9.16 to keep local metadata out of Central bundles) -- Node.js + npm (for the documentation site only) - -### Maven Build Commands - -```bash -mvn compile # basic compilation (the day-to-day command from README.md) -mvn clean package # create the standard JAR ``` - -**Build Profiles**: -```bash -mvn deploy -Pcentral # release to Maven Central: GPG signing + central-publishing-maven-plugin - # (the real release path — not something to run casually) -mvn clean package -Pall # standalone JAR with all dependencies shaded in -> target/*-all.jar +pom.xml parent (scratch-parent); modules in lockstep, one version +core/ artifact `scratch` + src/main/java/org/openpatch/scratch/ + Window, Stage, Sprite, Text, Pen, Camera, Layer, Shader(s), Transition, Pixels, Timer, + Color, Vector2, shapes, Operators, KeyCode, ... the learner API, one flat package + Launcher macOS: window on the first thread (-XstartOnFirstThread) + extension/ public extension API (Extension, ExtensionContext, Canvas) + internal/ not exported: Game, loop/ (game thread, tick clock), draw/ (draw list), + render/ (OpenGL), window/ (GLFW), canvas/ + compose/ (CPU pen canvases, + compositor for colour sensing), text/ (stb_truetype engine), audio/ + (OpenAL), image/ (stb_image), geom/, input/, Assets, Preview, Release + src/build/NrwVariant.java +extensions/{tiled,save,recorder,drawing}/ `scratch-`, package org.openpatch.scratch., + public API only, registered through ServiceLoader +all/ fat jar + src/build/BuildChecks.java +examples/ demos/ (runnable projects), reference/ (one example per documented + method), parity/; src/tools/java (doclet, docs.GenerateDemoPages, + docs.GenerateAssetPages); built, never published +templates/extension-starter/ standalone Maven project for third-party extensions +docs/ Hyperbook site (English) ``` -### Documentation Build - -The documentation site uses **Hyperbook** (Node.js-based static site generator) and lives entirely under `docs/` (single language, English): +## Architecture -```bash -cd docs -npx hyperbook dev # start development server -npx hyperbook build # build static documentation -``` +Three concepts mirror Scratch directly and almost every feature hangs off one of them: -`./build.sh` (run from the repo root) is the full pipeline CI uses: it copies `CHANGELOG.md` into `docs/book/changelog.md`, regenerates the reference GIFs from `src/examples/java/reference` into `docs/public/reference/`, substitutes the version into `docs/book/download.md` / `docs/book/index.md`, then runs `npx hyperbook build`. +- **Window** — the singleton window (`new Window(480, 360)`, then `setStage(...)`). Settings + that must be known before it opens are static and called first (`usePixelArt()`, + `useFullScreen()`, ...). +- **Stage** — one scene: sprites, texts, pens, backdrops, the `when*` event handlers. +- **Sprite** — costumes, animations, movement, collision/sensing, sound, and a `run()` method + called every tick (a Scratch script attached to a sprite). -## Project Layout and Architecture +Threads: a **window thread** owns GLFW and OpenGL, a **game thread** runs +every tick and all learner callbacks, the learner's `main` runs on its own thread. They work in +lockstep: a tick is exactly 1/60 s of game time; at the end of a batch of ticks the game thread +builds a **draw list**, and that is all the renderer sees — the scene never draws itself. +Everything learners can observe (collisions, colour sensing through the CPU compositor, text +layout) is computed on the CPU and is the same on every GPU and in headless tests. -### Source Code Structure -``` -src/main/java/org/openpatch/scratch/ -├── Window.java # singleton application window -├── Stage.java # scene: sprites, backdrops, event handlers -├── Sprite.java # core interactive object -├── Operators.java # Scratch "Operators" block equivalents -├── KeyCode.java / MouseCode.java / RotationStyle.java -├── extensions/ # optional capabilities, one sub-package each: -│ ├── animation/ # AnimatedSprite etc. -│ ├── camera/ # camera/viewport -│ ├── color/ # color manipulation -│ ├── fs/ # file system / save-data -│ ├── hitbox/ # precise collision shapes -│ ├── math/ # math utilities -│ ├── pen/ # drawing/pen -│ ├── recorder/ # GIF recording (Recorder / GifRecorder) -│ ├── shader/ # OpenGL shader support -│ ├── shape/ # geometric shapes -│ ├── text/ # text rendering -│ ├── tiled/ # Tiled map support -│ └── timer/ # timers -└── internal/ # implementation details, not public API - (Processing glue, image/font/sound loading, GIF encoding, simplex noise, ...) - -src/examples/java/ -├── demos/ # complete runnable example projects -└── reference/ # one folder per documented API method/feature - -src/tools/java/doclets/ -└── Scratch4JDoclet.java # custom Javadoc doclet that generates the reference docs - -docs/ # Hyperbook documentation site -├── book/ # page content (tutorials, examples, generated reference) -├── archives/ # starter project templates (vs-code-starter, bluej-starter) -│ # and other downloadable/archived project snapshots -├── templates/ # Handlebars templates used by the doclet-generated pages -└── public/ # static assets, incl. generated reference GIFs -``` +Extensions build on the public extension API only (`ExtensionContext` hooks: `beforeTick`, +layer and overlay drawers on a `Canvas`, `afterFrame`, `dispatch` to listener interfaces, +attachments via `stage.extension(...)`), never on `internal`, and register themselves through +`ServiceLoader`. New capabilities go into an extension if they can be built that way and pull in +a dependency (Jackson); things that need the renderer or the game loop stay in the core. -Prefer adding a new `extensions/` sub-package for new capabilities over growing `Sprite.java`/`Stage.java` further (they are already ~2,000+ lines each) — e.g. `AnimatedSprite` (animation) extends `Sprite` rather than adding animation state directly to it. +No `java.awt`/`java.desktop` in shipped code (BuildChecks enforces it); tests and build tools may +use it. Jackson (`tools.jackson.*`) is used by tiled and save. -`src/examples/java` and `src/tools/java` are wired into the main build via the -`build-helper-maven-plugin` (`add-examples-source` execution), so they compile as part of the -project even though they live outside `src/main`. They are excluded from the packaged JAR and -sources JAR (see the `maven-jar-plugin` / `maven-source-plugin` `` in `pom.xml`). +## Javadoc → documentation pipeline -### Configuration Files -- `pom.xml` - Maven build configuration with `central` and `all` profiles -- `.vscode/settings.json` - VS Code Java project settings (Hyperbook root, formatter) -- `docs/hyperbook.json` - documentation site config -- `.github/workflows/` - CI/CD pipelines (`version.yml`, `release.yml`, `docs.yml`) +The public API's Javadoc is the source of truth for the reference documentation on +https://scratch4j.openpatch.org. `./scripts/reference-docs.sh` runs the doclet +(`examples/src/tools/java/doclets`) over core and the extensions and writes +`docs/book/reference`: -## Continuous Integration +- `@example.files a.java;b.java` — files from `examples/src/main/java/reference` shown as source + (`@example.folder ` for a folder of them). +- `@scratchblock`, `@index-in-docs`, `@name-in-docs`, `@ignore-in-docs` — the Scratch block shown, + ordering, display name, exclusion. -1. **Version Bump Workflow** (`.github/workflows/version.yml`) — triggers on changeset files in `.changeset/`, bumps the version (patch/minor/major), updates `CHANGELOG.md`, opens a release PR. -2. **Release Workflow** (`.github/workflows/release.yml`) — triggers when the version-bump PR is merged; deploys to Maven Central (`mvn deploy -Pcentral`, GPG-signed), builds the fat JAR (`-Pall`), and creates a GitHub release. -3. **Documentation Workflow** (`.github/workflows/docs.yml`) — on push to `main`: `mvn clean package`, `./build.sh`, copies `target/apidocs` into the built docs, deploys to GitHub Pages. +When adding or changing a public method that should be documented, add/update its reference +example and the tags on the Javadoc comment. Other generators: `docs.GenerateDemoPages --write` +(example pages from the demos) and `docs.GenerateAssetPages` (built-in sprites and sounds). -### Release Flow (changesets) -Releases are changeset-driven (`.changeset/README.md`): add a Markdown file to `.changeset/` with -frontmatter `type: patch | minor | major` and a description as part of your PR. Merging that PR -triggers the version-bump workflow above; merging *its* PR triggers the actual release. +## Versioning & release flow -## Javadoc → Documentation Pipeline - -Public API Javadoc is the source of truth for https://scratch4j.openpatch.org. The custom doclet -(`Scratch4JDoclet`) reads special tags on public members and emits per-method reference pages: - -- `@example.folder ` — matches `src/examples/java/reference//`, a self-contained example - (package `reference.`) with `MySprite.java` / `MyStage.java` / `MyWindow.java`. `MyWindow` - typically wraps the example in a `GifRecorder` to produce the preview GIF. -- `@example.preview .gif` — the GIF shown alongside the docs. -- `@example.files a.java;b.java;...` — which files from that folder to display as source. -- `@index-in-docs`, `@name-in-docs`, `@ignore-in-docs`, `@scratchblock` — control ordering, display - name, exclusion, and the Scratch-block visual shown for a member. - -When adding or changing a documented public method, add/update the matching folder under -`src/examples/java/reference/` and the Javadoc tags together — the doclet won't generate a page -without both. - -## Common Development Patterns - -### Application Entry Point -```java -import org.openpatch.scratch.Window; - -public class MyWindow extends Window { - public MyWindow() { - super(800, 600, "assets"); - this.setStage(new MyStage()); - } - - public static void main(String[] args) { - new MyWindow(); - } -} -``` - -### Basic Sprite Implementation -```java -import org.openpatch.scratch.Sprite; - -public class MySprite extends Sprite { - public MySprite() { - this.setCostume("name", "path/to/image.png"); - this.setPosition(100, 100); - } - - public void run() { - // Called every frame - this.ifOnEdgeBounce(); - this.move(5); - } -} -``` - -### Stage with Event Handlers -```java -import org.openpatch.scratch.Stage; - -public class MyStage extends Stage { - public MyStage() { - this.add(new MySprite()); - this.setWhenKeyPressed((stage, keyCode) -> { - // Handle key press events - }); - } -} -``` +Releases are changeset-driven (see `.changeset/README.md`): -## Working with This Repository +1. Add a Markdown file to `.changeset/` with frontmatter `type: patch|minor|major` and a description + of the change, as part of the PR. **Only when the change reaches the user**: the public API moved, + or a bug is gone. Documentation, tests, examples, tooling and CI changes get no changeset — they + would put a release note in front of readers about something they cannot see from the library. +2. Merging to `main` triggers `.github/workflows/version.yml`, which bumps the version of every module + (`mvn versions:set`, all poms in lockstep) and opens a version-bump PR (updates `CHANGELOG.md` too). +3. Merging that PR triggers `.github/workflows/release.yml`, which publishes to Maven Central and + creates a GitHub release with the fat jars (`-all`, `-nrw-all`) and Javadocs. -Focus on: -1. Understanding the core Sprite/Stage/Window architecture -2. Using the reference examples in `src/examples/java/reference/` and demos in `src/examples/java/demos/` as patterns -3. Keeping new capabilities in their own `extensions/` sub-package rather than expanding `Sprite.java`/`Stage.java` -4. Adding/updating the matching `src/examples/java/reference//` folder and Javadoc tags whenever a public, documented API changes -5. Testing documentation builds with `npx hyperbook dev` in `docs/` if editing documentation content +Don't hand-edit the version in the poms — it's managed by that workflow. diff --git a/.github/workflows/macos-spike.yml b/.github/workflows/macos-spike.yml new file mode 100644 index 00000000..14e8f14f --- /dev/null +++ b/.github/workflows/macos-spike.yml @@ -0,0 +1,82 @@ +name: macOS spike (gate G1) + +# The LWJGL spike on macOS: do the two macOS launch routes open a window, keep main +# free and run the game loop? Started by hand; its captures and logs are the +# evidence. A runner without OpenGL makes the run inconclusive, not a failure +# of the routes: then a real Mac decides. +on: + workflow_dispatch: + +jobs: + spike: + strategy: + fail-fast: false + matrix: + os: [macos-latest, macos-15-intel] + runs-on: ${{ matrix.os }} + timeout-minutes: 15 + defaults: + run: + working-directory: spikes/lwjgl + + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 25 + cache: maven + + - name: Build the spike + run: mvn -q compile dependency:build-classpath -Dmdep.outputFile=target/cp.txt + + - name: System + run: | + sw_vers + uname -m + system_profiler SPDisplaysDataType || true + + # macOS has no timeout(1); perl's alarm ends a run that hangs + - name: Route 1 - plain java, glfw_async, no -XstartOnFirstThread + run: | + perl -e 'alarm 60; exec @ARGV' java --enable-native-access=ALL-UNNAMED -cp "target/classes:$(cat target/cp.txt)" \ + -Dspike.exitAfter=5 -Dspike.capture=target/route1.png spike.GameLoopCheck 2>&1 | tee target/route1.log + grep -q "main: returns" target/route1.log + grep -q "window: closed" target/route1.log + + - name: Route 2 - Launcher with -XstartOnFirstThread (gate G1) + if: always() + run: | + perl -e 'alarm 60; exec @ARGV' java -XstartOnFirstThread --enable-native-access=ALL-UNNAMED -cp "target/classes:$(cat target/cp.txt)" \ + -Dspike.exitAfter=5 -Dspike.capture=target/route2.png spike.Launcher spike.GameLoopCheck 2>&1 | tee target/route2.log + grep -q "window: runs on thread 'main'" target/route2.log + grep -q "window: closed" target/route2.log + + - name: Route 2 with learner code that never returns (watchdog, close) + if: always() + run: | + perl -e 'alarm 60; exec @ARGV' java -XstartOnFirstThread --enable-native-access=ALL-UNNAMED -cp "target/classes:$(cat target/cp.txt)" \ + -Dspike.exitAfter=5 -Dspike.hangAt=60 spike.Launcher spike.GameLoopCheck 2>&1 | tee target/route2-hang.log + grep -q "has not returned for 2 seconds" target/route2-hang.log + grep -q "did not answer, skipped" target/route2-hang.log + + - name: Original spike window through glfw_async + if: always() + run: | + perl -e 'alarm 60; exec @ARGV' java --enable-native-access=ALL-UNNAMED -cp "target/classes:$(cat target/cp.txt)" \ + -Dspike.exitAfter=4 -Dspike.capture=target/spike.png spike.Main 2>&1 | tee target/spike.log + + - name: Audio (a runner usually has no output device; then exactly one warning) + if: always() + run: | + perl -e 'alarm 60; exec @ARGV' java --enable-native-access=ALL-UNNAMED -cp "target/classes:$(cat target/cp.txt)" \ + spike.AudioCheck 2>&1 | tee target/audio.log + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: macos-spike-${{ matrix.os }} + path: | + spikes/lwjgl/target/*.png + spikes/lwjgl/target/*.log diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad959485..790628c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,16 +79,16 @@ jobs: - name: Build NRW jar # The NRW build returns the List of the NRW Zentralabitur from find, # getAll and getTouchingSprites. It is only offered as a download, and - # the next step cleans target/, so the jars are put aside first. + # the next step cleans the build, so the jar is put aside first. run: | - mvn -B clean package -Pall,nrw + mvn -B clean package -Pnrw -DskipTests mkdir -p dist - cp target/*-nrw-all.jar target/*-nrw-sources.jar dist/ + cp all/target/*-nrw-all.jar dist/ - - name: Build fat jar - # Tests already ran as part of the deploy step above; skip them here - # to avoid paying for the full suite twice in the same job. - run: mvn -B clean package -Pall -DskipTests + - name: Build fat jar, sources and Javadoc + # Tests already ran as part of the deploy step above. The central + # profile adds the sources and Javadoc jars; nothing is signed here. + run: mvn -B clean package -Pcentral -Dgpg.skip=true -DskipTests - name: Require current catalogs and assemble offline examples run: | @@ -134,7 +134,8 @@ jobs: name: v${{ env.VERSION }} body_path: ${{ runner.temp }}/release-notes.md files: | - target/*.jar + all/target/scratch-*-all.jar + core/target/scratch-*.jar dist/*.jar dist/*.zip diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 883d5a4f..dd777e78 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,7 @@ on: push: branches: - main + - v7 jobs: test: @@ -29,7 +30,10 @@ jobs: cache: maven - name: Run tests - run: mvn -B test + run: mvn -B verify + # The online IDE gets its 7.0 branch in Phase 8; until then the + # 7.0 library cannot be checked against it. - name: Check browser compatibility and generated references + if: github.ref_name != 'v7' && github.head_ref != 'v7' uses: ./.github/actions/check-browser diff --git a/.github/workflows/visual.yml b/.github/workflows/visual.yml index 171d8a16..de39a94d 100644 --- a/.github/workflows/visual.yml +++ b/.github/workflows/visual.yml @@ -5,11 +5,11 @@ name: Visual # longer, and can fail for a reason the tests never can: a different machine # drawing the same thing slightly differently. # -# The recorded frames in src/test/resources/parity/frames are pixel-for-pixel. +# The recorded frames in examples/src/test/resources/parity/frames are pixel-for-pixel. # Two runs on one machine are bit-identical, but two different machines are only # identical if they rasterise the same way, and the runner is not the machine the # frames were recorded on. If this job fails on something nobody changed, take -# the drawn-frames artifact below, put it in src/test/resources/parity/frames, +# the drawn-frames artifact below, put it in examples/src/test/resources/parity/frames, # and commit that: the runner then becomes what the frames are recorded against. on: diff --git a/.gitignore b/.gitignore index 2b30992c..73d76311 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,8 @@ natives # Ignore Gradle build output directory build +# but not the modules' build scripts (BuildChecks, NrwVariant) +!**/src/build/ ### Maven ### target/ @@ -33,3 +35,6 @@ dependency-reduced-pom.xml buildNumber.properties .mvn/timing.properties .mvn/wrapper/maven-wrapper.jar + +# Python bytecode +__pycache__/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..81e9bdb4 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,158 @@ +# AGENTS.md + +Guidance for coding agents (and people) working in this repository. + +## 7.0 rewrite (branch `v7`) — read this first + +7.0 replaces Processing with LWJGL and moves the extensions into jars of their own. Where they +exist, `plan.md` (specification and decision log) and `v7-execution.md` (requirements, evidence, +log) are local working notes and are not committed. 7.0 breaks 6.x on purpose wherever the design needs it +(`docs/book/migrate-to-7.md` lists every change). The 6.x sources are on `main` and in the +history; everything in them has been ported. + +## What this is + +Scratch for Java (`org.openpatch.scratch`) is a Java library that ports the Scratch (scratch.mit.edu) +block-based programming model to Java, so learners can move from blocks to text-based code while +keeping the same mental model (Window / Stage / Sprite, costumes, backdrops, broadcasts, etc.). + +## Build & commands + +- **Never `mvn install` on `v7`.** The version is still the released one (6.5.0, managed by the + release workflow), so an install overwrites the real `org.openpatch:scratch:6.5.0` in `~/.m2` + with 7.0 code, and every other project on the machine (Studio) silently builds against it. + Build inside the reactor instead (`-pl -am`). +- `mvn test` — all modules, no window needed. If a test fails with "Unresolved compilation + problems", an IDE (Eclipse compiler) wrote into `target/`: run `mvn clean test`. +- `mvn verify` — additionally builds the fat jar `all/target/scratch--all.jar` and runs + `all/src/build/BuildChecks.java` (no `java.desktop` in shipped code, extensions use no + `internal`, no NRW-sensitive calls or GLFW callbacks in extensions, fat-jar + manifest/natives/notices). +- `mvn package -pl all,examples -am -DskipTests` — the fat jar and the examples, quickly. +- `mvn package -Pnrw` — the NRW fat jar (`scratch--nrw-all.jar`): sources rewritten by + `core/src/build/NrwVariant.java` from the `// nrw:` markers in Stage and Sprite, so `find`, + `getAll` and `getTouchingSprites` return the `List` of the NRW Zentralabitur. +- `mvn deploy -Pcentral` — release to Maven Central; done by the release workflow, not by hand. +- `./scripts/run.sh` — pick a demo or reference example and run it (`--each` runs every demo, + `-- ` passes JVM arguments); builds in the reactor first. +- `./scripts/benchmark.sh [--quick] [--xvfb] [--with-6x]` — the stress test, collision and + colour checks; appends the results with the commit to `scripts/benchmark/history.csv` + (commit that with the change it measures). `--with-6x` builds `main` in a worktree for comparison. +- `python3 scripts/migrate-7.py --out <6.x folder>` migrates 6.x code, shaders and the + ```java blocks of Markdown pages (run once per project; it marks what needs a person with + `// TODO 7.0:`). +- `./build.sh` — full doc site build (reference pages, demo pages, asset pages, version + substitution, then `npx hyperbook build` in `docs/`); `cd docs && npx hyperbook@latest dev` runs + the site locally (always the newest Hyperbook, as in CI). + +Java 17 builds the library (`maven.compiler.release`), but the tests want Java 25: the +documentation's interactive examples are compact source files (`void main()` beside the classes), +and the tests that compile them skip on anything older. CI runs 25. + +## Seeing and testing without a window + +- Scene logic is tested headless: `Game.headless(480, 360)`, `game.setStage(stage)`, + `game.runTicks(n)`, `game.drawList()` (see `core/src/test/.../SceneTest.java`). Sprites, + costumes, hitboxes, clones, pens, colour sensing (`Pixels.of(stage)`), text layout, timers and + transitions all work there. +- To see a frame: run a program with `-Dscratch4j.preview=` (writes `frame.png` and the + sprites in `stage.json`, then ends). `-Dscratch4j.capture=` does the same per stage while the + program keeps running (Studio uses it for its stage designer). +- Under Xvfb in a Wayland session: `XDG_SESSION_TYPE=x11 xvfb-run -a java -Dscratch4j.platform=x11 …` + (GLFW picks Wayland otherwise). Under Xvfb the window is exactly the render size, so letterbox + and HiDPI bugs do not reproduce there. `-Dscratch4j.debugGl` prints window, framebuffer, monitor + and letterbox geometry and vsync switches. +- Reference examples load their assets relative to `examples/src/main/java/reference`: run them + from there (`run.sh` does). +- Parity: `ParityTest` and `LifecycleParityTest` (core, headless; `./scripts/parity.sh --record`), + `./scripts/visual-parity.sh [--record]` (23 frames under Xvfb, compared exactly). +- Documentation guards in the examples module: `DocumentationSnippetsTest` compiles every + ```java block on the hand-written pages under `docs/book` — **if you change a public API, this + tells you which tutorial you just broke**; `DemoPagesTest` checks that `docs/book/examples/*.md` + match the demos they are generated from (a page opts in with `` above its + `:::onlineide` block). **After changing a demo, run `./scripts/update-demo-pages.sh`** and commit + the pages it touches (it also copies the demos' assets to `docs/public/examples`, ignored). + `OnlineExampleTest` compiles the interactive examples. + +## Source layout + +``` +pom.xml parent (scratch-parent); modules in lockstep, one version +core/ artifact `scratch` + src/main/java/org/openpatch/scratch/ + Window, Stage, Sprite, Text, Pen, Camera, Layer, Shader(s), Transition, Pixels, Timer, + Color, Vector2, shapes, Operators, KeyCode, ... the learner API, one flat package + Launcher macOS: window on the first thread (-XstartOnFirstThread) + extension/ public extension API (Extension, ExtensionContext, Canvas) + internal/ not exported: Game, loop/ (game thread, tick clock), draw/ (draw list), + render/ (OpenGL), window/ (GLFW), canvas/ + compose/ (CPU pen canvases, + compositor for colour sensing), text/ (stb_truetype engine), audio/ + (OpenAL), image/ (stb_image), geom/, input/, Assets, Preview, Release + src/build/NrwVariant.java +extensions/{tiled,save,recorder,drawing}/ `scratch-`, package org.openpatch.scratch., + public API only, registered through ServiceLoader +all/ fat jar + src/build/BuildChecks.java +examples/ demos/ (runnable projects), reference/ (one example per documented + method), parity/; src/tools/java (doclet, docs.GenerateDemoPages, + docs.GenerateAssetPages); built, never published +templates/extension-starter/ standalone Maven project for third-party extensions +docs/ Hyperbook site (English) +``` + +## Architecture + +Three concepts mirror Scratch directly and almost every feature hangs off one of them: + +- **Window** — the singleton window (`new Window(480, 360)`, then `setStage(...)`). Settings + that must be known before it opens are static and called first (`usePixelArt()`, + `useFullScreen()`, ...). +- **Stage** — one scene: sprites, texts, pens, backdrops, the `when*` event handlers. +- **Sprite** — costumes, animations, movement, collision/sensing, sound, and a `run()` method + called every tick (a Scratch script attached to a sprite). + +Threads: a **window thread** owns GLFW and OpenGL, a **game thread** runs +every tick and all learner callbacks, the learner's `main` runs on its own thread. They work in +lockstep: a tick is exactly 1/60 s of game time; at the end of a batch of ticks the game thread +builds a **draw list**, and that is all the renderer sees — the scene never draws itself. +Everything learners can observe (collisions, colour sensing through the CPU compositor, text +layout) is computed on the CPU and is the same on every GPU and in headless tests. + +Extensions build on the public extension API only (`ExtensionContext` hooks: `beforeTick`, +layer and overlay drawers on a `Canvas`, `afterFrame`, `dispatch` to listener interfaces, +attachments via `stage.extension(...)`), never on `internal`, and register themselves through +`ServiceLoader`. New capabilities go into an extension if they can be built that way and pull in +a dependency (Jackson); things that need the renderer or the game loop stay in the core. + +No `java.awt`/`java.desktop` in shipped code (BuildChecks enforces it); tests and build tools may +use it. Jackson (`tools.jackson.*`) is used by tiled and save. + +## Javadoc → documentation pipeline + +The public API's Javadoc is the source of truth for the reference documentation on +https://scratch4j.openpatch.org. `./scripts/reference-docs.sh` runs the doclet +(`examples/src/tools/java/doclets`) over core and the extensions and writes +`docs/book/reference`: + +- `@example.files a.java;b.java` — files from `examples/src/main/java/reference` shown as source + (`@example.folder ` for a folder of them). +- `@scratchblock`, `@index-in-docs`, `@name-in-docs`, `@ignore-in-docs` — the Scratch block shown, + ordering, display name, exclusion. + +When adding or changing a public method that should be documented, add/update its reference +example and the tags on the Javadoc comment. Other generators: `docs.GenerateDemoPages --write` +(example pages from the demos) and `docs.GenerateAssetPages` (built-in sprites and sounds). + +## Versioning & release flow + +Releases are changeset-driven (see `.changeset/README.md`): + +1. Add a Markdown file to `.changeset/` with frontmatter `type: patch|minor|major` and a description + of the change, as part of the PR. **Only when the change reaches the user**: the public API moved, + or a bug is gone. Documentation, tests, examples, tooling and CI changes get no changeset — they + would put a release note in front of readers about something they cannot see from the library. +2. Merging to `main` triggers `.github/workflows/version.yml`, which bumps the version of every module + (`mvn versions:set`, all poms in lockstep) and opens a version-bump PR (updates `CHANGELOG.md` too). +3. Merging that PR triggers `.github/workflows/release.yml`, which publishes to Maven Central and + creates a GitHub release with the fat jars (`-all`, `-nrw-all`) and Javadocs. + +Don't hand-edit the version in the poms — it's managed by that workflow. diff --git a/CLAUDE.md b/CLAUDE.md index 6b44a007..43c994c2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,145 +1 @@ -# CLAUDE.md - -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. - -## What this is - -Scratch for Java (`org.openpatch.scratch`) is a Java library that ports the Scratch (scratch.mit.edu) -block-based programming model to Java, so learners can move from blocks to text-based code while -keeping the same mental model (Window / Stage / Sprite, costumes, backdrops, broadcasts, etc.). - -## Build & release commands - -- `mvn compile` — compile the library (this is the command referenced in the README for day-to-day dev) -- `mvn test` — run the JUnit 5 test suite (152 tests) -- `mvn clean package` — build the JAR -- `mvn clean package -Pall` — build a standalone JAR with all dependencies shaded in (maven-shade-plugin) -- `mvn clean package -Pall,nrw` — build the NRW Abitur version (`target/scratch--nrw-all.jar`), in which `find`, `getAll` and `getTouchingSprites` return the `List` of the NRW Zentralabitur. The sources are rewritten from the `// nrw-standard-begin` / `// nrw:` markers in `Stage.java` and `Sprite.java` by `src/tools/java/variants/NrwVariant.java`; tests, examples and docs are skipped in that build -- `mvn deploy -Pcentral` — release to Maven Central (GPG signing + central-publishing-maven-plugin); not something to run casually -- `./build.sh` — full doc site build: copies CHANGELOG into the docs book, regenerates reference GIFs from `src/examples/java/reference`, substitutes the version into docs, then runs `npx hyperbook build` inside `docs/` -- `cd docs && npx hyperbook@latest dev` — run the documentation site locally. The docs always use - the newest Hyperbook (CI installs `hyperbook@latest`), so there is no version to update - -Tests live in `src/test/java` and run under JUnit 5. They cover the parts that can be checked -without a window — geometry, operators, colours, the built-in asset registry — plus one that guards -the documentation: - -- `DocumentationSnippetsTest` pulls every ```java block out of the hand-written pages under - `docs/book` and compiles them, a page at a time. **If you change a public API, this is what tells - you which tutorial you just broke.** Two examples had rotted unnoticed before it existed. -- `DemoPagesTest` checks that the interactive examples on `docs/book/examples/*.md` still match - the demos under `src/examples/java/demos` they are generated from. A page opts in with - `` above its `:::onlineide` block; everything inside that block is - generated. **After changing a demo, run `./scripts/update-demo-pages.sh`** and commit the pages - it touches. The demos' assets are copied to `docs/public/examples` (ignored, not committed) - by the same script and by `mvn prepare-package`. - -Sprites load costumes without a window (`Image.loadWithoutWindow`), so sizes, costume switching, -hitboxes and clones can be unit-tested (`HeadlessCostumeTest`, `SpriteCloneTest`); the game clock -behind pause and game speed is `internal/GameClock` (`GameClockTest`). A `Stage` still needs a -live `Window` (its buffers are OpenGL), so verifying drawing, input or anything on a stage still -means running something: the affected reference/demo example under `src/examples/java`, or -`./scripts/run.sh` to pick one. - -The window comes first: `new Window(480, 360)`, then `setStage(new MyStage())`; a stage built -without a window throws. To see what a stage draws without watching it, run it with -`-Dscratch4j.preview=` (see `internal/Preview`): the first frame lands in -`/frame.png`, its sprites in `/stage.json`, and the program ends. -`-Dscratch4j.capture=` takes the same picture of each stage while the program keeps -running; Studio passes it on every run and shows the result in its stage designer. - -Running a windowed example headlessly works with `xvfb-run -a java ...`, which is how the -documentation GIFs are recorded. Note that under Xvfb the window is exactly the render size, so -letterbox bars never appear — a bug that only shows on a scaled or HiDPI display will not reproduce -there. - -Java 17 is required to build the library (`maven.compiler.release` in `pom.xml`), but the tests want -Java 25: the documentation's interactive examples are compact source files (`void main()` beside the -classes), and the two tests that compile them — `DocumentationSnippetsTest.everyInteractiveExampleCompiles` -and `OnlineExampleTest` — skip on anything older. CI runs 25 for that reason. - -## Source layout - -``` -src/main/java/org/openpatch/scratch/ - Window.java - singleton application window (one per process) - Stage.java - the active "scene": holds sprites, backdrops, input/event callbacks - Sprite.java - the core interactive object (costumes, movement, collision, sound, ...) - Operators.java - Scratch "Operators" block equivalents (math/string helpers) - KeyCode.java / MouseCode.java / RotationStyle.java - extensions/ - optional add-on capabilities, each its own sub-package: - animation/ camera/ color/ fs/ hitbox/ math/ pen/ recorder/ shader/ shape/ text/ tiled/ timer/ - internal/ - implementation details not part of the public API (Processing/JOGL glue, - image/font/sound loading, GIF encoding, simplex noise, etc.) - -src/examples/java/ - demos/ - complete runnable example projects (one folder per demo) - reference/ - one folder per documented API method/feature, used to generate docs - -src/tools/java/doclets/ - Scratch4JDoclet.java - custom Javadoc doclet that turns annotated Javadoc into the reference docs - -docs/ - Hyperbook-based documentation site (English + German), built via ./build.sh -``` - -`src/examples/java` and `src/tools/java` are wired into the main build via -`build-helper-maven-plugin` (`add-examples-source`), so they compile as part of the project even -though they live outside `src/main`. They are excluded from the packaged JAR/sources JAR -(see the `maven-jar-plugin` / `maven-source-plugin` excludes in `pom.xml`). - -## Architecture - -Three concepts mirror Scratch directly and almost every feature hangs off one of them: - -- **Window** — the top-level, singleton application window (constructed with size/title/asset - path). Owns the render loop and delegates to the current `Stage`. -- **Stage** — one screen/scene of the project. Holds the collection of `Sprite`s, backdrops, and - the `when*` event handlers (key press, mouse click, custom broadcasts, etc.). -- **Sprite** — an interactive object with costumes, position/rotation, movement, collision/sensing, - sound, and a `run()` method invoked every frame (analogous to a Scratch script attached to a sprite). - -Extensions in `extensions/` layer additional behavior onto this model rather than modifying the -core classes — e.g. `AnimatedSprite` (animation) extends `Sprite`, `Recorder`/`GifRecorder` -(recorder) capture stage output, `pen`/`shape`/`text` add drawing primitives, `tiled` adds -Tiled-map support, `hitbox` adds precise collision shapes. When adding a new capability, prefer a -new extension package over growing `Sprite.java`/`Stage.java` further (they are already ~2,000+ -lines each). - -The library is built on **Processing** (`org.processing:core`) for graphics/windowing and JOGL for -OpenGL (via the `central` profile's native dependencies). Jackson (`tools.jackson.*`) is used for -JSON/XML (de)serialization, e.g. in `extensions/fs` and `extensions/tiled`. - -## Javadoc → documentation pipeline - -The public API's Javadoc is the source of truth for the reference documentation on -https://scratch4j.openpatch.org. The custom doclet (`Scratch4JDoclet`) reads special tags on public -methods and emits per-method reference pages: - -- `@example.folder ` — matches a directory under `src/examples/java/reference//` - containing a self-contained `MySprite.java` / `MyStage.java` / `MyWindow.java` example (package - `reference.`). The `MyWindow` typically wraps the example in a `GifRecorder` to produce the - preview GIF. -- `@example.preview .gif` — the GIF (usually generated by the example itself) shown alongside - the docs. -- `@example.files a.java;b.java;...` — which files from that folder to display as source. -- `@index-in-docs`, `@name-in-docs`, `@ignore-in-docs`, `@scratchblock` — control ordering, display - name, exclusion, and the Scratch-block visual shown for a member. - -When adding or changing a public method that should be documented, add/update the matching folder -under `src/examples/java/reference/` and the corresponding tags on the Javadoc comment — the doclet -will not generate a page without both. - -## Versioning & release flow - -Releases are changeset-driven (see `.changeset/README.md`): - -1. Add a Markdown file to `.changeset/` with frontmatter `type: patch|minor|major` and a description - of the change, as part of the PR. **Only when the change reaches the user**: the public API moved, - or a bug is gone. Documentation, tests, examples, tooling and CI changes get no changeset — they - would put a release note in front of readers about something they cannot see from the library. -2. Merging to `main` triggers `.github/workflows/version.yml`, which bumps `pom.xml`'s version and - opens a version-bump PR (updates `CHANGELOG.md` too). -3. Merging that PR triggers `.github/workflows/release.yml`, which publishes to Maven Central and - creates a GitHub release with the shaded ("all") JAR and Javadocs. - -Don't hand-edit the version in `pom.xml` — it's managed by that workflow. +@AGENTS.md diff --git a/README.md b/README.md index 7d0a9ebe..c592dae7 100644 --- a/README.md +++ b/README.md @@ -27,21 +27,26 @@ Browser versions, API availability and synchronization commands are documented i [compatibility/contract.json](compatibility/contract.json). Game progress can be stored with -[`SaveData`](src/main/java/org/openpatch/scratch/extensions/fs/SaveData.java). +[`SaveData`](extensions/save/src/main/java/org/openpatch/scratch/save/SaveData.java). It saves public data fields as JSON in a stable user-data folder; the online IDE uses IndexedDB through the same Java API. Storage and decoding failures raise `IOException`, and missing slots use caller-supplied defaults without writing. -The [Coin Quest demo](src/examples/java/demos/saveSlots/README.md) uses built-in +The [Coin Quest demo](examples/src/main/java/demos/saveSlots/README.md) uses built-in assets and three save slots. Run `demos.saveSlots.SaveSlotGame`, or use its [interactive documentation example](docs/book/examples/save-slots.md). -If you want to work on the library. You need a Java environment and Maven. Then you can use the following command to build -the library. +If you want to work on the library, you need Java 25 and Maven. The library +itself is built for Java 17; the tests compile the documentation's examples, +which need 25. Build and test every module with: ``` -mvn compile +mvn test ``` +`mvn verify` also builds the fat jar `all/target/scratch--all.jar`. +Do not run `mvn install` on a branch: the version in the poms is still the +released one, so an install would overwrite it in your local repository. + You can release the library with the following command: ``` @@ -74,38 +79,26 @@ which are not part of the build, are compiled on the fly. checking that a change to the library has not broken what the documentation teaches. -### With Maven, without building a jar +### With `run.sh` ``` -mvn -q compile exec:exec -Parchive -Darchive=make-it-walk-100 -Dmain=WalkStage +./scripts/run.sh --archives ``` -This compiles the chosen project against the library as it stands in your -working copy and runs it in a fresh JVM. The project sources go to their own -output directory, so they can never end up in a released jar. - -The finished projects and the class to start are: +`run.sh` compiles the chosen project into `examples/target/archive-run` and runs +it against the library as it stands in your working copy. -| `-Darchive=` | `-Dmain=` | -|---|---| -| `getting-started-100` | `MyStage` | -| `make-it-walk-100` | `WalkStage` | -| `catch-the-coins-100` | `CatchStage` | -| `red-light-green-light-100` | `RaceStage` | -| `guess-the-number-100` | `GuessStage` | -| `bouncy-hedgehog-100` | `BouncyHedgehogStage` | - -### With BlueJ or VS Code +### With Studio or VS Code Those need a real jar in each project's `+libs` folder: ``` -mvn package -Pall -DskipTests +mvn package -pl all -am -DskipTests ./scripts/link-jar.sh ``` -The script links the jar it finds in `target/` into every project under -`docs/archives`, so any of them can be opened directly with BlueJ or VS Code. +The script links the fat jar from `all/target/` into every project under +`docs/archives`, so any of them can be opened directly with Studio or VS Code. It symlinks where it can and copies where it cannot, so it works on Windows too. **Those jars are for local testing only.** They are git-ignored, and `build.sh` @@ -140,6 +133,8 @@ We are [happy to hear from you](mailto:contact@openpatch.org), if you need custo Scratch for Java is maintained by [OpenPatch](https://openpatch.org), an organization for educational assessments and training. If you need help [get in touch](mailto:contact@openpatch.org). +Scratch for Java is an independent project and is not affiliated with or endorsed by the Scratch Foundation or the Scratch Team. + ## Special Thanks The Scratch for Java library is profiled using [Java Profiler](https://www.ej-technologies.com/products/jprofiler/overview.html) diff --git a/all/.project b/all/.project new file mode 100644 index 00000000..aeb2348f --- /dev/null +++ b/all/.project @@ -0,0 +1,34 @@ + + + scratch-all + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1792662947243 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/all/pom.xml b/all/pom.xml new file mode 100644 index 00000000..06399428 --- /dev/null +++ b/all/pom.xml @@ -0,0 +1,143 @@ + + 4.0.0 + + + org.openpatch + scratch-parent + 6.5.0 + + + + scratch-all + jar + Scratch for Java (fat jar) + + + + org.openpatch + scratch + + + org.openpatch + scratch-tiled + ${project.version} + + + org.openpatch + scratch-save + ${project.version} + + + org.openpatch + scratch-recorder + ${project.version} + + + org.openpatch + scratch-drawing + ${project.version} + + + org.openpatch + scratch-gamepad + ${project.version} + + + + + scratch-${project.version}-all.jar + + + + + nrw + + scratch-${project.version}-nrw-all.jar + + + + + + scratch-all-${project.version} + + + org.apache.maven.plugins + maven-shade-plugin + + + package + + shade + + + false + + ${project.build.directory}/${scratch.fatJar} + + + *:* + + + **/module-info.class + META-INF/INDEX.LIST + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + META-INF/maven/** + + META-INF/LICENSE* + META-INF/NOTICE* + + + + + + + + + + true + ALL-UNNAMED + Scratch for Java + ${project.version} + + + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + build-checks + verify + + exec + + + ${java.home}/bin/java + + ${project.basedir}/src/build/BuildChecks.java + ${maven.multiModuleProjectDirectory} + ${project.build.directory}/${scratch.fatJar} + + + + + + + + diff --git a/all/src/build/BuildChecks.java b/all/src/build/BuildChecks.java new file mode 100644 index 00000000..241cc848 --- /dev/null +++ b/all/src/build/BuildChecks.java @@ -0,0 +1,196 @@ +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.jar.JarFile; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.spi.ToolProvider; +import java.util.stream.Stream; + +/** + * The build's rules for 7.0, run by all/pom.xml in `verify`: + * + *
java all/src/build/BuildChecks.java <repository root> <fat jar>
+ * + * Exits with 1 and one line per broken rule. + */ +public class BuildChecks { + + static final String[] EXTENSIONS = {"tiled", "save", "recorder", "drawing", "gamepad"}; + static final String[] PLATFORMS = {"linux/x64", "linux/arm64", "macos/x64", "macos/arm64", "windows/x64", + "windows/arm64"}; + /** Native libraries per platform, relative to org/lwjgl/: core, then one folder per module. */ + static final String[] NATIVE_FOLDERS = {"", "glfw/", "opengl/", "openal/", "stb/", "tinyfd/"}; + /** What 7.0 replaced; none of it may come back through a dependency. */ + static final String[] GONE = {"processing/", "com/jogamp/", "jogamp/", "kotlin/", "com/github/davidmoten/", + "javazoom/", "org/tritonus/", "com/jcraft/"}; + + static final List problems = new ArrayList<>(); + + public static void main(String[] args) throws IOException { + Path root = Path.of(args[0]); + Path fatJar = Path.of(args[1]); + List shipped = new ArrayList<>(List.of(root.resolve("core/target/classes"))); + for (String e : EXTENSIONS) { + shipped.add(root.resolve("extensions/" + e + "/target/classes")); + } + for (Path classes : shipped) { + noJavaDesktop(classes); + } + for (String e : EXTENSIONS) { + Path classes = root.resolve("extensions/" + e + "/target/classes"); + noInternalImports(classes, e); + noForbiddenCalls(classes, e); + } + fatJar(fatJar); + if (problems.isEmpty()) { + System.out.println("build checks: all rules hold"); + } else { + problems.forEach(p -> System.err.println("build checks: " + p)); + System.exit(1); + } + } + + /** The core and the first-party extensions run without java.desktop (decision log). */ + static void noJavaDesktop(Path classes) throws IOException { + // a module may only use what it requires (javac sees to that), so its descriptor says it all + Path descriptor = classes.resolve("module-info.class"); + if (Files.exists(descriptor)) { + String module = run("javap", descriptor.toString()); + if (module.contains("java.desktop")) { + problems.add(classes + ": module-info requires java.desktop:\n" + module); + } + } + // and the classes themselves; jdeps would try to resolve the descriptor's modules, so it + // looks at a copy without it + Path copy = Files.createTempDirectory("buildchecks"); + try (var files = Files.walk(classes)) { + for (Path f : (Iterable) files::iterator) { + if (Files.isRegularFile(f) && f.toString().endsWith(".class") && !f.equals(descriptor)) { + Path target = copy.resolve(classes.relativize(f).toString()); + Files.createDirectories(target.getParent()); + Files.copy(f, target); + } + } + } + try { + String out = run("jdeps", "--list-deps", "--ignore-missing-deps", "--multi-release", "25", copy.toString()); + if (out.contains("java.desktop")) { + problems.add(classes + " uses java.desktop:\n" + out); + } + } finally { + try (var made = Files.walk(copy)) { + for (Path f : made.sorted(java.util.Comparator.reverseOrder()).toList()) { + Files.delete(f); + } + } + } + } + + /** Extensions use only public API: nothing from org.openpatch.scratch.internal. */ + static void noInternalImports(Path classes, String extension) throws IOException { + for (Path c : classFiles(classes)) { + // class names and descriptors sit in the constant pool as plain UTF-8 + String pool = new String(Files.readAllBytes(c), StandardCharsets.ISO_8859_1); + if (pool.contains("org/openpatch/scratch/internal/")) { + problems.add("extension " + extension + ": " + classes.relativize(c) + + " uses org.openpatch.scratch.internal"); + } + } + } + + /** + * NRW: find, getAll and getTouchingSprites return another type in the NRW jar, so a call + * compiled against the standard jar fails there. GLFW: extensions may poll, never set + * callbacks, which would replace the core's. + */ + static void noForbiddenCalls(Path classes, String extension) throws IOException { + Pattern nrw = Pattern.compile("Method org/openpatch/scratch/(Stage|Sprite)\\.(find|getAll|getTouchingSprites):"); + Pattern callback = Pattern.compile("Method org/lwjgl/glfw/GLFW\\.(glfwSet\\w+Callback)"); + for (Path c : classFiles(classes)) { + String code = run("javap", "-c", "-p", c.toString()); + Matcher m = nrw.matcher(code); + if (m.find()) { + problems.add("extension " + extension + ": " + classes.relativize(c) + " calls " + m.group(1) + "." + + m.group(2) + ", whose type differs in the NRW jar"); + } + m = callback.matcher(code); + if (m.find()) { + problems.add("extension " + extension + ": " + classes.relativize(c) + " sets a GLFW callback (" + + m.group(1) + "); extensions may only poll"); + } + } + } + + static void fatJar(Path path) throws IOException { + if (!Files.exists(path)) { + problems.add("no fat jar at " + path); + return; + } + try (JarFile jar = new JarFile(path.toFile())) { + var attributes = jar.getManifest().getMainAttributes(); + // LWJGL's FFM memory backend is in META-INF/versions/25 + if (!"true".equals(attributes.getValue("Multi-Release"))) { + problems.add("fat jar: the manifest lacks Multi-Release: true"); + } + if (!"ALL-UNNAMED".equals(attributes.getValue("Enable-Native-Access"))) { + problems.add("fat jar: the manifest lacks Enable-Native-Access: ALL-UNNAMED"); + } + List names = jar.stream().map(e -> e.getName()).toList(); + names.stream().filter(n -> n.endsWith("module-info.class")) + .forEach(n -> problems.add("fat jar: " + n + " would make the jar claim to be that module")); + for (String gone : GONE) { + if (names.stream().anyMatch(n -> n.startsWith(gone))) { + problems.add("fat jar: still contains " + gone); + } + } + if (jar.getEntry("THIRD-PARTY-NOTICES.txt") == null) { + problems.add("fat jar: THIRD-PARTY-NOTICES.txt is missing"); + } + var services = jar.getEntry("META-INF/services/org.openpatch.scratch.extension.Extension"); + String registered = services == null ? "" : new String(jar.getInputStream(services).readAllBytes(), + StandardCharsets.UTF_8); + for (String e : EXTENSIONS) { + if (!registered.contains("org.openpatch.scratch." + e + ".")) { + problems.add("fat jar: extension " + e + " is not registered in META-INF/services"); + } + } + for (String platform : PLATFORMS) { + for (String folder : NATIVE_FOLDERS) { + String prefix = platform + "/org/lwjgl/" + folder; + boolean found = names.stream().anyMatch(n -> n.startsWith(prefix) + && n.indexOf('/', prefix.length()) < 0 && n.matches(".*\\.(so|dylib|dll)")); + if (!found) { + problems.add("fat jar: no native library in " + prefix); + } + } + } + } + } + + static List classFiles(Path classes) throws IOException { + if (!Files.isDirectory(classes)) { + problems.add(classes + " does not exist"); + return List.of(); + } + try (Stream files = Files.walk(classes)) { + return files.filter(f -> f.toString().endsWith(".class")).toList(); + } + } + + static String run(String tool, String... args) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try (PrintStream print = new PrintStream(out, true, StandardCharsets.UTF_8)) { + int code = ToolProvider.findFirst(tool).orElseThrow().run(print, print, args); + if (code != 0) { + problems.add(tool + " " + String.join(" ", args) + " failed:\n" + out.toString(StandardCharsets.UTF_8)); + } + } + return out.toString(StandardCharsets.UTF_8); + } +} diff --git a/all/src/main/resources/THIRD-PARTY-NOTICES.txt b/all/src/main/resources/THIRD-PARTY-NOTICES.txt new file mode 100644 index 00000000..9457de64 --- /dev/null +++ b/all/src/main/resources/THIRD-PARTY-NOTICES.txt @@ -0,0 +1,1037 @@ +Scratch for Java - third-party notices + +Scratch for Java itself is MIT licensed (LICENSE.md in its repository). This jar also contains the +software and assets listed below, each under its own licence. The full texts follow the list. + + Component Licence Where + --------------------------------- -------------------------- ------------------------------------- + LWJGL 3 (core, GLFW, OpenGL, BSD 3-Clause org/lwjgl/**, natives per platform + OpenAL, stb, tinyfd bindings) + GLFW zlib/libpng //org/lwjgl/glfw/* + OpenAL Soft GNU LGPL 2.1 or later //org/lwjgl/openal/* + stb (stb_image, stb_image_write, MIT (or public domain) //org/lwjgl/stb/* + stb_truetype, stb_vorbis) + tinyfiledialogs zlib //org/lwjgl/tinyfd/* + Jackson (core, databind, Apache 2.0 tools/jackson/**, com/fasterxml/** + annotations, dataformat-xml) + Woodstox (with MSV, shaded by it) Apache 2.0 (MSV: BSD) com/ctc/wstx/** + Stax2 API BSD 2-Clause org/codehaus/stax2/** + Ubuntu Mono font Ubuntu Font Licence 1.0 UbuntuMono-Regular.ttf + Jersey 10 font SIL Open Font Licence 1.1 Jersey10-Regular.ttf + Built-in images and sounds CC0 (Kenney, kenney.nl) images/**, sounds/** + +OpenAL Soft is a separate shared library that Scratch for Java loads at run time; it is not linked +into Scratch for Java's code and can be replaced with another build of OpenAL Soft (LWJGL looks for +it as described at https://www.lwjgl.org/guide). Its source code, in the version shipped here +(commit 7f9c6de1162b1d4604b9a2f8bcd6c53021566221), is available at +https://github.com/kcat/openal-soft. The binaries are those LWJGL 3.4.3 distributes. + +================================================================================================ + +LWJGL - Lightweight Java Game Library 3 +Copyright (c) 2012-present Lightweight Java Game Library. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, this list of + conditions and the following disclaimer in the documentation and/or other materials provided + with the distribution. +- Neither the name of the copyright holder nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +================================================================================================ + +GLFW +Copyright (c) 2002-2006 Marcus Geelnard +Copyright (c) 2006-2019 Camilla Löwy + +This software is provided 'as-is', without any express or implied warranty. In no event will +the authors be held liable for any damages arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, including commercial +applications, and to alter it and redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the + original software. If you use this software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as + being the original software. +3. This notice may not be removed or altered from any source distribution. + +================================================================================================ + +tinyfiledialogs +Copyright (c) 2014 - 2024 Guillaume Vareille http://ysengrin.com + +This software is provided 'as-is', without any express or implied warranty. In no event will +the authors be held liable for any damages arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, including commercial +applications, and to alter it and redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the + original software. If you use this software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as + being the original software. +3. This notice may not be removed or altered from any source distribution. + +================================================================================================ + +stb +Copyright (c) 2017 Sean Barrett + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +================================================================================================ + +Stax2 API +Copyright (c) 2008- FasterXML.com + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of + conditions and the following disclaimer in the documentation and/or other materials provided + with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +================================================================================================ + +MSV (shaded in Woodstox) +Copyright (c) 2001-2013 Oracle and/or its affiliates. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, this list of + conditions and the following disclaimer in the documentation and/or other materials provided + with the distribution. +- Neither the name of the copyright holder nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +================================================================================================ + +Jackson, Woodstox: Apache License 2.0 + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +================================================================================================ + +OpenAL Soft: GNU Lesser General Public License 2.1 + +GNU LESSER GENERAL PUBLIC LICENSE + +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. + +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts as the +successor of the GNU Library Public License, version 2, hence the version +number 2.1.] + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public Licenses are intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. + +This license, the Lesser General Public License, applies to some specially +designated software packages--typically libraries--of the Free Software Foundation +and other authors who decide to use it. You can use it too, but we suggest +you first think carefully about whether this license or the ordinary General +Public License is the better strategy to use in any particular case, based +on the explanations below. + +When we speak of free software, we are referring to freedom of use, not price. +Our General Public Licenses are designed to make sure that you have the freedom +to distribute copies of free software (and charge for this service if you +wish); that you receive source code or can get it if you want it; that you +can change the software and use pieces of it in new free programs; and that +you are informed that you can do these things. + +To protect your rights, we need to make restrictions that forbid distributors +to deny you these rights or to ask you to surrender these rights. These restrictions +translate to certain responsibilities for you if you distribute copies of +the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for +a fee, you must give the recipients all the rights that we gave you. You must +make sure that they, too, receive or can get the source code. If you link +other code with the library, you must provide complete object files to the +recipients, so that they can relink them with the library after making changes +to the library and recompiling it. And you must show them these terms so they +know their rights. + +We protect your rights with a two-step method: (1) we copyright the library, +and (2) we offer you this license, which gives you legal permission to copy, +distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that there is no +warranty for the free library. Also, if the library is modified by someone +else and passed on, the recipients should know that what they have is not +the original version, so that the original author's reputation will not be +affected by problems that might be introduced by others. + +Finally, software patents pose a constant threat to the existence of any free +program. We wish to make sure that a company cannot effectively restrict the +users of a free program by obtaining a restrictive license from a patent holder. +Therefore, we insist that any patent license obtained for a version of the +library must be consistent with the full freedom of use specified in this +license. + +Most GNU software, including some libraries, is covered by the ordinary GNU +General Public License. This license, the GNU Lesser General Public License, +applies to certain designated libraries, and is quite different from the ordinary +General Public License. We use this license for certain libraries in order +to permit linking those libraries into non-free programs. + +When a program is linked with a library, whether statically or using a shared +library, the combination of the two is legally speaking a combined work, a +derivative of the original library. The ordinary General Public License therefore +permits such linking only if the entire combination fits its criteria of freedom. +The Lesser General Public License permits more lax criteria for linking other +code with the library. + +We call this license the "Lesser" General Public License because it does Less +to protect the user's freedom than the ordinary General Public License. It +also provides other free software developers Less of an advantage over competing +non-free programs. These disadvantages are the reason we use the ordinary +General Public License for many libraries. However, the Lesser license provides +advantages in certain special circumstances. + +For example, on rare occasions, there may be a special need to encourage the +widest possible use of a certain library, so that it becomes a de-facto standard. +To achieve this, non-free programs must be allowed to use the library. A more +frequent case is that a free library does the same job as widely used non-free +libraries. In this case, there is little to gain by limiting the free library +to free software only, so we use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free programs +enables a greater number of people to use a large body of free software. For +example, permission to use the GNU C Library in non-free programs enables +many more people to use the whole GNU operating system, as well as its variant, +the GNU/Linux operating system. + +Although the Lesser General Public License is Less protective of the users' +freedom, it does ensure that the user of a program that is linked with the +Library has the freedom and the wherewithal to run that program using a modified +version of the Library. + +The precise terms and conditions for copying, distribution and modification +follow. Pay close attention to the difference between a "work based on the +library" and a "work that uses the library". The former contains code derived +from the library, whereas the latter must be combined with the library in +order to run. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License Agreement applies to any software library or other program +which contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Lesser General +Public License (also called "this License"). Each licensee is addressed as +"you". + +A "library" means a collection of software functions and/or data prepared +so as to be conveniently linked with application programs (which use some +of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has +been distributed under these terms. A "work based on the Library" means either +the Library or any derivative work under copyright law: that is to say, a +work containing the Library or a portion of it, either verbatim or with modifications +and/or translated straightforwardly into another language. (Hereinafter, translation +is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications +to it. For a library, complete source code means all the source code for all +modules it contains, plus any associated interface definition files, plus +the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered +by this License; they are outside its scope. The act of running a program +using the Library is not restricted, and output from such a program is covered +only if its contents constitute a work based on the Library (independent of +the use of the Library in a tool for writing it). Whether that is true depends +on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and disclaimer +of warranty; keep intact all the notices that refer to this License and to +the absence of any warranty; and distribute a copy of this License along with +the Library. + +You may charge a fee for the physical act of transferring a copy, and you +may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, +thus forming a work based on the Library, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all +of these conditions: + + a) The modified work must itself be a software library. + +b) You must cause the files modified to carry prominent notices stating that +you changed the files and the date of any change. + +c) You must cause the whole of the work to be licensed at no charge to all +third parties under the terms of this License. + +d) If a facility in the modified Library refers to a function or a table of +data to be supplied by an application program that uses the facility, other +than as an argument passed when the facility is invoked, then you must make +a good faith effort to ensure that, in the event an application does not supply +such function or table, the facility still operates, and performs whatever +part of its purpose remains meaningful. + +(For example, a function in a library to compute square roots has a purpose +that is entirely well-defined independent of the application. Therefore, Subsection +2d requires that any application-supplied function or table used by this function +must be optional: if the application does not supply it, the square root function +must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Library, and can be reasonably +considered independent and separate works in themselves, then this License, +and its terms, do not apply to those sections when you distribute them as +separate works. But when you distribute the same sections as part of a whole +which is a work based on the Library, the distribution of the whole must be +on the terms of this License, whose permissions for other licensees extend +to the entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise +the right to control the distribution of derivative or collective works based +on the Library. + +In addition, mere aggregation of another work not based on the Library with +the Library (or with a work based on the Library) on a volume of a storage +or distribution medium does not bring the other work under the scope of this +License. + +3. You may opt to apply the terms of the ordinary GNU General Public License +instead of this License to a given copy of the Library. To do this, you must +alter all the notices that refer to this License, so that they refer to the +ordinary GNU General Public License, version 2, instead of to this License. +(If a newer version than version 2 of the ordinary GNU General Public License +has appeared, then you can specify that version instead if you wish.) Do not +make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, +so the ordinary GNU General Public License applies to all subsequent copies +and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library +into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of +it, under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you accompany it with the complete corresponding +machine-readable source code, which must be distributed under the terms of +Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated +place, then offering equivalent access to copy the source code from the same +place satisfies the requirement to distribute the source code, even though +third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but +is designed to work with the Library by being compiled or linked with it, +is called a "work that uses the Library". Such a work, in isolation, is not +a derivative work of the Library, and therefore falls outside the scope of +this License. + +However, linking a "work that uses the Library" with the Library creates an +executable that is a derivative of the Library (because it contains portions +of the Library), rather than a "work that uses the library". The executable +is therefore covered by this License. Section 6 states terms for distribution +of such executables. + +When a "work that uses the Library" uses material from a header file that +is part of the Library, the object code for the work may be a derivative work +of the Library even though the source code is not. Whether this is true is +especially significant if the work can be linked without the Library, or if +the work is itself a library. The threshold for this to be true is not precisely +defined by law. + +If such an object file uses only numerical parameters, data structure layouts +and accessors, and small macros and small inline functions (ten lines or less +in length), then the use of the object file is unrestricted, regardless of +whether it is legally a derivative work. (Executables containing this object +code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute +the object code for the work under the terms of Section 6. Any executables +containing that work also fall under Section 6, whether or not they are linked +directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or link a "work +that uses the Library" with the Library to produce a work containing portions +of the Library, and distribute that work under terms of your choice, provided +that the terms permit modification of the work for the customer's own use +and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library +is used in it and that the Library and its use are covered by this License. +You must supply a copy of this License. If the work during execution displays +copyright notices, you must include the copyright notice for the Library among +them, as well as a reference directing the user to the copy of this License. +Also, you must do one of these things: + +a) Accompany the work with the complete corresponding machine-readable source +code for the Library including whatever changes were used in the work (which +must be distributed under Sections 1 and 2 above); and, if the work is an +executable linked with the Library, with the complete machine-readable "work +that uses the Library", as object code and/or source code, so that the user +can modify the Library and then relink to produce a modified executable containing +the modified Library. (It is understood that the user who changes the contents +of definitions files in the Library will not necessarily be able to recompile +the application to use the modified definitions.) + +b) Use a suitable shared library mechanism for linking with the Library. A +suitable mechanism is one that (1) uses at run time a copy of the library +already present on the user's computer system, rather than copying library +functions into the executable, and (2) will operate properly with a modified +version of the library, if the user installs one, as long as the modified +version is interface-compatible with the version that the work was made with. + +c) Accompany the work with a written offer, valid for at least three years, +to give the same user the materials specified in Subsection 6a, above, for +a charge no more than the cost of performing this distribution. + +d) If distribution of the work is made by offering access to copy from a designated +place, offer equivalent access to copy the above specified materials from +the same place. + +e) Verify that the user has already received a copy of these materials or +that you have already sent this user a copy. + +For an executable, the required form of the "work that uses the Library" must +include any data and utility programs needed for reproducing the executable +from it. However, as a special exception, the materials to be distributed +need not include anything that is normally distributed (in either source or +binary form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component itself +accompanies the executable. + +It may happen that this requirement contradicts the license restrictions of +other proprietary libraries that do not normally accompany the operating system. +Such a contradiction means you cannot use both them and the Library together +in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side +in a single library together with other library facilities not covered by +this License, and distribute such a combined library, provided that the separate +distribution of the work based on the Library and of the other library facilities +is otherwise permitted, and provided that you do these two things: + +a) Accompany the combined library with a copy of the same work based on the +Library, uncombined with any other library facilities. This must be distributed +under the terms of the Sections above. + +b) Give prominent notice with the combined library of the fact that part of +it is a work based on the Library, and explaining where to find the accompanying +uncombined form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute the Library +except as expressly provided under this License. Any attempt otherwise to +copy, modify, sublicense, link with, or distribute the Library is void, and +will automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will not +have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Library or its derivative works. These actions are prohibited by law if you +do not accept this License. Therefore, by modifying or distributing the Library +(or any work based on the Library), you indicate your acceptance of this License +to do so, and all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), +the recipient automatically receives a license from the original licensor +to copy, distribute, link with or modify the Library subject to these terms +and conditions. You may not impose any further restrictions on the recipients' +exercise of the rights granted herein. You are not responsible for enforcing +compliance by third parties with this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed +on you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of +this License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as +a consequence you may not distribute the Library at all. For example, if a +patent license would not permit royalty-free redistribution of the Library +by all those who receive copies directly or indirectly through you, then the +only way you could satisfy both it and this License would be to refrain entirely +from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents +or other property right claims or to contest validity of any such claims; +this section has the sole purpose of protecting the integrity of the free +software distribution system which is implemented by public license practices. +Many people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose +that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Library under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of +the Lesser General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to address +new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies +a version number of this License which applies to it and "any later version", +you have the option of following the terms and conditions either of that version +or of any later version published by the Free Software Foundation. If the +Library does not specify a license version number, you may choose any version +ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs +whose distribution conditions are incompatible with these, write to the author +to ask for permission. For software which is copyrighted by the Free Software +Foundation, write to the Free Software Foundation; we sometimes make exceptions +for this. Our decision will be guided by the two goals of preserving the free +status of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE +OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE +THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE +OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA +OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES +OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH +HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Libraries + +If you develop a new library, and you want it to be of the greatest possible +use to the public, we recommend making it free software that everyone can +redistribute and change. You can do so by permitting redistribution under +these terms (or, alternatively, under the terms of the ordinary General Public +License). + +To apply these terms, attach the following notices to the library. It is safest +to attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the "copyright" +line and a pointer to where the full notice is found. + + + +Copyright (C) + +This library is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation; either version 2.1 of the License, or (at your option) +any later version. + +This library is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License along +with this library; if not, write to the Free Software Foundation, Inc., 51 +Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the library, if necessary. Here +is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in + +the library `Frob' (a library for tweaking knobs) written + +by James Random Hacker. + +< signature of Ty Coon > , 1 April 1990 + +Ty Coon, President of Vice + +That's all there is to it! + +================================================================================================ + +Ubuntu Mono: Ubuntu Font Licence 1.0 + +------------------------------- +UBUNTU FONT LICENCE Version 1.0 +------------------------------- + +PREAMBLE +This licence allows the licensed fonts to be used, studied, modified and +redistributed freely. The fonts, including any derivative works, can be +bundled, embedded, and redistributed provided the terms of this licence +are met. The fonts and derivatives, however, cannot be released under +any other licence. The requirement for fonts to remain under this +licence does not require any document created using the fonts or their +derivatives to be published under this licence, as long as the primary +purpose of the document is not to be a vehicle for the distribution of +the fonts. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this licence and clearly marked as such. This may +include source files, build scripts and documentation. + +"Original Version" refers to the collection of Font Software components +as received under this licence. + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to +a new environment. + +"Copyright Holder(s)" refers to all individuals and companies who have a +copyright ownership of the Font Software. + +"Substantially Changed" refers to Modified Versions which can be easily +identified as dissimilar to the Font Software by users of the Font +Software comparing the Original Version with the Modified Version. + +To "Propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification and with or without charging +a redistribution fee), making available to the public, and in some +countries other activities as well. + +PERMISSION & CONDITIONS +This licence does not grant any rights under trademark law and all such +rights are reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of the Font Software, to propagate the Font Software, subject to +the below conditions: + +1) Each copy of the Font Software must contain the above copyright +notice and this licence. These can be included either as stand-alone +text files, human-readable headers or in the appropriate machine- +readable metadata fields within text or binary files as long as those +fields can be easily viewed by the user. + +2) The font name complies with the following: +(a) The Original Version must retain its name, unmodified. +(b) Modified Versions which are Substantially Changed must be renamed to +avoid use of the name of the Original Version or similar names entirely. +(c) Modified Versions which are not Substantially Changed must be +renamed to both (i) retain the name of the Original Version and (ii) add +additional naming elements to distinguish the Modified Version from the +Original Version. The name of such Modified Versions must be the name of +the Original Version, with "derivative X" where X represents the name of +the new work, appended to that name. + +3) The name(s) of the Copyright Holder(s) and any contributor to the +Font Software shall not be used to promote, endorse or advertise any +Modified Version, except (i) as required by this licence, (ii) to +acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with +their explicit written permission. + +4) The Font Software, modified or unmodified, in part or in whole, must +be distributed entirely under this licence, and must not be distributed +under any other licence. The requirement for fonts to remain under this +licence does not affect any document created using the Font Software, +except any version of the Font Software extracted from a document +created using the Font Software may only be distributed under this +licence. + +TERMINATION +This licence becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER +DEALINGS IN THE FONT SOFTWARE. + +================================================================================================ + +Jersey 10: SIL Open Font Licence 1.1 + +Copyright 2023 The Soft Type Project Authors (https://github.com/scfried/soft-type-jersey) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/build.sh b/build.sh index b7cf67ef..771dd262 100755 --- a/build.sh +++ b/build.sh @@ -31,11 +31,14 @@ for page in $VERSIONED_PAGES; do done # Regenerates everything the docs are built from: the reference pages written by -# the doclet, the built-in sprite and sound pages, and the demo assets the -# example pages load. Running only `compile` here would leave the reference -# pages as they were after the last `mvn package`, which is how pages for -# deleted methods used to survive. -mvn -q -DskipTests prepare-package +# the doclet, the built-in sprite and sound pages, and the demo pages with the +# assets they load. +# in the reactor, never `install` (AGENTS.md); the reference pages come from the Javadoc of the +# core and the extensions, the demo pages and their assets from examples/src/main/java/demos +./scripts/reference-docs.sh +CP="examples/target/classes:$(ls all/target/scratch-*-all.jar | grep -v nrw | head -1)" +java -cp "$CP" docs.GenerateDemoPages --write +java -cp "$CP" docs.GenerateAssetPages python3 scripts/browser-compatibility.py python3 scripts/release-catalogs.py python3 scripts/build-course-pack.py --output docs/public/scratch-to-java-course.zip diff --git a/catalogs/api.json b/catalogs/api.json index 0196cda3..8487f182 100644 --- a/catalogs/api.json +++ b/catalogs/api.json @@ -4,606 +4,594 @@ "browserVersion": "6.5.0-browser.1", "methods": [ { - "id": "AnimatedSprite/addAnimation(String,String,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", - "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int" - ], - "parameterNames": [ - "name", - "pattern", - "frames" - ], - "params": [ - "String name", - "String pattern", - "int frames" - ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.", - "scratchblock": null, - "paramDocs": [ - "name: the name of the animation", - "pattern: the pattern (@see String#format) of the file names. The frame\n starts from 1.", - "frames: the number of frames in the animation" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt eine Animation hinzu. %d im Muster wird durch 1..frames ersetzt, z.B. bunny1_walk%d" - } - } - }, - { - "id": "AnimatedSprite/addAnimation(String,Function,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/changeX(double)", + "memberId": "Camera/changeX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "changeX", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.util.function.Function", - "int" + "double" ], "parameterNames": [ - "name", - "builder", - "frame" + "dx" ], "params": [ - "String name", - "Function builder", - "int frame" + "double dx" ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nTo add an animation with file names \"walk_1.png\", \"walk_2.png\",\n\"walk_3.png\", you can use the following code:\n\n```java\nsprite.addAnimation(\"walk\", i -> \"walk_\" + i + \".png\", 3);\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the animation", - "builder: a function that builds the file names for the animation frames", - "frame: the number of frames in the animation. The frame starts from\n 1." + "dx: how far to move the camera along x" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/changeX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt eine Animation an; builder liefert zu 1..frames jeweils den Bildpfad" - } - } + "translations": {} }, { - "id": "AnimatedSprite/addAnimation(String,String,int,int,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/changeY(double)", + "memberId": "Camera/changeY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "changeY", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int" + "double" ], "parameterNames": [ - "name", - "path", - "frames", - "width", - "height" + "dy" ], "params": [ - "String name", - "String path", - "int frames", - "int width", - "int height" + "double dy" ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nFor an animation sprite sheet, where each frame is of equal width and height,\nyou can use this method to add an animation by specifying the path to the\nsprite sheet, the number of frames, and the dimensions of each frame.\nFor example, for a four-frame animation arranged in a single row, each frame\nbeing 64x64 pixels, you can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64);\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the animation", - "path: the path to the animation frames", - "frames: the number of frames in the animation", - "width: the width of each frame", - "height: the height of each frame" + "dy: how far to move the camera along y" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/changeY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zerlegt ein Bild in gleich große Einzelbilder und legt daraus eine Animation an" - } - } + "translations": {} }, { - "id": "AnimatedSprite/addAnimation(String,String,int,int,int,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/changeZoom(double)", + "memberId": "Camera/changeZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "changeZoom", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int", - "int" + "double" ], "parameterNames": [ - "name", - "path", - "frames", - "width", - "height", - "row" + "dz" ], "params": [ - "String name", - "String path", - "int frames", - "int width", - "int height", - "int row" + "double dz" ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nIf the animation frames are arranged in rows in a sprite sheet, you can use\nthis method to specify which row to use for the animation.\n\nFor example, for a four-frame animation arranged in a single row, you want the second, each frame\nbeing 64x64 pixels, you can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64, 2);\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the animation", - "path: the path to the animation frames", - "frames: the number of frames in the animation", - "width: the width of each frame", - "height: the height of each frame", - "row: the row of the animation frames" + "dz: percentage points to add to the zoom" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/changeZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wie addAnimation(name, imagePath, frames, width, height), beginnt aber in der angegebenen Zeile" - } - } + "translations": {} }, { - "id": "AnimatedSprite/addAnimation(String,String,int,int,int,int,boolean)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/constructor()", + "memberId": "Camera/constructor", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "constructor", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int", - "int", - "boolean" - ], - "parameterNames": [ - "name", - "path", - "frames", - "width", - "height", - "column", - "useColumns" - ], - "params": [ - "String name", - "String path", - "int frames", - "int width", - "int height", - "int column", - "boolean useColumns" - ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nIf the animation frames are arranged in either rows or columns in a sprite\nsheet, you can use this method to specify which column or row to use for the\nanimation. Take four frame animation arranged in a single column. Each frame is\n64x64 pixels. You can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64, 1, true); // use column 1\n```", + "returnType": "Camera", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A camera at (0, 0) with zoom 100. Every stage has its own: `getStage().getCamera()`.", + "description": "A camera at (0, 0) with zoom 100. Every stage has its own: `getStage().getCamera()`.", "scratchblock": null, - "paramDocs": [ - "name: the name of the animation", - "path: the path to the animation frames", - "frames: the number of frames in the animation", - "width: the width of each frame", - "height: the height of each frame", - "column: the column of the animation frames", - "useColumns: whether to use columns or rows" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt eine Animation aus einer Spalte des Bildes an" - } - } + "translations": {} }, { - "id": "AnimatedSprite/clone()", - "memberId": "AnimatedSprite/clone", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "clone", + "id": "Camera/getPosition()", + "memberId": "Camera/getPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getPosition", "static": false, - "returnType": "AnimatedSprite", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a clone of this sprite with the same animations, playing the same\none, and puts it on the stage right behind this sprite. See\n[Sprite.clone()](../Sprite/clone).", - "description": "Creates a clone of this sprite with the same animations, playing the same\none, and puts it on the stage right behind this sprite. See\n[Sprite.clone()](../Sprite/clone).", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the clone, of the same class as this sprite", + "returns": "the world position at the stage's centre", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/clone", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie dieser Figur" - } - } + "translations": {} }, { - "id": "AnimatedSprite/constructor()", - "memberId": "AnimatedSprite/constructor", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "constructor", + "id": "Camera/getX()", + "memberId": "Camera/getX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getX", "static": false, - "returnType": "AnimatedSprite", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.", - "description": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.\n\nExample usage:\n\n```java\nAnimatedSprite sprite = new AnimatedSprite();\nsprite.addCostume(\"idle\", \"assets/idle.png\");\nsprite.addAnimation(\"walk\", \"assets/walk_%d.png\", 4);\nsprite.playAnimation(\"walk\");\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the world x at the stage's centre", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine neue animierte Figur" - } - } - }, - { - "id": "AnimatedSprite/constructor(AnimatedSprite)", - "memberId": "AnimatedSprite/constructor", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "constructor", - "static": false, - "returnType": "AnimatedSprite", - "parameterTypes": [ - "org.openpatch.scratch.AnimatedSprite" - ], - "parameterNames": [ - "animatedSprite" - ], - "params": [ - "AnimatedSprite animatedSprite" - ], - "summary": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.", - "description": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.\n\nExample usage:\n\n```java\nAnimatedSprite sprite = new AnimatedSprite();\nsprite.addCostume(\"idle\", \"assets/idle.png\");\nsprite.addAnimation(\"walk\", \"assets/walk_%d.png\", 4);\nsprite.playAnimation(\"walk\");\n```", - "scratchblock": null, - "paramDocs": [ - "animatedSprite: " - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie der angegebenen animierten Figur" - } - } + "translations": {} }, { - "id": "AnimatedSprite/getAnimationFrame()", - "memberId": "AnimatedSprite/getAnimationFrame", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "getAnimationFrame", + "id": "Camera/getY()", + "memberId": "Camera/getY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getY", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the current animation frame.", - "description": "Gets the current animation frame.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the current animation frame", + "returns": "the world y at the stage's centre", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/getAnimationFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Nummer des aktuellen Einzelbildes zurück" - } - } + "translations": {} }, { - "id": "AnimatedSprite/getAnimationInterval()", - "memberId": "AnimatedSprite/getAnimationInterval", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "getAnimationInterval", + "id": "Camera/getZoom()", + "memberId": "Camera/getZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getZoom", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the interval between animation frames.", - "description": "Gets the interval between animation frames.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the interval between animation frames", + "returns": "the zoom in percent", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/getAnimationInterval", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt zurück, wie viele Millisekunden ein Einzelbild angezeigt wird" - } - } + "translations": {} }, { - "id": "AnimatedSprite/isAnimationPlayed()", - "memberId": "AnimatedSprite/isAnimationPlayed", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "isAnimationPlayed", + "id": "Camera/resetZoom()", + "memberId": "Camera/resetZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "resetZoom", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the animation is played.", - "description": "Checks if the animation is played.", + "summary": "Back to zoom 100.", + "description": "Back to zoom 100.", "scratchblock": null, "paramDocs": [], - "returns": "true if the animation is played, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/isAnimationPlayed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/resetZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn eine mit once gestartete Animation durchgelaufen ist" - } - } + "translations": {} }, { - "id": "AnimatedSprite/playAnimation(String)", - "memberId": "AnimatedSprite/playAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "playAnimation", + "id": "Camera/setPosition(double,double)", + "memberId": "Camera/setPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double" ], "parameterNames": [ - "name" + "x", + "y" ], "params": [ - "String name" + "double x", + "double y" ], - "summary": "Plays the animation with the specified name.", - "description": "Plays the animation with the specified name.", + "summary": "Centres the camera on a world position.", + "description": "Centres the camera on a world position.", "scratchblock": null, "paramDocs": [ - "name: the name of the animation to play" + "x: world x", + "y: world y" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/playAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Spielt die Animation in einer Schleife ab" - } - } + "translations": {} }, { - "id": "AnimatedSprite/playAnimation(String,boolean)", - "memberId": "AnimatedSprite/playAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "playAnimation", + "id": "Camera/setPosition(Vector2)", + "memberId": "Camera/setPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "boolean" + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "name", - "once" + "position" ], "params": [ - "String name", - "boolean once" + "Vector2 position" ], - "summary": "Plays the animation with the specified name.", - "description": "Plays the animation with the specified name.", + "summary": "Centres the camera on a world position.", + "description": "Centres the camera on a world position.", "scratchblock": null, "paramDocs": [ - "name: the name of the animation to play", - "once: whether to play the animation once" + "position: world position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/playAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Spielt die Animation ab; bei once == true nur ein einziges Mal" - } - } + "translations": {} }, { - "id": "AnimatedSprite/resetAnimation()", - "memberId": "AnimatedSprite/resetAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "resetAnimation", + "id": "Camera/setX(double)", + "memberId": "Camera/setX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setX", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Resets the animation. The animation will start from the first frame.", - "description": "Resets the animation. The animation will start from the first frame.", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "x" + ], + "params": [ + "double x" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "x: the world x to show at the stage's centre" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/resetAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Animation auf das erste Einzelbild zurück" - } - } + "translations": {} }, { - "id": "AnimatedSprite/setAnimationFrame(int)", - "memberId": "AnimatedSprite/setAnimationFrame", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "setAnimationFrame", + "id": "Camera/setY(double)", + "memberId": "Camera/setY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setY", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double" ], "parameterNames": [ - "frame" + "y" ], "params": [ - "int frame" + "double y" ], - "summary": "Sets the current animation frame.", - "description": "Sets the current animation frame.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "frame: the current animation frame" + "y: the world y to show at the stage's centre" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/setAnimationFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Springt zum Einzelbild mit der angegebenen Nummer" - } - } + "translations": {} }, { - "id": "AnimatedSprite/setAnimationInterval(int)", - "memberId": "AnimatedSprite/setAnimationInterval", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "setAnimationInterval", + "id": "Camera/setZoom(double)", + "memberId": "Camera/setZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setZoom", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double" ], "parameterNames": [ - "interval" + "zoom" ], "params": [ - "int interval" + "double zoom" ], - "summary": "Sets the interval between animation frames.", - "description": "Sets the interval between animation frames.", + "summary": "Sets the zoom in percent: 200 shows everything twice as large, 50 half as large. It stays\nwithin the zoom limits (50 to 200 unless changed).", + "description": "Sets the zoom in percent: 200 shows everything twice as large, 50 half as large. It stays\nwithin the zoom limits (50 to 200 unless changed).", "scratchblock": null, "paramDocs": [ - "interval: the interval between animation frames" + "zoom: the zoom in percent" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/setAnimationInterval", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt fest, wie viele Millisekunden ein Einzelbild angezeigt wird" - } - } + "translations": {} }, { - "id": "AnimatedSprite/toString()", - "memberId": "AnimatedSprite/toString", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "toString", + "id": "Camera/setZoomLimit(double,double)", + "memberId": "Camera/setZoomLimit", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setZoomLimit", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns which animation is playing and how far into it.", - "description": "Returns which animation is playing and how far into it.", + "returnType": "void", + "parameterTypes": [ + "double", + "double" + ], + "parameterNames": [ + "min", + "max" + ], + "params": [ + "double min", + "double max" + ], + "summary": "Limits the zoom.", + "description": "Limits the zoom.", "scratchblock": null, - "paramDocs": [], - "returns": "the sprite as a text", + "paramDocs": [ + "min: the smallest zoom in percent", + "max: the largest zoom in percent" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/toString", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setZoomLimit", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Figur als Zeichenkette zurück" - } - } + "translations": {} + }, + { + "id": "Camera/toScreenPosition(Vector2)", + "memberId": "Camera/toScreenPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toScreenPosition", + "static": false, + "returnType": "Vector2", + "parameterTypes": [ + "org.openpatch.scratch.Vector2" + ], + "parameterNames": [ + "world" + ], + "params": [ + "Vector2 world" + ], + "summary": "Where a world position shows on the stage.", + "description": "Where a world position shows on the stage.", + "scratchblock": null, + "paramDocs": [ + "world: a world position" + ], + "returns": "the screen position (origin at the stage's centre)", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toScreenPosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toScreenX(double)", + "memberId": "Camera/toScreenX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toScreenX", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "worldX" + ], + "params": [ + "double worldX" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "worldX: a world x" + ], + "returns": "where it shows on the stage", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toScreenX", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toScreenY(double)", + "memberId": "Camera/toScreenY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toScreenY", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "worldY" + ], + "params": [ + "double worldY" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "worldY: a world y" + ], + "returns": "where it shows on the stage", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toScreenY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toWorldPosition(Vector2)", + "memberId": "Camera/toWorldPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toWorldPosition", + "static": false, + "returnType": "Vector2", + "parameterTypes": [ + "org.openpatch.scratch.Vector2" + ], + "parameterNames": [ + "screen" + ], + "params": [ + "Vector2 screen" + ], + "summary": "Which world position shows at a place on the stage.", + "description": "Which world position shows at a place on the stage.", + "scratchblock": null, + "paramDocs": [ + "screen: a screen position (origin at the stage's centre)" + ], + "returns": "the world position", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toWorldPosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toWorldX(double)", + "memberId": "Camera/toWorldX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toWorldX", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "screenX" + ], + "params": [ + "double screenX" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "screenX: an x on the stage" + ], + "returns": "the world x shown there", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toWorldX", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toWorldY(double)", + "memberId": "Camera/toWorldY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toWorldY", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "screenY" + ], + "params": [ + "double screenY" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "screenY: a y on the stage" + ], + "returns": "the world y shown there", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toWorldY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} }, { "id": "Circle/constructor(double,double,double)", @@ -628,13 +616,13 @@ "double y", "double radius" ], - "summary": "Creates a circle with no specified position or size.", - "description": "Creates a circle with no specified position or size.", + "summary": "A circle.", + "description": "A circle.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate of the circle's center", - "y: the y-coordinate of the circle's center", - "radius: the radius of the circle" + "x: x of the centre", + "y: y of the centre", + "radius: the radius" ], "returns": null, "since": "", @@ -882,64 +870,88 @@ } }, { - "id": "Color/changeColor(double)", - "memberId": "Color/changeColor", + "id": "Color/constructor(double,double,double)", + "memberId": "Color/constructor", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "changeColor", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ + "double", + "double", "double" ], "parameterNames": [ - "h" + "red", + "green", + "blue" ], "params": [ - "double h" + "double red", + "double green", + "double blue" ], - "summary": "Changes the color accordining to a hue value, which is added to the current hue value. When the\nresulting value is greater than 255 it will be reset. For example: 285 => 30.", - "description": "Changes the color accordining to a hue value, which is added to the current hue value. When the\nresulting value is greater than 255 it will be reset. For example: 285 => 30.", + "summary": "A colour from red, green and blue, each from 0 to 255 (values outside are clamped). The\ncolour is opaque.", + "description": "A colour from red, green and blue, each from 0 to 255 (values outside are clamped). The\ncolour is opaque.", "scratchblock": null, "paramDocs": [ - "h: A hue value. Could be any positive or negative number." + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/changeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert den Farbton um den angegebenen Wert" + "description": "Erzeugt eine Farbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" } } }, { - "id": "Color/constructor()", + "id": "Color/constructor(double,double,double,double)", "memberId": "Color/constructor", "owner": "org.openpatch.scratch.Color", "className": "Color", "methodName": "constructor", "static": false, "returnType": "Color", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Constructs a new Color object with default values.", - "description": "Constructs a new Color object with default values.", + "parameterTypes": [ + "double", + "double", + "double", + "double" + ], + "parameterNames": [ + "red", + "green", + "blue", + "alpha" + ], + "params": [ + "double red", + "double green", + "double blue", + "double alpha" + ], + "summary": "A colour from red, green, blue and alpha, each from 0 to 255 (values outside are clamped).\nAn alpha of 0 is invisible, 255 opaque.", + "description": "A colour from red, green, blue and alpha, each from 0 to 255 (values outside are clamped).\nAn alpha of 0 is invisible, 255 opaque.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255", + "alpha: opacity from 0 to 255" + ], "returns": null, "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt die Farbe Weiß" - } - } + "translations": {} }, { "id": "Color/constructor(String)", @@ -953,16 +965,16 @@ "java.lang.String" ], "parameterNames": [ - "hexCode" + "hex" ], "params": [ - "String hexCode" + "String hex" ], - "summary": "The Color class represents a color in the Scratch environment. It supports various\nfunctionalities such as setting color values in the RGB and HSB spectrum, changing the color\nbased on a hue value, and converting between RGB and HSB color codes.", - "description": "The Color class represents a color in the Scratch environment. It supports various\nfunctionalities such as setting color values in the RGB and HSB spectrum, changing the color\nbased on a hue value, and converting between RGB and HSB color codes.", + "summary": "A colour from a hex code as in HTML and CSS: `\"#ff8000\"`, `\"ff8000\"`,\n`\"#f80\"`, or with alpha `\"#ff800080\"`.", + "description": "A colour from a hex code as in HTML and CSS: `\"#ff8000\"`, `\"ff8000\"`,\n`\"#f80\"`, or with alpha `\"#ff800080\"`.", "scratchblock": null, "paramDocs": [ - "hexCode: " + "hex: the hex code" ], "returns": null, "since": "", @@ -976,200 +988,176 @@ } }, { - "id": "Color/constructor(double)", - "memberId": "Color/constructor", + "id": "Color/equals(Object)", + "memberId": "Color/equals", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "constructor", + "methodName": "equals", "static": false, - "returnType": "Color", + "returnType": "boolean", "parameterTypes": [ - "double" + "java.lang.Object" ], "parameterNames": [ - "h" + "other" ], "params": [ - "double h" + "Object other" ], - "summary": "Constructs a new Color object with the specified hue value.", - "description": "Constructs a new Color object with the specified hue value.", + "summary": "Two colours are equal when they pack into the same ARGB number.", + "description": "Two colours are equal when they pack into the same ARGB number.", "scratchblock": null, "paramDocs": [ - "h: the hue value" + "other: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/equals", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Farbe mit dem angegebenen Farbton (0 bis 255)" + "description": "Prüft, ob es dieselbe Farbe ist" } } }, { - "id": "Color/constructor(double,double,double)", - "memberId": "Color/constructor", + "id": "Color/fromARGB(int)", + "memberId": "Color/fromARGB", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "constructor", - "static": false, + "methodName": "fromARGB", + "static": true, "returnType": "Color", "parameterTypes": [ - "double", - "double", - "double" + "int" ], "parameterNames": [ - "r", - "g", - "b" + "argb" ], "params": [ - "double r", - "double g", - "double b" + "int argb" ], - "summary": "Constructs a new Color object with the specified rgb values.", - "description": "Constructs a new Color object with the specified rgb values.", + "summary": "A colour from a packed ARGB number, as [toARGB()](toARGB) gives it.", + "description": "A colour from a packed ARGB number, as [toARGB()](toARGB) gives it.", "scratchblock": null, "paramDocs": [ - "r: the red value", - "g: the green value", - "b: the blue value" + "argb: alpha, red, green and blue in one int" ], - "returns": null, + "returns": "the colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/fromARGB", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Farbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/constructor(Color)", - "memberId": "Color/constructor", + "id": "Color/fromHSB(double,double,double)", + "memberId": "Color/fromHSB", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "constructor", - "static": false, + "methodName": "fromHSB", + "static": true, "returnType": "Color", "parameterTypes": [ - "org.openpatch.scratch.Color" + "double", + "double", + "double" ], "parameterNames": [ - "c" + "hue", + "saturation", + "brightness" ], "params": [ - "Color c" + "double hue", + "double saturation", + "double brightness" ], - "summary": "Copies the received ScratchColor object.", - "description": "Copies the received ScratchColor object.", + "summary": "A colour from Scratch's colour, saturation and brightness, each from 0 to 100. The colour\ngoes around (110 is the same as 10); saturation and brightness are clamped.", + "description": "A colour from Scratch's colour, saturation and brightness, each from 0 to 100. The colour\ngoes around (110 is the same as 10); saturation and brightness are clamped.", "scratchblock": null, "paramDocs": [ - "c: ScratchColor object to copy" + "hue: the colour from 0 to 100", + "saturation: from 0 (grey) to 100 (full colour)", + "brightness: from 0 (black) to 100 (full brightness)" ], - "returns": null, + "returns": "the colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/fromHSB", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie der übergebenen Farbe" - } - } + "translations": {} }, { - "id": "Color/equals(Object)", - "memberId": "Color/equals", + "id": "Color/getAlpha()", + "memberId": "Color/getAlpha", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "equals", + "methodName": "getAlpha", "static": false, - "returnType": "boolean", - "parameterTypes": [ - "java.lang.Object" - ], - "parameterNames": [ - "other" - ], - "params": [ - "Object other" - ], - "summary": "Two colours are the same when they are the same colour.", - "description": "Two colours are the same when they are the same colour.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "other: the object to compare with" - ], - "returns": "whether both are colours with the same red, green and blue", + "paramDocs": [], + "returns": "alpha (opacity) from 0 (invisible) to 255 (opaque)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/equals", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getAlpha", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Prüft, ob es dieselbe Farbe ist" - } - } + "translations": {} }, { - "id": "Color/get()", - "memberId": "Color/get", + "id": "Color/getBlue()", + "memberId": "Color/getBlue", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "get", + "methodName": "getBlue", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the color value as a hex code. This is useful for comparing pixels.", - "description": "Get the color value as a hex code. This is useful for comparing pixels.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "hex code", + "returns": "blue from 0 to 255", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/get", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getBlue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Farbe als ganze Zahl zurück" + "description": "Gibt den Blauanteil zurück (0 bis 255)" } } }, { - "id": "Color/getBlue()", - "memberId": "Color/getBlue", + "id": "Color/getBrightness()", + "memberId": "Color/getBrightness", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getBlue", + "methodName": "getBrightness", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the blue value.", - "description": "Get the blue value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "blue value [0...255]", + "returns": "brightness from 0 (black) to 100", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getBlue", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getBrightness", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Blauanteil zurück (0 bis 255)" - } - } + "translations": {} }, { "id": "Color/getGreen()", @@ -1182,11 +1170,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the green value.", - "description": "Get the green value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "green value [0...255]", + "returns": "green from 0 to 255", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getGreen", "availability": "implemented", @@ -1198,143 +1186,127 @@ } }, { - "id": "Color/getH()", - "memberId": "Color/getH", + "id": "Color/getHue()", + "memberId": "Color/getHue", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getH", + "methodName": "getHue", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the hue value.", - "description": "Get the hue value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "hue value [0...255]", + "returns": "Scratch's colour (hue) from 0 to 100; 0 for greys", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getH", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getHue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Farbton zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/getHSB()", - "memberId": "Color/getHSB", + "id": "Color/getRed()", + "memberId": "Color/getRed", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getHSB", + "methodName": "getRed", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the color value on the HSB spectrum.", - "description": "Get the color value on the HSB spectrum.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "hue value [0...255]", + "returns": "red from 0 to 255", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getHSB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getRed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Farbton zurück (0 bis 255)" + "description": "Gibt den Rotanteil zurück (0 bis 255)" } } }, { - "id": "Color/getL()", - "memberId": "Color/getL", + "id": "Color/getSaturation()", + "memberId": "Color/getSaturation", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getL", + "methodName": "getSaturation", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the luminosity value.", - "description": "Get the luminosity value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "luminosity value [0...255]", + "returns": "saturation from 0 (grey) to 100", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getL", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getSaturation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Helligkeit zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/getRed()", - "memberId": "Color/getRed", + "id": "Color/hashCode()", + "memberId": "Color/hashCode", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getRed", + "methodName": "hashCode", "static": false, - "returnType": "double", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the red value.", - "description": "Get the red value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "red value [0...255]", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getRed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/hashCode", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Rotanteil zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/getS()", - "memberId": "Color/getS", + "id": "Color/toARGB()", + "memberId": "Color/toARGB", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getS", + "methodName": "toARGB", "static": false, - "returnType": "double", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the saturation value.", - "description": "Get the saturation value.", + "summary": "The colour packed into one int as alpha, red, green and blue (8 bits each, rounded), the way\npixels are stored.", + "description": "The colour packed into one int as alpha, red, green and blue (8 bits each, rounded), the way\npixels are stored.", "scratchblock": null, "paramDocs": [], - "returns": "saturation value [0...255]", + "returns": "the packed colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getS", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/toARGB", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Sättigung zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/hashCode()", - "memberId": "Color/hashCode", + "id": "Color/toString()", + "memberId": "Color/toString", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "hashCode", + "methodName": "toString", "static": false, - "returnType": "int", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], @@ -1342,476 +1314,270 @@ "description": "", "scratchblock": null, "paramDocs": [], - "returns": "a hash consistent with [equals(Object)](equals)", + "returns": "`#rrggbb`, or `#rrggbbaa` when not opaque", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/hashCode", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/toString", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt die Farbe als Text aus" + } + } }, { - "id": "Color/setHSB(double)", - "memberId": "Color/setHSB", + "id": "Color/withAlpha(double)", + "memberId": "Color/withAlpha", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "setHSB", + "methodName": "withAlpha", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ "double" ], "parameterNames": [ - "h" + "alpha" ], "params": [ - "double h" + "double alpha" ], - "summary": "Setting the color value after the HSB spectrum. Saturation and Luminosity are fixed at 255.", - "description": "Setting the color value after the HSB spectrum. Saturation and Luminosity are fixed at 255.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "h: A hue value [0...255]" + "alpha: opacity from 0 to 255" ], - "returns": null, + "returns": "this colour with another alpha", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/setHSB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withAlpha", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt den Farbton (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/setHSB(double,double,double)", - "memberId": "Color/setHSB", + "id": "Color/withBlue(double)", + "memberId": "Color/withBlue", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "setHSB", + "methodName": "withBlue", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ - "double", - "double", "double" ], "parameterNames": [ - "h", - "s", - "l" + "blue" ], "params": [ - "double h", - "double s", - "double l" + "double blue" ], - "summary": "Setting the color value after the HSB spectrum.", - "description": "Setting the color value after the HSB spectrum.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "h: A hue value [0...255]", - "s: A saturation value [0...255]", - "l: A luminosity value [0...255]" + "blue: blue from 0 to 255" ], - "returns": null, + "returns": "this colour with another blue", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/setHSB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withBlue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt Farbton, Sättigung und Helligkeit (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/setRGB(double,double,double)", - "memberId": "Color/setRGB", + "id": "Color/withBrightness(double)", + "memberId": "Color/withBrightness", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "setRGB", + "methodName": "withBrightness", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ - "double", - "double", "double" ], "parameterNames": [ - "r", - "g", - "b" + "brightness" ], "params": [ - "double r", - "double g", - "double b" + "double brightness" ], - "summary": "Setting the color value after the RGB spectrum", - "description": "Setting the color value after the RGB spectrum", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "r: A red value [0...255]", - "g: A green value [0...255]", - "b: A blue value [0...255]" + "brightness: from 0 to 100" ], - "returns": null, + "returns": "this colour with another brightness", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/setRGB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withBrightness", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/toString()", - "memberId": "Color/toString", + "id": "Color/withGreen(double)", + "memberId": "Color/withGreen", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "toString", + "methodName": "withGreen", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "The colour written out, so that printing one says something.", - "description": "The colour written out, so that printing one says something.\n\nWithout this a `System.out.println(mySprite.getTint())` printed\n`org.openpatch.scratch.Color@35432107`, which tells you nothing about\nthe colour and is the first thing anyone tries when a tint looks wrong.", + "returnType": "Color", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "green" + ], + "params": [ + "double green" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], - "returns": "the colour as `Color[r=255.0, g=128.0, b=0.0]`", + "paramDocs": [ + "green: green from 0 to 255" + ], + "returns": "this colour with another green", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/toString", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withGreen", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Farbe als Text aus" - } - } + "translations": {} }, { - "id": "Ellipse/constructor(double,double,double,double)", - "memberId": "Ellipse/constructor", - "owner": "org.openpatch.scratch.Ellipse", - "className": "Ellipse", - "methodName": "constructor", + "id": "Color/withHue(double)", + "memberId": "Color/withHue", + "owner": "org.openpatch.scratch.Color", + "className": "Color", + "methodName": "withHue", "static": false, - "returnType": "Ellipse", + "returnType": "Color", "parameterTypes": [ - "double", - "double", - "double", "double" ], "parameterNames": [ - "x", - "y", - "width", - "height" + "hue" ], "params": [ - "double x", - "double y", - "double width", - "double height" + "double hue" ], - "summary": "Creates an ellipse with no specified position or size.", - "description": "Creates an ellipse with no specified position or size.", + "summary": "Another colour (hue), keeping saturation, brightness and alpha. The colour goes around, so\n`withHue(getHue() + 10)` works like Scratch's \"change color by 10\".", + "description": "Another colour (hue), keeping saturation, brightness and alpha. The colour goes around, so\n`withHue(getHue() + 10)` works like Scratch's \"change color by 10\".", "scratchblock": null, "paramDocs": [ - "x: ", - "y: ", - "width: ", - "height: " + "hue: the colour from 0 to 100" ], - "returns": null, + "returns": "this colour with another hue", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Ellipse/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withHue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Ellipse im angegebenen Rechteck" - } - } + "translations": {} }, { - "id": "Hitbox/constructor(Shape)", - "memberId": "Hitbox/constructor", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "constructor", + "id": "Color/withRed(double)", + "memberId": "Color/withRed", + "owner": "org.openpatch.scratch.Color", + "className": "Color", + "methodName": "withRed", "static": false, - "returnType": "Hitbox", + "returnType": "Color", "parameterTypes": [ - "org.openpatch.scratch.Shape" + "double" ], "parameterNames": [ - "shape" + "red" ], "params": [ - "Shape shape" + "double red" ], - "summary": "Constructs a hitbox with the specified shape.", - "description": "Constructs a hitbox with the specified shape.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "shape: The shape of the hitbox." + "red: red from 0 to 255" ], - "returns": null, + "returns": "this colour with another red", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withRed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt einen Umriss aus einer Form" - } - } + "translations": {} }, { - "id": "Hitbox/constructor(double[],double[])", - "memberId": "Hitbox/constructor", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "constructor", + "id": "Color/withSaturation(double)", + "memberId": "Color/withSaturation", + "owner": "org.openpatch.scratch.Color", + "className": "Color", + "methodName": "withSaturation", "static": false, - "returnType": "Hitbox", + "returnType": "Color", "parameterTypes": [ - "double[]", - "double[]" + "double" ], "parameterNames": [ - "xPoints", - "yPoints" + "saturation" ], "params": [ - "double[] xPoints", - "double[] yPoints" + "double saturation" ], - "summary": "Constructs a hitbox with the specified x and y points.", - "description": "Constructs a hitbox with the specified x and y points.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "xPoints: The x-coordinates of the points.", - "yPoints: The y-coordinates of the points." + "saturation: from 0 to 100" ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt einen Umriss aus x- und y-Koordinaten" - } - } - }, - { - "id": "Hitbox/contains(double,double)", - "memberId": "Hitbox/contains", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "contains", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "x", - "y" - ], - "params": [ - "double x", - "double y" - ], - "summary": "Checks if the hitbox contains a point.", - "description": "Checks if the hitbox contains a point.", - "scratchblock": null, - "paramDocs": [ - "x: The x-coordinate of the point.", - "y: The y-coordinate of the point." - ], - "returns": "`true` if the hitbox contains the point, `false`\n otherwise.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/contains", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Punkt im Umriss liegt" - } - } - }, - { - "id": "Hitbox/getBounds()", - "memberId": "Hitbox/getBounds", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "getBounds", - "static": false, - "returnType": "Bounds", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the smallest upright rectangle the hitbox fits into.", - "description": "Returns the smallest upright rectangle the hitbox fits into.", - "scratchblock": null, - "paramDocs": [], - "returns": "the bounding box of the hitbox", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/getBounds", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt das umschließende Rechteck zurück" - } - } - }, - { - "id": "Hitbox/getShape()", - "memberId": "Hitbox/getShape", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "getShape", - "static": false, - "returnType": "Shape", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shape of the hitbox.", - "description": "Returns the shape of the hitbox.", - "scratchblock": null, - "paramDocs": [], - "returns": "The shape of the hitbox.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/getShape", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Umriss als Form zurück" - } - } - }, - { - "id": "Hitbox/intersects(Hitbox)", - "memberId": "Hitbox/intersects", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "intersects", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Hitbox" - ], - "parameterNames": [ - "hitbox" - ], - "params": [ - "Hitbox hitbox" - ], - "summary": "Checks if the hitbox intersects with another hitbox.", - "description": "Checks if the hitbox intersects with another hitbox.", - "scratchblock": null, - "paramDocs": [ - "hitbox: The hitbox to check for intersection." - ], - "returns": "`true` if the hitboxes intersect, `false` otherwise.", + "returns": "this colour with another saturation", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/intersects", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withSaturation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn sich beide Umrisse überlappen" - } - } + "translations": {} }, { - "id": "Hitbox/translateAndRotateAndResize(double,double,double,double,double,double)", - "memberId": "Hitbox/translateAndRotateAndResize", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "translateAndRotateAndResize", + "id": "Ellipse/constructor(double,double,double,double)", + "memberId": "Ellipse/constructor", + "owner": "org.openpatch.scratch.Ellipse", + "className": "Ellipse", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "Ellipse", "parameterTypes": [ - "double", - "double", "double", "double", "double", "double" ], "parameterNames": [ - "degrees", - "originX", - "originY", - "translateX", - "translateY", - "size" + "x", + "y", + "width", + "height" ], "params": [ - "double degrees", - "double originX", - "double originY", - "double translateX", - "double translateY", - "double size" + "double x", + "double y", + "double width", + "double height" ], - "summary": "Transforms the shape by scaling, translating, and rotating it.", - "description": "Transforms the shape by scaling, translating, and rotating it.", + "summary": "An ellipse inside a rectangle along the axes.", + "description": "An ellipse inside a rectangle along the axes.", "scratchblock": null, "paramDocs": [ - "degrees: The angle in degrees to rotate the shape.", - "originX: The x-coordinate of the rotation origin.", - "originY: The y-coordinate of the rotation origin.", - "translateX: The x-coordinate to translate the shape.", - "translateY: The y-coordinate to translate the shape.", - "size: The size to scale the shape, where 100.0 represents the\n original size." + "x: the smallest x of the rectangle around it", + "y: the smallest y of the rectangle around it", + "width: the width", + "height: the height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/translateAndRotateAndResize", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Verschiebt, dreht und skaliert den Umriss" - } - } - }, - { - "id": "HtmlColor/constructor()", - "memberId": "HtmlColor/constructor", - "owner": "org.openpatch.scratch.HtmlColor", - "className": "HtmlColor", - "methodName": "constructor", - "static": false, - "returnType": "HtmlColor", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Provides predefined HTML colors as Color objects.", - "description": "Provides predefined HTML colors as Color objects.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/HtmlColor/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Ellipse/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt eine zufällige der benannten Farben zurück" + "description": "Erzeugt eine Ellipse im angegebenen Rechteck" } } }, @@ -2567,7 +2333,7 @@ ], "summary": "\"mod\" is an abbreviation for \"modulo\". Modulo returns what is left over when\nthe first input is divided by the second, with the sign of the second input,\nas the Scratch block does.", "description": "\"mod\" is an abbreviation for \"modulo\". Modulo returns what is left over when\nthe first input is divided by the second, with the sign of the second input,\nas the Scratch block does.", - "scratchblock": null, + "scratchblock": "((x) mod (y))", "paramDocs": [ "x: first value", "y: second value" @@ -2639,7 +2405,7 @@ ], "summary": "Rounds a number to a specified number of decimal places.", "description": "Rounds a number to a specified number of decimal places.", - "scratchblock": null, + "scratchblock": "(round (x))", "paramDocs": [ "x: a value", "precision: the number of decimal places to round to" @@ -2803,16 +2569,16 @@ "double" ], "parameterNames": [ - "c" + "by" ], "params": [ - "double c" + "double by" ], - "summary": "Change color via a hue value, which is added to the current hue value", - "description": "Change color via a hue value, which is added to the current hue value", + "summary": "", + "description": "", "scratchblock": "change pen [color v] by (c)", "paramDocs": [ - "c: a hue value [0...255]" + "by: how much to change the colour (hue, 0 to 100, going around)" ], "returns": null, "since": "", @@ -2837,16 +2603,16 @@ "double" ], "parameterNames": [ - "size" + "by" ], "params": [ - "double size" + "double by" ], - "summary": "Change the size of the pen", - "description": "Change the size of the pen", + "summary": "", + "description": "", "scratchblock": "change pen size by (size)", "paramDocs": [ - "size: size to change" + "by: how much to change the line width" ], "returns": null, "since": "", @@ -2871,16 +2637,16 @@ "double" ], "parameterNames": [ - "step" + "by" ], "params": [ - "double step" + "double by" ], - "summary": "Change the transparency by a step", - "description": "Change the transparency by a step", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "step: the step to change the transparency by" + "by: how much to change the transparency" ], "returns": null, "since": "", @@ -2904,8 +2670,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Pen object.", - "description": "Constructs a new Pen object.", + "summary": "A pen of your own, at (0, 0); add it to a stage with `stage.add(pen)`.", + "description": "A pen of your own, at (0, 0); add it to a stage with `stage.add(pen)`.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -2919,70 +2685,6 @@ } } }, - { - "id": "Pen/constructor(Sprite)", - "memberId": "Pen/constructor", - "owner": "org.openpatch.scratch.Pen", - "className": "Pen", - "methodName": "constructor", - "static": false, - "returnType": "Pen", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "s" - ], - "params": [ - "Sprite s" - ], - "summary": "Constructs a new Pen object associated with the given Sprite.", - "description": "Constructs a new Pen object associated with the given Sprite.", - "scratchblock": null, - "paramDocs": [ - "s: the Sprite object to associate with this Pen" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Senkt den Stift ab, so dass er beim Bewegen zeichnet" - } - } - }, - { - "id": "Pen/constructor(Pen)", - "memberId": "Pen/constructor", - "owner": "org.openpatch.scratch.Pen", - "className": "Pen", - "methodName": "constructor", - "static": false, - "returnType": "Pen", - "parameterTypes": [ - "org.openpatch.scratch.Pen" - ], - "parameterNames": [ - "p" - ], - "params": [ - "Pen p" - ], - "summary": "Copies a Pen object.", - "description": "Copies a Pen object.", - "scratchblock": null, - "paramDocs": [ - "p: Pen object to copy" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, { "id": "Pen/down()", "memberId": "Pen/down", @@ -2994,8 +2696,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Set the pen down.", - "description": "Set the pen down.", + "summary": "Puts the pen down: it leaves a dot, and a line wherever it moves.", + "description": "Puts the pen down: it leaves a dot, and a line wherever it moves.", "scratchblock": "pen down", "paramDocs": [], "returns": null, @@ -3016,8 +2718,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Erases all.", - "description": "Erases all.", + "summary": "Erases everything drawn on the pen's layer, by any pen or stamp.", + "description": "Erases everything drawn on the pen's layer, by any pen or stamp.", "scratchblock": "erase all", "paramDocs": [], "returns": null, @@ -3042,11 +2744,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current color of the pen.", - "description": "Retrieves the current color of the pen.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the color of the pen", + "returns": "the colour lines are drawn in", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getColor", "availability": "implemented", @@ -3058,83 +2760,97 @@ } }, { - "id": "Pen/getSize()", - "memberId": "Pen/getSize", + "id": "Pen/getLayer()", + "memberId": "Pen/getLayer", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "getSize", + "methodName": "getLayer", "static": false, - "returnType": "double", + "returnType": "Layer", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the size of the pen", - "description": "Returns the size of the pen", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the size of the pen", + "returns": "the layer whose canvas the pen draws on", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Strichstärke zurück" - } - } + "translations": {} }, { - "id": "Pen/goToBackground()", - "memberId": "Pen/goToBackground", + "id": "Pen/getPosition()", + "memberId": "Pen/getPosition", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "goToBackground", + "methodName": "getPosition", "static": false, - "returnType": "void", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Sets the pen to the background. This method changes the state of the pen to\nindicate that it is\nno longer in the foreground.", - "description": "Sets the pen to the background. This method changes the state of the pen to\nindicate that it is\nno longer in the foreground.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the pen's world position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/goToBackground", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zeichnet hinter den Figuren" - } - } + "translations": {} }, { - "id": "Pen/goToForeground()", - "memberId": "Pen/goToForeground", + "id": "Pen/getSize()", + "memberId": "Pen/getSize", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "goToForeground", + "methodName": "getSize", "static": false, - "returnType": "void", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves the pen to the foreground. This method sets the pen's state to indicate\nthat it is in the\nforeground.", - "description": "Moves the pen to the foreground. This method sets the pen's state to indicate\nthat it is in the\nforeground.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the line width in stage pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/goToForeground", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeichnet vor den Figuren" + "description": "Gibt die Strichstärke zurück" } } }, + { + "id": "Pen/getTransparency()", + "memberId": "Pen/getTransparency", + "owner": "org.openpatch.scratch.Pen", + "className": "Pen", + "methodName": "getTransparency", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the transparency in percent (0 opaque, 100 invisible)", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getTransparency", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Pen/goToMousePointer()", "memberId": "Pen/goToMousePointer", @@ -3146,8 +2862,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves the object to the current position of the mouse pointer.", - "description": "Moves the object to the current position of the mouse pointer.", + "summary": "Moves the pen to the mouse pointer, drawing if it is down.", + "description": "Moves the pen to the mouse pointer, drawing if it is down.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -3172,8 +2888,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves the object to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", - "description": "Moves the object to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", + "summary": "Moves the pen to a random position on the stage, drawing if it is down.", + "description": "Moves the pen to a random position on the stage, drawing if it is down.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -3188,30 +2904,26 @@ } }, { - "id": "Pen/isInBackground()", - "memberId": "Pen/isInBackground", + "id": "Pen/isDown()", + "memberId": "Pen/isDown", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "isInBackground", + "methodName": "isDown", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true if the pen is in the background.", - "description": "Returns true if the pen is in the background.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true if the pen is in the background", + "returns": "whether the pen is down and draws when it moves", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/isInBackground", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/isDown", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Stift hinter den Figuren zeichnet" - } - } + "translations": {} }, { "id": "Pen/setColor(Color)", @@ -3225,16 +2937,16 @@ "org.openpatch.scratch.Color" ], "parameterNames": [ - "c" + "color" ], "params": [ - "Color c" + "Color color" ], - "summary": "Set the color of the pen", - "description": "Set the color of the pen", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: color of the pen" + "color: the colour to draw lines in" ], "returns": null, "since": "", @@ -3259,16 +2971,16 @@ "double" ], "parameterNames": [ - "h" + "hue" ], "params": [ - "double h" + "double hue" ], - "summary": "Set color via hue value", - "description": "Set color via hue value", - "scratchblock": "set pen [color v] to (h)", + "summary": "Sets the colour by Scratch's colour number (hue) from 0 to 100, at full saturation and\nbrightness, like Scratch's \"set pen color to\".", + "description": "Sets the colour by Scratch's colour number (hue) from 0 to 100, at full saturation and\nbrightness, like Scratch's \"set pen color to\".", + "scratchblock": null, "paramDocs": [ - "h: a hue value [0...255]" + "hue: the colour from 0 to 100" ], "returns": null, "since": "", @@ -3295,22 +3007,22 @@ "double" ], "parameterNames": [ - "r", - "g", - "b" + "red", + "green", + "blue" ], "params": [ - "double r", - "double g", - "double b" + "double red", + "double green", + "double blue" ], - "summary": "Set color via rgb values", - "description": "Set color via rgb values", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", @@ -3323,6 +3035,36 @@ } } }, + { + "id": "Pen/setLayer(Layer)", + "memberId": "Pen/setLayer", + "owner": "org.openpatch.scratch.Pen", + "className": "Pen", + "methodName": "setLayer", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.Layer" + ], + "parameterNames": [ + "layer" + ], + "params": [ + "Layer layer" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "layer: the layer whose canvas the pen draws on" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/setLayer", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Pen/setPosition(double,double)", "memberId": "Pen/setPosition", @@ -3343,12 +3085,12 @@ "double x", "double y" ], - "summary": "Set the position if the pen is down.", - "description": "Set the position if the pen is down.", + "summary": "Moves the pen, drawing a line from where it was if it is down.", + "description": "Moves the pen, drawing a line from where it was if it is down.", "scratchblock": null, "paramDocs": [ - "x: x coordinate", - "y: y coordinate" + "x: world x", + "y: world y" ], "returns": null, "since": "", @@ -3373,16 +3115,16 @@ "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "v" + "position" ], "params": [ - "Vector2 v" + "Vector2 position" ], - "summary": "Sets the position of the pen using a Vector2 object.", - "description": "Sets the position of the pen using a Vector2 object.", + "summary": "Moves the pen, drawing a line from where it was if it is down.", + "description": "Moves the pen, drawing a line from where it was if it is down.", "scratchblock": null, "paramDocs": [ - "v: the Vector2 object containing the new x and y coordinates" + "position: world position" ], "returns": null, "since": "", @@ -3412,11 +3154,11 @@ "params": [ "double size" ], - "summary": "Set the size of the pen", - "description": "Set the size of the pen", + "summary": "", + "description": "", "scratchblock": "set pen size to (size)", "paramDocs": [ - "size: size of the pen" + "size: the line width in stage pixels (at least 1)" ], "returns": null, "since": "", @@ -3446,11 +3188,11 @@ "params": [ "double transparency" ], - "summary": "Set the transparency", - "description": "Set the transparency", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "transparency: transparency of the pen" + "transparency: in percent (0 opaque, 100 invisible)" ], "returns": null, "since": "", @@ -3474,8 +3216,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Stamps the current sprite onto the canvas. If the sprite is not null, it will\nstamp either to\nthe foreground or the background based on the value of the isForeground flag.", - "description": "Stamps the current sprite onto the canvas. If the sprite is not null, it will\nstamp either to\nthe foreground or the background based on the value of the isForeground flag.", + "summary": "Stamps the pen's sprite onto the pen's layer, like Scratch's \"stamp\" block.", + "description": "Stamps the pen's sprite onto the pen's layer, like Scratch's \"stamp\" block.", "scratchblock": "stamp", "paramDocs": [], "returns": null, @@ -3500,8 +3242,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Move the pen up.", - "description": "Move the pen up.", + "summary": "Lifts the pen: it no longer draws.", + "description": "Lifts the pen: it no longer draws.", "scratchblock": "pen up", "paramDocs": [], "returns": null, @@ -3515,6 +3257,178 @@ } } }, + { + "id": "Pixels/getArgb(int,int)", + "memberId": "Pixels/getArgb", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getArgb", + "static": false, + "returnType": "int", + "parameterTypes": [ + "int", + "int" + ], + "parameterNames": [ + "x", + "y" + ], + "params": [ + "int x", + "int y" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "x: pixels from the left edge", + "y: pixels from the top edge" + ], + "returns": "the colour there packed as alpha, red, green, blue, or 0 outside", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getArgb", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/getColor(int,int)", + "memberId": "Pixels/getColor", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getColor", + "static": false, + "returnType": "Color", + "parameterTypes": [ + "int", + "int" + ], + "parameterNames": [ + "x", + "y" + ], + "params": [ + "int x", + "int y" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "x: pixels from the left edge", + "y: pixels from the top edge" + ], + "returns": "the colour there, or transparent black outside", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getColor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/getHeight()", + "memberId": "Pixels/getHeight", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getHeight", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the height in pixels", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getHeight", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/getWidth()", + "memberId": "Pixels/getWidth", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getWidth", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the width in pixels", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getWidth", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/of(Stage)", + "memberId": "Pixels/of", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "of", + "static": true, + "returnType": "Pixels", + "parameterTypes": [ + "org.openpatch.scratch.Stage" + ], + "parameterNames": [ + "stage" + ], + "params": [ + "Stage stage" + ], + "summary": "The stage's pixels as they are now.", + "description": "The stage's pixels as they are now.", + "scratchblock": null, + "paramDocs": [ + "stage: the stage" + ], + "returns": "its pixels, at stage size", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/of", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/of(String)", + "memberId": "Pixels/of", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "of", + "static": true, + "returnType": "Pixels", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "imagePath" + ], + "params": [ + "String imagePath" + ], + "summary": "The pixels of an image file.", + "description": "The pixels of an image file.", + "scratchblock": null, + "paramDocs": [ + "imagePath: the image" + ], + "returns": "its pixels", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/of", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Polygon/addPoint(double,double)", "memberId": "Polygon/addPoint", @@ -3535,12 +3449,12 @@ "double x", "double y" ], - "summary": "Adds a point to the polygon.", - "description": "Adds a point to the polygon.", + "summary": "Adds a corner after the last one.", + "description": "Adds a corner after the last one.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate", - "y: the y-coordinate" + "x: x of the corner", + "y: y of the corner" ], "returns": null, "since": "", @@ -3564,8 +3478,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates an empty polygon.", - "description": "Creates an empty polygon.", + "summary": "A polygon without corners yet; add them with [addPoint(double, double)](addPoint).", + "description": "A polygon without corners yet; add them with [addPoint(double, double)](addPoint).", "scratchblock": null, "paramDocs": [], "returns": null, @@ -3599,12 +3513,12 @@ "double[] xPoints", "double[] yPoints" ], - "summary": "Creates a polygon with the specified vertices.", - "description": "Creates a polygon with the specified vertices.", + "summary": "A polygon given by its corners, concave ones included. The outline closes by itself.", + "description": "A polygon given by its corners, concave ones included. The outline closes by itself.", "scratchblock": null, "paramDocs": [ - "xPoints: an array of x-coordinates", - "yPoints: an array of y-coordinates" + "xPoints: x of every corner", + "yPoints: y of every corner, in the same order" ], "returns": null, "since": "", @@ -4099,14 +4013,14 @@ "double width", "double height" ], - "summary": "Creates a rectangle with the specified position and size.", - "description": "Creates a rectangle with the specified position and size.", + "summary": "A rectangle along the axes.", + "description": "A rectangle along the axes.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate of the rectangle's top-left corner", - "y: the y-coordinate of the rectangle's top-left corner", - "width: the width of the rectangle", - "height: the height of the rectangle" + "x: the smallest x", + "y: the smallest y", + "width: the width", + "height: the height" ], "returns": null, "since": "", @@ -4120,1085 +4034,1995 @@ } }, { - "id": "Shape/contains(double,double)", - "memberId": "Shape/contains", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "contains", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "x", - "y" - ], - "params": [ - "double x", - "double y" - ], - "summary": "Check if the shape contains a point defined by its x and y coordinates.", - "description": "Check if the shape contains a point defined by its x and y coordinates.", - "scratchblock": null, - "paramDocs": [ - "x: the x-coordinate of the point", - "y: the y-coordinate of the point" - ], - "returns": "true if the shape contains the point, false otherwise", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/contains", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Punkt in der Form liegt" - } - } - }, - { - "id": "Shape/getBounds()", - "memberId": "Shape/getBounds", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "getBounds", + "id": "Shader/getName()", + "memberId": "Shader/getName", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "getName", "static": false, - "returnType": "Bounds", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the bounds of the shape.", - "description": "Get the bounds of the shape.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "a Bounds object representing the bounding box of the shape", + "returns": "the shader's name", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/getBounds", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/getName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt das umschließende Rechteck zurück" - } - } + "translations": {} }, { - "id": "Shape/intersects(Shape)", - "memberId": "Shape/intersects", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "intersects", + "id": "Shader/set(String,double)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Shape" + "java.lang.String", + "double" ], "parameterNames": [ - "other" + "uniform", + "value" ], "params": [ - "Shape other" + "String uniform", + "double value" ], - "summary": "Check if the shape intersects with another shape.", - "description": "Check if the shape intersects with another shape.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "other: the other shape to check intersection with" + "uniform: the uniform's name in the shader", + "value: an `int` or `float` uniform's value" ], - "returns": "true if the shapes intersect, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/intersects", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn sich beide Formen überlappen" - } - } + "translations": {} }, { - "id": "Shape/rotate(double,double,double)", - "memberId": "Shape/rotate", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "rotate", + "id": "Shader/set(String,int)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "Shape", + "returnType": "void", "parameterTypes": [ - "double", - "double", - "double" + "java.lang.String", + "int" ], "parameterNames": [ - "theta", - "anchorX", - "anchorY" + "uniform", + "value" ], "params": [ - "double theta", - "double anchorX", - "double anchorY" + "String uniform", + "int value" ], - "summary": "Rotate the shape by the specified angle around a given anchor point.", - "description": "Rotate the shape by the specified angle around a given anchor point.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "theta: the angle in degrees to rotate", - "anchorX: the x-coordinate of the anchor point", - "anchorY: the y-coordinate of the anchor point" + "uniform: the uniform's name", + "value: an `int` uniform's value" ], - "returns": "a new Shape object that is rotated", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/rotate", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die um theta Grad gedrehte Form als neue Form zurück" - } - } + "translations": {} }, { - "id": "Shape/scale(double,double)", - "memberId": "Shape/scale", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "scale", + "id": "Shader/set(String,boolean)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "Shape", + "returnType": "void", "parameterTypes": [ - "double", - "double" + "java.lang.String", + "boolean" ], "parameterNames": [ - "scaleX", - "scaleY" + "uniform", + "value" ], "params": [ - "double scaleX", - "double scaleY" + "String uniform", + "boolean value" ], - "summary": "Check if the shape is empty.", - "description": "Check if the shape is empty.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "scaleX: ", - "scaleY: " + "uniform: the uniform's name", + "value: a `bool` uniform's value" ], - "returns": "true if the shape is empty, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/scale", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die skalierte Form als neue Form zurück" - } - } + "translations": {} }, { - "id": "Shape/translate(double,double)", - "memberId": "Shape/translate", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "translate", + "id": "Shader/set(String,double,double)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "Shape", + "returnType": "void", "parameterTypes": [ + "java.lang.String", "double", "double" ], "parameterNames": [ - "dx", - "dy" + "uniform", + "x", + "y" ], "params": [ - "double dx", - "double dy" + "String uniform", + "double x", + "double y" ], - "summary": "Translate the shape by the specified distances in the x and y directions.", - "description": "Translate the shape by the specified distances in the x and y directions.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "dx: the distance to translate in the x direction", - "dy: the distance to translate in the y direction" + "uniform: the uniform's name", + "x: a `vec2`'s x", + "y: a `vec2`'s y" ], - "returns": "a new Shape object that is translated", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/translate", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die verschobene Form als neue Form zurück" - } - } + "translations": {} }, { - "id": "Sprite/addCostume(String)", - "memberId": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostume", + "id": "Shader/set(String,Vector2)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "name" + "uniform", + "value" ], "params": [ - "String name" + "String uniform", + "Vector2 value" ], - "summary": "Add one of the costumes that ship with Scratch for Java to the sprite. The\ncostume gets the same name as the built-in sprite. If a costume with that\nname already exists do nothing.", - "description": "Add one of the costumes that ship with Scratch for Java to the sprite. The\ncostume gets the same name as the built-in sprite. If a costume with that\nname already exists do nothing.\n\nExample usage:\n\n```java\nthis.addCostume(\"bunny1_jump\");\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of a built-in sprite, for example \"bunny1_jump\". Add\n the sheet in front of the name, for example\n \"platformer/grass\", if the same name exists on several sheets." + "uniform: the uniform's name", + "value: a `vec2`" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt eines der eingebauten Kostüme hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addCostume(String,String)", - "memberId": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostume", + "id": "Shader/set(String,Color)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "name", - "imagePath" + "uniform", + "color" ], "params": [ - "String name", - "String imagePath" + "String uniform", + "Color color" ], - "summary": "Add a costume to the sprite. If a costume with the received name already\nexists do nothing.", - "description": "Add a costume to the sprite. If a costume with the received name already\nexists do nothing.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: a unique name", - "imagePath: a image path, or the name of a built-in sprite such as\n \"bunny1_jump\"" + "uniform: the uniform's name", + "color: a `vec4`: red, green, blue and alpha from 0 to 1" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt ein Kostüm unter eigenem Namen hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addCostume(String,String,int,int,int,int)", - "memberId": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostume", + "id": "Shader/set(String,double[],int)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "int", - "int", - "int", + "double[]", "int" ], "parameterNames": [ - "name", - "spriteSheetPath", - "x", - "y", - "width", - "height" + "uniform", + "values", + "perElement" ], "params": [ - "String name", - "String spriteSheetPath", - "int x", - "int y", - "int width", - "int height" + "String uniform", + "double[] values", + "int perElement" ], - "summary": "Adds a new costume to the sprite if a costume with the same name does not\nalready exist.", - "description": "Adds a new costume to the sprite if a costume with the same name does not\nalready exist.", + "summary": "An array uniform such as `uniform vec3 lights[100];`.", + "description": "An array uniform such as `uniform vec3 lights[100];`.", "scratchblock": null, "paramDocs": [ - "name: The name of the costume.", - "spriteSheetPath: The path to the sprite sheet image file.", - "x: The x-coordinate of the top-left corner of the costume\n in the sprite sheet.", - "y: The y-coordinate of the top-left corner of the costume\n in the sprite sheet.", - "width: The width of the costume in the sprite sheet.", - "height: The height of the costume in the sprite sheet." + "uniform: the uniform's name", + "values: all values, one element after the other", + "perElement: values per element: 1 for `float[]`, 3 for `vec3[]`" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schneidet ein Kostüm aus einem Bild aus" - } - } + "translations": {} }, { - "id": "Sprite/addCostumes(String,String,int,int)", - "memberId": "Sprite/addCostumes", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostumes", + "id": "Shader/setName(String)", + "memberId": "Shader/setName", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "setName", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "prefix", - "spriteSheet", - "tileWidth", - "tileHeight" + "name" ], "params": [ - "String prefix", - "String spriteSheet", - "int tileWidth", - "int tileHeight" + "String name" ], - "summary": "Adds all tiles from a spritesheet as costumes. The costumes will be name by\nthe prefix and the\nindex in the spritesheet. For example if the prefix is \"tile\" and the\nspritesheet contains 4\ntiles, the costumes will be named \"tile0\", \"tile1\", \"tile2\", and \"tile3\".", - "description": "Adds all tiles from a spritesheet as costumes. The costumes will be name by\nthe prefix and the\nindex in the spritesheet. For example if the prefix is \"tile\" and the\nspritesheet contains 4\ntiles, the costumes will be named \"tile0\", \"tile1\", \"tile2\", and \"tile3\".", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "prefix: a prefix for all generated costumes", - "spriteSheet: a path to a sprite sheet, or the name of a built-in sprite", - "tileWidth: the width of a single tile", - "tileHeight: the height of a single tile" + "name: a new name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostumes", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/setName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zerschneidet ein Bild in gleich große Kacheln und fügt sie als Kostüme hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addSound(String,String)", - "memberId": "Sprite/addSound", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addSound", + "id": "Shaders/activate(String)", + "memberId": "Shaders/activate", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "activate", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", "java.lang.String" ], "parameterNames": [ - "name", - "soundPath" + "name" ], "params": [ - "String name", - "String soundPath" + "String name" ], - "summary": "Add a sound to the sprite. If a sound with the received name already exists\ndo nothing.", - "description": "Add a sound to the sprite. If a sound with the received name already exists\ndo nothing.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: a unique name", - "soundPath: a sound path, or the name of a built-in sound such as\n \"footstep_carpet_000\"" + "name: a shader to use in addition to the active ones" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/activate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt einen Klang unter eigenem Namen hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addSound(String)", - "memberId": "Sprite/addSound", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addSound", + "id": "Shaders/add(String,String)", + "memberId": "Shaders/add", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "add", "static": false, - "returnType": "void", + "returnType": "Shader", "parameterTypes": [ + "java.lang.String", "java.lang.String" ], "parameterNames": [ - "name" + "name", + "fragmentPath" ], "params": [ - "String name" + "String name", + "String fragmentPath" ], - "summary": "Add one of the sounds that ship with Scratch for Java to the sprite. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.", - "description": "Add one of the sounds that ship with Scratch for Java to the sprite. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.\n\nExample usage:\n\n```java\nthis.addSound(\"footstep_carpet_000\");\n```", + "summary": "Adds a shader, or returns the one of that name added before.", + "description": "Adds a shader, or returns the one of that name added before.", "scratchblock": null, "paramDocs": [ - "name: the name of a built-in sound, for example \"footstep_carpet_000\"" + "name: the shader's name", + "fragmentPath: the file with the shader's body" ], - "returns": null, + "returns": "the shader, to set its uniforms", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt einen der eingebauten Klänge hinzu" - } - } + "translations": {} }, { - "id": "Sprite/ask(String)", - "memberId": "Sprite/ask", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "ask", + "id": "Shaders/deactivate(String)", + "memberId": "Shaders/deactivate", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "deactivate", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "question" + "name" ], "params": [ - "String question" + "String name" ], - "summary": "Asks a question and waits for an answer to be typed in. The question appears\nat the top of the stage.", - "description": "Asks a question and waits for an answer to be typed in. The question appears\nat the top of the stage.\n\nUnlike Scratch, this does not pause the sprite. `run()` keeps being called\nwhile the question is on screen, so check [isAsking()](isAsking) or wait for\n[getAnswer()](getAnswer) to change.", - "scratchblock": "ask [question] and wait", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "question: the question to show" + "name: a shader to stop using" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ask", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/deactivate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" - } - } + "translations": {} }, { - "id": "Sprite/broadcast(String)", - "memberId": "Sprite/broadcast", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "broadcast", + "id": "Shaders/get(String)", + "memberId": "Shaders/get", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "get", "static": false, - "returnType": "void", + "returnType": "Shader", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "message" + "name" ], "params": [ - "String message" + "String name" ], - "summary": "Broadcasts a message to every sprite on the stage, this one included, and\nto the stage itself, as in Scratch. If the sprite is not on a stage, nothing\nhappens.", - "description": "Broadcasts a message to every sprite on the stage, this one included, and\nto the stage itself, as in Scratch. If the sprite is not on a stage, nothing\nhappens.", - "scratchblock": "broadcast [message v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "message: The message to broadcast." + "name: a shader's name" ], - "returns": null, + "returns": "the shader, or null", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/broadcast", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/get", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Sendet eine Nachricht an alle Figuren und die Bühne" - } - } + "translations": {} }, { - "id": "Sprite/changePosition(Vector2)", - "memberId": "Sprite/changePosition", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changePosition", + "id": "Shaders/getActive()", + "memberId": "Shaders/getActive", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getActive", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Vector2" - ], - "parameterNames": [ - "v" - ], - "params": [ - "Vector2 v" - ], - "summary": "Changes the position of the sprite by a given vector.", - "description": "Changes the position of the sprite by a given vector.", + "returnType": "List", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "v: a vector representing the change in position" - ], - "returns": null, + "paramDocs": [], + "returns": "the shaders in use, in order", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getActive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Verschiebt die Figur um den angegebenen Vektor" - } - } + "translations": {} }, { - "id": "Sprite/changePosition(double,double)", - "memberId": "Sprite/changePosition", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changePosition", + "id": "Shaders/getCurrent()", + "memberId": "Shaders/getCurrent", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getCurrent", "static": false, - "returnType": "void", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "x", - "y" - ], - "params": [ - "double x", - "double y" - ], - "summary": "Changes the position of the sprite by the given amounts.", - "description": "Changes the position of the sprite by the given amounts.", + "returnType": "Shader", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "x: how far to move along the x-axis", - "y: how far to move along the y-axis" - ], - "returns": null, + "paramDocs": [], + "returns": "the first shader in use, or null", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getCurrent", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Verschiebt die Figur um die angegebenen Werte" - } - } + "translations": {} }, { - "id": "Sprite/changeSize(double)", - "memberId": "Sprite/changeSize", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeSize", + "id": "Shaders/getCurrentIndex()", + "memberId": "Shaders/getCurrentIndex", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getCurrentIndex", "static": false, - "returnType": "void", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the number of the first shader in use, or -1", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getCurrentIndex", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Shaders/getCurrentName()", + "memberId": "Shaders/getCurrentName", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getCurrentName", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the name of the first shader in use, or null", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getCurrentName", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Shaders/isActive(String)", + "memberId": "Shaders/isActive", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "isActive", + "static": false, + "returnType": "boolean", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "amount" + "name" ], "params": [ - "double amount" + "String name" ], - "summary": "Changes the size of the sprite by a given percentage.", - "description": "Changes the size of the sprite by a given percentage.", - "scratchblock": "change size by (amount)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "amount: a percentage [0...100]" + "name: a shader's name" ], - "returns": null, + "returns": "whether it is in use", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/isActive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Größe um den angegebenen Wert in Prozent" - } - } + "translations": {} }, { - "id": "Sprite/changeTint(double)", - "memberId": "Sprite/changeTint", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeTint", + "id": "Shaders/next()", + "memberId": "Shaders/next", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "next", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "step" - ], - "params": [ - "double step" - ], - "summary": "Changes the tint for the sprite by a step.", - "description": "Changes the tint for the sprite by a step.", - "scratchblock": "change [color v] effect by (step)", - "paramDocs": [ - "step: a step value" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Uses the next shader alone.", + "description": "Uses the next shader alone.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/next", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert den Farbton der Einfärbung um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeTransparency(double)", - "memberId": "Sprite/changeTransparency", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeTransparency", + "id": "Shaders/reset()", + "memberId": "Shaders/reset", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "reset", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "step" - ], - "params": [ - "double step" - ], - "summary": "Changes how see-through the sprite is by a step. A positive step fades it\nout, a negative one brings it back.", - "description": "Changes how see-through the sprite is by a step. A positive step fades it\nout, a negative one brings it back.", - "scratchblock": "change [ghost v] effect by (step)", - "paramDocs": [ - "step: a step value" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Uses no shader.", + "description": "Uses no shader.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/reset", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Transparenz um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeVolume(double)", - "memberId": "Sprite/changeVolume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeVolume", + "id": "Shaders/switchTo(String)", + "memberId": "Shaders/switchTo", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "switchTo", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "step" + "name" ], "params": [ - "double step" + "String name" ], - "summary": "Makes every sound of this sprite louder or quieter.", - "description": "Makes every sound of this sprite louder or quieter.", - "scratchblock": "change volume by (step)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "step: how much to add to the volume, in percent" + "name: the shader to use, alone" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/switchTo", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Lautstärke um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeX(double)", - "memberId": "Sprite/changeX", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeX", + "id": "Shaders/switchTo(double)", + "memberId": "Shaders/switchTo", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "switchTo", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "x" + "index" ], "params": [ - "double x" + "double index" ], - "summary": "Changes x by a certain amount", - "description": "Changes x by a certain amount", - "scratchblock": "change x by (x)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "x: number in pixels" + "index: the shader to use alone, counting from 0; wraps around" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/switchTo", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die x-Position um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeY(double)", - "memberId": "Sprite/changeY", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeY", + "id": "Shape/contains(double,double)", + "memberId": "Shape/contains", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "contains", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ + "double", "double" ], "parameterNames": [ + "x", "y" ], "params": [ + "double x", "double y" ], - "summary": "Changes y by a certain amount", - "description": "Changes y by a certain amount", - "scratchblock": "change y by (y)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "y: number in pixels" + "x: x of a point", + "y: y of a point" ], - "returns": null, + "returns": "whether the point lies inside the shape", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/contains", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert die y-Position um den angegebenen Wert" + "description": "Gibt genau dann true zurück, wenn der Punkt in der Form liegt" } } }, { - "id": "Sprite/clone()", - "memberId": "Sprite/clone", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "clone", + "id": "Shape/getBounds()", + "memberId": "Shape/getBounds", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "getBounds", "static": false, - "returnType": "Sprite", + "returnType": "Bounds", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a clone of this sprite, like Scratch's \"create clone of myself\": a\nnew sprite of the same class (a clone of a `Cat` is a `Cat`),\nwith the same costume, position, direction, size and pen, and a copy of\nthe variables of your class. It is put on the stage right behind this\nsprite, and its [whenStartsAsClone()](whenStartsAsClone) runs; the constructor does\nnot run again.", - "description": "Creates a clone of this sprite, like Scratch's \"create clone of myself\": a\nnew sprite of the same class (a clone of a `Cat` is a `Cat`),\nwith the same costume, position, direction, size and pen, and a copy of\nthe variables of your class. It is put on the stage right behind this\nsprite, and its [whenStartsAsClone()](whenStartsAsClone) runs; the constructor does\nnot run again.\n\nNumbers, text and booleans in your variables are the clone's own. A list\nor another object is shared with the original: give the clone its own in\n[whenStartsAsClone()](whenStartsAsClone) if it needs one.\n\n```java\nBullet bullet = (Bullet) this.clone();\n```", - "scratchblock": "create clone of [myself v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "the clone, of the same class as this sprite", + "returns": "the smallest rectangle around the shape", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/clone", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/getBounds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt das umschließende Rechteck zurück" + } + } }, { - "id": "Sprite/constructor()", - "memberId": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "constructor", + "id": "Shape/getPoints()", + "memberId": "Shape/getPoints", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "getPoints", "static": false, - "returnType": "Sprite", + "returnType": "double[]", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Sprite object with default settings.", - "description": "Constructs a new Sprite object with default settings.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the outline's points `x0, y0, x1, y1, \\u2026` (a copy)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/getPoints", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Shape/intersects(Shape)", + "memberId": "Shape/intersects", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "intersects", + "static": false, + "returnType": "boolean", + "parameterTypes": [ + "org.openpatch.scratch.Shape" + ], + "parameterNames": [ + "other" + ], + "params": [ + "Shape other" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "other: another shape" + ], + "returns": "whether the two shapes overlap with some area; shapes that only touch do not", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/intersects", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine neue Figur" + "description": "Gibt genau dann true zurück, wenn sich beide Formen überlappen" } } }, { - "id": "Sprite/constructor(String,String)", - "memberId": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "constructor", + "id": "Shape/rotate(double,double,double)", + "memberId": "Shape/rotate", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "rotate", "static": false, - "returnType": "Sprite", + "returnType": "Shape", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "double", + "double", + "double" ], "parameterNames": [ - "name", - "imagePath" + "degrees", + "anchorX", + "anchorY" ], "params": [ - "String name", - "String imagePath" + "double degrees", + "double anchorX", + "double anchorY" ], - "summary": "Constructs a new Sprite object with a specified costume.", - "description": "Constructs a new Sprite object with a specified costume.", + "summary": "Turns the shape about a point, from the x axis towards the y axis (anticlockwise when y points\nup).", + "description": "Turns the shape about a point, from the x axis towards the y axis (anticlockwise when y points\nup).", "scratchblock": null, "paramDocs": [ - "name: a unique name for the costume", - "imagePath: a path to an image file, or the name of a built-in sprite\n such as \"slimeGreen\"" + "degrees: the angle", + "anchorX: x of the point to turn about", + "anchorY: y of the point to turn about" ], - "returns": null, + "returns": "the shape turned", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/rotate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Figur mit einem ersten Kostüm" + "description": "Gibt die um theta Grad gedrehte Form als neue Form zurück" } } }, { - "id": "Sprite/constructor(Sprite)", - "memberId": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "constructor", + "id": "Shape/scale(double,double)", + "memberId": "Shape/scale", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "scale", "static": false, - "returnType": "Sprite", + "returnType": "Shape", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "double", + "double" ], "parameterNames": [ - "s" + "scaleX", + "scaleY" ], "params": [ - "Sprite s" + "double scaleX", + "double scaleY" ], - "summary": "Copies a Sprite object.", - "description": "Copies a Sprite object.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "s: a Sprite object to copy" + "scaleX: factor along x (negative mirrors)", + "scaleY: factor along y" ], - "returns": null, + "returns": "the shape scaled about the origin", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/scale", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Kopie der angegebenen Figur" + "description": "Gibt die skalierte Form als neue Form zurück" } } }, { - "id": "Sprite/debug(Object[])", - "memberId": "Sprite/debug", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "debug", + "id": "Shape/translate(double,double)", + "memberId": "Shape/translate", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "translate", "static": false, - "returnType": "void", + "returnType": "Shape", "parameterTypes": [ - "java.lang.Object[]" + "double", + "double" ], "parameterNames": [ - "values" + "dx", + "dy" ], "params": [ - "Object[] values" + "double dx", + "double dy" ], - "summary": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the sprite's class name so you can tell\nwhich sprite it came from.", - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the sprite's class name so you can tell\nwhich sprite it came from.\n\nExample:\n\n```java\nthis.debug(\"x =\", getX(), \"y =\", getY());\n// prints: [CatSprite] x = 100.0 y = 200.0\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "values: one or more values to print" + "dx: distance along x", + "dy: distance along y" ], - "returns": null, + "returns": "the shape moved", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/debug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/translate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt die verschobene Form als neue Form zurück" + } + } }, { - "id": "Sprite/deleteThisClone()", - "memberId": "Sprite/deleteThisClone", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "deleteThisClone", + "id": "SoundPlayback/isPlaying()", + "memberId": "SoundPlayback/isPlaying", + "owner": "org.openpatch.scratch.SoundPlayback", + "className": "SoundPlayback", + "methodName": "isPlaying", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes this sprite from the stage if it is a clone, like Scratch's\n\"delete this clone\". The original stays.", - "description": "Removes this sprite from the stage if it is a clone, like Scratch's\n\"delete this clone\". The original stays.", - "scratchblock": "delete this clone", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether this copy still plays", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/deleteThisClone", + "docsUrl": "https://scratch4j.openpatch.org/reference/SoundPlayback/isPlaying", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Sprite/disableHitbox()", - "memberId": "Sprite/disableHitbox", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "disableHitbox", + "id": "SoundPlayback/setVolume(double)", + "memberId": "SoundPlayback/setVolume", + "owner": "org.openpatch.scratch.SoundPlayback", + "className": "SoundPlayback", + "methodName": "setVolume", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Disables the hitbox for the sprite. Once the hitbox is disabled, the sprite\nwill no longer\ndetect collisions with other objects.", - "description": "Disables the hitbox for the sprite. Once the hitbox is disabled, the sprite\nwill no longer\ndetect collisions with other objects.", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "volume" + ], + "params": [ + "double volume" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "volume: from 0 to 100" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/disableHitbox", + "docsUrl": "https://scratch4j.openpatch.org/reference/SoundPlayback/setVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schaltet die Berührungserkennung aus" - } - } + "translations": {} }, { - "id": "Sprite/distanceToMousePointer()", - "memberId": "Sprite/distanceToMousePointer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "distanceToMousePointer", + "id": "SoundPlayback/stop()", + "memberId": "SoundPlayback/stop", + "owner": "org.openpatch.scratch.SoundPlayback", + "className": "SoundPlayback", + "methodName": "stop", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Calculates the distance from the current sprite to the mouse pointer.", - "description": "Calculates the distance from the current sprite to the mouse pointer.", - "scratchblock": "(distance to [mouse-pointer v])", + "summary": "Stops this copy.", + "description": "Stops this copy.", + "scratchblock": null, "paramDocs": [], - "returns": "the distance to the mouse pointer as a double.", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToMousePointer", + "docsUrl": "https://scratch4j.openpatch.org/reference/SoundPlayback/stop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Abstand zum Mauszeiger zurück" - } - } + "translations": {} }, { - "id": "Sprite/distanceToSprite(Sprite)", - "memberId": "Sprite/distanceToSprite", + "id": "Sprite/addAnimation(String,String,int)", + "memberId": "Sprite/addAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "distanceToSprite", + "methodName": "addAnimation", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "java.lang.String", + "java.lang.String", + "int" ], "parameterNames": [ - "sprite" + "name", + "pattern", + "frames" ], "params": [ - "Sprite sprite" + "String name", + "String pattern", + "int frames" ], - "summary": "Calculates the Euclidean distance between this sprite and another sprite.", - "description": "Calculates the Euclidean distance between this sprite and another sprite.", - "scratchblock": "(distance to [sprite v])", + "summary": "Adds an animation from numbered image files: the pattern's `%d` counts from 1.", + "description": "Adds an animation from numbered image files: the pattern's `%d` counts from 1.\n\n```java\nthis.addAnimation(\"walk\", \"assets/walk%d.png\", 4); // walk1.png \\u2026 walk4.png\n```", + "scratchblock": null, "paramDocs": [ - "sprite: the other sprite to which the distance is calculated" + "name: the animation's name", + "pattern: the file names, with `%d` for the frame number", + "frames: how many frames" ], - "returns": "the distance between this sprite and the specified sprite", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addAnimation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Abstand zu einer anderen Figur zurück" - } - } + "translations": {} }, { - "id": "Sprite/enableHitbox()", - "memberId": "Sprite/enableHitbox", + "id": "Sprite/addAnimation(String,String,int,int)", + "memberId": "Sprite/addAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "enableHitbox", + "methodName": "addAnimation", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Enables the hitbox for the sprite. This method sets the hitboxDisabled flag\nto false, allowing\nthe sprite to interact with other objects.", - "description": "Enables the hitbox for the sprite. This method sets the hitboxDisabled flag\nto false, allowing\nthe sprite to interact with other objects.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/enableHitbox", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int" + ], + "parameterNames": [ + "name", + "pattern", + "from", + "to" + ], + "params": [ + "String name", + "String pattern", + "int from", + "int to" + ], + "summary": "Adds an animation from numbered image files, from one number to another: for files that count\nfrom 0, or to use only some of them. If `to` is smaller than `from`, it counts down.", + "description": "Adds an animation from numbered image files, from one number to another: for files that count\nfrom 0, or to use only some of them. If `to` is smaller than `from`, it counts down.\n\n```java\nthis.addAnimation(\"hit\", \"assets/hit%d.png\", 0, 4); // hit0.png \\u2026 hit4.png\n```", + "scratchblock": null, + "paramDocs": [ + "name: the animation's name", + "pattern: the file names, with `%d` for the frame number", + "from: the number of the first frame", + "to: the number of the last frame" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addAnimation", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/addAnimation(String,String,int,int,int[])", + "memberId": "Sprite/addAnimation", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addAnimation", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int", + "int[]" + ], + "parameterNames": [ + "name", + "sheetPath", + "width", + "height", + "frames" + ], + "params": [ + "String name", + "String sheetPath", + "int width", + "int height", + "int[] frames" + ], + "summary": "Adds an animation from a sprite sheet: frames of equal size, numbered row by row from the\ntop left, starting at 0.", + "description": "Adds an animation from a sprite sheet: frames of equal size, numbered row by row from the\ntop left, starting at 0.\n\n```java\nthis.addAnimation(\"walk\", \"assets/walk.png\", 32, 32, 0, 1, 2, 3); // the first row\nthis.addAnimation(\"down\", \"assets/hero.png\", 32, 32, 0, 4, 8, 12); // the first column of 4\n```", + "scratchblock": null, + "paramDocs": [ + "name: the animation's name", + "sheetPath: the sprite sheet", + "width: the width of a frame", + "height: the height of a frame", + "frames: the frames to show, in order" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addAnimation", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/addCostume(String,String)", + "memberId": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "imagePath" + ], + "params": [ + "String name", + "String imagePath" + ], + "summary": "Adds a costume from an image file. The first costume added is the one the sprite wears.", + "description": "Adds a costume from an image file. The first costume added is the one the sprite wears.", + "scratchblock": null, + "paramDocs": [ + "name: the costume's name, for [switchCostume(String)](switchCostume)", + "imagePath: the image file (PNG, JPEG, GIF, BMP or TGA)" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt ein Kostüm unter eigenem Namen hinzu" + } + } + }, + { + "id": "Sprite/addCostume(String)", + "memberId": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "imagePath" + ], + "params": [ + "String imagePath" + ], + "summary": "Adds a costume from an image file, named after the file.", + "description": "Adds a costume from an image file, named after the file.", + "scratchblock": null, + "paramDocs": [ + "imagePath: the image file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt eines der eingebauten Kostüme hinzu" + } + } + }, + { + "id": "Sprite/addCostume(String,String,int,int,int,int)", + "memberId": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int", + "int", + "int" + ], + "parameterNames": [ + "name", + "imagePath", + "x", + "y", + "width", + "height" + ], + "params": [ + "String name", + "String imagePath", + "int x", + "int y", + "int width", + "int height" + ], + "summary": "Adds a costume cut out of a larger image, e.g. one frame of a sprite sheet.", + "description": "Adds a costume cut out of a larger image, e.g. one frame of a sprite sheet.", + "scratchblock": null, + "paramDocs": [ + "name: the costume's name", + "imagePath: the image file", + "x: left edge of the part, in pixels", + "y: top edge of the part, in pixels", + "width: width of the part", + "height: height of the part" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Schneidet ein Kostüm aus einem Bild aus" + } + } + }, + { + "id": "Sprite/addCostumes(String,String,int,int)", + "memberId": "Sprite/addCostumes", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostumes", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int" + ], + "parameterNames": [ + "name", + "imagePath", + "width", + "height" + ], + "params": [ + "String name", + "String imagePath", + "int width", + "int height" + ], + "summary": "Adds every frame of a sprite sheet as a costume, row by row, named `name0`,\n`name1`, \\u2026", + "description": "Adds every frame of a sprite sheet as a costume, row by row, named `name0`,\n`name1`, \\u2026", + "scratchblock": null, + "paramDocs": [ + "name: the start of the costumes' names", + "imagePath: the image file", + "width: width of one frame", + "height: height of one frame" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostumes", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Zerschneidet ein Bild in gleich große Kacheln und fügt sie als Kostüme hinzu" + } + } + }, + { + "id": "Sprite/addSound(String,String)", + "memberId": "Sprite/addSound", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addSound", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "soundPath" + ], + "params": [ + "String name", + "String soundPath" + ], + "summary": "Adds a sound (WAV or OGG).", + "description": "Adds a sound (WAV or OGG).", + "scratchblock": null, + "paramDocs": [ + "name: the sound's name, for [playSound(String)](playSound)", + "soundPath: the sound file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt einen Klang unter eigenem Namen hinzu" + } + } + }, + { + "id": "Sprite/addSound(String)", + "memberId": "Sprite/addSound", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addSound", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "soundPath" + ], + "params": [ + "String soundPath" + ], + "summary": "Adds a sound, named after its file.", + "description": "Adds a sound, named after its file.", + "scratchblock": null, + "paramDocs": [ + "soundPath: the sound file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt einen der eingebauten Klänge hinzu" + } + } + }, + { + "id": "Sprite/ask(String)", + "memberId": "Sprite/ask", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "ask", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "question" + ], + "params": [ + "String question" + ], + "summary": "Asks a question: the sprite says it in a bubble, and a box to type the answer in appears at\nthe bottom of the stage. Enter finishes it; see [Stage.ask(String)](../Stage/ask).", + "description": "Asks a question: the sprite says it in a bubble, and a box to type the answer in appears at\nthe bottom of the stage. Enter finishes it; see [Stage.ask(String)](../Stage/ask).", + "scratchblock": "ask [question] and wait", + "paramDocs": [ + "question: the question" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ask", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" + } + } + }, + { + "id": "Sprite/broadcast(String)", + "memberId": "Sprite/broadcast", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "broadcast", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "message" + ], + "params": [ + "String message" + ], + "summary": "Sends a message to the stage and every sprite on it; their [whenIReceive(String)](whenIReceive)\nruns at once, before this method returns.", + "description": "Sends a message to the stage and every sprite on it; their [whenIReceive(String)](whenIReceive)\nruns at once, before this method returns.", + "scratchblock": "broadcast [message v]", + "paramDocs": [ + "message: the message" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/broadcast", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Sendet eine Nachricht an alle Figuren und die Bühne" + } + } + }, + { + "id": "Sprite/changeColorEffect(double)", + "memberId": "Sprite/changeColorEffect", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeColorEffect", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [color v] effect by (by)", + "paramDocs": [ + "by: how much to change the colour effect" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeColorEffect", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/changeHeight(double)", + "memberId": "Sprite/changeHeight", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeHeight", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "by: how much higher to draw the sprite" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeHeight", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/changePosition(double,double)", + "memberId": "Sprite/changePosition", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changePosition", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double", + "double" + ], + "parameterNames": [ + "dx", + "dy" + ], + "params": [ + "double dx", + "double dy" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "dx: how far to move along x", + "dy: how far to move along y" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Verschiebt die Figur um die angegebenen Werte" + } + } + }, + { + "id": "Sprite/changePosition(Vector2)", + "memberId": "Sprite/changePosition", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changePosition", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.Vector2" + ], + "parameterNames": [ + "by" + ], + "params": [ + "Vector2 by" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "by: how far to move" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Verschiebt die Figur um den angegebenen Vektor" + } + } + }, + { + "id": "Sprite/changeSize(double)", + "memberId": "Sprite/changeSize", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeSize", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "percent" + ], + "params": [ + "double percent" + ], + "summary": "", + "description": "", + "scratchblock": "change size by (amount)", + "paramDocs": [ + "percent: how much to change the size, in percentage points" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeSize", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die Größe um den angegebenen Wert in Prozent" + } + } + }, + { + "id": "Sprite/changeTransparency(double)", + "memberId": "Sprite/changeTransparency", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeTransparency", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [ghost v] effect by (step)", + "paramDocs": [ + "by: how much to change the transparency" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeTransparency", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die Transparenz um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/changeVolume(double)", + "memberId": "Sprite/changeVolume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeVolume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change volume by (step)", + "paramDocs": [ + "by: how much to change the volume" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeVolume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die Lautstärke um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/changeWidth(double)", + "memberId": "Sprite/changeWidth", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeWidth", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "by: how much wider to draw the sprite" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeWidth", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/changeX(double)", + "memberId": "Sprite/changeX", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeX", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "dx" + ], + "params": [ + "double dx" + ], + "summary": "", + "description": "", + "scratchblock": "change x by (x)", + "paramDocs": [ + "dx: how far to move along x" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeX", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die x-Position um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/changeY(double)", + "memberId": "Sprite/changeY", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeY", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "dy" + ], + "params": [ + "double dy" + ], + "summary": "", + "description": "", + "scratchblock": "change y by (y)", + "paramDocs": [ + "dy: how far to move along y" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die y-Position um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/constructor()", + "memberId": "Sprite/constructor", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "constructor", + "static": false, + "returnType": "Sprite", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A sprite without costumes. Add some with [addCostume(String, String)](addCostume).", + "description": "A sprite without costumes. Add some with [addCostume(String, String)](addCostume).", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Erzeugt eine neue Figur" + } + } + }, + { + "id": "Sprite/constructor(String,String)", + "memberId": "Sprite/constructor", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "constructor", + "static": false, + "returnType": "Sprite", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "imagePath" + ], + "params": [ + "String name", + "String imagePath" + ], + "summary": "A sprite with one costume.", + "description": "A sprite with one costume.", + "scratchblock": null, + "paramDocs": [ + "name: the costume's name", + "imagePath: the image file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Erzeugt eine Figur mit einem ersten Kostüm" + } + } + }, + { + "id": "Sprite/createClone()", + "memberId": "Sprite/createClone", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "createClone", + "static": false, + "returnType": "T", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Makes a clone: a copy of this sprite with the same costumes, position, direction, effects and\nvariables, added to the stage just behind this sprite, as in Scratch. Its\n[whenStartsAsClone()](whenStartsAsClone) runs;\nits constructor does not. Numbers, texts and booleans in its variables are its own; lists and\nother objects are shared with this sprite until the clone gets its own in\n[whenStartsAsClone()](whenStartsAsClone).", + "description": "Makes a clone: a copy of this sprite with the same costumes, position, direction, effects and\nvariables, added to the stage just behind this sprite, as in Scratch. Its\n[whenStartsAsClone()](whenStartsAsClone) runs;\nits constructor does not. Numbers, texts and booleans in its variables are its own; lists and\nother objects are shared with this sprite until the clone gets its own in\n[whenStartsAsClone()](whenStartsAsClone).\n\n```java\nBullet bullet = this.createClone();\n```", + "scratchblock": null, + "paramDocs": [], + "returns": "the clone", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/createClone", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/debug(Object[])", + "memberId": "Sprite/debug", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "debug", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.Object[]" + ], + "parameterNames": [ + "values" + ], + "params": [ + "Object[] values" + ], + "summary": "Prints values for debugging, but only while debug mode is on (`window.setDebug(true)`\nor F12).", + "description": "Prints values for debugging, but only while debug mode is on (`window.setDebug(true)`\nor F12).", + "scratchblock": null, + "paramDocs": [ + "values: what to print" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/debug", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/deleteThisClone()", + "memberId": "Sprite/deleteThisClone", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "deleteThisClone", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Removes this sprite if it is a clone, stopping its sounds; does nothing for the original.", + "description": "Removes this sprite if it is a clone, stopping its sounds; does nothing for the original.", + "scratchblock": "delete this clone", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/deleteThisClone", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/disableHitbox()", + "memberId": "Sprite/disableHitbox", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "disableHitbox", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Touching ignores this sprite until [enableHitbox()](enableHitbox).", + "description": "Touching ignores this sprite until [enableHitbox()](enableHitbox).", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/disableHitbox", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Schaltet die Berührungserkennung aus" + } + } + }, + { + "id": "Sprite/disableNineSlice()", + "memberId": "Sprite/disableNineSlice", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "disableNineSlice", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Stretches the whole costume again.", + "description": "Stretches the whole costume again.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/disableNineSlice", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/distanceToMousePointer()", + "memberId": "Sprite/distanceToMousePointer", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "distanceToMousePointer", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(distance to [mouse-pointer v])", + "paramDocs": [], + "returns": "the distance to the mouse pointer", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToMousePointer", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Gibt den Abstand zum Mauszeiger zurück" + } + } + }, + { + "id": "Sprite/distanceToSprite(Sprite)", + "memberId": "Sprite/distanceToSprite", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "distanceToSprite", + "static": false, + "returnType": "double", + "parameterTypes": [ + "org.openpatch.scratch.Sprite" + ], + "parameterNames": [ + "sprite" + ], + "params": [ + "Sprite sprite" + ], + "summary": "", + "description": "", + "scratchblock": "(distance to [sprite v])", + "paramDocs": [ + "sprite: another sprite" + ], + "returns": "the distance between the two positions", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToSprite", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Gibt den Abstand zu einer anderen Figur zurück" + } + } + }, + { + "id": "Sprite/enableHitbox()", + "memberId": "Sprite/enableHitbox", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "enableHitbox", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Touching counts this sprite again.", + "description": "Touching counts this sprite again.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/enableHitbox", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { @@ -5207,6 +6031,84 @@ } } }, + { + "id": "Sprite/extension(Class,Supplier)", + "memberId": "Sprite/extension", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "extension", + "static": false, + "returnType": "T", + "parameterTypes": [ + "java.lang.Class", + "java.util.function.Supplier" + ], + "parameterNames": [ + "type", + "factory" + ], + "params": [ + "Class type", + "Supplier factory" + ], + "summary": "An extension's state for this sprite, made on first use; a clone gets its own. For\nextensions, not for learner code.", + "description": "An extension's state for this sprite, made on first use; a clone gets its own. For\nextensions, not for learner code.", + "scratchblock": null, + "paramDocs": [ + "type: the state's class", + "factory: makes it" + ], + "returns": "the sprite's one instance", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/extension", + "availability": "desktop-only", + "availabilityReason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others.", + "translations": {} + }, + { + "id": "Sprite/getAnimationFrame()", + "memberId": "Sprite/getAnimationFrame", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getAnimationFrame", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the frame of the current animation, counting from 0", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getAnimationFrame", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/getAnimationInterval()", + "memberId": "Sprite/getAnimationInterval", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getAnimationInterval", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "how long each frame shows, in seconds", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getAnimationInterval", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Sprite/getAnswer()", "memberId": "Sprite/getAnswer", @@ -5218,11 +6120,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the last answer that was typed in.", - "description": "Returns the last answer that was typed in.", + "summary": "", + "description": "", "scratchblock": "(answer)", "paramDocs": [], - "returns": "the answer, or an empty string if nothing has been answered yet", + "returns": "the answer to the last question", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getAnswer", "availability": "implemented", @@ -5233,6 +6135,28 @@ } } }, + { + "id": "Sprite/getColorEffect()", + "memberId": "Sprite/getColorEffect", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getColorEffect", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the colour effect", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getColorEffect", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Sprite/getCurrentCostumeIndex()", "memberId": "Sprite/getCurrentCostumeIndex", @@ -5244,11 +6168,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current costume index", - "description": "Returns the current costume index", + "summary": "", + "description": "", "scratchblock": "(costume [number v])", "paramDocs": [], - "returns": "a costume index", + "returns": "the current costume's number, counting from 0", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getCurrentCostumeIndex", "availability": "implemented", @@ -5270,11 +6194,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current costume name", - "description": "Returns the current costume name", + "summary": "", + "description": "", "scratchblock": "(costume [name v])", "paramDocs": [], - "returns": "a costume name", + "returns": "the current costume's name, or null without costumes", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getCurrentCostumeName", "availability": "implemented", @@ -5285,32 +6209,6 @@ } } }, - { - "id": "Sprite/getDeltaTime()", - "memberId": "Sprite/getDeltaTime", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "getDeltaTime", - "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Gets the seconds passed since the last frame.", - "description": "Gets the seconds passed since the last frame.", - "scratchblock": null, - "paramDocs": [], - "returns": "seconds since last frame", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getDeltaTime", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" - } - } - }, { "id": "Sprite/getDirection()", "memberId": "Sprite/getDirection", @@ -5322,11 +6220,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the direction of the sprite.", - "description": "Returns the direction of the sprite.", + "summary": "", + "description": "", "scratchblock": "(direction)", "paramDocs": [], - "returns": "the direction [0...360]", + "returns": "the direction, from 0 (inclusive) to 360 (exclusive); 90 is right", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getDirection", "availability": "implemented", @@ -5344,15 +6242,15 @@ "className": "Sprite", "methodName": "getHeight", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the height of the current costume or the pen size, when no costume is\navailable.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the height of the sprite", + "returns": "the height the sprite is drawn at, in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getHeight", "availability": "implemented", @@ -5370,15 +6268,15 @@ "className": "Sprite", "methodName": "getHitbox", "static": false, - "returnType": "Hitbox", + "returnType": "Shape", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the hitbox of the sprite based on its current costume, position, and\nrotation. If the\nsprite has a hitbox already defined, it updates and returns it. Otherwise, it\ncalculates a new\nhitbox based on the sprite's dimensions and rotation.", - "description": "Returns the hitbox of the sprite based on its current costume, position, and\nrotation. If the\nsprite has a hitbox already defined, it updates and returns it. Otherwise, it\ncalculates a new\nhitbox based on the sprite's dimensions and rotation.", + "summary": "The hitbox where the sprite is now, in stage coordinates: by default the rectangle around the\ncostume's painted pixels; null for a sprite without costumes.", + "description": "The hitbox where the sprite is now, in stage coordinates: by default the rectangle around the\ncostume's painted pixels; null for a sprite without costumes.", "scratchblock": null, "paramDocs": [], - "returns": "the hitbox of the sprite", + "returns": "the hitbox, or null", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getHitbox", "availability": "implemented", @@ -5389,6 +6287,28 @@ } } }, + { + "id": "Sprite/getLayer()", + "memberId": "Sprite/getLayer", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getLayer", + "static": false, + "returnType": "Layer", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the sprite's layer", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getLayer", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Sprite/getMouse()", "memberId": "Sprite/getMouse", @@ -5400,11 +6320,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current position of the mouse cursor.", - "description": "Retrieves the current position of the mouse cursor.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "a Vector2 object representing the current mouse cursor position, with\n the x-coordinate\n obtained from getMouseX() and the y-coordinate obtained from\n getMouseY().", + "returns": "the mouse pointer's position, in world coordinates (or stage coordinates for UI)", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getMouse", "availability": "implemented", @@ -5426,11 +6346,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current x-position of the mouse cursor", - "description": "Returns the current x-position of the mouse cursor", + "summary": "", + "description": "", "scratchblock": "(mouse x)", "paramDocs": [], - "returns": "x-position", + "returns": "x of the mouse pointer, in the sprite's coordinates (world, or the stage for UI)", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getMouseX", "availability": "implemented", @@ -5452,11 +6372,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current y-position of the mouse cursor", - "description": "Returns the current y-position of the mouse cursor", + "summary": "", + "description": "", "scratchblock": "(mouse y)", "paramDocs": [], - "returns": "y-position", + "returns": "y of the mouse pointer", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getMouseY", "availability": "implemented", @@ -5478,11 +6398,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pen of the sprite.", - "description": "Returns the pen of the sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the sprite's pen, which follows it", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getPen", "availability": "implemented", @@ -5504,20 +6424,42 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current position of the sprite.", - "description": "Retrieves the current position of the sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "A [Vector2](../Vector2/index) object representing the x and y coordinates of the\n sprite.", + "returns": "the sprite's position", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Position der Figur zurück" - } - } + "translations": { + "de": { + "description": "Gibt die Position der Figur zurück" + } + } + }, + { + "id": "Sprite/getRotationStyle()", + "memberId": "Sprite/getRotationStyle", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getRotationStyle", + "static": false, + "returnType": "RotationStyle", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "how the costume follows the direction", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getRotationStyle", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} }, { "id": "Sprite/getShaders()", @@ -5530,11 +6472,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the shaders of this sprite. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.", - "description": "Returns the shaders of this sprite. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.\n\nExample usage:\n\n```java\nthis.getShaders().add(\"blur\", \"blur.frag\", null);\nthis.getShaders().switchTo(\"blur\");\n```\n\nA sprite draws with one shader: with several active, the first of them.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the shaders", + "returns": "the sprite's shaders", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getShaders", "availability": "implemented", @@ -5556,11 +6498,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the size of the sprite.", - "description": "Returns the size of the sprite.", + "summary": "", + "description": "", "scratchblock": "(size)", "paramDocs": [], - "returns": "size in percentage", + "returns": "the size in percent of the costume's own size", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getSize", "availability": "implemented", @@ -5582,11 +6524,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current stage associated with this sprite.", - "description": "Retrieves the current stage associated with this sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the stage associated with this sprite", + "returns": "the stage the sprite is on, or null", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getStage", "availability": "implemented", @@ -5608,11 +6550,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the text associated with this sprite.", - "description": "Retrieves the text associated with this sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the text associated with this sprite", + "returns": "the sprite's text, which say and think show in a bubble", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getText", "availability": "implemented", @@ -5634,11 +6576,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the default timer", - "description": "Return the default timer", + "summary": "", + "description": "", "scratchblock": "(timer)", "paramDocs": [], - "returns": "the default timer", + "returns": "this object's timer, counting game time since it was made or reset", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTimer", "availability": "implemented", @@ -5649,40 +6591,6 @@ } } }, - { - "id": "Sprite/getTimer(String)", - "memberId": "Sprite/getTimer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "getTimer", - "static": false, - "returnType": "Timer", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Return a timer by name", - "description": "Return a timer by name", - "scratchblock": null, - "paramDocs": [ - "name: " - ], - "returns": "a timer", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTimer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Timer mit dem angegebenen Namen zurück und legt ihn bei Bedarf an" - } - } - }, { "id": "Sprite/getTint()", "memberId": "Sprite/getTint", @@ -5694,11 +6602,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the tint value of the current costume.", - "description": "Retrieves the tint value of the current costume.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the tint value of the current costume, or null if there are no\n costumes.", + "returns": "the tint, or null for none", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTint", "availability": "implemented", @@ -5721,18 +6629,18 @@ "java.lang.Class" ], "parameterNames": [ - "c" + "type" ], "params": [ - "Class c" + "Class type" ], - "summary": "Returns the first sprite of the specified type that is currently touching\nthis sprite.", - "description": "Returns the first sprite of the specified type that is currently touching\nthis sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: the class object of the type of sprite to check for" + "type: a class of sprites" ], - "returns": "the first sprite of the specified type that is touching this sprite,\n or null if no such\n sprite is found", + "returns": "a sprite of that class the sprite touches, or null", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTouchingSprite", "availability": "implemented", @@ -5755,18 +6663,18 @@ "java.lang.Class" ], "parameterNames": [ - "c" + "type" ], "params": [ - "Class c" + "Class type" ], - "summary": "Returns a list of sprites of the specified type that are currently touching\nthis sprite.", - "description": "Returns a list of sprites of the specified type that are currently touching\nthis sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: the class of the type of sprites to return" + "type: a class of sprites" ], - "returns": "a list of sprites of the specified type that are touching this\n sprite, or null if the\n stage is not set", + "returns": "every sprite of that class the sprite touches", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTouchingSprites", "availability": "implemented", @@ -5788,11 +6696,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the transparency of the current costume.", - "description": "Gets the transparency of the current costume.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "how see-through the sprite is, 0 solid and 100 invisible", + "returns": "the transparency in percent", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTransparency", "availability": "implemented", @@ -5814,11 +6722,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns how loud the sounds of this sprite play.", - "description": "Returns how loud the sounds of this sprite play.", + "summary": "", + "description": "", "scratchblock": "(volume)", "paramDocs": [], - "returns": "the volume, from 0 to 100", + "returns": "this object's volume from 0 to 100", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getVolume", "availability": "implemented", @@ -5836,15 +6744,15 @@ "className": "Sprite", "methodName": "getWidth", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the width of the current costume or the pen size, when no costume is\navailable.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the width of the sprite", + "returns": "the width the sprite is drawn at, in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getWidth", "availability": "implemented", @@ -5866,11 +6774,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the x coordinate of the sprite", - "description": "Returns the x coordinate of the sprite", + "summary": "", + "description": "", "scratchblock": "(x position)", "paramDocs": [], - "returns": "a x coordinate", + "returns": "x of the sprite's position", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getX", "availability": "implemented", @@ -5892,11 +6800,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the y coordinate of the sprite", - "description": "Returns the y coordinate of the sprite", + "summary": "", + "description": "", "scratchblock": "(y position)", "paramDocs": [], - "returns": "a y coordinate", + "returns": "y of the sprite's position", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getY", "availability": "implemented", @@ -5928,499 +6836,267 @@ "params": [ "double seconds", "double x", - "double y" - ], - "summary": "Slides the sprite to a place over the given time, instead of jumping there.", - "description": "Slides the sprite to a place over the given time, instead of jumping there.\n\nUnlike Scratch this does not hold up the sprite: `run()` keeps being called\nwhile the sprite is on its way. Use [isGliding()](isGliding) to tell whether it\nhas arrived.", - "scratchblock": "glide (seconds) secs to x: (x) y: (y)", - "paramDocs": [ - "seconds: how long the trip should take", - "x: where to end up", - "y: where to end up" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/glide", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gleitet in der angegebenen Zeit zur Zielposition" - } - } - }, - { - "id": "Sprite/goLayersBackwards(int)", - "memberId": "Sprite/goLayersBackwards", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goLayersBackwards", - "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the sprite backwards by a specified number of layers in the stage. If\nthe sprite is not\npart of a stage, the method does nothing.", - "description": "Moves the sprite backwards by a specified number of layers in the stage. If\nthe sprite is not\npart of a stage, the method does nothing.", - "scratchblock": "go [backward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the sprite backwards" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersBackwards", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schiebt die Figur um die angegebene Anzahl Ebenen nach hinten" - } - } - }, - { - "id": "Sprite/goLayersForwards(int)", - "memberId": "Sprite/goLayersForwards", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goLayersForwards", - "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the sprite forward by a specified number of layers within its stage.", - "description": "Moves the sprite forward by a specified number of layers within its stage.", - "scratchblock": "go [forward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the sprite forward" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersForwards", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Bringt die Figur um die angegebene Anzahl Ebenen nach vorne" - } - } - }, - { - "id": "Sprite/goToBackLayer()", - "memberId": "Sprite/goToBackLayer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToBackLayer", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves the sprite to the back layer of the stage. If the sprite is not\nassociated with any\nstage, the method returns without performing any action.", - "description": "Moves the sprite to the back layer of the stage. If the sprite is not\nassociated with any\nstage, the method returns without performing any action.", - "scratchblock": "go to [back v] layer", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToBackLayer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schiebt die Figur ganz nach hinten" - } - } - }, - { - "id": "Sprite/goToFrontLayer()", - "memberId": "Sprite/goToFrontLayer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToFrontLayer", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves this sprite to the front layer of the stage. If the sprite is not part\nof any stage, the\nmethod does nothing.", - "description": "Moves this sprite to the front layer of the stage. If the sprite is not part\nof any stage, the\nmethod does nothing.", - "scratchblock": "go to [front v] layer", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToFrontLayer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Bringt die Figur ganz nach vorne" - } - } - }, - { - "id": "Sprite/goToMousePointer()", - "memberId": "Sprite/goToMousePointer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToMousePointer", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves the sprite to the current position of the mouse pointer. This method\nupdates the sprite's\nposition to the coordinates of the mouse cursor.", - "description": "Moves the sprite to the current position of the mouse pointer. This method\nupdates the sprite's\nposition to the coordinates of the mouse cursor.", - "scratchblock": "go to [mouse-pointer v]", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToMousePointer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an die Position des Mauszeigers" - } - } - }, - { - "id": "Sprite/goToRandomPosition()", - "memberId": "Sprite/goToRandomPosition", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToRandomPosition", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves the sprite to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", - "description": "Moves the sprite to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", - "scratchblock": "go to [random position v]", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToRandomPosition", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an eine zufällige Position auf der Bühne" - } - } - }, - { - "id": "Sprite/goToSprite(Sprite)", - "memberId": "Sprite/goToSprite", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToSprite", - "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "sprite" - ], - "params": [ - "Sprite sprite" + "double y" ], - "summary": "Moves this sprite to the position of the specified sprite.", - "description": "Moves this sprite to the position of the specified sprite.", - "scratchblock": "go to [sprite v]", + "summary": "Glides to a position in a number of seconds of game time; the sprite keeps running its code\nmeanwhile. A new glide replaces one that is still going.", + "description": "Glides to a position in a number of seconds of game time; the sprite keeps running its code\nmeanwhile. A new glide replaces one that is still going.", + "scratchblock": "glide (seconds) secs to x: (x) y: (y)", "paramDocs": [ - "sprite: the sprite to move to" + "seconds: how long the glide takes", + "x: x of the target", + "y: y of the target" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/glide", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Figur auf die Position einer anderen Figur" + "description": "Gleitet in der angegebenen Zeit zur Zielposition" } } }, { - "id": "Sprite/hide()", - "memberId": "Sprite/hide", + "id": "Sprite/goLayersBackwards(int)", + "memberId": "Sprite/goLayersBackwards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "hide", + "methodName": "goLayersBackwards", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Hides the sprite. The pen is not effected.", - "description": "Hides the sprite. The pen is not effected.", - "scratchblock": "hide", - "paramDocs": [], + "parameterTypes": [ + "int" + ], + "parameterNames": [ + "number" + ], + "params": [ + "int number" + ], + "summary": "", + "description": "", + "scratchblock": "go [backward v] (number) layers", + "paramDocs": [ + "number: how many sprites of its layer to move behind" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hide", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersBackwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Macht die Figur unsichtbar" + "description": "Schiebt die Figur um die angegebene Anzahl Ebenen nach hinten" } } }, { - "id": "Sprite/hideVariable(String)", - "memberId": "Sprite/hideVariable", + "id": "Sprite/goLayersForwards(int)", + "memberId": "Sprite/goLayersForwards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "hideVariable", + "methodName": "goLayersForwards", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "number" ], "params": [ - "String name" + "int number" ], - "summary": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "description": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "scratchblock": "hide variable [name v]", + "summary": "", + "description": "", + "scratchblock": "go [forward v] (number) layers", "paramDocs": [ - "name: the name the monitor was shown with" + "number: how many sprites of its layer to move in front of" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hideVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersForwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Bringt die Figur um die angegebene Anzahl Ebenen nach vorne" + } + } }, { - "id": "Sprite/ifOnEdgeBounce()", - "memberId": "Sprite/ifOnEdgeBounce", + "id": "Sprite/goToBackLayer()", + "memberId": "Sprite/goToBackLayer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "ifOnEdgeBounce", + "methodName": "goToBackLayer", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the sprite is on the edge of the stage and bounces it back if it\nis. The sprite's\ndirection is reversed when it hits the left or right border, and it is\nreversed and rotated by\n180 degrees when it hits the top or bottom border. The method does nothing if\nthe hitbox is\ndisabled or if the sprite is a UI element. It also does nothing if the\nsprite has not been added to a stage yet.", - "description": "Checks if the sprite is on the edge of the stage and bounces it back if it\nis. The sprite's\ndirection is reversed when it hits the left or right border, and it is\nreversed and rotated by\n180 degrees when it hits the top or bottom border. The method does nothing if\nthe hitbox is\ndisabled or if the sprite is a UI element. It also does nothing if the\nsprite has not been added to a stage yet.", - "scratchblock": "if on edge, bounce", + "summary": "Moves the sprite behind every other sprite of its layer.", + "description": "Moves the sprite behind every other sprite of its layer.", + "scratchblock": "go to [back v] layer", "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ifOnEdgeBounce", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToBackLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Lässt die Figur am Bühnenrand abprallen" + "description": "Schiebt die Figur ganz nach hinten" } } }, { - "id": "Sprite/isAsking()", - "memberId": "Sprite/isAsking", + "id": "Sprite/goToFrontLayer()", + "memberId": "Sprite/goToFrontLayer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isAsking", + "methodName": "goToFrontLayer", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether a question is on screen and still waiting for an answer.", - "description": "Checks whether a question is on screen and still waiting for an answer.", - "scratchblock": null, + "summary": "Moves the sprite in front of every other sprite of its layer.", + "description": "Moves the sprite in front of every other sprite of its layer.", + "scratchblock": "go to [front v] layer", "paramDocs": [], - "returns": "true while a question is waiting", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isAsking", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToFrontLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" + "description": "Bringt die Figur ganz nach vorne" } } }, { - "id": "Sprite/isClone()", - "memberId": "Sprite/isClone", + "id": "Sprite/goToMousePointer()", + "memberId": "Sprite/goToMousePointer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isClone", + "methodName": "goToMousePointer", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Whether this sprite is a clone, made by [clone()](clone).", - "description": "Whether this sprite is a clone, made by [clone()](clone).", - "scratchblock": null, + "summary": "Goes to the mouse pointer.", + "description": "Goes to the mouse pointer.", + "scratchblock": "go to [mouse-pointer v]", "paramDocs": [], - "returns": "true for a clone, false for the original", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isClone", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie der Figur" - } - } - }, - { - "id": "Sprite/isColorTouchingColor(Color,Color)", - "memberId": "Sprite/isColorTouchingColor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "isColorTouchingColor", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "color", - "other" - ], - "params": [ - "Color color", - "Color other" - ], - "summary": "Checks whether a colour of the sprite is touching a colour on the stage:\nonly the parts of the costume painted in `color` count. A car whose\nfront bumper is red can ask whether the bumper touches the grass.", - "description": "Checks whether a colour of the sprite is touching a colour on the stage:\nonly the parts of the costume painted in `color` count. A car whose\nfront bumper is red can ask whether the bumper touches the grass.\n\n```java\nif (this.isColorTouchingColor(HtmlColor.RED, HtmlColor.GREEN)) {\n this.say(\"Off the road!\");\n}\n```", - "scratchblock": "<color [#ff0000] is touching [#00ff00]?>", - "paramDocs": [ - "color: a colour of this sprite's costume", - "other: the colour to look for under it" - ], - "returns": "true if the colour touches the other colour", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isColorTouchingColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToMousePointer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Prüft, ob die Teile der Figur in der Farbe color über der Farbe other liegen" + "description": "Setzt die Figur an die Position des Mauszeigers" } } }, { - "id": "Sprite/isGliding()", - "memberId": "Sprite/isGliding", + "id": "Sprite/goToRandomPosition()", + "memberId": "Sprite/goToRandomPosition", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isGliding", + "methodName": "goToRandomPosition", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether the sprite is still on its way to a place it was told to\nglide to.", - "description": "Checks whether the sprite is still on its way to a place it was told to\nglide to.", - "scratchblock": null, + "summary": "Goes to a random position on the stage.", + "description": "Goes to a random position on the stage.", + "scratchblock": "go to [random position v]", "paramDocs": [], - "returns": "true while it is still moving", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isGliding", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToRandomPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Figur gerade gleitet" + "description": "Setzt die Figur an eine zufällige Position auf der Bühne" } } }, { - "id": "Sprite/isKeyPressed(KeyCode)", - "memberId": "Sprite/isKeyPressed", + "id": "Sprite/goToSprite(Sprite)", + "memberId": "Sprite/goToSprite", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isKeyPressed", + "methodName": "goToSprite", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "keyCode" + "sprite" ], "params": [ - "KeyCode keyCode" + "Sprite sprite" ], - "summary": "Returns true if the key is pressed", - "description": "Returns true if the key is pressed", - "scratchblock": "<key [space v] pressed?>", + "summary": "", + "description": "", + "scratchblock": "go to [sprite v]", "paramDocs": [ - "keyCode: a key" + "sprite: the sprite whose position to go to" ], - "returns": "key pressed", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToSprite", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" + "description": "Setzt die Figur auf die Position einer anderen Figur" } } }, { - "id": "Sprite/isMouseDown()", - "memberId": "Sprite/isMouseDown", + "id": "Sprite/hide()", + "memberId": "Sprite/hide", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isMouseDown", + "methodName": "hide", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true is the mouse button is down", - "description": "Returns true is the mouse button is down", - "scratchblock": "<mouse down?>", + "summary": "Hides the sprite: it is not drawn, cannot be touched and cannot be clicked.", + "description": "Hides the sprite: it is not drawn, cannot be touched and cannot be clicked.", + "scratchblock": "hide", "paramDocs": [], - "returns": "mouse button down", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isMouseDown", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hide", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" + "description": "Macht die Figur unsichtbar" } } }, { - "id": "Sprite/isSoundPlaying(String)", - "memberId": "Sprite/isSoundPlaying", + "id": "Sprite/hideVariable(String)", + "memberId": "Sprite/hideVariable", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isSoundPlaying", + "methodName": "hideVariable", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ "java.lang.String" ], @@ -6430,1371 +7106,1177 @@ "params": [ "String name" ], - "summary": "Returns true if the sound if playing", - "description": "Returns true if the sound if playing", - "scratchblock": null, - "paramDocs": [ - "name: Name of the sound" - ], - "returns": "playing", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isSoundPlaying", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" - } - } - }, - { - "id": "Sprite/isTouchingColor(Color)", - "memberId": "Sprite/isTouchingColor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "isTouchingColor", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "color" - ], - "params": [ - "Color color" - ], - "summary": "Checks whether the sprite is touching a colour: whether anything it paints\nlies over that colour on the stage - on the backdrop, on what the pen drew,\nor on another sprite.", - "description": "Checks whether the sprite is touching a colour: whether anything it paints\nlies over that colour on the stage - on the backdrop, on what the pen drew,\nor on another sprite.\n\nAs in Scratch, colours that are nearly the same count, so anti-aliased\nedges still match. Only what is under the painted part of the costume\ncounts, not the empty space around it, and not the hitbox.\n\n```java\nif (this.isTouchingColor(HtmlColor.RED)) {\n this.say(\"Ouch!\");\n}\n```\n\nThe time it takes grows with the size of the sprite, not of the stage.", - "scratchblock": "<touching color [#ff0000]?>", + "summary": "", + "description": "", + "scratchblock": "hide variable [name v]", "paramDocs": [ - "color: the colour to look for" + "name: the label of a variable to hide again" ], - "returns": "true if the sprite is touching the colour", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hideVariable", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Prüft, ob etwas, das die Figur malt, über dieser Farbe auf der Bühne liegt — auf dem Bühnenbild, auf dem, was der Stift gezeichnet hat, oder auf einer anderen Figur. Fast gleiche Farben zählen wie in Scratch." - } - } - }, - { - "id": "Sprite/isTouchingColor(double,double,double)", - "memberId": "Sprite/isTouchingColor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "isTouchingColor", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "double", - "double", - "double" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "double r", - "double g", - "double b" - ], - "summary": "Checks whether the sprite is touching a colour given by its red, green and\nblue parts.", - "description": "Checks whether the sprite is touching a colour given by its red, green and\nblue parts.", - "scratchblock": null, - "paramDocs": [ - "r: the red part [0...255]", - "g: the green part [0...255]", - "b: the blue part [0...255]" - ], - "returns": "true if the sprite is touching the colour", + "translations": {} + }, + { + "id": "Sprite/ifOnEdgeBounce()", + "memberId": "Sprite/ifOnEdgeBounce", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "ifOnEdgeBounce", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Turns around when touching an edge of the stage and moves back inside, as in Scratch.", + "description": "Turns around when touching an edge of the stage and moves back inside, as in Scratch.", + "scratchblock": "if on edge, bounce", + "paramDocs": [], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ifOnEdgeBounce", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Prüft, ob die Figur eine Farbe berührt, angegeben durch Rot, Grün und Blau [0...255]" + "description": "Lässt die Figur am Bühnenrand abprallen" } } }, { - "id": "Sprite/isTouchingEdge()", - "memberId": "Sprite/isTouchingEdge", + "id": "Sprite/isAnimationPlayed()", + "memberId": "Sprite/isAnimationPlayed", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingEdge", + "methodName": "isAnimationPlayed", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true if the rectangle which contains the image is outside of the\nstage", - "description": "Returns true if the rectangle which contains the image is outside of the\nstage", - "scratchblock": "<touching [edge v]?>", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "true if outside", + "returns": "whether an animation played with `once` reached its last frame", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingEdge", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isAnimationPlayed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn die Figur den Bühnenrand berührt" - } - } + "translations": {} }, { - "id": "Sprite/isTouchingMousePointer()", - "memberId": "Sprite/isTouchingMousePointer", + "id": "Sprite/isAsking()", + "memberId": "Sprite/isAsking", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingMousePointer", + "methodName": "isAsking", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true is the mouse pointer is touching the hitbox of the sprite.", - "description": "Returns true is the mouse pointer is touching the hitbox of the sprite.", - "scratchblock": "<touching [mouse-pointer v]?>", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "true if touching", + "returns": "whether a question is waiting for its answer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingMousePointer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isAsking", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn der Mauszeiger auf der Figur liegt" + "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" } } }, { - "id": "Sprite/isTouchingSprite(Sprite)", - "memberId": "Sprite/isTouchingSprite", + "id": "Sprite/isClone()", + "memberId": "Sprite/isClone", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingSprite", + "methodName": "isClone", "static": false, "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "sprite" - ], - "params": [ - "Sprite sprite" - ], - "summary": "Checks if this sprite is touching another sprite.", - "description": "Checks if this sprite is touching another sprite.", - "scratchblock": "<touching [sprite v]?>", - "paramDocs": [ - "sprite: The sprite to check for collision with." - ], - "returns": "true if this sprite is touching the specified sprite, false\n otherwise. Returns false if\n the specified sprite is the same as this sprite, if the stage is\n null, if the specified\n sprite is null, not shown, or has its hitbox disabled.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether this sprite is a clone", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isClone", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn sich die Figuren berühren" + "description": "Erzeugt eine Kopie der Figur" } } }, { - "id": "Sprite/isTouchingSprite(Class)", - "memberId": "Sprite/isTouchingSprite", + "id": "Sprite/isColorTouchingColor(Color,Color)", + "memberId": "Sprite/isColorTouchingColor", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingSprite", + "methodName": "isColorTouchingColor", "static": false, "returnType": "boolean", "parameterTypes": [ - "java.lang.Class" + "org.openpatch.scratch.Color", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "c" + "mine", + "color" ], "params": [ - "Class c" + "Color mine", + "Color color" ], - "summary": "Checks if this sprite is touching any sprite of the specified class type.", - "description": "Checks if this sprite is touching any sprite of the specified class type.", - "scratchblock": null, + "summary": "Whether a colour of the sprite touches a colour on the stage, like Scratch's \"color is\ntouching color\".", + "description": "Whether a colour of the sprite touches a colour on the stage, like Scratch's \"color is\ntouching color\".", + "scratchblock": "<color [#ff0000] is touching [#00ff00]?>", "paramDocs": [ - "c: the class type of the sprite to check for collision" + "mine: a colour of the sprite", + "color: the colour to look for underneath" ], - "returns": "true if this sprite is touching any sprite of the specified class\n type, false otherwise", + "returns": "whether they touch", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isColorTouchingColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Figur eine Figur dieser Klasse berührt, z.B. isTouchingSprite(Apfel.class)" + "description": "Prüft, ob die Teile der Figur in der Farbe color über der Farbe other liegen" } } }, { - "id": "Sprite/isVisible()", - "memberId": "Sprite/isVisible", + "id": "Sprite/isGliding()", + "memberId": "Sprite/isGliding", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isVisible", + "methodName": "isGliding", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns if the sprite is visible", - "description": "Returns if the sprite is visible", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "is visible", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isVisible", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn die Figur sichtbar ist" - } - } - }, - { - "id": "Sprite/move(double)", - "memberId": "Sprite/move", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "move", - "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "steps" - ], - "params": [ - "double steps" - ], - "summary": "Moves the sprite towards the current rotation by the received steps.", - "description": "Moves the sprite towards the current rotation by the received steps.", - "scratchblock": "move (steps) steps", - "paramDocs": [ - "steps: a number of pixels" - ], - "returns": null, + "returns": "whether a glide is still going", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/move", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isGliding", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Bewegt die Figur um die angegebene Schrittzahl in ihre Blickrichtung" + "description": "Gibt genau dann true zurück, wenn die Figur gerade gleitet" } } }, { - "id": "Sprite/move(Vector2)", - "memberId": "Sprite/move", + "id": "Sprite/isKeyPressed(KeyCode)", + "memberId": "Sprite/isKeyPressed", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "move", + "methodName": "isKeyPressed", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.KeyCode" ], "parameterNames": [ - "v" + "key" ], "params": [ - "Vector2 v" + "KeyCode key" ], - "summary": "Moves the sprite in the direction of the given vector. The length of the\nvector determines how\nmove the sprite will move in this direction.", - "description": "Moves the sprite in the direction of the given vector. The length of the\nvector determines how\nmove the sprite will move in this direction.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "<key [space v] pressed?>", "paramDocs": [ - "v: a vector" + "key: a key" ], - "returns": null, + "returns": "whether the key is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/move", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Verschiebt die Figur um den Vektor" + "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" } } }, { - "id": "Sprite/nextCostume()", - "memberId": "Sprite/nextCostume", + "id": "Sprite/isMouseDown()", + "memberId": "Sprite/isMouseDown", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "nextCostume", + "methodName": "isMouseDown", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to the next costume.", - "description": "Switch to the next costume.", - "scratchblock": "next costume", + "summary": "", + "description": "", + "scratchblock": "<mouse down?>", "paramDocs": [], - "returns": null, + "returns": "whether a mouse button is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/nextCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isMouseDown", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum nächsten Kostüm" + "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" } } }, { - "id": "Sprite/pickRandom(int,int)", - "memberId": "Sprite/pickRandom", + "id": "Sprite/isSoundPlaying(String)", + "memberId": "Sprite/isSoundPlaying", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pickRandom", + "methodName": "isSoundPlaying", "static": false, - "returnType": "int", + "returnType": "boolean", "parameterTypes": [ - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "from", - "to" + "name" ], "params": [ - "int from", - "int to" + "String name" ], - "summary": "Returns a random integer between the specified range.", - "description": "Returns a random integer between the specified range.", - "scratchblock": "(pick random (from) to (to))", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "from: the lower bound of the range (inclusive)", - "to: the upper bound of the range (exclusive)" + "name: a sound's name" ], - "returns": "a random integer between the specified range", + "returns": "whether it is playing", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pickRandom", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isSoundPlaying", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" + "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" } } }, { - "id": "Sprite/playSound(String)", - "memberId": "Sprite/playSound", + "id": "Sprite/isTouchingColor(Color)", + "memberId": "Sprite/isTouchingColor", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "playSound", + "methodName": "isTouchingColor", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "name" + "color" ], "params": [ - "String name" + "Color color" ], - "summary": "Plays a sound.", - "description": "Plays a sound.\n\nEvery sprite plays its own copy, so ten sprites playing the same sound are\nheard ten times at once. One sprite only plays a sound once at a time:\nplaying it again while it is still going does nothing.", - "scratchblock": "start sound [name v]\n\nplaySoundCopy() returns an independent SoundPlayback with its own volume\nand can overlap earlier plays of the same sound.", + "summary": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "description": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "scratchblock": "<touching color [#ff0000]?>", "paramDocs": [ - "name: the sound name" + "color: the colour to look for" ], - "returns": null, + "returns": "whether the sprite touches it", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Spielt einen zuvor hinzugefügten Klang ab" + "description": "Prüft, ob etwas, das die Figur malt, über dieser Farbe auf der Bühne liegt — auf dem Bühnenbild, auf dem, was der Stift gezeichnet hat, oder auf einer anderen Figur. Fast gleiche Farben zählen wie in Scratch." } } }, { - "id": "Sprite/playSoundCopy(String,double)", - "memberId": "Sprite/playSoundCopy", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "playSoundCopy", - "static": false, - "returnType": "SoundPlayback", - "parameterTypes": [ - "java.lang.String", - "double" - ], - "parameterNames": [ - "name", - "volume" - ], - "params": [ - "String name", - "double volume" - ], - "summary": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this sprite.\nThe sprite's ordinary volume does not change a copy's explicit volume.", - "description": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this sprite.\nThe sprite's ordinary volume does not change a copy's explicit volume.", - "scratchblock": null, - "paramDocs": [ - "name: a sound already added with addSound()", - "volume: volume from 0 to 100 percent" - ], - "returns": "this individual playback, also usable in try-with-resources", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSoundCopy", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Sprite/pointInDirection(double)", - "memberId": "Sprite/pointInDirection", + "id": "Sprite/isTouchingColor(double,double,double)", + "memberId": "Sprite/isTouchingColor", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointInDirection", + "methodName": "isTouchingColor", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ + "double", + "double", "double" ], "parameterNames": [ - "degrees" + "red", + "green", + "blue" ], "params": [ - "double degrees" + "double red", + "double green", + "double blue" ], - "summary": "Points the sprite in the specified direction.", - "description": "Points the sprite in the specified direction.", - "scratchblock": null, + "summary": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "description": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "scratchblock": "<touching color [#ff0000]?>", "paramDocs": [ - "degrees: The direction in degrees to point the sprite. 0 degrees is up,\n 90 degrees is to the right, 180 degrees is down, and 270\n degrees is to the left." + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], - "returns": null, + "returns": "whether the sprite touches that colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointInDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" + "description": "Prüft, ob die Figur eine Farbe berührt, angegeben durch Rot, Grün und Blau [0...255]" } } }, { - "id": "Sprite/pointInDirection(Vector2)", - "memberId": "Sprite/pointInDirection", + "id": "Sprite/isTouchingEdge()", + "memberId": "Sprite/isTouchingEdge", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointInDirection", + "methodName": "isTouchingEdge", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Vector2" - ], - "parameterNames": [ - "v" - ], - "params": [ - "Vector2 v" - ], - "summary": "Points the sprite in the direction of the given vector.", - "description": "Points the sprite in the direction of the given vector.", - "scratchblock": null, - "paramDocs": [ - "v: the target vector to point towards" - ], - "returns": null, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "<touching [edge v]?>", + "paramDocs": [], + "returns": "whether the sprite's hitbox reaches an edge of the stage", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointInDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingEdge", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Richtet die Figur entlang des angegebenen Vektors aus" + "description": "Gibt genau dann true zurück, wenn die Figur den Bühnenrand berührt" } } }, { - "id": "Sprite/pointTowardsMousePointer()", - "memberId": "Sprite/pointTowardsMousePointer", + "id": "Sprite/isTouchingMousePointer()", + "memberId": "Sprite/isTouchingMousePointer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointTowardsMousePointer", + "methodName": "isTouchingMousePointer", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Points the sprite towards the current position of the mouse pointer. This\nmethod calculates the\nangle between the sprite's current position and the mouse pointer's position,\nthen sets the\nsprite's direction accordingly.", - "description": "Points the sprite towards the current position of the mouse pointer. This\nmethod calculates the\nangle between the sprite's current position and the mouse pointer's position,\nthen sets the\nsprite's direction accordingly.", - "scratchblock": "point towards [mouse-pointer v]", + "summary": "", + "description": "", + "scratchblock": "<touching [mouse-pointer v]?>", "paramDocs": [], - "returns": null, + "returns": "whether the mouse pointer is over the sprite's hitbox", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowardsMousePointer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingMousePointer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Richtet die Figur zum Mauszeiger aus" + "description": "Gibt genau dann true zurück, wenn der Mauszeiger auf der Figur liegt" } } }, { - "id": "Sprite/pointTowardsSprite(Sprite)", - "memberId": "Sprite/pointTowardsSprite", + "id": "Sprite/isTouchingSprite(Sprite)", + "memberId": "Sprite/isTouchingSprite", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointTowardsSprite", + "methodName": "isTouchingSprite", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "s" + "sprite" ], "params": [ - "Sprite s" + "Sprite sprite" ], - "summary": "Points the current sprite towards the specified sprite.", - "description": "Points the current sprite towards the specified sprite.", - "scratchblock": "point towards [sprite v]", + "summary": "", + "description": "", + "scratchblock": "<touching [sprite v]?>", "paramDocs": [ - "s: the sprite to point towards" + "sprite: another sprite" ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowardsSprite", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Richtet die Figur zu einer anderen Figur aus" - } - } - }, - { - "id": "Sprite/previousCostume()", - "memberId": "Sprite/previousCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "previousCostume", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Switch to the previous costume.", - "description": "Switch to the previous costume.", - "scratchblock": "switch costume to (previous costume)", - "paramDocs": [], - "returns": null, + "returns": "whether the two hitboxes overlap (touching edges do not count); a hidden sprite\n touches nothing, and the UI layer never touches the world", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/previousCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum vorherigen Kostüm" + "description": "Gibt genau dann true zurück, wenn sich die Figuren berühren" } } }, { - "id": "Sprite/remove()", - "memberId": "Sprite/remove", + "id": "Sprite/isTouchingSprite(Class)", + "memberId": "Sprite/isTouchingSprite", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "remove", + "methodName": "isTouchingSprite", "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Removes this sprite from its current stage. For \"delete this clone\", see\n[deleteThisClone()](deleteThisClone).", - "description": "Removes this sprite from its current stage. For \"delete this clone\", see\n[deleteThisClone()](deleteThisClone).", - "scratchblock": null, - "paramDocs": [], - "returns": null, + "returnType": "boolean", + "parameterTypes": [ + "java.lang.Class" + ], + "parameterNames": [ + "type" + ], + "params": [ + "Class type" + ], + "summary": "", + "description": "", + "scratchblock": "<touching [sprite v]?>", + "paramDocs": [ + "type: a class of sprites" + ], + "returns": "whether the sprite touches any sprite of that class (or a subclass)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt die Figur von der Bühne" + "description": "Gibt genau dann true zurück, wenn die Figur eine Figur dieser Klasse berührt, z.B. isTouchingSprite(Apfel.class)" } } }, { - "id": "Sprite/run()", - "memberId": "Sprite/run", + "id": "Sprite/isVisible()", + "memberId": "Sprite/isVisible", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "run", + "methodName": "isVisible", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "This method is intended to be overridden by subclasses to define the behavior\nof the sprite\nwhen it is run. By default, this method does nothing.", - "description": "This method is intended to be overridden by subclasses to define the behavior\nof the sprite\nwhen it is run. By default, this method does nothing.\n\nIt is called every frame.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether the sprite is shown", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/run", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isVisible", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird in jedem Frame aufgerufen" + "description": "Gibt genau dann true zurück, wenn die Figur sichtbar ist" } } }, { - "id": "Sprite/say(String)", - "memberId": "Sprite/say", + "id": "Sprite/move(double)", + "memberId": "Sprite/move", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "say", + "methodName": "move", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "text" + "steps" ], "params": [ - "String text" + "double steps" ], - "summary": "Makes the sprite display a speech bubble with the specified text.", - "description": "Makes the sprite display a speech bubble with the specified text.", - "scratchblock": "say [text]", + "summary": "Moves forward in the sprite's direction.", + "description": "Moves forward in the sprite's direction.", + "scratchblock": "move (steps) steps", "paramDocs": [ - "text: The text to be displayed in the speech bubble." + "steps: how far, in stage pixels (negative moves backwards)" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/move", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Sprechblase an" + "description": "Bewegt die Figur um die angegebene Schrittzahl in ihre Blickrichtung" } } }, { - "id": "Sprite/say(String,int)", - "memberId": "Sprite/say", + "id": "Sprite/nextCostume()", + "memberId": "Sprite/nextCostume", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "say", + "methodName": "nextCostume", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "int" - ], - "parameterNames": [ - "text", - "millis" - ], - "params": [ - "String text", - "int millis" - ], - "summary": "Displays a text message for a specified duration.", - "description": "Displays a text message for a specified duration.", - "scratchblock": "say [text] for (millis) seconds", - "paramDocs": [ - "text: The message to be displayed.", - "millis: The duration in milliseconds for which the message will be\n displayed." - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the next costume, after the last one to the first.", + "description": "Switches to the next costume, after the last one to the first.", + "scratchblock": "next costume", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/nextCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Sprechblase für die angegebene Zeit in Millisekunden" + "description": "Wechselt zum nächsten Kostüm" } } }, { - "id": "Sprite/setDirection(double)", - "memberId": "Sprite/setDirection", + "id": "Sprite/pickRandom(int,int)", + "memberId": "Sprite/pickRandom", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setDirection", + "methodName": "pickRandom", "static": false, - "returnType": "void", + "returnType": "int", "parameterTypes": [ - "double" + "int", + "int" ], "parameterNames": [ - "degrees" + "from", + "to" ], "params": [ - "double degrees" + "int from", + "int to" ], - "summary": "Sets the direction of the sprite to a given degrees. When this value is 0 the\nsprite moves\nup, when it is 180 it moves down.", - "description": "Sets the direction of the sprite to a given degrees. When this value is 0 the\nsprite moves\nup, when it is 180 it moves down.", - "scratchblock": "point in direction (degrees)", + "summary": "A random whole number between two numbers, both included.", + "description": "A random whole number between two numbers, both included.", + "scratchblock": "(pick random (from) to (to))", "paramDocs": [ - "degrees: between 0 and 360" + "from: the lowest", + "to: the highest" ], - "returns": null, + "returns": "the number", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pickRandom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" + "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" } } }, { - "id": "Sprite/setDirection(Vector2)", - "memberId": "Sprite/setDirection", + "id": "Sprite/playAnimation(String)", + "memberId": "Sprite/playAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setDirection", + "methodName": "playAnimation", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" ], "parameterNames": [ - "v" + "name" ], "params": [ - "Vector2 v" + "String name" ], - "summary": "Sets the direction of the sprite to the direction of a given vector.", - "description": "Sets the direction of the sprite to the direction of a given vector.", + "summary": "Plays an animation, over and over. Call it every tick (in `run()`): it shows the next\nframe each time the animation interval has passed, and starts from the first frame when\nanother animation was playing before.", + "description": "Plays an animation, over and over. Call it every tick (in `run()`): it shows the next\nframe each time the animation interval has passed, and starts from the first frame when\nanother animation was playing before.", "scratchblock": null, "paramDocs": [ - "v: a vector" + "name: the animation's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playAnimation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Blickrichtung auf die Richtung des Vektors" - } - } + "translations": {} }, { - "id": "Sprite/setHitbox(double[])", - "memberId": "Sprite/setHitbox", + "id": "Sprite/playAnimation(String,boolean)", + "memberId": "Sprite/playAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setHitbox", + "methodName": "playAnimation", "static": false, "returnType": "void", "parameterTypes": [ - "double[]" + "java.lang.String", + "boolean" ], "parameterNames": [ - "points" + "name", + "once" ], "params": [ - "double[] points" + "String name", + "boolean once" ], - "summary": "Sets the hitbox for the sprite using the provided points. The points should\nbe provided in\npairs representing the x and y coordinates.", - "description": "Sets the hitbox for the sprite using the provided points. The points should\nbe provided in\npairs representing the x and y coordinates.", + "summary": "Plays an animation; call it every tick.", + "description": "Plays an animation; call it every tick.", "scratchblock": null, "paramDocs": [ - "points: an array of integers representing the x and y coordinates of\n the hitbox vertices.\n The length of the array should be even, with each pair of\n integers representing a point (x,\n y)." + "name: the animation's name", + "once: whether to stop at the last frame instead of starting over" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHitbox", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playAnimation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Sprite/setHitbox(Shape)", - "memberId": "Sprite/setHitbox", + "id": "Sprite/playSound(String)", + "memberId": "Sprite/playSound", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setHitbox", + "methodName": "playSound", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Shape" + "java.lang.String" ], "parameterNames": [ - "shape" + "name" ], "params": [ - "Shape shape" + "String name" ], - "summary": "Sets the hitbox for the sprite using the specified shape.", - "description": "Sets the hitbox for the sprite using the specified shape.", - "scratchblock": null, + "summary": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "description": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "scratchblock": "start sound [name v]", "paramDocs": [ - "shape: the shape to be used for the hitbox" + "name: the sound's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHitbox", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Trefferfläche auf die angegebene Form; (0/0) ist die Mitte der Figur" + "description": "Spielt einen zuvor hinzugefügten Klang ab" } } }, { - "id": "Sprite/setPosition(double,double)", - "memberId": "Sprite/setPosition", + "id": "Sprite/playSoundCopy(String,double)", + "memberId": "Sprite/playSoundCopy", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setPosition", + "methodName": "playSoundCopy", "static": false, - "returnType": "void", + "returnType": "SoundPlayback", "parameterTypes": [ - "double", + "java.lang.String", "double" ], "parameterNames": [ - "x", - "y" + "name", + "volume" ], "params": [ - "double x", - "double y" + "String name", + "double volume" ], - "summary": "Sets the position of the sprite", - "description": "Sets the position of the sprite", - "scratchblock": "go to x: (x) y: (y)", + "summary": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "description": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "scratchblock": null, "paramDocs": [ - "x: a x coordinate", - "y: a y coordinate" + "name: the sound's name", + "volume: the copy's volume from 0 to 100" ], - "returns": null, + "returns": "the copy, to stop it or change its volume", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSoundCopy", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" - } - } + "translations": {} }, { - "id": "Sprite/setPosition(Vector2)", - "memberId": "Sprite/setPosition", + "id": "Sprite/pointTowards(Vector2)", + "memberId": "Sprite/pointTowards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setPosition", + "methodName": "pointTowards", "static": false, "returnType": "void", "parameterTypes": [ "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "v" + "position" ], "params": [ - "Vector2 v" + "Vector2 position" ], - "summary": "Sets the position of the sprite based on the coordinates of a given vector.", - "description": "Sets the position of the sprite based on the coordinates of a given vector.", + "summary": "Points towards a position.", + "description": "Points towards a position.", "scratchblock": null, "paramDocs": [ - "v: a vector" + "position: where to point" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" - } - } + "translations": {} }, { - "id": "Sprite/setRotationCenter(double,double)", - "memberId": "Sprite/setRotationCenter", + "id": "Sprite/pointTowards(Sprite)", + "memberId": "Sprite/pointTowards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setRotationCenter", + "methodName": "pointTowards", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "x", - "y" + "sprite" ], "params": [ - "double x", - "double y" + "Sprite sprite" ], - "summary": "Sets the point of the costume the sprite turns around - Scratch's rotation\ncenter. It is also the point that sits at the sprite's position, so it is\nwhere the pen draws from and what `goTo` puts in place.", - "description": "Sets the point of the costume the sprite turns around - Scratch's rotation\ncenter. It is also the point that sits at the sprite's position, so it is\nwhere the pen draws from and what `goTo` puts in place.\n\nThe point is given in the costume's own pixels, counted from its top left\ncorner, the same way as [setHitbox(double...)](setHitbox): a sword whose hilt\nis 12 pixels from the left and 60 from the top swings around the hilt with\n`setRotationCenter(12, 60)`. It grows and shrinks with the sprite's\nsize and holds for every costume of the sprite. Without it, a sprite turns\naround the middle of its costume.\n\n```java\nthis.addCostume(\"hand\", \"assets/clock-hand.png\");\nthis.setRotationCenter(8, 100); // the end of the hand\n```", + "summary": "Points towards a position.", + "description": "Points towards a position.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate in the costume, from its left edge", - "y: the y-coordinate in the costume, from its top edge" + "sprite: the sprite to point at" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationCenter", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt den Punkt des Kostüms, um den sich die Figur dreht (Drehpunkt). Er sitzt an der Position der Figur. Angegeben in Pixeln des Kostüms von seiner linken oberen Ecke aus, wie bei setHitbox; er wächst mit der Größe und gilt für alle Kostüme." - } - } + "translations": {} }, { - "id": "Sprite/setRotationStyle(RotationStyle)", - "memberId": "Sprite/setRotationStyle", + "id": "Sprite/pointTowardsMousePointer()", + "memberId": "Sprite/pointTowardsMousePointer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setRotationStyle", + "methodName": "pointTowardsMousePointer", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.RotationStyle" - ], - "parameterNames": [ - "style" - ], - "params": [ - "RotationStyle style" - ], - "summary": "Sets the rotation style for the sprite.", - "description": "Sets the rotation style for the sprite.", - "scratchblock": "set rotation style [left-right v]", - "paramDocs": [ - "style: the rotation style to be set" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Points towards the mouse pointer.", + "description": "Points towards the mouse pointer.", + "scratchblock": "point towards [mouse-pointer v]", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationStyle", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowardsMousePointer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, wie sich die Figur beim Drehen verhält" + "description": "Richtet die Figur zum Mauszeiger aus" } } }, { - "id": "Sprite/setSize(double)", - "memberId": "Sprite/setSize", + "id": "Sprite/previousCostume()", + "memberId": "Sprite/previousCostume", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setSize", + "methodName": "previousCostume", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "percentage" - ], - "params": [ - "double percentage" - ], - "summary": "Sets the size of the sprite.", - "description": "Sets the size of the sprite.", - "scratchblock": "set size to (percentage) %", - "paramDocs": [ - "percentage: a percentage [0...100]" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the previous costume, before the first one to the last.", + "description": "Switches to the previous costume, before the first one to the last.", + "scratchblock": "switch costume to (previous costume)", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/previousCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Größe in Prozent (100 = Originalgröße)" + "description": "Wechselt zum vorherigen Kostüm" } } }, { - "id": "Sprite/setTint(Color)", - "memberId": "Sprite/setTint", + "id": "Sprite/remove()", + "memberId": "Sprite/remove", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTint", + "methodName": "remove", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the tint for the sprite with an color object.", - "description": "Sets the tint for the sprite with an color object.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Removes the sprite from its stage.", + "description": "Removes the sprite from its stage.", "scratchblock": null, - "paramDocs": [ - "c: a color object" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt die Figur mit der angegebenen Farbe ein" + "description": "Entfernt die Figur von der Bühne" } } }, { - "id": "Sprite/setTint(double,double,double)", - "memberId": "Sprite/setTint", + "id": "Sprite/resetAnimation()", + "memberId": "Sprite/resetAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTint", + "methodName": "resetAnimation", "static": false, "returnType": "void", - "parameterTypes": [ - "double", - "double", - "double" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "double r", - "double g", - "double b" - ], - "summary": "Sets the tint for the sprite with rgb.", - "description": "Sets the tint for the sprite with rgb.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Starts the current animation from its first frame again.", + "description": "Starts the current animation from its first frame again.", "scratchblock": null, - "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/resetAnimation", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/run()", + "memberId": "Sprite/run", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "run", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Runs every tick, 60 times a second of game time. Override it with the sprite's code.", + "description": "Runs every tick, 60 times a second of game time. Override it with the sprite's code.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/run", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt die Figur mit der angegebenen Farbe ein (Anteile jeweils 0 bis 255)" + "description": "Wird in jedem Frame aufgerufen" } } }, { - "id": "Sprite/setTint(double)", - "memberId": "Sprite/setTint", + "id": "Sprite/say(String)", + "memberId": "Sprite/say", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTint", + "methodName": "say", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "h" + "text" ], "params": [ - "double h" + "String text" ], - "summary": "Sets the tint for the sprite with a hue.", - "description": "Sets the tint for the sprite with a hue.", - "scratchblock": "set [color v] effect to (h)", + "summary": "Shows a speech bubble until the sprite says something else; an empty text removes it.", + "description": "Shows a speech bubble until the sprite says something else; an empty text removes it.", + "scratchblock": "say [text]", "paramDocs": [ - "h: a hue value [0...255]" + "text: what the sprite says" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt die Figur mit dem angegebenen Farbton ein (0 bis 255)" + "description": "Zeigt eine Sprechblase an" } } }, { - "id": "Sprite/setTransparency(double)", - "memberId": "Sprite/setTransparency", + "id": "Sprite/say(String,double)", + "memberId": "Sprite/say", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTransparency", + "methodName": "say", "static": false, "returnType": "void", "parameterTypes": [ + "java.lang.String", "double" ], "parameterNames": [ - "transparency" + "text", + "seconds" ], "params": [ - "double transparency" + "String text", + "double seconds" ], - "summary": "Sets how see-through the sprite is, as Scratch's ghost effect does: 0 is the\nsolid sprite you start with and 100 is invisible. Anything outside that is\npinned to it.", - "description": "Sets how see-through the sprite is, as Scratch's ghost effect does: 0 is the\nsolid sprite you start with and 100 is invisible. Anything outside that is\npinned to it.", - "scratchblock": "set [ghost v] effect to (transparency)", + "summary": "Shows a speech bubble for a number of seconds of game time.", + "description": "Shows a speech bubble for a number of seconds of game time.", + "scratchblock": "say [text] for (seconds) seconds", "paramDocs": [ - "transparency: [0...100], 0 solid and 100 invisible" + "text: what the sprite says", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Transparenz in Prozent (0 = deckend, 100 = unsichtbar)" - } - } + "translations": {} }, { - "id": "Sprite/setVolume(double)", - "memberId": "Sprite/setVolume", + "id": "Sprite/setAnimationFrame(int)", + "memberId": "Sprite/setAnimationFrame", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setVolume", + "methodName": "setAnimationFrame", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "int" ], "parameterNames": [ - "percent" + "frame" ], "params": [ - "double percent" + "int frame" ], - "summary": "Sets how loud every sound of this sprite plays.", - "description": "Sets how loud every sound of this sprite plays.", - "scratchblock": "set volume to (percent) %", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "percent: 0 for silent, 100 for full volume" + "frame: the frame of the current animation to show next, counting from 0" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setAnimationFrame", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Lautstärke aller Klänge dieser Figur in Prozent" - } - } + "translations": {} }, { - "id": "Sprite/setX(double)", - "memberId": "Sprite/setX", + "id": "Sprite/setAnimationInterval(double)", + "memberId": "Sprite/setAnimationInterval", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setX", + "methodName": "setAnimationInterval", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "x" + "seconds" ], "params": [ - "double x" + "double seconds" ], - "summary": "Sets the x coordinate", - "description": "Sets the x coordinate", - "scratchblock": "set x to (x)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "x: a x coordinate" + "seconds: how long each frame shows" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setAnimationInterval", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die x-Position" - } - } + "translations": {} }, { - "id": "Sprite/setY(double)", - "memberId": "Sprite/setY", + "id": "Sprite/setColorEffect(double)", + "memberId": "Sprite/setColorEffect", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setY", + "methodName": "setColorEffect", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "y" + "value" ], "params": [ - "double y" + "double value" ], - "summary": "Sets the y coordinate", - "description": "Sets the y coordinate", - "scratchblock": "set y to (y)", + "summary": "Scratch's colour effect: shifts every colour of the costume around the colour wheel. 0 is no\nchange; 100 is halfway round; 200 is all the way round again. Like Scratch, it gives colours\ntoo grey or too dark to show a hue a little one, so white and black are tinted too.", + "description": "Scratch's colour effect: shifts every colour of the costume around the colour wheel. 0 is no\nchange; 100 is halfway round; 200 is all the way round again. Like Scratch, it gives colours\ntoo grey or too dark to show a hue a little one, so white and black are tinted too.", + "scratchblock": "set [color v] effect to (value)", "paramDocs": [ - "y: a y coordinate" + "value: the effect" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die y-Position" - } - } + "translations": {} }, { - "id": "Sprite/show()", - "memberId": "Sprite/show", + "id": "Sprite/setDirection(double)", + "memberId": "Sprite/setDirection", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "show", + "methodName": "setDirection", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Shows the sprite.", - "description": "Shows the sprite.", - "scratchblock": "show", - "paramDocs": [], + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "degrees" + ], + "params": [ + "double degrees" + ], + "summary": "Points in a direction: 0 up, 90 right, 180 down, 270 left; other numbers go around.", + "description": "Points in a direction: 0 up, 90 right, 180 down, 270 left; other numbers go around.", + "scratchblock": "point in direction (degrees)", + "paramDocs": [ + "degrees: the direction" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/show", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setDirection", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Macht die Figur sichtbar" + "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" } } }, { - "id": "Sprite/showVariable(String,Supplier)", - "memberId": "Sprite/showVariable", + "id": "Sprite/setHeight(double)", + "memberId": "Sprite/setHeight", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "showVariable", + "methodName": "setHeight", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.util.function.Supplier" + "double" ], "parameterNames": [ - "name", - "value" + "height" ], "params": [ - "String name", - "Supplier value" + "double height" ], - "summary": "Shows a monitor for one of this sprite's variables in the top left corner\nof the stage, like Scratch's variable monitors: \"Cat: score\" and the\ncurrent value, updated every frame. Showing the same name again replaces\nthe monitor; it goes away with the sprite.", - "description": "Shows a monitor for one of this sprite's variables in the top left corner\nof the stage, like Scratch's variable monitors: \"Cat: score\" and the\ncurrent value, updated every frame. Showing the same name again replaces\nthe monitor; it goes away with the sprite.\n\n```java\npublic Cat() {\n this.addCostume(\"cat\", \"bunny1_stand\");\n this.showVariable(\"lives\", () -> lives);\n}\n```", - "scratchblock": "show variable [name v]", + "summary": "Draws the sprite this high; see [setWidth(double)](setWidth).", + "description": "Draws the sprite this high; see [setWidth(double)](setWidth).", + "scratchblock": null, "paramDocs": [ - "name: the variable's name, shown after the sprite's", - "value: gives the value to show; asked for it every frame" + "height: the height in stage pixels; 0 to follow the costume and size again" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/showVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Sprite/stamp()", - "memberId": "Sprite/stamp", + "id": "Sprite/setHitbox(Shape)", + "memberId": "Sprite/setHitbox", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "stamp", + "methodName": "setHitbox", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stamps the current sprite to the background. A stamp is a non interactive\nversion of the sprite.", - "description": "Stamps the current sprite to the background. A stamp is a non interactive\nversion of the sprite.", - "scratchblock": "stamp", - "paramDocs": [], + "parameterTypes": [ + "org.openpatch.scratch.Shape" + ], + "parameterNames": [ + "shape" + ], + "params": [ + "Shape shape" + ], + "summary": "Sets the hitbox: the shape that counts for touching, in costume pixels (origin at the\ncostume's top left corner, y down). It turns, grows and mirrors with the sprite.", + "description": "Sets the hitbox: the shape that counts for touching, in costume pixels (origin at the\ncostume's top left corner, y down). It turns, grows and mirrors with the sprite.", + "scratchblock": null, + "paramDocs": [ + "shape: the hitbox" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHitbox", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Druckt ein unbewegliches Abbild der Figur auf die Bühne" + "description": "Setzt die Trefferfläche auf die angegebene Form; (0/0) ist die Mitte der Figur" } } }, { - "id": "Sprite/stamp(Layer)", - "memberId": "Sprite/stamp", + "id": "Sprite/setLayer(Layer)", + "memberId": "Sprite/setLayer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "stamp", + "methodName": "setLayer", "static": false, "returnType": "void", "parameterTypes": [ @@ -7806,859 +8288,919 @@ "params": [ "Layer layer" ], - "summary": "Stamps the sprite onto one of the stage's layers. A stamp is a picture of\nthe sprite that stays where it is put, and is not interactive.", - "description": "Stamps the sprite onto one of the stage's layers. A stamp is a picture of\nthe sprite that stays where it is put, and is not interactive.\n\nExample usage:\n\n```java\nthis.stamp(Layer.UI);\n```", + "summary": "Moves the sprite to another layer, in front of the sprites already there. A sprite in\n[Layer.UI](../Layer/UI) ignores the camera; its pen moves to the UI layer too.", + "description": "Moves the sprite to another layer, in front of the sprites already there. A sprite in\n[Layer.UI](../Layer/UI) ignores the camera; its pen moves to the UI layer too.", "scratchblock": null, "paramDocs": [ - "layer: which layer to stamp onto" + "layer: the layer" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Druckt ein unbewegliches Abbild der Figur auf die angegebene Ebene" - } - } - }, - { - "id": "Sprite/stopAllSounds()", - "memberId": "Sprite/stopAllSounds", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "stopAllSounds", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the playing of all sounds of the sprite.", - "description": "Stops the playing of all sounds of the sprite.", - "scratchblock": "stop all sounds", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopAllSounds", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Stoppt alle Klänge dieser Figur" - } - } + "translations": {} }, { - "id": "Sprite/stopSound(String)", - "memberId": "Sprite/stopSound", + "id": "Sprite/setNineSlice(int,int,int,int)", + "memberId": "Sprite/setNineSlice", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "stopSound", + "methodName": "setNineSlice", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int", + "int", + "int", + "int" ], "parameterNames": [ - "name" + "top", + "right", + "bottom", + "left" ], "params": [ - "String name" + "int top", + "int right", + "int bottom", + "int left" ], - "summary": "Stops the playing of the sound with the given name", - "description": "Stops the playing of the sound with the given name", + "summary": "Stretches only the middle of the costume when the sprite is drawn at its own width and\nheight: the four corners keep their size (scaled with the sprite's size), the edges stretch\nalong one side.", + "description": "Stretches only the middle of the costume when the sprite is drawn at its own width and\nheight: the four corners keep their size (scaled with the sprite's size), the edges stretch\nalong one side.", "scratchblock": null, "paramDocs": [ - "name: Name of the sound" + "top: costume pixels at the top that keep their height", + "right: costume pixels at the right that keep their width", + "bottom: costume pixels at the bottom that keep their height", + "left: costume pixels at the left that keep their width" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setNineSlice", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Stoppt den Klang mit dem angegebenen Namen" - } - } + "translations": {} }, { - "id": "Sprite/switchCostume(String)", - "memberId": "Sprite/switchCostume", + "id": "Sprite/setPosition(double,double)", + "memberId": "Sprite/setPosition", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "switchCostume", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double" ], "parameterNames": [ - "name" + "x", + "y" ], "params": [ - "String name" + "double x", + "double y" ], - "summary": "Switch to a costume by name.", - "description": "Switch to a costume by name.", - "scratchblock": "switch costume to [name v]", + "summary": "Goes to a position; with the pen down, it draws a line there.", + "description": "Goes to a position; with the pen down, it draws a line there.", + "scratchblock": "go to x: (x) y: (y)", "paramDocs": [ - "name: the name of a costume" + "x: x of the new position", + "y: y of the new position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum Kostüm mit dem Namen" + "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Sprite/switchCostume(double)", - "memberId": "Sprite/switchCostume", + "id": "Sprite/setPosition(Vector2)", + "memberId": "Sprite/setPosition", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "switchCostume", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "index" + "position" ], "params": [ - "double index" + "Vector2 position" ], - "summary": "Switches the current costume of the sprite to the costume at the specified\nindex.", - "description": "Switches the current costume of the sprite to the costume at the specified\nindex.", - "scratchblock": "switch costume to (index)", + "summary": "Goes to a position; with the pen down, it draws a line there.", + "description": "Goes to a position; with the pen down, it draws a line there.", + "scratchblock": "go to x: (x) y: (y)", "paramDocs": [ - "index: The index of the costume to switch to." + "position: the new position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum Kostüm mit der angegebenen Nummer" + "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Sprite/think(String)", - "memberId": "Sprite/think", + "id": "Sprite/setRotationCenter(double,double)", + "memberId": "Sprite/setRotationCenter", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "think", + "methodName": "setRotationCenter", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double" ], "parameterNames": [ - "text" + "x", + "y" ], "params": [ - "String text" + "double x", + "double y" ], - "summary": "Displays a thought bubble with the specified text.", - "description": "Displays a thought bubble with the specified text.", - "scratchblock": "think [text]", + "summary": "Sets the point of the costumes the sprite turns around and stands on, in costume pixels from\nthe top left corner. Without it, that is the centre of each costume.", + "description": "Sets the point of the costumes the sprite turns around and stands on, in costume pixels from\nthe top left corner. Without it, that is the centre of each costume.", + "scratchblock": null, "paramDocs": [ - "text: The text to be displayed in the thought bubble." + "x: pixels from the left edge", + "y: pixels from the top edge" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationCenter", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Denkblase an" + "description": "Setzt den Punkt des Kostüms, um den sich die Figur dreht (Drehpunkt). Er sitzt an der Position der Figur. Angegeben in Pixeln des Kostüms von seiner linken oberen Ecke aus, wie bei setHitbox; er wächst mit der Größe und gilt für alle Kostüme." } } }, { - "id": "Sprite/think(String,int)", - "memberId": "Sprite/think", + "id": "Sprite/setRotationStyle(RotationStyle)", + "memberId": "Sprite/setRotationStyle", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "think", + "methodName": "setRotationStyle", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.RotationStyle" ], "parameterNames": [ - "text", - "millis" + "style" ], "params": [ - "String text", - "int millis" + "RotationStyle style" ], - "summary": "Displays a thought bubble with the specified text for a given duration.", - "description": "Displays a thought bubble with the specified text for a given duration.", - "scratchblock": "think [text] for (millis) seconds", + "summary": "", + "description": "", + "scratchblock": "set rotation style [left-right v]", "paramDocs": [ - "text: The text to be displayed in the thought bubble.", - "millis: The duration in milliseconds for which the thought bubble will\n be displayed." + "style: how the costume follows the direction" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationStyle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Denkblase für die angegebene Zeit in Millisekunden" + "description": "Legt fest, wie sich die Figur beim Drehen verhält" } } }, { - "id": "Sprite/turnLeft(double)", - "memberId": "Sprite/turnLeft", + "id": "Sprite/setSize(double)", + "memberId": "Sprite/setSize", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "turnLeft", + "methodName": "setSize", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "degrees" + "percent" ], "params": [ - "double degrees" + "double percent" ], - "summary": "Rotates the sprite by a certain degrees to the left.", - "description": "Rotates the sprite by a certain degrees to the left.", - "scratchblock": "turn left (degrees) degrees", + "summary": "", + "description": "", + "scratchblock": "set size to (percentage) %", "paramDocs": [ - "degrees: between 0 and 360" + "percent: the size in percent of the costume's own size" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnLeft", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Dreht die Figur um die angegebene Gradzahl nach links" + "description": "Setzt die Größe in Prozent (100 = Originalgröße)" } } }, { - "id": "Sprite/turnRight(double)", - "memberId": "Sprite/turnRight", + "id": "Sprite/setTint(Color)", + "memberId": "Sprite/setTint", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "turnRight", + "methodName": "setTint", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "degrees" + "color" ], "params": [ - "double degrees" + "Color color" ], - "summary": "Rotates the sprite by a certain degrees to the right.", - "description": "Rotates the sprite by a certain degrees to the right.", - "scratchblock": "turn right (degrees) degrees", + "summary": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", + "description": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", + "scratchblock": null, "paramDocs": [ - "degrees: between 0 and 360" + "color: the tint, or null for none" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnRight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Dreht die Figur um die angegebene Gradzahl nach rechts" + "description": "Färbt die Figur mit der angegebenen Farbe ein" } } }, { - "id": "Sprite/whenAddedToStage()", - "memberId": "Sprite/whenAddedToStage", + "id": "Sprite/setTint(double,double,double)", + "memberId": "Sprite/setTint", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenAddedToStage", + "methodName": "setTint", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the sprite is added to the stage. Override this\nmethod to define\ncustom behavior when the sprite is added to the stage.", - "description": "This method is called when the sprite is added to the stage. Override this\nmethod to define\ncustom behavior when the sprite is added to the stage.", + "parameterTypes": [ + "double", + "double", + "double" + ], + "parameterNames": [ + "red", + "green", + "blue" + ], + "params": [ + "double red", + "double green", + "double blue" + ], + "summary": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", + "description": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenAddedToStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn die Figur der Bühne hinzugefügt wird" + "description": "Färbt die Figur mit der angegebenen Farbe ein (Anteile jeweils 0 bis 255)" } } }, { - "id": "Sprite/whenBackdropSwitches(String)", - "memberId": "Sprite/whenBackdropSwitches", + "id": "Sprite/setTransparency(double)", + "memberId": "Sprite/setTransparency", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenBackdropSwitches", + "methodName": "setTransparency", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "name" + "percent" ], "params": [ - "String name" + "double percent" ], - "summary": "This method is called when the backdrop switches to the specified name.\nOverride this method to\ndefine custom behavior.", - "description": "This method is called when the backdrop switches to the specified name.\nOverride this method to\ndefine custom behavior.", - "scratchblock": "when backdrop switches to [name v]", + "summary": "Scratch's ghost effect.", + "description": "Scratch's ghost effect.", + "scratchblock": "set [ghost v] effect to (transparency)", "paramDocs": [ - "name: the name of the backdrop to switch to" + "percent: 0 opaque, 100 invisible" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenBackdropSwitches", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn der Hintergrund gewechselt wird" + "description": "Setzt die Transparenz in Prozent (0 = deckend, 100 = unsichtbar)" } } }, { - "id": "Sprite/whenClicked()", - "memberId": "Sprite/whenClicked", + "id": "Sprite/setVolume(double)", + "memberId": "Sprite/setVolume", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenClicked", + "methodName": "setVolume", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the sprite is clicked. Override this method to\ndefine custom\nbehavior for the sprite when it is clicked.", - "description": "This method is called when the sprite is clicked. Override this method to\ndefine custom\nbehavior for the sprite when it is clicked.", - "scratchblock": "when this sprite clicked", - "paramDocs": [], + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "volume" + ], + "params": [ + "double volume" + ], + "summary": "", + "description": "", + "scratchblock": "set volume to (percent) %", + "paramDocs": [ + "volume: this object's volume from 0 to 100" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenClicked", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn die Figur angeklickt wird" + "description": "Setzt die Lautstärke aller Klänge dieser Figur in Prozent" } } }, { - "id": "Sprite/whenIReceive(String)", - "memberId": "Sprite/whenIReceive", + "id": "Sprite/setWidth(double)", + "memberId": "Sprite/setWidth", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenIReceive", + "methodName": "setWidth", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "message" + "width" ], "params": [ - "String message" + "double width" ], - "summary": "This method is called when a message is received. Override this method to\ndefine custom\nbehavior.", - "description": "This method is called when a message is received. Override this method to\ndefine custom\nbehavior.", - "scratchblock": "when I receive [message v]", + "summary": "Draws the sprite this wide, whatever its costume's width and size: for buttons, panels and\nplatforms. With [setNineSlice(int, int, int, int)](setNineSlice) the corners keep their size.", + "description": "Draws the sprite this wide, whatever its costume's width and size: for buttons, panels and\nplatforms. With [setNineSlice(int, int, int, int)](setNineSlice) the corners keep their size.", + "scratchblock": null, "paramDocs": [ - "message: The message that is received." + "width: the width in stage pixels; 0 to follow the costume and size again" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenIReceive", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird aufgerufen, wenn die Bühne eine Nachricht sendet" - } - } + "translations": {} }, { - "id": "Sprite/whenKeyPressed(KeyCode)", - "memberId": "Sprite/whenKeyPressed", + "id": "Sprite/setX(double)", + "memberId": "Sprite/setX", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenKeyPressed", + "methodName": "setX", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "double" ], "parameterNames": [ - "keyCode" + "x" ], "params": [ - "KeyCode keyCode" + "double x" ], - "summary": "This method is called when a key is pressed. Override this method to define\ncustom behavior.", - "description": "This method is called when a key is pressed. Override this method to define\ncustom behavior.", - "scratchblock": "when [space v] key pressed", + "summary": "", + "description": "", + "scratchblock": "set x to (x)", "paramDocs": [ - "keyCode: the key that was pressed" + "x: the new x" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Drücken einer Taste aufgerufen" + "description": "Setzt die x-Position" } } }, { - "id": "Sprite/whenKeyReleased(KeyCode)", - "memberId": "Sprite/whenKeyReleased", + "id": "Sprite/setY(double)", + "memberId": "Sprite/setY", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenKeyReleased", + "methodName": "setY", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "double" ], "parameterNames": [ - "keyCode" + "y" ], "params": [ - "KeyCode keyCode" + "double y" ], - "summary": "This method is called when a key is released. Override this method to define\ncustom behavior.", - "description": "This method is called when a key is released. Override this method to define\ncustom behavior.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "set y to (y)", "paramDocs": [ - "keyCode: the key that was released" + "y: the new y" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyReleased", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Loslassen einer Taste aufgerufen" + "description": "Setzt die y-Position" } } }, { - "id": "Sprite/whenMouseClicked(MouseCode)", - "memberId": "Sprite/whenMouseClicked", + "id": "Sprite/show()", + "memberId": "Sprite/show", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenMouseClicked", + "methodName": "show", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Shows the sprite.", + "description": "Shows the sprite.", + "scratchblock": "show", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/show", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Macht die Figur sichtbar" + } + } + }, + { + "id": "Sprite/showVariable(String,Supplier)", + "memberId": "Sprite/showVariable", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "showVariable", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.MouseCode" + "java.lang.String", + "java.util.function.Supplier" ], "parameterNames": [ - "mouseCode" + "name", + "value" ], "params": [ - "MouseCode mouseCode" + "String name", + "Supplier value" ], - "summary": "This method is called when a mouse click event occurs. Override this method\nto define custom\nbehavior.", - "description": "This method is called when a mouse click event occurs. Override this method\nto define custom\nbehavior.", - "scratchblock": null, + "summary": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.", + "description": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.\n\n```java\nthis.showVariable(\"score\", () -> this.score);\n```", + "scratchblock": "show variable [name v]", "paramDocs": [ - "mouseCode: The code representing the mouse button that was clicked." + "name: the label", + "value: gives the value to show" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseClicked", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/showVariable", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/stamp()", + "memberId": "Sprite/stamp", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "stamp", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Stamps the costume onto the canvas of the sprite's pen layer (behind the sprites unless the\npen was moved): a picture of the sprite as it looks now, effects included, that stays.", + "description": "Stamps the costume onto the canvas of the sprite's pen layer (behind the sprites unless the\npen was moved): a picture of the sprite as it looks now, effects included, that stays.", + "scratchblock": "stamp", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei einem Mausklick aufgerufen, egal wo" + "description": "Druckt ein unbewegliches Abbild der Figur auf die Bühne" } } }, { - "id": "Sprite/whenMouseMoved(double,double)", - "memberId": "Sprite/whenMouseMoved", + "id": "Sprite/stamp(Layer)", + "memberId": "Sprite/stamp", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenMouseMoved", + "methodName": "stamp", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "org.openpatch.scratch.Layer" ], "parameterNames": [ - "x", - "y" + "layer" ], "params": [ - "double x", - "double y" + "Layer layer" ], - "summary": "This method is called when the mouse is moved. Override this method to define\ncustom behavior.", - "description": "This method is called when the mouse is moved. Override this method to define\ncustom behavior.", - "scratchblock": null, + "summary": "Stamps the costume onto the canvas of a layer.", + "description": "Stamps the costume onto the canvas of a layer.", + "scratchblock": "stamp", "paramDocs": [ - "x: The x-coordinate of the mouse pointer.", - "y: The y-coordinate of the mouse pointer." + "layer: the layer" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseMoved", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei jeder Mausbewegung aufgerufen; x und y sind Bühnenkoordinaten" + "description": "Druckt ein unbewegliches Abbild der Figur auf die angegebene Ebene" } } }, { - "id": "Sprite/whenRemovedFromStage()", - "memberId": "Sprite/whenRemovedFromStage", + "id": "Sprite/stopAllSounds()", + "memberId": "Sprite/stopAllSounds", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenRemovedFromStage", + "methodName": "stopAllSounds", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "This method is called when the sprite is removed from the stage. Override\nthis method to define\ncustom behavior when the sprite is removed.", - "description": "This method is called when the sprite is removed from the stage. Override\nthis method to define\ncustom behavior when the sprite is removed.", - "scratchblock": null, + "summary": "Stops every sound this object started.", + "description": "Stops every sound this object started.", + "scratchblock": "stop all sounds", "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenRemovedFromStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopAllSounds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn die Figur von der Bühne entfernt wird" + "description": "Stoppt alle Klänge dieser Figur" } } }, { - "id": "Sprite/whenStartsAsClone()", - "memberId": "Sprite/whenStartsAsClone", + "id": "Sprite/stopSound(String)", + "memberId": "Sprite/stopSound", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenStartsAsClone", + "methodName": "stopSound", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Runs when this sprite was just made as a clone, like Scratch's \"when I\nstart as a clone\". Override it to give clones their own behaviour, for\nexample to send a bullet on its way.", - "description": "Runs when this sprite was just made as a clone, like Scratch's \"when I\nstart as a clone\". Override it to give clones their own behaviour, for\nexample to send a bullet on its way.\n\n```java\npublic void whenStartsAsClone() {\n this.show();\n this.goToRandomPosition();\n}\n```", - "scratchblock": "when I start as a clone", - "paramDocs": [], + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "name" + ], + "params": [ + "String name" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "name: the sound to stop" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenStartsAsClone", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Stoppt den Klang mit dem angegebenen Namen" + } + } }, { - "id": "Stage/add(Sprite)", - "memberId": "Stage/add", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "add", + "id": "Sprite/switchCostume(String)", + "memberId": "Sprite/switchCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "switchCostume", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "java.lang.String" ], "parameterNames": [ - "sprite" + "name" ], "params": [ - "Sprite sprite" + "String name" ], - "summary": "Adds a sprite to the stage. Sprites are drawn in the order they were added, so a sprite added\nlater is drawn on top of one added earlier.", - "description": "Adds a sprite to the stage. Sprites are drawn in the order they were added, so a sprite added\nlater is drawn on top of one added earlier.", - "scratchblock": null, + "summary": "Switches to the costume with that name; an unknown name changes nothing.", + "description": "Switches to the costume with that name; an unknown name changes nothing.", + "scratchblock": "switch costume to [name v]", "paramDocs": [ - "sprite: the sprite to add" + "name: the costume's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt der Bühne eine Figur hinzu" + "description": "Wechselt zum Kostüm mit dem Namen" } } }, { - "id": "Stage/add(Text)", - "memberId": "Stage/add", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "add", + "id": "Sprite/switchCostume(double)", + "memberId": "Sprite/switchCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "switchCostume", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Text" + "double" ], "parameterNames": [ - "text" + "index" ], "params": [ - "Text text" + "double index" ], - "summary": "Add a text object to the stage", - "description": "Add a text object to the stage", - "scratchblock": null, + "summary": "Switches to a costume by number, counting from 0; numbers wrap around like Scratch's.", + "description": "Switches to a costume by number, counting from 0; numbers wrap around like Scratch's.", + "scratchblock": "switch costume to [name v]", "paramDocs": [ - "text: a text" + "index: the costume's number" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt der Bühne einen Text hinzu" + "description": "Wechselt zum Kostüm mit der angegebenen Nummer" } } }, { - "id": "Stage/add(Pen)", - "memberId": "Stage/add", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "add", + "id": "Sprite/think(String)", + "memberId": "Sprite/think", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "think", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Pen" + "java.lang.String" ], "parameterNames": [ - "pen" + "text" ], "params": [ - "Pen pen" + "String text" ], - "summary": "Adds a Pen object to the stage.", - "description": "Adds a Pen object to the stage.", - "scratchblock": null, + "summary": "Shows a thought bubble until the sprite thinks something else; an empty text removes it.", + "description": "Shows a thought bubble until the sprite thinks something else; an empty text removes it.", + "scratchblock": "think [text]", "paramDocs": [ - "pen: the Pen object to be added to the stage" + "text: what the sprite thinks" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt der Bühne einen Stift hinzu" + "description": "Zeigt eine Denkblase an" } } }, { - "id": "Stage/addBackdrop(String,String,boolean)", - "memberId": "Stage/addBackdrop", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addBackdrop", + "id": "Sprite/think(String,double)", + "memberId": "Sprite/think", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "think", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "boolean" + "double" ], "parameterNames": [ - "name", - "imagePath", - "stretch" + "text", + "seconds" ], "params": [ - "String name", - "String imagePath", - "boolean stretch" + "String text", + "double seconds" ], - "summary": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "description": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "scratchblock": null, + "summary": "Shows a thought bubble for a number of seconds of game time.", + "description": "Shows a thought bubble for a number of seconds of game time.", + "scratchblock": "think [text] for (seconds) seconds", "paramDocs": [ - "name: a unique name", - "imagePath: a image path, or the name of a built-in sprite such as\n \"bg_castle\"", - "stretch: stretch image to window size" + "text: what the sprite thinks", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt einen Hintergrund hinzu; bei stretch == true wird er auf Bühnengröße gedehnt" - } - } + "translations": {} }, { - "id": "Stage/addBackdrop(String,String)", - "memberId": "Stage/addBackdrop", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addBackdrop", + "id": "Sprite/toString()", + "memberId": "Sprite/toString", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "toString", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "The sprite's centre of the costume on the stage, as Scratch's \"x position\"/\"y position\".", + "description": "The sprite's centre of the costume on the stage, as Scratch's \"x position\"/\"y position\".", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/toString", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/turnLeft(double)", + "memberId": "Sprite/turnLeft", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "turnLeft", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "double" ], "parameterNames": [ - "name", - "imagePath" + "degrees" ], "params": [ - "String name", - "String imagePath" + "double degrees" ], - "summary": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "description": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "turn left (degrees) degrees", "paramDocs": [ - "name: a unique name", - "imagePath: a image path, or the name of a built-in sprite such as\n \"bg_castle\"" + "degrees: how far to turn anticlockwise" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnLeft", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen Hintergrund unter eigenem Namen hinzu" + "description": "Dreht die Figur um die angegebene Gradzahl nach links" } } }, { - "id": "Stage/addBackdrop(String)", - "memberId": "Stage/addBackdrop", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addBackdrop", + "id": "Sprite/turnRight(double)", + "memberId": "Sprite/turnRight", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "turnRight", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "name" + "degrees" ], "params": [ - "String name" + "double degrees" ], - "summary": "Add one of the backdrops that ship with Scratch for Java to the stage. The\nbackdrop gets the same name as the built-in sprite. If a backdrop with that\nname already exists do nothing.", - "description": "Add one of the backdrops that ship with Scratch for Java to the stage. The\nbackdrop gets the same name as the built-in sprite. If a backdrop with that\nname already exists do nothing.\n\nExample usage:\n\n```java\nthis.addBackdrop(\"bg_castle\");\n```", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "turn right (degrees) degrees", "paramDocs": [ - "name: the name of a built-in sprite, for example \"bg_castle\". Add the\n sheet in front of the name, for example \"platformer/grass\", if\n the same name exists on several sheets." + "degrees: how far to turn clockwise" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnRight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen der eingebauten Hintergründe hinzu" + "description": "Dreht die Figur um die angegebene Gradzahl nach rechts" } } }, { - "id": "Stage/addSound(String,String)", - "memberId": "Stage/addSound", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addSound", + "id": "Sprite/whenAddedToStage()", + "memberId": "Sprite/whenAddedToStage", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenAddedToStage", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "java.lang.String" - ], - "parameterNames": [ - "name", - "soundPath" - ], - "params": [ - "String name", - "String soundPath" - ], - "summary": "Add a sound to the stage. If a sound with the received name already exists do\nnothing.", - "description": "Add a sound to the stage. If a sound with the received name already exists do\nnothing.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Called when the sprite was added to a stage. Override it to react.", + "description": "Called when the sprite was added to a stage. Override it to react.", "scratchblock": null, - "paramDocs": [ - "name: a unique name", - "soundPath: a sound path, or the name of a built-in sound such as\n \"footstep_carpet_000\"" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenAddedToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen Klang unter eigenem Namen hinzu" + "description": "Wird aufgerufen, wenn die Figur der Bühne hinzugefügt wird" } } }, { - "id": "Stage/addSound(String)", - "memberId": "Stage/addSound", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addSound", + "id": "Sprite/whenBackdropSwitches(String)", + "memberId": "Sprite/whenBackdropSwitches", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenBackdropSwitches", "static": false, "returnType": "void", "parameterTypes": [ @@ -8670,63 +9212,55 @@ "params": [ "String name" ], - "summary": "Add one of the sounds that ship with Scratch for Java to the stage. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.", - "description": "Add one of the sounds that ship with Scratch for Java to the stage. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.\n\nExample usage:\n\n```java\nthis.addSound(\"footstep_carpet_000\");\n```", - "scratchblock": null, + "summary": "Called when the stage switches its backdrop.", + "description": "Called when the stage switches its backdrop.", + "scratchblock": "when backdrop switches to [name v]", "paramDocs": [ - "name: the name of a built-in sound, for example \"footstep_carpet_000\"" + "name: the new backdrop's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenBackdropSwitches", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen der eingebauten Klänge hinzu" + "description": "Wird aufgerufen, wenn der Hintergrund gewechselt wird" } } }, { - "id": "Stage/ask(String)", - "memberId": "Stage/ask", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "ask", + "id": "Sprite/whenClicked()", + "memberId": "Sprite/whenClicked", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenClicked", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "question" - ], - "params": [ - "String question" - ], - "summary": "Asks a question and waits for an answer to be typed in. A box appears at the\nbottom of the stage; whatever is typed goes into it until Enter is pressed.", - "description": "Asks a question and waits for an answer to be typed in. A box appears at the\nbottom of the stage; whatever is typed goes into it until Enter is pressed.\n\nUnlike Scratch, this does not pause anything. Your `run()` keeps being\ncalled while the question is on screen, so check [isAsking()](isAsking) or wait\nfor [getAnswer()](getAnswer) to change:\n\n```java\npublic void run() {\n if (!this.isAsking() && this.getAnswer().isEmpty()) {\n this.ask(\"What is your name?\");\n }\n if (!this.getAnswer().isEmpty()) {\n this.display(\"Hello \" + this.getAnswer() + \"!\");\n }\n}\n```", - "scratchblock": "ask [question] and wait", - "paramDocs": [ - "question: the question to show" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Called when this sprite is clicked: a mouse button is pressed over its hitbox, and no sprite\nin front of it is under the pointer.", + "description": "Called when this sprite is clicked: a mouse button is pressed over its hitbox, and no sprite\nin front of it is under the pointer.", + "scratchblock": "when this sprite clicked", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/ask", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenClicked", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" + "description": "Wird aufgerufen, wenn die Figur angeklickt wird" } } }, { - "id": "Stage/broadcast(String)", - "memberId": "Stage/broadcast", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "broadcast", + "id": "Sprite/whenIReceive(String)", + "memberId": "Sprite/whenIReceive", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenIReceive", "static": false, "returnType": "void", "parameterTypes": [ @@ -8738,4634 +9272,4500 @@ "params": [ "String message" ], - "summary": "Broadcasts a message to every sprite on the stage and to the stage itself,\nas in Scratch. Each of them runs its `whenIReceive` method with the\nmessage.", - "description": "Broadcasts a message to every sprite on the stage and to the stage itself,\nas in Scratch. Each of them runs its `whenIReceive` method with the\nmessage.", - "scratchblock": "broadcast [message v]", + "summary": "Called when a message is broadcast.", + "description": "Called when a message is broadcast.", + "scratchblock": "when I receive [message v]", "paramDocs": [ - "message: The message to broadcast." + "message: the message" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/broadcast", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenIReceive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Sendet eine Nachricht an alle whenIReceive-Empfänger" + "description": "Wird aufgerufen, wenn die Bühne eine Nachricht sendet" } } }, { - "id": "Stage/changeColor(double)", - "memberId": "Stage/changeColor", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeColor", + "id": "Sprite/whenKeyPressed(KeyCode)", + "memberId": "Sprite/whenKeyPressed", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenKeyPressed", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.KeyCode" ], "parameterNames": [ - "h" + "key" ], "params": [ - "double h" + "KeyCode key" ], - "summary": "Changes the background color by adding a step to the hue value.", - "description": "Changes the background color by adding a step to the hue value.", - "scratchblock": null, + "summary": "Called when a key is pressed, once per press (holding a key down does not repeat it).", + "description": "Called when a key is pressed, once per press (holding a key down does not repeat it).", + "scratchblock": "when [space v] key pressed", "paramDocs": [ - "h: a step value" + "key: the key" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert den Farbton des Hintergrunds um den angegebenen Wert" + "description": "Wird beim Drücken einer Taste aufgerufen" } } }, { - "id": "Stage/changeTint(double)", - "memberId": "Stage/changeTint", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeTint", + "id": "Sprite/whenKeyReleased(KeyCode)", + "memberId": "Sprite/whenKeyReleased", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenKeyReleased", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.KeyCode" ], "parameterNames": [ - "step" + "key" ], "params": [ - "double step" + "KeyCode key" ], - "summary": "Changes the colour the backdrop is tinted with by a step.", - "description": "Changes the colour the backdrop is tinted with by a step.", - "scratchblock": "change [color v] effect by (step)", + "summary": "Called when a key is released.", + "description": "Called when a key is released.", + "scratchblock": null, "paramDocs": [ - "step: a step value" + "key: the key" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyReleased", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert den Farbton der Einfärbung um den angegebenen Wert" + "description": "Wird beim Loslassen einer Taste aufgerufen" } } }, { - "id": "Stage/changeTransparency(double)", - "memberId": "Stage/changeTransparency", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeTransparency", + "id": "Sprite/whenMouseClicked(MouseCode)", + "memberId": "Sprite/whenMouseClicked", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenMouseClicked", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.MouseCode" ], "parameterNames": [ - "step" + "button" ], "params": [ - "double step" + "MouseCode button" ], - "summary": "Changes how see-through the backdrop is by a step. A positive step fades it\nout, a negative one brings it back.", - "description": "Changes how see-through the backdrop is by a step. A positive step fades it\nout, a negative one brings it back.", - "scratchblock": "change [ghost v] effect by (step)", + "summary": "Called when a mouse button is pressed anywhere on the stage.", + "description": "Called when a mouse button is pressed anywhere on the stage.", + "scratchblock": null, "paramDocs": [ - "step: a step value" + "button: the button" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseClicked", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert die Transparenz des Hintergrunds" + "description": "Wird bei einem Mausklick aufgerufen, egal wo" } } }, { - "id": "Stage/changeVolume(double)", - "memberId": "Stage/changeVolume", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeVolume", + "id": "Sprite/whenMouseMoved(double,double)", + "memberId": "Sprite/whenMouseMoved", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenMouseMoved", "static": false, "returnType": "void", "parameterTypes": [ + "double", "double" ], "parameterNames": [ - "step" + "x", + "y" ], "params": [ - "double step" + "double x", + "double y" ], - "summary": "Makes every sound of this stage louder or quieter.", - "description": "Makes every sound of this stage louder or quieter.", - "scratchblock": "change volume by (step)", + "summary": "Called when the mouse moves.", + "description": "Called when the mouse moves.", + "scratchblock": null, "paramDocs": [ - "step: how much to add to the volume, in percent" + "x: x of the mouse pointer (world)", + "y: y of the mouse pointer (world)" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseMoved", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert die Lautstärke um den angegebenen Wert" + "description": "Wird bei jeder Mausbewegung aufgerufen; x und y sind Bühnenkoordinaten" } } }, { - "id": "Stage/constructor()", - "memberId": "Stage/constructor", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "constructor", + "id": "Sprite/whenRemovedFromStage()", + "memberId": "Sprite/whenRemovedFromStage", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenRemovedFromStage", "static": false, - "returnType": "Stage", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Stage. A stage is as big as the window it is shown in, so\nthe window has to exist first:", - "description": "Constructs a new Stage. A stage is as big as the window it is shown in, so\nthe window has to exist first:\n\n```java\nWindow myWindow = new Window(480, 360);\nmyWindow.setStage(new MyStage());\n```", + "summary": "Called when the sprite was removed from its stage. Override it to react.", + "description": "Called when the sprite was removed from its stage. Override it to react.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenRemovedFromStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Bühne. Sie ist so groß wie das Fenster, das es schon geben muss" + "description": "Wird aufgerufen, wenn die Figur von der Bühne entfernt wird" } } }, { - "id": "Stage/count(Class)", - "memberId": "Stage/count", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "count", + "id": "Sprite/whenStartsAsClone()", + "memberId": "Sprite/whenStartsAsClone", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenStartsAsClone", "static": false, - "returnType": "int", - "parameterTypes": [ - "java.lang.Class" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Class c" - ], - "summary": "Returns the number of sprites of the specified class.", - "description": "Returns the number of sprites of the specified class.", - "scratchblock": null, - "paramDocs": [ - "c: the class of the sprites to count" - ], - "returns": "the number of sprites of the specified class", + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Called in a new clone, right after it was made.", + "description": "Called in a new clone, right after it was made.", + "scratchblock": "when I start as a clone", + "paramDocs": [], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/count", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenStartsAsClone", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Anzahl der Figuren dieser Klasse zurück, z.B. count(Apfel.class)" - } - } + "translations": {} }, { - "id": "Stage/debug(Object[])", - "memberId": "Stage/debug", + "id": "Stage/add(Sprite)", + "memberId": "Stage/add", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "debug", + "methodName": "add", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.Object[]" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "values" + "sprite" ], "params": [ - "Object[] values" + "Sprite sprite" ], - "summary": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the stage's class name so you can tell\nwhich stage it came from.", - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the stage's class name so you can tell\nwhich stage it came from.\n\nExample:\n\n```java\nthis.debug(\"score =\", score, \"lives =\", lives);\n// prints: [MyStage] score = 5 lives = 3\n```", + "summary": "Adds a sprite, in front of the sprites of its layer. A sprite can only be on one stage; it\nleaves the old one.", + "description": "Adds a sprite, in front of the sprites of its layer. A sprite can only be on one stage; it\nleaves the old one.", "scratchblock": null, "paramDocs": [ - "values: one or more values to print" + "sprite: the sprite" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/debug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Fügt der Bühne eine Figur hinzu" + } + } }, { - "id": "Stage/display(String)", - "memberId": "Stage/display", + "id": "Stage/add(Pen)", + "memberId": "Stage/add", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "display", + "methodName": "add", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Pen" ], "parameterNames": [ - "text" + "pen" ], "params": [ - "String text" + "Pen pen" ], - "summary": "Displays the given text on the stage.", - "description": "Displays the given text on the stage.", + "summary": "Adds a pen of its own.", + "description": "Adds a pen of its own.", "scratchblock": null, "paramDocs": [ - "text: the text to be displayed" + "pen: the pen" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt einen Text am unteren Rand der Bühne an" + "description": "Fügt der Bühne einen Stift hinzu" } } }, { - "id": "Stage/display(String,int)", - "memberId": "Stage/display", + "id": "Stage/add(Text)", + "memberId": "Stage/add", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "display", + "methodName": "add", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.Text" ], "parameterNames": [ - "text", - "millis" + "text" ], "params": [ - "String text", - "int millis" + "Text text" ], - "summary": "Displays the given text on the screen for a specified duration.", - "description": "Displays the given text on the screen for a specified duration.", + "summary": "Adds a text of its own.", + "description": "Adds a text of its own.", "scratchblock": null, "paramDocs": [ - "text: The text to be displayed.", - "millis: The duration in milliseconds for which the text will be\n displayed." + "text: the text" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zeigt einen Text für die angegebene Zeit in Millisekunden an" - } - } - }, - { - "id": "Stage/eraseAll()", - "memberId": "Stage/eraseAll", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "eraseAll", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Erases all lines on the pen layer.", - "description": "Erases all lines on the pen layer.", - "scratchblock": "erase all", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/eraseAll", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Löscht alles, was mit Stiften gezeichnet wurde" + "description": "Fügt der Bühne einen Text hinzu" } } }, { - "id": "Stage/exit()", - "memberId": "Stage/exit", + "id": "Stage/addBackdrop(String,String)", + "memberId": "Stage/addBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "exit", + "methodName": "addBackdrop", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Close the window and therefore the whole application.", - "description": "Close the window and therefore the whole application.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/exit", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Beendet das Programm" - } - } - }, - { - "id": "Stage/find(Class)", - "memberId": "Stage/find", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "find", - "static": false, - "returnType": "List", "parameterTypes": [ - "java.lang.Class" + "java.lang.String", + "java.lang.String" ], "parameterNames": [ - "c" + "name", + "imagePath" ], "params": [ - "Class c" + "String name", + "String imagePath" ], - "summary": "Find sprites of a given class.", - "description": "Find sprites of a given class.", + "summary": "Adds a backdrop. The first one added is shown.", + "description": "Adds a backdrop. The first one added is shown.", "scratchblock": null, "paramDocs": [ - "c: Class" + "name: the backdrop's name", + "imagePath: the image file" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/find", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt alle Figuren dieser Klasse zurück, z.B. find(Apfel.class)" - } - } - }, - { - "id": "Stage/getAll()", - "memberId": "Stage/getAll", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "getAll", - "static": false, - "returnType": "List", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves a list of all sprites in the current stage.", - "description": "Retrieves a list of all sprites in the current stage.", - "scratchblock": null, - "paramDocs": [], - "returns": "a list containing all sp", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAll", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt alle Figuren auf der Bühne zurück" + "description": "Fügt einen Hintergrund unter eigenem Namen hinzu" } } }, { - "id": "Stage/getAnswer()", - "memberId": "Stage/getAnswer", + "id": "Stage/addBackdrop(String)", + "memberId": "Stage/addBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getAnswer", + "methodName": "addBackdrop", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the last answer that was typed in.", - "description": "Returns the last answer that was typed in.", - "scratchblock": "(answer)", - "paramDocs": [], - "returns": "the answer, or an empty string if nothing has been answered yet", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "imagePath" + ], + "params": [ + "String imagePath" + ], + "summary": "Adds a backdrop, named after its file.", + "description": "Adds a backdrop, named after its file.", + "scratchblock": null, + "paramDocs": [ + "imagePath: the image file, or a built-in sprite's name" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAnswer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die zuletzt eingegebene Antwort zurück, sonst eine leere Zeichenkette" + "description": "Fügt einen der eingebauten Hintergründe hinzu" } } }, { - "id": "Stage/getCamera()", - "memberId": "Stage/getCamera", + "id": "Stage/addBackdrop(String,String,boolean)", + "memberId": "Stage/addBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getCamera", + "methodName": "addBackdrop", "static": false, - "returnType": "Camera", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the current camera instance associated with this stage.", - "description": "Retrieves the current camera instance associated with this stage.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "boolean" + ], + "parameterNames": [ + "name", + "imagePath", + "stretch" + ], + "params": [ + "String name", + "String imagePath", + "boolean stretch" + ], + "summary": "Adds a backdrop, optionally stretched to the stage's size.", + "description": "Adds a backdrop, optionally stretched to the stage's size.", "scratchblock": null, - "paramDocs": [], - "returns": "the current Camera object.", + "paramDocs": [ + "name: the backdrop's name", + "imagePath: the image file, or a built-in sprite's name", + "stretch: whether to stretch it to the stage's size" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCamera", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Kamera der Bühne zurück" + "description": "Fügt einen Hintergrund hinzu; bei stretch == true wird er auf Bühnengröße gedehnt" } } }, { - "id": "Stage/getColor()", - "memberId": "Stage/getColor", + "id": "Stage/addSound(String,String)", + "memberId": "Stage/addSound", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getColor", + "methodName": "addSound", "static": false, - "returnType": "Color", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current color of the stage.", - "description": "Returns the current color of the stage.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "soundPath" + ], + "params": [ + "String name", + "String soundPath" + ], + "summary": "Adds a sound (WAV or OGG).", + "description": "Adds a sound (WAV or OGG).", "scratchblock": null, - "paramDocs": [], - "returns": "the current color", + "paramDocs": [ + "name: the sound's name, for [playSound(String)](playSound)", + "soundPath: the sound file" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Hintergrundfarbe zurück" + "description": "Fügt einen Klang unter eigenem Namen hinzu" } } }, { - "id": "Stage/getCurrentBackdropIndex()", - "memberId": "Stage/getCurrentBackdropIndex", + "id": "Stage/addSound(String)", + "memberId": "Stage/addSound", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getCurrentBackdropIndex", + "methodName": "addSound", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current backdrop index", - "description": "Returns the current backdrop index", - "scratchblock": "(backdrop [number v])", - "paramDocs": [], - "returns": "a backdrop index", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "soundPath" + ], + "params": [ + "String soundPath" + ], + "summary": "Adds a sound, named after its file.", + "description": "Adds a sound, named after its file.", + "scratchblock": null, + "paramDocs": [ + "soundPath: the sound file" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropIndex", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Nummer des aktuellen Hintergrunds zurück" + "description": "Fügt einen der eingebauten Klänge hinzu" } } }, { - "id": "Stage/getCurrentBackdropName()", - "memberId": "Stage/getCurrentBackdropName", + "id": "Stage/ask(String)", + "memberId": "Stage/ask", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getCurrentBackdropName", + "methodName": "ask", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current backdrop name", - "description": "Returns the current backdrop name", - "scratchblock": "(backdrop [name v])", - "paramDocs": [], - "returns": "a backdrop name", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "question" + ], + "params": [ + "String question" + ], + "summary": "Asks a question in a box along the bottom of the stage, as Scratch does, with a field to type\nthe answer in. Enter or the check button finishes it: then [isAsking()](isAsking) is false and [getAnswer()](getAnswer) has the answer.\nWhile a question is open, keys go to the answer box, not to the stage and its sprites.", + "description": "Asks a question in a box along the bottom of the stage, as Scratch does, with a field to type\nthe answer in. Enter or the check button finishes it: then [isAsking()](isAsking) is false and [getAnswer()](getAnswer) has the answer.\nWhile a question is open, keys go to the answer box, not to the stage and its sprites.", + "scratchblock": "ask [question] and wait", + "paramDocs": [ + "question: the question" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropName", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/ask", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Namen des aktuellen Hintergrunds zurück" + "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" } } }, { - "id": "Stage/getDeltaTime()", - "memberId": "Stage/getDeltaTime", + "id": "Stage/broadcast(String)", + "memberId": "Stage/broadcast", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getDeltaTime", + "methodName": "broadcast", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Gets the seconds passed since the last frame.", - "description": "Gets the seconds passed since the last frame.", - "scratchblock": null, - "paramDocs": [], - "returns": "secons since last frame", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "message" + ], + "params": [ + "String message" + ], + "summary": "Sends a message to every sprite and then the stage; their `whenIReceive` runs at once.", + "description": "Sends a message to every sprite and then the stage; their `whenIReceive` runs at once.", + "scratchblock": "broadcast [message v]", + "paramDocs": [ + "message: the message" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getDeltaTime", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/broadcast", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" + "description": "Sendet eine Nachricht an alle whenIReceive-Empfänger" } } }, { - "id": "Stage/getFrameRate()", - "memberId": "Stage/getFrameRate", + "id": "Stage/changeColorEffect(double)", + "memberId": "Stage/changeColorEffect", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getFrameRate", + "methodName": "changeColorEffect", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Get the frame rate of the application.", - "description": "Get the frame rate of the application.", - "scratchblock": null, - "paramDocs": [], - "returns": "the frame rate", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [color v] effect by (by)", + "paramDocs": [ + "by: how much to change the backdrop's colour effect" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getFrameRate", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die aktuelle Bildrate zurück" - } - } + "translations": {} }, { - "id": "Stage/getHeight()", - "memberId": "Stage/getHeight", + "id": "Stage/changeTransparency(double)", + "memberId": "Stage/changeTransparency", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getHeight", + "methodName": "changeTransparency", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "scratchblock": null, - "paramDocs": [], - "returns": "the height of the sprite", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [ghost v] effect by (step)", + "paramDocs": [ + "by: how much to change the backdrop's transparency" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Höhe der Bühne in Pixeln zurück" + "description": "Ändert die Transparenz des Hintergrunds" } } }, { - "id": "Stage/getMouse()", - "memberId": "Stage/getMouse", + "id": "Stage/changeVolume(double)", + "memberId": "Stage/changeVolume", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getMouse", + "methodName": "changeVolume", "static": false, - "returnType": "Vector2", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current position of the mouse cursor as a Vector2", - "description": "Returns the current position of the mouse cursor as a Vector2", - "scratchblock": null, - "paramDocs": [], - "returns": "mouse position", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change volume by (step)", + "paramDocs": [ + "by: how much to change the volume" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouse", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Position des Mauszeigers zurück" + "description": "Ändert die Lautstärke um den angegebenen Wert" } } }, { - "id": "Stage/getMouseX()", - "memberId": "Stage/getMouseX", + "id": "Stage/constructor()", + "memberId": "Stage/constructor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getMouseX", + "methodName": "constructor", "static": false, - "returnType": "double", + "returnType": "Stage", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current x-position of the mouse cursor", - "description": "Returns the current x-position of the mouse cursor", - "scratchblock": "(mouse x)", + "summary": "A stage the size of the window.", + "description": "A stage the size of the window.", + "scratchblock": null, "paramDocs": [], - "returns": "x-position", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die x-Position des Mauszeigers zurück" + "description": "Erzeugt eine Bühne. Sie ist so groß wie das Fenster, das es schon geben muss" } } }, { - "id": "Stage/getMouseY()", - "memberId": "Stage/getMouseY", + "id": "Stage/count(Class)", + "memberId": "Stage/count", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getMouseY", + "methodName": "count", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current y-position of the mouse cursor", - "description": "Returns the current y-position of the mouse cursor", - "scratchblock": "(mouse y)", - "paramDocs": [], - "returns": "y-position", + "returnType": "int", + "parameterTypes": [ + "java.lang.Class" + ], + "parameterNames": [ + "type" + ], + "params": [ + "Class type" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "type: a class of sprites" + ], + "returns": "how many sprites of that class are on the stage", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/count", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die y-Position des Mauszeigers zurück" + "description": "Gibt die Anzahl der Figuren dieser Klasse zurück, z.B. count(Apfel.class)" } } }, { - "id": "Stage/getPixels()", - "memberId": "Stage/getPixels", + "id": "Stage/debug(Object[])", + "memberId": "Stage/debug", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getPixels", + "methodName": "debug", "static": false, - "returnType": "Pixels", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the colours of everything this stage has drawn.", - "description": "Returns the colours of everything this stage has drawn.\n\nExample usage:\n\n```java\nint[] colours = this.getPixels().main();\n```", + "returnType": "void", + "parameterTypes": [ + "java.lang.Object[]" + ], + "parameterNames": [ + "values" + ], + "params": [ + "Object[] values" + ], + "summary": "Prints values for debugging, but only while debug mode is on.", + "description": "Prints values for debugging, but only while debug mode is on.", "scratchblock": null, - "paramDocs": [], - "returns": "the pixels", + "paramDocs": [ + "values: what to print" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getPixels", - "availability": "desktop-only", - "availabilityReason": "The desktop pixel buffer is not exposed by the browser renderer.", - "translations": { - "de": { - "description": "Nur in der Desktop-Version: Zugriff auf einzelne Bildpunkte" - } - } + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/debug", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} }, { - "id": "Stage/getShaders()", - "memberId": "Stage/getShaders", + "id": "Stage/display(String)", + "memberId": "Stage/display", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getShaders", + "methodName": "display", "static": false, - "returnType": "Shaders", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shaders of this stage. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.", - "description": "Returns the shaders of this stage. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.\n\nExample usage:\n\n```java\nthis.getShaders().add(\"blur\", \"blur.frag\", null);\nthis.getShaders().switchTo(\"blur\");\n```\n\nSeveral shaders can be active at once with `activate`: the stage\ndraws with each in turn, in the order they were added.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "text" + ], + "params": [ + "String text" + ], + "summary": "Shows a text in a band along the bottom of the stage until something else is displayed; an\nempty text removes the band.", + "description": "Shows a text in a band along the bottom of the stage until something else is displayed; an\nempty text removes the band.", "scratchblock": null, - "paramDocs": [], - "returns": "the shaders", + "paramDocs": [ + "text: what to show" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getShaders", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Shader der Bühne zurück; sie verändern das ganze Bild ohne die UI" + "description": "Zeigt einen Text am unteren Rand der Bühne an" } } }, { - "id": "Stage/getSorting()", - "memberId": "Stage/getSorting", + "id": "Stage/display(String,double)", + "memberId": "Stage/display", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getSorting", + "methodName": "display", "static": false, - "returnType": "Sorting", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the order in which the sprites of this stage are drawn.", - "description": "Returns the order in which the sprites of this stage are drawn.\n\nExample usage:\n\n```java\nthis.getSorting().byY();\n```", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "double" + ], + "parameterNames": [ + "text", + "seconds" + ], + "params": [ + "String text", + "double seconds" + ], + "summary": "Shows a text in a band along the bottom of the stage for a number of seconds of game time.", + "description": "Shows a text in a band along the bottom of the stage for a number of seconds of game time.", "scratchblock": null, - "paramDocs": [], - "returns": "the sorting", + "paramDocs": [ + "text: what to show", + "seconds: how long" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getSorting", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Sortierung der Bühne zurück. Mit getSorting().byY() werden Figuren weiter unten vor denen weiter oben gezeichnet." - } - } + "translations": {} }, { - "id": "Stage/getTimer()", - "memberId": "Stage/getTimer", + "id": "Stage/eraseAll()", + "memberId": "Stage/eraseAll", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getTimer", + "methodName": "eraseAll", "static": false, - "returnType": "Timer", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the timer", - "description": "Returns the timer", - "scratchblock": "(timer)", + "summary": "Erases everything every pen drew and everything stamped, on every layer.", + "description": "Erases everything every pen drew and everything stamped, on every layer.", + "scratchblock": "erase all", "paramDocs": [], - "returns": "the timer", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTimer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/eraseAll", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Standard-Timer der Bühne zurück" + "description": "Löscht alles, was mit Stiften gezeichnet wurde" } } }, { - "id": "Stage/getTimer(String)", - "memberId": "Stage/getTimer", + "id": "Stage/extension(Class,Supplier)", + "memberId": "Stage/extension", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getTimer", + "methodName": "extension", "static": false, - "returnType": "Timer", + "returnType": "T", "parameterTypes": [ - "java.lang.String" + "java.lang.Class", + "java.util.function.Supplier" ], "parameterNames": [ - "name" + "type", + "factory" ], "params": [ - "String name" + "Class type", + "Supplier factory" ], - "summary": "Returns a timer by name", - "description": "Returns a timer by name", + "summary": "An extension's state for this stage, made on first use. For extensions, not for learner code.", + "description": "An extension's state for this stage, made on first use. For extensions, not for learner code.", "scratchblock": null, "paramDocs": [ - "name: a name" + "type: the state's class", + "factory: makes it" ], - "returns": "the timer", + "returns": "the stage's one instance", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTimer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/extension", + "availability": "desktop-only", + "availabilityReason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others.", + "translations": {} + }, + { + "id": "Stage/find(Class)", + "memberId": "Stage/find", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "find", + "static": false, + "returnType": "List", + "parameterTypes": [ + "java.lang.Class" + ], + "parameterNames": [ + "type" + ], + "params": [ + "Class type" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "type: a class of sprites" + ], + "returns": "every sprite of that class (subclasses included), back to front", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/find", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Timer mit dem angegebenen Namen zurück und legt ihn bei Bedarf an" + "description": "Gibt alle Figuren dieser Klasse zurück, z.B. find(Apfel.class)" } } }, { - "id": "Stage/getVolume()", - "memberId": "Stage/getVolume", + "id": "Stage/getAll()", + "memberId": "Stage/getAll", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getVolume", + "methodName": "getAll", "static": false, - "returnType": "double", + "returnType": "List", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns how loud the sounds of this stage play.", - "description": "Returns how loud the sounds of this stage play.", - "scratchblock": "(volume)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "the volume, from 0 to 100", + "returns": "every sprite on the stage, back to front, layer by layer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAll", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Lautstärke in Prozent zurück" + "description": "Gibt alle Figuren auf der Bühne zurück" } } }, { - "id": "Stage/getWidth()", - "memberId": "Stage/getWidth", + "id": "Stage/getAnswer()", + "memberId": "Stage/getAnswer", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getWidth", + "methodName": "getAnswer", "static": false, - "returnType": "int", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "(answer)", "paramDocs": [], - "returns": "the width of the sprite", + "returns": "the answer to the last question, \"\" before the first", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAnswer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Breite der Bühne in Pixeln zurück" + "description": "Gibt die zuletzt eingegebene Antwort zurück, sonst eine leere Zeichenkette" } } }, { - "id": "Stage/hideVariable(String)", - "memberId": "Stage/hideVariable", + "id": "Stage/getCamera()", + "memberId": "Stage/getCamera", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "hideVariable", + "methodName": "getCamera", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "description": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "scratchblock": "hide variable [name v]", - "paramDocs": [ - "name: the name the monitor was shown with" - ], - "returns": null, + "returnType": "Camera", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the stage's camera", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/hideVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCamera", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt die Kamera der Bühne zurück" + } + } }, { - "id": "Stage/isAsking()", - "memberId": "Stage/isAsking", + "id": "Stage/getColor()", + "memberId": "Stage/getColor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isAsking", + "methodName": "getColor", "static": false, - "returnType": "boolean", + "returnType": "Color", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether a question is on screen and still waiting for an answer.", - "description": "Checks whether a question is on screen and still waiting for an answer.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true while a question is waiting", + "returns": "the colour behind the backdrop", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isAsking", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" + "description": "Gibt die Hintergrundfarbe zurück" } } }, { - "id": "Stage/isDebug()", - "memberId": "Stage/isDebug", + "id": "Stage/getColorEffect()", + "memberId": "Stage/getColorEffect", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isDebug", + "methodName": "getColorEffect", "static": false, - "returnType": "boolean", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the application is in debug mode.", - "description": "Checks if the application is in debug mode.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true if the application is in debug mode, false otherwise.", + "returns": "the backdrop's colour effect", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isDebug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn die Fehlersuche eingeschaltet ist" - } - } + "translations": {} }, { - "id": "Stage/isKeyPressed(KeyCode)", - "memberId": "Stage/isKeyPressed", + "id": "Stage/getCurrentBackdropIndex()", + "memberId": "Stage/getCurrentBackdropIndex", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isKeyPressed", + "methodName": "getCurrentBackdropIndex", "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.KeyCode" - ], - "parameterNames": [ - "keyCode" - ], - "params": [ - "KeyCode keyCode" - ], - "summary": "Returns true if the key is pressed", - "description": "Returns true if the key is pressed", - "scratchblock": "<key [space v] pressed?>", - "paramDocs": [ - "keyCode: a key" - ], - "returns": "key pressed", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(backdrop [number v])", + "paramDocs": [], + "returns": "the current backdrop's number, counting from 0", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropIndex", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" + "description": "Gibt die Nummer des aktuellen Hintergrunds zurück" } } }, { - "id": "Stage/isMouseDown()", - "memberId": "Stage/isMouseDown", + "id": "Stage/getCurrentBackdropName()", + "memberId": "Stage/getCurrentBackdropName", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isMouseDown", + "methodName": "getCurrentBackdropName", "static": false, - "returnType": "boolean", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true is the mouse button is down", - "description": "Returns true is the mouse button is down", - "scratchblock": "<mouse down?>", + "summary": "", + "description": "", + "scratchblock": "(backdrop [name v])", "paramDocs": [], - "returns": "mouse button down", + "returns": "the current backdrop's name, or null without backdrops", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isMouseDown", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" + "description": "Gibt den Namen des aktuellen Hintergrunds zurück" } } }, { - "id": "Stage/isSoundPlaying(String)", - "memberId": "Stage/isSoundPlaying", + "id": "Stage/getHeight()", + "memberId": "Stage/getHeight", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isSoundPlaying", + "methodName": "getHeight", "static": false, - "returnType": "boolean", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Returns true if the sound if playing", - "description": "Returns true if the sound if playing", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "name: " - ], - "returns": "playing", + "paramDocs": [], + "returns": "the stage's height in stage pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isSoundPlaying", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" + "description": "Gibt die Höhe der Bühne in Pixeln zurück" } } }, { - "id": "Stage/nextBackdrop()", - "memberId": "Stage/nextBackdrop", + "id": "Stage/getMouse()", + "memberId": "Stage/getMouse", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "nextBackdrop", + "methodName": "getMouse", "static": false, - "returnType": "void", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to the next backdrop.", - "description": "Switch to the next backdrop.", - "scratchblock": "next backdrop", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the mouse pointer in world coordinates", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/nextBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouse", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum nächsten Hintergrund" + "description": "Gibt die Position des Mauszeigers zurück" } } }, { - "id": "Stage/pickRandom(int,int)", - "memberId": "Stage/pickRandom", + "id": "Stage/getMouseX()", + "memberId": "Stage/getMouseX", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "pickRandom", + "methodName": "getMouseX", "static": false, - "returnType": "int", - "parameterTypes": [ - "int", - "int" - ], - "parameterNames": [ - "from", - "to" - ], - "params": [ - "int from", - "int to" - ], - "summary": "Returns a random integer between the specified range (inclusive).", - "description": "Returns a random integer between the specified range (inclusive).", - "scratchblock": "(pick random (from) to (to))", - "paramDocs": [ - "from: the lower bound of the range (inclusive)", - "to: the upper bound of the range (inclusive)" - ], - "returns": "a random integer between `from` and `to` (inclusive)", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(mouse x)", + "paramDocs": [], + "returns": "x of the mouse pointer in world coordinates", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/pickRandom", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" + "description": "Gibt die x-Position des Mauszeigers zurück" } } }, { - "id": "Stage/playSound(String)", - "memberId": "Stage/playSound", + "id": "Stage/getMouseY()", + "memberId": "Stage/getMouseY", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "playSound", + "methodName": "getMouseY", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Plays a sound.", - "description": "Plays a sound.\n\nplaySoundCopy() returns an independent SoundPlayback with its own volume\nand can overlap earlier plays of the same sound.", - "scratchblock": "start sound [name v]", - "paramDocs": [ - "name: the sound name" - ], - "returns": null, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(mouse y)", + "paramDocs": [], + "returns": "y of the mouse pointer in world coordinates", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Spielt einen zuvor hinzugefügten Klang ab" + "description": "Gibt die y-Position des Mauszeigers zurück" } } }, { - "id": "Stage/playSoundCopy(String,double)", - "memberId": "Stage/playSoundCopy", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "playSoundCopy", - "static": false, - "returnType": "SoundPlayback", - "parameterTypes": [ - "java.lang.String", - "double" - ], - "parameterNames": [ - "name", - "volume" - ], - "params": [ - "String name", - "double volume" - ], - "summary": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this stage.\nThe stage's ordinary volume does not change a copy's explicit volume.", - "description": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this stage.\nThe stage's ordinary volume does not change a copy's explicit volume.", - "scratchblock": null, - "paramDocs": [ - "name: a sound already added with addSound()", - "volume: volume from 0 to 100 percent" - ], - "returns": "this individual playback, also usable in try-with-resources", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSoundCopy", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Stage/previousBackdrop()", - "memberId": "Stage/previousBackdrop", + "id": "Stage/getShaders()", + "memberId": "Stage/getShaders", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "previousBackdrop", + "methodName": "getShaders", "static": false, - "returnType": "void", + "returnType": "Shaders", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to the previous backdrop.", - "description": "Switch to the previous backdrop.", - "scratchblock": "switch backdrop to [previous backdrop v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the stage's shaders, applied to the picture of its world layers", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/previousBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getShaders", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum vorherigen Hintergrund" + "description": "Gibt die Shader der Bühne zurück; sie verändern das ganze Bild ohne die UI" } } }, { - "id": "Stage/randomBackdrop()", - "memberId": "Stage/randomBackdrop", + "id": "Stage/getTimer()", + "memberId": "Stage/getTimer", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "randomBackdrop", + "methodName": "getTimer", "static": false, - "returnType": "void", + "returnType": "Timer", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to a random backdrop.", - "description": "Switch to a random backdrop.", - "scratchblock": "switch backdrop to [random backdrop v]", + "summary": "", + "description": "", + "scratchblock": "(timer)", "paramDocs": [], - "returns": null, + "returns": "this object's timer, counting game time since it was made or reset", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/randomBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTimer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zu einem zufälligen Hintergrund" + "description": "Gibt den Standard-Timer der Bühne zurück" } } }, { - "id": "Stage/remove(Sprite)", - "memberId": "Stage/remove", + "id": "Stage/getTransparency()", + "memberId": "Stage/getTransparency", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "getTransparency", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "sprite" - ], - "params": [ - "Sprite sprite" - ], - "summary": "Removes the specified sprite from the stage.", - "description": "Removes the specified sprite from the stage.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "sprite: the sprite to be removed" - ], - "returns": null, + "paramDocs": [], + "returns": "the backdrop's transparency in percent", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Entfernt die Figur von der Bühne" - } - } + "translations": {} }, { - "id": "Stage/remove(Pen)", - "memberId": "Stage/remove", + "id": "Stage/getVolume()", + "memberId": "Stage/getVolume", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "getVolume", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Pen" - ], - "parameterNames": [ - "pen" - ], - "params": [ - "Pen pen" - ], - "summary": "Removes the specified pen from the stage.", - "description": "Removes the specified pen from the stage.", - "scratchblock": null, - "paramDocs": [ - "pen: the pen to be removed" - ], - "returns": null, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(volume)", + "paramDocs": [], + "returns": "this object's volume from 0 to 100", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt den Stift von der Bühne" + "description": "Gibt die Lautstärke in Prozent zurück" } } }, { - "id": "Stage/remove(Text)", - "memberId": "Stage/remove", + "id": "Stage/getWidth()", + "memberId": "Stage/getWidth", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "getWidth", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Text" - ], - "parameterNames": [ - "text" - ], - "params": [ - "Text text" - ], - "summary": "Removes the specified text from the stage.", - "description": "Removes the specified text from the stage.", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "text: the text to be removed" - ], - "returns": null, + "paramDocs": [], + "returns": "the stage's width in stage pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt den Text von der Bühne" + "description": "Gibt die Breite der Bühne in Pixeln zurück" } } }, { - "id": "Stage/remove(Class)", - "memberId": "Stage/remove", + "id": "Stage/hideVariable(String)", + "memberId": "Stage/hideVariable", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "hideVariable", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.Class" + "java.lang.String" ], "parameterNames": [ - "c" + "name" ], "params": [ - "Class c" + "String name" ], - "summary": "Removes all sprites of the specified class from the stage.", - "description": "Removes all sprites of the specified class from the stage.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "hide variable [name v]", "paramDocs": [ - "c: the class of the sprites to remove" + "name: the label of a variable to hide again" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/hideVariable", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Entfernt alle Figuren dieser Klasse von der Bühne, z.B. remove(Apfel.class)" - } - } + "translations": {} }, { - "id": "Stage/removeAll()", - "memberId": "Stage/removeAll", + "id": "Stage/isAsking()", + "memberId": "Stage/isAsking", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "removeAll", + "methodName": "isAsking", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes all elements from the stage.", - "description": "Removes all elements from the stage.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether a question is waiting for its answer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/removeAll", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isAsking", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt alle Figuren von der Bühne" + "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" } } }, { - "id": "Stage/run()", - "memberId": "Stage/run", + "id": "Stage/isKeyPressed(KeyCode)", + "memberId": "Stage/isKeyPressed", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "run", + "methodName": "isKeyPressed", "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Executes the main logic of the stage. This method should be overridden by\nsubclasses to define\nthe specific behavior of the stage.", - "description": "Executes the main logic of the stage. This method should be overridden by\nsubclasses to define\nthe specific behavior of the stage.", - "scratchblock": null, - "paramDocs": [], - "returns": null, + "returnType": "boolean", + "parameterTypes": [ + "org.openpatch.scratch.KeyCode" + ], + "parameterNames": [ + "key" + ], + "params": [ + "KeyCode key" + ], + "summary": "", + "description": "", + "scratchblock": "<key [space v] pressed?>", + "paramDocs": [ + "key: a key" + ], + "returns": "whether the key is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/run", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird in jedem Frame aufgerufen" + "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" } } }, { - "id": "Stage/setColor(double)", - "memberId": "Stage/setColor", + "id": "Stage/isMouseDown()", + "memberId": "Stage/isMouseDown", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setColor", + "methodName": "isMouseDown", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "h" - ], - "params": [ - "double h" - ], - "summary": "Sets the background color via a hue value", - "description": "Sets the background color via a hue value", - "scratchblock": null, - "paramDocs": [ - "h: a hue value [0...255]" - ], - "returns": null, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "<mouse down?>", + "paramDocs": [], + "returns": "whether a mouse button is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isMouseDown", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe über den Farbton (0 bis 255)" + "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" } } }, { - "id": "Stage/setColor(double,double,double)", - "memberId": "Stage/setColor", + "id": "Stage/isSoundPlaying(String)", + "memberId": "Stage/isSoundPlaying", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setColor", + "methodName": "isSoundPlaying", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ - "double", - "double", - "double" + "java.lang.String" ], "parameterNames": [ - "r", - "g", - "b" + "name" ], "params": [ - "double r", - "double g", - "double b" + "String name" ], - "summary": "Sets the background color via a rgb value", - "description": "Sets the background color via a rgb value", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" + "name: a sound's name" ], - "returns": null, + "returns": "whether it is playing", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isSoundPlaying", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" + "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" } } }, { - "id": "Stage/setColor(Color)", - "memberId": "Stage/setColor", + "id": "Stage/nextBackdrop()", + "memberId": "Stage/nextBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setColor", + "methodName": "nextBackdrop", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the color of the stage.", - "description": "Sets the color of the stage.", - "scratchblock": null, - "paramDocs": [ - "c: the new color to be set" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the next backdrop, after the last to the first.", + "description": "Switches to the next backdrop, after the last to the first.", + "scratchblock": "next backdrop", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/nextBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe" + "description": "Wechselt zum nächsten Hintergrund" } } }, { - "id": "Stage/setCursor(String)", - "memberId": "Stage/setCursor", + "id": "Stage/pickRandom(int,int)", + "memberId": "Stage/pickRandom", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setCursor", + "methodName": "pickRandom", "static": false, - "returnType": "void", + "returnType": "int", "parameterTypes": [ - "java.lang.String" + "int", + "int" ], "parameterNames": [ - "path" + "from", + "to" ], "params": [ - "String path" + "int from", + "int to" ], - "summary": "Sets the cursor image for the stage.", - "description": "Sets the cursor image for the stage.", - "scratchblock": null, + "summary": "A random whole number between two numbers, both included.", + "description": "A random whole number between two numbers, both included.", + "scratchblock": "(pick random (from) to (to))", "paramDocs": [ - "path: a path to an image file, or the name of a built-in sprite" + "from: the lowest", + "to: the highest" ], - "returns": null, + "returns": "the number", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/pickRandom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt das Mauszeigerbild" + "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" } } }, { - "id": "Stage/setCursor(String,int,int)", - "memberId": "Stage/setCursor", + "id": "Stage/playSound(String)", + "memberId": "Stage/playSound", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setCursor", + "methodName": "playSound", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "path", - "x", - "y" + "name" ], "params": [ - "String path", - "int x", - "int y" + "String name" ], - "summary": "Sets the cursor image and its active spot coordinates.", - "description": "Sets the cursor image and its active spot coordinates.", - "scratchblock": null, + "summary": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "description": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "scratchblock": "start sound [name v]", "paramDocs": [ - "path: a path to an image file, or the name of a built-in sprite", - "x: the x-coordinate of the cursor's active spot", - "y: the y-coordinate of the cursor's active spot" + "name: the sound's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt das Mauszeigerbild mit eigenem Aktivpunkt" + "description": "Spielt einen zuvor hinzugefügten Klang ab" } } }, { - "id": "Stage/setDebug(boolean)", - "memberId": "Stage/setDebug", + "id": "Stage/playSoundCopy(String,double)", + "memberId": "Stage/playSoundCopy", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setDebug", + "methodName": "playSoundCopy", "static": false, - "returnType": "void", + "returnType": "SoundPlayback", "parameterTypes": [ - "boolean" + "java.lang.String", + "double" ], "parameterNames": [ - "debug" + "name", + "volume" ], "params": [ - "boolean debug" + "String name", + "double volume" ], - "summary": "Enables or disables the debug mode for the application.", - "description": "Enables or disables the debug mode for the application.", + "summary": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "description": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", "scratchblock": null, "paramDocs": [ - "debug: a boolean value where `true` enables debug mode and\n `false` disables\n it." + "name: the sound's name", + "volume: the copy's volume from 0 to 100" ], + "returns": "the copy, to stop it or change its volume", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSoundCopy", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/previousBackdrop()", + "memberId": "Stage/previousBackdrop", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "previousBackdrop", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the previous backdrop, before the first to the last.", + "description": "Switches to the previous backdrop, before the first to the last.", + "scratchblock": "switch backdrop to [previous backdrop v]", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setDebug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/previousBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Schaltet die Ausgabe von debug() ein oder aus" + "description": "Wechselt zum vorherigen Hintergrund" } } }, { - "id": "Stage/setTint(double,double,double)", - "memberId": "Stage/setTint", + "id": "Stage/randomBackdrop()", + "memberId": "Stage/randomBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setTint", + "methodName": "randomBackdrop", "static": false, "returnType": "void", - "parameterTypes": [ - "double", - "double", - "double" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "double r", - "double g", - "double b" - ], - "summary": "Sets the colour the backdrop is tinted with.", - "description": "Sets the colour the backdrop is tinted with.", - "scratchblock": null, - "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to a random backdrop other than the current one (if there is another).", + "description": "Switches to a random backdrop other than the current one (if there is another).", + "scratchblock": "switch backdrop to [random backdrop v]", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/randomBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt den Hintergrund ein (Anteile jeweils 0 bis 255)" + "description": "Wechselt zu einem zufälligen Hintergrund" } } }, { - "id": "Stage/setTint(double)", - "memberId": "Stage/setTint", + "id": "Stage/remove(Text)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setTint", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Text" ], "parameterNames": [ - "h" + "text" ], "params": [ - "double h" + "Text text" ], - "summary": "Sets the colour the backdrop is tinted with, as a hue.", - "description": "Sets the colour the backdrop is tinted with, as a hue.", - "scratchblock": "set [color v] effect to (h)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "h: " + "text: a text of its own to remove" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt den Hintergrund mit dem angegebenen Farbton ein (0 bis 255)" + "description": "Entfernt den Text von der Bühne" } } }, { - "id": "Stage/setTransparency(double)", - "memberId": "Stage/setTransparency", + "id": "Stage/remove(Sprite)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setTransparency", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "transparency" + "sprite" ], "params": [ - "double transparency" + "Sprite sprite" ], - "summary": "Sets how see-through the backdrop is, as Scratch's ghost effect does: 0 is\nthe solid backdrop you start with and 100 is invisible.", - "description": "Sets how see-through the backdrop is, as Scratch's ghost effect does: 0 is\nthe solid backdrop you start with and 100 is invisible.", - "scratchblock": "set [ghost v] effect to (transparency)", + "summary": "Removes a sprite.", + "description": "Removes a sprite.", + "scratchblock": null, "paramDocs": [ - "transparency: [0...100], 0 solid and 100 invisible" + "sprite: the sprite" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Transparenz des Hintergrunds in Prozent" + "description": "Entfernt die Figur von der Bühne" } } }, { - "id": "Stage/setVolume(double)", - "memberId": "Stage/setVolume", + "id": "Stage/remove(Pen)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setVolume", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Pen" ], "parameterNames": [ - "percent" + "pen" ], "params": [ - "double percent" + "Pen pen" ], - "summary": "Sets how loud every sound of this stage plays.", - "description": "Sets how loud every sound of this stage plays.", - "scratchblock": "set volume to (percent) %", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "percent: 0 for silent, 100 for full volume" + "pen: a pen of its own to remove" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Lautstärke in Prozent" + "description": "Entfernt den Stift von der Bühne" } } }, { - "id": "Stage/showVariable(String,Supplier)", - "memberId": "Stage/showVariable", + "id": "Stage/remove(Class)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "showVariable", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.util.function.Supplier" + "java.lang.Class" ], "parameterNames": [ - "name", - "value" + "type" ], "params": [ - "String name", - "Supplier value" + "Class type" ], - "summary": "Shows a monitor for a variable in the top left corner of the stage, like\nScratch's variable monitors: the name and the current value, updated every\nframe. Showing the same name again replaces the monitor.", - "description": "Shows a monitor for a variable in the top left corner of the stage, like\nScratch's variable monitors: the name and the current value, updated every\nframe. Showing the same name again replaces the monitor.\n\n```java\nthis.showVariable(\"score\", () -> score);\n```", - "scratchblock": "show variable [name v]", + "summary": "Removes every sprite of a class (subclasses included).", + "description": "Removes every sprite of a class (subclasses included).", + "scratchblock": null, "paramDocs": [ - "name: what the monitor says", - "value: gives the value to show; asked for it every frame" + "type: the class" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/showVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt den Wert einer Variablen auf der Bühne an" + "description": "Entfernt alle Figuren dieser Klasse von der Bühne, z.B. remove(Apfel.class)" } } }, { - "id": "Stage/stopAllSounds()", - "memberId": "Stage/stopAllSounds", + "id": "Stage/removeAll()", + "memberId": "Stage/removeAll", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "stopAllSounds", + "methodName": "removeAll", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Stops the playing of all sounds of the stage.", - "description": "Stops the playing of all sounds of the stage.", - "scratchblock": "stop all sounds", + "summary": "Removes every sprite, text and pen: an empty stage (backdrops and what was drawn stay).", + "description": "Removes every sprite, text and pen: an empty stage (backdrops and what was drawn stay).", + "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopAllSounds", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/removeAll", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Stoppt alle Klänge der Bühne" + "description": "Entfernt alle Figuren von der Bühne" } } }, { - "id": "Stage/stopSound(String)", - "memberId": "Stage/stopSound", + "id": "Stage/run()", + "memberId": "Stage/run", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "stopSound", + "methodName": "run", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Stops the playing of the sound with the given name", - "description": "Stops the playing of the sound with the given name", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Runs every tick before the sprites' `run()`. Override it with the stage's code.", + "description": "Runs every tick before the sprites' `run()`. Override it with the stage's code.", "scratchblock": null, - "paramDocs": [ - "name: Name of the sound" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/run", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Stoppt den Klang mit dem angegebenen Namen" + "description": "Wird in jedem Frame aufgerufen" } } }, { - "id": "Stage/switchBackdrop(String)", - "memberId": "Stage/switchBackdrop", + "id": "Stage/setColor(Color)", + "memberId": "Stage/setColor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "switchBackdrop", + "methodName": "setColor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "name" + "color" ], "params": [ - "String name" + "Color color" ], - "summary": "Switch to a backdrop by name.", - "description": "Switch to a backdrop by name.", - "scratchblock": "switch backdrop to [name v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "name: the name of a backdrop" + "color: the colour behind the backdrop" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/switchBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum Hintergrund mit dem angegebenen Namen" + "description": "Setzt die Hintergrundfarbe" } } }, { - "id": "Stage/wait(int)", - "memberId": "Stage/wait", + "id": "Stage/setColor(double,double,double)", + "memberId": "Stage/setColor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "wait", + "methodName": "setColor", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double", + "double", + "double" ], "parameterNames": [ - "millis" + "red", + "green", + "blue" ], "params": [ - "int millis" + "double red", + "double green", + "double blue" ], - "summary": "Stop the execution of the whole applications for the given milliseconds.", - "description": "Stop the execution of the whole applications for the given milliseconds.", - "scratchblock": "wait (millis) seconds", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "millis: Milliseconds" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/wait", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Pausiert das Programm für die angegebene Zeit in Millisekunden" + "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" } } }, { - "id": "Stage/waitUntil(BooleanSupplier)", - "memberId": "Stage/waitUntil", + "id": "Stage/setColorEffect(double)", + "memberId": "Stage/setColorEffect", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "waitUntil", + "methodName": "setColorEffect", "static": false, "returnType": "void", "parameterTypes": [ - "java.util.function.BooleanSupplier" + "double" ], "parameterNames": [ - "condition" + "value" ], "params": [ - "BooleanSupplier condition" + "double value" ], - "summary": "Waits until something becomes true, then carries on.", - "description": "Waits until something becomes true, then carries on.\n\nLike [wait(int)](wait) this holds up the code that calls it, not the whole\nprogram: sprites keep running and the stage keeps drawing while it waits.\nThat makes it useful for setting a scene up in a constructor, and a bad idea\ninside `run()`, which is called once per frame and should return quickly.\n\n```java\nthis.ask(\"What is your name?\");\nthis.waitUntil(() -> !this.isAsking());\nthis.display(\"Hello \" + this.getAnswer() + \"!\");\n```", - "scratchblock": "wait until <condition>", + "summary": "Scratch's colour effect on the backdrop: shifts its colours around the colour wheel (200 is\nall the way round). Like Scratch, it gives colours too grey or too dark to show a hue a\nlittle one, so white and black are tinted too.", + "description": "Scratch's colour effect on the backdrop: shifts its colours around the colour wheel (200 is\nall the way round). Like Scratch, it gives colours too grey or too dark to show a hue a\nlittle one, so white and black are tinted too.", + "scratchblock": "set [color v] effect to (value)", "paramDocs": [ - "condition: checked over and over until it is true" + "value: the effect" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/waitUntil", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wartet, bis die Bedingung erfüllt ist" - } - } + "translations": {} }, { - "id": "Stage/whenBackdropSwitches(String)", - "memberId": "Stage/whenBackdropSwitches", + "id": "Stage/setCursor(String)", + "memberId": "Stage/setCursor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenBackdropSwitches", + "methodName": "setCursor", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "name" + "path" ], "params": [ - "String name" + "String path" ], - "summary": "This method is called when the backdrop switches to the specified name.\nOverride this method to\nadd custom behavior.", - "description": "This method is called when the backdrop switches to the specified name.\nOverride this method to\nadd custom behavior.", + "summary": "Shows an image instead of the mouse pointer while the mouse is over the stage.", + "description": "Shows an image instead of the mouse pointer while the mouse is over the stage.", "scratchblock": null, "paramDocs": [ - "name: the name of the backdrop to switch to" + "path: an image file, or a built-in sprite's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenBackdropSwitches", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Wechsel des Hintergrunds aufgerufen" + "description": "Setzt das Mauszeigerbild" } } }, { - "id": "Stage/whenIReceive(String)", - "memberId": "Stage/whenIReceive", + "id": "Stage/setCursor(String,int,int)", + "memberId": "Stage/setCursor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenIReceive", + "methodName": "setCursor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "int", + "int" ], "parameterNames": [ - "message" + "path", + "x", + "y" ], "params": [ - "String message" + "String path", + "int x", + "int y" ], - "summary": "This method is called when a specific message is received. Override this\nmethod to add custom\nbehavior.", - "description": "This method is called when a specific message is received. Override this\nmethod to add custom\nbehavior.", - "scratchblock": "when I receive [message v]", + "summary": "Shows an image instead of the mouse pointer.", + "description": "Shows an image instead of the mouse pointer.", + "scratchblock": null, "paramDocs": [ - "message: The message that triggers this method." + "path: an image file, or a built-in sprite's name", + "x: pixels from the image's left edge to the point that clicks", + "y: pixels from the image's top edge to the point that clicks" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenIReceive", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei broadcast(message) aufgerufen" + "description": "Setzt das Mauszeigerbild mit eigenem Aktivpunkt" } } }, { - "id": "Stage/whenKeyPressed(KeyCode)", - "memberId": "Stage/whenKeyPressed", + "id": "Stage/setTint(Color)", + "memberId": "Stage/setTint", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenKeyPressed", + "methodName": "setTint", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "keyCode" + "color" ], "params": [ - "KeyCode keyCode" + "Color color" ], - "summary": "This method is called when a key is pressed. Override this method to add\ncustom behavior.", - "description": "This method is called when a key is pressed. Override this method to add\ncustom behavior.", - "scratchblock": "when [space v] key pressed", + "summary": "Multiplies the backdrop by a colour. Not a Scratch block: Scratch's colour effect is\n[setColorEffect(double)](setColorEffect).", + "description": "Multiplies the backdrop by a colour. Not a Scratch block: Scratch's colour effect is\n[setColorEffect(double)](setColorEffect).", + "scratchblock": null, "paramDocs": [ - "keyCode: the key that was pressed" + "color: the tint, or null for none" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTint", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird beim Drücken der Taste aufgerufen" - } - } + "translations": {} }, { - "id": "Stage/whenKeyReleased(KeyCode)", - "memberId": "Stage/whenKeyReleased", + "id": "Stage/setTransparency(double)", + "memberId": "Stage/setTransparency", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenKeyReleased", + "methodName": "setTransparency", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "double" ], "parameterNames": [ - "keyCode" + "percent" ], "params": [ - "KeyCode keyCode" + "double percent" ], - "summary": "This method is called when a key is released. Override this method to add\ncustom behavior.", - "description": "This method is called when a key is released. Override this method to add\ncustom behavior.", - "scratchblock": null, + "summary": "Scratch's ghost effect on the backdrop: the stage colour shows through.", + "description": "Scratch's ghost effect on the backdrop: the stage colour shows through.", + "scratchblock": "set [ghost v] effect to (transparency)", "paramDocs": [ - "keyCode: the key that was released" + "percent: 0 opaque, 100 invisible" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyReleased", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Loslassen der Taste aufgerufen" + "description": "Setzt die Transparenz des Hintergrunds in Prozent" } } }, { - "id": "Stage/whenMouseClicked(MouseCode)", - "memberId": "Stage/whenMouseClicked", + "id": "Stage/setVolume(double)", + "memberId": "Stage/setVolume", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenMouseClicked", + "methodName": "setVolume", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.MouseCode" + "double" ], "parameterNames": [ - "mouseEvent" + "volume" ], "params": [ - "MouseCode mouseEvent" + "double volume" ], - "summary": "This method is called when a mouse click event occurs. Overwrite this method\nto add custom\nbehavior.", - "description": "This method is called when a mouse click event occurs. Overwrite this method\nto add custom\nbehavior.", - "scratchblock": "when stage clicked", + "summary": "", + "description": "", + "scratchblock": "set volume to (percent) %", "paramDocs": [ - "mouseEvent: The mouse event that triggered this method." + "volume: this object's volume from 0 to 100" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseClicked", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei einem Mausklick aufgerufen" + "description": "Setzt die Lautstärke in Prozent" } } }, { - "id": "Stage/whenMouseWheelMoved(int)", - "memberId": "Stage/whenMouseWheelMoved", + "id": "Stage/showVariable(String,Supplier)", + "memberId": "Stage/showVariable", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenMouseWheelMoved", + "methodName": "showVariable", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "java.lang.String", + "java.util.function.Supplier" ], "parameterNames": [ - "steps" + "name", + "value" ], "params": [ - "int steps" + "String name", + "Supplier value" ], - "summary": "This method is called when the mouse wheel is moved. Overwrite this method to\nadd custom\nbehavior.", - "description": "This method is called when the mouse wheel is moved. Overwrite this method to\nadd custom\nbehavior.", - "scratchblock": null, + "summary": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.", + "description": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.\n\n```java\nthis.showVariable(\"score\", () -> this.score);\n```", + "scratchblock": "show variable [name v]", "paramDocs": [ - "steps: the number of steps the mouse wheel has moved. Positive values\n indicate movement\n away from the user, while negative values indicate movement\n towards the user." + "name: the label", + "value: gives the value to show" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseWheelMoved", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/showVariable", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Drehen des Mausrads aufgerufen" + "description": "Zeigt den Wert einer Variablen auf der Bühne an" } } }, { - "id": "Text/addFont(String,String)", - "memberId": "Text/addFont", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "addFont", + "id": "Stage/sortBy(Comparator)", + "memberId": "Stage/sortBy", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "sortBy", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "java.util.Comparator" ], "parameterNames": [ - "name", - "path" + "comparator" ], "params": [ - "String name", - "String path" + "Comparator comparator" ], - "summary": "Adds a new font to the list of fonts if it does not already exist.", - "description": "Adds a new font to the list of fonts if it does not already exist.", + "summary": "Draws and runs the sprites of each layer in the order a comparator gives, back to front.", + "description": "Draws and runs the sprites of each layer in the order a comparator gives, back to front.", "scratchblock": null, "paramDocs": [ - "name: the name of the font to be added", - "path: the path to the font file" + "comparator: the order" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/addFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/sortBy", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/sortByY()", + "memberId": "Stage/sortByY", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "sortByY", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Draws and runs the sprites of each layer sorted by their y position: lower sprites in front,\nas in a top-down game. Applies from the next tick on, until [stopSorting()](stopSorting).", + "description": "Draws and runs the sprites of each layer sorted by their y position: lower sprites in front,\nas in a top-down game. Applies from the next tick on, until [stopSorting()](stopSorting).", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/sortByY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/stopAllSounds()", + "memberId": "Stage/stopAllSounds", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "stopAllSounds", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Stops every sound this object started.", + "description": "Stops every sound this object started.", + "scratchblock": "stop all sounds", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopAllSounds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt eine Schriftart hinzu" + "description": "Stoppt alle Klänge der Bühne" } } }, { - "id": "Text/constructor()", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/stopSorting()", + "memberId": "Stage/stopSorting", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "stopSorting", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Text object with default values. The text is initialized to an empty string,\npositioned at (0, 0), with a default size of 0. The text style is set to plain and the text\nis centred on its position, as every text is. Call [setAlign(TextAlign)](setAlign) for anything\nelse.", - "description": "Constructs a new Text object with default values. The text is initialized to an empty string,\npositioned at (0, 0), with a default size of 0. The text style is set to plain and the text\nis centred on its position, as every text is. Call [setAlign(TextAlign)](setAlign) for anything\nelse.", + "summary": "Keeps the order the sprites have now and stops sorting them.", + "description": "Keeps the order the sprites have now and stops sorting them.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopSorting", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/stopSound(String)", + "memberId": "Stage/stopSound", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "stopSound", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "name" + ], + "params": [ + "String name" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "name: the sound to stop" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt einen leeren Text in der Mitte der Bühne" + "description": "Stoppt den Klang mit dem angegebenen Namen" } } }, { - "id": "Text/constructor(Sprite)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/switchBackdrop(String)", + "memberId": "Stage/switchBackdrop", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "switchBackdrop", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "java.lang.String" ], "parameterNames": [ - "s" + "name" ], "params": [ - "Sprite s" + "String name" ], - "summary": "Constructs a new Text object associated with a given Sprite.", - "description": "Constructs a new Text object associated with a given Sprite.", - "scratchblock": null, + "summary": "Switches to the backdrop with that name and tells the stage and every sprite\n(`whenBackdropSwitches`); an unknown name changes nothing.", + "description": "Switches to the backdrop with that name and tells the stage and every sprite\n(`whenBackdropSwitches`); an unknown name changes nothing.", + "scratchblock": "switch backdrop to [name v]", "paramDocs": [ - "s: the Sprite to associate with this Text object" + "name: the backdrop's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/switchBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt einen Text an der angegebenen Position mit der angegebenen Breite" + "description": "Wechselt zum Hintergrund mit dem angegebenen Namen" } } }, { - "id": "Text/constructor(String,double,double,double)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/waitSeconds(double)", + "memberId": "Stage/waitSeconds", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "waitSeconds", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double", - "double", "double" ], "parameterNames": [ - "text", - "x", - "y", - "width" + "seconds" ], "params": [ - "String text", - "double x", - "double y", - "double width" + "double seconds" ], - "summary": "Constructs a new Text object with the specified text, position, and width.", - "description": "Constructs a new Text object with the specified text, position, and width.", + "summary": "Holds up the code that calls it for a number of seconds. Called in `main` (a program\nwritten straight down the page), the game keeps running meanwhile and the seconds are game\ntime. Called in `run()` or an event, the whole game waits, as it does for any slow\ncode; the window stays responsive.", + "description": "Holds up the code that calls it for a number of seconds. Called in `main` (a program\nwritten straight down the page), the game keeps running meanwhile and the seconds are game\ntime. Called in `run()` or an event, the whole game waits, as it does for any slow\ncode; the window stays responsive.", "scratchblock": null, "paramDocs": [ - "text: the text to be displayed", - "x: the x-coordinate of the text's position", - "y: the y-coordinate of the text's position", - "width: the width of the text" + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/waitSeconds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Text/constructor(String,double,double,double,TextStyle)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/waitUntil(BooleanSupplier)", + "memberId": "Stage/waitUntil", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "waitUntil", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double", - "double", - "double", - "org.openpatch.scratch.TextStyle" + "java.util.function.BooleanSupplier" ], "parameterNames": [ - "text", - "x", - "y", - "width", - "style" + "condition" ], "params": [ - "String text", - "double x", - "double y", - "double width", - "TextStyle style" + "BooleanSupplier condition" ], - "summary": "Constructs a new Text object with the specified text, position, width, and style.", - "description": "Constructs a new Text object with the specified text, position, width, and style.", - "scratchblock": null, + "summary": "Holds up the code that calls it until a condition is true; see [waitSeconds(double)](waitSeconds).", + "description": "Holds up the code that calls it until a condition is true; see [waitSeconds(double)](waitSeconds).", + "scratchblock": "wait until <condition>", "paramDocs": [ - "text: the text content to be displayed", - "x: the x-coordinate of the text's position", - "y: the y-coordinate of the text's position", - "width: the width of the text area", - "style: the style to be applied to the text" + "condition: checked about every millisecond" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/waitUntil", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt einen Text an der angegebenen Position, mit der angegebenen Breite und im angegebenen Stil" + "description": "Wartet, bis die Bedingung erfüllt ist" } } }, { - "id": "Text/constructor(Text)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/whenBackdropSwitches(String)", + "memberId": "Stage/whenBackdropSwitches", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenBackdropSwitches", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Text" + "java.lang.String" ], "parameterNames": [ - "t" + "name" ], "params": [ - "Text t" + "String name" ], - "summary": "Copy constructor for the Text class. Creates a new Text object by copying the properties of the\ngiven Text object.", - "description": "Copy constructor for the Text class. Creates a new Text object by copying the properties of the\ngiven Text object.", + "summary": "Called when the backdrop switches.", + "description": "Called when the backdrop switches.", "scratchblock": null, "paramDocs": [ - "t: the Text object to copy" + "name: the new backdrop's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Text/getAlign()", - "memberId": "Text/getAlign", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getAlign", - "static": false, - "returnType": "TextAlign", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns where the text sits relative to its position.", - "description": "Returns where the text sits relative to its position.", - "scratchblock": null, - "paramDocs": [], - "returns": "the alignment", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getAlign", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenBackdropSwitches", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Ausrichtung des Texts zurück" + "description": "Wird beim Wechsel des Hintergrunds aufgerufen" } } }, { - "id": "Text/getCurrentFontIndex()", - "memberId": "Text/getCurrentFontIndex", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getCurrentFontIndex", + "id": "Stage/whenIReceive(String)", + "memberId": "Stage/whenIReceive", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenIReceive", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the index of the current font.", - "description": "Returns the index of the current font.", - "scratchblock": null, - "paramDocs": [], - "returns": "the index of the current font", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "message" + ], + "params": [ + "String message" + ], + "summary": "Called when a message is broadcast.", + "description": "Called when a message is broadcast.", + "scratchblock": "when I receive [message v]", + "paramDocs": [ + "message: the message" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontIndex", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenIReceive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Nummer der aktuellen Schriftart zurück" + "description": "Wird bei broadcast(message) aufgerufen" } } }, { - "id": "Text/getCurrentFontName()", - "memberId": "Text/getCurrentFontName", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getCurrentFontName", + "id": "Stage/whenKeyPressed(KeyCode)", + "memberId": "Stage/whenKeyPressed", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenKeyPressed", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the name of the current font.", - "description": "Retrieves the name of the current font.", - "scratchblock": null, - "paramDocs": [], - "returns": "the name of the current font, or `null` if no fonts are available.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Namen der aktuellen Schriftart zurück" - } - } - }, - { - "id": "Text/getDefaultFont()", - "memberId": "Text/getDefaultFont", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getDefaultFont", - "static": true, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the font that text is written in by default.", - "description": "Returns the font that text is written in by default.", - "scratchblock": null, - "paramDocs": [], - "returns": "the path to the font file", + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.KeyCode" + ], + "parameterNames": [ + "key" + ], + "params": [ + "KeyCode key" + ], + "summary": "Called when a key is pressed, once per press.", + "description": "Called when a key is pressed, once per press.", + "scratchblock": "when [space v] key pressed", + "paramDocs": [ + "key: the key" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Standardschriftart zurück" + "description": "Wird beim Drücken der Taste aufgerufen" } } }, { - "id": "Text/getDefaultFontSize()", - "memberId": "Text/getDefaultFontSize", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getDefaultFontSize", - "static": true, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the size text is written in by default.", - "description": "Returns the size text is written in by default.", + "id": "Stage/whenKeyReleased(KeyCode)", + "memberId": "Stage/whenKeyReleased", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenKeyReleased", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.KeyCode" + ], + "parameterNames": [ + "key" + ], + "params": [ + "KeyCode key" + ], + "summary": "Called when a key is released.", + "description": "Called when a key is released.", "scratchblock": null, - "paramDocs": [], - "returns": "the font size", + "paramDocs": [ + "key: the key" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFontSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyReleased", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Standardschriftgröße zurück" + "description": "Wird beim Loslassen der Taste aufgerufen" } } }, { - "id": "Text/getFont()", - "memberId": "Text/getFont", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getFont", + "id": "Stage/whenMouseClicked(MouseCode)", + "memberId": "Stage/whenMouseClicked", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenMouseClicked", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the name of the font.", - "description": "Retrieves the name of the font.", - "scratchblock": null, - "paramDocs": [], - "returns": "the name of the font as a String.", + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.MouseCode" + ], + "parameterNames": [ + "button" + ], + "params": [ + "MouseCode button" + ], + "summary": "Called when a mouse button is pressed anywhere on the stage.", + "description": "Called when a mouse button is pressed anywhere on the stage.", + "scratchblock": "when stage clicked", + "paramDocs": [ + "button: the button" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseClicked", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Namen der aktuellen Schriftart zurück" + "description": "Wird bei einem Mausklick aufgerufen" } } }, { - "id": "Text/getPosition()", - "memberId": "Text/getPosition", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getPosition", + "id": "Stage/whenMouseWheelMoved(double)", + "memberId": "Stage/whenMouseWheelMoved", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenMouseWheelMoved", "static": false, - "returnType": "Vector2", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the current position as a Vector2 object.", - "description": "Retrieves the current position as a Vector2 object.", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "steps" + ], + "params": [ + "double steps" + ], + "summary": "Called when the mouse wheel turns.", + "description": "Called when the mouse wheel turns.", "scratchblock": null, - "paramDocs": [], - "returns": "a Vector2 object representing the current x and y coordinates.", + "paramDocs": [ + "steps: notches; positive is towards the user" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseWheelMoved", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Position des Texts zurück" - } - } + "translations": {} }, { - "id": "Text/getStage()", - "memberId": "Text/getStage", + "id": "Text/addFont(String,String)", + "memberId": "Text/addFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getStage", + "methodName": "addFont", "static": false, - "returnType": "Stage", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the current stage associated with this object.", - "description": "Retrieves the current stage associated with this object.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "path" + ], + "params": [ + "String name", + "String path" + ], + "summary": "Adds a font this text can switch to; the first one added is used.", + "description": "Adds a font this text can switch to; the first one added is used.", "scratchblock": null, - "paramDocs": [], - "returns": "the current stage", + "paramDocs": [ + "name: the font's name", + "path: the TTF or OTF file" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/addFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Bühne zurück, auf der der Text liegt" + "description": "Fügt eine Schriftart hinzu" } } }, { - "id": "Text/getStyle()", - "memberId": "Text/getStyle", + "id": "Text/constructor()", + "memberId": "Text/constructor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getStyle", + "methodName": "constructor", "static": false, - "returnType": "TextStyle", + "returnType": "Text", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the style the text is drawn in.", - "description": "Returns the style the text is drawn in.", + "summary": "An empty plain text at (0, 0).", + "description": "An empty plain text at (0, 0).", "scratchblock": null, "paramDocs": [], - "returns": "the style, never null", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStyle", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Stil zurück, in dem der Text gezeichnet wird" + "description": "Erzeugt einen leeren Text in der Mitte der Bühne" } } }, { - "id": "Text/getTextSize()", - "memberId": "Text/getTextSize", + "id": "Text/constructor(String,double,double,double)", + "memberId": "Text/constructor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getTextSize", + "methodName": "constructor", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the size of the text.", - "description": "Returns the size of the text.", + "returnType": "Text", + "parameterTypes": [ + "java.lang.String", + "double", + "double", + "double" + ], + "parameterNames": [ + "text", + "x", + "y", + "width" + ], + "params": [ + "String text", + "double x", + "double y", + "double width" + ], + "summary": "A plain text.", + "description": "A plain text.", "scratchblock": null, - "paramDocs": [], - "returns": "the size of the text as an integer", + "paramDocs": [ + "text: what it says", + "x: x of its position", + "y: y of its position (the first line's baseline)", + "width: where lines wrap; 0 for no wrapping" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getTextSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Schriftgröße zurück" - } - } + "translations": {} }, { - "id": "Text/getWidth()", - "memberId": "Text/getWidth", + "id": "Text/constructor(String,double,double,double,TextStyle)", + "memberId": "Text/constructor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getWidth", + "methodName": "constructor", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the width of the text.", - "description": "Returns the width of the text.", + "returnType": "Text", + "parameterTypes": [ + "java.lang.String", + "double", + "double", + "double", + "org.openpatch.scratch.TextStyle" + ], + "parameterNames": [ + "text", + "x", + "y", + "width", + "style" + ], + "params": [ + "String text", + "double x", + "double y", + "double width", + "TextStyle style" + ], + "summary": "A text in a style.", + "description": "A text in a style.", "scratchblock": null, - "paramDocs": [], - "returns": "the width of the text as a double", + "paramDocs": [ + "text: what it says", + "x: x of its position", + "y: y of its position: the first baseline for plain text, the bottom edge of a box", + "width: where lines wrap; 0 for no wrapping", + "style: plain, box, speech or thought bubble" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Breite des Textfelds zurück" + "description": "Erzeugt einen Text an der angegebenen Position, mit der angegebenen Breite und im angegebenen Stil" } } }, { - "id": "Text/getX()", - "memberId": "Text/getX", + "id": "Text/getAlign()", + "memberId": "Text/getAlign", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getX", + "methodName": "getAlign", "static": false, - "returnType": "double", + "returnType": "TextAlign", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the x-coordinate of this object.", - "description": "Returns the x-coordinate of this object.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the x-coordinate as a double", + "returns": "the alignment", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getAlign", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die x-Position zurück" + "description": "Gibt die Ausrichtung des Texts zurück" } } }, { - "id": "Text/getY()", - "memberId": "Text/getY", + "id": "Text/getCurrentFontIndex()", + "memberId": "Text/getCurrentFontIndex", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getY", + "methodName": "getCurrentFontIndex", "static": false, - "returnType": "double", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the y-coordinate of this object.", - "description": "Returns the y-coordinate of this object.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the y-coordinate as a double", + "returns": "the number of the font in use, counting from 0; -1 for the default font", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontIndex", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die y-Position zurück" + "description": "Gibt die Nummer der aktuellen Schriftart zurück" } } }, { - "id": "Text/goLayersBackwards(int)", - "memberId": "Text/goLayersBackwards", + "id": "Text/getCurrentFontName()", + "memberId": "Text/getCurrentFontName", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goLayersBackwards", + "methodName": "getCurrentFontName", "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the text backwards by a specified number of layers in the stage. If\nthe text is not on a stage, the method does nothing.", - "description": "Moves the text backwards by a specified number of layers in the stage. If\nthe text is not on a stage, the method does nothing.", - "scratchblock": "go [backward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the text backwards" - ], - "returns": null, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the name of the font in use, or null for the default font", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersBackwards", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Schiebt den Text um die angegebene Anzahl Ebenen nach hinten" + "description": "Gibt den Namen der aktuellen Schriftart zurück" } } }, { - "id": "Text/goLayersForwards(int)", - "memberId": "Text/goLayersForwards", + "id": "Text/getDefaultFont()", + "memberId": "Text/getDefaultFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goLayersForwards", - "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the text forward by a specified number of layers within its stage. If\nthe text is not on a stage, the method does nothing.", - "description": "Moves the text forward by a specified number of layers within its stage. If\nthe text is not on a stage, the method does nothing.", - "scratchblock": "go [forward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the text forward" - ], - "returns": null, + "methodName": "getDefaultFont", + "static": true, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the default font file", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersForwards", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Bringt den Text um die angegebene Anzahl Ebenen nach vorne" + "description": "Gibt die Standardschriftart zurück" } } }, { - "id": "Text/goToBackLayer()", - "memberId": "Text/goToBackLayer", + "id": "Text/getDefaultFontSize()", + "memberId": "Text/getDefaultFontSize", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goToBackLayer", - "static": false, - "returnType": "void", + "methodName": "getDefaultFontSize", + "static": true, + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves this text to the back layer of the stage, behind every other text on\nit. If the text is not on a stage, the method does nothing.", - "description": "Moves this text to the back layer of the stage, behind every other text on\nit. If the text is not on a stage, the method does nothing.\n\nTexts are drawn on top of the sprites, so this orders a text against the\nother texts rather than against the sprites.", - "scratchblock": "go to [back v] layer", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the default font size", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToBackLayer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFontSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Schiebt den Text hinter die anderen Texte" + "description": "Gibt die Standardschriftgröße zurück" } } }, { - "id": "Text/goToFrontLayer()", - "memberId": "Text/goToFrontLayer", + "id": "Text/getFont()", + "memberId": "Text/getFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goToFrontLayer", + "methodName": "getFont", "static": false, - "returnType": "void", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves this text to the front layer of the stage, in front of every other\ntext on it. If the text is not on a stage, the method does nothing.", - "description": "Moves this text to the front layer of the stage, in front of every other\ntext on it. If the text is not on a stage, the method does nothing.\n\nTexts are drawn on top of the sprites, so this orders a text against the\nother texts rather than against the sprites.", - "scratchblock": "go to [front v] layer", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the font file, or null for the default font", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToFrontLayer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Bringt den Text vor die anderen Texte" + "description": "Gibt den Namen der aktuellen Schriftart zurück" } } }, { - "id": "Text/isUI()", - "memberId": "Text/isUI", + "id": "Text/getLayer()", + "memberId": "Text/getLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "isUI", + "methodName": "getLayer", "static": false, - "returnType": "boolean", + "returnType": "Layer", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the current instance is a UI element.", - "description": "Checks if the current instance is a UI element.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "`true` if this instance is a UI element, `false` otherwise.", + "returns": "the layer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/isUI", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Text zur Benutzeroberfläche gehört" - } - } + "translations": {} }, { - "id": "Text/nextFont()", - "memberId": "Text/nextFont", + "id": "Text/getPosition()", + "memberId": "Text/getPosition", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "nextFont", + "methodName": "getPosition", "static": false, - "returnType": "void", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Advances to the next font in the list of available fonts. The current font index is incremented\nby one and wraps around to the beginning of the list if it exceeds the number of available\nfonts.", - "description": "Advances to the next font in the list of available fonts. The current font index is incremented\nby one and wraps around to the beginning of the list if it exceeds the number of available\nfonts.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/nextFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zur nächsten Schriftart" + "description": "Gibt die Position des Texts zurück" } } }, { - "id": "Text/remove()", - "memberId": "Text/remove", + "id": "Text/getStage()", + "memberId": "Text/getStage", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "remove", + "methodName": "getStage", "static": false, - "returnType": "void", + "returnType": "Stage", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes this object from its current stage if it is associated with one. If the object is not\nassociated with any stage, this method does nothing.", - "description": "Removes this object from its current stage if it is associated with one. If the object is not\nassociated with any stage, this method does nothing.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the stage the text is on (a sprite's text: the sprite's stage), or null", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt den Text von der Bühne" + "description": "Gibt die Bühne zurück, auf der der Text liegt" } } }, { - "id": "Text/setAlign(TextAlign)", - "memberId": "Text/setAlign", + "id": "Text/getStyle()", + "memberId": "Text/getStyle", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setAlign", + "methodName": "getStyle", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.TextAlign" - ], - "parameterNames": [ - "align" - ], - "params": [ - "TextAlign align" - ], - "summary": "Sets the alignment of the text.", - "description": "Sets the alignment of the text.", + "returnType": "TextStyle", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "align: where the text should sit relative to its position" - ], - "returns": null, + "paramDocs": [], + "returns": "the style", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setAlign", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStyle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, wie der Text zu seiner Position ausgerichtet wird" + "description": "Gibt den Stil zurück, in dem der Text gezeichnet wird" } } }, { - "id": "Text/setBackgroundColor(int,int,int)", - "memberId": "Text/setBackgroundColor", + "id": "Text/getText()", + "memberId": "Text/getText", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setBackgroundColor", + "methodName": "getText", "static": false, - "returnType": "void", - "parameterTypes": [ - "int", - "int", - "int" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "int r", - "int g", - "int b" - ], - "summary": "Sets the background color using the specified RGB values.", - "description": "Sets the background color using the specified RGB values.", + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "r: the red component of the color (0-255)", - "g: the green component of the color (0-255)", - "b: the blue component of the color (0-255)" - ], - "returns": null, + "paramDocs": [], + "returns": "what the text says", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Text/setBackgroundColor(double)", - "memberId": "Text/setBackgroundColor", + "id": "Text/getTextSize()", + "memberId": "Text/getTextSize", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setBackgroundColor", + "methodName": "getTextSize", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "h" - ], - "params": [ - "double h" - ], - "summary": "Sets the background color using the specified hue value.", - "description": "Sets the background color using the specified hue value.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "h: the hue value for the background color" - ], - "returns": null, + "paramDocs": [], + "returns": "the font size, or the default", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getTextSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe über den Farbton (0 bis 255)" + "description": "Gibt die Schriftgröße zurück" } } }, { - "id": "Text/setBackgroundColor(Color)", - "memberId": "Text/setBackgroundColor", + "id": "Text/getWidth()", + "memberId": "Text/getWidth", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setBackgroundColor", + "methodName": "getWidth", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the background color of the text.", - "description": "Sets the background color of the text.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "c: the new background color to be set" - ], - "returns": null, + "paramDocs": [], + "returns": "where lines wrap; 0 for no wrapping", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe" + "description": "Gibt die Breite des Textfelds zurück" } } }, { - "id": "Text/setFont(String)", - "memberId": "Text/setFont", + "id": "Text/getX()", + "memberId": "Text/getX", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setFont", + "methodName": "getX", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Sets the font name for the text.", - "description": "Sets the font name for the text.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "name: the name of the font to be set" - ], - "returns": null, + "paramDocs": [], + "returns": "x of the position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zur Schriftart mit dem angegebenen Namen" + "description": "Gibt die x-Position zurück" } } }, { - "id": "Text/setIsUI(boolean)", - "memberId": "Text/setIsUI", + "id": "Text/getY()", + "memberId": "Text/getY", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setIsUI", + "methodName": "getY", "static": false, - "returnType": "void", - "parameterTypes": [ - "boolean" - ], - "parameterNames": [ - "isUI" - ], - "params": [ - "boolean isUI" - ], - "summary": "Sets the UI status of this object.", - "description": "Sets the UI status of this object.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "isUI: a boolean indicating whether this object is part of the UI" - ], - "returns": null, + "paramDocs": [], + "returns": "y of the position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setIsUI", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, ob der Text zur Benutzeroberfläche gehört und sich nicht mit der Kamera bewegt" + "description": "Gibt die y-Position zurück" } } }, { - "id": "Text/setPosition(double,double)", - "memberId": "Text/setPosition", + "id": "Text/goLayersBackwards(int)", + "memberId": "Text/goLayersBackwards", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setPosition", + "methodName": "goLayersBackwards", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "int" ], "parameterNames": [ - "x", - "y" + "number" ], "params": [ - "double x", - "double y" + "int number" ], - "summary": "Sets the position of the text", - "description": "Sets the position of the text", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "go [backward v] (number) layers", "paramDocs": [ - "x: a x coordinate", - "y: a y coordinate" + "number: how many texts to move behind" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersBackwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" + "description": "Schiebt den Text um die angegebene Anzahl Ebenen nach hinten" } } }, { - "id": "Text/setPosition(Vector2)", - "memberId": "Text/setPosition", + "id": "Text/goLayersForwards(int)", + "memberId": "Text/goLayersForwards", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setPosition", + "methodName": "goLayersForwards", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "int" ], "parameterNames": [ - "v" + "number" ], "params": [ - "Vector2 v" + "int number" ], - "summary": "Sets the position of the text object using a Vector2 object.", - "description": "Sets the position of the text object using a Vector2 object.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "go [forward v] (number) layers", "paramDocs": [ - "v: the Vector2 object containing the x and y coordinates" + "number: how many texts to move in front of" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersForwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" + "description": "Bringt den Text um die angegebene Anzahl Ebenen nach vorne" } } }, { - "id": "Text/setStrokeColor(int,int,int)", - "memberId": "Text/setStrokeColor", + "id": "Text/goToBackLayer()", + "memberId": "Text/goToBackLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStrokeColor", + "methodName": "goToBackLayer", "static": false, "returnType": "void", - "parameterTypes": [ - "int", - "int", - "int" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "int r", - "int g", - "int b" - ], - "summary": "Sets the stroke color using the specified RGB values.", - "description": "Sets the stroke color using the specified RGB values.", - "scratchblock": null, - "paramDocs": [ - "r: the red component of the color (0-255)", - "g: the green component of the color (0-255)", - "b: the blue component of the color (0-255)" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Draws this text behind the other texts.", + "description": "Draws this text behind the other texts.", + "scratchblock": "go to [back v] layer", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToBackLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Rahmenfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" + "description": "Schiebt den Text hinter die anderen Texte" } } }, { - "id": "Text/setStrokeColor(double)", - "memberId": "Text/setStrokeColor", + "id": "Text/goToFrontLayer()", + "memberId": "Text/goToFrontLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStrokeColor", + "methodName": "goToFrontLayer", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "h" - ], - "params": [ - "double h" - ], - "summary": "Sets the stroke color using the specified hue value.", - "description": "Sets the stroke color using the specified hue value.", - "scratchblock": null, - "paramDocs": [ - "h: the hue value for the stroke color" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Draws this text in front of the other texts.", + "description": "Draws this text in front of the other texts.", + "scratchblock": "go to [front v] layer", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToFrontLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Rahmenfarbe über den Farbton (0 bis 255)" + "description": "Bringt den Text vor die anderen Texte" } } }, { - "id": "Text/setStrokeColor(Color)", - "memberId": "Text/setStrokeColor", + "id": "Text/hide()", + "memberId": "Text/hide", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStrokeColor", + "methodName": "hide", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the stroke color for the text.", - "description": "Sets the stroke color for the text.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Hides the text.", + "description": "Hides the text.", "scratchblock": null, - "paramDocs": [ - "c: the color to set as the stroke color" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/hide", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Rahmenfarbe" - } - } + "translations": {} }, { - "id": "Text/setStyle(TextStyle)", - "memberId": "Text/setStyle", + "id": "Text/isVisible()", + "memberId": "Text/isVisible", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStyle", + "methodName": "isVisible", + "static": false, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether the text is shown", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/isVisible", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Text/nextFont()", + "memberId": "Text/nextFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "nextFont", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.TextStyle" - ], - "parameterNames": [ - "style" - ], - "params": [ - "TextStyle style" - ], - "summary": "Sets the style of the text.", - "description": "Sets the style of the text.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the next font added, after the last to the first.", + "description": "Switches to the next font added, after the last to the first.", "scratchblock": null, - "paramDocs": [ - "style: the TextStyle to be applied to the text" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStyle", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/nextFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, ob der Text als Kasten, Sprech- oder Denkblase dargestellt wird" + "description": "Wechselt zur nächsten Schriftart" } } }, { - "id": "Text/setTextColor(int,int,int)", - "memberId": "Text/setTextColor", + "id": "Text/remove()", + "memberId": "Text/remove", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextColor", + "methodName": "remove", "static": false, "returnType": "void", - "parameterTypes": [ - "int", - "int", - "int" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "int r", - "int g", - "int b" - ], - "summary": "Sets the text color using RGB values.", - "description": "Sets the text color using RGB values.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Removes the text from its stage.", + "description": "Removes the text from its stage.", "scratchblock": null, - "paramDocs": [ - "r: the red component of the color (0-255)", - "g: the green component of the color (0-255)", - "b: the blue component of the color (0-255)" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Schriftfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" + "description": "Entfernt den Text von der Bühne" } } }, { - "id": "Text/setTextColor(double)", - "memberId": "Text/setTextColor", + "id": "Text/setAlign(TextAlign)", + "memberId": "Text/setAlign", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextColor", + "methodName": "setAlign", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.TextAlign" ], "parameterNames": [ - "h" + "align" ], "params": [ - "double h" + "TextAlign align" ], - "summary": "Sets the text color using the specified hue value.", - "description": "Sets the text color using the specified hue value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "h: the hue value for the text color" + "align: how lines sit relative to the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setAlign", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Schriftfarbe über den Farbton (0 bis 255)" + "description": "Legt fest, wie der Text zu seiner Position ausgerichtet wird" } } }, { - "id": "Text/setTextColor(Color)", - "memberId": "Text/setTextColor", + "id": "Text/setBackgroundColor(Color)", + "memberId": "Text/setBackgroundColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextColor", + "methodName": "setBackgroundColor", "static": false, "returnType": "void", "parameterTypes": [ "org.openpatch.scratch.Color" ], "parameterNames": [ - "c" + "color" ], "params": [ - "Color c" + "Color color" ], - "summary": "Sets the color of the text.", - "description": "Sets the color of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: the new color to be set for the text" + "color: the fill of a box or bubble" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Schriftfarbe" + "description": "Setzt die Hintergrundfarbe" } } }, { - "id": "Text/setTextSize(int)", - "memberId": "Text/setTextSize", + "id": "Text/setBackgroundColor(double,double,double)", + "memberId": "Text/setBackgroundColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextSize", + "methodName": "setBackgroundColor", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double", + "double", + "double" ], "parameterNames": [ - "size" + "red", + "green", + "blue" ], "params": [ - "int size" + "double red", + "double green", + "double blue" ], - "summary": "Sets the size of the text.", - "description": "Sets the size of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "size: the new size of the text" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Schriftgröße" - } - } + "translations": {} }, { - "id": "Text/setWidth(double)", - "memberId": "Text/setWidth", + "id": "Text/setFont(String)", + "memberId": "Text/setFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setWidth", + "methodName": "setFont", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "width" + "path" ], "params": [ - "double width" + "String path" ], - "summary": "Sets the width of the text.", - "description": "Sets the width of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "width: the new width to set" + "path: the font file for this text, or null for the default font" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Breite des Textfelds; längere Texte werden umgebrochen" + "description": "Wechselt zur Schriftart mit dem angegebenen Namen" } } }, { - "id": "Text/setX(double)", - "memberId": "Text/setX", + "id": "Text/setLayer(Layer)", + "memberId": "Text/setLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setX", + "methodName": "setLayer", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Layer" ], "parameterNames": [ - "x" + "layer" ], "params": [ - "double x" + "Layer layer" ], - "summary": "Sets the x-coordinate for this object.", - "description": "Sets the x-coordinate for this object.", + "summary": "Moves the text to another layer: [Layer.UI](../Layer/UI) keeps it in place when the camera moves;\nany other layer puts it into the world, in front of the foreground.", + "description": "Moves the text to another layer: [Layer.UI](../Layer/UI) keeps it in place when the camera moves;\nany other layer puts it into the world, in front of the foreground.", "scratchblock": null, "paramDocs": [ - "x: the new x-coordinate value" + "layer: the layer" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die x-Position" - } - } + "translations": {} }, { - "id": "Text/setY(double)", - "memberId": "Text/setY", + "id": "Text/setPosition(double,double)", + "memberId": "Text/setPosition", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setY", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ + "double", "double" ], "parameterNames": [ + "x", "y" ], "params": [ + "double x", "double y" ], - "summary": "Sets the Y coordinate of the text.", - "description": "Sets the Y coordinate of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "y: the new Y coordinate value" + "x: x of the position", + "y: y of the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die y-Position" + "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Text/showText(String)", - "memberId": "Text/showText", + "id": "Text/setPosition(Vector2)", + "memberId": "Text/setPosition", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "showText", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "text" + "position" ], "params": [ - "String text" + "Vector2 position" ], - "summary": "Displays the specified text.", - "description": "Displays the specified text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "text: The text to be displayed. If the text is null or empty, the text will be set to\n null." + "position: the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt den Text an" + "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Text/showText(String,int)", - "memberId": "Text/showText", + "id": "Text/setStrokeColor(Color)", + "memberId": "Text/setStrokeColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "showText", + "methodName": "setStrokeColor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "text", - "millis" + "color" ], "params": [ - "String text", - "int millis" + "Color color" ], - "summary": "Displays the specified text for a given duration.", - "description": "Displays the specified text for a given duration.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "text: The text to be displayed.", - "millis: The duration in milliseconds for which the text should be displayed." + "color: the outline of a box or bubble" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt den Text für die angegebene Zeit in Millisekunden an" + "description": "Setzt die Rahmenfarbe" } } }, { - "id": "Text/switchFont(String)", - "memberId": "Text/switchFont", + "id": "Text/setStrokeColor(double,double,double)", + "memberId": "Text/setStrokeColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "switchFont", + "methodName": "setStrokeColor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double", + "double" ], "parameterNames": [ - "name" + "red", + "green", + "blue" ], "params": [ - "String name" + "double red", + "double green", + "double blue" ], - "summary": "Switches the current font to the font with the specified name.", - "description": "Switches the current font to the font with the specified name.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the font to switch to" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/switchFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wechselt zur Schriftart mit dem angegebenen Namen" - } - } + "translations": {} }, { - "id": "Text/useFont(String,int)", - "memberId": "Text/useFont", + "id": "Text/setStyle(TextStyle)", + "memberId": "Text/setStyle", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useFont", - "static": true, + "methodName": "setStyle", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.TextStyle" ], "parameterNames": [ - "path", - "size" + "style" ], "params": [ - "String path", - "int size" + "TextStyle style" ], - "summary": "Chooses the font all text is written in, and how big it is.", - "description": "Chooses the font all text is written in, and how big it is.\n\nCall it before the first stage is created. The font is loaded while the\nwindow starts up, so choosing one later is not reliable.\n\n```java\npublic static void main(String[] args) {\n Text.useFont(\"assets/Retro Gaming.ttf\", 11);\n new MyStage();\n}\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "path: the path to a .ttf or .otf file", - "size: the size to write in" + "style: plain, box, speech or thought bubble" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStyle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt Schriftart und -größe für alle Texte fest" + "description": "Legt fest, ob der Text als Kasten, Sprech- oder Denkblase dargestellt wird" } } }, { - "id": "Text/useFont(String)", - "memberId": "Text/useFont", + "id": "Text/setTextColor(Color)", + "memberId": "Text/setTextColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useFont", - "static": true, + "methodName": "setTextColor", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "path" + "color" ], "params": [ - "String path" + "Color color" ], - "summary": "Chooses the font all text is written in, keeping the current size.", - "description": "Chooses the font all text is written in, keeping the current size.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "path: the path to a .ttf or .otf file" + "color: the colour of the letters" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt die Schriftart für alle Texte fest" + "description": "Setzt die Schriftfarbe" } } }, { - "id": "Text/useFontSizes(int[])", - "memberId": "Text/useFontSizes", + "id": "Text/setTextColor(double,double,double)", + "memberId": "Text/setTextColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useFontSizes", - "static": true, + "methodName": "setTextColor", + "static": false, "returnType": "void", "parameterTypes": [ - "int[]" + "double", + "double", + "double" ], "parameterNames": [ - "sizes" + "red", + "green", + "blue" ], "params": [ - "int[] sizes" + "double red", + "double green", + "double blue" ], - "summary": "Prepares several sizes of the font in advance. Only needed when text is\nshown at more than one size, so that every size looks sharp.", - "description": "Prepares several sizes of the font in advance. Only needed when text is\nshown at more than one size, so that every size looks sharp.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "sizes: the sizes to prepare" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFontSizes", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Text/useSmoothing(boolean)", - "memberId": "Text/useSmoothing", + "id": "Text/setTextSize(double)", + "memberId": "Text/setTextSize", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useSmoothing", - "static": true, + "methodName": "setTextSize", + "static": false, "returnType": "void", "parameterTypes": [ - "boolean" + "double" ], "parameterNames": [ - "smooth" + "size" ], "params": [ - "boolean smooth" + "double size" ], - "summary": "Chooses whether letters are smoothed. Turn it off for pixel fonts.", - "description": "Chooses whether letters are smoothed. Turn it off for pixel fonts.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "smooth: true to smooth the letters" + "size: the font size in stage units (in pixel-art mode rounded to whole font pixels when\n drawn)" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useSmoothing", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt fest, ob Schrift geglättet wird" - } - } - }, - { - "id": "Text/whenAddedToStage()", - "memberId": "Text/whenAddedToStage", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "whenAddedToStage", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the object is added to the stage. Override this method to define\ncustom behavior when the object is added to the stage.", - "description": "This method is called when the object is added to the stage. Override this method to define\ncustom behavior when the object is added to the stage.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenAddedToStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" - } - } + "translations": {} }, { - "id": "Text/whenAddedToStage(Stage)", - "memberId": "Text/whenAddedToStage", + "id": "Text/setWidth(double)", + "memberId": "Text/setWidth", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "whenAddedToStage", + "methodName": "setWidth", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Stage" + "double" ], "parameterNames": [ - "stage" + "width" ], "params": [ - "Stage stage" + "double width" ], - "summary": "This method is called when the text is added to the stage. Override this method to define\ncustom behavior when the text.", - "description": "This method is called when the text is added to the stage. Override this method to define\ncustom behavior when the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "stage: The stage to which the text is added." + "width: where lines wrap, in stage units; 0 for no wrapping" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenAddedToStage", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" - } - } - }, - { - "id": "Text/whenRemovedFromStage()", - "memberId": "Text/whenRemovedFromStage", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "whenRemovedFromStage", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the object is removed from the stage. Override this method to define\ncustom behavior that should occur when the object is no longer part of the stage.", - "description": "This method is called when the object is removed from the stage. Override this method to define\ncustom behavior that should occur when the object is no longer part of the stage.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenRemovedFromStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" + "description": "Setzt die Breite des Textfelds; längere Texte werden umgebrochen" } } }, { - "id": "Text/whenRemovedFromStage(Stage)", - "memberId": "Text/whenRemovedFromStage", + "id": "Text/setX(double)", + "memberId": "Text/setX", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "whenRemovedFromStage", + "methodName": "setX", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Stage" + "double" ], "parameterNames": [ - "stage" + "x" ], "params": [ - "Stage stage" + "double x" ], - "summary": "This method is called when the text is removed from the stage. Override this method to define\ncustom behavior that should occur.", - "description": "This method is called when the text is removed from the stage. Override this method to define\ncustom behavior that should occur.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "stage: The stage from which the text is removed." + "x: x of the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenRemovedFromStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" + "description": "Setzt die x-Position" } } }, { - "id": "Timer/afterMillis(int)", - "memberId": "Timer/afterMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "afterMillis", + "id": "Text/setY(double)", + "memberId": "Text/setY", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "setY", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int" + "double" ], "parameterNames": [ - "millis" + "y" ], "params": [ - "int millis" + "double y" ], - "summary": "Checks if the specified number of milliseconds has passed since the method was first called.", - "description": "Checks if the specified number of milliseconds has passed since the method was first called.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "millis: the number of milliseconds to check against" + "y: y of the position" ], - "returns": "true if the specified number of milliseconds has passed since the method was first\n called, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/afterMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt true zurück, sobald seit dem Zurücksetzen millis Millisekunden vergangen sind" + "description": "Setzt die y-Position" } } }, { - "id": "Timer/constructor()", - "memberId": "Timer/constructor", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "constructor", + "id": "Text/show()", + "memberId": "Text/show", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "show", "static": false, - "returnType": "Timer", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Timer object.", - "description": "Constructs a new Timer object.", + "summary": "Shows the text.", + "description": "Shows the text.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt einen neuen Timer" - } - } - }, - { - "id": "Timer/everyMillis(int)", - "memberId": "Timer/everyMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "everyMillis", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "millis" - ], - "params": [ - "int millis" - ], - "summary": "Checks if the specified number of milliseconds has passed since the last time this method\nreturned true.", - "description": "Checks if the specified number of milliseconds has passed since the last time this method\nreturned true.", - "scratchblock": null, - "paramDocs": [ - "millis: The number of milliseconds to wait before returning true." - ], - "returns": "true if the specified number of milliseconds has passed since the last call that\n returned true, false otherwise.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/everyMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/show", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt alle millis Millisekunden einmal true zurück" - } - } + "translations": {} }, { - "id": "Timer/forMillis(int)", - "memberId": "Timer/forMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "forMillis", + "id": "Text/showText(String)", + "memberId": "Text/showText", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "showText", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int" + "java.lang.String" ], "parameterNames": [ - "millis" + "text" ], "params": [ - "int millis" + "String text" ], - "summary": "Checks if the specified amount of milliseconds has passed since the method was first called. If\nthe method is called for the first time, it initializes the start time.", - "description": "Checks if the specified amount of milliseconds has passed since the method was first called. If\nthe method is called for the first time, it initializes the start time.", + "summary": "Shows the text with new words until it is changed or hidden.", + "description": "Shows the text with new words until it is changed or hidden.", "scratchblock": null, "paramDocs": [ - "millis: the number of milliseconds to check against" + "text: what it says; an empty text hides a bubble" ], - "returns": "true if the current time is less than the start time plus the specified milliseconds,\n false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/forMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt für die ersten millis Millisekunden nach dem Zurücksetzen true zurück" + "description": "Zeigt den Text an" } } }, { - "id": "Timer/intervalMillis(int)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", + "id": "Text/showText(String,double)", + "memberId": "Text/showText", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "showText", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int" + "java.lang.String", + "double" ], "parameterNames": [ - "millis" + "text", + "seconds" ], "params": [ - "int millis" + "String text", + "double seconds" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "Shows the text for a number of seconds of game time, then hides it.", + "description": "Shows the text for a number of seconds of game time, then hides it.", "scratchblock": null, "paramDocs": [ - "millis: the interval in milliseconds to check" + "text: what it says", + "seconds: how long" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wechselt alle millis Millisekunden zwischen true und false" - } - } + "translations": {} }, { - "id": "Timer/intervalMillis(int,boolean)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", + "id": "Text/switchFont(String)", + "memberId": "Text/switchFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "switchFont", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int", - "boolean" + "java.lang.String" ], "parameterNames": [ - "millis", - "skipFirst" + "name" ], "params": [ - "int millis", - "boolean skipFirst" + "String name" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "millis: the interval in milliseconds to check", - "skipFirst: if true, the first interval will be skipped" + "name: the name of a font added with [addFont(String, String)](addFont)" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/switchFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt alle millis Millisekunden zwischen true und false; skipFirst überspringt das erste Intervall" + "description": "Wechselt zur Schriftart mit dem angegebenen Namen" } } }, { - "id": "Timer/intervalMillis(int,int)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", - "static": false, - "returnType": "boolean", + "id": "Text/useFont(String)", + "memberId": "Text/useFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "useFont", + "static": true, + "returnType": "void", "parameterTypes": [ - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "millis1", - "millis2" + "path" ], "params": [ - "int millis1", - "int millis2" + "String path" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "The font every text uses unless it sets its own, from now on. Without it, texts use Ubuntu\nMono, or Jersey 10 in pixel-art mode.", + "description": "The font every text uses unless it sets its own, from now on. Without it, texts use Ubuntu\nMono, or Jersey 10 in pixel-art mode.", "scratchblock": null, "paramDocs": [ - "millis1: the first interval in milliseconds to check", - "millis2: the second interval in milliseconds to check" + "path: a TTF or OTF file" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt millis1 Millisekunden lang true und danach millis2 Millisekunden lang false zurück" + "description": "Legt die Schriftart für alle Texte fest" } } }, { - "id": "Timer/intervalMillis(int,int,boolean)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", - "static": false, - "returnType": "boolean", + "id": "Text/useFont(String,double)", + "memberId": "Text/useFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "useFont", + "static": true, + "returnType": "void", "parameterTypes": [ - "int", - "int", - "boolean" + "java.lang.String", + "double" ], "parameterNames": [ - "millis1", - "millis2", - "skipFirst" + "path", + "pixelSize" ], "params": [ - "int millis1", - "int millis2", - "boolean skipFirst" + "String path", + "double pixelSize" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "A pixel font as default font, with the size at which one of its pixels is one stage pixel:\nfor a pixel font whose outlines do not show its grid (most do: then [useFont(String)](useFont)\nis enough). In pixel-art mode sizes are rounded to whole pixels of it.", + "description": "A pixel font as default font, with the size at which one of its pixels is one stage pixel:\nfor a pixel font whose outlines do not show its grid (most do: then [useFont(String)](useFont)\nis enough). In pixel-art mode sizes are rounded to whole pixels of it.", "scratchblock": null, "paramDocs": [ - "millis1: the first interval in milliseconds to check", - "millis2: the second interval in milliseconds to check", - "skipFirst: if true, the first interval will be skipped" + "path: a TTF or OTF file", + "pixelSize: the size at which one font pixel is one stage pixel" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt millis1 Millisekunden lang true und danach millis2 Millisekunden lang false zurück; skipFirst überspringt das erste Intervall" - } - } + "translations": {} }, { - "id": "Timer/millis()", - "memberId": "Timer/millis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "millis", - "static": true, - "returnType": "int", + "id": "Text/whenAddedToStage()", + "memberId": "Text/whenAddedToStage", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "whenAddedToStage", + "static": false, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the number of milliseconds of game time since the program started.\nGame time stands still while the game is paused and runs slower or faster\nwith the game speed (see [Window.pause()](../Window/pause) and\n[Window.setGameSpeed(double)](../Window/setGameSpeed)); without either, it is the real time.", - "description": "Returns the number of milliseconds of game time since the program started.\nGame time stands still while the game is paused and runs slower or faster\nwith the game speed (see [Window.pause()](../Window/pause) and\n[Window.setGameSpeed(double)](../Window/setGameSpeed)); without either, it is the real time.", - "scratchblock": "(timer)", + "summary": "Called when the text was added to a stage.", + "description": "Called when the text was added to a stage.", + "scratchblock": null, "paramDocs": [], - "returns": "the milliseconds of game time since the program started", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/millis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenAddedToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die seit dem Programmstart vergangenen Millisekunden zurück" + "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" } } }, { - "id": "Timer/reset()", - "memberId": "Timer/reset", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "reset", + "id": "Text/whenRemovedFromStage()", + "memberId": "Text/whenRemovedFromStage", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "whenRemovedFromStage", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Resets the timer.", - "description": "Resets the timer.", - "scratchblock": "reset timer", + "summary": "Called when the text was removed from its stage.", + "description": "Called when the text was removed from its stage.", + "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/reset", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenRemovedFromStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt den Timer auf 0 zurück" + "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" } } }, { - "id": "Triangle/constructor(double,double,double,double,double,double)", - "memberId": "Triangle/constructor", - "owner": "org.openpatch.scratch.Triangle", - "className": "Triangle", - "methodName": "constructor", + "id": "Timer/after(double)", + "memberId": "Timer/after", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "after", "static": false, - "returnType": "Triangle", + "returnType": "boolean", "parameterTypes": [ - "double", - "double", - "double", - "double", - "double", "double" ], "parameterNames": [ - "x1", - "y1", - "x2", - "y2", - "x3", - "y3" + "seconds" ], "params": [ - "double x1", - "double y1", - "double x2", - "double y2", - "double x3", - "double y3" + "double seconds" ], - "summary": "Creates a triangle with the specified vertices.", - "description": "Creates a triangle with the specified vertices.", + "summary": "False for a number of seconds from the first call on, true afterwards.", + "description": "False for a number of seconds from the first call on, true afterwards.", "scratchblock": null, "paramDocs": [ - "x1: the x-coordinate of the first vertex", - "y1: the y-coordinate of the first vertex", - "x2: the x-coordinate of the second vertex", - "y2: the y-coordinate of the second vertex", - "x3: the x-coordinate of the third vertex", - "y3: the y-coordinate of the third vertex" + "seconds: how long to wait" ], + "returns": "whether that time is over", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/after", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Timer/constructor()", + "memberId": "Timer/constructor", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "constructor", + "static": false, + "returnType": "Timer", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A timer starting now.", + "description": "A timer starting now.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Triangle/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt ein Dreieck aus den drei Eckpunkten" + "description": "Erzeugt einen neuen Timer" } } }, { - "id": "UISprite/changeHeight(double)", - "memberId": "UISprite/changeHeight", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "changeHeight", + "id": "Timer/during(double)", + "memberId": "Timer/during", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "during", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ "double" ], "parameterNames": [ - "amount" + "seconds" ], "params": [ - "double amount" + "double seconds" ], - "summary": "Changes the height of the sprite by the given number of pixels.", - "description": "Changes the height of the sprite by the given number of pixels.", + "summary": "True for a number of seconds from the first call on, false afterwards.", + "description": "True for a number of seconds from the first call on, false afterwards.", "scratchblock": null, "paramDocs": [ - "amount: how many pixels to add to the height" + "seconds: how long" ], - "returns": null, + "returns": "whether that time is still running", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/changeHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/during", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Höhe um die angegebene Anzahl Pixel" - } - } + "translations": {} }, { - "id": "UISprite/changeWidth(double)", - "memberId": "UISprite/changeWidth", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "changeWidth", + "id": "Timer/every(double)", + "memberId": "Timer/every", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "every", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ "double" ], "parameterNames": [ - "amount" + "seconds" ], "params": [ - "double amount" + "double seconds" ], - "summary": "Changes the width of the sprite by the given number of pixels.", - "description": "Changes the width of the sprite by the given number of pixels.", + "summary": "True once every number of seconds: the first time that many seconds after the first call,\nthen again each time as many seconds have passed.", + "description": "True once every number of seconds: the first time that many seconds after the first call,\nthen again each time as many seconds have passed.", "scratchblock": null, "paramDocs": [ - "amount: how many pixels to add to the width" + "seconds: the period" ], - "returns": null, + "returns": "whether the period is over", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/changeWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/every", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Breite um die angegebene Anzahl Pixel" - } - } + "translations": {} }, { - "id": "UISprite/constructor()", - "memberId": "UISprite/constructor", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "constructor", + "id": "Timer/getSeconds()", + "memberId": "Timer/getSeconds", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "getSeconds", "static": false, - "returnType": "UISprite", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a sprite that is drawn as part of the user interface.", - "description": "Creates a sprite that is drawn as part of the user interface.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the seconds of game time since the timer started or was reset", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/getSeconds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine neue UI-Figur" - } - } + "translations": {} }, { - "id": "UISprite/disableNineSlice()", - "memberId": "UISprite/disableNineSlice", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "disableNineSlice", + "id": "Timer/interval(double)", + "memberId": "Timer/interval", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "interval", "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Lets the whole costume stretch again.", - "description": "Lets the whole costume stretch again.", + "returnType": "boolean", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "seconds" + ], + "params": [ + "double seconds" + ], + "summary": "Alternates: true for a number of seconds, then false for as long, and so on.", + "description": "Alternates: true for a number of seconds, then false for as long, and so on.", "scratchblock": null, - "paramDocs": [], - "returns": null, + "paramDocs": [ + "seconds: how long each phase lasts" + ], + "returns": "whether it is in an \"on\" phase", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/disableNineSlice", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/interval", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Lässt das ganze Kostüm wieder mitskalieren" - } - } + "translations": {} }, { - "id": "UISprite/setHeight(double)", - "memberId": "UISprite/setHeight", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "setHeight", + "id": "Timer/interval(double,double)", + "memberId": "Timer/interval", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "interval", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ + "double", "double" ], "parameterNames": [ - "height" + "on", + "off" ], "params": [ - "double height" + "double on", + "double off" ], - "summary": "Sets the height of the sprite in pixels.", - "description": "Sets the height of the sprite in pixels.", + "summary": "Alternates: true for `on` seconds, then false for `off` seconds, and so on.", + "description": "Alternates: true for `on` seconds, then false for `off` seconds, and so on.", "scratchblock": null, "paramDocs": [ - "height: the height in pixels" + "on: how long it is true", + "off: how long it is false" ], + "returns": "whether it is in an \"on\" phase", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/interval", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Timer/reset()", + "memberId": "Timer/reset", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "reset", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Starts the timer again from 0, and every method below with it.", + "description": "Starts the timer again from 0, and every method below with it.", + "scratchblock": "reset timer", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/setHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/reset", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Höhe in Pixeln" + "description": "Setzt den Timer auf 0 zurück" } } }, { - "id": "UISprite/setNineSlice(int,int,int,int)", - "memberId": "UISprite/setNineSlice", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "setNineSlice", - "static": false, - "returnType": "void", + "id": "Transition/fromShader(String)", + "memberId": "Transition/fromShader", + "owner": "org.openpatch.scratch.Transition", + "className": "Transition", + "methodName": "fromShader", + "static": true, + "returnType": "Transition", "parameterTypes": [ - "int", - "int", - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "top", - "right", - "bottom", - "left" + "path" ], "params": [ - "int top", - "int right", - "int bottom", - "int left" + "String path" ], - "summary": "Keeps the corners and edges of the costume from stretching when the sprite\nis resized, so that a button costume can be made any size.", - "description": "Keeps the corners and edges of the costume from stretching when the sprite\nis resized, so that a button costume can be made any size.", + "summary": "A transition of your own: a shader body with `from`, `to` (the two pictures),\n`progress` (0 to 1), `uv` and `color`.", + "description": "A transition of your own: a shader body with `from`, `to` (the two pictures),\n`progress` (0 to 1), `uv` and `color`.", "scratchblock": null, "paramDocs": [ - "top: how many pixels of the costume belong to the top edge", - "right: how many pixels of the costume belong to the right edge", - "bottom: how many pixels of the costume belong to the bottom edge", - "left: how many pixels of the costume belong to the left edge" + "path: the file with the body" ], + "returns": "the transition", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Transition/fromShader", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Transition/getName()", + "memberId": "Transition/getName", + "owner": "org.openpatch.scratch.Transition", + "className": "Transition", + "methodName": "getName", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the built-in name or the shader file", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Transition/getName", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Transition/toString()", + "memberId": "Transition/toString", + "owner": "org.openpatch.scratch.Transition", + "className": "Transition", + "methodName": "toString", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/setNineSlice", + "docsUrl": "https://scratch4j.openpatch.org/reference/Transition/toString", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Hält die Ecken und Ränder des Kostüms beim Skalieren fest (Nine-Slice)" - } - } + "translations": {} }, { - "id": "UISprite/setWidth(double)", - "memberId": "UISprite/setWidth", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "setWidth", + "id": "Triangle/constructor(double,double,double,double,double,double)", + "memberId": "Triangle/constructor", + "owner": "org.openpatch.scratch.Triangle", + "className": "Triangle", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "Triangle", "parameterTypes": [ + "double", + "double", + "double", + "double", + "double", "double" ], "parameterNames": [ - "width" + "x1", + "y1", + "x2", + "y2", + "x3", + "y3" ], "params": [ - "double width" + "double x1", + "double y1", + "double x2", + "double y2", + "double x3", + "double y3" ], - "summary": "Sets the width of the sprite in pixels.", - "description": "Sets the width of the sprite in pixels.", + "summary": "A triangle.", + "description": "A triangle.", "scratchblock": null, "paramDocs": [ - "width: the width in pixels" + "x1: x of the first corner", + "y1: y of the first corner", + "x2: x of the second corner", + "y2: y of the second corner", + "x3: x of the third corner", + "y3: y of the third corner" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/setWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Triangle/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Breite in Pixeln" + "description": "Erzeugt ein Dreieck aus den drei Eckpunkten" } } }, @@ -13553,6 +13953,28 @@ } } }, + { + "id": "Vector2/direction()", + "memberId": "Vector2/direction", + "owner": "org.openpatch.scratch.Vector2", + "className": "Vector2", + "methodName": "direction", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Returns the direction of the vector in Scratch's degrees: 0 points up, 90 to the right, 180\ndown and 270 to the left, the way `setDirection` on a sprite counts. [angle()](angle)\ncounts the mathematical way instead (0 to the right, anticlockwise).", + "description": "Returns the direction of the vector in Scratch's degrees: 0 points up, 90 to the right, 180\ndown and 270 to the left, the way `setDirection` on a sprite counts. [angle()](angle)\ncounts the mathematical way instead (0 to the right, anticlockwise).", + "scratchblock": null, + "paramDocs": [], + "returns": "the direction in degrees between 0 (inclusive) and 360 (exclusive)", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Vector2/direction", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Vector2/distance(Vector2)", "memberId": "Vector2/distance", @@ -14108,8 +14530,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Window with default dimensions. The default width is 480\npixels and the\ndefault height is 360 pixels.", - "description": "Constructs a new Window with default dimensions. The default width is 480\npixels and the\ndefault height is 360 pixels.\n\nA folder named `assets` is loaded while the loading screen shows, if\nthe project has one.", + "summary": "A window of 480 × 360, Scratch's stage size.", + "description": "A window of 480 × 360, Scratch's stage size.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14140,11 +14562,11 @@ "params": [ "String assets" ], - "summary": "Constructs a new Window with the specified assets. The window will have a\ndefault width of 480\npixels and a height of 360 pixels.", - "description": "Constructs a new Window with the specified assets. The window will have a\ndefault width of 480\npixels and a height of 360 pixels.\n\nThe images, sounds and fonts in that folder are loaded while the loading\nscreen shows, so they are ready when a sprite first uses them. Without\nit, a folder named `assets` is loaded, if there is one.", + "summary": "A window of 480 × 360 that loads every image, sound and font in a folder before the first\nframe, showing a loading screen.", + "description": "A window of 480 × 360 that loads every image, sound and font in a folder before the first\nframe, showing a loading screen.", "scratchblock": null, "paramDocs": [ - "assets: the path to the assets to be used in the window" + "assets: the folder, e.g. `\"assets\"`" ], "returns": null, "since": "", @@ -14177,12 +14599,12 @@ "int width", "int height" ], - "summary": "Constructs a new Window with the specified width and height.", - "description": "Constructs a new Window with the specified width and height.\n\nA folder named `assets` is loaded while the loading screen shows, if\nthe project has one.", + "summary": "A window whose stage has this size in stage pixels. The window opens at that size (in pixel\nart at the largest whole multiple that fits the screen) and scales the stage to fit when it\nis resized.", + "description": "A window whose stage has this size in stage pixels. The window opens at that size (in pixel\nart at the largest whole multiple that fits the screen) and scales the stage to fit when it\nis resized.", "scratchblock": null, "paramDocs": [ - "width: the width of the window", - "height: the height of the window" + "width: the stage width", + "height: the stage height" ], "returns": null, "since": "", @@ -14218,13 +14640,13 @@ "int height", "String assets" ], - "summary": "Constructs a new Window with the specified width, height, and assets path.\nEnsures that only\none instance of Window can be created.", - "description": "Constructs a new Window with the specified width, height, and assets path.\nEnsures that only\none instance of Window can be created.\n\nThe single exception is the window Java builds by itself: a class that\nextends Window and has a `main` method which is not static is\ninstantiated by the JVM before `main` is called, so the\n`new MyWindow()` in that `main` would be the second window. That\none reuses the first instead of failing.", + "summary": "A window of a size that loads a folder of assets first.", + "description": "A window of a size that loads a folder of assets first.", "scratchblock": null, "paramDocs": [ - "width: the width of the window", - "height: the height of the window\n\nThe images, sounds and fonts in the assets folder are loaded while the\nloading screen shows, so they are ready when a sprite first uses them.\nWithout it, a folder named `assets` is loaded, if there is one.", - "assets: the path to the assets" + "width: the stage width", + "height: the stage height", + "assets: the folder, or null" ], "returns": null, "since": "", @@ -14254,11 +14676,11 @@ "params": [ "Object[] values" ], - "summary": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the window's class name.", - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the window's class name.\n\nExample:\n\n```java\nthis.debug(\"fps =\", getFps());\n// prints: [MyWindow] fps = 60\n```", + "summary": "Prints values, but only in debug mode.", + "description": "Prints values, but only in debug mode.", "scratchblock": null, "paramDocs": [ - "values: one or more values to print" + "values: what to print" ], "returns": null, "since": "", @@ -14278,8 +14700,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Exits the application by invoking the `whenExits` method and then calling the\n`exit` method on\nthe `Applet` instance.", - "description": "Exits the application by invoking the `whenExits` method and then calling the\n`exit` method on\nthe `Applet` instance.", + "summary": "Ends the program: [whenExits()](whenExits) runs first.", + "description": "Ends the program: [whenExits()](whenExits) runs first.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14294,30 +14716,26 @@ } }, { - "id": "Window/getDeltaTime()", - "memberId": "Window/getDeltaTime", + "id": "Window/getFrameSmoothing()", + "memberId": "Window/getFrameSmoothing", "owner": "org.openpatch.scratch.Window", "className": "Window", - "methodName": "getDeltaTime", - "static": false, + "methodName": "getFrameSmoothing", + "static": true, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the seconds of game time passed since the last frame. While the game\nis paused this is 0, and at half speed half the real time.", - "description": "Gets the seconds of game time passed since the last frame. While the game\nis paused this is 0, and at half speed half the real time.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "seconds since last frame", + "returns": "the frame smoothing in percent, 0 when off", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getDeltaTime", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getFrameSmoothing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" - } - } + "translations": {} }, { "id": "Window/getGameSpeed()", @@ -14330,11 +14748,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "The game speed set with [setGameSpeed(double)](setGameSpeed).", - "description": "The game speed set with [setGameSpeed(double)](setGameSpeed).", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "1 for normal speed", + "returns": "the game speed", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getGameSpeed", "availability": "implemented", @@ -14352,11 +14770,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the height of the current window.", - "description": "Retrieves the height of the current window.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the height of the window in pixels", + "returns": "the stage height in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getHeight", "availability": "implemented", @@ -14378,11 +14796,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the singleton instance of the Window class.", - "description": "Returns the singleton instance of the Window class.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the singleton instance of Window", + "returns": "the window, or null before it was created", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getInstance", "availability": "implemented", @@ -14404,11 +14822,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the title of the library.", - "description": "Returns the title of the library.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the title of the library as a String", + "returns": "\"Scratch for Java\"", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getLibraryTitle", "availability": "implemented", @@ -14430,11 +14848,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the version of the library.", - "description": "Returns the version of the library.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the version of the library as a String", + "returns": "the version of Scratch for Java, e.g. \"7.0.0\"", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getLibraryVersion", "availability": "implemented", @@ -14456,43 +14874,17 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current stage from the Applet instance.", - "description": "Retrieves the current stage from the Applet instance.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the current Stage object", + "returns": "the stage shown", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, - { - "id": "Window/getTextureSampling()", - "memberId": "Window/getTextureSampling", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "getTextureSampling", - "static": true, - "returnType": "TextureSampling", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns how pictures are being smoothed.", - "description": "Returns how pictures are being smoothed.", - "scratchblock": null, - "paramDocs": [], - "returns": "the current setting", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getTextureSampling", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt das eingestellte Glättungsverfahren zurück" - } - } - }, { "id": "Window/getWidth()", "memberId": "Window/getWidth", @@ -14504,11 +14896,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the width of the current window.", - "description": "Retrieves the width of the current window.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the width of the window in pixels", + "returns": "the stage width in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getWidth", "availability": "implemented", @@ -14530,11 +14922,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the application is in debug mode.", - "description": "Checks if the application is in debug mode.\n\nDebug mode can be toggled at runtime by pressing F12.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true if the application is in debug mode, false otherwise.", + "returns": "whether debug mode is on", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isDebug", "availability": "implemented", @@ -14556,33 +14948,77 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Whether the game is paused.", - "description": "Whether the game is paused.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true while paused", + "returns": "whether the game is paused", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isPaused", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, + { + "id": "Window/isPixelArt()", + "memberId": "Window/isPixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "isPixelArt", + "static": true, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether pixel-art mode is on", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isPixelArt", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Window/isSmoothPixelArt()", + "memberId": "Window/isSmoothPixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "isSmoothPixelArt", + "static": true, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether the pixel art scrolls smoothly (see [useSmoothPixelArt()](useSmoothPixelArt))", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isSmoothPixelArt", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Window/isTransitioning()", "memberId": "Window/isTransitioning", "owner": "org.openpatch.scratch.Window", "className": "Window", "methodName": "isTransitioning", - "static": true, + "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns whether a stage transition is in progress, including creation of\nthe destination stage.", - "description": "Returns whether a stage transition is in progress, including creation of\nthe destination stage.\n\nWhile a transition is running, calls to\n[transitionToStage(Stage, int)](transitionToStage) are ignored. A program that moves\nthe player or builds a new stage in the same breath as a warp should\nuse [transitionToStage(Supplier, int)](transitionToStage) so those changes are deferred\nuntil the screen is black and skipped when a transition is already running.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "`true` while a transition is in progress, `false` otherwise", + "returns": "whether a transition is in progress", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isTransitioning", "availability": "implemented", @@ -14600,8 +15036,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Pauses the game: `run()` is no longer called, and timers, gliding\nand animations stand still. The window keeps drawing, so the paused\npicture stays visible, and keys and clicks still reach methods like\n`whenKeyPressed`, so a key can [resume()](resume) the game.", - "description": "Pauses the game: `run()` is no longer called, and timers, gliding\nand animations stand still. The window keeps drawing, so the paused\npicture stays visible, and keys and clicks still reach methods like\n`whenKeyPressed`, so a key can [resume()](resume) the game.", + "summary": "Pauses the game: no ticks run; keys and the mouse still reach the stage and sprites.", + "description": "Pauses the game: no ticks run; keys and the mouse still reach the stage and sprites.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14626,8 +15062,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Lets a paused game go on where it stopped.", - "description": "Lets a paused game go on where it stopped.", + "summary": "Goes on after [pause()](pause).", + "description": "Goes on after [pause()](pause).", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14654,11 +15090,11 @@ "params": [ "boolean debug" ], - "summary": "Enables or disables the debug mode for the application.", - "description": "Enables or disables the debug mode for the application.\n\nDebug mode shows sprite positions, hitboxes, and other debug information.\nIt can also be toggled at runtime by pressing F12.", + "summary": "Debug mode shows what its panel in the bottom right corner has ticked: hitboxes, positions,\nthe mouse and camera, touching pairs, hidden sprites, the clones and the frame rate, and it\nlets `debug(\\u2026)` print. F12 switches it too, and `-Dscratch4j.debug=\\u2026` presets\nwhich options are on.", + "description": "Debug mode shows what its panel in the bottom right corner has ticked: hitboxes, positions,\nthe mouse and camera, touching pairs, hidden sprites, the clones and the frame rate, and it\nlets `debug(\\u2026)` print. F12 switches it too, and `-Dscratch4j.debug=\\u2026` presets\nwhich options are on.", "scratchblock": null, "paramDocs": [ - "debug: a boolean value where `true` enables debug mode and\n `false` disables\n it." + "debug: on or off" ], "returns": null, "since": "", @@ -14688,11 +15124,11 @@ "params": [ "double speed" ], - "summary": "Makes the game run slower or faster: 1 is normal, 0.5 half as fast, 2\ntwice as fast. `run()`, timers, gliding and animations all follow,\nso the whole game looks like slow motion; the window keeps drawing\nsmoothly.", - "description": "Makes the game run slower or faster: 1 is normal, 0.5 half as fast, 2\ntwice as fast. `run()`, timers, gliding and animations all follow,\nso the whole game looks like slow motion; the window keeps drawing\nsmoothly.", + "summary": "How fast the game runs: 1 is normal, 2 twice as fast, 0.5 half as fast; up to 8. Each tick\nstill is 1/60 s of game time; there are more or fewer of them per second.", + "description": "How fast the game runs: 1 is normal, 2 twice as fast, 0.5 half as fast; up to 8. Each tick\nstill is 1/60 s of game time; there are more or fewer of them per second.", "scratchblock": null, "paramDocs": [ - "speed: 1 for normal speed, smaller for slower, larger for faster" + "speed: the game speed" ], "returns": null, "since": "", @@ -14718,11 +15154,11 @@ "params": [ "Stage stage" ], - "summary": "Sets the current stage of the application.", - "description": "Sets the current stage of the application.", + "summary": "Shows a stage from the next tick on.", + "description": "Shows a stage from the next tick on.", "scratchblock": null, "paramDocs": [ - "stage: the new stage to be set" + "stage: the stage" ], "returns": null, "since": "", @@ -14746,8 +15182,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "While the game is paused: runs it for exactly one frame (every\n`run()` once) and pauses again. Useful to watch closely what\nhappens, for example when two sprites touch.", - "description": "While the game is paused: runs it for exactly one frame (every\n`run()` once) and pauses again. Useful to watch closely what\nhappens, for example when two sprites touch.", + "summary": "While paused: runs exactly one tick.", + "description": "While paused: runs exactly one tick.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14758,7 +15194,7 @@ "translations": {} }, { - "id": "Window/transitionToStage(Stage,int)", + "id": "Window/transitionToStage(Stage,double)", "memberId": "Window/transitionToStage", "owner": "org.openpatch.scratch.Window", "className": "Window", @@ -14767,782 +15203,636 @@ "returnType": "void", "parameterTypes": [ "org.openpatch.scratch.Stage", - "int" + "double" ], "parameterNames": [ "stage", - "duration" + "seconds" ], "params": [ "Stage stage", - "int duration" + "double seconds" ], - "summary": "Transitions to a new stage with a specified duration.", - "description": "Transitions to a new stage with a specified duration.", + "summary": "Fades to a stage through black.", + "description": "Fades to a stage through black.", "scratchblock": null, "paramDocs": [ - "stage: the new stage to transition to", - "duration: the duration of the transition in milliseconds" + "stage: the stage", + "seconds: how long" ], "returns": null, "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Blendet über Schwarz zur angegebenen Bühne über" - } - } - }, - { - "id": "Window/transitionToStage(Supplier,int)", - "memberId": "Window/transitionToStage", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "transitionToStage", - "static": false, - "returnType": "void", - "parameterTypes": [ - "java.util.function.Supplier", - "int" - ], - "parameterNames": [ - "stage", - "duration" - ], - "params": [ - "Supplier stage", - "int duration" - ], - "summary": "Fades to black, creates the destination stage, then fades it in.", - "description": "Fades to black, creates the destination stage, then fades it in.\n\nThe supplier is called exactly once, when the screen is black. It is\nnever called when another transition is already running. Move shared\nsprites and update game state inside the supplier so those changes happen\nonly when the transition is accepted, while the old stage is hidden.\nThe call returns immediately; the supplier runs later on the animation thread.", - "scratchblock": null, - "paramDocs": [ - "stage: creates the destination stage; must return a non-null stage", - "duration: the duration, using the same timing as the Stage overload" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Window/useFullScreen()", - "memberId": "Window/useFullScreen", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "useFullScreen", - "static": true, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Makes the window fill the whole screen.", - "description": "Makes the window fill the whole screen.\n\nCall it before the first stage is created, because the size of the window is\nsettled the moment it opens:\n\n```java\npublic static void main(String[] args) {\n Window.useFullScreen();\n new MyStage();\n}\n```", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useFullScreen", - "availability": "desktop-only", - "availabilityReason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation.", - "translations": { - "de": { - "description": "Nur in der Desktop-Version: startet im Vollbild" - } - } - }, - { - "id": "Window/useSplashLogo(String)", - "memberId": "Window/useSplashLogo", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "useSplashLogo", - "static": true, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "path" - ], - "params": [ - "String path" - ], - "summary": "Puts your own picture on the loading screen in place of the Scratch for Java\nlogo. The picture fades in while your project starts and fades out again\nonce it is ready.", - "description": "Puts your own picture on the loading screen in place of the Scratch for Java\nlogo. The picture fades in while your project starts and fades out again\nonce it is ready.\n\nIt is shrunk to fit if it is large, and never enlarged, so a picture of\nroughly 300 by 300 looks right in a window of the usual size.\n\nCall it before the first stage is created, because the loading screen is the\nfirst thing the window draws:\n\n```java\npublic static void main(String[] args) {\n Window.useSplashLogo(\"assets/logo.png\");\n new MyStage();\n}\n```", - "scratchblock": null, - "paramDocs": [ - "path: a path to an image file or the name of a built-in sprite, or\n `null` for the Scratch for Java logo" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useSplashLogo", - "availability": "desktop-only", - "availabilityReason": "The browser has no desktop splash window. This option only reports a limitation.", - "translations": { - "de": { - "description": "Nur in der Desktop-Version: zeigt beim Start ein Logo" - } - } - }, - { - "id": "Window/useTextureSampling(TextureSampling)", - "memberId": "Window/useTextureSampling", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "useTextureSampling", - "static": true, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.TextureSampling" - ], - "parameterNames": [ - "sampling" - ], - "params": [ - "TextureSampling sampling" - ], - "summary": "Chooses how pictures are smoothed when they are drawn larger or smaller than\nthey really are. Pixel art usually wants [TextureSampling.POINT](../TextureSampling/POINT).", - "description": "Chooses how pictures are smoothed when they are drawn larger or smaller than\nthey really are. Pixel art usually wants [TextureSampling.POINT](../TextureSampling/POINT).\n\nCall it before the first stage is created.\n\n```java\nWindow.useTextureSampling(TextureSampling.POINT);\nnew MyStage();\n```", - "scratchblock": null, - "paramDocs": [ - "sampling: how to smooth pictures" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useTextureSampling", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt fest, wie Bilder beim Vergrößern und Verkleinern geglättet werden. TextureSampling.POINT hält Pixelgrafik scharf, LINEAR (Standard) glättet. BILINEAR und TRILINEAR wirken im Browser wie LINEAR." - } - } - }, - { - "id": "Window/whenExits()", - "memberId": "Window/whenExits", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "whenExits", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the window exits. Override this method to define\ncustom behavior\nwhen the window is closed.", - "description": "This method is called when the window exits. Override this method to define\ncustom behavior\nwhen the window is closed.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/whenExits", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird beim Beenden des Programms aufgerufen" - } - } + "translations": {} }, { - "id": "extensions/camera/Camera/changeX(double)", - "memberId": "extensions/camera/Camera/changeX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "changeX", + "id": "Window/transitionToStage(Supplier,double)", + "memberId": "Window/transitionToStage", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "transitionToStage", "static": false, "returnType": "void", "parameterTypes": [ + "java.util.function.Supplier", "double" ], "parameterNames": [ - "x" + "stage", + "seconds" ], "params": [ - "double x" + "Supplier stage", + "double seconds" ], - "summary": "Changes x by a certain amount", - "description": "Changes x by a certain amount", + "summary": "Fades to a stage made now, on the game thread: a slow constructor shows the loading screen\ninstead of freezing the window.", + "description": "Fades to a stage made now, on the game thread: a slow constructor shows the loading screen\ninstead of freezing the window.", "scratchblock": null, "paramDocs": [ - "x: number in pixels" + "stage: makes the stage, e.g. `() -> new Level2()`", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/changeX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/changeY(double)", - "memberId": "extensions/camera/Camera/changeY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "changeY", + "id": "Window/transitionToStage(Supplier,Transition,double)", + "memberId": "Window/transitionToStage", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "transitionToStage", "static": false, "returnType": "void", "parameterTypes": [ + "java.util.function.Supplier", + "org.openpatch.scratch.Transition", "double" ], "parameterNames": [ - "y" + "stage", + "transition", + "seconds" ], "params": [ - "double y" + "Supplier stage", + "Transition transition", + "double seconds" ], - "summary": "Changes y by a certain amount", - "description": "Changes y by a certain amount", + "summary": "Shows a stage made now through a transition.", + "description": "Shows a stage made now through a transition.\n\n```java\nwindow.transitionToStage(() -> new Level2(), Transition.SLIDE_LEFT, 0.5);\n```", "scratchblock": null, "paramDocs": [ - "y: number in pixels" + "stage: makes the stage", + "transition: how", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/changeY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/changeZoom(double)", - "memberId": "extensions/camera/Camera/changeZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "changeZoom", - "static": false, + "id": "Window/use(Extension)", + "memberId": "Window/use", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "use", + "static": true, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.extension.Extension" ], "parameterNames": [ - "dz" + "extension" ], "params": [ - "double dz" + "Extension extension" ], - "summary": "Changes the zoom level by a certain amount", - "description": "Changes the zoom level by a certain amount", + "summary": "Uses an extension that does not register itself through `META-INF/services` (one in\nyour own project). Call it before `new Window`.", + "description": "Uses an extension that does not register itself through `META-INF/services` (one in\nyour own project). Call it before `new Window`.", "scratchblock": null, "paramDocs": [ - "dz: the amount to change the zoom level by" + "extension: the extension" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/changeZoom", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/use", + "availability": "desktop-only", + "availabilityReason": "Extensions load through the desktop's ServiceLoader and run against its window and render threads. The browser ships its extensions natively; it does not load external or custom extensions.", "translations": {} }, { - "id": "extensions/camera/Camera/constructor()", - "memberId": "extensions/camera/Camera/constructor", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "constructor", - "static": false, - "returnType": "Camera", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Constructs a new Camera with default values. The default position is (0, 0) and the default\nzoom level is 100.", - "description": "Constructs a new Camera with default values. The default position is (0, 0) and the default\nzoom level is 100.", + "id": "Window/useFrameSmoothing(double)", + "memberId": "Window/useFrameSmoothing", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useFrameSmoothing", + "static": true, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "percent" + ], + "params": [ + "double percent" + ], + "summary": "Frame smoothing: each frame is presented mixed with the one before it, this much in percent.\nA screen that holds each frame until the next (every 60 Hz LCD) smears whatever moves,\nbecause the eye gets one picture per 16.7 ms; two pictures per frame (50 is a good value)\nlook like one picture per 8.3 ms and smear about half as much. The world keeps its pixels:\nthe moment nothing moves, current and previous frame are the same and the picture is fully\nsharp. While things move, edges are softer \\u2014 that is the trade. Call it before\n`new Window`; 0 (the default) turns it off.", + "description": "Frame smoothing: each frame is presented mixed with the one before it, this much in percent.\nA screen that holds each frame until the next (every 60 Hz LCD) smears whatever moves,\nbecause the eye gets one picture per 16.7 ms; two pictures per frame (50 is a good value)\nlook like one picture per 8.3 ms and smear about half as much. The world keeps its pixels:\nthe moment nothing moves, current and previous frame are the same and the picture is fully\nsharp. While things move, edges are softer \\u2014 that is the trade. Call it before\n`new Window`; 0 (the default) turns it off.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "percent: how much of the previous frame each presented one keeps, 0 to 100" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useFrameSmoothing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/getPosition()", - "memberId": "extensions/camera/Camera/getPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getPosition", - "static": false, - "returnType": "Vector2", + "id": "Window/useFullScreen()", + "memberId": "Window/useFullScreen", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useFullScreen", + "static": true, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the position of the sprite", - "description": "Returns the position of the sprite", + "summary": "Opens the window full screen (a borderless window at the screen's size). Call it before `new Window`.", + "description": "Opens the window full screen (a borderless window at the screen's size). Call it before `new Window`.", "scratchblock": null, "paramDocs": [], - "returns": "a vector", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getPosition", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useFullScreen", + "availability": "desktop-only", + "availabilityReason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation.", + "translations": { + "de": { + "description": "Nur in der Desktop-Version: startet im Vollbild" + } + } }, { - "id": "extensions/camera/Camera/getX()", - "memberId": "extensions/camera/Camera/getX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getX", - "static": false, - "returnType": "double", + "id": "Window/usePixelArt()", + "memberId": "Window/usePixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "usePixelArt", + "static": true, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the x coordinate of the sprite", - "description": "Returns the x coordinate of the sprite", + "summary": "Pixel-art mode: images are not smoothed, the stage scales by whole numbers only, the default\nfont is Jersey 10 and font sizes are rounded to its pixels. Call it before `new Window`.", + "description": "Pixel-art mode: images are not smoothed, the stage scales by whole numbers only, the default\nfont is Jersey 10 and font sizes are rounded to its pixels. Call it before `new Window`.", "scratchblock": null, "paramDocs": [], - "returns": "a x coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/usePixelArt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/getY()", - "memberId": "extensions/camera/Camera/getY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getY", - "static": false, - "returnType": "double", + "id": "Window/useSmoothPixelArt()", + "memberId": "Window/useSmoothPixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useSmoothPixelArt", + "static": true, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the y coordinate of the sprite", - "description": "Returns the y coordinate of the sprite", + "summary": "Smooth pixel art (Godot's \"canvas items\" way of showing pixel art): as [usePixelArt()](usePixelArt),\nbut the camera moves without snapping and zoom works at any factor. The world is drawn at the\nwindow's resolution with the sprites still sampled by nearest neighbour, so every pixel stays\na sharp square while things move \\u2014 the grid wobbles by a screen pixel instead of the picture\nstepping whole stage pixels (the look of Hyper Light Drifter, as Godot's guide puts it). With\nit, scrolling does not need [useFrameSmoothing(double)](useFrameSmoothing). Call it before\n`new Window`.", + "description": "Smooth pixel art (Godot's \"canvas items\" way of showing pixel art): as [usePixelArt()](usePixelArt),\nbut the camera moves without snapping and zoom works at any factor. The world is drawn at the\nwindow's resolution with the sprites still sampled by nearest neighbour, so every pixel stays\na sharp square while things move \\u2014 the grid wobbles by a screen pixel instead of the picture\nstepping whole stage pixels (the look of Hyper Light Drifter, as Godot's guide puts it). With\nit, scrolling does not need [useFrameSmoothing(double)](useFrameSmoothing). Call it before\n`new Window`.", "scratchblock": null, "paramDocs": [], - "returns": "a y coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useSmoothPixelArt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/getZoom()", - "memberId": "extensions/camera/Camera/getZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getZoom", - "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the zoom level", - "description": "Returns the zoom level", + "id": "Window/useSplashLogo(String)", + "memberId": "Window/useSplashLogo", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useSplashLogo", + "static": true, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "path" + ], + "params": [ + "String path" + ], + "summary": "The logo on the loading screen. Call it before `new Window`.", + "description": "The logo on the loading screen. Call it before `new Window`.", "scratchblock": null, - "paramDocs": [], - "returns": "the zoom level", + "paramDocs": [ + "path: an image" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getZoom", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useSplashLogo", + "availability": "desktop-only", + "availabilityReason": "The browser has no desktop splash window. This option only reports a limitation.", + "translations": { + "de": { + "description": "Nur in der Desktop-Version: zeigt beim Start ein Logo" + } + } }, { - "id": "extensions/camera/Camera/resetZoom()", - "memberId": "extensions/camera/Camera/resetZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "resetZoom", + "id": "Window/whenExits()", + "memberId": "Window/whenExits", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "whenExits", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Resets the zoom level to 100", - "description": "Resets the zoom level to 100", + "summary": "Called when the program ends, on the game thread. Override it to save, say.", + "description": "Called when the program ends, on the game thread. Override it to save, say.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/resetZoom", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/whenExits", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Wird beim Beenden des Programms aufgerufen" + } + } }, { - "id": "extensions/camera/Camera/setPosition(double,double)", - "memberId": "extensions/camera/Camera/setPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setPosition", + "id": "drawing/BitmapText/addGlyph(char,String)", + "memberId": "drawing/BitmapText/addGlyph", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "addGlyph", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "char", + "java.lang.String" ], "parameterNames": [ - "x", - "y" + "character", + "path" ], "params": [ - "double x", - "double y" + "char character", + "String path" ], - "summary": "Sets the position of the sprite", - "description": "Sets the position of the sprite", + "summary": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", + "description": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", "scratchblock": null, "paramDocs": [ - "x: a x coordinate", - "y: a y coordinate" + "character: the character to replace", + "path: its image or built-in costume name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/addGlyph", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setPosition(Vector2)", - "memberId": "extensions/camera/Camera/setPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setPosition", + "id": "drawing/BitmapText/constructor(String)", + "memberId": "drawing/BitmapText/constructor", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "BitmapText", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" ], "parameterNames": [ - "v" + "pattern" ], "params": [ - "Vector2 v" + "String pattern" ], - "summary": "Sets the position of the sprite based on the coordinates of a given vector.", - "description": "Sets the position of the sprite based on the coordinates of a given vector.", + "summary": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", + "description": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", "scratchblock": null, "paramDocs": [ - "v: a vector" + "pattern: image path with an integer format, e.g. \"assets/font%03d.png\"" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setX(double)", - "memberId": "extensions/camera/Camera/setX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setX", + "id": "drawing/BitmapText/draw(Drawing)", + "memberId": "drawing/BitmapText/draw", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "draw", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.drawing.Drawing" ], "parameterNames": [ - "x" + "drawing" ], "params": [ - "double x" + "Drawing drawing" ], - "summary": "Sets the x coordinate", - "description": "Sets the x coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "x: a x coordinate" + "drawing: the current frame's canvas" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setX", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/draw", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setY(double)", - "memberId": "extensions/camera/Camera/setY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setY", + "id": "drawing/BitmapText/getContent()", + "memberId": "drawing/BitmapText/getContent", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "getContent", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "y" - ], - "params": [ - "double y" - ], - "summary": "Sets the y coordinate", - "description": "Sets the y coordinate", + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "y: a y coordinate" - ], - "returns": null, + "paramDocs": [], + "returns": "the text being shown", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setY", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/getContent", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setZoom(double)", - "memberId": "extensions/camera/Camera/setZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setZoom", + "id": "drawing/BitmapText/getHeight()", + "memberId": "drawing/BitmapText/getHeight", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "getHeight", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "zoom" - ], - "params": [ - "double zoom" - ], - "summary": "Sets the zoom", - "description": "Sets the zoom", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "zoom: the zoom level" - ], - "returns": null, + "paramDocs": [], + "returns": "the displayed text's height, including line spacing and sprite size", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setZoom", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/getHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setZoomLimit(double,double)", - "memberId": "extensions/camera/Camera/setZoomLimit", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setZoomLimit", + "id": "drawing/BitmapText/getWidth()", + "memberId": "drawing/BitmapText/getWidth", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "getWidth", "static": false, - "returnType": "void", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "low", - "high" - ], - "params": [ - "double low", - "double high" - ], - "summary": "Sets the zoom limits", - "description": "Sets the zoom limits", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "low: the lower limit", - "high: the upper limit" - ], - "returns": null, + "paramDocs": [], + "returns": "the displayed text's width, including the sprite's size", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setZoomLimit", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toGlobalPosition(Vector2)", - "memberId": "extensions/camera/Camera/toGlobalPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toGlobalPosition", + "id": "drawing/BitmapText/setAlign(TextAlign)", + "memberId": "drawing/BitmapText/setAlign", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setAlign", "static": false, - "returnType": "Vector2", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.TextAlign" ], "parameterNames": [ - "v" + "align" ], "params": [ - "Vector2 v" + "TextAlign align" ], - "summary": "Converts local camera coordinates to screen coordinates", - "description": "Converts local camera coordinates to screen coordinates", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "v: local camera coordinates" + "align: LEFT, CENTER or RIGHT (DEFAULT means LEFT)" ], - "returns": "screen coordinates", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toGlobalPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setAlign", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toGlobalX(double)", - "memberId": "extensions/camera/Camera/toGlobalX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toGlobalX", + "id": "drawing/BitmapText/setFont(String)", + "memberId": "drawing/BitmapText/setFont", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setFont", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "x" + "pattern" ], "params": [ - "double x" + "String pattern" ], - "summary": "Converts local camera x coordinate to screen x coordinate", - "description": "Converts local camera x coordinate to screen x coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "x: local camera x coordinate" + "pattern: glyph path with one integer format for the Unicode code point" ], - "returns": "screen x coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toGlobalX", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toGlobalY(double)", - "memberId": "extensions/camera/Camera/toGlobalY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toGlobalY", + "id": "drawing/BitmapText/setLetterSpacing(double)", + "memberId": "drawing/BitmapText/setLetterSpacing", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setLetterSpacing", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "y" + "spacing" ], "params": [ - "double y" + "double spacing" ], - "summary": "Converts local camera y coordinate to screen y coordinate", - "description": "Converts local camera y coordinate to screen y coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "y: local camera y coordinate" + "spacing: gap between characters; negative values allow italic glyphs to overlap" ], - "returns": "screen y coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toGlobalY", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setLetterSpacing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toLocalPosition(Vector2)", - "memberId": "extensions/camera/Camera/toLocalPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toLocalPosition", + "id": "drawing/BitmapText/setLineSpacing(double)", + "memberId": "drawing/BitmapText/setLineSpacing", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setLineSpacing", "static": false, - "returnType": "Vector2", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "double" ], "parameterNames": [ - "v" + "spacing" ], "params": [ - "Vector2 v" + "double spacing" ], - "summary": "Converts screen coordinates to local camera coordinates", - "description": "Converts screen coordinates to local camera coordinates", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "v: screen coordinates" + "spacing: extra pixels between lines" ], - "returns": "local coordinates", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toLocalPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setLineSpacing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toLocalX(double)", - "memberId": "extensions/camera/Camera/toLocalX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toLocalX", + "id": "drawing/BitmapText/setSpaceWidth(double)", + "memberId": "drawing/BitmapText/setSpaceWidth", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setSpaceWidth", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "x" + "width" ], "params": [ - "double x" + "double width" ], - "summary": "Converts screen x coordinate to local camera x coordinate", - "description": "Converts screen x coordinate to local camera x coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "x: screen x coordinate" + "width: width of a space, in unscaled pixels" ], - "returns": "local x coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toLocalX", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setSpaceWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toLocalY(double)", - "memberId": "extensions/camera/Camera/toLocalY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toLocalY", + "id": "drawing/BitmapText/showText(String)", + "memberId": "drawing/BitmapText/showText", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "showText", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "y" + "text" ], "params": [ - "double y" + "String text" ], - "summary": "Converts screen y coordinate to local camera y coordinate", - "description": "Converts screen y coordinate to local camera y coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "y: screen y coordinate" + "text: text to show, including spaces and newlines" ], - "returns": "local y coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toLocalY", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/showText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/clip(double,double,double,double)", - "memberId": "extensions/drawing/Drawing/clip", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/clip(double,double,double,double)", + "memberId": "drawing/Drawing/clip", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "clip", "static": false, @@ -15565,26 +15855,26 @@ "double width", "double height" ], - "summary": "Limits subsequent drawing to a centred rectangle. This replaces the previous\nclip; it is always cleared when the sprite finishes drawing. For a rotated\nsprite, the clip is the screen-aligned bounding box of this rectangle.", - "description": "Limits subsequent drawing to a centred rectangle. This replaces the previous\nclip; it is always cleared when the sprite finishes drawing. For a rotated\nsprite, the clip is the screen-aligned bounding box of this rectangle.", + "summary": "Draws only inside a rectangle until [noClip()](noClip); a turned sprite clips to the rectangle\naround the turned one.", + "description": "Draws only inside a rectangle until [noClip()](noClip); a turned sprite clips to the rectangle\naround the turned one.", "scratchblock": null, "paramDocs": [ - "x: centre x", - "y: centre y", - "width: clip width", - "height: clip height" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/clip", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/clip", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/image(String,double,double)", - "memberId": "extensions/drawing/Drawing/image", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/image(String,double,double)", + "memberId": "drawing/Drawing/image", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "image", "static": false, @@ -15604,25 +15894,25 @@ "double x", "double y" ], - "summary": "Draws an image at its original size. A built-in costume name also works.", - "description": "Draws an image at its original size. A built-in costume name also works.", + "summary": "An image at its own size, centred on a point.", + "description": "An image at its own size, centred on a point.", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume", - "x: centre x", - "y: centre y" + "path: an image file or a built-in sprite name", + "x: x of its centre", + "y: y of its centre" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/image", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/image", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/image(String,double,double,double,double)", - "memberId": "extensions/drawing/Drawing/image", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/image(String,double,double,double,double)", + "memberId": "drawing/Drawing/image", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "image", "static": false, @@ -15648,27 +15938,27 @@ "double width", "double height" ], - "summary": "Draws an image at the requested size, preserving its source in the cache.", - "description": "Draws an image at the requested size, preserving its source in the cache.", + "summary": "An image stretched to a size, centred on a point.", + "description": "An image stretched to a size, centred on a point.", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume", - "x: centre x", - "y: centre y", - "width: drawn width in pixels", - "height: drawn height in pixels" + "path: an image file or a built-in sprite name", + "x: x of its centre", + "y: y of its centre", + "width: the width", + "height: the height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/image", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/image", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/imageHeight(String)", - "memberId": "extensions/drawing/Drawing/imageHeight", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/imageHeight(String)", + "memberId": "drawing/Drawing/imageHeight", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "imageHeight", "static": false, @@ -15686,19 +15976,19 @@ "description": "", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume" + "path: an image file or a built-in sprite name" ], - "returns": "its original height in pixels", + "returns": "its height in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/imageHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/imageHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/imageWidth(String)", - "memberId": "extensions/drawing/Drawing/imageWidth", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/imageWidth(String)", + "memberId": "drawing/Drawing/imageWidth", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "imageWidth", "static": false, @@ -15716,19 +16006,19 @@ "description": "", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume" + "path: an image file or a built-in sprite name" ], - "returns": "its original width in pixels", + "returns": "its width in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/imageWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/imageWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/noClip()", - "memberId": "extensions/drawing/Drawing/noClip", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/noClip()", + "memberId": "drawing/Drawing/noClip", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "noClip", "static": false, @@ -15736,21 +16026,21 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes this sprite's clip.", - "description": "Removes this sprite's clip.", + "summary": "Draws everywhere again.", + "description": "Draws everywhere again.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/noClip", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/noClip", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/polygon(double[],double[],Color)", - "memberId": "extensions/drawing/Drawing/polygon", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/polygon(double[],double[],Color)", + "memberId": "drawing/Drawing/polygon", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "polygon", "static": false, @@ -15770,25 +16060,25 @@ "double[] y", "Color color" ], - "summary": "Draws a filled polygon with at least three points. Concave polygons are\nsupported; crossing outlines are not.", - "description": "Draws a filled polygon with at least three points. Concave polygons are\nsupported; crossing outlines are not.", + "summary": "A filled polygon.", + "description": "A filled polygon.", "scratchblock": null, "paramDocs": [ - "x: x coordinates", - "y: y coordinates (same length as x)", - "color: fill colour" + "x: x of every corner", + "y: y of every corner", + "color: the fill" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/polygon", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/polygon", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/rectangle(double,double,double,double,Color)", - "memberId": "extensions/drawing/Drawing/rectangle", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/rectangle(double,double,double,double,Color)", + "memberId": "drawing/Drawing/rectangle", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "rectangle", "static": false, @@ -15814,113 +16104,149 @@ "double height", "Color color" ], - "summary": "Draws a filled rectangle centred on (x,y).", - "description": "Draws a filled rectangle centred on (x,y).", + "summary": "A filled rectangle centred on a point.", + "description": "A filled rectangle centred on a point.", "scratchblock": null, "paramDocs": [ - "x: centre x", - "y: centre y", - "width: width in pixels", - "height: height in pixels", - "color: fill colour" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height", + "color: the fill" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/rectangle", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/rectangle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/changeTransparency(double)", - "memberId": "extensions/drawing/DrawingSprite/changeTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "changeTransparency", + "id": "drawing/DrawingExtension/constructor()", + "memberId": "drawing/DrawingExtension/constructor", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "constructor", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "step" - ], - "params": [ - "double step" - ], - "summary": "", - "description": "", + "returnType": "DrawingExtension", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Registers the drawing extension; found through ServiceLoader, learners never see it.", + "description": "Registers the drawing extension; found through ServiceLoader, learners never see it.", "scratchblock": null, - "paramDocs": [ - "step: change in percentage points" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/changeTransparency", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/constructor()", - "memberId": "extensions/drawing/DrawingSprite/constructor", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "constructor", + "id": "drawing/DrawingExtension/id()", + "memberId": "drawing/DrawingExtension/id", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "id", "static": false, - "returnType": "DrawingSprite", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a custom drawing sprite.", - "description": "Creates a custom drawing sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/draw(Drawing)", - "memberId": "extensions/drawing/DrawingSprite/draw", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "draw", + "id": "drawing/DrawingExtension/install(ExtensionContext)", + "memberId": "drawing/DrawingExtension/install", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "install", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "org.openpatch.scratch.extension.ExtensionContext" ], "parameterNames": [ - "drawing" + "ctx" ], "params": [ - "Drawing drawing" + "ExtensionContext ctx" ], - "summary": "Draws this frame's appearance. Override this method; use run() for changes\nto game state, since a paused game can still be redrawn.", - "description": "Draws this frame's appearance. Override this method; use run() for changes\nto game state, since a paused game can still be redrawn.", + "summary": "Every layer gets a drawer that lets the stage's visible drawing sprites of that layer draw,\nback to front.", + "description": "Every layer gets a drawer that lets the stage's visible drawing sprites of that layer draw,\nback to front.", "scratchblock": null, "paramDocs": [ - "drawing: this frame's canvas in local Scratch coordinates" + "ctx: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/draw", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/install", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/getTransparency()", - "memberId": "extensions/drawing/DrawingSprite/getTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "getTransparency", + "id": "drawing/DrawingExtension/name()", + "memberId": "drawing/DrawingExtension/name", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "name", "static": false, - "returnType": "double", + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "drawing/DrawingExtension/requires()", + "memberId": "drawing/DrawingExtension/requires", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "requires", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "drawing/DrawingExtension/version()", + "memberId": "drawing/DrawingExtension/version", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "version", + "static": false, + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], @@ -15928,2045 +16254,2383 @@ "description": "", "scratchblock": null, "paramDocs": [], - "returns": "transparency in percent", + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "drawing/DrawingSprite/constructor()", + "memberId": "drawing/DrawingSprite/constructor", + "owner": "org.openpatch.scratch.drawing.DrawingSprite", + "className": "DrawingSprite", + "methodName": "constructor", + "static": false, + "returnType": "DrawingSprite", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A drawing sprite; it has no hitbox unless given one.", + "description": "A drawing sprite; it has no hitbox unless given one.", + "scratchblock": null, + "paramDocs": [], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/getTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingSprite/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/setIsUI(boolean)", - "memberId": "extensions/drawing/DrawingSprite/setIsUI", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "id": "drawing/DrawingSprite/draw(Drawing)", + "memberId": "drawing/DrawingSprite/draw", + "owner": "org.openpatch.scratch.drawing.DrawingSprite", "className": "DrawingSprite", - "methodName": "setIsUI", + "methodName": "draw", "static": false, "returnType": "void", "parameterTypes": [ - "boolean" + "org.openpatch.scratch.drawing.Drawing" ], "parameterNames": [ - "isUI" + "drawing" ], "params": [ - "boolean isUI" + "Drawing drawing" ], - "summary": "Chooses whether the drawing stays fixed on screen as UI.", - "description": "Chooses whether the drawing stays fixed on screen as UI.", + "summary": "Draws the sprite; called every frame on the game thread.", + "description": "Draws the sprite; called every frame on the game thread.", "scratchblock": null, "paramDocs": [ - "isUI: true for UI, false for the game world" + "drawing: what to draw with, in the sprite's own coordinates" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/setIsUI", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingSprite/draw", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/setTransparency(double)", - "memberId": "extensions/drawing/DrawingSprite/setTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "setTransparency", + "id": "extension/Canvas/clip(double,double,double,double)", + "memberId": "extension/Canvas/clip", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "clip", "static": false, "returnType": "void", "parameterTypes": [ + "double", + "double", + "double", "double" ], "parameterNames": [ - "percent" + "x", + "y", + "width", + "height" ], "params": [ - "double percent" + "double x", + "double y", + "double width", + "double height" ], - "summary": "", - "description": "", + "summary": "Draws only inside a rectangle (axis-aligned on the screen) until [noClip()](noClip).", + "description": "Draws only inside a rectangle (axis-aligned on the screen) until [noClip()](noClip).", "scratchblock": null, "paramDocs": [ - "percent: 0 solid, 100 invisible" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/setTransparency", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/fs/File/constructor()", - "memberId": "extensions/fs/File/constructor", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "constructor", - "static": false, - "returnType": "File", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.", - "description": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.\n\nUsage examples:\n\n```java\n// Save an object as JSON\nFile.save(\"/path/to/file.json\", myObject);\n\n// Save an object as XML\nFile.saveXML(\"/path/to/file.xml\", myObject);\n\n// Load an object from JSON\nMyClass obj = File.load(\"/path/to/file.json\", MyClass.class);\n\n// Load an object from XML\nMyClass obj = File.loadXML(\"/path/to/file.xml\", MyClass.class);\n```\n\nNote: The file paths can be absolute or relative. If a relative path is\nprovided, the class\nwill attempt to load the file from the classpath.\n\nSupported file types:\n\n
    \n
  • JSON\n
  • XML\n
", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/clip", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/load(String,Class)", - "memberId": "extensions/fs/File/load", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "load", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawImage(String,double,double,double,double)", + "memberId": "extension/Canvas/drawImage", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawImage", + "static": false, + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.Class" + "double", + "double", + "double", + "double" ], "parameterNames": [ "path", - "cls" + "x", + "y", + "width", + "height" ], "params": [ "String path", - "Class cls" + "double x", + "double y", + "double width", + "double height" ], - "summary": "Loads an object of the specified class from a file at the given path.", - "description": "Loads an object of the specified class from a file at the given path.", + "summary": "An image (a file or a built-in sprite name), centred on a point.", + "description": "An image (a file or a built-in sprite name), centred on a point.", "scratchblock": null, "paramDocs": [ - "path: the path to the file from which the object is to be loaded", - "cls: the class of the object to be loaded" + "path: the image", + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height" ], - "returns": "the loaded object of the specified class", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/load", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawImage", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/loadOrCreate(String,Class)", - "memberId": "extensions/fs/File/loadOrCreate", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "loadOrCreate", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawImageQuad(String,int,int,int,int,double[])", + "memberId": "extension/Canvas/drawImageQuad", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawImageQuad", + "static": false, + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.Class" + "int", + "int", + "int", + "int", + "double[]" ], "parameterNames": [ "path", - "cls" + "sx", + "sy", + "sw", + "sh", + "corners" ], "params": [ "String path", - "Class cls" + "int sx", + "int sy", + "int sw", + "int sh", + "double[] corners" ], - "summary": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", - "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", + "summary": "A region of an image on any quad: turned, mirrored, sheared.", + "description": "A region of an image on any quad: turned, mirrored, sheared.", "scratchblock": null, "paramDocs": [ - "path: the path to the file from which the object is to be loaded", - "cls: the class of the object to be loaded" + "path: the image", + "sx: the region's left edge in image pixels", + "sy: its top edge", + "sw: its width", + "sh: its height", + "corners: where the region's top-left, top-right, bottom-right and bottom-left corners go:\n `x0, y0, \\u2026, x3, y3`" ], - "returns": "the loaded object of the specified class, or a new instance if the\n file does not exist", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/loadOrCreate", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawImageQuad", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/loadXML(String,Class)", - "memberId": "extensions/fs/File/loadXML", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "loadXML", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawImageRegion(String,int,int,int,int,double,double,double,double)", + "memberId": "extension/Canvas/drawImageRegion", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawImageRegion", + "static": false, + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.Class" + "int", + "int", + "int", + "int", + "double", + "double", + "double", + "double" ], "parameterNames": [ "path", - "cls" + "sx", + "sy", + "sw", + "sh", + "x", + "y", + "width", + "height" ], "params": [ "String path", - "Class cls" + "int sx", + "int sy", + "int sw", + "int sh", + "double x", + "double y", + "double width", + "double height" ], - "summary": "Loads an object of the specified class from an XML file at the given path.", - "description": "Loads an object of the specified class from an XML file at the given path.", + "summary": "A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font.", + "description": "A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font.", "scratchblock": null, "paramDocs": [ - "path: the path to the XML file", - "cls: the class of the object to be loaded" + "path: the image", + "sx: the region's left edge in image pixels", + "sy: its top edge", + "sw: its width", + "sh: its height", + "x: x of the centre", + "y: y of the centre", + "width: the width to draw it at", + "height: the height to draw it at" ], - "returns": "the object loaded from the XML file", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/loadXML", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawImageRegion", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/loadXMLOrCreate(String,Class)", - "memberId": "extensions/fs/File/loadXMLOrCreate", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "loadXMLOrCreate", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawOutline(double[],double[],Color,double)", + "memberId": "extension/Canvas/drawOutline", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawOutline", + "static": false, + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.Class" + "double[]", + "double[]", + "org.openpatch.scratch.Color", + "double" ], "parameterNames": [ - "path", - "cls" + "xs", + "ys", + "stroke", + "weight" ], "params": [ - "String path", - "Class cls" + "double[] xs", + "double[] ys", + "Color stroke", + "double weight" ], - "summary": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", - "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", + "summary": "The outline of a polygon.", + "description": "The outline of a polygon.", "scratchblock": null, "paramDocs": [ - "path: the path to the XML file", - "cls: the class of the object to be loaded" + "xs: x of every corner", + "ys: y of every corner", + "stroke: the outline's colour", + "weight: the outline's width" ], - "returns": "the object loaded from the XML file, or a new instance if the file\n does not exist", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/loadXMLOrCreate", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawOutline", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/save(String,T)", - "memberId": "extensions/fs/File/save", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "save", - "static": true, + "id": "extension/Canvas/drawPolygon(double[],double[],Color)", + "memberId": "extension/Canvas/drawPolygon", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawPolygon", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "T" + "double[]", + "double[]", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "path", - "obj" + "xs", + "ys", + "fill" ], "params": [ - "String path", - "T obj" + "double[] xs", + "double[] ys", + "Color fill" ], - "summary": "Saves the given object to the specified path in the default file type (JSON).", - "description": "Saves the given object to the specified path in the default file type (JSON).", + "summary": "A filled polygon, concave ones included.", + "description": "A filled polygon, concave ones included.", "scratchblock": null, "paramDocs": [ - "path: the path where the object should be saved", - "obj: the object to be saved" + "xs: x of every corner", + "ys: y of every corner, in the same order", + "fill: its colour" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/save", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawPolygon", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/saveXML(String,T)", - "memberId": "extensions/fs/File/saveXML", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "saveXML", - "static": true, + "id": "extension/Canvas/drawRectangle(double,double,double,double,Color)", + "memberId": "extension/Canvas/drawRectangle", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawRectangle", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "T" + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "path", - "obj" + "x", + "y", + "width", + "height", + "fill" ], "params": [ - "String path", - "T obj" + "double x", + "double y", + "double width", + "double height", + "Color fill" ], - "summary": "Saves the given object as an XML file at the specified path.", - "description": "Saves the given object as an XML file at the specified path.", + "summary": "A filled rectangle centred on a point.", + "description": "A filled rectangle centred on a point.", "scratchblock": null, "paramDocs": [ - "path: the path where the XML file will be saved", - "obj: the object to be saved as XML" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height", + "fill: its colour" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/saveXML", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawRectangle", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/constructor(String,String,Class)", - "memberId": "extensions/fs/SaveData/constructor", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "constructor", + "id": "extension/Canvas/drawText(String,double,double,double,Color)", + "memberId": "extension/Canvas/drawText", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawText", "static": false, - "returnType": "SaveData", + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "java.lang.Class" + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "gameId", - "slot", - "type" + "text", + "x", + "y", + "size", + "color" ], "params": [ - "String gameId", - "String slot", - "Class type" + "String text", + "double x", + "double y", + "double size", + "Color color" ], - "summary": "Selects a game's save slot without creating a file or opening a database.", - "description": "Selects a game's save slot without creating a file or opening a database.", + "summary": "A line of text whose first baseline starts at a point, in the default font.", + "description": "A line of text whose first baseline starts at a point, in the default font.", "scratchblock": null, "paramDocs": [ - "gameId: a stable identifier, for example org.openpatch.coincatcher", - "slot: a slot name, for example slot1, slot2 or slot3", - "type: the data class to load" + "text: the text", + "x: where it starts", + "y: its baseline", + "size: the font size", + "color: the colour of the letters" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawText", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/getLocation()", - "memberId": "extensions/fs/SaveData/getLocation", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "getLocation", + "id": "extension/Canvas/imageHeight(String)", + "memberId": "extension/Canvas/imageHeight", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "imageHeight", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", - "description": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", + "returnType": "int", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "path" + ], + "params": [ + "String path" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], - "returns": "a description of the save location", + "paramDocs": [ + "path: an image or a built-in sprite name" + ], + "returns": "its height in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/getLocation", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/imageHeight", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/loadOrDefault(Supplier)", - "memberId": "extensions/fs/SaveData/loadOrDefault", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "loadOrDefault", + "id": "extension/Canvas/imageWidth(String)", + "memberId": "extension/Canvas/imageWidth", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "imageWidth", "static": false, - "returnType": "T", + "returnType": "int", "parameterTypes": [ - "java.util.function.Supplier" + "java.lang.String" ], "parameterNames": [ - "defaults" + "path" ], "params": [ - "Supplier defaults" + "String path" ], - "summary": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", - "description": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "defaults: creates initial progress for a missing slot; called only when missing" + "path: an image or a built-in sprite name" ], - "returns": "loaded progress, or the supplied defaults for a missing slot", + "returns": "its width in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/loadOrDefault", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/imageWidth", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/path()", - "memberId": "extensions/fs/SaveData/path", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "path", + "id": "extension/Canvas/noClip()", + "memberId": "extension/Canvas/noClip", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "noClip", "static": false, - "returnType": "Path", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", - "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "summary": "Draws everywhere again.", + "description": "Draws everywhere again.", "scratchblock": null, "paramDocs": [], - "returns": "the desktop file path", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/path", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/noClip", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/save(T)", - "memberId": "extensions/fs/SaveData/save", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "save", + "id": "extension/Canvas/setOpacity(double)", + "memberId": "extension/Canvas/setOpacity", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "setOpacity", "static": false, "returnType": "void", "parameterTypes": [ - "T" + "double" ], "parameterNames": [ - "data" + "opacity" ], "params": [ - "T data" + "double opacity" ], - "summary": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", - "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "data: the progress to save; must not be null" + "opacity: how opaque what follows is drawn, 0 to 1" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/save", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/setOpacity", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/background()", - "memberId": "extensions/pixels/Pixels/background", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "background", + "id": "extension/Extension/coreVersion()", + "memberId": "extension/Extension/coreVersion", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "coreVersion", + "static": true, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "The version of the core library, e.g. `\"7.0.0\"`.", + "description": "The version of the core library, e.g. `\"7.0.0\"`.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/coreVersion", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/Extension/id()", + "memberId": "extension/Extension/id", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "id", "static": false, - "returnType": "int[]", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pixels of the background layer, where the pen and stamps draw.", - "description": "Returns the pixels of the background layer, where the pen and stamps draw.", + "summary": "A short unique id such as `\"tiled\"`, used in messages.", + "description": "A short unique id such as `\"tiled\"`, used in messages.", "scratchblock": null, "paramDocs": [], - "returns": "one colour per pixel", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/background", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/id", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/constructor(PGraphics,PGraphics,PGraphics)", - "memberId": "extensions/pixels/Pixels/constructor", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "constructor", + "id": "extension/Extension/install(ExtensionContext)", + "memberId": "extension/Extension/install", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "install", "static": false, - "returnType": "Pixels", + "returnType": "void", "parameterTypes": [ - "processing.core.PGraphics", - "processing.core.PGraphics", - "processing.core.PGraphics" + "org.openpatch.scratch.extension.ExtensionContext" ], "parameterNames": [ - "mainBuffer", - "backgroundBuffer", - "foregroundBuffer" + "ctx" ], "params": [ - "PGraphics mainBuffer", - "PGraphics backgroundBuffer", - "PGraphics foregroundBuffer" + "ExtensionContext ctx" ], - "summary": "Creates the pixel access for a stage.", - "description": "Creates the pixel access for a stage.", + "summary": "Adds the extension's hooks. Called once, on the window thread, before the first stage.", + "description": "Adds the extension's hooks. Called once, on the window thread, before the first stage.", "scratchblock": null, "paramDocs": [ - "mainBuffer: where the sprites are drawn", - "backgroundBuffer: where the background is drawn", - "foregroundBuffer: where the foreground is drawn" + "ctx: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/install", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/foreground()", - "memberId": "extensions/pixels/Pixels/foreground", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "foreground", + "id": "extension/Extension/name()", + "memberId": "extension/Extension/name", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "name", "static": false, - "returnType": "int[]", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pixels of the foreground layer.", - "description": "Returns the pixels of the foreground layer.", + "summary": "A name for people, such as `\"Tiled maps\"`.", + "description": "A name for people, such as `\"Tiled maps\"`.", "scratchblock": null, "paramDocs": [], - "returns": "one colour per pixel", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/foreground", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/name", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/main()", - "memberId": "extensions/pixels/Pixels/main", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "main", + "id": "extension/Extension/requires()", + "memberId": "extension/Extension/requires", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "requires", "static": false, - "returnType": "int[]", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pixels of the layer the sprites are drawn on.", - "description": "Returns the pixels of the layer the sprites are drawn on.", + "summary": "The core versions this extension works with: `\"7\"` means any 7.x, `\"7.1\"` 7.1\nor newer, `\"7.1.2\"` 7.1.2 or newer, always below the next major version.", + "description": "The core versions this extension works with: `\"7\"` means any 7.x, `\"7.1\"` 7.1\nor newer, `\"7.1.2\"` 7.1.2 or newer, always below the next major version.", "scratchblock": null, "paramDocs": [], - "returns": "one colour per pixel", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/main", - "availability": "desktop-only", - "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "translations": {} - }, - { - "id": "extensions/recorder/FFmpegRecorder/constructor(String)", - "memberId": "extensions/recorder/FFmpegRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "className": "FFmpegRecorder", - "methodName": "constructor", - "static": false, - "returnType": "FFmpegRecorder", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "path" - ], - "params": [ - "String path" - ], - "summary": "Constructs an FFmpegRecorder object with the specified path.", - "description": "Constructs an FFmpegRecorder object with the specified path.", - "scratchblock": null, - "paramDocs": [ - "path: the path where the recording will be saved\n \n\nThis constructor initializes the FFmpegRecorder by creating a temporary directory and\n setting up a pattern for temporary PNG files. If the temporary directory cannot be created,\n an error message is printed to the console." - ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FFmpegRecorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/requires", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FFmpegRecorder/saveFrame()", - "memberId": "extensions/recorder/FFmpegRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "className": "FFmpegRecorder", - "methodName": "saveFrame", + "id": "extension/Extension/version()", + "memberId": "extension/Extension/version", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "version", "static": false, - "returnType": "void", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Saves the current frame using the specified pattern.", - "description": "Saves the current frame using the specified pattern.", + "summary": "The extension's own version.", + "description": "The extension's own version.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FFmpegRecorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/version", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FFmpegRecorder/stop()", - "memberId": "extensions/recorder/FFmpegRecorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "className": "FFmpegRecorder", - "methodName": "stop", + "id": "extension/ExtensionContext/addLayerDrawer(Layer,LayerDrawer)", + "memberId": "extension/ExtensionContext/addLayerDrawer", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "addLayerDrawer", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the recording process and converts the recorded frames into a video file using FFmpeg.", - "description": "Stops the recording process and converts the recorded frames into a video file using FFmpeg.\n\nThis method overrides the `stop` method from the superclass. It first calls the superclass's\n`stop` method, then checks if the temporary directory (`tmpDir`) is not null. If it is not\nnull, it constructs a command to run FFmpeg, which converts the recorded frames (stored as PNG\nfiles) into a video file with the specified frame rate and codec.\n\nThe FFmpeg command is executed, and a message is printed to the console indicating that the\nvideo conversion is in progress. If there is an error during the execution of the command, the\nerror message is printed to the console.", + "parameterTypes": [ + "org.openpatch.scratch.Layer", + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" + ], + "parameterNames": [ + "layer", + "drawer" + ], + "params": [ + "Layer layer", + "LayerDrawer drawer" + ], + "summary": "Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles,\ndrawings. Game thread, when the draw list is made.", + "description": "Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles,\ndrawings. Game thread, when the draw list is made.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "layer: ", + "drawer: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FFmpegRecorder/stop", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/addLayerDrawer", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FrameRecorder/constructor(String)", - "memberId": "extensions/recorder/FrameRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "className": "FrameRecorder", - "methodName": "constructor", + "id": "extension/ExtensionContext/addOverlayDrawer(LayerDrawer)", + "memberId": "extension/ExtensionContext/addOverlayDrawer", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "addOverlayDrawer", "static": false, - "returnType": "FrameRecorder", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], "parameterNames": [ - "outputFolder" + "drawer" ], "params": [ - "String outputFolder" + "LayerDrawer drawer" ], - "summary": "Constructs a new FrameRecorder with the specified output folder.", - "description": "Constructs a new FrameRecorder with the specified output folder.", + "summary": "Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave\nit out (Studio's watch pins). Game thread.", + "description": "Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave\nit out (Studio's watch pins). Game thread.", "scratchblock": null, "paramDocs": [ - "outputFolder: the folder where the recorded frames will be saved" + "drawer: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FrameRecorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/addOverlayDrawer", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FrameRecorder/saveFrame()", - "memberId": "extensions/recorder/FrameRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "className": "FrameRecorder", - "methodName": "saveFrame", + "id": "extension/ExtensionContext/afterFrame(BiConsumer)", + "memberId": "extension/ExtensionContext/afterFrame", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "afterFrame", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Saves the current frame of the stage to the specified output folder. The frame is saved as a\nPNG file with a filename pattern \"#######.png\". The exact filename will be generated based on\nthe current frame number. The picture is the stage at its own size, also when the window is\nbigger.", - "description": "Saves the current frame of the stage to the specified output folder. The frame is saved as a\nPNG file with a filename pattern \"#######.png\". The exact filename will be generated based on\nthe current frame number. The picture is the stage at its own size, also when the window is\nbigger.", + "parameterTypes": [ + "java.util.function.BiConsumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "BiConsumer hook" + ], + "summary": "After a frame was drawn, on the window thread.", + "description": "After a frame was drawn, on the window thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FrameRecorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/afterFrame", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FrameRecorder/snapshot(String)", - "memberId": "extensions/recorder/FrameRecorder/snapshot", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "className": "FrameRecorder", - "methodName": "snapshot", + "id": "extension/ExtensionContext/beforeTick(Consumer)", + "memberId": "extension/ExtensionContext/beforeTick", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "beforeTick", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.util.function.Consumer" ], "parameterNames": [ - "filename" + "hook" ], "params": [ - "String filename" + "Consumer hook" ], - "summary": "Takes a snapshot of the current frame and saves it to the specified filename.", - "description": "Takes a snapshot of the current frame and saves it to the specified filename.", + "summary": "Every tick, after the tick's input and before timers and `run()`. Game thread.", + "description": "Every tick, after the tick's input and before timers and `run()`. Game thread.", "scratchblock": null, "paramDocs": [ - "filename: the name of the file to save the snapshot to" + "hook: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FrameRecorder/snapshot", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/beforeTick", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/constructor(String)", - "memberId": "extensions/recorder/GifRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "constructor", + "id": "extension/ExtensionContext/dispatch(Stage,Class,Consumer)", + "memberId": "extension/ExtensionContext/dispatch", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "dispatch", "static": false, - "returnType": "GifRecorder", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Stage", + "java.lang.Class", + "java.util.function.Consumer" ], "parameterNames": [ - "filePath" + "stage", + "listener", + "call" ], "params": [ - "String filePath" + "Stage stage", + "Class listener", + "Consumer call" ], - "summary": "Constructs a new GifRecorder object.", - "description": "Constructs a new GifRecorder object.", + "summary": "Calls a listener interface on the stage and every sprite of it that implements it, at the\npoint of the tick where key events arrive. Learner exceptions thrown there stop the game like\nany learner exception. Game thread.", + "description": "Calls a listener interface on the stage and every sprite of it that implements it, at the\npoint of the tick where key events arrive. Learner exceptions thrown there stop the game like\nany learner exception. Game thread.", "scratchblock": null, "paramDocs": [ - "filePath: the path where the GIF file will be saved" + "stage: ", + "listener: ", + "call: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/dispatch", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/saveFrame()", - "memberId": "extensions/recorder/GifRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "saveFrame", + "id": "extension/ExtensionContext/getTickCount()", + "memberId": "extension/ExtensionContext/getTickCount", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "getTickCount", "static": false, - "returnType": "void", + "returnType": "long", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Saves the current frame of the stage as a GIF image.", - "description": "Saves the current frame of the stage as a GIF image.\n\nThis method captures the stage at its own size, sets the frame rate, and adds the frame to\nthe GIF encoder. A window that is bigger than the stage (maximized, say) records the stage\nwithout the bars around it, and the frames keep their size when the window changes during the\nrecording.\n\nNote: This method catches and ignores any NullPointerException that may occur.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], + "returns": "ticks run so far", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/getTickCount", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/ExtensionContext/input(InputKey)", + "memberId": "extension/ExtensionContext/input", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "input", + "static": false, + "returnType": "T", + "parameterTypes": [ + "org.openpatch.scratch.extension.ExtensionContext.InputKey" + ], + "parameterNames": [ + "key" + ], + "params": [ + "InputKey key" + ], + "summary": "This batch's copy of a slot of the input snapshot. Game thread.", + "description": "This batch's copy of a slot of the input snapshot. Game thread.", + "scratchblock": null, + "paramDocs": [ + "key: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/input", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/snapshot()", - "memberId": "extensions/recorder/GifRecorder/snapshot", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "snapshot", + "id": "extension/ExtensionContext/isLoading()", + "memberId": "extension/ExtensionContext/isLoading", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "isLoading", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the\ncurrent frame, and then finishes the encoding process.", - "description": "Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the\ncurrent frame, and then finishes the encoding process.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether the loading screen is up", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/snapshot", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/isLoading", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/start()", - "memberId": "extensions/recorder/GifRecorder/start", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "start", + "id": "extension/ExtensionContext/onExit(Runnable)", + "memberId": "extension/ExtensionContext/onExit", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onExit", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Starts the GIF recording process.", - "description": "Starts the GIF recording process.", + "parameterTypes": [ + "java.lang.Runnable" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Runnable hook" + ], + "summary": "At the end of the program, after `whenExits()`. Game thread.", + "description": "At the end of the program, after `whenExits()`. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/start", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onExit", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/stop()", - "memberId": "extensions/recorder/GifRecorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "stop", + "id": "extension/ExtensionContext/onInputPoll(Consumer)", + "memberId": "extension/ExtensionContext/onInputPoll", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onInputPoll", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the GIF recording process and finalizes the GIF file.", - "description": "Stops the GIF recording process and finalizes the GIF file.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into\nthe snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed.", + "description": "Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into\nthe snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/stop", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onInputPoll", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/constructor(String,String)", - "memberId": "extensions/recorder/Recorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "constructor", + "id": "extension/ExtensionContext/onKey(Consumer)", + "memberId": "extension/ExtensionContext/onKey", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onKey", "static": false, - "returnType": "Recorder", + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "java.util.function.Consumer" ], "parameterNames": [ - "path", - "ext" + "hook" ], "params": [ - "String path", - "String ext" + "Consumer hook" ], - "summary": "Constructs a new Recorder object with the specified file path and extension. If the provided\npath does not end with the specified extension, the extension is appended to the path.", - "description": "Constructs a new Recorder object with the specified file path and extension. If the provided\npath does not end with the specified extension, the extension is appended to the path.", + "summary": "Every key press and release, before learner code sees it; observe only. Game thread.", + "description": "Every key press and release, before learner code sees it; observe only. Game thread.", "scratchblock": null, "paramDocs": [ - "path: the file path where the recording will be saved", - "ext: the file extension to be used for the recording" + "hook: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onKey", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/post()", - "memberId": "extensions/recorder/Recorder/post", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "post", + "id": "extension/ExtensionContext/onLearnerError(Consumer)", + "memberId": "extension/ExtensionContext/onLearnerError", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onLearnerError", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Called after each frame is drawn. This method is registered with the Applet class to ensure\nthat frames are saved at the appropriate time during the recording process.", - "description": "Called after each frame is drawn. This method is registered with the Applet class to ensure\nthat frames are saved at the appropriate time during the recording process.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "A learner exception stopped the game. Game thread.", + "description": "A learner exception stopped the game. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/post", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onLearnerError", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/saveFrame()", - "memberId": "extensions/recorder/Recorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "saveFrame", + "id": "extension/ExtensionContext/onMouse(Consumer)", + "memberId": "extension/ExtensionContext/onMouse", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onMouse", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Saves the current frame. This method should be implemented by subclasses to define the specific\nbehavior for saving a frame.", - "description": "Saves the current frame. This method should be implemented by subclasses to define the specific\nbehavior for saving a frame.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "Every mouse event, before learner code sees it; observe only. Game thread.", + "description": "Every mouse event, before learner code sees it; observe only. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onMouse", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/start()", - "memberId": "extensions/recorder/Recorder/start", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "start", + "id": "extension/ExtensionContext/onStageCreated(Consumer)", + "memberId": "extension/ExtensionContext/onStageCreated", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onStageCreated", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Starts the recording process.", - "description": "Starts the recording process.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "A stage was made (on the thread that made it, usually the game thread or main).", + "description": "A stage was made (on the thread that made it, usually the game thread or main).", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/start", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onStageCreated", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/stop()", - "memberId": "extensions/recorder/Recorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "stop", + "id": "extension/ExtensionContext/onStageDisposed(Consumer)", + "memberId": "extension/ExtensionContext/onStageDisposed", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onStageDisposed", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the recording process.", - "description": "Stops the recording process.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "A stage stopped being shown. Game thread.", + "description": "A stage stopped being shown. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/stop", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onStageDisposed", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/constructor(String,String,String)", - "memberId": "extensions/shader/Shader/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "constructor", + "id": "extension/ExtensionContext/registerImageFormat(String,ImageDecoder)", + "memberId": "extension/ExtensionContext/registerImageFormat", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "registerImageFormat", "static": false, - "returnType": "Shader", + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder" ], "parameterNames": [ - "name", - "fragmentShaderPath", - "vertexShaderPath" + "suffix", + "decoder" ], "params": [ - "String name", - "String fragmentShaderPath", - "String vertexShaderPath" + "String suffix", + "ImageDecoder decoder" ], - "summary": "Constructor", - "description": "Constructor", + "summary": "Images whose name ends in `suffix` (e.g. `\".ase\"`) are decoded by\n`decoder`.", + "description": "Images whose name ends in `suffix` (e.g. `\".ase\"`) are decoded by\n`decoder`.", "scratchblock": null, "paramDocs": [ - "name: unique name", - "fragmentShaderPath: path to the fragment shader file", - "vertexShaderPath: path to the vertex shader file, or null for Processing's default one" + "suffix: ", + "decoder: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/registerImageFormat", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/constructor(Shader)", - "memberId": "extensions/shader/Shader/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "constructor", + "id": "extension/ExtensionContext/runOnGameThread(Runnable)", + "memberId": "extension/ExtensionContext/runOnGameThread", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "runOnGameThread", "static": false, - "returnType": "Shader", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.shader.Shader" + "java.lang.Runnable" ], "parameterNames": [ - "shader" + "task" ], "params": [ - "Shader shader" + "Runnable task" ], - "summary": "Copy constructor", - "description": "Copy constructor", + "summary": "Runs a task at the start of the next tick, before input.", + "description": "Runs a task at the start of the next tick, before input.", "scratchblock": null, "paramDocs": [ - "shader: shader" + "task: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/runOnGameThread", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/getName()", - "memberId": "extensions/shader/Shader/getName", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "getName", + "id": "extension/Frame/getArgb()", + "memberId": "extension/Frame/getArgb", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "getArgb", "static": false, - "returnType": "String", + "returnType": "int[]", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the name", - "description": "Returns the name", + "summary": "Straight ARGB, top row first.", + "description": "Straight ARGB, top row first.", "scratchblock": null, "paramDocs": [], - "returns": "the name", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/getName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/getArgb", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/getPShader()", - "memberId": "extensions/shader/Shader/getPShader", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "getPShader", + "id": "extension/Frame/getHeight()", + "memberId": "extension/Frame/getHeight", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "getHeight", "static": false, - "returnType": "PShader", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the shader", - "description": "Returns the shader", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the shader", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/getPShader", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/getHeight", "availability": "desktop-only", - "availabilityReason": "Processing's PShader object belongs to the desktop renderer. The browser uses WebGL filters.", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/Frame/getWidth()", + "memberId": "extension/Frame/getWidth", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "getWidth", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/getWidth", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/Frame/savePng(Path)", + "memberId": "extension/Frame/savePng", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "savePng", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "java.nio.file.Path" ], "parameterNames": [ - "name", - "x" + "file" ], "params": [ - "String name", - "int x" + "Path file" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the uniform in the shader file", - "x: the value" + "file: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/savePng", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,boolean)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/ImageDecoder/decode(byte[])", + "memberId": "extension/ImageDecoder/decode", + "owner": "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder", + "className": "ImageDecoder", + "methodName": "decode", "static": false, - "returnType": "void", + "returnType": "DecodedImage", "parameterTypes": [ - "java.lang.String", - "boolean" + "byte[]" ], "parameterNames": [ - "name", - "x" + "file" ], "params": [ - "String name", - "boolean x" + "byte[] file" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: " + "file: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ImageDecoder/decode", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,double)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/InputKey/copy(T,T)", + "memberId": "extension/InputKey/copy", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "copy", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double" + "T", + "T" ], "parameterNames": [ - "name", - "x" + "from", + "into" ], "params": [ - "String name", - "double x" + "T from", + "T into" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "For the core: copies one state into another.", + "description": "For the core: copies one state into another.", "scratchblock": null, "paramDocs": [ - "name: ", - "x: " + "from: ", + "into: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/copy", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,int,int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/InputKey/create()", + "memberId": "extension/InputKey/create", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "create", "static": false, - "returnType": "void", + "returnType": "T", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "For the core: makes a state for this key.", + "description": "For the core: makes a state for this key.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/create", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/InputKey/of(String,Supplier,BiConsumer)", + "memberId": "extension/InputKey/of", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "of", + "static": true, + "returnType": "InputKey", "parameterTypes": [ "java.lang.String", - "int", - "int" + "java.util.function.Supplier", + "java.util.function.BiConsumer" ], "parameterNames": [ "name", - "x", - "y" + "factory", + "copy" ], "params": [ "String name", - "int x", - "int y" + "Supplier factory", + "BiConsumer copy" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: ", - "y: " + "name: for messages", + "factory: makes an empty state (twice: one per thread)", + "copy: copies the window thread's state into the game thread's: (from, into)" ], + "returns": "the key", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/of", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/InputKey/toString()", + "memberId": "extension/InputKey/toString", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "toString", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/toString", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,boolean,boolean)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/InputSnapshot/get(InputKey)", + "memberId": "extension/InputSnapshot/get", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputSnapshot", + "className": "InputSnapshot", + "methodName": "get", "static": false, - "returnType": "void", + "returnType": "T", "parameterTypes": [ - "java.lang.String", - "boolean", - "boolean" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], "parameterNames": [ - "name", - "x", - "y" + "key" ], "params": [ - "String name", - "boolean x", - "boolean y" + "InputKey key" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: ", - "y: " + "key: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputSnapshot/get", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,double,double)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/LayerDrawer/draw(Stage,Canvas)", + "memberId": "extension/LayerDrawer/draw", + "owner": "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer", + "className": "LayerDrawer", + "methodName": "draw", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double", - "double" + "org.openpatch.scratch.Stage", + "org.openpatch.scratch.extension.Canvas" ], "parameterNames": [ - "name", - "x", - "y" + "stage", + "canvas" ], "params": [ - "String name", - "double x", - "double y" + "Stage stage", + "Canvas canvas" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: ", - "y: " + "stage: ", + "canvas: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/LayerDrawer/draw", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,Vector2)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getStick(GamepadStick)", + "memberId": "gamepad/Gamepad/getStick", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getStick", + "static": true, + "returnType": "Vector2", "parameterTypes": [ - "java.lang.String", - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.gamepad.GamepadStick" ], "parameterNames": [ - "name", - "vec" + "stick" ], "params": [ - "String name", - "Vector2 vec" + "GamepadStick stick" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "Where the first connected controller's stick points, (0, 0) if there is none.", + "description": "Where the first connected controller's stick points, (0, 0) if there is none.", "scratchblock": null, "paramDocs": [ - "name: ", - "vec: " + "stick: the stick to ask about" ], - "returns": null, + "returns": "its position, x \\u22121 to 1 and y \\u22121 to 1 (up is positive)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getStick", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,int[],int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getStick(int,GamepadStick)", + "memberId": "gamepad/Gamepad/getStick", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getStick", + "static": true, + "returnType": "Vector2", "parameterTypes": [ - "java.lang.String", - "int[]", - "int" + "int", + "org.openpatch.scratch.gamepad.GamepadStick" ], "parameterNames": [ - "name", - "values", - "ncoords" + "player", + "stick" ], "params": [ - "String name", - "int[] values", - "int ncoords" + "int player", + "GamepadStick stick" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "Where the player's controller's stick points, (0, 0) if it is not connected.", + "description": "Where the player's controller's stick points, (0, 0) if it is not connected.", "scratchblock": null, "paramDocs": [ - "name: ", - "values: ", - "ncoords: " + "player: the player, 1 to 4", + "stick: the stick to ask about" ], - "returns": null, + "returns": "its position, x \\u22121 to 1 and y \\u22121 to 1 (up is positive)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getStick", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,double[],int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getTrigger(GamepadTrigger)", + "memberId": "gamepad/Gamepad/getTrigger", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getTrigger", + "static": true, + "returnType": "double", "parameterTypes": [ - "java.lang.String", - "double[]", - "int" + "org.openpatch.scratch.gamepad.GamepadTrigger" ], "parameterNames": [ - "name", - "values", - "ncoords" + "trigger" ], "params": [ - "String name", - "double[] values", - "int ncoords" + "GamepadTrigger trigger" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "How far down the first connected controller's trigger is, 0 if there is none.", + "description": "How far down the first connected controller's trigger is, 0 if there is none.", "scratchblock": null, "paramDocs": [ - "name: ", - "values: ", - "ncoords: " + "trigger: the trigger to ask about" ], - "returns": null, + "returns": "how far it is pressed, 0 (not at all) to 1 (fully)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getTrigger", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,Color)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getTrigger(int,GamepadTrigger)", + "memberId": "gamepad/Gamepad/getTrigger", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getTrigger", + "static": true, + "returnType": "double", "parameterTypes": [ - "java.lang.String", - "org.openpatch.scratch.Color" + "int", + "org.openpatch.scratch.gamepad.GamepadTrigger" ], "parameterNames": [ - "name", - "c" + "player", + "trigger" ], "params": [ - "String name", - "Color c" + "int player", + "GamepadTrigger trigger" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "How far down the player's controller's trigger is, 0 if it is not connected.", + "description": "How far down the player's controller's trigger is, 0 if it is not connected.", "scratchblock": null, "paramDocs": [ - "name: ", - "c: " + "player: the player, 1 to 4", + "trigger: the trigger to ask about" ], - "returns": null, + "returns": "how far it is pressed, 0 (not at all) to 1 (fully)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getTrigger", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/setName(String)", - "memberId": "extensions/shader/Shader/setName", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "setName", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/isButtonPressed(GamepadButton)", + "memberId": "gamepad/Gamepad/isButtonPressed", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isButtonPressed", + "static": true, + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "name" + "button" ], "params": [ - "String name" + "GamepadButton button" ], - "summary": "Sets the name", - "description": "Sets the name", + "summary": "Whether any controller has the button down.", + "description": "Whether any controller has the button down.", "scratchblock": null, "paramDocs": [ - "name: unique name" + "button: the button to ask about" ], - "returns": null, + "returns": "whether it is down on any connected controller", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/setName", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isButtonPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/activate(String)", - "memberId": "extensions/shader/Shaders/activate", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "activate", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/isButtonPressed(int,GamepadButton)", + "memberId": "gamepad/Gamepad/isButtonPressed", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isButtonPressed", + "static": true, + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "int", + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "name" + "player", + "button" ], "params": [ - "String name" + "int player", + "GamepadButton button" ], - "summary": "Draws with the shader of the given name as well, without stopping the\nothers. Active shaders take turns in the order they were added, each\nworking on what the one before it drew, so a stage can be tinted and\nwobble at the same time. A sprite draws with the first of its active\nshaders only.", - "description": "Draws with the shader of the given name as well, without stopping the\nothers. Active shaders take turns in the order they were added, each\nworking on what the one before it drew, so a stage can be tinted and\nwobble at the same time. A sprite draws with the first of its active\nshaders only.", + "summary": "Whether the player's controller has the button down.", + "description": "Whether the player's controller has the button down.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "player: the player, 1 to 4", + "button: the button to ask about" ], + "returns": "whether it is down on that player's controller", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isButtonPressed", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "gamepad/Gamepad/isConnected()", + "memberId": "gamepad/Gamepad/isConnected", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isConnected", + "static": true, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Whether any controller is connected.", + "description": "Whether any controller is connected.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/activate", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isConnected", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/add(String,String,String)", - "memberId": "extensions/shader/Shaders/add", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "add", - "static": false, - "returnType": "Shader", + "id": "gamepad/Gamepad/isConnected(int)", + "memberId": "gamepad/Gamepad/isConnected", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isConnected", + "static": true, + "returnType": "boolean", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "java.lang.String" + "int" ], "parameterNames": [ - "name", - "fragmentShaderPath", - "vertexShaderPath" + "player" ], "params": [ - "String name", - "String fragmentShaderPath", - "String vertexShaderPath" + "int player" ], - "summary": "Adds a shader. If a shader with the given name already exists, that one is\nreturned instead.", - "description": "Adds a shader. If a shader with the given name already exists, that one is\nreturned instead.\n\nThe first shader added is drawn with right away; the ones after it wait\nuntil [switchTo(String)](switchTo), [next()](next) or\n[activate(String)](activate) picks them.\n\nThe vertex shader is usually `null`, which uses Processing's default\none. In the browser any other vertex shader is ignored.", + "summary": "Whether a controller sits in the player's slot.", + "description": "Whether a controller sits in the player's slot.", "scratchblock": null, "paramDocs": [ - "name: a unique name", - "fragmentShaderPath: the path to the fragment shader", - "vertexShaderPath: the path to the vertex shader, may be null" + "player: the player, 1 to 4" ], - "returns": "the shader", + "returns": "whether that slot has a controller", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isConnected", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/constructor(String)", - "memberId": "extensions/shader/Shaders/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "constructor", + "id": "gamepad/GamepadListener/whenGamepadButtonPressed(GamepadButton)", + "memberId": "gamepad/GamepadListener/whenGamepadButtonPressed", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "className": "GamepadListener", + "methodName": "whenGamepadButtonPressed", "static": false, - "returnType": "Shaders", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "owner" + "button" ], "params": [ - "String owner" + "GamepadButton button" ], - "summary": "Creates an empty set of shaders.", - "description": "Creates an empty set of shaders.", + "summary": "A button went down on one of the controllers.", + "description": "A button went down on one of the controllers.", "scratchblock": null, "paramDocs": [ - "owner: what the shaders belong to, used in error messages: \"sprite\" or\n \"stage\"" + "button: the button that was pressed" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/GamepadListener/whenGamepadButtonPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/constructor(Shaders)", - "memberId": "extensions/shader/Shaders/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "constructor", + "id": "gamepad/GamepadListener/whenGamepadButtonReleased(GamepadButton)", + "memberId": "gamepad/GamepadListener/whenGamepadButtonReleased", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "className": "GamepadListener", + "methodName": "whenGamepadButtonReleased", "static": false, - "returnType": "Shaders", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.shader.Shaders" + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "s" + "button" ], "params": [ - "Shaders s" + "GamepadButton button" ], - "summary": "Copies a set of shaders.", - "description": "Copies a set of shaders.", + "summary": "A button came up on one of the controllers.", + "description": "A button came up on one of the controllers.", "scratchblock": null, "paramDocs": [ - "s: the shaders to copy" + "button: the button that was released" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/GamepadListener/whenGamepadButtonReleased", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/deactivate(String)", - "memberId": "extensions/shader/Shaders/deactivate", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "deactivate", + "id": "gamepad/GamepadListener/whenGamepadConnected(int)", + "memberId": "gamepad/GamepadListener/whenGamepadConnected", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "className": "GamepadListener", + "methodName": "whenGamepadConnected", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "player" ], "params": [ - "String name" + "int player" ], - "summary": "Stops drawing with the shader of the given name. The other active shaders\nstay.", - "description": "Stops drawing with the shader of the given name. The other active shaders\nstay.", + "summary": "A controller appeared in a player's slot.", + "description": "A controller appeared in a player's slot.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "player: the player whose slot got a controller, 1 to 4" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/deactivate", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/GamepadListener/whenGamepadConnected", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/get(String)", - "memberId": "extensions/shader/Shaders/get", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "get", + "id": "recorder/GifEncoder/addFrame(int[],int,int)", + "memberId": "recorder/GifEncoder/addFrame", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "addFrame", "static": false, - "returnType": "Shader", + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "int[]", + "int", + "int" ], "parameterNames": [ - "name" + "argb", + "width", + "height" ], "params": [ - "String name" + "int[] argb", + "int width", + "int height" ], - "summary": "Returns a shader by name.", - "description": "Returns a shader by name.", + "summary": "Adds next GIF frame as an ARGB pixel array, top row first (0xAARRGGBB). The alpha channel is\nignored. The frame is not written immediately, but is actually deferred until the next frame\nis received so that timing data can be inserted. Invoking finish() flushes all\nframes. The size of the first frame is used for all subsequent frames; frames of another size\nare scaled with nearest-neighbour sampling.", + "description": "Adds next GIF frame as an ARGB pixel array, top row first (0xAARRGGBB). The alpha channel is\nignored. The frame is not written immediately, but is actually deferred until the next frame\nis received so that timing data can be inserted. Invoking finish() flushes all\nframes. The size of the first frame is used for all subsequent frames; frames of another size\nare scaled with nearest-neighbour sampling.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "argb: int array containing the frame's pixels, top row first.", + "width: int frame width.", + "height: int frame height." ], - "returns": "the shader, or null if there is none with that name", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/get", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/shader/Shaders/getActive()", - "memberId": "extensions/shader/Shaders/getActive", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getActive", - "static": false, - "returnType": "List", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shaders drawn with, in the order they take turns: the order in\nwhich they were added.", - "description": "Returns the shaders drawn with, in the order they take turns: the order in\nwhich they were added.", - "scratchblock": null, - "paramDocs": [], - "returns": "a new list of the active shaders, empty if there are none", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getActive", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/shader/Shaders/getCurrent()", - "memberId": "extensions/shader/Shaders/getCurrent", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getCurrent", - "static": false, - "returnType": "Shader", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shader currently drawn with. With several active, this is the\nfirst of them.", - "description": "Returns the shader currently drawn with. With several active, this is the\nfirst of them.", - "scratchblock": null, - "paramDocs": [], - "returns": "the current shader, or null if there is none", + "returns": "true if successful.", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getCurrent", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/addFrame", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/getCurrentIndex()", - "memberId": "extensions/shader/Shaders/getCurrentIndex", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getCurrentIndex", + "id": "recorder/GifEncoder/constructor()", + "memberId": "recorder/GifEncoder/constructor", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "constructor", "static": false, - "returnType": "int", + "returnType": "GifEncoder", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the position of the current shader.", - "description": "Returns the position of the current shader.", + "summary": "Encodes a GIF file consisting of one or more frames.", + "description": "Encodes a GIF file consisting of one or more frames.\n\n
\n Example:\n    GifEncoder e = new GifEncoder();\n    e.start(outputFileName);\n    e.setDelay(1000);   // 1 frame per sec\n    e.addFrame(argbPixels, width, height);\n    e.finish();\n
\n\nPorted from AnimatedGifEncoder (Kevin Weiner, FM Software, November 2003), with the LZW encoder\nadapted from Jef Poskanzer's Java port by way of J. M. G. Elliott, and the NeuQuant neural-net\nquantizer by Anthony Dekker, 1994. Uses only java.base: frames arrive as ARGB int arrays\ninstead of BufferedImages.", "scratchblock": null, "paramDocs": [], - "returns": "the position, or -1 if no shader is in use", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getCurrentIndex", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/constructor", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/getCurrentName()", - "memberId": "extensions/shader/Shaders/getCurrentName", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getCurrentName", + "id": "recorder/GifEncoder/finish()", + "memberId": "recorder/GifEncoder/finish", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "finish", "static": false, - "returnType": "String", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the name of the current shader.", - "description": "Returns the name of the current shader.", + "summary": "Flushes any pending data and closes output file. If writing to an OutputStream, the stream is\nnot closed.", + "description": "Flushes any pending data and closes output file. If writing to an OutputStream, the stream is\nnot closed.", "scratchblock": null, "paramDocs": [], - "returns": "the name, or null if no shader is in use", + "returns": "true if finished", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getCurrentName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/finish", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/isActive(String)", - "memberId": "extensions/shader/Shaders/isActive", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "isActive", + "id": "recorder/GifEncoder/setDelay(int)", + "memberId": "recorder/GifEncoder/setDelay", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setDelay", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "ms" ], "params": [ - "String name" + "int ms" ], - "summary": "Returns whether the shader of the given name is drawn with.", - "description": "Returns whether the shader of the given name is drawn with.", + "summary": "Sets the delay time between each frame, or changes it for subsequent frames (applies to last\nframe added).", + "description": "Sets the delay time between each frame, or changes it for subsequent frames (applies to last\nframe added).", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "ms: int delay time in milliseconds" ], - "returns": "true if the shader is active", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/isActive", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setDelay", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/next()", - "memberId": "extensions/shader/Shaders/next", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "next", + "id": "recorder/GifEncoder/setDispose(int)", + "memberId": "recorder/GifEncoder/setDispose", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setDispose", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Switches to the next shader, in the order they were added. After the last\none comes the first one again. It is then the only one drawn with.", - "description": "Switches to the next shader, in the order they were added. After the last\none comes the first one again. It is then the only one drawn with.", + "parameterTypes": [ + "int" + ], + "parameterNames": [ + "code" + ], + "params": [ + "int code" + ], + "summary": "Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default\nis 0 if no transparent color has been set, otherwise 2.", + "description": "Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default\nis 0 if no transparent color has been set, otherwise 2.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "code: int disposal code." + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/next", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setDispose", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/reset()", - "memberId": "extensions/shader/Shaders/reset", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "reset", + "id": "recorder/GifEncoder/setFrameRate(float)", + "memberId": "recorder/GifEncoder/setFrameRate", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setFrameRate", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops drawing with shaders, so the sprite or stage looks as it does\nwithout one. The shaders are kept: [switchTo(String)](switchTo),\n[next()](next) or [activate(String)](activate) brings one back.", - "description": "Stops drawing with shaders, so the sprite or stage looks as it does\nwithout one. The shaders are kept: [switchTo(String)](switchTo),\n[next()](next) or [activate(String)](activate) brings one back.", + "parameterTypes": [ + "float" + ], + "parameterNames": [ + "fps" + ], + "params": [ + "float fps" + ], + "summary": "Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).", + "description": "Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "fps: float frame rate (frames per second)" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/reset", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setFrameRate", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/switchTo(String)", - "memberId": "extensions/shader/Shaders/switchTo", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "switchTo", + "id": "recorder/GifEncoder/setQuality(int)", + "memberId": "recorder/GifEncoder/setQuality", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setQuality", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "quality" ], "params": [ - "String name" + "int quality" ], - "summary": "Switches to the shader with the given name, or with the given position in\nthe order the shaders were added. It is then the only one drawn with. A\nname that is not there leaves the shaders as they are and prints which ones\nthere are.", - "description": "Switches to the shader with the given name, or with the given position in\nthe order the shaders were added. It is then the only one drawn with. A\nname that is not there leaves the shaders as they are and prints which ones\nthere are.", + "summary": "Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by\nthe GIF specification). Lower values (minimum = 1) produce better colors, but slow processing\nsignificantly. 10 is the default, and produces good color mapping at reasonable speeds. Values\ngreater than 20 do not yield significant improvements in speed.", + "description": "Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by\nthe GIF specification). Lower values (minimum = 1) produce better colors, but slow processing\nsignificantly. 10 is the default, and produces good color mapping at reasonable speeds. Values\ngreater than 20 do not yield significant improvements in speed.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "quality: int greater than 0." ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/switchTo", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setQuality", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/switchTo(double)", - "memberId": "extensions/shader/Shaders/switchTo", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "switchTo", + "id": "recorder/GifEncoder/setRepeat(int)", + "memberId": "recorder/GifEncoder/setRepeat", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setRepeat", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "int" ], "parameterNames": [ - "index" + "iter" ], "params": [ - "double index" + "int iter" ], - "summary": "Switches to the shader at the given position. It is then the only one drawn\nwith.", - "description": "Switches to the shader at the given position. It is then the only one drawn\nwith.", + "summary": "Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play\nindefinitely. Must be invoked before the first image is added.", + "description": "Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play\nindefinitely. Must be invoked before the first image is added.", "scratchblock": null, "paramDocs": [ - "index: the position of the shader" + "iter: int number of iterations." ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/switchTo", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setRepeat", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/sorting/Sorting/by(Comparator)", - "memberId": "extensions/sorting/Sorting/by", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "by", + "id": "recorder/GifEncoder/setTransparent(int)", + "memberId": "recorder/GifEncoder/setTransparent", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setTransparent", "static": false, "returnType": "void", "parameterTypes": [ - "java.util.Comparator" + "int" ], "parameterNames": [ - "comparator" + "rgb" ], "params": [ - "Comparator comparator" + "int rgb" ], - "summary": "Draws sprites in an order of your own.", - "description": "Draws sprites in an order of your own.", + "summary": "Sets the transparent color for the last added frame and any subsequent frames. Since all\ncolors are subject to modification in the quantization process, the color in the final palette\nfor each frame closest to the given color becomes the transparent color for that frame. May be\nset to -1 to indicate no transparent color.", + "description": "Sets the transparent color for the last added frame and any subsequent frames. Since all\ncolors are subject to modification in the quantization process, the color in the final palette\nfor each frame closest to the given color becomes the transparent color for that frame. May be\nset to -1 to indicate no transparent color.", "scratchblock": null, "paramDocs": [ - "comparator: decides which of two sprites is drawn first" + "rgb: int color (0xRRGGBB) to be treated as transparent on display, or -1 for none." ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/by", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setTransparent", "availability": "desktop-only", - "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "translations": {} + }, + { + "id": "recorder/GifEncoder/start(OutputStream)", + "memberId": "recorder/GifEncoder/start", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "start", + "static": false, + "returnType": "boolean", + "parameterTypes": [ + "java.io.OutputStream" + ], + "parameterNames": [ + "os" + ], + "params": [ + "OutputStream os" + ], + "summary": "Initiates GIF file creation on the given stream. The stream is not closed automatically.", + "description": "Initiates GIF file creation on the given stream. The stream is not closed automatically.", + "scratchblock": null, + "paramDocs": [ + "os: OutputStream on which GIF images are written." + ], + "returns": "false if initial write failed.", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/start", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "translations": {} + }, + { + "id": "recorder/GifEncoder/start(String)", + "memberId": "recorder/GifEncoder/start", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "start", + "static": false, + "returnType": "boolean", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "file" + ], + "params": [ + "String file" + ], + "summary": "Initiates writing of a GIF file with the specified name.", + "description": "Initiates writing of a GIF file with the specified name.", + "scratchblock": null, + "paramDocs": [ + "file: String containing output file name." + ], + "returns": "false if open or initial write failed.", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/start", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "translations": {} + }, + { + "id": "recorder/GifRecorder/constructor(String)", + "memberId": "recorder/GifRecorder/constructor", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "constructor", + "static": false, + "returnType": "GifRecorder", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "path" + ], + "params": [ + "String path" + ], + "summary": "Records the stage as an animated GIF: every second frame of game time (30 a second), at stage\nsize, texts and the UI included.", + "description": "Records the stage as an animated GIF: every second frame of game time (30 a second), at stage\nsize, texts and the UI included.\n\n```java\nGifRecorder recorder = new GifRecorder(\"recording.gif\");\nrecorder.start();\n// \\u2026 later\nrecorder.stop();\n```", + "scratchblock": null, + "paramDocs": [ + "path: the GIF file to write; `.gif` is added when missing" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/byY()", - "memberId": "extensions/sorting/Sorting/byY", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "byY", + "id": "recorder/GifRecorder/snapshot()", + "memberId": "recorder/GifRecorder/snapshot", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "snapshot", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Draws sprites that are further down the stage in front of sprites that are\nfurther up, which is what a view from above usually wants.", - "description": "Draws sprites that are further down the stage in front of sprites that are\nfurther up, which is what a view from above usually wants.", + "summary": "Saves the next frame as a GIF of one frame.", + "description": "Saves the next frame as a GIF of one frame.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/byY", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/snapshot", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/constructor()", - "memberId": "extensions/sorting/Sorting/constructor", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "constructor", + "id": "recorder/GifRecorder/start()", + "memberId": "recorder/GifRecorder/start", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "start", "static": false, - "returnType": "Sorting", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Decides the order in which the sprites of a stage are drawn.", - "description": "Decides the order in which the sprites of a stage are drawn.\n\nReached through `stage.getSorting()`:\n\n```java\nthis.getSorting().byY();\n```", + "summary": "Starts recording from the next frame on.", + "description": "Starts recording from the next frame on.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/start", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/getComparator()", - "memberId": "extensions/sorting/Sorting/getComparator", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "getComparator", + "id": "recorder/GifRecorder/stop()", + "memberId": "recorder/GifRecorder/stop", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "stop", "static": false, - "returnType": "Comparator", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the order currently used.", - "description": "Returns the order currently used.", + "summary": "Stops recording and finishes the file.", + "description": "Stops recording and finishes the file.", "scratchblock": null, "paramDocs": [], - "returns": "the comparator, or null if the sprites are not sorted", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/getComparator", - "availability": "desktop-only", - "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/stop", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/isOn()", - "memberId": "extensions/sorting/Sorting/isOn", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "isOn", + "id": "recorder/RecorderExtension/constructor()", + "memberId": "recorder/RecorderExtension/constructor", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "constructor", "static": false, - "returnType": "boolean", + "returnType": "RecorderExtension", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether the sprites are being sorted.", - "description": "Checks whether the sprites are being sorted.", + "summary": "Registers the recorder extension; found through ServiceLoader, learners never see it.", + "description": "Registers the recorder extension; found through ServiceLoader, learners never see it.", "scratchblock": null, "paramDocs": [], - "returns": "true if an order is set", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/isOn", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sorting/Sorting/off()", - "memberId": "extensions/sorting/Sorting/off", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "off", + "id": "recorder/RecorderExtension/id()", + "memberId": "recorder/RecorderExtension/id", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "id", "static": false, - "returnType": "void", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Draws sprites in the order they were added, which is the default.", - "description": "Draws sprites in the order they were added, which is the default.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/off", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/close()", - "memberId": "extensions/sound/SoundPlayback/close", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "close", + "id": "recorder/RecorderExtension/install(ExtensionContext)", + "memberId": "recorder/RecorderExtension/install", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "install", "static": false, "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.extension.ExtensionContext" + ], + "parameterNames": [ + "ctx" + ], + "params": [ + "ExtensionContext ctx" + ], + "summary": "Hands every drawn frame to the recorders that are recording; frames are read back only then.", + "description": "Hands every drawn frame to the recorders that are recording; frames are read back only then.", + "scratchblock": null, + "paramDocs": [ + "ctx: " + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/install", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "recorder/RecorderExtension/name()", + "memberId": "recorder/RecorderExtension/name", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "name", + "static": false, + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Stops this playback.", - "description": "Stops this playback.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/close", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/getName()", - "memberId": "extensions/sound/SoundPlayback/getName", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "getName", + "id": "recorder/RecorderExtension/requires()", + "memberId": "recorder/RecorderExtension/requires", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "requires", "static": false, "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "", - "description": "", + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", "scratchblock": null, "paramDocs": [], - "returns": "the name of the sound", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/getName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/getVolume()", - "memberId": "extensions/sound/SoundPlayback/getVolume", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "getVolume", + "id": "recorder/RecorderExtension/version()", + "memberId": "recorder/RecorderExtension/version", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "version", "static": false, - "returnType": "double", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], @@ -17974,431 +18638,495 @@ "description": "", "scratchblock": null, "paramDocs": [], - "returns": "this playback's volume in percent", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/getVolume", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/isPlaying()", - "memberId": "extensions/sound/SoundPlayback/isPlaying", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "isPlaying", + "id": "save/File/constructor()", + "memberId": "save/File/constructor", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "constructor", "static": false, - "returnType": "boolean", + "returnType": "File", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "", - "description": "", + "summary": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.", + "description": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.\n\nUsage examples:\n\n```java\n// Save an object as JSON\nFile.save(\"/path/to/file.json\", myObject);\n\n// Save an object as XML\nFile.saveXML(\"/path/to/file.xml\", myObject);\n\n// Load an object from JSON\nMyClass obj = File.load(\"/path/to/file.json\", MyClass.class);\n\n// Load an object from XML\nMyClass obj = File.loadXML(\"/path/to/file.xml\", MyClass.class);\n```\n\nNote: The file paths can be absolute or relative. If a relative path is\nprovided, the class\nwill attempt to load the file from the classpath.\n\nSupported file types:\n\n
    \n
  • JSON\n
  • XML\n
", "scratchblock": null, "paramDocs": [], - "returns": "whether this playback is queued or playing", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/isPlaying", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/constructor", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "save/File/load(String,Class)", + "memberId": "save/File/load", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "load", + "static": true, + "returnType": "T", + "parameterTypes": [ + "java.lang.String", + "java.lang.Class" + ], + "parameterNames": [ + "path", + "cls" + ], + "params": [ + "String path", + "Class cls" + ], + "summary": "Loads an object of the specified class from a file at the given path.", + "description": "Loads an object of the specified class from a file at the given path.", + "scratchblock": null, + "paramDocs": [ + "path: the path to the file from which the object is to be loaded", + "cls: the class of the object to be loaded" + ], + "returns": "the loaded object of the specified class", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/load", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/setVolume(double)", - "memberId": "extensions/sound/SoundPlayback/setVolume", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "setVolume", - "static": false, - "returnType": "void", + "id": "save/File/loadOrCreate(String,Class)", + "memberId": "save/File/loadOrCreate", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "loadOrCreate", + "static": true, + "returnType": "T", "parameterTypes": [ - "double" + "java.lang.String", + "java.lang.Class" ], "parameterNames": [ - "percent" + "path", + "cls" ], "params": [ - "double percent" + "String path", + "Class cls" ], - "summary": "Changes only this playback's volume. Values outside 0..100 are clamped.", - "description": "Changes only this playback's volume. Values outside 0..100 are clamped.", + "summary": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", + "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", "scratchblock": null, "paramDocs": [ - "percent: volume in percent" + "path: the path to the file from which the object is to be loaded", + "cls: the class of the object to be loaded" ], - "returns": null, + "returns": "the loaded object of the specified class, or a new instance if the\n file does not exist", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/setVolume", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/loadOrCreate", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/stop()", - "memberId": "extensions/sound/SoundPlayback/stop", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "stop", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops this playback, leaving other copies alone.", - "description": "Stops this playback, leaving other copies alone.", + "id": "save/File/loadXML(String,Class)", + "memberId": "save/File/loadXML", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "loadXML", + "static": true, + "returnType": "T", + "parameterTypes": [ + "java.lang.String", + "java.lang.Class" + ], + "parameterNames": [ + "path", + "cls" + ], + "params": [ + "String path", + "Class cls" + ], + "summary": "Loads an object of the specified class from an XML file at the given path.", + "description": "Loads an object of the specified class from an XML file at the given path.", "scratchblock": null, - "paramDocs": [], - "returns": null, + "paramDocs": [ + "path: the path to the XML file", + "cls: the class of the object to be loaded" + ], + "returns": "the object loaded from the XML file", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/stop", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/loadXML", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/addGlyph(char,String)", - "memberId": "extensions/text/BitmapText/addGlyph", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "addGlyph", - "static": false, - "returnType": "void", + "id": "save/File/loadXMLOrCreate(String,Class)", + "memberId": "save/File/loadXMLOrCreate", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "loadXMLOrCreate", + "static": true, + "returnType": "T", "parameterTypes": [ - "char", - "java.lang.String" + "java.lang.String", + "java.lang.Class" ], "parameterNames": [ - "character", - "path" + "path", + "cls" ], "params": [ - "char character", - "String path" + "String path", + "Class cls" ], - "summary": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", - "description": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", + "summary": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", + "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", "scratchblock": null, "paramDocs": [ - "character: the character to replace", - "path: its image or built-in costume name" + "path: the path to the XML file", + "cls: the class of the object to be loaded" ], - "returns": null, + "returns": "the object loaded from the XML file, or a new instance if the file\n does not exist", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/addGlyph", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/loadXMLOrCreate", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/constructor(String)", - "memberId": "extensions/text/BitmapText/constructor", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "constructor", - "static": false, - "returnType": "BitmapText", + "id": "save/File/save(String,T)", + "memberId": "save/File/save", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "save", + "static": true, + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "T" ], "parameterNames": [ - "pattern" + "path", + "obj" ], "params": [ - "String pattern" + "String path", + "T obj" ], - "summary": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", - "description": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", + "summary": "Saves the given object to the specified path in the default file type (JSON).", + "description": "Saves the given object to the specified path in the default file type (JSON).", "scratchblock": null, "paramDocs": [ - "pattern: image path with an integer format, e.g. \"assets/font%03d.png\"" + "path: the path where the object should be saved", + "obj: the object to be saved" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/save", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/draw(Drawing)", - "memberId": "extensions/text/BitmapText/draw", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "draw", - "static": false, + "id": "save/File/saveXML(String,T)", + "memberId": "save/File/saveXML", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "saveXML", + "static": true, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "java.lang.String", + "T" ], "parameterNames": [ - "drawing" + "path", + "obj" ], "params": [ - "Drawing drawing" + "String path", + "T obj" ], - "summary": "", - "description": "", + "summary": "Saves the given object as an XML file at the specified path.", + "description": "Saves the given object as an XML file at the specified path.", "scratchblock": null, "paramDocs": [ - "drawing: the current frame's canvas" + "path: the path where the XML file will be saved", + "obj: the object to be saved as XML" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/draw", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/text/BitmapText/getContent()", - "memberId": "extensions/text/BitmapText/getContent", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "getContent", - "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "", - "description": "", - "scratchblock": null, - "paramDocs": [], - "returns": "the text being shown", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/getContent", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/saveXML", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/getHeight()", - "memberId": "extensions/text/BitmapText/getHeight", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "getHeight", + "id": "save/SaveData/constructor(String,String,Class)", + "memberId": "save/SaveData/constructor", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "constructor", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "", - "description": "", + "returnType": "SaveData", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "java.lang.Class" + ], + "parameterNames": [ + "gameId", + "slot", + "type" + ], + "params": [ + "String gameId", + "String slot", + "Class type" + ], + "summary": "Selects a game's save slot without creating a file or opening a database.", + "description": "Selects a game's save slot without creating a file or opening a database.", "scratchblock": null, - "paramDocs": [], - "returns": "the displayed text's height, including line spacing and sprite size", + "paramDocs": [ + "gameId: a stable identifier, for example org.openpatch.coincatcher", + "slot: a slot name, for example slot1, slot2 or slot3", + "type: the data class to load" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/getHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/getWidth()", - "memberId": "extensions/text/BitmapText/getWidth", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "getWidth", + "id": "save/SaveData/getLocation()", + "memberId": "save/SaveData/getLocation", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "getLocation", "static": false, - "returnType": "int", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "", - "description": "", + "summary": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", + "description": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", "scratchblock": null, "paramDocs": [], - "returns": "the displayed text's width, including the sprite's size", + "returns": "a description of the save location", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/getLocation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/setAlign(TextAlign)", - "memberId": "extensions/text/BitmapText/setAlign", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setAlign", + "id": "save/SaveData/loadOrDefault(Supplier)", + "memberId": "save/SaveData/loadOrDefault", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "loadOrDefault", "static": false, - "returnType": "void", + "returnType": "T", "parameterTypes": [ - "org.openpatch.scratch.TextAlign" + "java.util.function.Supplier" ], "parameterNames": [ - "align" + "defaults" ], "params": [ - "TextAlign align" + "Supplier defaults" ], - "summary": "", - "description": "", + "summary": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", + "description": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", "scratchblock": null, "paramDocs": [ - "align: LEFT, CENTER or RIGHT (DEFAULT means LEFT)" + "defaults: creates initial progress for a missing slot; called only when missing" ], - "returns": null, + "returns": "loaded progress, or the supplied defaults for a missing slot", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setAlign", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/loadOrDefault", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/setFont(String)", - "memberId": "extensions/text/BitmapText/setFont", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setFont", + "id": "save/SaveData/path()", + "memberId": "save/SaveData/path", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "path", + "static": false, + "returnType": "Path", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "scratchblock": null, + "paramDocs": [], + "returns": "the desktop file path", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/path", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "save/SaveData/save(T)", + "memberId": "save/SaveData/save", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "save", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "T" ], "parameterNames": [ - "pattern" + "data" ], "params": [ - "String pattern" + "T data" ], - "summary": "", - "description": "", + "summary": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", + "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", "scratchblock": null, "paramDocs": [ - "pattern: glyph path with one integer format for the Unicode code point" + "data: the progress to save; must not be null" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/save", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/setLetterSpacing(double)", - "memberId": "extensions/text/BitmapText/setLetterSpacing", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setLetterSpacing", + "id": "save/SaveExtension/constructor()", + "memberId": "save/SaveExtension/constructor", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "constructor", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "spacing" - ], - "params": [ - "double spacing" - ], - "summary": "", - "description": "", + "returnType": "SaveExtension", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Registers the save extension; found through ServiceLoader, learners never see it.", + "description": "Registers the save extension; found through ServiceLoader, learners never see it.", "scratchblock": null, - "paramDocs": [ - "spacing: gap between characters; negative values allow italic glyphs to overlap" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setLetterSpacing", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/text/BitmapText/setLineSpacing(double)", - "memberId": "extensions/text/BitmapText/setLineSpacing", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setLineSpacing", + "id": "save/SaveExtension/id()", + "memberId": "save/SaveExtension/id", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "id", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "spacing" - ], - "params": [ - "double spacing" - ], + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], "summary": "", "description": "", "scratchblock": null, - "paramDocs": [ - "spacing: extra pixels between lines" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setLineSpacing", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/text/BitmapText/setSpaceWidth(double)", - "memberId": "extensions/text/BitmapText/setSpaceWidth", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setSpaceWidth", + "id": "save/SaveExtension/name()", + "memberId": "save/SaveExtension/name", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "name", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "width" - ], - "params": [ - "double width" - ], + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], "summary": "", "description": "", "scratchblock": null, - "paramDocs": [ - "width: width of a space, in unscaled pixels" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setSpaceWidth", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/text/BitmapText/showText(String)", - "memberId": "extensions/text/BitmapText/showText", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "showText", + "id": "save/SaveExtension/requires()", + "memberId": "save/SaveExtension/requires", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "requires", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "text" - ], - "params": [ - "String text" - ], + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "save/SaveExtension/version()", + "memberId": "save/SaveExtension/version", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "version", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], "summary": "", "description": "", "scratchblock": null, - "paramDocs": [ - "text: text to show, including spaces and newlines" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/showText", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/tiled/MapObject/constructor()", - "memberId": "extensions/tiled/MapObject/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/constructor()", + "memberId": "tiled/MapObject/constructor", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "constructor", "static": false, @@ -18412,15 +19140,15 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/constructor", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getProperty(String)", - "memberId": "extensions/tiled/MapObject/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getProperty(String)", + "memberId": "tiled/MapObject/getProperty", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getProperty", "static": false, @@ -18442,15 +19170,15 @@ ], "returns": "the value of the property with the specified name", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getProperty", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getProperty", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getPropertyBoolean(String)", - "memberId": "extensions/tiled/MapObject/getPropertyBoolean", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyBoolean(String)", + "memberId": "tiled/MapObject/getPropertyBoolean", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getPropertyBoolean", "static": false, @@ -18472,15 +19200,15 @@ ], "returns": "the boolean value of the property, or false if the property is not\n found or cannot be\n parsed as a boolean", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getPropertyBoolean", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getPropertyBoolean", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getPropertyFloat(String)", - "memberId": "extensions/tiled/MapObject/getPropertyFloat", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyFloat(String)", + "memberId": "tiled/MapObject/getPropertyFloat", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getPropertyFloat", "static": false, @@ -18502,15 +19230,15 @@ ], "returns": "the float value of the specified property", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getPropertyFloat", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getPropertyFloat", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getPropertyInt(String)", - "memberId": "extensions/tiled/MapObject/getPropertyInt", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyInt(String)", + "memberId": "tiled/MapObject/getPropertyInt", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getPropertyInt", "static": false, @@ -18532,15 +19260,15 @@ ], "returns": "the integer value of the property", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getPropertyInt", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getPropertyInt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getShape()", - "memberId": "extensions/tiled/MapObject/getShape", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getShape()", + "memberId": "tiled/MapObject/getShape", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getShape", "static": false, @@ -18554,15 +19282,15 @@ "paramDocs": [], "returns": "a Shape object representing the current map object.", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getShape", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getShape", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/setClassName(String)", - "memberId": "extensions/tiled/MapObject/setClassName", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/setClassName(String)", + "memberId": "tiled/MapObject/setClassName", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "setClassName", "static": false, @@ -18584,15 +19312,15 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/setClassName", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/setClassName", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/Property/constructor()", - "memberId": "extensions/tiled/Property/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.Property", + "id": "tiled/Property/constructor()", + "memberId": "tiled/Property/constructor", + "owner": "org.openpatch.scratch.tiled.Property", "className": "Property", "methodName": "constructor", "static": false, @@ -18606,15 +19334,15 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/Property/constructor", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/Property/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/Property/setText(String)", - "memberId": "extensions/tiled/Property/setText", - "owner": "org.openpatch.scratch.extensions.tiled.Property", + "id": "tiled/Property/setText(String)", + "memberId": "tiled/Property/setText", + "owner": "org.openpatch.scratch.tiled.Property", "className": "Property", "methodName": "setText", "static": false, @@ -18636,15 +19364,155 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/Property/setText", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/Property/setText", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/constructor()", + "memberId": "tiled/TiledExtension/constructor", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "constructor", + "static": false, + "returnType": "TiledExtension", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Registers the tiled extension; found through ServiceLoader, learners never see it.", + "description": "Registers the tiled extension; found through ServiceLoader, learners never see it.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/id()", + "memberId": "tiled/TiledExtension/id", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "id", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/install(ExtensionContext)", + "memberId": "tiled/TiledExtension/install", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "install", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.extension.ExtensionContext" + ], + "parameterNames": [ + "ctx" + ], + "params": [ + "ExtensionContext ctx" + ], + "summary": "Every layer of a stage draws its shown map layers, only the part the camera shows.", + "description": "Every layer of a stage draws its shown map layers, only the part the camera shows.", + "scratchblock": null, + "paramDocs": [ + "ctx: " + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/install", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/name()", + "memberId": "tiled/TiledExtension/name", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "name", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/requires()", + "memberId": "tiled/TiledExtension/requires", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "requires", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/version()", + "memberId": "tiled/TiledExtension/version", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "version", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/constructor(String)", - "memberId": "extensions/tiled/TiledMap/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/constructor(String)", + "memberId": "tiled/TiledMap/constructor", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "constructor", "static": false, @@ -18666,15 +19534,15 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/constructor(String,Stage)", - "memberId": "extensions/tiled/TiledMap/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/constructor(String,Stage)", + "memberId": "tiled/TiledMap/constructor", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "constructor", "static": false, @@ -18700,15 +19568,15 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getHeight()", - "memberId": "extensions/tiled/TiledMap/getHeight", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getHeight()", + "memberId": "tiled/TiledMap/getHeight", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getHeight", "static": false, @@ -18722,15 +19590,15 @@ "paramDocs": [], "returns": "the number of map rows", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getObjectsFromLayer(String)", - "memberId": "extensions/tiled/TiledMap/getObjectsFromLayer", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getObjectsFromLayer(String)", + "memberId": "tiled/TiledMap/getObjectsFromLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getObjectsFromLayer", "static": false, @@ -18752,15 +19620,15 @@ ], "returns": "an array of MapObject from the specified layer, or null if the layer\n does not exist", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getObjectsFromLayer", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getObjectsFromLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getProperty(String)", - "memberId": "extensions/tiled/TiledMap/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getProperty(String)", + "memberId": "tiled/TiledMap/getProperty", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getProperty", "static": false, @@ -18782,15 +19650,15 @@ ], "returns": "its string value, including multiline strings", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getProperty", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getProperty", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getProperty(String,String)", - "memberId": "extensions/tiled/TiledMap/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getProperty(String,String)", + "memberId": "tiled/TiledMap/getProperty", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getProperty", "static": false, @@ -18816,15 +19684,15 @@ ], "returns": "the stored value or the default", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getProperty", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getProperty", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getPropertyBoolean(String)", - "memberId": "extensions/tiled/TiledMap/getPropertyBoolean", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyBoolean(String)", + "memberId": "tiled/TiledMap/getPropertyBoolean", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getPropertyBoolean", "static": false, @@ -18846,15 +19714,15 @@ ], "returns": "its boolean value", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getPropertyBoolean", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getPropertyBoolean", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getPropertyFloat(String)", - "memberId": "extensions/tiled/TiledMap/getPropertyFloat", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyFloat(String)", + "memberId": "tiled/TiledMap/getPropertyFloat", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getPropertyFloat", "static": false, @@ -18876,15 +19744,15 @@ ], "returns": "its floating-point value", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getPropertyFloat", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getPropertyFloat", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getPropertyInt(String)", - "memberId": "extensions/tiled/TiledMap/getPropertyInt", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyInt(String)", + "memberId": "tiled/TiledMap/getPropertyInt", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getPropertyInt", "static": false, @@ -18906,15 +19774,15 @@ ], "returns": "its integer value", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getPropertyInt", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getPropertyInt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileCollisionShapes(int)", - "memberId": "extensions/tiled/TiledMap/getTileCollisionShapes", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileCollisionShapes(int)", + "memberId": "tiled/TiledMap/getTileCollisionShapes", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileCollisionShapes", "static": false, @@ -18936,15 +19804,15 @@ ], "returns": "rectangles, ellipses or polygons for this tile", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileCollisionShapes", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileCollisionShapes", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileCollisionShapes(String,int,int)", - "memberId": "extensions/tiled/TiledMap/getTileCollisionShapes", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileCollisionShapes(String,int,int)", + "memberId": "tiled/TiledMap/getTileCollisionShapes", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileCollisionShapes", "static": false, @@ -18974,15 +19842,15 @@ ], "returns": "positioned outlines, or an empty array outside/without collision", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileCollisionShapes", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileCollisionShapes", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileHeight()", - "memberId": "extensions/tiled/TiledMap/getTileHeight", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileHeight()", + "memberId": "tiled/TiledMap/getTileHeight", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileHeight", "static": false, @@ -18996,15 +19864,15 @@ "paramDocs": [], "returns": "the height of a map cell in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileId(String,int,int)", - "memberId": "extensions/tiled/TiledMap/getTileId", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileId(String,int,int)", + "memberId": "tiled/TiledMap/getTileId", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileId", "static": false, @@ -19034,15 +19902,15 @@ ], "returns": "global ID, or zero for an empty/outside cell", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileId", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileId", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileWidth()", - "memberId": "extensions/tiled/TiledMap/getTileWidth", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileWidth()", + "memberId": "tiled/TiledMap/getTileWidth", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileWidth", "static": false, @@ -19056,15 +19924,15 @@ "paramDocs": [], "returns": "the width of a map cell in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getWidth()", - "memberId": "extensions/tiled/TiledMap/getWidth", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getWidth()", + "memberId": "tiled/TiledMap/getWidth", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getWidth", "static": false, @@ -19078,105 +19946,109 @@ "paramDocs": [], "returns": "the number of map columns", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/spawn(String)", - "memberId": "extensions/tiled/TiledMap/spawn", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/hideLayer(String)", + "memberId": "tiled/TiledMap/hideLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", - "methodName": "spawn", + "methodName": "hideLayer", "static": false, - "returnType": "List", + "returnType": "void", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "layerName" + "name" ], "params": [ - "String layerName" + "String name" ], - "summary": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.", - "description": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.\n\nThe sprite's class needs one of these constructors, tried in this order:\none that takes the [MapObject](../MapObject/index) (to read its name and properties), one\nthat takes `(double x, double y)`, or one without parameters. Either\nway the sprite is put where the object is. An object drawn as an area\n(a rectangle, an ellipse or a polygon) also gives the sprite that area as\nits hitbox, which is how walls and water work without a costume.\n\nObjects whose type is not a sprite class, or that have no type, are left\nalone, so a layer can hold markers the program reads itself.\n\n```java\nTiledMap map = new TiledMap(\"level.tmx\", this);\nmap.spawn(\"Objects\");\n```", + "summary": "Stops drawing a tile layer shown with [showLayer(String, Layer)](showLayer).", + "description": "Stops drawing a tile layer shown with [showLayer(String, Layer)](showLayer).", "scratchblock": null, "paramDocs": [ - "layerName: the object layer" + "name: the tile layer's name in Tiled" ], - "returns": "the sprites that were made, in the order of the layer", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/spawn", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/hideLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/stampLayerToBackground(String)", - "memberId": "extensions/tiled/TiledMap/stampLayerToBackground", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/showLayer(String,Layer)", + "memberId": "tiled/TiledMap/showLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", - "methodName": "stampLayerToBackground", + "methodName": "showLayer", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "org.openpatch.scratch.Layer" ], "parameterNames": [ - "name" + "name", + "layer" ], "params": [ - "String name" + "String name", + "Layer layer" ], - "summary": "Stamps a specified layer onto the background.", - "description": "Stamps a specified layer onto the background.", + "summary": "Shows a tile layer of the map in a layer of the stage, drawn every frame from now on (only\nthe tiles the camera shows). The map's top left corner is at (0, 0) of the world; the map\nextends right and down.", + "description": "Shows a tile layer of the map in a layer of the stage, drawn every frame from now on (only\nthe tiles the camera shows). The map's top left corner is at (0, 0) of the world; the map\nextends right and down.\n\n```java\nmap.showLayer(\"ground\", Layer.BACKGROUND);\nmap.showLayer(\"trees\", Layer.FOREGROUND);\n```", "scratchblock": null, "paramDocs": [ - "name: the name of the layer to be stamped onto the background" + "name: the tile layer's name in Tiled", + "layer: the stage's layer to draw it in" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/stampLayerToBackground", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/showLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/stampLayerToForeground(String)", - "memberId": "extensions/tiled/TiledMap/stampLayerToForeground", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/spawn(String)", + "memberId": "tiled/TiledMap/spawn", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", - "methodName": "stampLayerToForeground", + "methodName": "spawn", "static": false, - "returnType": "void", + "returnType": "List", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "name" + "layerName" ], "params": [ - "String name" + "String layerName" ], - "summary": "Stamps the specified layer to the foreground.", - "description": "Stamps the specified layer to the foreground.", + "summary": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.", + "description": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.\n\nThe sprite's class needs one of these constructors, tried in this order:\none that takes the [MapObject](../MapObject/index) (to read its name and properties), one\nthat takes `(double x, double y)`, or one without parameters. Either\nway the sprite is put where the object is. An object drawn as an area\n(a rectangle, an ellipse or a polygon) also gives the sprite that area as\nits hitbox, which is how walls and water work without a costume.\n\nObjects whose type is not a sprite class, or that have no type, are left\nalone, so a layer can hold markers the program reads itself.\n\n```java\nTiledMap map = new TiledMap(\"level.tmx\", this);\nmap.spawn(\"Objects\");\n```", "scratchblock": null, "paramDocs": [ - "name: the name of the layer to be stamped to the foreground" + "layerName: the object layer" ], - "returns": null, + "returns": "the sprites that were made, in the order of the layer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/stampLayerToForeground", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/spawn", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/toString()", - "memberId": "extensions/tiled/TiledMap/toString", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/toString()", + "memberId": "tiled/TiledMap/toString", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "toString", "static": false, @@ -19190,15 +20062,15 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/toString", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/toString", + "availability": "desktop-only", + "availabilityReason": "Prints the desktop's parsed TMX tree as JSON; the browser reads maps without it.", "translations": {} }, { - "id": "extensions/tiled/TilesetImage/constructor()", - "memberId": "extensions/tiled/TilesetImage/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TilesetImage", + "id": "tiled/TilesetImage/constructor()", + "memberId": "tiled/TilesetImage/constructor", + "owner": "org.openpatch.scratch.tiled.TilesetImage", "className": "TilesetImage", "methodName": "constructor", "static": false, @@ -19212,9 +20084,9 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TilesetImage/constructor", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TilesetImage/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} } ] diff --git a/catalogs/examples.json b/catalogs/examples.json index 8afc476e..c8f69f23 100644 --- a/catalogs/examples.json +++ b/catalogs/examples.json @@ -6,7 +6,7 @@ { "id": "demo/cat", "kind": "demo", - "source": "src/examples/java/demos/cat", + "source": "examples/src/main/java/demos/cat", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -24,7 +24,7 @@ { "id": "demo/catPlatformer", "kind": "demo", - "source": "src/examples/java/demos/catPlatformer", + "source": "examples/src/main/java/demos/catPlatformer", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -35,15 +35,15 @@ "files": [ { "path": "Bean.java", - "sha256": "e711aead57857c6d25ff96f5e0de6a969ffd9c1b33f359e3f2bb8a36428f5a10" + "sha256": "2a29b5b353cf5408a9b0926e4a834733e45d06504eca0f778b49e475fcb27d8c" }, { "path": "Bug.java", - "sha256": "6a6e39b0925985b93f9e5e1c509fe898a9cd13a5dc2cba3f46b3c58eae58677a" + "sha256": "a3e060ff2c19606f94e26161d37e500acc67ace1708d5de059bd01189407789b" }, { "path": "Cat.java", - "sha256": "40752d42d41e75295bbea5463ae5f574b58ddc4a888cde56b319cf57a4484c40" + "sha256": "fb1e51731c37b0db917ec274a9fb9a5b9964ad132eae73ffbf462e71a629eebb" }, { "path": "CatPlatformer.java", @@ -51,7 +51,7 @@ }, { "path": "Goal.java", - "sha256": "a0ab034b3dbf2835a1b85dd1edbb32b67a7774dd8e41b3a493194ba778b97572" + "sha256": "c828b86c1b09f039f3b46bcf9d7424244df474a2b08aa7ac42d0316f6ca49ab6" }, { "path": "Ground.java", @@ -74,7 +74,7 @@ { "id": "demo/clock", "kind": "demo", - "source": "src/examples/java/demos/clock", + "source": "examples/src/main/java/demos/clock", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -124,7 +124,7 @@ { "id": "demo/coinCollector", "kind": "demo", - "source": "src/examples/java/demos/coinCollector", + "source": "examples/src/main/java/demos/coinCollector", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -138,7 +138,7 @@ }, { "path": "CoinCollector.java", - "sha256": "7ea50c78169a962f75a35e72d36b355b52af9f4b1b1233218d98e040318503b7" + "sha256": "82d0f645d9adbec7f06ff4b4eb7db38dafc5e0643c94d26b61a6de4030ad447e" }, { "path": "Ground.java", @@ -146,25 +146,25 @@ }, { "path": "Player.java", - "sha256": "0693a09310284af5d2fd58693ac1430d34ea9b09f210e91422d63449bb25497d" + "sha256": "0143c301cd7395ba82be98af8b56ed283b122411846e7b0dde203eaaa6eb5d8b" } ] }, { "id": "demo/donutIO", "kind": "demo", - "source": "src/examples/java/demos/donutIO", + "source": "examples/src/main/java/demos/donutIO", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "Background.java", - "sha256": "240f3eee3a70b9a9ffcd23d731400300ad1dccb2b9402d820ee9ec7fe250b258" + "sha256": "240686fd74eac29bea2de07abb9fdf7eb2d68f07b25e936eb151d00e2093b717" }, { "path": "Donut.java", - "sha256": "72e4ed699fc1de18ee2a48644d3c5425b762c667a7a7fdfa82aab7038a65a362" + "sha256": "12909d89ff89c8ab093150d102cd355ffd7c96644d741e2978a9ff35a29dfcbb" }, { "path": "FollowDonut.java", @@ -172,11 +172,11 @@ }, { "path": "Game.java", - "sha256": "dd47d147b288eb68780451f6f6c3a1234ff162d63039ec925a455092ccc3bddb" + "sha256": "01645a6b03f037958b4037f78ebdbe0174c7690314f77b2e7e292893cd9f75af" }, { "path": "GameOverStage.java", - "sha256": "8b03b31cb932b6972803e49a58501e5c7b04f0e7b2c4bc0473b7cfa2cf20089c" + "sha256": "7dec2067ba6e4edf4642670f838ee983a639307117b10a309ff36f94c9ee5557" }, { "path": "PlayerDonut.java", @@ -184,15 +184,15 @@ }, { "path": "StartStage.java", - "sha256": "9d4a0085c2377ad6e9fcba5fbd05936c1f344b6b12aeb6ec36c3579325b28821" + "sha256": "d511595cb10651f75e3a895550b041db4a1a2d7867d309e55ff6e47723095b6e" }, { "path": "WinStage.java", - "sha256": "691b5d745227a569d9e96fcee082c0ca022cb166702e5f70402f7f1d2573e6d1" + "sha256": "699a0026ff67d1079df2cb811283f0743ffb1cb0ccd849852169e05c1a9c0ca5" }, { "path": "WorldStage.java", - "sha256": "2c1e97bce4d27074b278d77f339c50eda6ad2632c2c324cc7bc50d2fb119566c" + "sha256": "d520f4b57fb2f7d2161ea407881cde464a7078dabd2cc7d7a8932d64ee21d3c8" }, { "path": "assets/donut.png", @@ -211,7 +211,7 @@ { "id": "demo/glide", "kind": "demo", - "source": "src/examples/java/demos/glide", + "source": "examples/src/main/java/demos/glide", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -228,18 +228,18 @@ { "id": "demo/pipes", "kind": "demo", - "source": "src/examples/java/demos/pipes", + "source": "examples/src/main/java/demos/pipes", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "PenSprite.java", - "sha256": "94b9fb824ef95dfbbd5c0f757aef771be165c1f7917fb5954b5f14651d516283" + "sha256": "9cc2544d691f9d771b868f0a644b8ea5eb74e89534a42aeeb7f88b87f064acf3" }, { "path": "Pipes.java", - "sha256": "3b516c93456ef4a74b149abb52844d877f6db846dd384f9156701fcacee81e28" + "sha256": "72540a41ffe2102900cf21da2a2430e95bcac6a93c61644e0b919343f0cc7ba5" }, { "path": "backdrops/chalk_board.jpg", @@ -258,7 +258,7 @@ { "id": "demo/quiz", "kind": "demo", - "source": "src/examples/java/demos/quiz", + "source": "examples/src/main/java/demos/quiz", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -275,35 +275,35 @@ { "id": "demo/rainbowVine", "kind": "demo", - "source": "src/examples/java/demos/rainbowVine", + "source": "examples/src/main/java/demos/rainbowVine", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "RainbowVine.java", - "sha256": "ab9f946430b98be3988e4b29606ecf135abc6b9f59002a04406bb9380e0df0c7" + "sha256": "138c92e3ec360946511bdaa3fbfcbf7680d7e0794bd0afd88940463328ba70ef" } ] }, { "id": "demo/randomDot", "kind": "demo", - "source": "src/examples/java/demos/randomDot", + "source": "examples/src/main/java/demos/randomDot", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "RandomDot.java", - "sha256": "29adafc8e89e37efb43cd41226bb557668f94345b8fd19ae9cdceaa7cf64b246" + "sha256": "85fca39a0f737838886790b33e3a78c0bf761fa22038f16d1647d49573b0f641" } ] }, { "id": "demo/robot", "kind": "demo", - "source": "src/examples/java/demos/robot", + "source": "examples/src/main/java/demos/robot", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -314,7 +314,7 @@ }, { "path": "RobotStage.java", - "sha256": "d3e5db133393de331fa3f9be1774ff8c74df9ce0437ddcc9cb6c726938a2abc6" + "sha256": "f4a13c806280372dd994a2b5c7c378622a7c56ab2cdcbca40a524da3dbcfe33e" }, { "path": "sprites/robot.png", @@ -325,7 +325,7 @@ { "id": "demo/saveSlots", "kind": "demo", - "source": "src/examples/java/demos/saveSlots", + "source": "examples/src/main/java/demos/saveSlots", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -347,14 +347,14 @@ }, { "path": "SaveSlotStage.java", - "sha256": "137d38a4b232e7c477d1d9b82143c986073221a9890a72783f8580818fd279e4" + "sha256": "952710f6d48438e6d4b504bd24d9d68da4164eeab8a98446d724e1de21d75c9e" } ] }, { "id": "demo/saving", "kind": "demo", - "source": "src/examples/java/demos/saving", + "source": "examples/src/main/java/demos/saving", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -365,21 +365,21 @@ }, { "path": "Saving.java", - "sha256": "083c69f9950f753e83a21bc722b4d91bdf476d6bb5d73f41d939c27d4ff60ac6" + "sha256": "07c5a1fa8f1205e86ad5770579f31f84c81583b72f43eaf7c38c1992b4a06479" } ] }, { "id": "demo/sensing", "kind": "demo", - "source": "src/examples/java/demos/sensing", + "source": "examples/src/main/java/demos/sensing", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "Sensing.java", - "sha256": "7a329ba9f3b5eed86c48eec6b963b22516a90267a4ee871bbf62775fc96b692d" + "sha256": "2ff78751e708d51ffb8b0afdcfab91c1fdd4f2a7de6c04beaf18a1b39dcba8bc" }, { "path": "sprites/hero.png", @@ -394,7 +394,7 @@ { "id": "demo/shader", "kind": "demo", - "source": "src/examples/java/demos/shader", + "source": "examples/src/main/java/demos/shader", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -405,11 +405,11 @@ }, { "path": "MySprite.java", - "sha256": "c1d6ef06a68dbcd7d77ea07f6fb7b50fc3d167c18075140db11b15b708affe6a" + "sha256": "0c1d54d65528f25b9b27c80e4e9aa8de6fd406b719ab27c0bc4aeb29cb01b311" }, { "path": "MyStage.java", - "sha256": "084c5cec165caab57efc5bc29a35858e369e13cee645ac1af38fe63d56cd3e90" + "sha256": "09ba7034c03535decd6f48b0db410d244fa41dad548e60cf5a31ab7007ea0680" }, { "path": "NormalSprite.java", @@ -421,27 +421,23 @@ }, { "path": "blobby.frag", - "sha256": "384933079eec3bb08beb0b141bec7cd59ff7ef17c4a8fa706e3c4f1640dba55b" + "sha256": "b4ee43f9290e7181eaf73cfa0d61951916655f284a390a74417bcded8572df6a" }, { "path": "cat.png", "sha256": "0423f61671a086906d972b266241d557934f86bdb8ec5ad6f50b08f3474efa0f" }, - { - "path": "default.vert", - "sha256": "74b864ff74fb681af02ede001826b988ec94edcbb2c3b3377cd08975edca7cbf" - }, { "path": "glitch.frag", - "sha256": "cc97afe4a6df211c95abf0dead361f05d32cf4e42d042d78ad47f22a3c1fdb5d" + "sha256": "c087dead430cf77c6b126a699533711597f0531a84b7ea599828e5157590bd62" }, { "path": "halftone.frag", - "sha256": "64e2eb806ed07b091fa5d9c15329cf776d2950832021fb985172edebd0c0df71" + "sha256": "feeeac1d83e851624d0bd1edfb83a037d42a2c72766bff67d3c73cf702d47c9e" }, { "path": "light.frag", - "sha256": "cbb7e7c862a6944b620919c8643b40f8986a6dcc389e2308966fa5f50694e551" + "sha256": "406c07398ade3a3bec38b7fe124bf900520d1372fcafff3ca43dbd272ac29578" }, { "path": "light.png", @@ -449,22 +445,22 @@ }, { "path": "neon.frag", - "sha256": "8e875c5eb0cc2884d3470ae96797bf3708e01eb1725a98ad560414d5c9493f75" + "sha256": "03e834af81c80587b7c1de2ee89fd9c0facd15aab9e2a38dfdbafe7045bb22ac" }, { "path": "pixel.frag", - "sha256": "3b3d471cd76f42313008ffaa3019fd382e80916ddc990c48b748786a54f5796f" + "sha256": "2642359211f3008c8e57b47ef97463a6727de042ccc6822cc67def9cdd0f41e2" }, { "path": "pixelate.frag", - "sha256": "7d0842e4fc000f92a2ac9cf113fce083b7c2c5e5bb43c2cb2edfbf0bc045075b" + "sha256": "b97cea96d4fe2ce65b00354f7096c69b1027e8cfd0685fb4c22e3c3636b4947c" } ] }, { "id": "demo/shakespeare", "kind": "demo", - "source": "src/examples/java/demos/shakespeare", + "source": "examples/src/main/java/demos/shakespeare", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -479,7 +475,7 @@ }, { "path": "Shakespeare.java", - "sha256": "de45a061414fb16ca748abd3fe0327df154257a76933fd41bcda446aa8965484" + "sha256": "28dd04fd2825a2ee6e3770dde8699881d9b1e6b7c13f7de2202b4bf0c4c6dd55" }, { "path": "assets/Singkong.ttf", @@ -490,7 +486,7 @@ { "id": "demo/smartRocket", "kind": "demo", - "source": "src/examples/java/demos/smartRocket", + "source": "examples/src/main/java/demos/smartRocket", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -509,7 +505,7 @@ }, { "path": "Rocket.java", - "sha256": "aacd80bf036fff40872615776c41049fb9e06d199a87f4c10a990bb1d9249415" + "sha256": "dc981311b03f78c6b88fbcb9f09f204e99253bb8a39c261f6654d8c9b107d407" }, { "path": "SmartRocket.java", @@ -517,7 +513,7 @@ }, { "path": "Ziel.java", - "sha256": "656a913936da7e1c41811fff6ca80d5ef0fa047b72534bb92a15d5163d72d511" + "sha256": "61fafe0d70651623b85039e3f4f68544e5a39fdb2ededd52b4476d540bfa24c0" }, { "path": "assets/rocket.png", @@ -532,7 +528,7 @@ { "id": "demo/stressTest", "kind": "demo", - "source": "src/examples/java/demos/stressTest", + "source": "examples/src/main/java/demos/stressTest", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -543,7 +539,7 @@ }, { "path": "Figure.java", - "sha256": "722315ba5fc50b965d100e10b4605325470909342561a3e7bf01a9b2df1c82c6" + "sha256": "40d78a80d3528fc9ab97aa6f621d66fdbd18c6de8865d7863885c6199f6665d2" }, { "path": "FigureState.java", @@ -930,26 +926,26 @@ { "id": "demo/tiled", "kind": "demo", - "source": "src/examples/java/demos/tiled", + "source": "examples/src/main/java/demos/tiled", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "Bamboo.java", - "sha256": "ef45cb82baf7adc0afe4bce3cd3d9c682140e565c7458648bd819621569ed0a4" + "sha256": "e34a0f3974c9fd718b5dc64e18de87f4678c7d094419f99e9fde16784c5775b0" }, { "path": "Enemy.java", - "sha256": "79e55b3bd2b799280fc3bb997700e8aa43fb410acab00b1546dacaefe465d61b" + "sha256": "290723fdc9747e0288e113a83f612f1a114528e38d0141c4e7cdbffdb21ce2ed" }, { "path": "Fireball.java", - "sha256": "48cd4c98729716490c2393eeeceae156381a1d4fa5a6b2bf37b25b37f1f55415" + "sha256": "d4ad9b4da3834994033969c1fd3003e06313d384054a58b2906122c35b15e58b" }, { "path": "GameState.java", - "sha256": "b7f6a5c03215e169f06986cf7856ec3873b432180d2a20665ae04801af93edaa" + "sha256": "92bb156764a03a3a6109ff4514e5d7f71a1556662b9d8a6e5def64f26f7ac1ad" }, { "path": "I18n.java", @@ -957,11 +953,11 @@ }, { "path": "Item.java", - "sha256": "e47faeb22edf46c14d082af212addbb7153d12db0e92ea55ee0d93efad9677d7" + "sha256": "5e09c2f6a37de88ac4938e3cf5d99b6c5975d120395810624bf9558289be5323" }, { "path": "Level.java", - "sha256": "836ae4f3e812081fb38ef0f6be6277cea64a190d9b676ce7401d8e0f493924c0" + "sha256": "cc23dac470d5f1c6368546d84281a5d28cef6727c90ed2041879fbc516fcd0bf" }, { "path": "Level1.tmx", @@ -973,15 +969,15 @@ }, { "path": "Player.java", - "sha256": "57e756ac071860864b23b94f94544acd434762b609e1269c2269697e757ed597" + "sha256": "ea4b1ae4977cec0863375b8513c79bff66b7f0c47992fe06496f54ff245f4aff" }, { "path": "Tiled.java", - "sha256": "960b45e33762de56bb58d730ac04f804b4caa89034754581ed37f23aebfa9080" + "sha256": "5d36d108981a89c7623489946d592bd11f910e023a8103eef1fca67b290bcec6" }, { "path": "UIItem.java", - "sha256": "7cf11e83c718558802931c182c4d5db58679dea3cc9f7fad21a37da0dad77349" + "sha256": "a6910a0d8669272a46e6734062bef5baa6cee95c583d426e9aa2a9c468be1c7c" }, { "path": "Wall.java", @@ -989,7 +985,7 @@ }, { "path": "Warp.java", - "sha256": "c203e54de7d36e77750eb06ca40de9911aa4b42f7ffe9b5dea868b2ded1a3eb8" + "sha256": "4e2f9addd0b0fc37f214e986e1331d479b6f4365b9e4e09040d9ed41185e02e6" }, { "path": "Water.java", @@ -1036,42 +1032,42 @@ { "id": "demo/timedDot", "kind": "demo", - "source": "src/examples/java/demos/timedDot", + "source": "examples/src/main/java/demos/timedDot", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "TimedDot.java", - "sha256": "122349586071c44793565603f0dc6a470c0665fe1655fa671dbc519dc21011ac" + "sha256": "4ffd93113ccce1ebe8461c3178a5155b6b6ce94e8f4067d34dd1e0bad081617d" } ] }, { "id": "demo/timer", "kind": "demo", - "source": "src/examples/java/demos/timer", + "source": "examples/src/main/java/demos/timer", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "TimerStage.java", - "sha256": "7d2e0fac9344fbf4d43c09a57ac4430cb8961613394ac0faf322e3852e2cfac2" + "sha256": "a9e9bf9cb594f18cf50898f1755bacd08708f2ac29b5d2286047eb9648e36626" } ] }, { "id": "demo/ui", "kind": "demo", - "source": "src/examples/java/demos/ui", + "source": "examples/src/main/java/demos/ui", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "UI.java", - "sha256": "145ecc97c900d75c57b48be50c979466e0d50566ef91a50163ec243c4b04942b" + "sha256": "70abb18e4bb6b1ddf58b8b87407723871abe00b69c3e0066fa0d65818f8edb93" }, { "path": "bar_round_gloss_large.png", @@ -1094,7 +1090,7 @@ { "id": "demo/volume", "kind": "demo", - "source": "src/examples/java/demos/volume", + "source": "examples/src/main/java/demos/volume", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -1104,7 +1100,7 @@ "files": [ { "path": "Volume.java", - "sha256": "bb2fab55b3f111fd33ff7beb654b9c1eed23323089b6117840790f3cfaa91948" + "sha256": "0cc43883cd844833e4e69b7a069a995feae6e0ad01dbe60a4da4f2f146fdc959" } ] }, @@ -1118,11 +1114,11 @@ "files": [ { "path": "GhostSprite.java", - "sha256": "0384d2d29fd627071a580ffdb91b3ebec648f6a210ba6bce3ffb7959941c3652" + "sha256": "cfd42ab8644f073f4a43ba8ee81c2b5138847cac785a4a6e54e71956d3bba6c8" }, { "path": "HalloweenStage.java", - "sha256": "74f1d0b11088cd27882e7fd07630ee581b40392781b2ba2542dc03b54bcc8dbb" + "sha256": "d5a3528a091191268c21d58784cb83edb8a8007be30f02b12c12cae088bb9956" }, { "path": "HouseSprite.java", @@ -1130,11 +1126,7 @@ }, { "path": "PumpkinSprite.java", - "sha256": "2437b012ead25f8fdcb8297c0e94b1bbc4ec37037226f5aa8b5113d669e8b27b" - }, - { - "path": "package.bluej", - "sha256": "a9623d91bd998d884124ed3815a659d2195e71377b797edba9b97a0afc15e558" + "sha256": "867d2776e5bfedd90195ff524d1c948863cdedc25174fac4564a06b8c64438d9" }, { "path": "sounds/background.wav", @@ -1210,40 +1202,6 @@ } ] }, - { - "id": "tutorial/bluej-starter", - "kind": "tutorial", - "source": "docs/archives/bluej-starter", - "libraryVersion": "6.5.0", - "flavour": "standard", - "requiredSheets": [], - "files": [ - { - "path": "Cat.java", - "sha256": "f5e71d1da4812c7810701eeaf23bc2d8bb455b8c8d607fa0ab04fcebd8df9f2b" - }, - { - "path": "MyStage.java", - "sha256": "5de0b930fc63f2aef2d4d7f7e3ce6a8d8ec82ee5a28898347799c48bbdc5e781" - }, - { - "path": "MyWindow.java", - "sha256": "8056b03a70774938863b829c750300549323c4287eb9f9e6350cd77ccb101005" - }, - { - "path": "assets/.gitkeep", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, - { - "path": "assets/cat.png", - "sha256": "0423f61671a086906d972b266241d557934f86bdb8ec5ad6f50b08f3474efa0f" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - ] - }, { "id": "tutorial/bouncy-hedgehog", "kind": "tutorial", @@ -1280,10 +1238,6 @@ "path": "hedgehog.png", "sha256": "731e677d38912bf339a16cda8c61035db1db52489c462181e9be4874bd310db7" }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, { "path": "playground.jpg", "sha256": "c68f76ab3c5ac54be427706d571cd5b268141c4448b88e7277ebae45c347f0dd" @@ -1330,10 +1284,6 @@ "path": "hedgehog.png", "sha256": "731e677d38912bf339a16cda8c61035db1db52489c462181e9be4874bd310db7" }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, { "path": "playground.jpg", "sha256": "c68f76ab3c5ac54be427706d571cd5b268141c4448b88e7277ebae45c347f0dd" @@ -1358,15 +1308,11 @@ }, { "path": "CatStage.java", - "sha256": "2e8b06a4b21eff0fd15b3c70eb1a9cfe25477942c7e1fe0365af0a9bb1bb889b" + "sha256": "8fe655126ec3bedcf3024c5842ad826125e2a80d06dd4a24111440ce2df4f013" }, { "path": "cat.png", "sha256": "0423f61671a086906d972b266241d557934f86bdb8ec5ad6f50b08f3474efa0f" - }, - { - "path": "package.bluej", - "sha256": "d18f1b5e976159b105ce08a72f95f98dffc64cec82f0d618460e73d710040604" } ] }, @@ -1400,10 +1346,6 @@ { "path": "README.md", "sha256": "7867d20f01bf95412d4b307e34210e9a62e0850b2db0eb7453a82c011deab634" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1424,7 +1366,7 @@ }, { "path": "Alien.java", - "sha256": "37fb2e8f845c81076e592f8b831d6406d8051b8f01b07c4e9a2eb68e6a8ed4b1" + "sha256": "e603e05427f46b8f19be76c0c10094864f91a8db63718218714ab03e4e0f306a" }, { "path": "DodgeWindow.java", @@ -1445,10 +1387,6 @@ { "path": "TitleStage.java", "sha256": "ed6dc9b799881aab876e0ee5a9413c02fade47cfd003ccd3935b68b8e6c04a69" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1478,10 +1416,6 @@ { "path": "README.md", "sha256": "1cf7971612162c7486cd95894fa740ec9f3e8f8268e01790ef5cb48ed37a0507" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1507,10 +1441,6 @@ { "path": "README.md", "sha256": "2e83410662b1d66e3b506bc668ecb59ee2651b9fe5344a1b16e0c43b6e0c6d27" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1539,11 +1469,7 @@ }, { "path": "Walker.java", - "sha256": "828b0d93d40e8a85ad0734028d86b867f4a36b401a283755cef5a25132a50c20" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "sha256": "8d9480e92d0c6e39ef1e63cf88d7c37b0e22881c667193758d9608e972694917" } ] }, @@ -1572,15 +1498,11 @@ }, { "path": "Racer.java", - "sha256": "e0b1d2de350f0a5db7ed66e13332a878d32aa18c47db4db1a88cc2a4ebbb88b9" + "sha256": "9e704919283ba0ae1dbe01a37b110e610f00fe030dca6d7d43722834942516fc" }, { "path": "Referee.java", - "sha256": "1586c6e111c8b3351d76b2940ee45c287797a457545681a6e61a141f65c55e3b" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "sha256": "1d979941352ba316da7065711957d988424821569e512e6e131f4cadcac2d992" } ] }, @@ -1602,15 +1524,11 @@ }, { "path": "Cat.java", - "sha256": "f5e71d1da4812c7810701eeaf23bc2d8bb455b8c8d607fa0ab04fcebd8df9f2b" + "sha256": "237a182186dc30651ce89a9c50f1a1e957119e69d4c7292405f06028d60ed35c" }, { "path": "MyStage.java", - "sha256": "5de0b930fc63f2aef2d4d7f7e3ce6a8d8ec82ee5a28898347799c48bbdc5e781" - }, - { - "path": "MyWindow.java", - "sha256": "8056b03a70774938863b829c750300549323c4287eb9f9e6350cd77ccb101005" + "sha256": "08e71423d91cb006266462d83d15142b9f9c695e0d7e8b259499aeb327c8b005" }, { "path": "assets/.gitkeep", diff --git a/catalogs/translations.json b/catalogs/translations.json index 4a4a41b7..89f21232 100644 --- a/catalogs/translations.json +++ b/catalogs/translations.json @@ -1,89 +1,4 @@ { - "AnimatedSprite/constructor()": { - "de": { - "description": "Erzeugt eine neue animierte Figur" - } - }, - "AnimatedSprite/constructor(AnimatedSprite)": { - "de": { - "description": "Erzeugt eine Kopie der angegebenen animierten Figur" - } - }, - "AnimatedSprite/clone()": { - "de": { - "description": "Erzeugt eine Kopie dieser Figur" - } - }, - "AnimatedSprite/toString()": { - "de": { - "description": "Gibt die Figur als Zeichenkette zurück" - } - }, - "AnimatedSprite/addAnimation(String,String,int)": { - "de": { - "description": "Fügt eine Animation hinzu. %d im Muster wird durch 1..frames ersetzt, z.B. bunny1_walk%d" - } - }, - "AnimatedSprite/addAnimation(String,String,int,int,int)": { - "de": { - "description": "Zerlegt ein Bild in gleich große Einzelbilder und legt daraus eine Animation an" - } - }, - "AnimatedSprite/addAnimation(String,String,int,int,int,int)": { - "de": { - "description": "Wie addAnimation(name, imagePath, frames, width, height), beginnt aber in der angegebenen Zeile" - } - }, - "AnimatedSprite/addAnimation(String,String,int,int,int,int,boolean)": { - "de": { - "description": "Legt eine Animation aus einer Spalte des Bildes an" - } - }, - "AnimatedSprite/addAnimation(String,Function,int)": { - "de": { - "description": "Legt eine Animation an; builder liefert zu 1..frames jeweils den Bildpfad" - } - }, - "AnimatedSprite/playAnimation(String)": { - "de": { - "description": "Spielt die Animation in einer Schleife ab" - } - }, - "AnimatedSprite/playAnimation(String,boolean)": { - "de": { - "description": "Spielt die Animation ab; bei once == true nur ein einziges Mal" - } - }, - "AnimatedSprite/resetAnimation()": { - "de": { - "description": "Setzt die Animation auf das erste Einzelbild zurück" - } - }, - "AnimatedSprite/setAnimationInterval(int)": { - "de": { - "description": "Legt fest, wie viele Millisekunden ein Einzelbild angezeigt wird" - } - }, - "AnimatedSprite/getAnimationInterval()": { - "de": { - "description": "Gibt zurück, wie viele Millisekunden ein Einzelbild angezeigt wird" - } - }, - "AnimatedSprite/getAnimationFrame()": { - "de": { - "description": "Gibt die Nummer des aktuellen Einzelbildes zurück" - } - }, - "AnimatedSprite/setAnimationFrame(int)": { - "de": { - "description": "Springt zum Einzelbild mit der angegebenen Nummer" - } - }, - "AnimatedSprite/isAnimationPlayed()": { - "de": { - "description": "Gibt genau dann true zurück, wenn eine mit once gestartete Animation durchgelaufen ist" - } - }, "Clock/getYear()": { "de": { "description": "Gibt das aktuelle Jahr zurück" @@ -129,61 +44,16 @@ "description": "Gibt die Anzahl der Tage seit dem 1. Januar 2000 zurück" } }, - "Color/constructor()": { - "de": { - "description": "Erzeugt die Farbe Weiß" - } - }, "Color/constructor(String)": { "de": { "description": "Erzeugt eine Farbe aus einem Hex-Code, z.B. #ff0000" } }, - "Color/constructor(double)": { - "de": { - "description": "Erzeugt eine Farbe mit dem angegebenen Farbton (0 bis 255)" - } - }, "Color/constructor(double,double,double)": { "de": { "description": "Erzeugt eine Farbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" } }, - "Color/constructor(Color)": { - "de": { - "description": "Erzeugt eine Kopie der übergebenen Farbe" - } - }, - "Color/get()": { - "de": { - "description": "Gibt die Farbe als ganze Zahl zurück" - } - }, - "Color/getHSB()": { - "de": { - "description": "Gibt den Farbton zurück (0 bis 255)" - } - }, - "Color/setHSB(double)": { - "de": { - "description": "Setzt den Farbton (0 bis 255)" - } - }, - "Color/setHSB(double,double,double)": { - "de": { - "description": "Setzt Farbton, Sättigung und Helligkeit (jeweils 0 bis 255)" - } - }, - "Color/setRGB(double,double,double)": { - "de": { - "description": "Setzt Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - }, - "Color/changeColor(double)": { - "de": { - "description": "Ändert den Farbton um den angegebenen Wert" - } - }, "Color/getRed()": { "de": { "description": "Gibt den Rotanteil zurück (0 bis 255)" @@ -199,21 +69,6 @@ "description": "Gibt den Blauanteil zurück (0 bis 255)" } }, - "Color/getH()": { - "de": { - "description": "Gibt den Farbton zurück (0 bis 255)" - } - }, - "Color/getS()": { - "de": { - "description": "Gibt die Sättigung zurück (0 bis 255)" - } - }, - "Color/getL()": { - "de": { - "description": "Gibt die Helligkeit zurück (0 bis 255)" - } - }, "Color/toString()": { "de": { "description": "Gibt die Farbe als Text aus" @@ -224,46 +79,6 @@ "description": "Prüft, ob es dieselbe Farbe ist" } }, - "Hitbox/constructor(double[],double[])": { - "de": { - "description": "Erzeugt einen Umriss aus x- und y-Koordinaten" - } - }, - "Hitbox/constructor(Shape)": { - "de": { - "description": "Erzeugt einen Umriss aus einer Form" - } - }, - "Hitbox/getShape()": { - "de": { - "description": "Gibt den Umriss als Form zurück" - } - }, - "Hitbox/translateAndRotateAndResize(double,double,double,double,double,double)": { - "de": { - "description": "Verschiebt, dreht und skaliert den Umriss" - } - }, - "Hitbox/contains(double,double)": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Punkt im Umriss liegt" - } - }, - "Hitbox/getBounds()": { - "de": { - "description": "Gibt das umschließende Rechteck zurück" - } - }, - "Hitbox/intersects(Hitbox)": { - "de": { - "description": "Gibt genau dann true zurück, wenn sich beide Umrisse überlappen" - } - }, - "HtmlColor/constructor()": { - "de": { - "description": "Gibt eine zufällige der benannten Farben zurück" - } - }, "Operators/lerp(double,double,double)": { "de": { "description": "Interpoliert linear zwischen start und stop; amt liegt zwischen 0 und 1" @@ -384,11 +199,6 @@ "description": "Erzeugt einen neuen Stift" } }, - "Pen/constructor(Sprite)": { - "de": { - "description": "Senkt den Stift ab, so dass er beim Bewegen zeichnet" - } - }, "Pen/up()": { "de": { "description": "Hebt den Stift an, so dass er nicht mehr zeichnet" @@ -444,21 +254,6 @@ "description": "Ändert die Deckkraft um den angegebenen Wert" } }, - "Pen/goToBackground()": { - "de": { - "description": "Zeichnet hinter den Figuren" - } - }, - "Pen/goToForeground()": { - "de": { - "description": "Zeichnet vor den Figuren" - } - }, - "Pen/isInBackground()": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Stift hinter den Figuren zeichnet" - } - }, "Pen/goToRandomPosition()": { "de": { "description": "Setzt den Stift an eine zufällige Position der Bühne" @@ -634,11 +429,6 @@ "description": "Erzeugt eine Figur mit einem ersten Kostüm" } }, - "Sprite/constructor(Sprite)": { - "de": { - "description": "Erzeugt eine Kopie der angegebenen Figur" - } - }, "Sprite/run()": { "de": { "description": "Wird in jedem Frame aufgerufen" @@ -694,21 +484,11 @@ "description": "Zeigt eine Sprechblase an" } }, - "Sprite/say(String,int)": { - "de": { - "description": "Zeigt eine Sprechblase für die angegebene Zeit in Millisekunden" - } - }, "Sprite/think(String)": { "de": { "description": "Zeigt eine Denkblase an" } }, - "Sprite/think(String,int)": { - "de": { - "description": "Zeigt eine Denkblase für die angegebene Zeit in Millisekunden" - } - }, "Sprite/addCostume(String)": { "de": { "description": "Fügt eines der eingebauten Kostüme hinzu" @@ -809,11 +589,6 @@ "description": "Bewegt die Figur um die angegebene Schrittzahl in ihre Blickrichtung" } }, - "Sprite/move(Vector2)": { - "de": { - "description": "Verschiebt die Figur um den Vektor" - } - }, "Sprite/setPosition(double,double)": { "de": { "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" @@ -909,36 +684,16 @@ "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" } }, - "Sprite/setDirection(Vector2)": { - "de": { - "description": "Setzt die Blickrichtung auf die Richtung des Vektors" - } - }, "Sprite/goToSprite(Sprite)": { "de": { "description": "Setzt die Figur auf die Position einer anderen Figur" } }, - "Sprite/pointInDirection(double)": { - "de": { - "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" - } - }, - "Sprite/pointInDirection(Vector2)": { - "de": { - "description": "Richtet die Figur entlang des angegebenen Vektors aus" - } - }, "Sprite/pointTowardsMousePointer()": { "de": { "description": "Richtet die Figur zum Mauszeiger aus" } }, - "Sprite/pointTowardsSprite(Sprite)": { - "de": { - "description": "Richtet die Figur zu einer anderen Figur aus" - } - }, "Sprite/getDirection()": { "de": { "description": "Gibt die Blickrichtung in Grad zurück (90 = rechts, 0 = oben)" @@ -1014,21 +769,11 @@ "description": "Färbt die Figur mit der angegebenen Farbe ein" } }, - "Sprite/setTint(double)": { - "de": { - "description": "Färbt die Figur mit dem angegebenen Farbton ein (0 bis 255)" - } - }, "Sprite/setTint(double,double,double)": { "de": { "description": "Färbt die Figur mit der angegebenen Farbe ein (Anteile jeweils 0 bis 255)" } }, - "Sprite/changeTint(double)": { - "de": { - "description": "Ändert den Farbton der Einfärbung um den angegebenen Wert" - } - }, "Sprite/getTint()": { "de": { "description": "Gibt die Farbe der Einfärbung zurück" @@ -1164,11 +909,6 @@ "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" } }, - "Sprite/getDeltaTime()": { - "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" - } - }, "Sprite/getText()": { "de": { "description": "Gibt den Text zurück, der über der Figur angezeigt wird" @@ -1179,11 +919,6 @@ "description": "Gibt den Standard-Timer dieser Figur zurück" } }, - "Sprite/getTimer(String)": { - "de": { - "description": "Gibt den Timer mit dem angegebenen Namen zurück und legt ihn bei Bedarf an" - } - }, "Sprite/setHitbox(Shape)": { "de": { "description": "Setzt die Trefferfläche auf die angegebene Form; (0/0) ist die Mitte der Figur" @@ -1269,11 +1004,6 @@ "description": "Wird bei einem Mausklick aufgerufen" } }, - "Stage/whenMouseWheelMoved(int)": { - "de": { - "description": "Wird beim Drehen des Mausrads aufgerufen" - } - }, "Stage/whenBackdropSwitches(String)": { "de": { "description": "Wird beim Wechsel des Hintergrunds aufgerufen" @@ -1429,11 +1159,6 @@ "description": "Gibt die Lautstärke in Prozent zurück" } }, - "Stage/setColor(double)": { - "de": { - "description": "Setzt die Hintergrundfarbe über den Farbton (0 bis 255)" - } - }, "Stage/setColor(double,double,double)": { "de": { "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" @@ -1449,31 +1174,11 @@ "description": "Gibt die Hintergrundfarbe zurück" } }, - "Stage/changeColor(double)": { - "de": { - "description": "Ändert den Farbton des Hintergrunds um den angegebenen Wert" - } - }, "Stage/getCamera()": { "de": { "description": "Gibt die Kamera der Bühne zurück" } }, - "Stage/setTint(double,double,double)": { - "de": { - "description": "Färbt den Hintergrund ein (Anteile jeweils 0 bis 255)" - } - }, - "Stage/setTint(double)": { - "de": { - "description": "Färbt den Hintergrund mit dem angegebenen Farbton ein (0 bis 255)" - } - }, - "Stage/changeTint(double)": { - "de": { - "description": "Ändert den Farbton der Einfärbung um den angegebenen Wert" - } - }, "Stage/setTransparency(double)": { "de": { "description": "Setzt die Transparenz des Hintergrunds in Prozent" @@ -1484,26 +1189,11 @@ "description": "Ändert die Transparenz des Hintergrunds" } }, - "Stage/setDebug(boolean)": { - "de": { - "description": "Schaltet die Ausgabe von debug() ein oder aus" - } - }, - "Stage/isDebug()": { - "de": { - "description": "Gibt genau dann true zurück, wenn die Fehlersuche eingeschaltet ist" - } - }, "Stage/waitUntil(BooleanSupplier)": { "de": { "description": "Wartet, bis die Bedingung erfüllt ist" } }, - "Stage/exit()": { - "de": { - "description": "Beendet das Programm" - } - }, "Stage/setCursor(String)": { "de": { "description": "Setzt das Mauszeigerbild" @@ -1514,21 +1204,11 @@ "description": "Setzt das Mauszeigerbild mit eigenem Aktivpunkt" } }, - "Stage/getPixels()": { - "de": { - "description": "Nur in der Desktop-Version: Zugriff auf einzelne Bildpunkte" - } - }, "Stage/getShaders()": { "de": { "description": "Gibt die Shader der Bühne zurück; sie verändern das ganze Bild ohne die UI" } }, - "Stage/getSorting()": { - "de": { - "description": "Gibt die Sortierung der Bühne zurück. Mit getSorting().byY() werden Figuren weiter unten vor denen weiter oben gezeichnet." - } - }, "Stage/getWidth()": { "de": { "description": "Gibt die Breite der Bühne in Pixeln zurück" @@ -1569,21 +1249,6 @@ "description": "Gibt den Standard-Timer der Bühne zurück" } }, - "Stage/getTimer(String)": { - "de": { - "description": "Gibt den Timer mit dem angegebenen Namen zurück und legt ihn bei Bedarf an" - } - }, - "Stage/getDeltaTime()": { - "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" - } - }, - "Stage/getFrameRate()": { - "de": { - "description": "Gibt die aktuelle Bildrate zurück" - } - }, "Stage/eraseAll()": { "de": { "description": "Löscht alles, was mit Stiften gezeichnet wurde" @@ -1594,16 +1259,6 @@ "description": "Zeigt einen Text am unteren Rand der Bühne an" } }, - "Stage/display(String,int)": { - "de": { - "description": "Zeigt einen Text für die angegebene Zeit in Millisekunden an" - } - }, - "Stage/wait(int)": { - "de": { - "description": "Pausiert das Programm für die angegebene Zeit in Millisekunden" - } - }, "Stage/ask(String)": { "de": { "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" @@ -1629,11 +1284,6 @@ "description": "Erzeugt einen leeren Text in der Mitte der Bühne" } }, - "Text/constructor(Sprite)": { - "de": { - "description": "Erzeugt einen Text an der angegebenen Position mit der angegebenen Breite" - } - }, "Text/constructor(String,double,double,double,TextStyle)": { "de": { "description": "Erzeugt einen Text an der angegebenen Position, mit der angegebenen Breite und im angegebenen Stil" @@ -1644,11 +1294,6 @@ "description": "Zeigt den Text an" } }, - "Text/showText(String,int)": { - "de": { - "description": "Zeigt den Text für die angegebene Zeit in Millisekunden an" - } - }, "Text/setPosition(double,double)": { "de": { "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" @@ -1684,46 +1329,16 @@ "description": "Gibt die y-Position zurück" } }, - "Text/setTextColor(int,int,int)": { - "de": { - "description": "Setzt die Schriftfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - }, - "Text/setTextColor(double)": { - "de": { - "description": "Setzt die Schriftfarbe über den Farbton (0 bis 255)" - } - }, "Text/setTextColor(Color)": { "de": { "description": "Setzt die Schriftfarbe" } }, - "Text/setBackgroundColor(int,int,int)": { - "de": { - "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - }, - "Text/setBackgroundColor(double)": { - "de": { - "description": "Setzt die Hintergrundfarbe über den Farbton (0 bis 255)" - } - }, "Text/setBackgroundColor(Color)": { "de": { "description": "Setzt die Hintergrundfarbe" } }, - "Text/setStrokeColor(int,int,int)": { - "de": { - "description": "Setzt die Rahmenfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - }, - "Text/setStrokeColor(double)": { - "de": { - "description": "Setzt die Rahmenfarbe über den Farbton (0 bis 255)" - } - }, "Text/setStrokeColor(Color)": { "de": { "description": "Setzt die Rahmenfarbe" @@ -1764,11 +1379,6 @@ "description": "Gibt den Namen der aktuellen Schriftart zurück" } }, - "Text/setTextSize(int)": { - "de": { - "description": "Setzt die Schriftgröße" - } - }, "Text/getTextSize()": { "de": { "description": "Gibt die Schriftgröße zurück" @@ -1829,16 +1439,6 @@ "description": "Schiebt den Text um die angegebene Anzahl Ebenen nach hinten" } }, - "Text/isUI()": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Text zur Benutzeroberfläche gehört" - } - }, - "Text/setIsUI(boolean)": { - "de": { - "description": "Legt fest, ob der Text zur Benutzeroberfläche gehört und sich nicht mit der Kamera bewegt" - } - }, "Text/getStage()": { "de": { "description": "Gibt die Bühne zurück, auf der der Text liegt" @@ -1849,21 +1449,11 @@ "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" } }, - "Text/whenAddedToStage(Stage)": { - "de": { - "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" - } - }, "Text/whenRemovedFromStage()": { "de": { "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" } }, - "Text/whenRemovedFromStage(Stage)": { - "de": { - "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" - } - }, "Text/getDefaultFont()": { "de": { "description": "Gibt die Standardschriftart zurück" @@ -1874,21 +1464,11 @@ "description": "Gibt die Standardschriftgröße zurück" } }, - "Text/useFont(String,int)": { - "de": { - "description": "Legt Schriftart und -größe für alle Texte fest" - } - }, "Text/useFont(String)": { "de": { "description": "Legt die Schriftart für alle Texte fest" } }, - "Text/useSmoothing(boolean)": { - "de": { - "description": "Legt fest, ob Schrift geglättet wird" - } - }, "Timer/constructor()": { "de": { "description": "Erzeugt einen neuen Timer" @@ -1899,81 +1479,6 @@ "description": "Setzt den Timer auf 0 zurück" } }, - "Timer/millis()": { - "de": { - "description": "Gibt die seit dem Programmstart vergangenen Millisekunden zurück" - } - }, - "Timer/everyMillis(int)": { - "de": { - "description": "Gibt alle millis Millisekunden einmal true zurück" - } - }, - "Timer/forMillis(int)": { - "de": { - "description": "Gibt für die ersten millis Millisekunden nach dem Zurücksetzen true zurück" - } - }, - "Timer/afterMillis(int)": { - "de": { - "description": "Gibt true zurück, sobald seit dem Zurücksetzen millis Millisekunden vergangen sind" - } - }, - "Timer/intervalMillis(int)": { - "de": { - "description": "Wechselt alle millis Millisekunden zwischen true und false" - } - }, - "Timer/intervalMillis(int,boolean)": { - "de": { - "description": "Wechselt alle millis Millisekunden zwischen true und false; skipFirst überspringt das erste Intervall" - } - }, - "Timer/intervalMillis(int,int)": { - "de": { - "description": "Gibt millis1 Millisekunden lang true und danach millis2 Millisekunden lang false zurück" - } - }, - "Timer/intervalMillis(int,int,boolean)": { - "de": { - "description": "Gibt millis1 Millisekunden lang true und danach millis2 Millisekunden lang false zurück; skipFirst überspringt das erste Intervall" - } - }, - "UISprite/constructor()": { - "de": { - "description": "Erzeugt eine neue UI-Figur" - } - }, - "UISprite/setWidth(double)": { - "de": { - "description": "Setzt die Breite in Pixeln" - } - }, - "UISprite/setHeight(double)": { - "de": { - "description": "Setzt die Höhe in Pixeln" - } - }, - "UISprite/changeWidth(double)": { - "de": { - "description": "Ändert die Breite um die angegebene Anzahl Pixel" - } - }, - "UISprite/changeHeight(double)": { - "de": { - "description": "Ändert die Höhe um die angegebene Anzahl Pixel" - } - }, - "UISprite/setNineSlice(int,int,int,int)": { - "de": { - "description": "Hält die Ecken und Ränder des Kostüms beim Skalieren fest (Nine-Slice)" - } - }, - "UISprite/disableNineSlice()": { - "de": { - "description": "Lässt das ganze Kostüm wieder mitskalieren" - } - }, "Vector2/constructor()": { "de": { "description": "Erzeugt den Nullvektor" @@ -2129,11 +1634,6 @@ "description": "Gibt die Höhe des Fensters in Pixeln zurück" } }, - "Window/getDeltaTime()": { - "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" - } - }, "Window/pause()": { "de": { "description": "Gibt die Bühne zurück, die gerade angezeigt wird" @@ -2144,11 +1644,6 @@ "description": "Zeigt die angegebene Bühne an" } }, - "Window/transitionToStage(Stage,int)": { - "de": { - "description": "Blendet über Schwarz zur angegebenen Bühne über" - } - }, "Window/setDebug(boolean)": { "de": { "description": "Schaltet die Ausgabe von debug() ein oder aus" @@ -2184,16 +1679,6 @@ "description": "Nur in der Desktop-Version: startet im Vollbild" } }, - "Window/useTextureSampling(TextureSampling)": { - "de": { - "description": "Legt fest, wie Bilder beim Vergrößern und Verkleinern geglättet werden. TextureSampling.POINT hält Pixelgrafik scharf, LINEAR (Standard) glättet. BILINEAR und TRILINEAR wirken im Browser wie LINEAR." - } - }, - "Window/getTextureSampling()": { - "de": { - "description": "Gibt das eingestellte Glättungsverfahren zurück" - } - }, "Window/useSplashLogo(String)": { "de": { "description": "Nur in der Desktop-Version: zeigt beim Start ein Logo" diff --git a/compatibility/browser-api.json b/compatibility/browser-api.json index 838fa969..79417dad 100644 --- a/compatibility/browser-api.json +++ b/compatibility/browser-api.json @@ -1,186 +1,151 @@ { "standard": { - "org.openpatch.scratch.AnimatedSprite": [ + "org.openpatch.scratch.Bounds": [ { - "name": "AnimatedSprite", + "name": "Bounds", "constructor": true, "static": false, "parameters": [ - "org.openpatch.scratch.AnimatedSprite" + "double", + "double", + "double", + "double" ], - "returns": "org.openpatch.scratch.AnimatedSprite" + "returns": "org.openpatch.scratch.Bounds" }, { - "name": "AnimatedSprite", - "constructor": true, + "name": "equals", + "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.AnimatedSprite" + "parameters": [ + "Object" + ], + "returns": "boolean" }, { - "name": "act", + "name": "hashCode", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "int" }, { - "name": "act", + "name": "height", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "addAnimation", + "name": "intersects", "constructor": false, "static": false, "parameters": [ - "String", - "Function", - "int" + "org.openpatch.scratch.Bounds" ], - "returns": "void" + "returns": "boolean" }, { - "name": "addAnimation", + "name": "toString", "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int", - "boolean" - ], - "returns": "void" + "parameters": [], + "returns": "String" }, { - "name": "addAnimation", + "name": "width", "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "addAnimation", + "name": "x", "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "addAnimation", + "name": "y", "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "double" + } + ], + "org.openpatch.scratch.Camera": [ + { + "name": "Camera", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Camera" }, { - "name": "addCostume", + "name": "changeX", "constructor": false, "static": false, "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int" + "double" ], "returns": "void" }, { - "name": "addCostume", + "name": "changeY", "constructor": false, "static": false, "parameters": [ - "String", - "String" + "double" ], "returns": "void" }, { - "name": "addCostume", + "name": "changeZoom", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], "returns": "void" }, { - "name": "addCostumes", + "name": "getPosition", "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "int", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "addSound", + "name": "getX", "constructor": false, "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "addSound", + "name": "getY", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "ask", + "name": "getZoom", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "broadcast", + "name": "resetZoom", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "void" }, { - "name": "changePosition", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ @@ -190,7 +155,7 @@ "returns": "void" }, { - "name": "changePosition", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ @@ -199,7 +164,7 @@ "returns": "void" }, { - "name": "changeSize", + "name": "setX", "constructor": false, "static": false, "parameters": [ @@ -208,7 +173,7 @@ "returns": "void" }, { - "name": "changeTint", + "name": "setY", "constructor": false, "static": false, "parameters": [ @@ -217,7 +182,7 @@ "returns": "void" }, { - "name": "changeTransparency", + "name": "setZoom", "constructor": false, "static": false, "parameters": [ @@ -226,12429 +191,914 @@ "returns": "void" }, { - "name": "changeVolume", + "name": "setZoomLimit", "constructor": false, "static": false, "parameters": [ + "double", "double" ], "returns": "void" }, { - "name": "changeX", + "name": "toScreenPosition", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Vector2" ], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "changeY", + "name": "toScreenX", "constructor": false, "static": false, "parameters": [ "double" ], - "returns": "void" + "returns": "double" }, { - "name": "clone", + "name": "toScreenY", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.AnimatedSprite" + "parameters": [ + "double" + ], + "returns": "double" }, { - "name": "clone", + "name": "toWorldPosition", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Sprite" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "debug", + "name": "toWorldX", "constructor": false, "static": false, "parameters": [ - "Object[]" + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "deleteThisClone", + "name": "toWorldY", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double" + ], + "returns": "double" + } + ], + "org.openpatch.scratch.Circle": [ + { + "name": "Circle", + "constructor": true, + "static": false, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Circle" }, { - "name": "destroy", + "name": "contains", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double", + "double" + ], + "returns": "boolean" }, { - "name": "disableHitbox", + "name": "getBounds", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Bounds" }, { - "name": "distanceToMousePointer", + "name": "getPoints", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "double[]" }, { - "name": "distanceToSprite", + "name": "intersects", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "org.openpatch.scratch.Shape" ], - "returns": "double" + "returns": "boolean" }, { - "name": "enableHitbox", + "name": "rotate", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape" }, { - "name": "equals", + "name": "scale", "constructor": false, "static": false, "parameters": [ - "Object" + "double", + "double" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "getAnimationFrame", + "name": "translate", "constructor": false, "static": false, - "parameters": [], - "returns": "int" - }, + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape" + } + ], + "org.openpatch.scratch.Clock": [ { - "name": "getAnimationInterval", + "name": "getDay", "constructor": false, - "static": false, + "static": true, "parameters": [], "returns": "int" }, { - "name": "getAnswer", + "name": "getDayOfWeek", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "String" + "returns": "int" }, { - "name": "getClass", + "name": "getDaysSince2000", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "Class" + "returns": "int" }, { - "name": "getCurrentCostumeIndex", + "name": "getHour", "constructor": false, - "static": false, + "static": true, "parameters": [], "returns": "int" }, { - "name": "getCurrentCostumeName", + "name": "getMillisecond", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "String" + "returns": "int" }, { - "name": "getDeltaTime", + "name": "getMinute", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "double" + "returns": "int" }, { - "name": "getDirection", + "name": "getMonth", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "double" - }, - { - "name": "getGamepadAxisValue", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "double" + "returns": "int" }, { - "name": "getHeight", + "name": "getSecond", "constructor": false, - "static": false, + "static": true, "parameters": [], "returns": "int" }, { - "name": "getHitbox", + "name": "getYear", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "org.openpatch.scratch.Hitbox" - }, + "returns": "int" + } + ], + "org.openpatch.scratch.Color": [ { - "name": "getMouse", - "constructor": false, + "name": "Color", + "constructor": true, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "parameters": [ + "String" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "getMouseX", - "constructor": false, + "name": "Color", + "constructor": true, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double", + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "getMouseY", - "constructor": false, + "name": "Color", + "constructor": true, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "getPen", + "name": "equals", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Pen" + "parameters": [ + "Object" + ], + "returns": "boolean" }, { - "name": "getPosition", + "name": "fromARGB", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "static": true, + "parameters": [ + "int" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "getShaders", + "name": "fromHSB", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" + "static": true, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "getSize", + "name": "getAlpha", "constructor": false, "static": false, "parameters": [], "returns": "double" }, { - "name": "getStage", + "name": "getBlue", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Stage" + "returns": "double" }, { - "name": "getText", + "name": "getBrightness", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Text" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.Timer" + "returns": "double" }, { - "name": "getTimer", + "name": "getGreen", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Timer" + "returns": "double" }, { - "name": "getTint", + "name": "getHue", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "getTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "T@197 extends org.openpatch.scratch.Sprite" - }, - { - "name": "getTouchingSprites", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "List" + "returns": "double" }, { - "name": "getTransparency", + "name": "getRed", "constructor": false, "static": false, "parameters": [], "returns": "double" }, { - "name": "getVolume", + "name": "getSaturation", "constructor": false, "static": false, "parameters": [], "returns": "double" }, { - "name": "getWidth", + "name": "hashCode", "constructor": false, "static": false, "parameters": [], "returns": "int" }, { - "name": "getX", + "name": "toARGB", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "int" }, { - "name": "getY", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "String" }, { - "name": "glide", + "name": "withAlpha", "constructor": false, "static": false, "parameters": [ - "double", - "double", "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { - "name": "goLayersBackwards", + "name": "withBlue", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { - "name": "goLayersForwards", + "name": "withBrightness", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], - "returns": "void" - }, - { - "name": "goToBackLayer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { - "name": "goToFrontLayer", + "name": "withGreen", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "goToMousePointer", + "name": "withHue", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "goToRandomPosition", + "name": "withRed", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "goToSprite", + "name": "withSaturation", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double" ], - "returns": "void" - }, + "returns": "org.openpatch.scratch.Color" + } + ], + "org.openpatch.scratch.Ellipse": [ { - "name": "hide", - "constructor": false, + "name": "Ellipse", + "constructor": true, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double", + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Ellipse" }, { - "name": "hideVariable", + "name": "contains", "constructor": false, "static": false, "parameters": [ - "String" + "double", + "double" ], - "returns": "void" + "returns": "boolean" }, { - "name": "ifOnEdgeBounce", + "name": "getBounds", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Bounds" }, { - "name": "isActing", + "name": "getPoints", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "double[]" }, { - "name": "isAnimationPlayed", + "name": "intersects", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Shape" + ], "returns": "boolean" }, { - "name": "isAsking", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isColorTouchingColor", + "name": "rotate", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" + "double", + "double", + "double" ], - "returns": "boolean" - }, - { - "name": "isDestroyed", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "isGamepadButtonDown", + "name": "scale", "constructor": false, "static": false, "parameters": [ - "int", - "int" + "double", + "double" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "isGamepadConnected", + "name": "translate", "constructor": false, "static": false, "parameters": [ - "int" + "double", + "double" ], - "returns": "boolean" - }, + "returns": "org.openpatch.scratch.Shape" + } + ], + "org.openpatch.scratch.HtmlColor": [ { - "name": "isGliding", + "name": "getRandom", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "boolean" - }, - { - "name": "isKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "boolean" - }, + "returns": "org.openpatch.scratch.Color" + } + ], + "org.openpatch.scratch.KeyCode": [ { - "name": "isKeyUp", + "name": "valueOf", "constructor": false, - "static": false, + "static": true, "parameters": [ "String" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.KeyCode" }, { - "name": "isMouseDown", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "boolean" - }, + "returns": "org.openpatch.scratch.KeyCode[]" + } + ], + "org.openpatch.scratch.Layer": [ { - "name": "isSoundPlaying", + "name": "valueOf", "constructor": false, - "static": false, + "static": true, "parameters": [ "String" ], - "returns": "boolean" - }, - { - "name": "isTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "isTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "boolean" - }, - { - "name": "isTouchingEdge", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" + "returns": "org.openpatch.scratch.Layer" }, { - "name": "isTouchingMousePointer", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "boolean" - }, - { - "name": "isTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "boolean" - }, + "returns": "org.openpatch.scratch.Layer[]" + } + ], + "org.openpatch.scratch.MouseCode": [ { - "name": "isTouchingSprite", + "name": "valueOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Sprite" + "String" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.MouseCode" }, { - "name": "isVisible", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "boolean" - }, + "returns": "org.openpatch.scratch.MouseCode[]" + } + ], + "org.openpatch.scratch.Operators": [ { - "name": "move", + "name": "absOf", "constructor": false, - "static": false, + "static": true, "parameters": [ "double" ], - "returns": "void" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "nextCostume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "onKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "onKeyTyped", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "onKeyUp", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "returns": "double" }, { - "name": "pickRandom", + "name": "absOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "int", "int" ], "returns": "int" }, { - "name": "playAnimation", - "constructor": false, - "static": false, - "parameters": [ - "String", - "boolean" - ], - "returns": "void" - }, - { - "name": "playAnimation", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "playSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "playSoundCopy", + "name": "acosOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String", "double" ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" + "returns": "double" }, { - "name": "pointInDirection", + "name": "asinOf", "constructor": false, - "static": false, + "static": true, "parameters": [ "double" ], - "returns": "void" - }, - { - "name": "pointInDirection", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "pointTowardsMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "pointTowardsSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, - { - "name": "previousCostume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "resetAnimation", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "restartActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "run", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "say", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "say", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "setActFrequency", - "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "setAnimationFrame", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "setAnimationInterval", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "setDirection", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setDirection", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setHitbox", - "constructor": false, - "static": false, - "parameters": [ - "double[]" - ], - "returns": "void" - }, - { - "name": "setHitbox", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setRotationCenter", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setRotationStyle", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.RotationStyle" - ], - "returns": "void" - }, - { - "name": "setSize", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "setTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "show", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "showVariable", - "constructor": false, - "static": false, - "parameters": [ - "String", - "java.util.function.Supplier" - ], - "returns": "void" - }, - { - "name": "stamp", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Layer" - ], - "returns": "void" - }, - { - "name": "stamp", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopAllSounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchCostume", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchCostume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "think", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "think", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "turnLeft", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "turnRight", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenAddedToStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenBackdropSwitches", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenClicked", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenIReceive", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenKeyReleased", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenMouseClicked", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.MouseCode" - ], - "returns": "void" - }, - { - "name": "whenMouseMoved", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "whenRemovedFromStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenStartsAsClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Bounds": [ - { - "name": "Bounds", - "constructor": true, - "static": false, - "parameters": [ - "double", - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Bounds" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "height", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "intersects", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Bounds" - ], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "width", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "x", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "y", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - } - ], - "org.openpatch.scratch.Circle": [ - { - "name": "Circle", - "constructor": true, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Circle" - }, - { - "name": "contains", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getBounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "intersects", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "rotate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "scale", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "translate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Clock": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getDay", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getDayOfWeek", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getDaysSince2000", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getHour", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getMillisecond", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getMinute", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getMonth", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getSecond", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getYear", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Color": [ - { - "name": "Color", - "constructor": true, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "Color", - "constructor": true, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "Color", - "constructor": true, - "static": false, - "parameters": [ - "double" - ], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "Color", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "Color", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "changeColor", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "get", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getBlue", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getGreen", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getH", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getHSB", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getL", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getRed", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getS", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "hashCode", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "setHSB", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setHSB", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setRGB", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Ellipse": [ - { - "name": "Ellipse", - "constructor": true, - "static": false, - "parameters": [ - "double", - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Ellipse" - }, - { - "name": "contains", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getBounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "intersects", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "rotate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "scale", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "translate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Hitbox": [ - { - "name": "Hitbox", - "constructor": true, - "static": false, - "parameters": [ - "double[]", - "double[]" - ], - "returns": "org.openpatch.scratch.Hitbox" - }, - { - "name": "Hitbox", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "org.openpatch.scratch.Hitbox" - }, - { - "name": "contains", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "drawDebug", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "drawShape", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getBounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getShape", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "intersects", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Hitbox" - ], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "translateAndRotateAndResize", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double", - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.HtmlColor": [ - { - "name": "HtmlColor", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.HtmlColor" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getRandom", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.KeyCode": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "name", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "ordinal", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "valueOf", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.KeyCode" - }, - { - "name": "values", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.KeyCode[]" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Layer": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "name", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "ordinal", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "valueOf", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.Layer" - }, - { - "name": "values", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.Layer[]" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.MouseCode": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "name", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "ordinal", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "valueOf", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.MouseCode" - }, - { - "name": "values", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.MouseCode[]" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Operators": [ - { - "name": "absOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "absOf", - "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "int" - }, - { - "name": "acosOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "asinOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "atanOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "ceilingOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "constrain", - "constructor": false, - "static": true, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "double" - }, - { - "name": "constrain", - "constructor": false, - "static": true, - "parameters": [ - "int", - "int", - "int" - ], - "returns": "int" - }, - { - "name": "cosOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "eToThePowerOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "floorOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "lerp", - "constructor": false, - "static": true, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "double" - }, - { - "name": "lnOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "logOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "map", - "constructor": false, - "static": true, - "parameters": [ - "double", - "double", - "double", - "double", - "double" - ], - "returns": "double" - }, - { - "name": "max", - "constructor": false, - "static": true, - "parameters": [ - "double[]" - ], - "returns": "double" - }, - { - "name": "max", - "constructor": false, - "static": true, - "parameters": [ - "int[]" - ], - "returns": "int" - }, - { - "name": "min", - "constructor": false, - "static": true, - "parameters": [ - "double[]" - ], - "returns": "double" - }, - { - "name": "min", - "constructor": false, - "static": true, - "parameters": [ - "int[]" - ], - "returns": "int" - }, - { - "name": "mod", - "constructor": false, - "static": true, - "parameters": [ - "double", - "double" - ], - "returns": "double" - }, - { - "name": "mod", - "constructor": false, - "static": true, - "parameters": [ - "int", - "int" - ], - "returns": "int" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "round", - "constructor": false, - "static": true, - "parameters": [ - "double", - "int" - ], - "returns": "double" - }, - { - "name": "round", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "int" - }, - { - "name": "sinOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "sqrtOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "tanOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "tenToThePowerOf", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Pen": [ - { - "name": "Pen", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Pen" - ], - "returns": "org.openpatch.scratch.Pen" - }, - { - "name": "Pen", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "org.openpatch.scratch.Pen" - }, - { - "name": "Pen", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Pen" - }, - { - "name": "addedToStage", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void" - }, - { - "name": "changeColor", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeSize", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "down", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "eraseAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getColor", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "getSize", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "goToBackground", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToForeground", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToRandomPosition", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "isInBackground", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "removedFromStage", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void" - }, - { - "name": "setColor", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setColor", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setSize", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "stamp", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "up", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Polygon": [ - { - "name": "Polygon", - "constructor": true, - "static": false, - "parameters": [ - "double[]", - "double[]" - ], - "returns": "org.openpatch.scratch.Polygon" - }, - { - "name": "Polygon", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Polygon" - }, - { - "name": "addPoint", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "contains", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getBounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "intersects", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "rotate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "scale", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "translate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Random": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "noise", - "constructor": false, - "static": true, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "double" - }, - { - "name": "noise", - "constructor": false, - "static": true, - "parameters": [ - "double", - "double" - ], - "returns": "double" - }, - { - "name": "noise", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "noiseSeed", - "constructor": false, - "static": true, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "random", - "constructor": false, - "static": true, - "parameters": [ - "double", - "double" - ], - "returns": "double" - }, - { - "name": "random", - "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "random", - "constructor": false, - "static": true, - "parameters": [], - "returns": "double" - }, - { - "name": "randomInt", - "constructor": false, - "static": true, - "parameters": [ - "int", - "int" - ], - "returns": "int" - }, - { - "name": "randomInt", - "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "int" - }, - { - "name": "randomPosition", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "randomSeed", - "constructor": false, - "static": true, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "randomVector2", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "randomX", - "constructor": false, - "static": true, - "parameters": [], - "returns": "double" - }, - { - "name": "randomY", - "constructor": false, - "static": true, - "parameters": [], - "returns": "double" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Rectangle": [ - { - "name": "Rectangle", - "constructor": true, - "static": false, - "parameters": [ - "double", - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Rectangle" - }, - { - "name": "contains", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getBounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "intersects", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "rotate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "scale", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "translate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.RotationStyle": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "name", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "ordinal", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "valueOf", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.RotationStyle" - }, - { - "name": "values", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.RotationStyle[]" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.ScratchException": [ - { - "name": "ScratchException", - "constructor": true, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.ScratchException" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getMessage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Shape": [ - { - "name": "contains", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getBounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "intersects", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "rotate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "scale", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "translate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Sprite": [ - { - "name": "Sprite", - "constructor": true, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "org.openpatch.scratch.Sprite" - }, - { - "name": "Sprite", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "org.openpatch.scratch.Sprite" - }, - { - "name": "Sprite", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Sprite" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "addCostumes", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "ask", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "broadcast", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "changePosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "changePosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "changeSize", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTint", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "clone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Sprite" - }, - { - "name": "debug", - "constructor": false, - "static": false, - "parameters": [ - "Object[]" - ], - "returns": "void" - }, - { - "name": "deleteThisClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "destroy", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "disableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "distanceToMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "distanceToSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "double" - }, - { - "name": "enableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getAnswer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getCurrentCostumeIndex", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getCurrentCostumeName", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getDeltaTime", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getDirection", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getGamepadAxisValue", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "double" - }, - { - "name": "getHeight", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Hitbox" - }, - { - "name": "getMouse", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getMouseX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getMouseY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getPen", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Pen" - }, - { - "name": "getPosition", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getShaders", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" - }, - { - "name": "getSize", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" - }, - { - "name": "getText", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Text" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.Timer" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Timer" - }, - { - "name": "getTint", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "getTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "T@197 extends org.openpatch.scratch.Sprite" - }, - { - "name": "getTouchingSprites", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "List" - }, - { - "name": "getTransparency", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getVolume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getWidth", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "glide", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "goLayersBackwards", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "goLayersForwards", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "goToBackLayer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToFrontLayer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToRandomPosition", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, - { - "name": "hide", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "hideVariable", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "ifOnEdgeBounce", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "isActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isAsking", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isColorTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" - ], - "returns": "boolean" - }, - { - "name": "isDestroyed", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isGamepadButtonDown", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "boolean" - }, - { - "name": "isGamepadConnected", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" - }, - { - "name": "isGliding", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "boolean" - }, - { - "name": "isKeyUp", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isMouseDown", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isSoundPlaying", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "isTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "boolean" - }, - { - "name": "isTouchingEdge", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isTouchingMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "boolean" - }, - { - "name": "isTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "boolean" - }, - { - "name": "isVisible", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "nextCostume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "onKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "onKeyTyped", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "onKeyUp", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "pickRandom", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "int" - }, - { - "name": "playSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "playSoundCopy", - "constructor": false, - "static": false, - "parameters": [ - "String", - "double" - ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" - }, - { - "name": "pointInDirection", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "pointInDirection", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "pointTowardsMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "pointTowardsSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, - { - "name": "previousCostume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "restartActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "run", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "say", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "say", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "setActFrequency", - "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "setDirection", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setDirection", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setHitbox", - "constructor": false, - "static": false, - "parameters": [ - "double[]" - ], - "returns": "void" - }, - { - "name": "setHitbox", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setRotationCenter", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setRotationStyle", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.RotationStyle" - ], - "returns": "void" - }, - { - "name": "setSize", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "setTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "show", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "showVariable", - "constructor": false, - "static": false, - "parameters": [ - "String", - "java.util.function.Supplier" - ], - "returns": "void" - }, - { - "name": "stamp", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Layer" - ], - "returns": "void" - }, - { - "name": "stamp", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopAllSounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchCostume", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchCostume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "think", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "think", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "turnLeft", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "turnRight", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenAddedToStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenBackdropSwitches", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenClicked", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenIReceive", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenKeyReleased", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenMouseClicked", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.MouseCode" - ], - "returns": "void" - }, - { - "name": "whenMouseMoved", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "whenRemovedFromStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenStartsAsClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Stage": [ - { - "name": "Stage", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "add", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Pen" - ], - "returns": "void" - }, - { - "name": "add", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, - { - "name": "add", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Text" - ], - "returns": "void" - }, - { - "name": "addBackdrop", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "boolean" - ], - "returns": "void" - }, - { - "name": "addBackdrop", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addBackdrop", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "ask", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "broadcast", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "changeColor", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTint", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "count", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "int" - }, - { - "name": "debug", - "constructor": false, - "static": false, - "parameters": [ - "Object[]" - ], - "returns": "void" - }, - { - "name": "destroy", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "display", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "display", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "eraseAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "exit", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "find", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "List" - }, - { - "name": "getAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "List" - }, - { - "name": "getAnswer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getCamera", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.camera.Camera" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getColor", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "getCurrentBackdropIndex", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getCurrentBackdropName", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getDeltaTime", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getFrameRate", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getGamepadAxisValue", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "double" - }, - { - "name": "getHeight", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getMouse", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getMouseX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getMouseY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getPixels", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.pixels.Pixels" - }, - { - "name": "getShaders", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" - }, - { - "name": "getSorting", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.sorting.Sorting" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.Timer" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Timer" - }, - { - "name": "getVolume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getWidth", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "hideVariable", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "isActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isAsking", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isDebug", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isDestroyed", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isGamepadButtonDown", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "boolean" - }, - { - "name": "isGamepadConnected", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" - }, - { - "name": "isKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "boolean" - }, - { - "name": "isKeyUp", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isMouseDown", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isSoundPlaying", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "nextBackdrop", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "onKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "onKeyTyped", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "onKeyUp", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "pickRandom", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "int" - }, - { - "name": "playSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "playSoundCopy", - "constructor": false, - "static": false, - "parameters": [ - "String", - "double" - ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" - }, - { - "name": "previousBackdrop", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "randomBackdrop", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "void" - }, - { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Pen" - ], - "returns": "void" - }, - { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, - { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Text" - ], - "returns": "void" - }, - { - "name": "removeAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "restartActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "run", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "setActFrequency", - "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "setColor", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setColor", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "setCursor", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "setCursor", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "setDebug", - "constructor": false, - "static": false, - "parameters": [ - "boolean" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "showVariable", - "constructor": false, - "static": false, - "parameters": [ - "String", - "java.util.function.Supplier" - ], - "returns": "void" - }, - { - "name": "stopActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopAllSounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchBackdrop", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "waitUntil", - "constructor": false, - "static": false, - "parameters": [ - "java.util.function.BooleanSupplier" - ], - "returns": "void" - }, - { - "name": "whenBackdropSwitches", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenIReceive", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenKeyReleased", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenMouseClicked", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.MouseCode" - ], - "returns": "void" - }, - { - "name": "whenMouseMoved", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "whenMouseWheelMoved", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - } - ], - "org.openpatch.scratch.Text": [ - { - "name": "Text", - "constructor": true, - "static": false, - "parameters": [ - "String", - "double", - "double", - "double", - "org.openpatch.scratch.TextStyle" - ], - "returns": "org.openpatch.scratch.Text" - }, - { - "name": "Text", - "constructor": true, - "static": false, - "parameters": [ - "String", - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Text" - }, - { - "name": "Text", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "org.openpatch.scratch.Text" - }, - { - "name": "Text", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Text" - ], - "returns": "org.openpatch.scratch.Text" - }, - { - "name": "Text", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Text" - }, - { - "name": "addFont", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addedToStage", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getAlign", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.TextAlign" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getCurrentFontIndex", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getCurrentFontName", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getDefaultFont", - "constructor": false, - "static": true, - "parameters": [], - "returns": "String" - }, - { - "name": "getDefaultFontSize", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getDefaultFontSizes", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int[]" - }, - { - "name": "getFont", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getPosition", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" - }, - { - "name": "getStyle", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.TextStyle" - }, - { - "name": "getTextSize", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getWidth", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "goLayersBackwards", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "goLayersForwards", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "goToBackLayer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToFrontLayer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "isSmoothing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isUI", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "nextFont", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "removedFromStage", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void" - }, - { - "name": "setAlign", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.TextAlign" - ], - "returns": "void" - }, - { - "name": "setBackgroundColor", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setBackgroundColor", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "setBackgroundColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "setFont", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "setIsUI", - "constructor": false, - "static": false, - "parameters": [ - "boolean" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setStrokeColor", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setStrokeColor", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "setStrokeColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "setStyle", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.TextStyle" - ], - "returns": "void" - }, - { - "name": "setTextColor", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTextColor", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "setTextColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "setTextSize", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "setWidth", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "showText", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "showText", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchFont", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "useFont", - "constructor": false, - "static": true, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "useFont", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "useFontSizes", - "constructor": false, - "static": true, - "parameters": [ - "int[]" - ], - "returns": "void" - }, - { - "name": "useSmoothing", - "constructor": false, - "static": true, - "parameters": [ - "boolean" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenAddedToStage", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void" - }, - { - "name": "whenAddedToStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenRemovedFromStage", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void" - }, - { - "name": "whenRemovedFromStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.TextAlign": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "name", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "ordinal", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "valueOf", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.TextAlign" - }, - { - "name": "values", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.TextAlign[]" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.TextStyle": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "name", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "ordinal", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "valueOf", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.TextStyle" - }, - { - "name": "values", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.TextStyle[]" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.TextureSampling": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getMode", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "name", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "ordinal", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "valueOf", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.TextureSampling" - }, - { - "name": "values", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.TextureSampling[]" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Timer": [ - { - "name": "Timer", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Timer" - }, - { - "name": "afterMillis", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "everyMillis", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" - }, - { - "name": "forMillis", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "intervalMillis", - "constructor": false, - "static": false, - "parameters": [ - "int", - "boolean" - ], - "returns": "boolean" - }, - { - "name": "intervalMillis", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int", - "boolean" - ], - "returns": "boolean" - }, - { - "name": "intervalMillis", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "boolean" - }, - { - "name": "intervalMillis", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" - }, - { - "name": "millis", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "reset", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Triangle": [ - { - "name": "Triangle", - "constructor": true, - "static": false, - "parameters": [ - "double", - "double", - "double", - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Triangle" - }, - { - "name": "contains", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getBounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "intersects", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "rotate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "scale", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "translate", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.UISprite": [ - { - "name": "UISprite", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.UISprite" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "addCostumes", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "ask", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "broadcast", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "changeHeight", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changePosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "changePosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "changeSize", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTint", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeWidth", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "clone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Sprite" - }, - { - "name": "debug", - "constructor": false, - "static": false, - "parameters": [ - "Object[]" - ], - "returns": "void" - }, - { - "name": "deleteThisClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "destroy", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "disableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "disableNineSlice", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "distanceToMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "distanceToSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "double" - }, - { - "name": "enableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getAnswer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getCurrentCostumeIndex", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getCurrentCostumeName", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getDeltaTime", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getDirection", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getGamepadAxisValue", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "double" - }, - { - "name": "getHeight", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Hitbox" - }, - { - "name": "getMouse", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getMouseX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getMouseY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getPen", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Pen" - }, - { - "name": "getPosition", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getShaders", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" - }, - { - "name": "getSize", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" - }, - { - "name": "getText", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Text" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.Timer" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Timer" - }, - { - "name": "getTint", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "getTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "T@197 extends org.openpatch.scratch.Sprite" - }, - { - "name": "getTouchingSprites", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "List" - }, - { - "name": "getTransparency", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getVolume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getWidth", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "glide", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "goLayersBackwards", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "goLayersForwards", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "goToBackLayer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToFrontLayer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToRandomPosition", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, - { - "name": "hide", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "hideVariable", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "ifOnEdgeBounce", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "isActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isAsking", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isColorTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" - ], - "returns": "boolean" - }, - { - "name": "isDestroyed", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isGamepadButtonDown", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "boolean" - }, - { - "name": "isGamepadConnected", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" - }, - { - "name": "isGliding", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "boolean" - }, - { - "name": "isKeyUp", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isMouseDown", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isSoundPlaying", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "isTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "boolean" - }, - { - "name": "isTouchingEdge", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isTouchingMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "boolean" - }, - { - "name": "isTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "boolean" - }, - { - "name": "isVisible", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "nextCostume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "onKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "onKeyTyped", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "onKeyUp", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "pickRandom", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "int" - }, - { - "name": "playSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "playSoundCopy", - "constructor": false, - "static": false, - "parameters": [ - "String", - "double" - ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" - }, - { - "name": "pointInDirection", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "pointInDirection", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "pointTowardsMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "pointTowardsSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, - { - "name": "previousCostume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "restartActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "run", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "say", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "say", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "setActFrequency", - "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "setDirection", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setDirection", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setHeight", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setHitbox", - "constructor": false, - "static": false, - "parameters": [ - "double[]" - ], - "returns": "void" - }, - { - "name": "setHitbox", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "void" - }, - { - "name": "setNineSlice", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setRotationCenter", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setRotationStyle", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.RotationStyle" - ], - "returns": "void" - }, - { - "name": "setSize", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "setTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setWidth", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "show", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "showVariable", - "constructor": false, - "static": false, - "parameters": [ - "String", - "java.util.function.Supplier" - ], - "returns": "void" - }, - { - "name": "stamp", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Layer" - ], - "returns": "void" - }, - { - "name": "stamp", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopAllSounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchCostume", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchCostume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "think", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "think", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "turnLeft", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "turnRight", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenAddedToStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenBackdropSwitches", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenClicked", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenIReceive", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenKeyReleased", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenMouseClicked", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.MouseCode" - ], - "returns": "void" - }, - { - "name": "whenMouseMoved", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "whenRemovedFromStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenStartsAsClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Vector2": [ - { - "name": "Vector2", - "constructor": true, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "Vector2", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "Vector2", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "add", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "angle", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "clone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "distance", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "double" - }, - { - "name": "distanceSq", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "double" - }, - { - "name": "dot", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "double" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "fromPolar", - "constructor": false, - "static": true, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "hashCode", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "length", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "lengthSq", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "multiply", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "normalVector", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "reverse", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "rotateBy", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "rotateTo", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "sub", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "unitVector", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Window": [ - { - "name": "Window", - "constructor": true, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.Window" - }, - { - "name": "Window", - "constructor": true, - "static": false, - "parameters": [ - "int", - "int", - "String" - ], - "returns": "org.openpatch.scratch.Window" - }, - { - "name": "Window", - "constructor": true, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "org.openpatch.scratch.Window" - }, - { - "name": "Window", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Window" - }, - { - "name": "debug", - "constructor": false, - "static": false, - "parameters": [ - "Object[]" - ], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "exit", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getDeltaTime", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getGameSpeed", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getHeight", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getInstance", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.Window" - }, - { - "name": "getLibraryTitle", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getLibraryVersion", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getSplashLogo", - "constructor": false, - "static": true, - "parameters": [], - "returns": "String" - }, - { - "name": "getStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" - }, - { - "name": "getTextureSampling", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.TextureSampling" - }, - { - "name": "getWidth", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "isDebug", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isPaused", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isTransitioning", - "constructor": false, - "static": true, - "parameters": [], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "pause", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "resume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "setDebug", - "constructor": false, - "static": false, - "parameters": [ - "boolean" - ], - "returns": "void" - }, - { - "name": "setGameSpeed", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setStage", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void" - }, - { - "name": "step", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "transitionToStage", - "constructor": false, - "static": false, - "parameters": [ - "java.util.function.Supplier", - "int" - ], - "returns": "void" - }, - { - "name": "transitionToStage", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Stage", - "int" - ], - "returns": "void" - }, - { - "name": "useFullScreen", - "constructor": false, - "static": true, - "parameters": [], - "returns": "void" - }, - { - "name": "useSplashLogo", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "useTextureSampling", - "constructor": false, - "static": true, - "parameters": [ - "org.openpatch.scratch.TextureSampling" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenExits", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.camera.Camera": [ - { - "name": "Camera", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.camera.Camera" - }, - { - "name": "changeX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeZoom", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getPosition", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getZoom", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "resetZoom", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setZoom", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setZoomLimit", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "toGlobalPosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "toGlobalX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "toGlobalY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "toLocalPosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "toLocalX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "toLocalY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "double" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.drawing.Drawing": [ - { - "name": "clip", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "image", - "constructor": false, - "static": false, - "parameters": [ - "String", - "double", - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "image", - "constructor": false, - "static": false, - "parameters": [ - "String", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "imageHeight", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "int" - }, - { - "name": "imageWidth", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "int" - }, - { - "name": "noClip", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "polygon", - "constructor": false, - "static": false, - "parameters": [ - "double[]", - "double[]", - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "rectangle", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double", - "double", - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.drawing.DrawingSprite": [ - { - "name": "DrawingSprite", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.drawing.DrawingSprite" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "addCostumes", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "ask", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "broadcast", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "changePosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "changePosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "changeSize", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTint", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "clone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Sprite" - }, - { - "name": "debug", - "constructor": false, - "static": false, - "parameters": [ - "Object[]" - ], - "returns": "void" - }, - { - "name": "deleteThisClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "destroy", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "disableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "distanceToMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "distanceToSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "double" - }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.extensions.drawing.Drawing" - ], - "returns": "void" - }, - { - "name": "enableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getAnswer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getCurrentCostumeIndex", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getCurrentCostumeName", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getDeltaTime", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getDirection", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getGamepadAxisValue", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "double" - }, - { - "name": "getHeight", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Hitbox" - }, - { - "name": "getMouse", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getMouseX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getMouseY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getPen", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Pen" - }, - { - "name": "getPosition", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getShaders", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" - }, - { - "name": "getSize", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" - }, - { - "name": "getText", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Text" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.Timer" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Timer" - }, - { - "name": "getTint", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color" - }, - { - "name": "getTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "T@197 extends org.openpatch.scratch.Sprite" - }, - { - "name": "getTouchingSprites", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "List" - }, - { - "name": "getTransparency", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getTransparency", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getVolume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getWidth", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "glide", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "goLayersBackwards", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "goLayersForwards", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "goToBackLayer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToFrontLayer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToRandomPosition", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "goToSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, - { - "name": "hide", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "hideVariable", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "ifOnEdgeBounce", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "isActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isAsking", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isColorTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" - ], - "returns": "boolean" - }, - { - "name": "isDestroyed", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isGamepadButtonDown", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "boolean" - }, - { - "name": "isGamepadConnected", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" - }, - { - "name": "isGliding", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "boolean" - }, - { - "name": "isKeyUp", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isMouseDown", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isSoundPlaying", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "isTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "boolean" - }, - { - "name": "isTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "boolean" - }, - { - "name": "isTouchingEdge", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isTouchingMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "Class" - ], - "returns": "boolean" - }, - { - "name": "isTouchingSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "boolean" - }, - { - "name": "isVisible", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "nextCostume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "onKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "onKeyTyped", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "onKeyUp", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "pickRandom", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "int" - }, - { - "name": "playSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "playSoundCopy", - "constructor": false, - "static": false, - "parameters": [ - "String", - "double" - ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" - }, - { - "name": "pointInDirection", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "pointInDirection", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "pointTowardsMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "pointTowardsSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, - { - "name": "previousCostume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "restartActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "run", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "say", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "say", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "setActFrequency", - "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "void" - }, - { - "name": "setDirection", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setDirection", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setHitbox", - "constructor": false, - "static": false, - "parameters": [ - "double[]" - ], - "returns": "void" - }, - { - "name": "setHitbox", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "void" - }, - { - "name": "setIsUI", - "constructor": false, - "static": false, - "parameters": [ - "boolean" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setPosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setRotationCenter", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setRotationStyle", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.RotationStyle" - ], - "returns": "void" - }, - { - "name": "setSize", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTint", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "setTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "setY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "show", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "showVariable", - "constructor": false, - "static": false, - "parameters": [ - "String", - "java.util.function.Supplier" - ], - "returns": "void" - }, - { - "name": "stamp", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Layer" - ], - "returns": "void" - }, - { - "name": "stamp", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopAllSounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stopSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchCostume", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchCostume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "think", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "think", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "turnLeft", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "turnRight", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenAddedToStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenBackdropSwitches", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenClicked", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenIReceive", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenKeyReleased", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenMouseClicked", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.MouseCode" - ], - "returns": "void" - }, - { - "name": "whenMouseMoved", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "whenRemovedFromStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenStartsAsClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.fs.File": [ - { - "name": "File", - "constructor": true, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.extensions.fs.File" - }, - { - "name": "append", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "delete", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "exists", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "read", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "write", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.fs.SaveData": [ - { - "name": "SaveData", - "constructor": true, - "static": false, - "parameters": [ - "String", - "String", - "Class" - ], - "returns": "org.openpatch.scratch.extensions.fs.SaveData" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getLocation", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "loadOrDefault", - "constructor": false, - "static": false, - "parameters": [ - "java.util.function.Supplier" - ], - "returns": "T@132" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "save", - "constructor": false, - "static": false, - "parameters": [ - "T@132" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.pixels.Pixels": [ - { - "name": "background", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int[]" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "foreground", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int[]" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "main", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int[]" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.recorder.FFmpegRecorder": [ - { - "name": "FFmpegRecorder", - "constructor": true, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "isRecording", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "start", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stop", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.recorder.FrameRecorder": [ - { - "name": "FrameRecorder", - "constructor": true, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.extensions.recorder.FrameRecorder" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "isRecording", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "start", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stop", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.recorder.GifRecorder": [ - { - "name": "GifRecorder", - "constructor": true, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.extensions.recorder.GifRecorder" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "isRecording", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "start", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stop", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.recorder.Recorder": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "isRecording", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "start", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "stop", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.shader.Shader": [ - { - "name": "Shader", - "constructor": true, - "static": false, - "parameters": [ - "String", - "String", - "String" - ], - "returns": "org.openpatch.scratch.extensions.shader.Shader" - }, - { - "name": "Shader", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.extensions.shader.Shader" - ], - "returns": "org.openpatch.scratch.extensions.shader.Shader" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getName", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "set", - "constructor": false, - "static": false, - "parameters": [ - "String", - "boolean", - "boolean" - ], - "returns": "void" - }, - { - "name": "set", - "constructor": false, - "static": false, - "parameters": [ - "String", - "boolean" - ], - "returns": "void" - }, - { - "name": "set", - "constructor": false, - "static": false, - "parameters": [ - "String", - "double", - "double" - ], - "returns": "void" - }, - { - "name": "set", - "constructor": false, - "static": false, - "parameters": [ - "String", - "double" - ], - "returns": "void" - }, - { - "name": "set", - "constructor": false, - "static": false, - "parameters": [ - "String", - "double[]", - "int" - ], - "returns": "void" - }, - { - "name": "set", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "set", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" - }, - { - "name": "set", - "constructor": false, - "static": false, - "parameters": [ - "String", - "int[]", - "int" - ], - "returns": "void" - }, - { - "name": "set", - "constructor": false, - "static": false, - "parameters": [ - "String", - "org.openpatch.scratch.Color" - ], - "returns": "void" - }, - { - "name": "set", - "constructor": false, - "static": false, - "parameters": [ - "String", - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "setName", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.shader.Shaders": [ - { - "name": "Shaders", - "constructor": true, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" - }, - { - "name": "Shaders", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.extensions.shader.Shaders" - ], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" - }, - { - "name": "activate", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "add", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "String" - ], - "returns": "org.openpatch.scratch.extensions.shader.Shader" - }, - { - "name": "deactivate", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "get", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.extensions.shader.Shader" - }, - { - "name": "getActive", - "constructor": false, - "static": false, - "parameters": [], - "returns": "List" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getCurrent", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shader" - }, - { - "name": "getCurrentIndex", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getCurrentName", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "isActive", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, - { - "name": "next", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "reset", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "switchTo", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "switchTo", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.sorting.Sorting": [ - { - "name": "Sorting", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.sorting.Sorting" - }, - { - "name": "byY", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "isOn", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "off", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.sound.SoundPlayback": [ - { - "name": "close", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getName", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getVolume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "isPlaying", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "setVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "stop", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.text.BitmapText": [ - { - "name": "BitmapText", - "constructor": true, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.extensions.text.BitmapText" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "addCostumes", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "addGlyph", - "constructor": false, - "static": false, - "parameters": [ - "char", - "String" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "ask", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "broadcast", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "changePosition", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "changePosition", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "changeSize", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTint", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeTransparency", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeVolume", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "changeY", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "clone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Sprite" - }, - { - "name": "debug", - "constructor": false, - "static": false, - "parameters": [ - "Object[]" - ], - "returns": "void" - }, - { - "name": "deleteThisClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "destroy", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "disableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "distanceToMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "distanceToSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "double" - }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.extensions.drawing.Drawing" - ], - "returns": "void" - }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.extensions.drawing.Drawing" - ], - "returns": "void" - }, - { - "name": "enableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getAnswer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getContent", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getCurrentCostumeIndex", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getCurrentCostumeName", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "getDeltaTime", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getDirection", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getGamepadAxisValue", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "double" - }, - { - "name": "getHeight", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getHeight", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "getHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Hitbox" - }, - { - "name": "getMouse", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getMouseX", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, - { - "name": "getMouseY", - "constructor": false, - "static": false, - "parameters": [], "returns": "double" }, { - "name": "getPen", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Pen" - }, - { - "name": "getPosition", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" - }, - { - "name": "getShaders", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" - }, - { - "name": "getSize", + "name": "atanOf", "constructor": false, - "static": false, - "parameters": [], + "static": true, + "parameters": [ + "double" + ], "returns": "double" }, { - "name": "getStage", + "name": "ceilingOf", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" + "static": true, + "parameters": [ + "double" + ], + "returns": "double" }, { - "name": "getText", + "name": "constrain", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Text" + "static": true, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "double" }, { - "name": "getTimer", + "name": "constrain", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String" + "int", + "int", + "int" ], - "returns": "org.openpatch.scratch.Timer" + "returns": "int" }, { - "name": "getTimer", + "name": "cosOf", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Timer" + "static": true, + "parameters": [ + "double" + ], + "returns": "double" }, { - "name": "getTint", + "name": "eToThePowerOf", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color" + "static": true, + "parameters": [ + "double" + ], + "returns": "double" }, { - "name": "getTouchingSprite", + "name": "floorOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "Class" + "double" ], - "returns": "T@197 extends org.openpatch.scratch.Sprite" + "returns": "double" }, { - "name": "getTouchingSprites", + "name": "lerp", "constructor": false, - "static": false, + "static": true, "parameters": [ - "Class" + "double", + "double", + "double" ], - "returns": "List" + "returns": "double" }, { - "name": "getTransparency", + "name": "lnOf", "constructor": false, - "static": false, - "parameters": [], + "static": true, + "parameters": [ + "double" + ], "returns": "double" }, { - "name": "getTransparency", + "name": "logOf", "constructor": false, - "static": false, - "parameters": [], + "static": true, + "parameters": [ + "double" + ], "returns": "double" }, { - "name": "getVolume", + "name": "map", "constructor": false, - "static": false, - "parameters": [], + "static": true, + "parameters": [ + "double", + "double", + "double", + "double", + "double" + ], "returns": "double" }, { - "name": "getWidth", + "name": "max", "constructor": false, - "static": false, - "parameters": [], - "returns": "int" + "static": true, + "parameters": [ + "double[]" + ], + "returns": "double" }, { - "name": "getWidth", + "name": "max", "constructor": false, - "static": false, - "parameters": [], + "static": true, + "parameters": [ + "int[]" + ], "returns": "int" }, { - "name": "getX", + "name": "min", "constructor": false, - "static": false, - "parameters": [], + "static": true, + "parameters": [ + "double[]" + ], "returns": "double" }, { - "name": "getY", + "name": "min", "constructor": false, - "static": false, - "parameters": [], - "returns": "double" + "static": true, + "parameters": [ + "int[]" + ], + "returns": "int" }, { - "name": "glide", + "name": "mod", "constructor": false, - "static": false, + "static": true, "parameters": [ - "double", "double", "double" ], - "returns": "void" + "returns": "double" }, { - "name": "goLayersBackwards", + "name": "mod", "constructor": false, - "static": false, + "static": true, "parameters": [ + "int", "int" ], - "returns": "void" + "returns": "int" }, { - "name": "goLayersForwards", + "name": "round", "constructor": false, - "static": false, + "static": true, "parameters": [ + "double", "int" ], - "returns": "void" + "returns": "double" }, { - "name": "goToBackLayer", + "name": "round", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "double" + ], + "returns": "int" }, { - "name": "goToFrontLayer", + "name": "sinOf", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "double" + ], + "returns": "double" }, { - "name": "goToMousePointer", + "name": "sqrtOf", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "double" + ], + "returns": "double" }, { - "name": "goToRandomPosition", + "name": "tanOf", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "double" + ], + "returns": "double" }, { - "name": "goToSprite", + "name": "tenToThePowerOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Sprite" + "double" ], - "returns": "void" - }, + "returns": "double" + } + ], + "org.openpatch.scratch.Pen": [ { - "name": "hide", - "constructor": false, + "name": "Pen", + "constructor": true, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Pen" }, { - "name": "hideVariable", + "name": "changeColor", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], "returns": "void" }, { - "name": "ifOnEdgeBounce", + "name": "changeSize", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "isActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isAsking", + "name": "changeTransparency", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "isClone", + "name": "down", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" - }, - { - "name": "isColorTouchingColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" - ], - "returns": "boolean" + "returns": "void" }, { - "name": "isDestroyed", + "name": "eraseAll", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "isGamepadButtonDown", + "name": "getColor", "constructor": false, "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "boolean" + "parameters": [], + "returns": "org.openpatch.scratch.Color" }, { - "name": "isGamepadConnected", + "name": "getLayer", "constructor": false, "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" + "parameters": [], + "returns": "org.openpatch.scratch.Layer" }, { - "name": "isGliding", + "name": "getPosition", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "isKeyDown", + "name": "getSize", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "isKeyPressed", + "name": "getTransparency", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "isKeyUp", + "name": "goToMousePointer", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" + "parameters": [], + "returns": "void" }, { - "name": "isMouseDown", + "name": "goToRandomPosition", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "isSoundPlaying", + "name": "isDown", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "boolean" }, { - "name": "isTouchingColor", + "name": "setColor", "constructor": false, "static": false, "parameters": [ @@ -12656,58 +1106,56 @@ "double", "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isTouchingColor", + "name": "setColor", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "double" ], - "returns": "boolean" - }, - { - "name": "isTouchingEdge", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "isTouchingMousePointer", + "name": "setColor", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "org.openpatch.scratch.Color" + ], + "returns": "void" }, { - "name": "isTouchingSprite", + "name": "setLayer", "constructor": false, "static": false, "parameters": [ - "Class" + "org.openpatch.scratch.Layer" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isTouchingSprite", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double", + "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isVisible", + "name": "setPosition", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void" }, { - "name": "move", + "name": "setSize", "constructor": false, "static": false, "parameters": [ @@ -12716,450 +1164,525 @@ "returns": "void" }, { - "name": "move", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "double" ], "returns": "void" }, { - "name": "nextCostume", + "name": "stamp", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "notify", + "name": "up", "constructor": false, "static": false, "parameters": [], "returns": "void" - }, + } + ], + "org.openpatch.scratch.Pixels": [ { - "name": "notifyAll", + "name": "getArgb", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "int", + "int" + ], + "returns": "int" }, { - "name": "onKeyDown", + "name": "getColor", "constructor": false, "static": false, "parameters": [ - "String" + "int", + "int" ], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { - "name": "onKeyTyped", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "int" }, { - "name": "onKeyUp", + "name": "getWidth", "constructor": false, "static": false, + "parameters": [], + "returns": "int" + }, + { + "name": "of", + "constructor": false, + "static": true, "parameters": [ "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Pixels" }, { - "name": "pickRandom", + "name": "of", "constructor": false, - "static": false, + "static": true, "parameters": [ - "int", - "int" + "org.openpatch.scratch.Stage" ], - "returns": "int" - }, + "returns": "org.openpatch.scratch.Pixels" + } + ], + "org.openpatch.scratch.Polygon": [ { - "name": "playSound", - "constructor": false, + "name": "Polygon", + "constructor": true, "static": false, "parameters": [ - "String" + "double[]", + "double[]" ], - "returns": "void" + "returns": "org.openpatch.scratch.Polygon" }, { - "name": "playSoundCopy", + "name": "Polygon", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Polygon" + }, + { + "name": "addPoint", "constructor": false, "static": false, "parameters": [ - "String", + "double", "double" ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" + "returns": "void" }, { - "name": "pointInDirection", + "name": "contains", "constructor": false, "static": false, "parameters": [ + "double", "double" ], - "returns": "void" + "returns": "boolean" }, { - "name": "pointInDirection", + "name": "getBounds", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Bounds" }, { - "name": "pointTowardsMousePointer", + "name": "getPoints", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double[]" }, { - "name": "pointTowardsSprite", + "name": "intersects", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "org.openpatch.scratch.Shape" ], - "returns": "void" + "returns": "boolean" }, { - "name": "previousCostume", + "name": "rotate", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape" }, { - "name": "remove", + "name": "scale", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape" }, { - "name": "restartActing", + "name": "translate", "constructor": false, "static": false, - "parameters": [], - "returns": "void" - }, + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape" + } + ], + "org.openpatch.scratch.Random": [ { - "name": "run", + "name": "noise", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "double" }, { - "name": "say", + "name": "noise", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String", - "int" + "double", + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "say", + "name": "noise", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String" + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setActFrequency", + "name": "noiseSeed", "constructor": false, "static": true, "parameters": [ - "int" + "long" ], "returns": "void" }, { - "name": "setAlign", + "name": "random", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.TextAlign" + "double", + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setDirection", + "name": "random", "constructor": false, - "static": false, + "static": true, "parameters": [ "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setDirection", + "name": "random", "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" + "static": true, + "parameters": [], + "returns": "double" }, { - "name": "setFont", + "name": "randomInt", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String" + "int", + "int" ], - "returns": "void" + "returns": "int" }, { - "name": "setHitbox", + "name": "randomInt", "constructor": false, - "static": false, + "static": true, "parameters": [ - "double[]" + "int" ], - "returns": "void" + "returns": "int" }, { - "name": "setHitbox", + "name": "randomPosition", "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "void" + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "setIsUI", + "name": "randomSeed", "constructor": false, - "static": false, + "static": true, "parameters": [ - "boolean" + "long" ], "returns": "void" }, { - "name": "setLetterSpacing", + "name": "randomVector2", "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "setLineSpacing", + "name": "randomX", + "constructor": false, + "static": true, + "parameters": [], + "returns": "double" + }, + { + "name": "randomY", "constructor": false, + "static": true, + "parameters": [], + "returns": "double" + } + ], + "org.openpatch.scratch.Rectangle": [ + { + "name": "Rectangle", + "constructor": true, "static": false, "parameters": [ + "double", + "double", + "double", "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Rectangle" }, { - "name": "setPosition", + "name": "contains", "constructor": false, "static": false, "parameters": [ "double", "double" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setPosition", + "name": "getBounds", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Bounds" }, { - "name": "setRotationCenter", + "name": "getPoints", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double[]" }, { - "name": "setRotationStyle", + "name": "intersects", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.RotationStyle" + "org.openpatch.scratch.Shape" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setSize", + "name": "rotate", "constructor": false, "static": false, "parameters": [ + "double", + "double", "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "setSpaceWidth", + "name": "scale", "constructor": false, "static": false, "parameters": [ + "double", "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "setTint", + "name": "translate", "constructor": false, "static": false, "parameters": [ - "double", "double", "double" ], - "returns": "void" - }, + "returns": "org.openpatch.scratch.Shape" + } + ], + "org.openpatch.scratch.RotationStyle": [ { - "name": "setTint", + "name": "valueOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "double" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.RotationStyle" }, { - "name": "setTint", + "name": "values", "constructor": false, + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.RotationStyle[]" + } + ], + "org.openpatch.scratch.ScratchException": [ + { + "name": "ScratchException", + "constructor": true, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.ScratchException" }, { - "name": "setTransparency", + "name": "toString", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, + "parameters": [], + "returns": "String" + } + ], + "org.openpatch.scratch.Shader": [ { - "name": "setTransparency", + "name": "getName", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "String" }, { - "name": "setVolume", + "name": "set", "constructor": false, "static": false, "parameters": [ - "double" + "String", + "boolean" ], "returns": "void" }, { - "name": "setX", + "name": "set", "constructor": false, "static": false, "parameters": [ + "String", + "double", "double" ], "returns": "void" }, { - "name": "setY", + "name": "set", "constructor": false, "static": false, "parameters": [ + "String", "double" ], "returns": "void" }, { - "name": "show", + "name": "set", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "double[]", + "int" + ], "returns": "void" }, { - "name": "showText", + "name": "set", "constructor": false, "static": false, "parameters": [ - "String" + "String", + "int" ], "returns": "void" }, { - "name": "showVariable", + "name": "set", "constructor": false, "static": false, "parameters": [ "String", - "java.util.function.Supplier" + "org.openpatch.scratch.Color" ], "returns": "void" }, { - "name": "stamp", + "name": "set", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Layer" + "String", + "org.openpatch.scratch.Vector2" ], "returns": "void" }, { - "name": "stamp", + "name": "setName", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" - }, + } + ], + "org.openpatch.scratch.Shaders": [ { - "name": "stopActing", + "name": "activate", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "stopAllSounds", + "name": "add", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "String", + "String" + ], + "returns": "org.openpatch.scratch.Shader" }, { - "name": "stopSound", + "name": "deactivate", "constructor": false, "static": false, "parameters": [ @@ -13168,1141 +1691,1161 @@ "returns": "void" }, { - "name": "switchCostume", + "name": "get", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Shader" }, { - "name": "switchCostume", + "name": "getActive", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "List" }, { - "name": "think", + "name": "getCurrent", "constructor": false, "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Shader" }, { - "name": "think", + "name": "getCurrentIndex", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "int" }, { - "name": "toString", + "name": "getCurrentName", "constructor": false, "static": false, "parameters": [], "returns": "String" }, { - "name": "turnLeft", + "name": "isActive", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], - "returns": "void" + "returns": "boolean" }, { - "name": "turnRight", + "name": "next", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "wait", + "name": "reset", "constructor": false, "static": false, - "parameters": [ - "long" - ], + "parameters": [], "returns": "void" }, { - "name": "wait", + "name": "switchTo", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "whenAddedToStage", + "name": "switchTo", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" - }, + } + ], + "org.openpatch.scratch.Shape": [ { - "name": "whenBackdropSwitches", + "name": "contains", "constructor": false, "static": false, "parameters": [ - "String" + "double", + "double" ], - "returns": "void" + "returns": "boolean" }, { - "name": "whenClicked", + "name": "getBounds", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Bounds" }, { - "name": "whenIReceive", + "name": "getPoints", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "double[]" }, { - "name": "whenKeyPressed", + "name": "intersects", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.Shape" ], - "returns": "void" + "returns": "boolean" }, { - "name": "whenKeyReleased", + "name": "rotate", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double", + "double", + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "whenMouseClicked", + "name": "scale", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.MouseCode" + "double", + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "whenMouseMoved", + "name": "translate", "constructor": false, "static": false, "parameters": [ "double", "double" ], - "returns": "void" - }, + "returns": "org.openpatch.scratch.Shape" + } + ], + "org.openpatch.scratch.SoundPlayback": [ { - "name": "whenRemovedFromStage", + "name": "close", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "whenStartsAsClone", + "name": "getName", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.tiled.MapObject": [ + "returns": "String" + }, { - "name": "equals", + "name": "getVolume", "constructor": false, "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "getClass", + "name": "isPlaying", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "boolean" }, { - "name": "getProperty", + "name": "setVolume", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], - "returns": "String" + "returns": "void" }, { - "name": "getPropertyBoolean", + "name": "stop", "constructor": false, "static": false, + "parameters": [], + "returns": "void" + } + ], + "org.openpatch.scratch.Sprite": [ + { + "name": "Sprite", + "constructor": true, + "static": false, "parameters": [ + "String", "String" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Sprite" }, { - "name": "getPropertyFloat", - "constructor": false, + "name": "Sprite", + "constructor": true, "static": false, - "parameters": [ - "String" - ], - "returns": "float" + "parameters": [], + "returns": "org.openpatch.scratch.Sprite" }, { - "name": "getPropertyInt", + "name": "addAnimation", "constructor": false, "static": false, "parameters": [ - "String" + "String", + "String", + "int", + "int", + "int[]" ], - "returns": "int" + "returns": "void" }, { - "name": "getShape", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Shape" + "parameters": [ + "String", + "String", + "int", + "int" + ], + "returns": "void" }, { - "name": "notify", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String", + "int" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "addCostume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String", + "int", + "int", + "int", + "int" + ], "returns": "void" }, { - "name": "toString", + "name": "addCostume", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "String", + "String" + ], + "returns": "void" }, { - "name": "wait", + "name": "addCostume", "constructor": false, "static": false, "parameters": [ - "long" + "String" ], "returns": "void" }, { - "name": "wait", + "name": "addCostumes", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String", + "int", + "int" + ], "returns": "void" - } - ], - "org.openpatch.scratch.extensions.tiled.Property": [ + }, { - "name": "equals", + "name": "addSound", "constructor": false, "static": false, "parameters": [ - "Object" + "String", + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "addSound", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "notify", + "name": "ask", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "broadcast", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "toString", + "name": "changeColorEffect", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "wait", + "name": "changeHeight", "constructor": false, "static": false, "parameters": [ - "long" + "double" ], "returns": "void" }, { - "name": "wait", + "name": "changePosition", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double" + ], "returns": "void" - } - ], - "org.openpatch.scratch.extensions.tiled.TiledMap": [ + }, { - "name": "TiledMap", - "constructor": true, + "name": "changePosition", + "constructor": false, "static": false, "parameters": [ - "String", - "org.openpatch.scratch.Stage" + "org.openpatch.scratch.Vector2" ], - "returns": "org.openpatch.scratch.extensions.tiled.TiledMap" + "returns": "void" }, { - "name": "TiledMap", - "constructor": true, + "name": "changeSize", + "constructor": false, "static": false, "parameters": [ - "String" + "double" ], - "returns": "org.openpatch.scratch.extensions.tiled.TiledMap" + "returns": "void" }, { - "name": "equals", + "name": "changeTransparency", "constructor": false, "static": false, "parameters": [ - "Object" + "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "changeVolume", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getHeight", + "name": "changeWidth", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getObjectsFromLayer", + "name": "changeX", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], - "returns": "org.openpatch.scratch.extensions.tiled.MapObject[]" + "returns": "void" }, { - "name": "getProperty", + "name": "changeY", "constructor": false, "static": false, "parameters": [ - "String", - "String" + "double" ], - "returns": "String" + "returns": "void" }, { - "name": "getProperty", + "name": "createClone", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "String" + "parameters": [], + "returns": "T@201 extends org.openpatch.scratch.Sprite" }, { - "name": "getPropertyBoolean", + "name": "debug", "constructor": false, "static": false, "parameters": [ - "String" + "Object[]" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getPropertyFloat", + "name": "deleteThisClone", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "float" + "parameters": [], + "returns": "void" }, { - "name": "getPropertyInt", + "name": "disableHitbox", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "int" + "parameters": [], + "returns": "void" }, { - "name": "getTileCollisionShapes", + "name": "disableNineSlice", "constructor": false, "static": false, - "parameters": [ - "String", - "int", - "int" - ], - "returns": "org.openpatch.scratch.Shape[]" + "parameters": [], + "returns": "void" }, { - "name": "getTileCollisionShapes", + "name": "distanceToMousePointer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "distanceToSprite", "constructor": false, "static": false, "parameters": [ - "int" + "org.openpatch.scratch.Sprite" ], - "returns": "org.openpatch.scratch.Shape[]" + "returns": "double" }, { - "name": "getTileHeight", + "name": "enableHitbox", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "void" }, { - "name": "getTileId", + "name": "getAnimationFrame", "constructor": false, "static": false, - "parameters": [ - "String", - "int", - "int" - ], + "parameters": [], "returns": "int" }, { - "name": "getTileWidth", + "name": "getAnimationInterval", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "double" }, { - "name": "getWidth", + "name": "getAnswer", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "String" }, { - "name": "notify", + "name": "getColorEffect", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "notifyAll", + "name": "getCurrentCostumeIndex", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "spawn", + "name": "getCurrentCostumeName", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "List" + "parameters": [], + "returns": "String" }, { - "name": "stampLayerToBackground", + "name": "getDirection", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "stampLayerToForeground", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "toString", + "name": "getHitbox", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "wait", + "name": "getLayer", "constructor": false, "static": false, - "parameters": [ - "long" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Layer" }, { - "name": "wait", + "name": "getMouse", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.tiled.TilesetImage": [ + "returns": "org.openpatch.scratch.Vector2" + }, { - "name": "equals", + "name": "getMouseX", "constructor": false, "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "getClass", + "name": "getMouseY", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "double" }, { - "name": "notify", + "name": "getPen", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Pen" }, { - "name": "notifyAll", + "name": "getPosition", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "toString", + "name": "getRotationStyle", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "org.openpatch.scratch.RotationStyle" }, { - "name": "wait", + "name": "getShaders", "constructor": false, "static": false, - "parameters": [ - "long" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Shaders" }, { - "name": "wait", + "name": "getSize", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ] - }, - "nrw": { - "org.openpatch.scratch.AnimatedSprite": [ + "returns": "double" + }, { - "name": "AnimatedSprite", - "constructor": true, + "name": "getStage", + "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.AnimatedSprite" - ], - "returns": "org.openpatch.scratch.AnimatedSprite" + "parameters": [], + "returns": "org.openpatch.scratch.Stage" }, { - "name": "AnimatedSprite", - "constructor": true, + "name": "getText", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.AnimatedSprite" + "returns": "org.openpatch.scratch.Text" }, { - "name": "act", + "name": "getTimer", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Timer" }, { - "name": "act", + "name": "getTint", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { - "name": "addAnimation", + "name": "getTouchingSprite", "constructor": false, "static": false, "parameters": [ - "String", - "Function", - "int" + "Class" ], - "returns": "void" + "returns": "T@199 extends org.openpatch.scratch.Sprite" }, { - "name": "addAnimation", + "name": "getTouchingSprites", "constructor": false, "static": false, "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int", - "boolean" + "Class" ], - "returns": "void" + "returns": "List" }, { - "name": "addAnimation", + "name": "getTransparency", "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "addAnimation", + "name": "getVolume", "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "addAnimation", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "addCostume", + "name": "getX", "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "double" + }, + { + "name": "getY", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" }, { - "name": "addCostume", + "name": "glide", "constructor": false, "static": false, "parameters": [ - "String", - "String" + "double", + "double", + "double" ], "returns": "void" }, { - "name": "addCostume", + "name": "goLayersBackwards", "constructor": false, "static": false, "parameters": [ - "String" + "int" ], "returns": "void" }, { - "name": "addCostumes", + "name": "goLayersForwards", "constructor": false, "static": false, "parameters": [ - "String", - "String", - "int", "int" ], "returns": "void" }, { - "name": "addSound", + "name": "goToBackLayer", "constructor": false, "static": false, - "parameters": [ - "String", - "String" - ], + "parameters": [], "returns": "void" }, { - "name": "addSound", + "name": "goToFrontLayer", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "void" }, { - "name": "ask", + "name": "goToMousePointer", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "void" }, { - "name": "broadcast", + "name": "goToRandomPosition", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "void" }, { - "name": "changePosition", + "name": "goToSprite", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "org.openpatch.scratch.Sprite" ], "returns": "void" }, { - "name": "changePosition", + "name": "hide", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], + "parameters": [], "returns": "void" }, { - "name": "changeSize", + "name": "hideVariable", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "changeTint", + "name": "ifOnEdgeBounce", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "changeTransparency", + "name": "isAnimationPlayed", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "changeVolume", + "name": "isAsking", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "changeX", + "name": "isClone", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "changeY", + "name": "isColorTouchingColor", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Color", + "org.openpatch.scratch.Color" ], - "returns": "void" + "returns": "boolean" }, { - "name": "clone", + "name": "isGliding", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.AnimatedSprite" + "returns": "boolean" }, { - "name": "clone", + "name": "isKeyPressed", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "boolean" + }, + { + "name": "isMouseDown", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Sprite" + "returns": "boolean" }, { - "name": "debug", + "name": "isSoundPlaying", "constructor": false, "static": false, "parameters": [ - "Object[]" + "String" ], - "returns": "void" + "returns": "boolean" }, { - "name": "deleteThisClone", + "name": "isTouchingColor", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "boolean" }, { - "name": "destroy", + "name": "isTouchingColor", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "org.openpatch.scratch.Color" + ], + "returns": "boolean" }, { - "name": "disableHitbox", + "name": "isTouchingEdge", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "boolean" }, { - "name": "distanceToMousePointer", + "name": "isTouchingMousePointer", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "boolean" }, { - "name": "distanceToSprite", + "name": "isTouchingSprite", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "Class" ], - "returns": "double" - }, - { - "name": "enableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "returns": "boolean" }, { - "name": "equals", + "name": "isTouchingSprite", "constructor": false, "static": false, "parameters": [ - "Object" + "org.openpatch.scratch.Sprite" ], "returns": "boolean" }, { - "name": "getAnimationFrame", + "name": "isVisible", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "boolean" }, { - "name": "getAnimationInterval", + "name": "move", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getAnswer", + "name": "nextCostume", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "getClass", + "name": "pickRandom", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "int", + "int" + ], + "returns": "int" }, { - "name": "getCurrentCostumeIndex", + "name": "playAnimation", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "String", + "boolean" + ], + "returns": "void" }, { - "name": "getCurrentCostumeName", + "name": "playAnimation", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getDeltaTime", + "name": "playSound", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getDirection", + "name": "playSoundCopy", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "String", + "double" + ], + "returns": "org.openpatch.scratch.SoundPlayback" }, { - "name": "getGamepadAxisValue", + "name": "pointTowards", "constructor": false, "static": false, "parameters": [ - "int", - "int" + "org.openpatch.scratch.Sprite" ], - "returns": "double" + "returns": "void" }, { - "name": "getHeight", + "name": "pointTowards", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void" }, { - "name": "getHitbox", + "name": "pointTowardsMousePointer", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Hitbox" + "returns": "void" }, { - "name": "getMouse", + "name": "previousCostume", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "getMouseX", + "name": "remove", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "void" }, { - "name": "getMouseY", + "name": "resetAnimation", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "void" }, { - "name": "getPen", + "name": "run", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Pen" + "returns": "void" }, { - "name": "getPosition", + "name": "say", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "parameters": [ + "String", + "double" + ], + "returns": "void" }, { - "name": "getShaders", + "name": "say", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getSize", + "name": "setAnimationFrame", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "int" + ], + "returns": "void" }, { - "name": "getStage", + "name": "setAnimationInterval", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getText", + "name": "setColorEffect", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Text" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getTimer", + "name": "setDirection", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], - "returns": "org.openpatch.scratch.Timer" + "returns": "void" }, { - "name": "getTimer", + "name": "setHeight", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Timer" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getTint", + "name": "setHitbox", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color" + "parameters": [ + "org.openpatch.scratch.Shape" + ], + "returns": "void" }, { - "name": "getTouchingSprite", + "name": "setLayer", "constructor": false, "static": false, "parameters": [ - "Class" + "org.openpatch.scratch.Layer" ], - "returns": "T@407 extends org.openpatch.scratch.Sprite" + "returns": "void" }, { - "name": "getTouchingSprites", + "name": "setNineSlice", "constructor": false, "static": false, "parameters": [ - "Class" + "int", + "int", + "int", + "int" ], - "returns": "nrw.List" + "returns": "void" }, { - "name": "getTransparency", + "name": "setPosition", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double", + "double" + ], + "returns": "void" }, { - "name": "getVolume", + "name": "setPosition", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void" }, { - "name": "getWidth", + "name": "setRotationCenter", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double", + "double" + ], + "returns": "void" }, { - "name": "getX", + "name": "setRotationStyle", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "org.openpatch.scratch.RotationStyle" + ], + "returns": "void" }, { - "name": "getY", + "name": "setSize", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "glide", + "name": "setTint", "constructor": false, "static": false, "parameters": [ @@ -14313,297 +2856,331 @@ "returns": "void" }, { - "name": "goLayersBackwards", + "name": "setTint", "constructor": false, "static": false, "parameters": [ - "int" + "org.openpatch.scratch.Color" ], "returns": "void" }, { - "name": "goLayersForwards", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], "returns": "void" }, { - "name": "goToBackLayer", + "name": "setVolume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "goToFrontLayer", + "name": "setWidth", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "goToMousePointer", + "name": "setX", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "goToRandomPosition", + "name": "setY", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "goToSprite", + "name": "show", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], + "parameters": [], "returns": "void" }, { - "name": "hide", + "name": "showVariable", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "java.util.function.Supplier" + ], "returns": "void" }, { - "name": "hideVariable", + "name": "stamp", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.Layer" ], "returns": "void" }, { - "name": "ifOnEdgeBounce", + "name": "stamp", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "isActing", + "name": "stopAllSounds", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "isAnimationPlayed", + "name": "stopSound", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "isAsking", + "name": "switchCostume", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "isClone", + "name": "switchCostume", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "isColorTouchingColor", + "name": "think", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" + "String", + "double" ], - "returns": "boolean" + "returns": "void" + }, + { + "name": "think", + "constructor": false, + "static": false, + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "isDestroyed", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "String" }, { - "name": "isGamepadButtonDown", + "name": "turnLeft", "constructor": false, "static": false, "parameters": [ - "int", - "int" + "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isGamepadConnected", + "name": "turnRight", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isGliding", + "name": "whenAddedToStage", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "isKeyDown", + "name": "whenBackdropSwitches", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isKeyPressed", + "name": "whenClicked", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "boolean" + "parameters": [], + "returns": "void" }, { - "name": "isKeyUp", + "name": "whenIReceive", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isMouseDown", + "name": "whenKeyPressed", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "void" }, { - "name": "isSoundPlaying", + "name": "whenKeyReleased", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.KeyCode" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isTouchingColor", + "name": "whenMouseClicked", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "org.openpatch.scratch.MouseCode" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isTouchingColor", + "name": "whenMouseMoved", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "double", + "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isTouchingEdge", + "name": "whenRemovedFromStage", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "isTouchingMousePointer", + "name": "whenStartsAsClone", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" + } + ], + "org.openpatch.scratch.Stage": [ + { + "name": "Stage", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Stage" }, { - "name": "isTouchingSprite", + "name": "add", "constructor": false, "static": false, "parameters": [ - "Class" + "org.openpatch.scratch.Pen" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isTouchingSprite", + "name": "add", "constructor": false, "static": false, "parameters": [ "org.openpatch.scratch.Sprite" ], - "returns": "boolean" - }, - { - "name": "isVisible", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "move", + "name": "add", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Text" ], "returns": "void" }, { - "name": "move", + "name": "addBackdrop", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "String", + "String", + "boolean" ], "returns": "void" }, { - "name": "nextCostume", + "name": "addBackdrop", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String" + ], "returns": "void" }, { - "name": "notify", + "name": "addBackdrop", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "addSound", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String" + ], "returns": "void" }, { - "name": "onKeyDown", + "name": "addSound", "constructor": false, "static": false, "parameters": [ @@ -14612,7 +3189,7 @@ "returns": "void" }, { - "name": "onKeyTyped", + "name": "ask", "constructor": false, "static": false, "parameters": [ @@ -14621,7 +3198,7 @@ "returns": "void" }, { - "name": "onKeyUp", + "name": "broadcast", "constructor": false, "static": false, "parameters": [ @@ -14630,383 +3207,407 @@ "returns": "void" }, { - "name": "pickRandom", + "name": "changeColorEffect", "constructor": false, "static": false, "parameters": [ - "int", - "int" + "double" ], - "returns": "int" + "returns": "void" }, { - "name": "playAnimation", + "name": "changeTransparency", "constructor": false, "static": false, "parameters": [ - "String", - "boolean" + "double" ], "returns": "void" }, { - "name": "playAnimation", + "name": "changeVolume", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], "returns": "void" }, { - "name": "playSound", + "name": "count", "constructor": false, "static": false, "parameters": [ - "String" + "Class" ], - "returns": "void" + "returns": "int" }, { - "name": "playSoundCopy", + "name": "debug", "constructor": false, "static": false, "parameters": [ - "String", - "double" + "Object[]" ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" + "returns": "void" }, { - "name": "pointInDirection", + "name": "display", "constructor": false, "static": false, "parameters": [ + "String", "double" ], "returns": "void" }, { - "name": "pointInDirection", + "name": "display", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "String" ], "returns": "void" }, { - "name": "pointTowardsMousePointer", + "name": "eraseAll", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "pointTowardsSprite", + "name": "find", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "Class" ], - "returns": "void" + "returns": "List" }, { - "name": "previousCostume", + "name": "getAll", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "List" }, { - "name": "remove", + "name": "getAnswer", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "resetAnimation", + "name": "getCamera", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Camera" }, { - "name": "restartActing", + "name": "getColor", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { - "name": "run", + "name": "getColorEffect", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "say", + "name": "getCurrentBackdropIndex", "constructor": false, "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "int" }, { - "name": "say", + "name": "getCurrentBackdropName", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "String" }, { - "name": "setActFrequency", + "name": "getHeight", "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "void" + "static": false, + "parameters": [], + "returns": "int" }, { - "name": "setAnimationFrame", + "name": "getMouse", "constructor": false, "static": false, - "parameters": [ - "int" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "setAnimationInterval", + "name": "getMouseX", "constructor": false, "static": false, - "parameters": [ - "int" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "setDirection", + "name": "getMouseY", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "setDirection", + "name": "getShaders", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Shaders" }, { - "name": "setHitbox", + "name": "getTimer", "constructor": false, "static": false, - "parameters": [ - "double[]" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Timer" }, { - "name": "setHitbox", + "name": "getTransparency", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "getVolume", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "getWidth", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int" + }, + { + "name": "hideVariable", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Shape" + "String" ], "returns": "void" }, { - "name": "setPosition", + "name": "isAsking", + "constructor": false, + "static": false, + "parameters": [], + "returns": "boolean" + }, + { + "name": "isKeyPressed", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "org.openpatch.scratch.KeyCode" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setPosition", + "name": "isMouseDown", + "constructor": false, + "static": false, + "parameters": [], + "returns": "boolean" + }, + { + "name": "isSoundPlaying", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "String" ], + "returns": "boolean" + }, + { + "name": "nextBackdrop", + "constructor": false, + "static": false, + "parameters": [], "returns": "void" }, { - "name": "setRotationCenter", + "name": "pickRandom", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "int", + "int" ], - "returns": "void" + "returns": "int" }, { - "name": "setRotationStyle", + "name": "playSound", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.RotationStyle" + "String" ], "returns": "void" }, { - "name": "setSize", + "name": "playSoundCopy", "constructor": false, "static": false, "parameters": [ + "String", "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.SoundPlayback" }, { - "name": "setTint", + "name": "previousBackdrop", "constructor": false, "static": false, - "parameters": [ - "double", - "double", - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "setTint", + "name": "randomBackdrop", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "setTint", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "Class" ], "returns": "void" }, { - "name": "setTransparency", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Pen" ], "returns": "void" }, { - "name": "setVolume", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Sprite" ], "returns": "void" }, { - "name": "setX", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Text" ], "returns": "void" }, { - "name": "setY", + "name": "removeAll", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "show", + "name": "run", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "showVariable", + "name": "setColor", "constructor": false, "static": false, "parameters": [ - "String", - "java.util.function.Supplier" + "double", + "double", + "double" ], "returns": "void" }, { - "name": "stamp", + "name": "setColor", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Layer" + "org.openpatch.scratch.Color" ], "returns": "void" }, { - "name": "stamp", + "name": "setColorEffect", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "stopActing", + "name": "setCursor", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "int", + "int" + ], "returns": "void" }, { - "name": "stopAllSounds", + "name": "setCursor", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "stopSound", + "name": "setTint", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.Color" ], "returns": "void" }, { - "name": "switchCostume", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], "returns": "void" }, { - "name": "switchCostume", + "name": "setVolume", "constructor": false, "static": false, "parameters": [ @@ -15015,77 +3616,79 @@ "returns": "void" }, { - "name": "think", + "name": "showVariable", "constructor": false, "static": false, "parameters": [ "String", - "int" + "java.util.function.Supplier" ], "returns": "void" }, { - "name": "think", + "name": "sortBy", "constructor": false, "static": false, "parameters": [ - "String" + "Comparator" ], "returns": "void" }, { - "name": "toString", + "name": "sortByY", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "toString", + "name": "stopAllSounds", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "turnLeft", + "name": "stopSorting", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "turnRight", + "name": "stopSound", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "wait", + "name": "switchBackdrop", "constructor": false, "static": false, "parameters": [ - "long" + "String" ], "returns": "void" }, { - "name": "wait", + "name": "waitSeconds", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "whenAddedToStage", + "name": "waitUntil", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "java.util.function.BooleanSupplier" + ], "returns": "void" }, { @@ -15097,13 +3700,6 @@ ], "returns": "void" }, - { - "name": "whenClicked", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, { "name": "whenIReceive", "constructor": false, @@ -15141,579 +3737,560 @@ "returns": "void" }, { - "name": "whenMouseMoved", + "name": "whenMouseWheelMoved", "constructor": false, "static": false, "parameters": [ - "double", "double" ], "returns": "void" - }, - { - "name": "whenRemovedFromStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenStartsAsClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" } ], - "org.openpatch.scratch.Bounds": [ + "org.openpatch.scratch.Text": [ { - "name": "Bounds", + "name": "Text", "constructor": true, "static": false, "parameters": [ + "String", "double", "double", "double", + "org.openpatch.scratch.TextStyle" + ], + "returns": "org.openpatch.scratch.Text" + }, + { + "name": "Text", + "constructor": true, + "static": false, + "parameters": [ + "String", + "double", + "double", "double" ], - "returns": "org.openpatch.scratch.Bounds" + "returns": "org.openpatch.scratch.Text" }, { - "name": "equals", + "name": "Text", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Text" + }, + { + "name": "addFont", "constructor": false, "static": false, "parameters": [ - "Object" + "String", + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "getAlign", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "org.openpatch.scratch.TextAlign" }, { - "name": "height", + "name": "getCurrentFontIndex", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "int" }, { - "name": "intersects", + "name": "getCurrentFontName", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Bounds" - ], - "returns": "boolean" + "parameters": [], + "returns": "String" + }, + { + "name": "getDefaultFont", + "constructor": false, + "static": true, + "parameters": [], + "returns": "String" + }, + { + "name": "getDefaultFontSize", + "constructor": false, + "static": true, + "parameters": [], + "returns": "double" }, { - "name": "notify", + "name": "getFont", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "notifyAll", + "name": "getLayer", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Layer" }, { - "name": "toString", + "name": "getPosition", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "toString", + "name": "getStage", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "org.openpatch.scratch.Stage" }, { - "name": "wait", + "name": "getStyle", "constructor": false, "static": false, - "parameters": [ - "long" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.TextStyle" }, { - "name": "wait", + "name": "getText", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "width", + "name": "getTextSize", "constructor": false, "static": false, "parameters": [], "returns": "double" }, { - "name": "x", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], "returns": "double" }, { - "name": "y", + "name": "getX", "constructor": false, "static": false, "parameters": [], "returns": "double" - } - ], - "org.openpatch.scratch.Circle": [ + }, { - "name": "Circle", - "constructor": true, + "name": "getY", + "constructor": false, "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "org.openpatch.scratch.Circle" + "parameters": [], + "returns": "double" }, { - "name": "contains", + "name": "goLayersBackwards", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "int" ], - "returns": "boolean" + "returns": "void" }, { - "name": "draw", + "name": "goLayersForwards", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "int" + ], "returns": "void" }, { - "name": "equals", + "name": "goToBackLayer", "constructor": false, "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" + "parameters": [], + "returns": "void" }, { - "name": "getBounds", + "name": "goToFrontLayer", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Bounds" + "returns": "void" }, { - "name": "getClass", + "name": "hide", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "void" }, { - "name": "intersects", + "name": "isVisible", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], + "parameters": [], "returns": "boolean" }, { - "name": "notify", + "name": "nextFont", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "notifyAll", + "name": "remove", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "rotate", + "name": "setAlign", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "org.openpatch.scratch.TextAlign" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "void" }, { - "name": "scale", + "name": "setBackgroundColor", "constructor": false, "static": false, "parameters": [ + "double", "double", "double" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "void" }, { - "name": "toString", + "name": "setBackgroundColor", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "org.openpatch.scratch.Color" + ], + "returns": "void" }, { - "name": "translate", + "name": "setFont", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "String" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "void" }, { - "name": "wait", + "name": "setLayer", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.Layer" ], "returns": "void" }, { - "name": "wait", + "name": "setPosition", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double" + ], "returns": "void" - } - ], - "org.openpatch.scratch.Clock": [ + }, { - "name": "equals", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "Object" + "org.openpatch.scratch.Vector2" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "setStrokeColor", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getDay", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getDayOfWeek", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getDaysSince2000", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getHour", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getMillisecond", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getMinute", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getMonth", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getSecond", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" - }, - { - "name": "getYear", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "void" }, { - "name": "notify", + "name": "setStrokeColor", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Color" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "setStyle", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.TextStyle" + ], "returns": "void" }, { - "name": "toString", + "name": "setTextColor", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "void" }, { - "name": "wait", + "name": "setTextColor", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.Color" ], "returns": "void" }, { - "name": "wait", + "name": "setTextSize", "constructor": false, "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Color": [ - { - "name": "Color", - "constructor": true, - "static": false, "parameters": [ - "String" + "double" ], - "returns": "org.openpatch.scratch.Color" + "returns": "void" }, { - "name": "Color", - "constructor": true, + "name": "setWidth", + "constructor": false, "static": false, "parameters": [ - "double", - "double", "double" ], - "returns": "org.openpatch.scratch.Color" + "returns": "void" }, { - "name": "Color", - "constructor": true, + "name": "setX", + "constructor": false, "static": false, "parameters": [ "double" ], - "returns": "org.openpatch.scratch.Color" + "returns": "void" }, { - "name": "Color", - "constructor": true, + "name": "setY", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "double" ], - "returns": "org.openpatch.scratch.Color" + "returns": "void" }, { - "name": "Color", - "constructor": true, + "name": "show", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Color" + "returns": "void" }, { - "name": "changeColor", + "name": "showText", "constructor": false, "static": false, "parameters": [ + "String", "double" ], "returns": "void" }, { - "name": "equals", + "name": "showText", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "equals", + "name": "switchFont", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "get", + "name": "useFont", "constructor": false, - "static": false, - "parameters": [], - "returns": "int" + "static": true, + "parameters": [ + "String", + "double" + ], + "returns": "void" }, { - "name": "getBlue", + "name": "useFont", "constructor": false, - "static": false, - "parameters": [], - "returns": "double" + "static": true, + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getClass", + "name": "whenAddedToStage", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "void" }, { - "name": "getGreen", + "name": "whenRemovedFromStage", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "void" + } + ], + "org.openpatch.scratch.TextAlign": [ + { + "name": "valueOf", + "constructor": false, + "static": true, + "parameters": [ + "String" + ], + "returns": "org.openpatch.scratch.TextAlign" }, { - "name": "getH", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "double" - }, + "returns": "org.openpatch.scratch.TextAlign[]" + } + ], + "org.openpatch.scratch.TextStyle": [ { - "name": "getHSB", + "name": "valueOf", "constructor": false, - "static": false, - "parameters": [], - "returns": "double" + "static": true, + "parameters": [ + "String" + ], + "returns": "org.openpatch.scratch.TextStyle" }, { - "name": "getL", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "double" - }, + "returns": "org.openpatch.scratch.TextStyle[]" + } + ], + "org.openpatch.scratch.Timer": [ { - "name": "getRed", - "constructor": false, + "name": "Timer", + "constructor": true, "static": false, "parameters": [], - "returns": "double" + "returns": "org.openpatch.scratch.Timer" }, { - "name": "getS", + "name": "after", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "boolean" }, { - "name": "hashCode", + "name": "during", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double" + ], + "returns": "boolean" }, { - "name": "notify", + "name": "every", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double" + ], + "returns": "boolean" }, { - "name": "notifyAll", + "name": "getSeconds", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "setHSB", + "name": "interval", "constructor": false, "static": false, "parameters": [ - "double", "double", "double" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setHSB", + "name": "interval", "constructor": false, "static": false, "parameters": [ "double" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setRGB", + "name": "reset", "constructor": false, "static": false, + "parameters": [], + "returns": "void" + } + ], + "org.openpatch.scratch.Transition": [ + { + "name": "fromShader", + "constructor": false, + "static": true, "parameters": [ - "double", - "double", - "double" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Transition" }, { - "name": "toString", + "name": "getName", "constructor": false, "static": false, "parameters": [], @@ -15727,34 +4304,36 @@ "returns": "String" }, { - "name": "wait", + "name": "valueOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "long" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Transition" }, { - "name": "wait", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Transition[]" } ], - "org.openpatch.scratch.Ellipse": [ + "org.openpatch.scratch.Triangle": [ { - "name": "Ellipse", + "name": "Triangle", "constructor": true, "static": false, "parameters": [ + "double", + "double", "double", "double", "double", "double" ], - "returns": "org.openpatch.scratch.Ellipse" + "returns": "org.openpatch.scratch.Triangle" }, { "name": "contains", @@ -15766,22 +4345,6 @@ ], "returns": "boolean" }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, { "name": "getBounds", "constructor": false, @@ -15790,11 +4353,11 @@ "returns": "org.openpatch.scratch.Bounds" }, { - "name": "getClass", + "name": "getPoints", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "double[]" }, { "name": "intersects", @@ -15805,20 +4368,6 @@ ], "returns": "boolean" }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, { "name": "rotate", "constructor": false, @@ -15840,13 +4389,6 @@ ], "returns": "org.openpatch.scratch.Shape" }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, { "name": "translate", "constructor": false, @@ -15856,913 +4398,930 @@ "double" ], "returns": "org.openpatch.scratch.Shape" - }, + } + ], + "org.openpatch.scratch.Vector2": [ { - "name": "wait", - "constructor": false, + "name": "Vector2", + "constructor": true, "static": false, "parameters": [ - "long" + "double", + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Hitbox": [ - { - "name": "Hitbox", + "name": "Vector2", "constructor": true, "static": false, "parameters": [ - "double[]", - "double[]" + "org.openpatch.scratch.Vector2" ], - "returns": "org.openpatch.scratch.Hitbox" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "Hitbox", + "name": "Vector2", "constructor": true, "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "org.openpatch.scratch.Hitbox" + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "contains", + "name": "add", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "org.openpatch.scratch.Vector2" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "drawDebug", + "name": "angle", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "drawShape", + "name": "clone", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "equals", + "name": "direction", "constructor": false, "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "getBounds", + "name": "distance", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "double" }, { - "name": "getClass", + "name": "distanceSq", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "double" }, { - "name": "getShape", + "name": "dot", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Shape" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "double" }, { - "name": "intersects", + "name": "equals", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Hitbox" + "Object" ], "returns": "boolean" }, { - "name": "notify", + "name": "fromPolar", + "constructor": false, + "static": true, + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Vector2" + }, + { + "name": "getX", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "notifyAll", + "name": "getY", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "toString", + "name": "hashCode", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "int" }, { - "name": "translateAndRotateAndResize", + "name": "length", "constructor": false, "static": false, - "parameters": [ - "double", - "double", - "double", - "double", - "double", - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double" + }, + { + "name": "lengthSq", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" }, { - "name": "wait", + "name": "multiply", "constructor": false, "static": false, "parameters": [ - "long" + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "wait", + "name": "normalVector", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.HtmlColor": [ + "returns": "org.openpatch.scratch.Vector2" + }, { - "name": "HtmlColor", - "constructor": true, + "name": "reverse", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.HtmlColor" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "equals", + "name": "rotateBy", "constructor": false, "static": false, "parameters": [ - "Object" + "double" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "getClass", + "name": "rotateTo", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "getRandom", + "name": "sub", "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.Color" + "static": false, + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "notify", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "notifyAll", + "name": "unitVector", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" + } + ], + "org.openpatch.scratch.Window": [ + { + "name": "Window", + "constructor": true, + "static": false, + "parameters": [ + "String" + ], + "returns": "org.openpatch.scratch.Window" }, { - "name": "toString", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "int", + "int", + "String" + ], + "returns": "org.openpatch.scratch.Window" }, { - "name": "wait", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, "parameters": [ - "long" + "int", + "int" ], - "returns": "void" + "returns": "org.openpatch.scratch.Window" }, { - "name": "wait", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.KeyCode": [ + "returns": "org.openpatch.scratch.Window" + }, { - "name": "equals", + "name": "debug", "constructor": false, "static": false, "parameters": [ - "Object" + "Object[]" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "exit", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "void" }, { - "name": "name", + "name": "getFrameSmoothing", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "String" + "returns": "double" }, { - "name": "notify", + "name": "getGameSpeed", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "notifyAll", + "name": "getHeight", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "ordinal", + "name": "getInstance", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "int" + "returns": "org.openpatch.scratch.Window" }, { - "name": "toString", + "name": "getLibraryTitle", "constructor": false, "static": false, "parameters": [], "returns": "String" }, { - "name": "toString", + "name": "getLibraryVersion", "constructor": false, "static": false, "parameters": [], "returns": "String" }, { - "name": "valueOf", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.KeyCode" - }, - { - "name": "values", + "name": "getStage", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "org.openpatch.scratch.KeyCode[]" + "returns": "org.openpatch.scratch.Stage" }, { - "name": "wait", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "long" - ], - "returns": "void" + "parameters": [], + "returns": "int" }, { - "name": "wait", + "name": "isDebug", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Layer": [ + "returns": "boolean" + }, { - "name": "equals", + "name": "isPaused", "constructor": false, "static": false, - "parameters": [ - "Object" - ], + "parameters": [], "returns": "boolean" }, { - "name": "getClass", + "name": "isPixelArt", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "Class" + "returns": "boolean" }, { - "name": "name", + "name": "isSmoothPixelArt", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "String" + "returns": "boolean" }, { - "name": "notify", + "name": "isTransitioning", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "boolean" }, { - "name": "notifyAll", + "name": "pause", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "ordinal", + "name": "resume", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "void" }, { - "name": "toString", + "name": "setDebug", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "boolean" + ], + "returns": "void" }, { - "name": "toString", + "name": "setGameSpeed", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "valueOf", + "name": "setStage", "constructor": false, - "static": true, + "static": false, "parameters": [ - "String" + "org.openpatch.scratch.Stage" ], - "returns": "org.openpatch.scratch.Layer" + "returns": "void" }, { - "name": "values", + "name": "step", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Layer[]" + "returns": "void" }, { - "name": "wait", + "name": "transitionToStage", "constructor": false, "static": false, "parameters": [ - "long" + "java.util.function.Supplier", + "double" ], "returns": "void" }, { - "name": "wait", + "name": "transitionToStage", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "java.util.function.Supplier", + "org.openpatch.scratch.Transition", + "double" + ], "returns": "void" - } - ], - "org.openpatch.scratch.MouseCode": [ + }, { - "name": "equals", + "name": "transitionToStage", "constructor": false, "static": false, "parameters": [ - "Object" + "org.openpatch.scratch.Stage", + "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "useFrameSmoothing", "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" + "static": true, + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "name", + "name": "useFullScreen", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "notify", + "name": "usePixelArt", "constructor": false, - "static": false, + "static": true, "parameters": [], "returns": "void" }, { - "name": "notifyAll", + "name": "useSmoothPixelArt", "constructor": false, - "static": false, + "static": true, "parameters": [], "returns": "void" }, { - "name": "ordinal", + "name": "useSplashLogo", "constructor": false, - "static": false, - "parameters": [], - "returns": "int" + "static": true, + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "toString", + "name": "whenExits", "constructor": false, "static": false, "parameters": [], - "returns": "String" - }, + "returns": "void" + } + ], + "org.openpatch.scratch.drawing.BitmapText": [ { - "name": "toString", - "constructor": false, + "name": "BitmapText", + "constructor": true, "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "valueOf", - "constructor": false, - "static": true, "parameters": [ "String" ], - "returns": "org.openpatch.scratch.MouseCode" + "returns": "org.openpatch.scratch.drawing.BitmapText" }, { - "name": "values", + "name": "addAnimation", "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.MouseCode[]" + "static": false, + "parameters": [ + "String", + "String", + "int", + "int", + "int[]" + ], + "returns": "void" }, { - "name": "wait", + "name": "addAnimation", "constructor": false, "static": false, "parameters": [ - "long" + "String", + "String", + "int", + "int" ], "returns": "void" }, { - "name": "wait", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String", + "int" + ], "returns": "void" - } - ], - "org.openpatch.scratch.Operators": [ + }, { - "name": "absOf", + "name": "addCostume", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double" + "String", + "String", + "int", + "int", + "int", + "int" ], - "returns": "double" + "returns": "void" }, { - "name": "absOf", + "name": "addCostume", "constructor": false, - "static": true, + "static": false, "parameters": [ - "int" + "String", + "String" ], - "returns": "int" + "returns": "void" }, { - "name": "acosOf", + "name": "addCostume", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double" + "String" ], - "returns": "double" + "returns": "void" }, { - "name": "asinOf", + "name": "addCostumes", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double" + "String", + "String", + "int", + "int" ], - "returns": "double" + "returns": "void" }, { - "name": "atanOf", + "name": "addGlyph", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double" + "char", + "String" ], - "returns": "double" + "returns": "void" }, { - "name": "ceilingOf", + "name": "addSound", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double" + "String", + "String" ], - "returns": "double" + "returns": "void" }, { - "name": "constrain", + "name": "addSound", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double", - "double", - "double" + "String" ], - "returns": "double" + "returns": "void" }, { - "name": "constrain", + "name": "ask", "constructor": false, - "static": true, + "static": false, "parameters": [ - "int", - "int", - "int" + "String" ], - "returns": "int" + "returns": "void" }, { - "name": "cosOf", + "name": "broadcast", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double" + "String" ], - "returns": "double" + "returns": "void" }, { - "name": "eToThePowerOf", + "name": "changeColorEffect", "constructor": false, - "static": true, + "static": false, "parameters": [ "double" ], - "returns": "double" + "returns": "void" }, { - "name": "equals", + "name": "changeHeight", "constructor": false, "static": false, "parameters": [ - "Object" + "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "floorOf", + "name": "changePosition", "constructor": false, - "static": true, + "static": false, "parameters": [ + "double", "double" ], - "returns": "double" + "returns": "void" }, { - "name": "getClass", + "name": "changePosition", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void" }, { - "name": "lerp", + "name": "changeSize", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double", - "double", "double" ], - "returns": "double" + "returns": "void" }, { - "name": "lnOf", + "name": "changeTransparency", "constructor": false, - "static": true, + "static": false, "parameters": [ "double" ], - "returns": "double" + "returns": "void" }, { - "name": "logOf", + "name": "changeTransparency", "constructor": false, - "static": true, + "static": false, "parameters": [ "double" ], - "returns": "double" + "returns": "void" }, { - "name": "map", + "name": "changeVolume", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double", - "double", - "double", - "double", "double" ], - "returns": "double" + "returns": "void" }, { - "name": "max", + "name": "changeWidth", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double[]" + "double" ], - "returns": "double" + "returns": "void" }, { - "name": "max", + "name": "changeX", "constructor": false, - "static": true, + "static": false, "parameters": [ - "int[]" + "double" ], - "returns": "int" + "returns": "void" }, { - "name": "min", + "name": "changeY", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double[]" + "double" ], - "returns": "double" + "returns": "void" }, { - "name": "min", + "name": "createClone", "constructor": false, - "static": true, - "parameters": [ - "int[]" - ], - "returns": "int" + "static": false, + "parameters": [], + "returns": "T@201 extends org.openpatch.scratch.Sprite" }, { - "name": "mod", + "name": "debug", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double", - "double" + "Object[]" ], - "returns": "double" + "returns": "void" }, { - "name": "mod", + "name": "deleteThisClone", "constructor": false, - "static": true, - "parameters": [ - "int", - "int" - ], - "returns": "int" + "static": false, + "parameters": [], + "returns": "void" }, { - "name": "notify", + "name": "disableHitbox", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "notifyAll", + "name": "disableNineSlice", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "round", + "name": "distanceToMousePointer", "constructor": false, - "static": true, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "distanceToSprite", + "constructor": false, + "static": false, "parameters": [ - "double", - "int" + "org.openpatch.scratch.Sprite" ], "returns": "double" }, { - "name": "round", + "name": "draw", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double" + "org.openpatch.scratch.drawing.Drawing" ], - "returns": "int" + "returns": "void" }, { - "name": "sinOf", + "name": "draw", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double" + "org.openpatch.scratch.drawing.Drawing" ], - "returns": "double" + "returns": "void" }, { - "name": "sqrtOf", + "name": "enableHitbox", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void" + }, + { + "name": "getAnimationFrame", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int" + }, + { + "name": "getAnimationInterval", "constructor": false, - "static": true, - "parameters": [ - "double" - ], + "static": false, + "parameters": [], "returns": "double" }, { - "name": "tanOf", + "name": "getAnswer", "constructor": false, - "static": true, - "parameters": [ - "double" - ], - "returns": "double" + "static": false, + "parameters": [], + "returns": "String" }, { - "name": "tenToThePowerOf", + "name": "getColorEffect", "constructor": false, - "static": true, - "parameters": [ - "double" - ], + "static": false, + "parameters": [], "returns": "double" }, { - "name": "toString", + "name": "getContent", "constructor": false, "static": false, "parameters": [], "returns": "String" }, { - "name": "wait", + "name": "getCurrentCostumeIndex", "constructor": false, "static": false, - "parameters": [ - "long" - ], - "returns": "void" + "parameters": [], + "returns": "int" }, { - "name": "wait", + "name": "getCurrentCostumeName", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Pen": [ + "returns": "String" + }, { - "name": "Pen", - "constructor": true, + "name": "getDirection", + "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Pen" - ], - "returns": "org.openpatch.scratch.Pen" + "parameters": [], + "returns": "double" }, { - "name": "Pen", - "constructor": true, + "name": "getHeight", + "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "org.openpatch.scratch.Pen" + "parameters": [], + "returns": "double" }, { - "name": "Pen", - "constructor": true, + "name": "getHeight", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Pen" + "returns": "int" }, { - "name": "addedToStage", + "name": "getHitbox", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Shape" }, { - "name": "changeColor", + "name": "getLayer", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Layer" }, { - "name": "changeSize", + "name": "getMouse", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "changeTransparency", + "name": "getMouseX", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "down", + "name": "getMouseY", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "equals", + "name": "getPen", "constructor": false, "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" + "parameters": [], + "returns": "org.openpatch.scratch.Pen" }, { - "name": "eraseAll", + "name": "getPosition", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "getClass", + "name": "getRotationStyle", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "org.openpatch.scratch.RotationStyle" }, { - "name": "getColor", + "name": "getShaders", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Color" + "returns": "org.openpatch.scratch.Shaders" }, { "name": "getSize", @@ -16772,267 +5331,254 @@ "returns": "double" }, { - "name": "goToBackground", + "name": "getStage", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Stage" }, { - "name": "goToForeground", + "name": "getText", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Text" }, { - "name": "goToMousePointer", + "name": "getTimer", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Timer" }, { - "name": "goToRandomPosition", + "name": "getTint", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { - "name": "isInBackground", + "name": "getTouchingSprite", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "Class" + ], + "returns": "T@199 extends org.openpatch.scratch.Sprite" + }, + { + "name": "getTouchingSprites", + "constructor": false, + "static": false, + "parameters": [ + "Class" + ], + "returns": "List" }, { - "name": "notify", + "name": "getTransparency", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "notifyAll", + "name": "getTransparency", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "removedFromStage", + "name": "getVolume", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "setColor", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "setColor", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "int" }, { - "name": "setColor", + "name": "getX", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "setPosition", + "name": "getY", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "setPosition", + "name": "glide", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "double", + "double", + "double" ], "returns": "void" }, { - "name": "setSize", + "name": "goLayersBackwards", "constructor": false, "static": false, "parameters": [ - "double" + "int" ], "returns": "void" }, { - "name": "setTransparency", + "name": "goLayersForwards", "constructor": false, "static": false, "parameters": [ - "double" + "int" ], "returns": "void" }, { - "name": "stamp", + "name": "goToBackLayer", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "toString", + "name": "goToFrontLayer", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "toString", + "name": "goToMousePointer", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "up", + "name": "goToRandomPosition", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "wait", + "name": "goToSprite", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.Sprite" ], "returns": "void" }, { - "name": "wait", + "name": "hide", "constructor": false, "static": false, "parameters": [], "returns": "void" - } - ], - "org.openpatch.scratch.Polygon": [ + }, { - "name": "Polygon", - "constructor": true, + "name": "hideVariable", + "constructor": false, "static": false, "parameters": [ - "double[]", - "double[]" + "String" ], - "returns": "org.openpatch.scratch.Polygon" + "returns": "void" }, { - "name": "Polygon", - "constructor": true, + "name": "ifOnEdgeBounce", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Polygon" + "returns": "void" }, { - "name": "addPoint", + "name": "isAnimationPlayed", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "contains", + "name": "isAsking", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], + "parameters": [], "returns": "boolean" }, { - "name": "draw", + "name": "isClone", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "boolean" }, { - "name": "equals", + "name": "isColorTouchingColor", "constructor": false, "static": false, "parameters": [ - "Object" + "org.openpatch.scratch.Color", + "org.openpatch.scratch.Color" ], "returns": "boolean" }, { - "name": "getBounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" - }, - { - "name": "getClass", + "name": "isGliding", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "boolean" }, { - "name": "intersects", + "name": "isKeyPressed", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Shape" + "org.openpatch.scratch.KeyCode" ], "returns": "boolean" }, { - "name": "notify", + "name": "isMouseDown", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "boolean" }, { - "name": "notifyAll", + "name": "isSoundPlaying", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "String" + ], + "returns": "boolean" }, { - "name": "rotate", + "name": "isTouchingColor", "constructor": false, "static": false, "parameters": [ @@ -17040,518 +5586,527 @@ "double", "double" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "boolean" }, { - "name": "scale", + "name": "isTouchingColor", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "org.openpatch.scratch.Color" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "boolean" }, { - "name": "toString", + "name": "isTouchingEdge", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "boolean" }, { - "name": "translate", + "name": "isTouchingMousePointer", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "org.openpatch.scratch.Shape" + "parameters": [], + "returns": "boolean" }, { - "name": "wait", + "name": "isTouchingSprite", "constructor": false, "static": false, "parameters": [ - "long" + "Class" ], - "returns": "void" + "returns": "boolean" }, { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Random": [ - { - "name": "equals", + "name": "isTouchingSprite", "constructor": false, "static": false, "parameters": [ - "Object" + "org.openpatch.scratch.Sprite" ], "returns": "boolean" }, { - "name": "getClass", + "name": "isVisible", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "boolean" }, { - "name": "noise", + "name": "move", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double", - "double", "double" ], - "returns": "double" + "returns": "void" }, { - "name": "noise", + "name": "nextCostume", "constructor": false, - "static": true, - "parameters": [ - "double", - "double" - ], - "returns": "double" + "static": false, + "parameters": [], + "returns": "void" }, { - "name": "noise", + "name": "pickRandom", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double" + "int", + "int" ], - "returns": "double" + "returns": "int" }, { - "name": "noiseSeed", + "name": "playAnimation", "constructor": false, - "static": true, + "static": false, "parameters": [ - "long" + "String", + "boolean" ], "returns": "void" }, { - "name": "notify", + "name": "playAnimation", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "playSound", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "random", + "name": "playSoundCopy", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double", + "String", "double" ], - "returns": "double" + "returns": "org.openpatch.scratch.SoundPlayback" }, { - "name": "random", + "name": "pointTowards", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Sprite" ], - "returns": "double" - }, - { - "name": "random", - "constructor": false, - "static": true, - "parameters": [], - "returns": "double" + "returns": "void" }, { - "name": "randomInt", + "name": "pointTowards", "constructor": false, - "static": true, + "static": false, "parameters": [ - "int", - "int" + "org.openpatch.scratch.Vector2" ], - "returns": "int" + "returns": "void" }, { - "name": "randomInt", + "name": "pointTowardsMousePointer", "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "int" + "static": false, + "parameters": [], + "returns": "void" }, { - "name": "randomPosition", + "name": "previousCostume", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "randomSeed", + "name": "remove", "constructor": false, - "static": true, - "parameters": [ - "long" - ], + "static": false, + "parameters": [], "returns": "void" }, { - "name": "randomVector2", + "name": "resetAnimation", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "randomX", + "name": "run", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "double" + "returns": "void" }, { - "name": "randomY", + "name": "say", "constructor": false, - "static": true, - "parameters": [], - "returns": "double" + "static": false, + "parameters": [ + "String", + "double" + ], + "returns": "void" }, { - "name": "toString", + "name": "say", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "wait", + "name": "setAlign", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.TextAlign" ], "returns": "void" }, { - "name": "wait", + "name": "setAnimationFrame", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "int" + ], "returns": "void" - } - ], - "org.openpatch.scratch.Rectangle": [ + }, { - "name": "Rectangle", - "constructor": true, + "name": "setAnimationInterval", + "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double", "double" ], - "returns": "org.openpatch.scratch.Rectangle" + "returns": "void" }, { - "name": "contains", + "name": "setColorEffect", "constructor": false, "static": false, "parameters": [ - "double", "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "draw", + "name": "setDirection", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "equals", + "name": "setFont", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getBounds", + "name": "setHeight", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getClass", + "name": "setHitbox", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "org.openpatch.scratch.Shape" + ], + "returns": "void" }, { - "name": "intersects", + "name": "setLayer", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Shape" + "org.openpatch.scratch.Layer" ], - "returns": "boolean" + "returns": "void" }, { - "name": "notify", + "name": "setLetterSpacing", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "setLineSpacing", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "rotate", + "name": "setNineSlice", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "int", + "int", + "int", + "int" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "void" }, { - "name": "scale", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ "double", "double" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "void" }, { - "name": "toString", + "name": "setPosition", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void" }, { - "name": "translate", + "name": "setRotationCenter", "constructor": false, "static": false, "parameters": [ "double", "double" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "void" }, { - "name": "wait", + "name": "setRotationStyle", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.RotationStyle" ], "returns": "void" }, { - "name": "wait", + "name": "setSize", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" - } - ], - "org.openpatch.scratch.RotationStyle": [ + }, { - "name": "equals", + "name": "setSpaceWidth", "constructor": false, "static": false, "parameters": [ - "Object" + "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "setTint", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "void" }, { - "name": "name", + "name": "setTint", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "org.openpatch.scratch.Color" + ], + "returns": "void" }, { - "name": "notify", + "name": "setTransparency", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "setTransparency", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "ordinal", + "name": "setVolume", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "toString", + "name": "setWidth", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "toString", + "name": "setX", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "valueOf", + "name": "setY", "constructor": false, - "static": true, + "static": false, "parameters": [ - "String" + "double" ], - "returns": "org.openpatch.scratch.RotationStyle" + "returns": "void" }, { - "name": "values", + "name": "show", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "org.openpatch.scratch.RotationStyle[]" + "returns": "void" }, { - "name": "wait", + "name": "showText", "constructor": false, "static": false, "parameters": [ - "long" + "String" ], "returns": "void" }, { - "name": "wait", + "name": "showVariable", "constructor": false, "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.ScratchException": [ - { - "name": "ScratchException", - "constructor": true, - "static": false, "parameters": [ - "String" + "String", + "java.util.function.Supplier" ], - "returns": "org.openpatch.scratch.ScratchException" + "returns": "void" }, { - "name": "equals", + "name": "stamp", "constructor": false, "static": false, "parameters": [ - "Object" + "org.openpatch.scratch.Layer" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "stamp", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "void" }, { - "name": "getMessage", + "name": "stopAllSounds", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "notify", + "name": "stopSound", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "switchCostume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "toString", + "name": "switchCostume", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "toString", + "name": "think", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "String", + "double" + ], + "returns": "void" }, { - "name": "toString", + "name": "think", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "String" + ], + "returns": "void" }, { "name": "toString", @@ -17561,189 +6116,236 @@ "returns": "String" }, { - "name": "toString", + "name": "turnLeft", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "wait", + "name": "turnRight", "constructor": false, "static": false, "parameters": [ - "long" + "double" ], "returns": "void" }, { - "name": "wait", + "name": "whenAddedToStage", "constructor": false, "static": false, "parameters": [], "returns": "void" - } - ], - "org.openpatch.scratch.Shape": [ + }, { - "name": "contains", + "name": "whenBackdropSwitches", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "draw", + "name": "whenClicked", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "equals", + "name": "whenIReceive", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getBounds", + "name": "whenKeyPressed", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds" + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "void" }, { - "name": "getClass", + "name": "whenKeyReleased", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "void" }, { - "name": "intersects", + "name": "whenMouseClicked", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Shape" + "org.openpatch.scratch.MouseCode" ], - "returns": "boolean" + "returns": "void" + }, + { + "name": "whenMouseMoved", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double" + ], + "returns": "void" }, { - "name": "notify", + "name": "whenRemovedFromStage", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "notifyAll", + "name": "whenStartsAsClone", "constructor": false, "static": false, "parameters": [], "returns": "void" + } + ], + "org.openpatch.scratch.drawing.Drawing": [ + { + "name": "clip", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double", + "double", + "double" + ], + "returns": "void" }, { - "name": "rotate", + "name": "image", "constructor": false, "static": false, "parameters": [ + "String", + "double", "double", "double", "double" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "void" }, { - "name": "scale", + "name": "image", "constructor": false, "static": false, "parameters": [ + "String", "double", "double" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "void" }, { - "name": "toString", + "name": "imageHeight", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "String" + ], + "returns": "int" }, { - "name": "translate", + "name": "imageWidth", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "String" ], - "returns": "org.openpatch.scratch.Shape" + "returns": "int" + }, + { + "name": "noClip", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void" }, { - "name": "wait", + "name": "polygon", "constructor": false, "static": false, "parameters": [ - "long" + "double[]", + "double[]", + "org.openpatch.scratch.Color" ], "returns": "void" }, { - "name": "wait", + "name": "rectangle", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" + ], "returns": "void" } ], - "org.openpatch.scratch.Sprite": [ + "org.openpatch.scratch.drawing.DrawingSprite": [ { - "name": "Sprite", + "name": "DrawingSprite", "constructor": true, "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "org.openpatch.scratch.Sprite" + "parameters": [], + "returns": "org.openpatch.scratch.drawing.DrawingSprite" }, { - "name": "Sprite", - "constructor": true, + "name": "addAnimation", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "String", + "String", + "int", + "int", + "int[]" ], - "returns": "org.openpatch.scratch.Sprite" - }, - { - "name": "Sprite", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Sprite" + "returns": "void" }, { - "name": "act", + "name": "addAnimation", "constructor": false, "static": false, "parameters": [ - "double" + "String", + "String", + "int", + "int" ], "returns": "void" }, { - "name": "act", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String", + "int" + ], "returns": "void" }, { @@ -17828,6 +6430,24 @@ ], "returns": "void" }, + { + "name": "changeColorEffect", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void" + }, + { + "name": "changeHeight", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void" + }, { "name": "changePosition", "constructor": false, @@ -17857,7 +6477,7 @@ "returns": "void" }, { - "name": "changeTint", + "name": "changeTransparency", "constructor": false, "static": false, "parameters": [ @@ -17883,6 +6503,15 @@ ], "returns": "void" }, + { + "name": "changeWidth", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void" + }, { "name": "changeX", "constructor": false, @@ -17902,11 +6531,11 @@ "returns": "void" }, { - "name": "clone", + "name": "createClone", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Sprite" + "returns": "T@201 extends org.openpatch.scratch.Sprite" }, { "name": "debug", @@ -17925,14 +6554,14 @@ "returns": "void" }, { - "name": "destroy", + "name": "disableHitbox", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "disableHitbox", + "name": "disableNineSlice", "constructor": false, "static": false, "parameters": [], @@ -17954,6 +6583,15 @@ ], "returns": "double" }, + { + "name": "draw", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.drawing.Drawing" + ], + "returns": "void" + }, { "name": "enableHitbox", "constructor": false, @@ -17962,13 +6600,18 @@ "returns": "void" }, { - "name": "equals", + "name": "getAnimationFrame", "constructor": false, "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" + "parameters": [], + "returns": "int" + }, + { + "name": "getAnimationInterval", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" }, { "name": "getAnswer", @@ -17978,11 +6621,11 @@ "returns": "String" }, { - "name": "getClass", + "name": "getColorEffect", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "double" }, { "name": "getCurrentCostumeIndex", @@ -17998,13 +6641,6 @@ "parameters": [], "returns": "String" }, - { - "name": "getDeltaTime", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, { "name": "getDirection", "constructor": false, @@ -18013,28 +6649,25 @@ "returns": "double" }, { - "name": "getGamepadAxisValue", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "int", - "int" - ], + "parameters": [], "returns": "double" }, { - "name": "getHeight", + "name": "getHitbox", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "getHitbox", + "name": "getLayer", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Hitbox" + "returns": "org.openpatch.scratch.Layer" }, { "name": "getMouse", @@ -18071,12 +6704,19 @@ "parameters": [], "returns": "org.openpatch.scratch.Vector2" }, + { + "name": "getRotationStyle", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.RotationStyle" + }, { "name": "getShaders", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" + "returns": "org.openpatch.scratch.Shaders" }, { "name": "getSize", @@ -18099,15 +6739,6 @@ "parameters": [], "returns": "org.openpatch.scratch.Text" }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.Timer" - }, { "name": "getTimer", "constructor": false, @@ -18127,18 +6758,25 @@ "constructor": false, "static": false, "parameters": [ - "Class" + "Class" ], - "returns": "T@407 extends org.openpatch.scratch.Sprite" + "returns": "T@199 extends org.openpatch.scratch.Sprite" }, { "name": "getTouchingSprites", "constructor": false, "static": false, "parameters": [ - "Class" + "Class" ], - "returns": "nrw.List" + "returns": "List" + }, + { + "name": "getTransparency", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" }, { "name": "getTransparency", @@ -18159,7 +6797,7 @@ "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "double" }, { "name": "getX", @@ -18265,7 +6903,7 @@ "returns": "void" }, { - "name": "isActing", + "name": "isAnimationPlayed", "constructor": false, "static": false, "parameters": [], @@ -18295,32 +6933,6 @@ ], "returns": "boolean" }, - { - "name": "isDestroyed", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean" - }, - { - "name": "isGamepadButtonDown", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "boolean" - }, - { - "name": "isGamepadConnected", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" - }, { "name": "isGliding", "constructor": false, @@ -18328,15 +6940,6 @@ "parameters": [], "returns": "boolean" }, - { - "name": "isKeyDown", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, { "name": "isKeyPressed", "constructor": false, @@ -18346,15 +6949,6 @@ ], "returns": "boolean" }, - { - "name": "isKeyUp", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" - }, { "name": "isMouseDown", "constructor": false, @@ -18410,7 +7004,7 @@ "constructor": false, "static": false, "parameters": [ - "Class" + "Class" ], "returns": "boolean" }, @@ -18428,67 +7022,46 @@ "constructor": false, "static": false, "parameters": [], - "returns": "boolean" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" - }, - { - "name": "nextCostume", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "returns": "boolean" }, { - "name": "notify", + "name": "move", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "nextCostume", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "onKeyDown", + "name": "pickRandom", "constructor": false, "static": false, "parameters": [ - "String" + "int", + "int" ], - "returns": "void" + "returns": "int" }, { - "name": "onKeyTyped", + "name": "playAnimation", "constructor": false, "static": false, "parameters": [ - "String" + "String", + "boolean" ], "returns": "void" }, { - "name": "onKeyUp", + "name": "playAnimation", "constructor": false, "static": false, "parameters": [ @@ -18496,16 +7069,6 @@ ], "returns": "void" }, - { - "name": "pickRandom", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "int" - }, { "name": "playSound", "constructor": false, @@ -18523,19 +7086,19 @@ "String", "double" ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" + "returns": "org.openpatch.scratch.SoundPlayback" }, { - "name": "pointInDirection", + "name": "pointTowards", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Sprite" ], "returns": "void" }, { - "name": "pointInDirection", + "name": "pointTowards", "constructor": false, "static": false, "parameters": [ @@ -18550,15 +7113,6 @@ "parameters": [], "returns": "void" }, - { - "name": "pointTowardsSprite", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, { "name": "previousCostume", "constructor": false, @@ -18574,7 +7128,7 @@ "returns": "void" }, { - "name": "restartActing", + "name": "resetAnimation", "constructor": false, "static": false, "parameters": [], @@ -18593,7 +7147,7 @@ "static": false, "parameters": [ "String", - "int" + "double" ], "returns": "void" }, @@ -18607,16 +7161,25 @@ "returns": "void" }, { - "name": "setActFrequency", + "name": "setAnimationFrame", "constructor": false, - "static": true, + "static": false, "parameters": [ "int" ], "returns": "void" }, { - "name": "setDirection", + "name": "setAnimationInterval", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void" + }, + { + "name": "setColorEffect", "constructor": false, "static": false, "parameters": [ @@ -18629,16 +7192,16 @@ "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "double" ], "returns": "void" }, { - "name": "setHitbox", + "name": "setHeight", "constructor": false, "static": false, "parameters": [ - "double[]" + "double" ], "returns": "void" }, @@ -18651,6 +7214,27 @@ ], "returns": "void" }, + { + "name": "setLayer", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Layer" + ], + "returns": "void" + }, + { + "name": "setNineSlice", + "constructor": false, + "static": false, + "parameters": [ + "int", + "int", + "int", + "int" + ], + "returns": "void" + }, { "name": "setPosition", "constructor": false, @@ -18714,16 +7298,16 @@ "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Color" ], "returns": "void" }, { - "name": "setTint", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "double" ], "returns": "void" }, @@ -18745,6 +7329,15 @@ ], "returns": "void" }, + { + "name": "setWidth", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void" + }, { "name": "setX", "constructor": false, @@ -18796,13 +7389,6 @@ "parameters": [], "returns": "void" }, - { - "name": "stopActing", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, { "name": "stopAllSounds", "constructor": false, @@ -18843,7 +7429,7 @@ "static": false, "parameters": [ "String", - "int" + "double" ], "returns": "void" }, @@ -18881,815 +7467,733 @@ ], "returns": "void" }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, { "name": "whenAddedToStage", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenBackdropSwitches", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenClicked", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenIReceive", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "whenKeyPressed", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenKeyReleased", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void" - }, - { - "name": "whenMouseClicked", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.MouseCode" - ], - "returns": "void" - }, - { - "name": "whenMouseMoved", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" - }, - { - "name": "whenRemovedFromStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenStartsAsClone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Stage": [ - { - "name": "Stage", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" - }, - { - "name": "act", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "add", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Pen" - ], - "returns": "void" - }, - { - "name": "add", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" - }, - { - "name": "add", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Text" - ], - "returns": "void" - }, - { - "name": "addBackdrop", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "boolean" - ], + "static": false, + "parameters": [], "returns": "void" }, { - "name": "addBackdrop", + "name": "whenBackdropSwitches", "constructor": false, "static": false, "parameters": [ - "String", "String" ], "returns": "void" }, { - "name": "addBackdrop", + "name": "whenClicked", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "void" }, { - "name": "addSound", + "name": "whenIReceive", "constructor": false, "static": false, "parameters": [ - "String", "String" ], "returns": "void" }, { - "name": "addSound", + "name": "whenKeyPressed", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.KeyCode" ], "returns": "void" }, { - "name": "ask", + "name": "whenKeyReleased", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.KeyCode" ], "returns": "void" }, { - "name": "broadcast", + "name": "whenMouseClicked", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.MouseCode" ], "returns": "void" }, { - "name": "changeColor", + "name": "whenMouseMoved", "constructor": false, "static": false, "parameters": [ + "double", "double" ], "returns": "void" }, { - "name": "changeTint", + "name": "whenRemovedFromStage", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "changeTransparency", + "name": "whenStartsAsClone", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void" - }, + } + ], + "org.openpatch.scratch.gamepad.Gamepad": [ { - "name": "changeVolume", + "name": "getStick", "constructor": false, - "static": false, + "static": true, "parameters": [ - "double" + "int", + "org.openpatch.scratch.gamepad.GamepadStick" ], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "count", + "name": "getStick", "constructor": false, - "static": false, + "static": true, "parameters": [ - "Class" + "org.openpatch.scratch.gamepad.GamepadStick" ], - "returns": "int" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "debug", + "name": "getTrigger", "constructor": false, - "static": false, + "static": true, "parameters": [ - "Object[]" + "int", + "org.openpatch.scratch.gamepad.GamepadTrigger" ], - "returns": "void" + "returns": "double" }, { - "name": "destroy", + "name": "getTrigger", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadTrigger" + ], + "returns": "double" }, { - "name": "display", + "name": "isButtonPressed", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String", - "int" + "int", + "org.openpatch.scratch.gamepad.GamepadButton" ], - "returns": "void" + "returns": "boolean" }, { - "name": "display", + "name": "isButtonPressed", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String" + "org.openpatch.scratch.gamepad.GamepadButton" ], - "returns": "void" + "returns": "boolean" }, { - "name": "equals", + "name": "isConnected", "constructor": false, - "static": false, + "static": true, "parameters": [ - "Object" + "int" ], "returns": "boolean" }, { - "name": "eraseAll", + "name": "isConnected", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void" + "returns": "boolean" + } + ], + "org.openpatch.scratch.gamepad.GamepadButton": [ + { + "name": "valueOf", + "constructor": false, + "static": true, + "parameters": [ + "String" + ], + "returns": "org.openpatch.scratch.gamepad.GamepadButton" }, { - "name": "exit", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void" - }, + "returns": "org.openpatch.scratch.gamepad.GamepadButton[]" + } + ], + "org.openpatch.scratch.gamepad.GamepadListener": [ { - "name": "find", + "name": "whenGamepadButtonPressed", "constructor": false, "static": false, "parameters": [ - "Class" + "org.openpatch.scratch.gamepad.GamepadButton" ], - "returns": "nrw.List" + "returns": "void" }, { - "name": "getAll", + "name": "whenGamepadButtonReleased", "constructor": false, "static": false, - "parameters": [], - "returns": "nrw.List" + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadButton" + ], + "returns": "void" }, { - "name": "getAnswer", + "name": "whenGamepadConnected", "constructor": false, "static": false, - "parameters": [], - "returns": "String" - }, + "parameters": [ + "int" + ], + "returns": "void" + } + ], + "org.openpatch.scratch.gamepad.GamepadStick": [ { - "name": "getCamera", + "name": "valueOf", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.camera.Camera" + "static": true, + "parameters": [ + "String" + ], + "returns": "org.openpatch.scratch.gamepad.GamepadStick" }, { - "name": "getClass", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "Class" + "returns": "org.openpatch.scratch.gamepad.GamepadStick[]" + } + ], + "org.openpatch.scratch.gamepad.GamepadTrigger": [ + { + "name": "valueOf", + "constructor": false, + "static": true, + "parameters": [ + "String" + ], + "returns": "org.openpatch.scratch.gamepad.GamepadTrigger" }, { - "name": "getColor", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "org.openpatch.scratch.Color" + "returns": "org.openpatch.scratch.gamepad.GamepadTrigger[]" + } + ], + "org.openpatch.scratch.recorder.GifRecorder": [ + { + "name": "GifRecorder", + "constructor": true, + "static": false, + "parameters": [ + "String" + ], + "returns": "org.openpatch.scratch.recorder.GifRecorder" }, { - "name": "getCurrentBackdropIndex", + "name": "snapshot", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "void" }, { - "name": "getCurrentBackdropName", + "name": "start", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "getDeltaTime", + "name": "stop", "constructor": false, "static": false, "parameters": [], - "returns": "double" - }, + "returns": "void" + } + ], + "org.openpatch.scratch.save.File": [ { - "name": "getFrameRate", - "constructor": false, + "name": "File", + "constructor": true, "static": false, "parameters": [], - "returns": "double" + "returns": "org.openpatch.scratch.save.File" }, { - "name": "getGamepadAxisValue", + "name": "load", "constructor": false, - "static": false, + "static": true, "parameters": [ - "int", - "int" + "String", + "Class" ], - "returns": "double" + "returns": "Object" }, { - "name": "getHeight", + "name": "loadOrCreate", "constructor": false, - "static": false, - "parameters": [], - "returns": "int" + "static": true, + "parameters": [ + "String", + "Class" + ], + "returns": "Object" }, { - "name": "getMouse", + "name": "loadXML", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "static": true, + "parameters": [ + "String", + "Class" + ], + "returns": "Object" }, { - "name": "getMouseX", + "name": "loadXMLOrCreate", "constructor": false, - "static": false, - "parameters": [], - "returns": "double" + "static": true, + "parameters": [ + "String", + "Class" + ], + "returns": "Object" }, { - "name": "getMouseY", + "name": "save", "constructor": false, - "static": false, - "parameters": [], - "returns": "double" + "static": true, + "parameters": [ + "String", + "Object" + ], + "returns": "void" }, { - "name": "getPixels", + "name": "saveXML", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.pixels.Pixels" - }, + "static": true, + "parameters": [ + "String", + "Object" + ], + "returns": "void" + } + ], + "org.openpatch.scratch.save.SaveData": [ { - "name": "getShaders", - "constructor": false, + "name": "SaveData", + "constructor": true, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" + "parameters": [ + "String", + "String", + "Class" + ], + "returns": "org.openpatch.scratch.save.SaveData" }, { - "name": "getSorting", + "name": "getLocation", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.sorting.Sorting" + "returns": "String" }, { - "name": "getTimer", + "name": "loadOrDefault", "constructor": false, "static": false, "parameters": [ - "String" + "java.util.function.Supplier" ], - "returns": "org.openpatch.scratch.Timer" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Timer" + "returns": "T@132" }, { - "name": "getVolume", + "name": "save", "constructor": false, "static": false, - "parameters": [], - "returns": "double" - }, + "parameters": [ + "T@132" + ], + "returns": "void" + } + ], + "org.openpatch.scratch.tiled.MapObject": [ { - "name": "getWidth", - "constructor": false, + "name": "MapObject", + "constructor": true, "static": false, "parameters": [], - "returns": "int" + "returns": "org.openpatch.scratch.tiled.MapObject" }, { - "name": "hideVariable", + "name": "getProperty", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "void" + "returns": "String" }, { - "name": "isActing", + "name": "getPropertyBoolean", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "boolean" }, { - "name": "isAsking", + "name": "getPropertyFloat", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "String" + ], + "returns": "float" }, { - "name": "isDebug", + "name": "getPropertyInt", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "String" + ], + "returns": "int" }, { - "name": "isDestroyed", + "name": "getShape", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "isGamepadButtonDown", + "name": "setClassName", "constructor": false, "static": false, "parameters": [ - "int", - "int" + "String" ], - "returns": "boolean" - }, + "returns": "void" + } + ], + "org.openpatch.scratch.tiled.Property": [ { - "name": "isGamepadConnected", - "constructor": false, + "name": "Property", + "constructor": true, "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" + "parameters": [], + "returns": "org.openpatch.scratch.tiled.Property" }, { - "name": "isKeyDown", + "name": "setText", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "boolean" - }, + "returns": "void" + } + ], + "org.openpatch.scratch.tiled.TiledMap": [ { - "name": "isKeyPressed", - "constructor": false, + "name": "TiledMap", + "constructor": true, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "String", + "org.openpatch.scratch.Stage" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.tiled.TiledMap" }, { - "name": "isKeyUp", - "constructor": false, + "name": "TiledMap", + "constructor": true, "static": false, "parameters": [ "String" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.tiled.TiledMap" }, { - "name": "isMouseDown", + "name": "getHeight", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "int" }, { - "name": "isSoundPlaying", + "name": "getObjectsFromLayer", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "boolean" - }, - { - "name": "nextBackdrop", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.tiled.MapObject[]" }, { - "name": "notify", + "name": "getProperty", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "String", + "String" + ], + "returns": "String" }, { - "name": "notifyAll", + "name": "getProperty", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "String" + ], + "returns": "String" }, { - "name": "onKeyDown", + "name": "getPropertyBoolean", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "void" + "returns": "boolean" }, { - "name": "onKeyTyped", + "name": "getPropertyFloat", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "void" + "returns": "float" }, { - "name": "onKeyUp", + "name": "getPropertyInt", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "void" + "returns": "int" }, { - "name": "pickRandom", + "name": "getTileCollisionShapes", "constructor": false, "static": false, "parameters": [ + "String", "int", "int" ], - "returns": "int" + "returns": "org.openpatch.scratch.Shape[]" }, { - "name": "playSound", + "name": "getTileCollisionShapes", "constructor": false, "static": false, "parameters": [ - "String" + "int" ], - "returns": "void" + "returns": "org.openpatch.scratch.Shape[]" }, { - "name": "playSoundCopy", + "name": "getTileHeight", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int" + }, + { + "name": "getTileId", "constructor": false, "static": false, "parameters": [ "String", - "double" + "int", + "int" ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" + "returns": "int" }, { - "name": "previousBackdrop", + "name": "getTileWidth", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "randomBackdrop", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "remove", + "name": "hideLayer", "constructor": false, "static": false, "parameters": [ - "Class" + "String" ], "returns": "void" }, { - "name": "remove", + "name": "showLayer", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Pen" + "String", + "org.openpatch.scratch.Layer" ], "returns": "void" }, { - "name": "remove", + "name": "spawn", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "String" ], - "returns": "void" - }, + "returns": "List" + } + ], + "org.openpatch.scratch.tiled.TilesetImage": [ { - "name": "remove", - "constructor": false, + "name": "TilesetImage", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.tiled.TilesetImage" + } + ] + }, + "nrw": { + "org.openpatch.scratch.Bounds": [ + { + "name": "Bounds", + "constructor": true, "static": false, "parameters": [ - "org.openpatch.scratch.Text" + "double", + "double", + "double", + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Bounds" }, { - "name": "removeAll", + "name": "equals", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "Object" + ], + "returns": "boolean" }, { - "name": "restartActing", + "name": "hashCode", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "run", + "name": "height", "constructor": false, "static": false, "parameters": [], - "returns": "void" - }, - { - "name": "setActFrequency", - "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "void" + "returns": "double" }, { - "name": "setColor", + "name": "intersects", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "org.openpatch.scratch.Bounds" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setColor", + "name": "toString", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "String" }, { - "name": "setColor", + "name": "width", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "setCursor", + "name": "x", "constructor": false, "static": false, - "parameters": [ - "String", - "int", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "setCursor", + "name": "y", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, + "parameters": [], + "returns": "double" + } + ], + "org.openpatch.scratch.Camera": [ { - "name": "setDebug", - "constructor": false, + "name": "Camera", + "constructor": true, "static": false, - "parameters": [ - "boolean" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Camera" }, { - "name": "setTint", + "name": "changeX", "constructor": false, "static": false, "parameters": [ - "double", - "double", "double" ], "returns": "void" }, { - "name": "setTint", + "name": "changeY", "constructor": false, "static": false, "parameters": [ @@ -19698,7 +8202,7 @@ "returns": "void" }, { - "name": "setTransparency", + "name": "changeZoom", "constructor": false, "static": false, "parameters": [ @@ -19707,231 +8211,325 @@ "returns": "void" }, { - "name": "setVolume", + "name": "getPosition", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "showVariable", + "name": "getX", "constructor": false, "static": false, - "parameters": [ - "String", - "java.util.function.Supplier" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "stopActing", + "name": "getY", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "stopAllSounds", + "name": "getZoom", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "stopSound", + "name": "resetZoom", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "void" }, { - "name": "switchBackdrop", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "String" + "double", + "double" ], "returns": "void" }, { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "int" + "org.openpatch.scratch.Vector2" ], "returns": "void" }, { - "name": "wait", + "name": "setX", "constructor": false, "static": false, "parameters": [ - "long" + "double" ], "returns": "void" }, { - "name": "wait", + "name": "setY", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "waitUntil", + "name": "setZoom", "constructor": false, "static": false, "parameters": [ - "java.util.function.BooleanSupplier" + "double" ], "returns": "void" }, { - "name": "whenBackdropSwitches", + "name": "setZoomLimit", "constructor": false, "static": false, "parameters": [ - "String" + "double", + "double" ], "returns": "void" }, { - "name": "whenIReceive", + "name": "toScreenPosition", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.Vector2" ], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "whenKeyPressed", + "name": "toScreenX", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "whenKeyReleased", + "name": "toScreenY", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "whenMouseClicked", + "name": "toWorldPosition", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.MouseCode" + "org.openpatch.scratch.Vector2" ], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "whenMouseMoved", + "name": "toWorldX", "constructor": false, "static": false, "parameters": [ - "double", "double" ], - "returns": "void" + "returns": "double" }, { - "name": "whenMouseWheelMoved", + "name": "toWorldY", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], - "returns": "void" + "returns": "double" } ], - "org.openpatch.scratch.Text": [ + "org.openpatch.scratch.Circle": [ { - "name": "Text", + "name": "Circle", "constructor": true, "static": false, "parameters": [ - "String", "double", "double", + "double" + ], + "returns": "org.openpatch.scratch.Circle" + }, + { + "name": "contains", + "constructor": false, + "static": false, + "parameters": [ "double", - "org.openpatch.scratch.TextStyle" + "double" ], - "returns": "org.openpatch.scratch.Text" + "returns": "boolean" }, { - "name": "Text", - "constructor": true, + "name": "getBounds", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Bounds" + }, + { + "name": "getPoints", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double[]" + }, + { + "name": "intersects", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Shape" + ], + "returns": "boolean" + }, + { + "name": "rotate", + "constructor": false, "static": false, "parameters": [ - "String", "double", "double", "double" ], - "returns": "org.openpatch.scratch.Text" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "Text", - "constructor": true, + "name": "scale", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double", + "double" ], - "returns": "org.openpatch.scratch.Text" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "Text", - "constructor": true, + "name": "translate", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Text" + "double", + "double" ], - "returns": "org.openpatch.scratch.Text" + "returns": "org.openpatch.scratch.Shape" + } + ], + "org.openpatch.scratch.Clock": [ + { + "name": "getDay", + "constructor": false, + "static": true, + "parameters": [], + "returns": "int" }, { - "name": "Text", - "constructor": true, - "static": false, + "name": "getDayOfWeek", + "constructor": false, + "static": true, "parameters": [], - "returns": "org.openpatch.scratch.Text" + "returns": "int" }, { - "name": "addFont", + "name": "getDaysSince2000", + "constructor": false, + "static": true, + "parameters": [], + "returns": "int" + }, + { + "name": "getHour", + "constructor": false, + "static": true, + "parameters": [], + "returns": "int" + }, + { + "name": "getMillisecond", + "constructor": false, + "static": true, + "parameters": [], + "returns": "int" + }, + { + "name": "getMinute", + "constructor": false, + "static": true, + "parameters": [], + "returns": "int" + }, + { + "name": "getMonth", + "constructor": false, + "static": true, + "parameters": [], + "returns": "int" + }, + { + "name": "getSecond", + "constructor": false, + "static": true, + "parameters": [], + "returns": "int" + }, + { + "name": "getYear", "constructor": false, + "static": true, + "parameters": [], + "returns": "int" + } + ], + "org.openpatch.scratch.Color": [ + { + "name": "Color", + "constructor": true, "static": false, "parameters": [ - "String", "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { - "name": "addedToStage", - "constructor": false, + "name": "Color", + "constructor": true, "static": false, "parameters": [ - "org.openpatch.scratch.Stage" + "double", + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Color" + }, + { + "name": "Color", + "constructor": true, + "static": false, + "parameters": [ + "double", + "double", + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { "name": "equals", @@ -19943,932 +8541,1035 @@ "returns": "boolean" }, { - "name": "getAlign", + "name": "fromARGB", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.TextAlign" + "static": true, + "parameters": [ + "int" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "getClass", + "name": "fromHSB", "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" + "static": true, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "getCurrentFontIndex", + "name": "getAlpha", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "double" }, { - "name": "getCurrentFontName", + "name": "getBlue", "constructor": false, "static": false, "parameters": [], - "returns": "String" - }, - { - "name": "getDefaultFont", - "constructor": false, - "static": true, - "parameters": [], - "returns": "String" - }, - { - "name": "getDefaultFontSize", - "constructor": false, - "static": true, - "parameters": [], - "returns": "int" + "returns": "double" }, { - "name": "getDefaultFontSizes", + "name": "getBrightness", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "int[]" + "returns": "double" }, { - "name": "getFont", + "name": "getGreen", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "double" }, { - "name": "getPosition", + "name": "getHue", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "returns": "double" }, { - "name": "getStage", + "name": "getRed", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Stage" + "returns": "double" }, { - "name": "getStyle", + "name": "getSaturation", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.TextStyle" + "returns": "double" }, { - "name": "getTextSize", + "name": "hashCode", "constructor": false, "static": false, "parameters": [], "returns": "int" }, { - "name": "getWidth", + "name": "toARGB", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "int" }, { - "name": "getX", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "String" }, { - "name": "getY", + "name": "withAlpha", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "goLayersBackwards", + "name": "withBlue", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { - "name": "goLayersForwards", + "name": "withBrightness", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Color" }, { - "name": "goToBackLayer", + "name": "withGreen", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "goToFrontLayer", + "name": "withHue", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "isSmoothing", + "name": "withRed", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color" }, { - "name": "isUI", + "name": "withSaturation", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" - }, + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color" + } + ], + "org.openpatch.scratch.Ellipse": [ { - "name": "nextFont", - "constructor": false, + "name": "Ellipse", + "constructor": true, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double", + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Ellipse" }, { - "name": "notify", + "name": "contains", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "double", + "double" + ], + "returns": "boolean" }, { - "name": "notifyAll", + "name": "getBounds", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Bounds" }, { - "name": "remove", + "name": "getPoints", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double[]" }, { - "name": "removedFromStage", + "name": "intersects", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Stage" + "org.openpatch.scratch.Shape" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setAlign", + "name": "rotate", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.TextAlign" + "double", + "double", + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "setBackgroundColor", + "name": "scale", "constructor": false, "static": false, "parameters": [ + "double", "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "setBackgroundColor", + "name": "translate", "constructor": false, "static": false, "parameters": [ - "int", - "int", - "int" + "double", + "double" ], - "returns": "void" - }, + "returns": "org.openpatch.scratch.Shape" + } + ], + "org.openpatch.scratch.HtmlColor": [ { - "name": "setBackgroundColor", + "name": "getRandom", "constructor": false, - "static": false, + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.Color" + } + ], + "org.openpatch.scratch.KeyCode": [ + { + "name": "valueOf", + "constructor": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Color" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.KeyCode" }, { - "name": "setFont", + "name": "values", "constructor": false, - "static": false, + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.KeyCode[]" + } + ], + "org.openpatch.scratch.Layer": [ + { + "name": "valueOf", + "constructor": false, + "static": true, "parameters": [ "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Layer" }, { - "name": "setIsUI", + "name": "values", "constructor": false, - "static": false, + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.Layer[]" + } + ], + "org.openpatch.scratch.MouseCode": [ + { + "name": "valueOf", + "constructor": false, + "static": true, "parameters": [ - "boolean" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.MouseCode" }, { - "name": "setPosition", + "name": "values", "constructor": false, - "static": false, + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.MouseCode[]" + } + ], + "org.openpatch.scratch.Operators": [ + { + "name": "absOf", + "constructor": false, + "static": true, "parameters": [ - "double", "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setPosition", + "name": "absOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Vector2" + "int" ], - "returns": "void" + "returns": "int" }, { - "name": "setStrokeColor", + "name": "acosOf", "constructor": false, - "static": false, + "static": true, "parameters": [ "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setStrokeColor", + "name": "asinOf", "constructor": false, - "static": false, - "parameters": [ - "int", - "int", - "int" + "static": true, + "parameters": [ + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setStrokeColor", + "name": "atanOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Color" + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setStyle", + "name": "ceilingOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.TextStyle" + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setTextColor", + "name": "constrain", "constructor": false, - "static": false, + "static": true, "parameters": [ + "double", + "double", "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setTextColor", + "name": "constrain", "constructor": false, - "static": false, + "static": true, "parameters": [ "int", "int", "int" ], - "returns": "void" + "returns": "int" }, { - "name": "setTextColor", + "name": "cosOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Color" + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setTextSize", + "name": "eToThePowerOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "int" + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setWidth", + "name": "floorOf", "constructor": false, - "static": false, + "static": true, "parameters": [ "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setX", + "name": "lerp", "constructor": false, - "static": false, + "static": true, "parameters": [ + "double", + "double", "double" ], - "returns": "void" + "returns": "double" }, { - "name": "setY", + "name": "lnOf", "constructor": false, - "static": false, + "static": true, "parameters": [ "double" ], - "returns": "void" + "returns": "double" }, { - "name": "showText", + "name": "logOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String", - "int" + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "showText", + "name": "map", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String" + "double", + "double", + "double", + "double", + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "switchFont", + "name": "max", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String" + "double[]" ], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" + "returns": "double" }, { - "name": "useFont", + "name": "max", "constructor": false, "static": true, "parameters": [ - "String", - "int" + "int[]" ], - "returns": "void" + "returns": "int" }, { - "name": "useFont", + "name": "min", "constructor": false, "static": true, "parameters": [ - "String" + "double[]" ], - "returns": "void" + "returns": "double" }, { - "name": "useFontSizes", + "name": "min", "constructor": false, "static": true, "parameters": [ "int[]" ], - "returns": "void" + "returns": "int" }, { - "name": "useSmoothing", + "name": "mod", "constructor": false, "static": true, "parameters": [ - "boolean" + "double", + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "wait", + "name": "mod", "constructor": false, - "static": false, + "static": true, "parameters": [ - "long" + "int", + "int" ], - "returns": "void" + "returns": "int" }, { - "name": "wait", + "name": "round", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "double", + "int" + ], + "returns": "double" }, { - "name": "whenAddedToStage", + "name": "round", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Stage" + "double" ], - "returns": "void" + "returns": "int" }, { - "name": "whenAddedToStage", + "name": "sinOf", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "double" + ], + "returns": "double" }, { - "name": "whenRemovedFromStage", + "name": "sqrtOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Stage" + "double" ], - "returns": "void" + "returns": "double" }, { - "name": "whenRemovedFromStage", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.TextAlign": [ - { - "name": "equals", + "name": "tanOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "Object" + "double" ], - "returns": "boolean" + "returns": "double" }, { - "name": "getClass", + "name": "tenToThePowerOf", "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, + "static": true, + "parameters": [ + "double" + ], + "returns": "double" + } + ], + "org.openpatch.scratch.Pen": [ { - "name": "name", - "constructor": false, + "name": "Pen", + "constructor": true, "static": false, "parameters": [], - "returns": "String" + "returns": "org.openpatch.scratch.Pen" }, { - "name": "notify", + "name": "changeColor", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "changeSize", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "ordinal", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "toString", + "name": "changeTransparency", "constructor": false, "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "valueOf", - "constructor": false, - "static": true, "parameters": [ - "String" + "double" ], - "returns": "org.openpatch.scratch.TextAlign" - }, - { - "name": "values", - "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.TextAlign[]" + "returns": "void" }, { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], + "name": "down", + "constructor": false, + "static": false, + "parameters": [], "returns": "void" }, { - "name": "wait", + "name": "eraseAll", "constructor": false, "static": false, "parameters": [], "returns": "void" - } - ], - "org.openpatch.scratch.TextStyle": [ + }, { - "name": "equals", + "name": "getColor", "constructor": false, "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" + "parameters": [], + "returns": "org.openpatch.scratch.Color" }, { - "name": "getClass", + "name": "getLayer", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "org.openpatch.scratch.Layer" }, { - "name": "name", + "name": "getPosition", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "notify", + "name": "getSize", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "notifyAll", + "name": "getTransparency", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "ordinal", + "name": "goToMousePointer", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "void" }, { - "name": "toString", + "name": "goToRandomPosition", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "toString", + "name": "isDown", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "boolean" }, { - "name": "valueOf", + "name": "setColor", "constructor": false, - "static": true, + "static": false, "parameters": [ - "String" + "double", + "double", + "double" ], - "returns": "org.openpatch.scratch.TextStyle" + "returns": "void" }, { - "name": "values", + "name": "setColor", "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.TextStyle[]" + "static": false, + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "wait", + "name": "setColor", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.Color" ], "returns": "void" }, { - "name": "wait", + "name": "setLayer", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Layer" + ], "returns": "void" - } - ], - "org.openpatch.scratch.TextureSampling": [ + }, { - "name": "equals", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "Object" + "double", + "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "setPosition", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void" }, { - "name": "getMode", + "name": "setSize", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "name", + "name": "setTransparency", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "notify", + "name": "stamp", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "notifyAll", + "name": "up", "constructor": false, "static": false, "parameters": [], "returns": "void" - }, + } + ], + "org.openpatch.scratch.Pixels": [ { - "name": "ordinal", + "name": "getArgb", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "int", + "int" + ], "returns": "int" }, { - "name": "toString", + "name": "getColor", + "constructor": false, + "static": false, + "parameters": [ + "int", + "int" + ], + "returns": "org.openpatch.scratch.Color" + }, + { + "name": "getHeight", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "int" }, { - "name": "toString", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "int" }, { - "name": "valueOf", + "name": "of", "constructor": false, "static": true, "parameters": [ "String" ], - "returns": "org.openpatch.scratch.TextureSampling" + "returns": "org.openpatch.scratch.Pixels" }, { - "name": "values", + "name": "of", "constructor": false, "static": true, + "parameters": [ + "org.openpatch.scratch.Stage" + ], + "returns": "org.openpatch.scratch.Pixels" + } + ], + "org.openpatch.scratch.Polygon": [ + { + "name": "Polygon", + "constructor": true, + "static": false, + "parameters": [ + "double[]", + "double[]" + ], + "returns": "org.openpatch.scratch.Polygon" + }, + { + "name": "Polygon", + "constructor": true, + "static": false, "parameters": [], - "returns": "org.openpatch.scratch.TextureSampling[]" + "returns": "org.openpatch.scratch.Polygon" }, { - "name": "wait", + "name": "addPoint", "constructor": false, "static": false, "parameters": [ - "long" + "double", + "double" ], "returns": "void" }, { - "name": "wait", + "name": "contains", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double" + ], + "returns": "boolean" + }, + { + "name": "getBounds", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.Timer": [ + "returns": "org.openpatch.scratch.Bounds" + }, { - "name": "Timer", - "constructor": true, + "name": "getPoints", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Timer" + "returns": "double[]" }, { - "name": "afterMillis", + "name": "intersects", "constructor": false, "static": false, "parameters": [ - "int" + "org.openpatch.scratch.Shape" ], "returns": "boolean" }, { - "name": "equals", + "name": "rotate", "constructor": false, "static": false, "parameters": [ - "Object" + "double", + "double", + "double" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "everyMillis", + "name": "scale", "constructor": false, "static": false, "parameters": [ - "int" + "double", + "double" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "forMillis", + "name": "translate", "constructor": false, "static": false, "parameters": [ - "int" + "double", + "double" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Shape" + } + ], + "org.openpatch.scratch.Random": [ + { + "name": "noise", + "constructor": false, + "static": true, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "double" }, { - "name": "getClass", + "name": "noise", "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" + "static": true, + "parameters": [ + "double", + "double" + ], + "returns": "double" }, { - "name": "intervalMillis", + "name": "noise", "constructor": false, - "static": false, + "static": true, "parameters": [ - "int", - "boolean" + "double" ], - "returns": "boolean" + "returns": "double" }, { - "name": "intervalMillis", + "name": "noiseSeed", "constructor": false, - "static": false, + "static": true, "parameters": [ - "int", - "int", - "boolean" + "long" ], - "returns": "boolean" + "returns": "void" }, { - "name": "intervalMillis", + "name": "random", "constructor": false, - "static": false, + "static": true, "parameters": [ - "int", - "int" + "double", + "double" ], - "returns": "boolean" + "returns": "double" + }, + { + "name": "random", + "constructor": false, + "static": true, + "parameters": [ + "double" + ], + "returns": "double" + }, + { + "name": "random", + "constructor": false, + "static": true, + "parameters": [], + "returns": "double" }, { - "name": "intervalMillis", + "name": "randomInt", "constructor": false, - "static": false, + "static": true, "parameters": [ + "int", "int" ], - "returns": "boolean" + "returns": "int" }, { - "name": "millis", + "name": "randomInt", "constructor": false, "static": true, - "parameters": [], + "parameters": [ + "int" + ], "returns": "int" }, { - "name": "notify", + "name": "randomPosition", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "notifyAll", + "name": "randomSeed", "constructor": false, - "static": false, - "parameters": [], + "static": true, + "parameters": [ + "long" + ], "returns": "void" }, { - "name": "reset", + "name": "randomVector2", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "toString", + "name": "randomX", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" + "returns": "double" }, { - "name": "wait", + "name": "randomY", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void" + "returns": "double" } ], - "org.openpatch.scratch.Triangle": [ + "org.openpatch.scratch.Rectangle": [ { - "name": "Triangle", + "name": "Rectangle", "constructor": true, "static": false, "parameters": [ - "double", - "double", "double", "double", "double", "double" ], - "returns": "org.openpatch.scratch.Triangle" + "returns": "org.openpatch.scratch.Rectangle" }, { "name": "contains", @@ -20880,22 +9581,6 @@ ], "returns": "boolean" }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, { "name": "getBounds", "constructor": false, @@ -20904,11 +9589,11 @@ "returns": "org.openpatch.scratch.Bounds" }, { - "name": "getClass", + "name": "getPoints", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "double[]" }, { "name": "intersects", @@ -20919,20 +9604,6 @@ ], "returns": "boolean" }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, { "name": "rotate", "constructor": false, @@ -20954,13 +9625,6 @@ ], "returns": "org.openpatch.scratch.Shape" }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, { "name": "translate", "constructor": false, @@ -20970,1059 +9634,1061 @@ "double" ], "returns": "org.openpatch.scratch.Shape" - }, + } + ], + "org.openpatch.scratch.RotationStyle": [ { - "name": "wait", + "name": "valueOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "long" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.RotationStyle" }, { - "name": "wait", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.RotationStyle[]" } ], - "org.openpatch.scratch.UISprite": [ + "org.openpatch.scratch.ScratchException": [ { - "name": "UISprite", + "name": "ScratchException", "constructor": true, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.UISprite" - }, - { - "name": "act", - "constructor": false, - "static": false, "parameters": [ - "double" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.ScratchException" }, { - "name": "act", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String", - "int", - "int", - "int", - "int" - ], - "returns": "void" - }, - { - "name": "addCostume", - "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" - }, + "returns": "String" + } + ], + "org.openpatch.scratch.Shader": [ { - "name": "addCostume", + "name": "getName", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "String" }, { - "name": "addCostumes", + "name": "set", "constructor": false, "static": false, "parameters": [ "String", - "String", - "int", - "int" + "boolean" ], "returns": "void" }, { - "name": "addSound", + "name": "set", "constructor": false, "static": false, "parameters": [ "String", - "String" - ], - "returns": "void" - }, - { - "name": "addSound", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "ask", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "broadcast", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "changeHeight", - "constructor": false, - "static": false, - "parameters": [ + "double", "double" ], "returns": "void" }, { - "name": "changePosition", + "name": "set", "constructor": false, "static": false, "parameters": [ - "double", + "String", "double" ], "returns": "void" }, { - "name": "changePosition", + "name": "set", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "String", + "double[]", + "int" ], "returns": "void" }, { - "name": "changeSize", + "name": "set", "constructor": false, "static": false, "parameters": [ - "double" + "String", + "int" ], "returns": "void" }, { - "name": "changeTint", + "name": "set", "constructor": false, "static": false, "parameters": [ - "double" + "String", + "org.openpatch.scratch.Color" ], "returns": "void" }, { - "name": "changeTransparency", + "name": "set", "constructor": false, "static": false, "parameters": [ - "double" + "String", + "org.openpatch.scratch.Vector2" ], "returns": "void" }, { - "name": "changeVolume", + "name": "setName", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" - }, + } + ], + "org.openpatch.scratch.Shaders": [ { - "name": "changeWidth", + "name": "activate", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "changeX", + "name": "add", "constructor": false, "static": false, "parameters": [ - "double" + "String", + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Shader" }, { - "name": "changeY", + "name": "deactivate", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "clone", - "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Sprite" - }, - { - "name": "debug", + "name": "get", "constructor": false, "static": false, "parameters": [ - "Object[]" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Shader" }, { - "name": "deleteThisClone", + "name": "getActive", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "List" }, { - "name": "destroy", + "name": "getCurrent", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Shader" }, { - "name": "disableHitbox", + "name": "getCurrentIndex", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "disableNineSlice", + "name": "getCurrentName", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "distanceToMousePointer", + "name": "isActive", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "String" + ], + "returns": "boolean" }, { - "name": "distanceToSprite", + "name": "next", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "double" + "parameters": [], + "returns": "void" }, { - "name": "enableHitbox", + "name": "reset", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "equals", + "name": "switchTo", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getAnswer", + "name": "switchTo", "constructor": false, "static": false, - "parameters": [], - "returns": "String" - }, + "parameters": [ + "double" + ], + "returns": "void" + } + ], + "org.openpatch.scratch.Shape": [ { - "name": "getClass", + "name": "contains", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "double", + "double" + ], + "returns": "boolean" }, { - "name": "getCurrentCostumeIndex", + "name": "getBounds", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "org.openpatch.scratch.Bounds" }, { - "name": "getCurrentCostumeName", + "name": "getPoints", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "double[]" }, { - "name": "getDeltaTime", + "name": "intersects", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "org.openpatch.scratch.Shape" + ], + "returns": "boolean" }, { - "name": "getDirection", + "name": "rotate", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape" }, { - "name": "getGamepadAxisValue", + "name": "scale", "constructor": false, "static": false, "parameters": [ - "int", - "int" + "double", + "double" ], - "returns": "double" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "getHeight", + "name": "translate", "constructor": false, "static": false, - "parameters": [], - "returns": "int" - }, + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape" + } + ], + "org.openpatch.scratch.SoundPlayback": [ { - "name": "getHitbox", + "name": "close", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Hitbox" + "returns": "void" }, { - "name": "getMouse", + "name": "getName", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "returns": "String" }, { - "name": "getMouseX", + "name": "getVolume", "constructor": false, "static": false, "parameters": [], "returns": "double" }, { - "name": "getMouseY", + "name": "isPlaying", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "boolean" }, { - "name": "getPen", + "name": "setVolume", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Pen" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getPosition", + "name": "stop", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" + } + ], + "org.openpatch.scratch.Sprite": [ + { + "name": "Sprite", + "constructor": true, + "static": false, + "parameters": [ + "String", + "String" + ], + "returns": "org.openpatch.scratch.Sprite" }, { - "name": "getShaders", - "constructor": false, + "name": "Sprite", + "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" + "returns": "org.openpatch.scratch.Sprite" }, { - "name": "getSize", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "String", + "String", + "int", + "int", + "int[]" + ], + "returns": "void" }, { - "name": "getStage", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" + "parameters": [ + "String", + "String", + "int", + "int" + ], + "returns": "void" }, { - "name": "getText", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Text" + "parameters": [ + "String", + "String", + "int" + ], + "returns": "void" }, { - "name": "getTimer", + "name": "addCostume", "constructor": false, "static": false, "parameters": [ - "String" + "String", + "String", + "int", + "int", + "int", + "int" ], - "returns": "org.openpatch.scratch.Timer" + "returns": "void" }, { - "name": "getTimer", + "name": "addCostume", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Timer" + "parameters": [ + "String", + "String" + ], + "returns": "void" }, { - "name": "getTint", + "name": "addCostume", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getTouchingSprite", + "name": "addCostumes", "constructor": false, "static": false, "parameters": [ - "Class" + "String", + "String", + "int", + "int" ], - "returns": "T@407 extends org.openpatch.scratch.Sprite" + "returns": "void" }, { - "name": "getTouchingSprites", + "name": "addSound", "constructor": false, "static": false, "parameters": [ - "Class" + "String", + "String" ], - "returns": "nrw.List" + "returns": "void" }, { - "name": "getTransparency", + "name": "addSound", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getVolume", + "name": "ask", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getWidth", + "name": "broadcast", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getX", + "name": "changeColorEffect", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getY", + "name": "changeHeight", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "glide", + "name": "changePosition", "constructor": false, "static": false, "parameters": [ - "double", "double", "double" ], "returns": "void" }, { - "name": "goLayersBackwards", + "name": "changePosition", "constructor": false, "static": false, "parameters": [ - "int" + "org.openpatch.scratch.Vector2" ], "returns": "void" }, { - "name": "goLayersForwards", + "name": "changeSize", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], "returns": "void" }, { - "name": "goToBackLayer", + "name": "changeTransparency", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "goToFrontLayer", + "name": "changeVolume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "goToMousePointer", + "name": "changeWidth", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "goToRandomPosition", + "name": "changeX", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "goToSprite", + "name": "changeY", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double" ], "returns": "void" }, { - "name": "hide", + "name": "createClone", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "T@414 extends org.openpatch.scratch.Sprite" }, { - "name": "hideVariable", + "name": "debug", "constructor": false, "static": false, "parameters": [ - "String" + "Object[]" ], "returns": "void" }, { - "name": "ifOnEdgeBounce", + "name": "deleteThisClone", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "isActing", + "name": "disableHitbox", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "isAsking", + "name": "disableNineSlice", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "isClone", + "name": "distanceToMousePointer", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "double" }, { - "name": "isColorTouchingColor", + "name": "distanceToSprite", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" + "org.openpatch.scratch.Sprite" ], - "returns": "boolean" + "returns": "double" }, { - "name": "isDestroyed", + "name": "enableHitbox", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "isGamepadButtonDown", + "name": "getAnimationFrame", "constructor": false, "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "boolean" + "parameters": [], + "returns": "int" }, { - "name": "isGamepadConnected", + "name": "getAnimationInterval", "constructor": false, "static": false, - "parameters": [ - "int" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "isGliding", + "name": "getAnswer", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "String" }, { - "name": "isKeyDown", + "name": "getColorEffect", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "isKeyPressed", + "name": "getCurrentCostumeIndex", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "boolean" + "parameters": [], + "returns": "int" }, { - "name": "isKeyUp", + "name": "getCurrentCostumeName", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" + "parameters": [], + "returns": "String" }, { - "name": "isMouseDown", + "name": "getDirection", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "double" }, { - "name": "isSoundPlaying", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "isTouchingColor", + "name": "getHitbox", "constructor": false, "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "boolean" + "parameters": [], + "returns": "org.openpatch.scratch.Shape" }, { - "name": "isTouchingColor", + "name": "getLayer", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "boolean" + "parameters": [], + "returns": "org.openpatch.scratch.Layer" }, { - "name": "isTouchingEdge", + "name": "getMouse", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "isTouchingMousePointer", + "name": "getMouseX", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "double" }, { - "name": "isTouchingSprite", + "name": "getMouseY", "constructor": false, "static": false, - "parameters": [ - "Class" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "isTouchingSprite", + "name": "getPen", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "boolean" + "parameters": [], + "returns": "org.openpatch.scratch.Pen" }, { - "name": "isVisible", + "name": "getPosition", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "move", + "name": "getRotationStyle", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.RotationStyle" }, { - "name": "move", + "name": "getShaders", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Shaders" }, { - "name": "nextCostume", + "name": "getSize", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "notify", + "name": "getStage", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Stage" }, { - "name": "notifyAll", + "name": "getText", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Text" }, { - "name": "onKeyDown", + "name": "getTimer", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Timer" }, { - "name": "onKeyTyped", + "name": "getTint", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Color" }, { - "name": "onKeyUp", + "name": "getTouchingSprite", "constructor": false, "static": false, "parameters": [ - "String" + "Class" ], - "returns": "void" + "returns": "T@412 extends org.openpatch.scratch.Sprite" }, { - "name": "pickRandom", + "name": "getTouchingSprites", "constructor": false, "static": false, "parameters": [ - "int", - "int" + "Class" ], - "returns": "int" + "returns": "nrw.List" }, { - "name": "playSound", + "name": "getTransparency", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "playSoundCopy", + "name": "getVolume", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "getWidth", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "getX", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "getY", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "glide", "constructor": false, "static": false, "parameters": [ - "String", + "double", + "double", "double" ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" + "returns": "void" }, { - "name": "pointInDirection", + "name": "goLayersBackwards", "constructor": false, "static": false, "parameters": [ - "double" + "int" ], "returns": "void" }, { - "name": "pointInDirection", + "name": "goLayersForwards", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "int" ], "returns": "void" }, { - "name": "pointTowardsMousePointer", + "name": "goToBackLayer", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "pointTowardsSprite", + "name": "goToFrontLayer", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], + "parameters": [], "returns": "void" }, { - "name": "previousCostume", + "name": "goToMousePointer", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "remove", + "name": "goToRandomPosition", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "restartActing", + "name": "goToSprite", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Sprite" + ], "returns": "void" }, { - "name": "run", + "name": "hide", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "say", + "name": "hideVariable", "constructor": false, "static": false, "parameters": [ - "String", - "int" + "String" ], "returns": "void" }, { - "name": "say", + "name": "ifOnEdgeBounce", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "void" }, { - "name": "setActFrequency", + "name": "isAnimationPlayed", "constructor": false, - "static": true, - "parameters": [ - "int" - ], - "returns": "void" + "static": false, + "parameters": [], + "returns": "boolean" }, { - "name": "setDirection", + "name": "isAsking", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "setDirection", + "name": "isClone", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "setHeight", + "name": "isColorTouchingColor", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Color", + "org.openpatch.scratch.Color" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setHitbox", + "name": "isGliding", "constructor": false, "static": false, - "parameters": [ - "double[]" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "setHitbox", + "name": "isKeyPressed", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Shape" + "org.openpatch.scratch.KeyCode" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setNineSlice", + "name": "isMouseDown", + "constructor": false, + "static": false, + "parameters": [], + "returns": "boolean" + }, + { + "name": "isSoundPlaying", "constructor": false, "static": false, "parameters": [ - "int", - "int", - "int", - "int" + "String" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setPosition", + "name": "isTouchingColor", "constructor": false, "static": false, "parameters": [ + "double", "double", "double" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setPosition", + "name": "isTouchingColor", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.Color" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setRotationCenter", + "name": "isTouchingEdge", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "setRotationStyle", + "name": "isTouchingMousePointer", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.RotationStyle" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "setSize", + "name": "isTouchingSprite", "constructor": false, "static": false, "parameters": [ - "double" + "Class" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setTint", + "name": "isTouchingSprite", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "org.openpatch.scratch.Sprite" ], - "returns": "void" + "returns": "boolean" }, { - "name": "setTint", + "name": "isVisible", + "constructor": false, + "static": false, + "parameters": [], + "returns": "boolean" + }, + { + "name": "move", "constructor": false, "static": false, "parameters": [ @@ -22031,161 +10697,152 @@ "returns": "void" }, { - "name": "setTint", + "name": "nextCostume", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], + "parameters": [], "returns": "void" }, { - "name": "setTransparency", + "name": "pickRandom", "constructor": false, "static": false, "parameters": [ - "double" + "int", + "int" ], - "returns": "void" + "returns": "int" }, { - "name": "setVolume", + "name": "playAnimation", "constructor": false, "static": false, "parameters": [ - "double" + "String", + "boolean" ], "returns": "void" }, { - "name": "setWidth", + "name": "playAnimation", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "setX", + "name": "playSound", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "setY", + "name": "playSoundCopy", "constructor": false, "static": false, "parameters": [ + "String", "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.SoundPlayback" }, { - "name": "show", + "name": "pointTowards", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Sprite" + ], "returns": "void" }, { - "name": "showVariable", + "name": "pointTowards", "constructor": false, "static": false, "parameters": [ - "String", - "java.util.function.Supplier" + "org.openpatch.scratch.Vector2" ], "returns": "void" }, { - "name": "stamp", + "name": "pointTowardsMousePointer", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Layer" - ], + "parameters": [], "returns": "void" }, { - "name": "stamp", + "name": "previousCostume", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "stopActing", + "name": "remove", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "stopAllSounds", + "name": "resetAnimation", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "stopSound", + "name": "run", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "void" }, { - "name": "switchCostume", + "name": "say", "constructor": false, "static": false, "parameters": [ - "String" + "String", + "double" ], "returns": "void" }, { - "name": "switchCostume", + "name": "say", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "think", + "name": "setAnimationFrame", "constructor": false, "static": false, "parameters": [ - "String", "int" ], "returns": "void" }, { - "name": "think", + "name": "setAnimationInterval", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], "returns": "void" }, { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "turnLeft", + "name": "setColorEffect", "constructor": false, "static": false, "parameters": [ @@ -22194,7 +10851,7 @@ "returns": "void" }, { - "name": "turnRight", + "name": "setDirection", "constructor": false, "static": false, "parameters": [ @@ -22203,1983 +10860,2011 @@ "returns": "void" }, { - "name": "wait", + "name": "setHeight", "constructor": false, "static": false, "parameters": [ - "long" + "double" ], "returns": "void" }, { - "name": "wait", + "name": "setHitbox", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Shape" + ], "returns": "void" }, { - "name": "whenAddedToStage", + "name": "setLayer", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Layer" + ], "returns": "void" }, { - "name": "whenBackdropSwitches", + "name": "setNineSlice", "constructor": false, "static": false, "parameters": [ - "String" + "int", + "int", + "int", + "int" ], "returns": "void" }, { - "name": "whenClicked", + "name": "setPosition", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double" + ], "returns": "void" }, { - "name": "whenIReceive", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.Vector2" ], "returns": "void" }, { - "name": "whenKeyPressed", + "name": "setRotationCenter", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double", + "double" ], "returns": "void" }, { - "name": "whenKeyReleased", + "name": "setRotationStyle", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.RotationStyle" ], "returns": "void" }, { - "name": "whenMouseClicked", + "name": "setSize", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.MouseCode" + "double" ], "returns": "void" }, { - "name": "whenMouseMoved", + "name": "setTint", "constructor": false, "static": false, "parameters": [ + "double", "double", "double" ], "returns": "void" }, { - "name": "whenRemovedFromStage", + "name": "setTint", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Color" + ], "returns": "void" }, { - "name": "whenStartsAsClone", + "name": "setTransparency", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" - } - ], - "org.openpatch.scratch.Vector2": [ + }, { - "name": "Vector2", - "constructor": true, + "name": "setVolume", + "constructor": false, "static": false, "parameters": [ - "double", "double" ], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "Vector2", - "constructor": true, + "name": "setWidth", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "double" ], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "Vector2", - "constructor": true, + "name": "setX", + "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "add", + "name": "setY", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "double" ], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "angle", + "name": "show", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "void" }, { - "name": "clone", + "name": "showVariable", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "parameters": [ + "String", + "java.util.function.Supplier" + ], + "returns": "void" }, { - "name": "distance", + "name": "stamp", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.Layer" ], - "returns": "double" + "returns": "void" }, { - "name": "distanceSq", + "name": "stamp", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "double" + "parameters": [], + "returns": "void" }, { - "name": "dot", + "name": "stopAllSounds", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "double" + "parameters": [], + "returns": "void" }, { - "name": "equals", + "name": "stopSound", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "equals", + "name": "switchCostume", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "fromPolar", + "name": "switchCostume", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double", "double" ], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "getClass", + "name": "think", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "String", + "double" + ], + "returns": "void" }, { - "name": "getX", + "name": "think", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getY", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "String" }, { - "name": "hashCode", + "name": "turnLeft", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "length", + "name": "turnRight", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "lengthSq", + "name": "whenAddedToStage", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "void" }, { - "name": "multiply", + "name": "whenBackdropSwitches", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "normalVector", + "name": "whenClicked", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "notify", + "name": "whenIReceive", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "whenKeyPressed", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], "returns": "void" }, { - "name": "reverse", + "name": "whenKeyReleased", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "void" }, { - "name": "rotateBy", + "name": "whenMouseClicked", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.MouseCode" ], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "rotateTo", + "name": "whenMouseMoved", "constructor": false, "static": false, "parameters": [ + "double", "double" ], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "sub", + "name": "whenRemovedFromStage", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "org.openpatch.scratch.Vector2" + "parameters": [], + "returns": "void" }, { - "name": "toString", + "name": "whenStartsAsClone", "constructor": false, "static": false, "parameters": [], - "returns": "String" - }, + "returns": "void" + } + ], + "org.openpatch.scratch.Stage": [ { - "name": "toString", - "constructor": false, + "name": "Stage", + "constructor": true, "static": false, "parameters": [], - "returns": "String" + "returns": "org.openpatch.scratch.Stage" }, { - "name": "unitVector", + "name": "add", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "parameters": [ + "org.openpatch.scratch.Pen" + ], + "returns": "void" }, { - "name": "wait", + "name": "add", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.Sprite" ], "returns": "void" }, { - "name": "wait", + "name": "add", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Text" + ], "returns": "void" - } - ], - "org.openpatch.scratch.Window": [ + }, { - "name": "Window", - "constructor": true, + "name": "addBackdrop", + "constructor": false, "static": false, "parameters": [ - "String" + "String", + "String", + "boolean" ], - "returns": "org.openpatch.scratch.Window" + "returns": "void" }, { - "name": "Window", - "constructor": true, + "name": "addBackdrop", + "constructor": false, "static": false, "parameters": [ - "int", - "int", + "String", "String" ], - "returns": "org.openpatch.scratch.Window" + "returns": "void" }, { - "name": "Window", - "constructor": true, + "name": "addBackdrop", + "constructor": false, "static": false, "parameters": [ - "int", - "int" + "String" ], - "returns": "org.openpatch.scratch.Window" + "returns": "void" }, { - "name": "Window", - "constructor": true, + "name": "addSound", + "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Window" + "parameters": [ + "String", + "String" + ], + "returns": "void" }, { - "name": "debug", + "name": "addSound", "constructor": false, "static": false, "parameters": [ - "Object[]" + "String" ], "returns": "void" }, { - "name": "equals", + "name": "ask", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "exit", + "name": "broadcast", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "getClass", + "name": "changeColorEffect", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getDeltaTime", + "name": "changeTransparency", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getGameSpeed", + "name": "changeVolume", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getHeight", + "name": "count", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "Class" + ], "returns": "int" }, { - "name": "getInstance", + "name": "debug", "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.Window" + "static": false, + "parameters": [ + "Object[]" + ], + "returns": "void" }, { - "name": "getLibraryTitle", + "name": "display", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "String", + "double" + ], + "returns": "void" }, { - "name": "getLibraryVersion", + "name": "display", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getSplashLogo", + "name": "eraseAll", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "getStage", + "name": "find", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" + "parameters": [ + "Class" + ], + "returns": "nrw.List" }, { - "name": "getTextureSampling", + "name": "getAll", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "org.openpatch.scratch.TextureSampling" + "returns": "nrw.List" }, { - "name": "getWidth", + "name": "getAnswer", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "String" }, { - "name": "isDebug", + "name": "getCamera", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "org.openpatch.scratch.Camera" }, { - "name": "isPaused", + "name": "getColor", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "org.openpatch.scratch.Color" }, { - "name": "isTransitioning", + "name": "getColorEffect", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "boolean" + "returns": "double" }, { - "name": "notify", + "name": "getCurrentBackdropIndex", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "notifyAll", + "name": "getCurrentBackdropName", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "pause", + "name": "getHeight", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "resume", + "name": "getMouse", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "setDebug", + "name": "getMouseX", "constructor": false, "static": false, - "parameters": [ - "boolean" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "setGameSpeed", + "name": "getMouseY", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "setStage", + "name": "getShaders", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Shaders" }, { - "name": "step", + "name": "getTimer", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Timer" }, { - "name": "toString", + "name": "getTransparency", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "double" }, { - "name": "transitionToStage", + "name": "getVolume", "constructor": false, "static": false, - "parameters": [ - "java.util.function.Supplier", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "transitionToStage", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Stage", - "int" - ], - "returns": "void" - }, - { - "name": "useFullScreen", - "constructor": false, - "static": true, "parameters": [], - "returns": "void" - }, - { - "name": "useSplashLogo", - "constructor": false, - "static": true, - "parameters": [ - "String" - ], - "returns": "void" - }, - { - "name": "useTextureSampling", - "constructor": false, - "static": true, - "parameters": [ - "org.openpatch.scratch.TextureSampling" - ], - "returns": "void" + "returns": "int" }, { - "name": "wait", + "name": "hideVariable", "constructor": false, "static": false, "parameters": [ - "long" + "String" ], "returns": "void" }, { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "whenExits", + "name": "isAsking", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.camera.Camera": [ - { - "name": "Camera", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.camera.Camera" - }, - { - "name": "changeX", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "returns": "boolean" }, { - "name": "changeY", + "name": "isKeyPressed", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.KeyCode" ], - "returns": "void" + "returns": "boolean" }, { - "name": "changeZoom", + "name": "isMouseDown", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "equals", + "name": "isSoundPlaying", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], "returns": "boolean" }, { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getPosition", + "name": "nextBackdrop", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "getX", + "name": "pickRandom", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "int", + "int" + ], + "returns": "int" }, { - "name": "getY", + "name": "playSound", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getZoom", + "name": "playSoundCopy", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "String", + "double" + ], + "returns": "org.openpatch.scratch.SoundPlayback" }, { - "name": "notify", + "name": "previousBackdrop", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "notifyAll", + "name": "randomBackdrop", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "resetZoom", + "name": "remove", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "Class" + ], "returns": "void" }, { - "name": "setPosition", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "org.openpatch.scratch.Pen" ], "returns": "void" }, { - "name": "setPosition", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.Sprite" ], "returns": "void" }, { - "name": "setX", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Text" ], "returns": "void" }, { - "name": "setY", + "name": "removeAll", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "setZoom", + "name": "run", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "setZoomLimit", + "name": "setColor", "constructor": false, "static": false, "parameters": [ + "double", "double", "double" ], "returns": "void" }, { - "name": "toGlobalPosition", + "name": "setColor", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.Color" ], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "toGlobalX", + "name": "setColorEffect", "constructor": false, "static": false, "parameters": [ "double" ], - "returns": "double" + "returns": "void" }, { - "name": "toGlobalY", + "name": "setCursor", "constructor": false, "static": false, "parameters": [ - "double" + "String", + "int", + "int" ], - "returns": "double" + "returns": "void" }, { - "name": "toLocalPosition", + "name": "setCursor", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "String" ], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "toLocalX", + "name": "setTint", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Color" ], - "returns": "double" + "returns": "void" }, { - "name": "toLocalY", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ "double" ], - "returns": "double" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "wait", + "name": "setVolume", "constructor": false, "static": false, "parameters": [ - "long" + "double" ], "returns": "void" }, { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.drawing.Drawing": [ - { - "name": "clip", + "name": "showVariable", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double", - "double" + "String", + "java.util.function.Supplier" ], "returns": "void" }, { - "name": "equals", + "name": "sortBy", "constructor": false, "static": false, "parameters": [ - "Object" + "Comparator" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "sortByY", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "void" }, { - "name": "image", + "name": "stopAllSounds", "constructor": false, "static": false, - "parameters": [ - "String", - "double", - "double", - "double", - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "image", + "name": "stopSorting", "constructor": false, "static": false, - "parameters": [ - "String", - "double", - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "imageHeight", + "name": "stopSound", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "int" + "returns": "void" }, { - "name": "imageWidth", + "name": "switchBackdrop", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "int" + "returns": "void" }, { - "name": "noClip", + "name": "waitSeconds", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "notify", + "name": "waitUntil", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "java.util.function.BooleanSupplier" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "whenBackdropSwitches", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "polygon", + "name": "whenIReceive", "constructor": false, "static": false, "parameters": [ - "double[]", - "double[]", - "org.openpatch.scratch.Color" + "String" ], "returns": "void" }, { - "name": "rectangle", + "name": "whenKeyPressed", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double", - "double", - "org.openpatch.scratch.Color" + "org.openpatch.scratch.KeyCode" ], "returns": "void" }, { - "name": "toString", + "name": "whenKeyReleased", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "void" }, { - "name": "wait", + "name": "whenMouseClicked", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.MouseCode" ], "returns": "void" }, { - "name": "wait", + "name": "whenMouseWheelMoved", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" } ], - "org.openpatch.scratch.extensions.drawing.DrawingSprite": [ + "org.openpatch.scratch.Text": [ { - "name": "DrawingSprite", + "name": "Text", "constructor": true, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.drawing.DrawingSprite" + "parameters": [ + "String", + "double", + "double", + "double", + "org.openpatch.scratch.TextStyle" + ], + "returns": "org.openpatch.scratch.Text" }, { - "name": "act", - "constructor": false, + "name": "Text", + "constructor": true, "static": false, "parameters": [ + "String", + "double", + "double", "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Text" }, { - "name": "act", - "constructor": false, + "name": "Text", + "constructor": true, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Text" }, { - "name": "addCostume", + "name": "addFont", "constructor": false, "static": false, "parameters": [ "String", - "String", - "int", - "int", - "int", - "int" + "String" ], "returns": "void" }, { - "name": "addCostume", + "name": "getAlign", "constructor": false, "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.TextAlign" }, { - "name": "addCostume", + "name": "getCurrentFontIndex", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "int" }, { - "name": "addCostumes", + "name": "getCurrentFontName", "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "int", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "String" + }, + { + "name": "getDefaultFont", + "constructor": false, + "static": true, + "parameters": [], + "returns": "String" }, { - "name": "addSound", + "name": "getDefaultFontSize", "constructor": false, - "static": false, - "parameters": [ - "String", - "String" - ], - "returns": "void" + "static": true, + "parameters": [], + "returns": "double" }, { - "name": "addSound", + "name": "getFont", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "String" }, { - "name": "ask", + "name": "getLayer", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Layer" }, { - "name": "broadcast", + "name": "getPosition", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "changePosition", + "name": "getStage", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Stage" }, { - "name": "changePosition", + "name": "getStyle", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.TextStyle" }, { - "name": "changeSize", + "name": "getText", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "String" }, { - "name": "changeTint", + "name": "getTextSize", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "changeTransparency", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "changeTransparency", + "name": "getX", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "changeVolume", + "name": "getY", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "changeX", + "name": "goLayersBackwards", "constructor": false, "static": false, "parameters": [ - "double" + "int" ], "returns": "void" }, { - "name": "changeY", + "name": "goLayersForwards", "constructor": false, "static": false, "parameters": [ - "double" + "int" ], "returns": "void" }, { - "name": "clone", + "name": "goToBackLayer", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Sprite" + "returns": "void" }, { - "name": "debug", + "name": "goToFrontLayer", "constructor": false, "static": false, - "parameters": [ - "Object[]" - ], + "parameters": [], "returns": "void" }, { - "name": "deleteThisClone", + "name": "hide", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "destroy", + "name": "isVisible", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "boolean" }, { - "name": "disableHitbox", + "name": "nextFont", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "distanceToMousePointer", + "name": "remove", "constructor": false, "static": false, "parameters": [], - "returns": "double" + "returns": "void" }, { - "name": "distanceToSprite", + "name": "setAlign", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "org.openpatch.scratch.TextAlign" ], - "returns": "double" + "returns": "void" }, { - "name": "draw", + "name": "setBackgroundColor", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "double", + "double", + "double" ], "returns": "void" }, { - "name": "enableHitbox", + "name": "setBackgroundColor", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Color" + ], "returns": "void" }, { - "name": "equals", + "name": "setFont", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], - "returns": "boolean" - }, - { - "name": "getAnswer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "getClass", + "name": "setLayer", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "org.openpatch.scratch.Layer" + ], + "returns": "void" }, { - "name": "getCurrentCostumeIndex", + "name": "setPosition", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double", + "double" + ], + "returns": "void" }, { - "name": "getCurrentCostumeName", + "name": "setPosition", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void" }, { - "name": "getDeltaTime", + "name": "setStrokeColor", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "void" }, { - "name": "getDirection", + "name": "setStrokeColor", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "org.openpatch.scratch.Color" + ], + "returns": "void" }, { - "name": "getGamepadAxisValue", + "name": "setStyle", "constructor": false, "static": false, "parameters": [ - "int", - "int" + "org.openpatch.scratch.TextStyle" ], - "returns": "double" + "returns": "void" }, { - "name": "getHeight", + "name": "setTextColor", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "void" }, { - "name": "getHitbox", + "name": "setTextColor", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Hitbox" + "parameters": [ + "org.openpatch.scratch.Color" + ], + "returns": "void" }, { - "name": "getMouse", + "name": "setTextSize", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getMouseX", + "name": "setWidth", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getMouseY", + "name": "setX", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getPen", + "name": "setY", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Pen" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getPosition", + "name": "show", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2" + "returns": "void" }, { - "name": "getShaders", + "name": "showText", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" + "parameters": [ + "String", + "double" + ], + "returns": "void" }, { - "name": "getSize", + "name": "showText", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getStage", + "name": "switchFont", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "getText", + "name": "useFont", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Text" + "static": true, + "parameters": [ + "String", + "double" + ], + "returns": "void" }, { - "name": "getTimer", + "name": "useFont", "constructor": false, - "static": false, + "static": true, "parameters": [ "String" ], - "returns": "org.openpatch.scratch.Timer" + "returns": "void" }, { - "name": "getTimer", + "name": "whenAddedToStage", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Timer" + "returns": "void" }, { - "name": "getTint", + "name": "whenRemovedFromStage", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Color" - }, + "returns": "void" + } + ], + "org.openpatch.scratch.TextAlign": [ { - "name": "getTouchingSprite", + "name": "valueOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "Class" + "String" ], - "returns": "T@407 extends org.openpatch.scratch.Sprite" + "returns": "org.openpatch.scratch.TextAlign" }, { - "name": "getTouchingSprites", + "name": "values", "constructor": false, - "static": false, + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.TextAlign[]" + } + ], + "org.openpatch.scratch.TextStyle": [ + { + "name": "valueOf", + "constructor": false, + "static": true, "parameters": [ - "Class" + "String" ], - "returns": "nrw.List" + "returns": "org.openpatch.scratch.TextStyle" }, { - "name": "getTransparency", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "double" - }, + "returns": "org.openpatch.scratch.TextStyle[]" + } + ], + "org.openpatch.scratch.Timer": [ { - "name": "getTransparency", - "constructor": false, + "name": "Timer", + "constructor": true, "static": false, "parameters": [], - "returns": "double" + "returns": "org.openpatch.scratch.Timer" }, { - "name": "getVolume", + "name": "after", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "boolean" }, { - "name": "getWidth", + "name": "during", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double" + ], + "returns": "boolean" }, { - "name": "getX", + "name": "every", "constructor": false, "static": false, - "parameters": [], - "returns": "double" + "parameters": [ + "double" + ], + "returns": "boolean" }, { - "name": "getY", + "name": "getSeconds", "constructor": false, "static": false, "parameters": [], "returns": "double" }, { - "name": "glide", + "name": "interval", "constructor": false, "static": false, "parameters": [ - "double", "double", "double" ], - "returns": "void" - }, - { - "name": "goLayersBackwards", - "constructor": false, - "static": false, - "parameters": [ - "int" - ], - "returns": "void" + "returns": "boolean" }, { - "name": "goLayersForwards", + "name": "interval", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], - "returns": "void" + "returns": "boolean" }, { - "name": "goToBackLayer", + "name": "reset", "constructor": false, "static": false, "parameters": [], "returns": "void" - }, + } + ], + "org.openpatch.scratch.Transition": [ { - "name": "goToFrontLayer", + "name": "fromShader", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "String" + ], + "returns": "org.openpatch.scratch.Transition" }, { - "name": "goToMousePointer", + "name": "getName", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "goToRandomPosition", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "goToSprite", + "name": "valueOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Sprite" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Transition" }, { - "name": "hide", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Transition[]" + } + ], + "org.openpatch.scratch.Triangle": [ + { + "name": "Triangle", + "constructor": true, + "static": false, + "parameters": [ + "double", + "double", + "double", + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Triangle" }, { - "name": "hideVariable", + "name": "contains", "constructor": false, "static": false, "parameters": [ - "String" + "double", + "double" ], - "returns": "void" + "returns": "boolean" }, { - "name": "ifOnEdgeBounce", + "name": "getBounds", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Bounds" }, { - "name": "isActing", + "name": "getPoints", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "double[]" }, { - "name": "isAsking", + "name": "intersects", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Shape" + ], "returns": "boolean" }, { - "name": "isClone", + "name": "rotate", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape" }, { - "name": "isColorTouchingColor", + "name": "scale", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" + "double", + "double" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "isDestroyed", + "name": "translate", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape" + } + ], + "org.openpatch.scratch.Vector2": [ + { + "name": "Vector2", + "constructor": true, + "static": false, + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "isGamepadButtonDown", - "constructor": false, + "name": "Vector2", + "constructor": true, "static": false, "parameters": [ - "int", - "int" + "org.openpatch.scratch.Vector2" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" + }, + { + "name": "Vector2", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "isGamepadConnected", + "name": "add", "constructor": false, "static": false, "parameters": [ - "int" + "org.openpatch.scratch.Vector2" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" + }, + { + "name": "angle", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" }, { - "name": "isGliding", + "name": "clone", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "isKeyDown", + "name": "direction", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "isKeyPressed", + "name": "distance", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.Vector2" ], - "returns": "boolean" + "returns": "double" }, { - "name": "isKeyUp", + "name": "distanceSq", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.Vector2" ], - "returns": "boolean" + "returns": "double" }, { - "name": "isMouseDown", + "name": "dot", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "double" }, { - "name": "isSoundPlaying", + "name": "equals", "constructor": false, "static": false, "parameters": [ - "String" + "Object" ], "returns": "boolean" }, { - "name": "isTouchingColor", + "name": "fromPolar", "constructor": false, - "static": false, + "static": true, "parameters": [ - "double", "double", "double" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "isTouchingColor", + "name": "getX", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "isTouchingEdge", + "name": "getY", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "double" }, { - "name": "isTouchingMousePointer", + "name": "hashCode", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "int" }, { - "name": "isTouchingSprite", + "name": "length", "constructor": false, "static": false, - "parameters": [ - "Class" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "isTouchingSprite", + "name": "lengthSq", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "multiply", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "isVisible", + "name": "normalVector", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "move", + "name": "reverse", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" + }, + { + "name": "rotateBy", "constructor": false, "static": false, "parameters": [ "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "move", + "name": "rotateTo", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "double" ], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "nextCostume", + "name": "sub", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "notify", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "notifyAll", + "name": "unitVector", "constructor": false, "static": false, "parameters": [], - "returns": "void" - }, + "returns": "org.openpatch.scratch.Vector2" + } + ], + "org.openpatch.scratch.Window": [ { - "name": "onKeyDown", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, "parameters": [ "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Window" }, { - "name": "onKeyTyped", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, "parameters": [ + "int", + "int", "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.Window" }, { - "name": "onKeyUp", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, "parameters": [ - "String" + "int", + "int" ], - "returns": "void" + "returns": "org.openpatch.scratch.Window" }, { - "name": "pickRandom", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "int" + "parameters": [], + "returns": "org.openpatch.scratch.Window" }, { - "name": "playSound", + "name": "debug", "constructor": false, "static": false, "parameters": [ - "String" + "Object[]" ], "returns": "void" }, { - "name": "playSoundCopy", + "name": "exit", "constructor": false, "static": false, - "parameters": [ - "String", - "double" - ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" + "parameters": [], + "returns": "void" }, { - "name": "pointInDirection", + "name": "getFrameSmoothing", "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "static": true, + "parameters": [], + "returns": "double" }, { - "name": "pointInDirection", + "name": "getGameSpeed", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "pointTowardsMousePointer", + "name": "getHeight", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "pointTowardsSprite", + "name": "getInstance", "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void" + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.Window" }, { - "name": "previousCostume", + "name": "getLibraryTitle", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "remove", + "name": "getLibraryVersion", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "restartActing", + "name": "getStage", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Stage" }, { - "name": "run", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "say", + "name": "isDebug", "constructor": false, "static": false, - "parameters": [ - "String", - "int" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "say", + "name": "isPaused", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "setActFrequency", + "name": "isPixelArt", "constructor": false, "static": true, - "parameters": [ - "int" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "setDirection", + "name": "isSmoothPixelArt", "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void" + "static": true, + "parameters": [], + "returns": "boolean" }, { - "name": "setDirection", + "name": "isTransitioning", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void" + "parameters": [], + "returns": "boolean" }, { - "name": "setHitbox", + "name": "pause", "constructor": false, "static": false, - "parameters": [ - "double[]" - ], + "parameters": [], "returns": "void" }, { - "name": "setHitbox", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], + "name": "resume", + "constructor": false, + "static": false, + "parameters": [], "returns": "void" }, { - "name": "setIsUI", + "name": "setDebug", "constructor": false, "static": false, "parameters": [ @@ -24188,212 +12873,239 @@ "returns": "void" }, { - "name": "setPosition", + "name": "setGameSpeed", "constructor": false, "static": false, "parameters": [ - "double", "double" ], "returns": "void" }, { - "name": "setPosition", + "name": "setStage", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.Stage" ], "returns": "void" }, { - "name": "setRotationCenter", + "name": "step", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "setRotationStyle", + "name": "transitionToStage", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.RotationStyle" + "java.util.function.Supplier", + "double" ], "returns": "void" }, { - "name": "setSize", + "name": "transitionToStage", "constructor": false, "static": false, "parameters": [ + "java.util.function.Supplier", + "org.openpatch.scratch.Transition", "double" ], "returns": "void" }, { - "name": "setTint", + "name": "transitionToStage", "constructor": false, "static": false, "parameters": [ - "double", - "double", + "org.openpatch.scratch.Stage", "double" ], "returns": "void" }, { - "name": "setTint", + "name": "useFrameSmoothing", "constructor": false, - "static": false, + "static": true, "parameters": [ "double" ], "returns": "void" }, { - "name": "setTint", + "name": "useFullScreen", "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], + "static": true, + "parameters": [], "returns": "void" }, { - "name": "setTransparency", + "name": "usePixelArt", "constructor": false, - "static": false, - "parameters": [ - "double" - ], + "static": true, + "parameters": [], "returns": "void" }, { - "name": "setTransparency", + "name": "useSmoothPixelArt", "constructor": false, - "static": false, - "parameters": [ - "double" - ], + "static": true, + "parameters": [], "returns": "void" }, { - "name": "setVolume", + "name": "useSplashLogo", "constructor": false, - "static": false, + "static": true, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "setX", + "name": "whenExits", "constructor": false, "static": false, + "parameters": [], + "returns": "void" + } + ], + "org.openpatch.scratch.drawing.BitmapText": [ + { + "name": "BitmapText", + "constructor": true, + "static": false, "parameters": [ - "double" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.drawing.BitmapText" }, { - "name": "setY", + "name": "addAnimation", "constructor": false, "static": false, "parameters": [ - "double" + "String", + "String", + "int", + "int", + "int[]" ], "returns": "void" }, { - "name": "show", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String", + "int", + "int" + ], "returns": "void" }, { - "name": "showVariable", + "name": "addAnimation", "constructor": false, "static": false, "parameters": [ "String", - "java.util.function.Supplier" + "String", + "int" ], "returns": "void" }, { - "name": "stamp", + "name": "addCostume", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Layer" + "String", + "String", + "int", + "int", + "int", + "int" ], "returns": "void" }, { - "name": "stamp", + "name": "addCostume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String" + ], "returns": "void" }, { - "name": "stopActing", + "name": "addCostume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "stopAllSounds", + "name": "addCostumes", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String", + "int", + "int" + ], "returns": "void" }, { - "name": "stopSound", + "name": "addGlyph", "constructor": false, "static": false, "parameters": [ + "char", "String" ], "returns": "void" }, { - "name": "switchCostume", + "name": "addSound", "constructor": false, "static": false, "parameters": [ + "String", "String" ], "returns": "void" }, { - "name": "switchCostume", + "name": "addSound", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "think", + "name": "ask", "constructor": false, "static": false, "parameters": [ - "String", - "int" + "String" ], "returns": "void" }, { - "name": "think", + "name": "broadcast", "constructor": false, "static": false, "parameters": [ @@ -24402,14 +13114,16 @@ "returns": "void" }, { - "name": "toString", + "name": "changeColorEffect", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "turnLeft", + "name": "changeHeight", "constructor": false, "static": false, "parameters": [ @@ -24418,1051 +13132,1039 @@ "returns": "void" }, { - "name": "turnRight", + "name": "changePosition", "constructor": false, "static": false, "parameters": [ + "double", "double" ], "returns": "void" }, { - "name": "wait", + "name": "changePosition", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.Vector2" ], "returns": "void" }, { - "name": "wait", + "name": "changeSize", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "whenAddedToStage", + "name": "changeTransparency", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "whenBackdropSwitches", + "name": "changeTransparency", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], "returns": "void" }, { - "name": "whenClicked", + "name": "changeVolume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "whenIReceive", + "name": "changeWidth", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], "returns": "void" }, { - "name": "whenKeyPressed", + "name": "changeX", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double" ], "returns": "void" }, { - "name": "whenKeyReleased", + "name": "changeY", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double" ], "returns": "void" }, { - "name": "whenMouseClicked", + "name": "createClone", + "constructor": false, + "static": false, + "parameters": [], + "returns": "T@414 extends org.openpatch.scratch.Sprite" + }, + { + "name": "debug", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.MouseCode" + "Object[]" ], "returns": "void" }, { - "name": "whenMouseMoved", + "name": "deleteThisClone", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "whenRemovedFromStage", + "name": "disableHitbox", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "whenStartsAsClone", + "name": "disableNineSlice", "constructor": false, "static": false, "parameters": [], "returns": "void" - } - ], - "org.openpatch.scratch.extensions.fs.File": [ + }, { - "name": "File", - "constructor": true, + "name": "distanceToMousePointer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "distanceToSprite", + "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.Sprite" ], - "returns": "org.openpatch.scratch.extensions.fs.File" + "returns": "double" }, { - "name": "append", + "name": "draw", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.drawing.Drawing" + ], + "returns": "void" + }, + { + "name": "draw", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.drawing.Drawing" ], "returns": "void" }, { - "name": "delete", + "name": "enableHitbox", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "equals", + "name": "getAnimationFrame", "constructor": false, "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" + "parameters": [], + "returns": "int" + }, + { + "name": "getAnimationInterval", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double" + }, + { + "name": "getAnswer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "String" }, { - "name": "exists", + "name": "getColorEffect", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "double" }, { - "name": "getClass", + "name": "getContent", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "String" }, { - "name": "notify", + "name": "getCurrentCostumeIndex", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "int" }, { - "name": "notifyAll", + "name": "getCurrentCostumeName", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "read", + "name": "getDirection", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "double" }, { - "name": "toString", + "name": "getHeight", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "double" }, { - "name": "wait", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "long" - ], - "returns": "void" + "parameters": [], + "returns": "int" }, { - "name": "wait", + "name": "getHitbox", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "write", + "name": "getLayer", "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.fs.SaveData": [ + "parameters": [], + "returns": "org.openpatch.scratch.Layer" + }, { - "name": "SaveData", - "constructor": true, + "name": "getMouse", + "constructor": false, "static": false, - "parameters": [ - "String", - "String", - "Class" - ], - "returns": "org.openpatch.scratch.extensions.fs.SaveData" + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "equals", + "name": "getMouseX", "constructor": false, "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" + "parameters": [], + "returns": "double" }, { - "name": "getClass", + "name": "getMouseY", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "double" }, { - "name": "getLocation", + "name": "getPen", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "org.openpatch.scratch.Pen" }, { - "name": "loadOrDefault", + "name": "getPosition", "constructor": false, "static": false, - "parameters": [ - "java.util.function.Supplier" - ], - "returns": "T@336" + "parameters": [], + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "notify", + "name": "getRotationStyle", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.RotationStyle" }, { - "name": "notifyAll", + "name": "getShaders", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.Shaders" }, { - "name": "save", + "name": "getSize", "constructor": false, "static": false, - "parameters": [ - "T@336" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "toString", + "name": "getStage", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "org.openpatch.scratch.Stage" }, { - "name": "wait", + "name": "getText", "constructor": false, "static": false, - "parameters": [ - "long" - ], - "returns": "void" + "parameters": [], + "returns": "org.openpatch.scratch.Text" }, { - "name": "wait", + "name": "getTimer", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.pixels.Pixels": [ + "returns": "org.openpatch.scratch.Timer" + }, { - "name": "background", + "name": "getTint", "constructor": false, "static": false, "parameters": [], - "returns": "int[]" + "returns": "org.openpatch.scratch.Color" }, { - "name": "equals", + "name": "getTouchingSprite", "constructor": false, "static": false, "parameters": [ - "Object" + "Class" ], - "returns": "boolean" + "returns": "T@412 extends org.openpatch.scratch.Sprite" }, { - "name": "foreground", + "name": "getTouchingSprites", "constructor": false, "static": false, - "parameters": [], - "returns": "int[]" + "parameters": [ + "Class" + ], + "returns": "nrw.List" }, { - "name": "getClass", + "name": "getTransparency", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "double" }, { - "name": "main", + "name": "getTransparency", "constructor": false, "static": false, "parameters": [], - "returns": "int[]" + "returns": "double" }, { - "name": "notify", + "name": "getVolume", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "notifyAll", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "double" }, { - "name": "toString", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "int" }, { - "name": "wait", + "name": "getX", "constructor": false, "static": false, - "parameters": [ - "long" - ], - "returns": "void" + "parameters": [], + "returns": "double" }, { - "name": "wait", + "name": "getY", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.recorder.FFmpegRecorder": [ + "returns": "double" + }, { - "name": "FFmpegRecorder", - "constructor": true, + "name": "glide", + "constructor": false, "static": false, "parameters": [ - "String" + "double", + "double", + "double" ], - "returns": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder" + "returns": "void" }, { - "name": "equals", + "name": "goLayersBackwards", "constructor": false, "static": false, "parameters": [ - "Object" + "int" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "goLayersForwards", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "int" + ], + "returns": "void" }, { - "name": "isRecording", + "name": "goToBackLayer", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "notify", + "name": "goToFrontLayer", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "notifyAll", + "name": "goToMousePointer", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "start", + "name": "goToRandomPosition", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "stop", + "name": "goToSprite", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Sprite" + ], "returns": "void" }, { - "name": "toString", + "name": "hide", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "wait", + "name": "hideVariable", "constructor": false, "static": false, "parameters": [ - "long" + "String" ], "returns": "void" }, { - "name": "wait", + "name": "ifOnEdgeBounce", "constructor": false, "static": false, "parameters": [], "returns": "void" - } - ], - "org.openpatch.scratch.extensions.recorder.FrameRecorder": [ + }, { - "name": "FrameRecorder", - "constructor": true, + "name": "isAnimationPlayed", + "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.extensions.recorder.FrameRecorder" + "parameters": [], + "returns": "boolean" }, { - "name": "equals", + "name": "isAsking", "constructor": false, "static": false, - "parameters": [ - "Object" - ], + "parameters": [], "returns": "boolean" }, { - "name": "getClass", + "name": "isClone", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "boolean" }, { - "name": "isRecording", + "name": "isColorTouchingColor", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Color", + "org.openpatch.scratch.Color" + ], "returns": "boolean" }, { - "name": "notify", + "name": "isGliding", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "boolean" }, { - "name": "notifyAll", + "name": "isKeyPressed", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "boolean" }, { - "name": "start", + "name": "isMouseDown", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "boolean" }, { - "name": "stop", + "name": "isSoundPlaying", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "String" + ], + "returns": "boolean" }, { - "name": "toString", + "name": "isTouchingColor", "constructor": false, "static": false, - "parameters": [], - "returns": "String" + "parameters": [ + "double", + "double", + "double" + ], + "returns": "boolean" }, { - "name": "wait", + "name": "isTouchingColor", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.Color" ], - "returns": "void" + "returns": "boolean" }, { - "name": "wait", + "name": "isTouchingEdge", "constructor": false, "static": false, "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.recorder.GifRecorder": [ + "returns": "boolean" + }, { - "name": "GifRecorder", - "constructor": true, + "name": "isTouchingMousePointer", + "constructor": false, "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.extensions.recorder.GifRecorder" + "parameters": [], + "returns": "boolean" }, { - "name": "equals", + "name": "isTouchingSprite", "constructor": false, "static": false, "parameters": [ - "Object" + "Class" ], "returns": "boolean" }, { - "name": "getClass", + "name": "isTouchingSprite", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "org.openpatch.scratch.Sprite" + ], + "returns": "boolean" }, { - "name": "isRecording", + "name": "isVisible", "constructor": false, "static": false, "parameters": [], "returns": "boolean" }, { - "name": "notify", + "name": "move", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "nextCostume", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "start", + "name": "pickRandom", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "int", + "int" + ], + "returns": "int" }, { - "name": "stop", + "name": "playAnimation", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "boolean" + ], "returns": "void" }, { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", + "name": "playAnimation", "constructor": false, "static": false, "parameters": [ - "long" + "String" ], "returns": "void" }, { - "name": "wait", + "name": "playSound", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" - } - ], - "org.openpatch.scratch.extensions.recorder.Recorder": [ + }, { - "name": "equals", + "name": "playSoundCopy", "constructor": false, "static": false, "parameters": [ - "Object" + "String", + "double" ], - "returns": "boolean" + "returns": "org.openpatch.scratch.SoundPlayback" }, { - "name": "getClass", + "name": "pointTowards", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "org.openpatch.scratch.Sprite" + ], + "returns": "void" }, { - "name": "isRecording", + "name": "pointTowards", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void" }, { - "name": "notify", + "name": "pointTowardsMousePointer", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "notifyAll", + "name": "previousCostume", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "start", + "name": "remove", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "stop", + "name": "resetAnimation", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "toString", + "name": "run", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "wait", + "name": "say", "constructor": false, "static": false, "parameters": [ - "long" + "String", + "double" ], "returns": "void" }, { - "name": "wait", + "name": "say", "constructor": false, "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.shader.Shader": [ - { - "name": "Shader", - "constructor": true, - "static": false, "parameters": [ - "String", - "String", "String" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader" + "returns": "void" }, { - "name": "Shader", - "constructor": true, + "name": "setAlign", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.shader.Shader" + "org.openpatch.scratch.TextAlign" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader" + "returns": "void" }, { - "name": "equals", + "name": "setAnimationFrame", "constructor": false, "static": false, "parameters": [ - "Object" + "int" ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "getName", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "notify", + "name": "setAnimationInterval", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "setColorEffect", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "set", + "name": "setDirection", "constructor": false, "static": false, "parameters": [ - "String", - "boolean", - "boolean" + "double" ], "returns": "void" }, { - "name": "set", + "name": "setFont", "constructor": false, "static": false, "parameters": [ - "String", - "boolean" + "String" ], "returns": "void" }, { - "name": "set", + "name": "setHeight", "constructor": false, "static": false, "parameters": [ - "String", - "double", "double" ], "returns": "void" }, { - "name": "set", + "name": "setHitbox", "constructor": false, "static": false, "parameters": [ - "String", - "double" + "org.openpatch.scratch.Shape" ], "returns": "void" }, { - "name": "set", + "name": "setLayer", "constructor": false, "static": false, "parameters": [ - "String", - "double[]", - "int" + "org.openpatch.scratch.Layer" ], "returns": "void" }, { - "name": "set", + "name": "setLetterSpacing", "constructor": false, "static": false, "parameters": [ - "String", - "int", - "int" + "double" ], "returns": "void" }, { - "name": "set", + "name": "setLineSpacing", "constructor": false, "static": false, "parameters": [ - "String", - "int" + "double" ], "returns": "void" }, { - "name": "set", + "name": "setNineSlice", "constructor": false, "static": false, "parameters": [ - "String", - "int[]", + "int", + "int", + "int", "int" ], "returns": "void" }, { - "name": "set", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "String", - "org.openpatch.scratch.Color" + "double", + "double" ], "returns": "void" }, { - "name": "set", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "String", "org.openpatch.scratch.Vector2" ], "returns": "void" }, { - "name": "setName", + "name": "setRotationCenter", "constructor": false, "static": false, "parameters": [ - "String" + "double", + "double" ], "returns": "void" }, { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", + "name": "setRotationStyle", "constructor": false, "static": false, "parameters": [ - "long" + "org.openpatch.scratch.RotationStyle" ], "returns": "void" }, { - "name": "wait", + "name": "setSize", "constructor": false, "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.shader.Shaders": [ - { - "name": "Shaders", - "constructor": true, - "static": false, "parameters": [ - "String" + "double" ], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" + "returns": "void" }, { - "name": "Shaders", - "constructor": true, + "name": "setSpaceWidth", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.shader.Shaders" + "double" ], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" + "returns": "void" }, { - "name": "activate", + "name": "setTint", "constructor": false, "static": false, "parameters": [ - "String" + "double", + "double", + "double" ], "returns": "void" }, { - "name": "add", + "name": "setTint", "constructor": false, "static": false, "parameters": [ - "String", - "String", - "String" + "org.openpatch.scratch.Color" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader" + "returns": "void" }, { - "name": "deactivate", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], "returns": "void" }, { - "name": "equals", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "Object" + "double" ], - "returns": "boolean" + "returns": "void" }, { - "name": "get", + "name": "setVolume", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader" - }, - { - "name": "getActive", - "constructor": false, - "static": false, - "parameters": [], - "returns": "List" + "returns": "void" }, { - "name": "getClass", + "name": "setWidth", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getCurrent", + "name": "setX", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shader" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getCurrentIndex", + "name": "setY", "constructor": false, "static": false, - "parameters": [], - "returns": "int" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "getCurrentName", + "name": "show", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "isActive", + "name": "showText", "constructor": false, "static": false, "parameters": [ "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "next", + "name": "showVariable", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "java.util.function.Supplier" + ], "returns": "void" }, { - "name": "notify", + "name": "stamp", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Layer" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "stamp", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "reset", + "name": "stopAllSounds", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "switchTo", + "name": "stopSound", "constructor": false, "static": false, "parameters": [ @@ -25471,244 +14173,280 @@ "returns": "void" }, { - "name": "switchTo", + "name": "switchCostume", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", + "name": "switchCostume", "constructor": false, "static": false, "parameters": [ - "long" + "double" ], "returns": "void" }, { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.sorting.Sorting": [ - { - "name": "Sorting", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.sorting.Sorting" - }, - { - "name": "byY", + "name": "think", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "double" + ], "returns": "void" }, { - "name": "equals", + "name": "think", "constructor": false, "static": false, "parameters": [ - "Object" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "String" }, { - "name": "isOn", + "name": "turnLeft", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "double" + ], + "returns": "void" }, { - "name": "notify", + "name": "turnRight", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "whenAddedToStage", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "off", + "name": "whenBackdropSwitches", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String" + ], "returns": "void" }, { - "name": "toString", + "name": "whenClicked", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "wait", + "name": "whenIReceive", "constructor": false, "static": false, "parameters": [ - "long" + "String" ], "returns": "void" }, { - "name": "wait", + "name": "whenKeyPressed", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], "returns": "void" - } - ], - "org.openpatch.scratch.extensions.sound.SoundPlayback": [ + }, { - "name": "close", + "name": "whenKeyReleased", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], "returns": "void" }, { - "name": "equals", + "name": "whenMouseClicked", "constructor": false, "static": false, "parameters": [ - "Object" + "org.openpatch.scratch.MouseCode" ], - "returns": "boolean" + "returns": "void" }, { - "name": "getClass", + "name": "whenMouseMoved", "constructor": false, "static": false, - "parameters": [], - "returns": "Class" + "parameters": [ + "double", + "double" + ], + "returns": "void" }, { - "name": "getName", + "name": "whenRemovedFromStage", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "getVolume", + "name": "whenStartsAsClone", "constructor": false, "static": false, "parameters": [], - "returns": "double" - }, + "returns": "void" + } + ], + "org.openpatch.scratch.drawing.Drawing": [ { - "name": "isPlaying", + "name": "clip", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "double", + "double", + "double", + "double" + ], + "returns": "void" }, { - "name": "notify", + "name": "image", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "double", + "double", + "double", + "double" + ], "returns": "void" }, { - "name": "notifyAll", + "name": "image", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "double", + "double" + ], "returns": "void" }, { - "name": "setVolume", + "name": "imageHeight", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], - "returns": "void" + "returns": "int" }, { - "name": "stop", + "name": "imageWidth", "constructor": false, "static": false, - "parameters": [], - "returns": "void" + "parameters": [ + "String" + ], + "returns": "int" }, { - "name": "toString", + "name": "noClip", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "void" }, { - "name": "wait", + "name": "polygon", "constructor": false, "static": false, "parameters": [ - "long" + "double[]", + "double[]", + "org.openpatch.scratch.Color" ], "returns": "void" }, { - "name": "wait", + "name": "rectangle", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" + ], "returns": "void" } ], - "org.openpatch.scratch.extensions.text.BitmapText": [ + "org.openpatch.scratch.drawing.DrawingSprite": [ { - "name": "BitmapText", + "name": "DrawingSprite", "constructor": true, "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.drawing.DrawingSprite" + }, + { + "name": "addAnimation", + "constructor": false, + "static": false, "parameters": [ - "String" + "String", + "String", + "int", + "int", + "int[]" ], - "returns": "org.openpatch.scratch.extensions.text.BitmapText" + "returns": "void" }, { - "name": "act", + "name": "addAnimation", "constructor": false, "static": false, "parameters": [ - "double" + "String", + "String", + "int", + "int" ], "returns": "void" }, { - "name": "act", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "String", + "String", + "int" + ], "returns": "void" }, { @@ -25757,11 +14495,11 @@ "returns": "void" }, { - "name": "addGlyph", + "name": "addSound", "constructor": false, "static": false, "parameters": [ - "char", + "String", "String" ], "returns": "void" @@ -25771,13 +14509,12 @@ "constructor": false, "static": false, "parameters": [ - "String", "String" ], "returns": "void" }, { - "name": "addSound", + "name": "ask", "constructor": false, "static": false, "parameters": [ @@ -25786,7 +14523,7 @@ "returns": "void" }, { - "name": "ask", + "name": "broadcast", "constructor": false, "static": false, "parameters": [ @@ -25795,11 +14532,20 @@ "returns": "void" }, { - "name": "broadcast", + "name": "changeColorEffect", "constructor": false, "static": false, "parameters": [ - "String" + "double" + ], + "returns": "void" + }, + { + "name": "changeHeight", + "constructor": false, + "static": false, + "parameters": [ + "double" ], "returns": "void" }, @@ -25832,7 +14578,7 @@ "returns": "void" }, { - "name": "changeTint", + "name": "changeTransparency", "constructor": false, "static": false, "parameters": [ @@ -25850,7 +14596,7 @@ "returns": "void" }, { - "name": "changeTransparency", + "name": "changeVolume", "constructor": false, "static": false, "parameters": [ @@ -25859,7 +14605,7 @@ "returns": "void" }, { - "name": "changeVolume", + "name": "changeWidth", "constructor": false, "static": false, "parameters": [ @@ -25886,11 +14632,11 @@ "returns": "void" }, { - "name": "clone", + "name": "createClone", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Sprite" + "returns": "T@414 extends org.openpatch.scratch.Sprite" }, { "name": "debug", @@ -25909,14 +14655,14 @@ "returns": "void" }, { - "name": "destroy", + "name": "disableHitbox", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "disableHitbox", + "name": "disableNineSlice", "constructor": false, "static": false, "parameters": [], @@ -25936,23 +14682,14 @@ "parameters": [ "org.openpatch.scratch.Sprite" ], - "returns": "double" - }, - { - "name": "draw", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.extensions.drawing.Drawing" - ], - "returns": "void" + "returns": "double" }, { "name": "draw", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "org.openpatch.scratch.drawing.Drawing" ], "returns": "void" }, @@ -25964,34 +14701,32 @@ "returns": "void" }, { - "name": "equals", + "name": "getAnimationFrame", "constructor": false, "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" + "parameters": [], + "returns": "int" }, { - "name": "getAnswer", + "name": "getAnimationInterval", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "double" }, { - "name": "getClass", + "name": "getAnswer", "constructor": false, "static": false, "parameters": [], - "returns": "Class" + "returns": "String" }, { - "name": "getContent", + "name": "getColorEffect", "constructor": false, "static": false, "parameters": [], - "returns": "String" + "returns": "double" }, { "name": "getCurrentCostumeIndex", @@ -26007,13 +14742,6 @@ "parameters": [], "returns": "String" }, - { - "name": "getDeltaTime", - "constructor": false, - "static": false, - "parameters": [], - "returns": "double" - }, { "name": "getDirection", "constructor": false, @@ -26021,36 +14749,26 @@ "parameters": [], "returns": "double" }, - { - "name": "getGamepadAxisValue", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "double" - }, { "name": "getHeight", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "double" }, { - "name": "getHeight", + "name": "getHitbox", "constructor": false, "static": false, "parameters": [], - "returns": "int" + "returns": "org.openpatch.scratch.Shape" }, { - "name": "getHitbox", + "name": "getLayer", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Hitbox" + "returns": "org.openpatch.scratch.Layer" }, { "name": "getMouse", @@ -26087,12 +14805,19 @@ "parameters": [], "returns": "org.openpatch.scratch.Vector2" }, + { + "name": "getRotationStyle", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.RotationStyle" + }, { "name": "getShaders", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders" + "returns": "org.openpatch.scratch.Shaders" }, { "name": "getSize", @@ -26115,15 +14840,6 @@ "parameters": [], "returns": "org.openpatch.scratch.Text" }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "org.openpatch.scratch.Timer" - }, { "name": "getTimer", "constructor": false, @@ -26143,18 +14859,18 @@ "constructor": false, "static": false, "parameters": [ - "Class" + "Class" ], - "returns": "T@407 extends org.openpatch.scratch.Sprite" + "returns": "T@412 extends org.openpatch.scratch.Sprite" }, { "name": "getTouchingSprites", "constructor": false, "static": false, "parameters": [ - "Class" + "Class" ], - "returns": "nrw.List" + "returns": "nrw.List" }, { "name": "getTransparency", @@ -26182,14 +14898,7 @@ "constructor": false, "static": false, "parameters": [], - "returns": "int" - }, - { - "name": "getWidth", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int" + "returns": "double" }, { "name": "getX", @@ -26295,7 +15004,7 @@ "returns": "void" }, { - "name": "isActing", + "name": "isAnimationPlayed", "constructor": false, "static": false, "parameters": [], @@ -26326,40 +15035,30 @@ "returns": "boolean" }, { - "name": "isDestroyed", + "name": "isGliding", "constructor": false, "static": false, "parameters": [], "returns": "boolean" }, { - "name": "isGamepadButtonDown", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "boolean" - }, - { - "name": "isGamepadConnected", + "name": "isKeyPressed", "constructor": false, "static": false, "parameters": [ - "int" + "org.openpatch.scratch.KeyCode" ], "returns": "boolean" }, { - "name": "isGliding", + "name": "isMouseDown", "constructor": false, "static": false, "parameters": [], "returns": "boolean" }, { - "name": "isKeyDown", + "name": "isSoundPlaying", "constructor": false, "static": false, "parameters": [ @@ -26368,109 +15067,139 @@ "returns": "boolean" }, { - "name": "isKeyPressed", + "name": "isTouchingColor", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double", + "double", + "double" ], "returns": "boolean" }, { - "name": "isKeyUp", + "name": "isTouchingColor", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.Color" ], "returns": "boolean" }, { - "name": "isMouseDown", + "name": "isTouchingEdge", "constructor": false, "static": false, "parameters": [], "returns": "boolean" }, { - "name": "isSoundPlaying", + "name": "isTouchingMousePointer", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "boolean" }, { - "name": "isTouchingColor", + "name": "isTouchingSprite", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "Class" ], "returns": "boolean" }, { - "name": "isTouchingColor", + "name": "isTouchingSprite", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "org.openpatch.scratch.Sprite" ], "returns": "boolean" }, { - "name": "isTouchingEdge", + "name": "isVisible", "constructor": false, "static": false, "parameters": [], "returns": "boolean" }, { - "name": "isTouchingMousePointer", + "name": "move", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void" + }, + { + "name": "nextCostume", "constructor": false, "static": false, "parameters": [], - "returns": "boolean" + "returns": "void" }, { - "name": "isTouchingSprite", + "name": "pickRandom", + "constructor": false, + "static": false, + "parameters": [ + "int", + "int" + ], + "returns": "int" + }, + { + "name": "playAnimation", "constructor": false, "static": false, "parameters": [ - "Class" + "String", + "boolean" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isTouchingSprite", + "name": "playAnimation", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "String" ], - "returns": "boolean" + "returns": "void" }, { - "name": "isVisible", + "name": "playSound", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean" + "parameters": [ + "String" + ], + "returns": "void" }, { - "name": "move", + "name": "playSoundCopy", "constructor": false, "static": false, "parameters": [ + "String", "double" ], + "returns": "org.openpatch.scratch.SoundPlayback" + }, + { + "name": "pointTowards", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Sprite" + ], "returns": "void" }, { - "name": "move", + "name": "pointTowards", "constructor": false, "static": false, "parameters": [ @@ -26479,37 +15208,52 @@ "returns": "void" }, { - "name": "nextCostume", + "name": "pointTowardsMousePointer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void" + }, + { + "name": "previousCostume", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void" + }, + { + "name": "remove", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "notify", + "name": "resetAnimation", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "notifyAll", + "name": "run", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "onKeyDown", + "name": "say", "constructor": false, "static": false, "parameters": [ - "String" + "String", + "double" ], "returns": "void" }, { - "name": "onKeyTyped", + "name": "say", "constructor": false, "static": false, "parameters": [ @@ -26518,45 +15262,43 @@ "returns": "void" }, { - "name": "onKeyUp", + "name": "setAnimationFrame", "constructor": false, "static": false, "parameters": [ - "String" + "int" ], "returns": "void" }, { - "name": "pickRandom", + "name": "setAnimationInterval", "constructor": false, "static": false, "parameters": [ - "int", - "int" + "double" ], - "returns": "int" + "returns": "void" }, { - "name": "playSound", + "name": "setColorEffect", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], "returns": "void" }, { - "name": "playSoundCopy", + "name": "setDirection", "constructor": false, "static": false, "parameters": [ - "String", "double" ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback" + "returns": "void" }, { - "name": "pointInDirection", + "name": "setHeight", "constructor": false, "static": false, "parameters": [ @@ -26565,97 +15307,140 @@ "returns": "void" }, { - "name": "pointInDirection", + "name": "setHitbox", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.Shape" ], "returns": "void" }, { - "name": "pointTowardsMousePointer", + "name": "setLayer", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Layer" + ], "returns": "void" }, { - "name": "pointTowardsSprite", + "name": "setNineSlice", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "int", + "int", + "int", + "int" ], "returns": "void" }, { - "name": "previousCostume", + "name": "setPosition", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double" + ], + "returns": "void" + }, + { + "name": "setPosition", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void" + }, + { + "name": "setRotationCenter", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double" + ], + "returns": "void" + }, + { + "name": "setRotationStyle", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.RotationStyle" + ], "returns": "void" }, { - "name": "remove", + "name": "setSize", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void" }, { - "name": "restartActing", + "name": "setTint", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double", + "double" + ], "returns": "void" }, { - "name": "run", + "name": "setTint", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Color" + ], "returns": "void" }, { - "name": "say", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "String", - "int" + "double" ], "returns": "void" }, { - "name": "say", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "String" + "double" ], "returns": "void" }, { - "name": "setActFrequency", + "name": "setVolume", "constructor": false, - "static": true, + "static": false, "parameters": [ - "int" + "double" ], "returns": "void" }, { - "name": "setAlign", + "name": "setWidth", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.TextAlign" + "double" ], "returns": "void" }, { - "name": "setDirection", + "name": "setX", "constructor": false, "static": false, "parameters": [ @@ -26664,108 +15449,109 @@ "returns": "void" }, { - "name": "setDirection", + "name": "setY", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "double" ], "returns": "void" }, { - "name": "setFont", + "name": "show", "constructor": false, "static": false, - "parameters": [ - "String" - ], + "parameters": [], "returns": "void" }, { - "name": "setHitbox", + "name": "showVariable", "constructor": false, "static": false, "parameters": [ - "double[]" + "String", + "java.util.function.Supplier" ], "returns": "void" }, { - "name": "setHitbox", + "name": "stamp", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Shape" + "org.openpatch.scratch.Layer" ], "returns": "void" }, { - "name": "setIsUI", + "name": "stamp", "constructor": false, "static": false, - "parameters": [ - "boolean" - ], + "parameters": [], "returns": "void" }, { - "name": "setLetterSpacing", + "name": "stopAllSounds", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "setLineSpacing", + "name": "stopSound", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "setPosition", + "name": "switchCostume", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "String" ], "returns": "void" }, { - "name": "setPosition", + "name": "switchCostume", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "double" ], "returns": "void" }, { - "name": "setRotationCenter", + "name": "think", "constructor": false, "static": false, "parameters": [ - "double", + "String", "double" ], "returns": "void" }, { - "name": "setRotationStyle", + "name": "think", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.RotationStyle" + "String" ], "returns": "void" }, { - "name": "setSize", + "name": "toString", + "constructor": false, + "static": false, + "parameters": [], + "returns": "String" + }, + { + "name": "turnLeft", "constructor": false, "static": false, "parameters": [ @@ -26774,7 +15560,7 @@ "returns": "void" }, { - "name": "setSpaceWidth", + "name": "turnRight", "constructor": false, "static": false, "parameters": [ @@ -26783,322 +15569,393 @@ "returns": "void" }, { - "name": "setTint", + "name": "whenAddedToStage", "constructor": false, "static": false, - "parameters": [ - "double", - "double", - "double" - ], + "parameters": [], "returns": "void" }, { - "name": "setTint", + "name": "whenBackdropSwitches", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "setTint", + "name": "whenClicked", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], + "parameters": [], "returns": "void" }, { - "name": "setTransparency", + "name": "whenIReceive", "constructor": false, "static": false, "parameters": [ - "double" + "String" ], "returns": "void" }, { - "name": "setTransparency", + "name": "whenKeyPressed", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.KeyCode" ], "returns": "void" }, { - "name": "setVolume", + "name": "whenKeyReleased", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.KeyCode" ], "returns": "void" }, { - "name": "setX", + "name": "whenMouseClicked", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.MouseCode" ], "returns": "void" }, { - "name": "setY", + "name": "whenMouseMoved", "constructor": false, "static": false, "parameters": [ + "double", "double" ], "returns": "void" }, { - "name": "show", + "name": "whenRemovedFromStage", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "showText", + "name": "whenStartsAsClone", "constructor": false, "static": false, + "parameters": [], + "returns": "void" + } + ], + "org.openpatch.scratch.gamepad.Gamepad": [ + { + "name": "getStick", + "constructor": false, + "static": true, "parameters": [ - "String" + "int", + "org.openpatch.scratch.gamepad.GamepadStick" ], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "showVariable", + "name": "getStick", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String", - "java.util.function.Supplier" + "org.openpatch.scratch.gamepad.GamepadStick" ], - "returns": "void" + "returns": "org.openpatch.scratch.Vector2" }, { - "name": "stamp", + "name": "getTrigger", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Layer" + "int", + "org.openpatch.scratch.gamepad.GamepadTrigger" ], - "returns": "void" + "returns": "double" }, { - "name": "stamp", + "name": "getTrigger", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadTrigger" + ], + "returns": "double" }, { - "name": "stopActing", + "name": "isButtonPressed", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "int", + "org.openpatch.scratch.gamepad.GamepadButton" + ], + "returns": "boolean" }, { - "name": "stopAllSounds", + "name": "isButtonPressed", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadButton" + ], + "returns": "boolean" }, { - "name": "stopSound", + "name": "isConnected", "constructor": false, - "static": false, + "static": true, + "parameters": [ + "int" + ], + "returns": "boolean" + }, + { + "name": "isConnected", + "constructor": false, + "static": true, + "parameters": [], + "returns": "boolean" + } + ], + "org.openpatch.scratch.gamepad.GamepadButton": [ + { + "name": "valueOf", + "constructor": false, + "static": true, "parameters": [ "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.gamepad.GamepadButton" }, { - "name": "switchCostume", + "name": "values", + "constructor": false, + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.gamepad.GamepadButton[]" + } + ], + "org.openpatch.scratch.gamepad.GamepadListener": [ + { + "name": "whenGamepadButtonPressed", "constructor": false, "static": false, "parameters": [ - "String" + "org.openpatch.scratch.gamepad.GamepadButton" ], "returns": "void" }, { - "name": "switchCostume", + "name": "whenGamepadButtonReleased", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.gamepad.GamepadButton" ], "returns": "void" }, { - "name": "think", + "name": "whenGamepadConnected", "constructor": false, "static": false, "parameters": [ - "String", "int" ], "returns": "void" - }, + } + ], + "org.openpatch.scratch.gamepad.GamepadStick": [ { - "name": "think", + "name": "valueOf", "constructor": false, - "static": false, + "static": true, "parameters": [ "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.gamepad.GamepadStick" }, { - "name": "toString", + "name": "values", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "String" - }, + "returns": "org.openpatch.scratch.gamepad.GamepadStick[]" + } + ], + "org.openpatch.scratch.gamepad.GamepadTrigger": [ { - "name": "turnLeft", + "name": "valueOf", "constructor": false, - "static": false, + "static": true, "parameters": [ - "double" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.gamepad.GamepadTrigger" }, { - "name": "turnRight", + "name": "values", "constructor": false, + "static": true, + "parameters": [], + "returns": "org.openpatch.scratch.gamepad.GamepadTrigger[]" + } + ], + "org.openpatch.scratch.recorder.GifRecorder": [ + { + "name": "GifRecorder", + "constructor": true, "static": false, "parameters": [ - "double" + "String" ], - "returns": "void" + "returns": "org.openpatch.scratch.recorder.GifRecorder" }, { - "name": "wait", + "name": "snapshot", "constructor": false, "static": false, - "parameters": [ - "long" - ], + "parameters": [], "returns": "void" }, { - "name": "wait", + "name": "start", "constructor": false, "static": false, "parameters": [], "returns": "void" }, { - "name": "whenAddedToStage", + "name": "stop", "constructor": false, "static": false, "parameters": [], "returns": "void" + } + ], + "org.openpatch.scratch.save.File": [ + { + "name": "File", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.save.File" }, { - "name": "whenBackdropSwitches", + "name": "load", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String" + "String", + "Class" ], - "returns": "void" + "returns": "Object" }, { - "name": "whenClicked", + "name": "loadOrCreate", "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "static": true, + "parameters": [ + "String", + "Class" + ], + "returns": "Object" }, { - "name": "whenIReceive", + "name": "loadXML", "constructor": false, - "static": false, + "static": true, "parameters": [ - "String" + "String", + "Class" ], - "returns": "void" + "returns": "Object" }, { - "name": "whenKeyPressed", + "name": "loadXMLOrCreate", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.KeyCode" + "String", + "Class" ], - "returns": "void" + "returns": "Object" }, { - "name": "whenKeyReleased", + "name": "save", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.KeyCode" + "String", + "Object" ], "returns": "void" }, { - "name": "whenMouseClicked", + "name": "saveXML", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.MouseCode" + "String", + "Object" ], "returns": "void" - }, + } + ], + "org.openpatch.scratch.save.SaveData": [ { - "name": "whenMouseMoved", - "constructor": false, + "name": "SaveData", + "constructor": true, "static": false, "parameters": [ - "double", - "double" + "String", + "String", + "Class" ], - "returns": "void" + "returns": "org.openpatch.scratch.save.SaveData" }, { - "name": "whenRemovedFromStage", + "name": "getLocation", "constructor": false, "static": false, "parameters": [], - "returns": "void" + "returns": "String" }, { - "name": "whenStartsAsClone", + "name": "loadOrDefault", "constructor": false, "static": false, - "parameters": [], - "returns": "void" - } - ], - "org.openpatch.scratch.extensions.tiled.MapObject": [ + "parameters": [ + "java.util.function.Supplier" + ], + "returns": "T@339" + }, { - "name": "equals", + "name": "save", "constructor": false, "static": false, "parameters": [ - "Object" + "T@339" ], - "returns": "boolean" - }, + "returns": "void" + } + ], + "org.openpatch.scratch.tiled.MapObject": [ { - "name": "getClass", - "constructor": false, + "name": "MapObject", + "constructor": true, "static": false, "parameters": [], - "returns": "Class" + "returns": "org.openpatch.scratch.tiled.MapObject" }, { "name": "getProperty", @@ -27144,99 +16001,34 @@ "returns": "org.openpatch.scratch.Shape" }, { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", + "name": "setClassName", "constructor": false, "static": false, "parameters": [ - "long" + "String" ], "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" } ], - "org.openpatch.scratch.extensions.tiled.Property": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, + "org.openpatch.scratch.tiled.Property": [ { - "name": "toString", - "constructor": false, + "name": "Property", + "constructor": true, "static": false, "parameters": [], - "returns": "String" + "returns": "org.openpatch.scratch.tiled.Property" }, { - "name": "wait", + "name": "setText", "constructor": false, "static": false, "parameters": [ - "long" + "String" ], "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" } ], - "org.openpatch.scratch.extensions.tiled.TiledMap": [ + "org.openpatch.scratch.tiled.TiledMap": [ { "name": "TiledMap", "constructor": true, @@ -27245,7 +16037,7 @@ "String", "org.openpatch.scratch.Stage" ], - "returns": "org.openpatch.scratch.extensions.tiled.TiledMap" + "returns": "org.openpatch.scratch.tiled.TiledMap" }, { "name": "TiledMap", @@ -27254,23 +16046,7 @@ "parameters": [ "String" ], - "returns": "org.openpatch.scratch.extensions.tiled.TiledMap" - }, - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" + "returns": "org.openpatch.scratch.tiled.TiledMap" }, { "name": "getHeight", @@ -27286,7 +16062,7 @@ "parameters": [ "String" ], - "returns": "org.openpatch.scratch.extensions.tiled.MapObject[]" + "returns": "org.openpatch.scratch.tiled.MapObject[]" }, { "name": "getProperty", @@ -27387,30 +16163,7 @@ "returns": "int" }, { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "spawn", - "constructor": false, - "static": false, - "parameters": [ - "String" - ], - "returns": "List" - }, - { - "name": "stampLayerToBackground", + "name": "hideLayer", "constructor": false, "static": false, "parameters": [ @@ -27419,91 +16172,32 @@ "returns": "void" }, { - "name": "stampLayerToForeground", + "name": "showLayer", "constructor": false, "static": false, "parameters": [ - "String" + "String", + "org.openpatch.scratch.Layer" ], "returns": "void" }, { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", + "name": "spawn", "constructor": false, "static": false, "parameters": [ - "long" + "String" ], - "returns": "void" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" + "returns": "List" } ], - "org.openpatch.scratch.extensions.tiled.TilesetImage": [ - { - "name": "equals", - "constructor": false, - "static": false, - "parameters": [ - "Object" - ], - "returns": "boolean" - }, - { - "name": "getClass", - "constructor": false, - "static": false, - "parameters": [], - "returns": "Class" - }, - { - "name": "notify", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "notifyAll", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void" - }, - { - "name": "toString", - "constructor": false, - "static": false, - "parameters": [], - "returns": "String" - }, - { - "name": "wait", - "constructor": false, - "static": false, - "parameters": [ - "long" - ], - "returns": "void" - }, + "org.openpatch.scratch.tiled.TilesetImage": [ { - "name": "wait", - "constructor": false, + "name": "TilesetImage", + "constructor": true, "static": false, "parameters": [], - "returns": "void" + "returns": "org.openpatch.scratch.tiled.TilesetImage" } ] } diff --git a/compatibility/browser-compatibility.md b/compatibility/browser-compatibility.md index 7eeeb98b..67554438 100644 --- a/compatibility/browser-compatibility.md +++ b/compatibility/browser-compatibility.md @@ -16,8 +16,8 @@ Public constructors and method groups documented by the Javadoc doclet. Overload ## Limits of this revision - Availability describes documented member groups and browser declarations. Compilation tests do not prove rendering, timing or complete behavioral parity. -- Fragment shaders use WebGL. Custom vertex shaders are desktop-only; the browser substitutes its default vertex shader. -- File access, pixel-buffer, and recorder APIs are desktop-only. Tiled reads finite orthogonal TMX/TSX maps from workspace files or URLs. SaveData instead persists plain game data in IndexedDB, scoped to the hosting origin and browser profile. +- Shaders are fragment shaders; the browser runs them with WebGL. +- File access and recorder APIs are desktop-only; Pixels reads the stage on the graphics card. Tiled reads finite orthogonal TMX/TSX maps from workspace files or URLs. SaveData instead persists plain game data in IndexedDB, scoped to the hosting origin and browser profile. - Reference examples are compiled with the standard flavor. Existing NRW runtime fixtures and a separate declaration inventory cover the NRW flavor. - Java compiler dialect differences also apply, including Java package access and unsupported standard-library methods. @@ -27,17 +27,26 @@ An implemented entry has its documented overloads declared in the browser. The r | API group | Browser availability | Details | | --- | --- | --- | -| [AnimatedSprite/addAnimation](/reference/AnimatedSprite/addAnimation) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [AnimatedSprite/clone](/reference/AnimatedSprite/clone) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [AnimatedSprite/constructor](/reference/AnimatedSprite/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [AnimatedSprite/getAnimationFrame](/reference/AnimatedSprite/getAnimationFrame) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [AnimatedSprite/getAnimationInterval](/reference/AnimatedSprite/getAnimationInterval) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [AnimatedSprite/isAnimationPlayed](/reference/AnimatedSprite/isAnimationPlayed) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [AnimatedSprite/playAnimation](/reference/AnimatedSprite/playAnimation) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [AnimatedSprite/resetAnimation](/reference/AnimatedSprite/resetAnimation) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [AnimatedSprite/setAnimationFrame](/reference/AnimatedSprite/setAnimationFrame) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [AnimatedSprite/setAnimationInterval](/reference/AnimatedSprite/setAnimationInterval) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [AnimatedSprite/toString](/reference/AnimatedSprite/toString) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/changeX](/reference/Camera/changeX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/changeY](/reference/Camera/changeY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/changeZoom](/reference/Camera/changeZoom) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/constructor](/reference/Camera/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/getPosition](/reference/Camera/getPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/getX](/reference/Camera/getX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/getY](/reference/Camera/getY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/getZoom](/reference/Camera/getZoom) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/resetZoom](/reference/Camera/resetZoom) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/setPosition](/reference/Camera/setPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/setX](/reference/Camera/setX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/setY](/reference/Camera/setY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/setZoom](/reference/Camera/setZoom) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/setZoomLimit](/reference/Camera/setZoomLimit) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/toScreenPosition](/reference/Camera/toScreenPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/toScreenX](/reference/Camera/toScreenX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/toScreenY](/reference/Camera/toScreenY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/toWorldPosition](/reference/Camera/toWorldPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/toWorldX](/reference/Camera/toWorldX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Camera/toWorldY](/reference/Camera/toWorldY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Circle/constructor](/reference/Circle/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Clock/constructor](/reference/Clock/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Clock/getDay](/reference/Clock/getDay) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -49,28 +58,28 @@ An implemented entry has its documented overloads declared in the browser. The r | [Clock/getMonth](/reference/Clock/getMonth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Clock/getSecond](/reference/Clock/getSecond) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Clock/getYear](/reference/Clock/getYear) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Color/changeColor](/reference/Color/changeColor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Color/constructor](/reference/Color/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Color/equals](/reference/Color/equals) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Color/get](/reference/Color/get) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/fromARGB](/reference/Color/fromARGB) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/fromHSB](/reference/Color/fromHSB) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/getAlpha](/reference/Color/getAlpha) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Color/getBlue](/reference/Color/getBlue) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/getBrightness](/reference/Color/getBrightness) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Color/getGreen](/reference/Color/getGreen) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Color/getH](/reference/Color/getH) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Color/getHSB](/reference/Color/getHSB) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Color/getL](/reference/Color/getL) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/getHue](/reference/Color/getHue) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Color/getRed](/reference/Color/getRed) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Color/getS](/reference/Color/getS) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/getSaturation](/reference/Color/getSaturation) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Color/hashCode](/reference/Color/hashCode) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Color/setHSB](/reference/Color/setHSB) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Color/setRGB](/reference/Color/setRGB) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/toARGB](/reference/Color/toARGB) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Color/toString](/reference/Color/toString) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/withAlpha](/reference/Color/withAlpha) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/withBlue](/reference/Color/withBlue) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/withBrightness](/reference/Color/withBrightness) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/withGreen](/reference/Color/withGreen) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/withHue](/reference/Color/withHue) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/withRed](/reference/Color/withRed) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Color/withSaturation](/reference/Color/withSaturation) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Ellipse/constructor](/reference/Ellipse/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Hitbox/constructor](/reference/Hitbox/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Hitbox/contains](/reference/Hitbox/contains) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Hitbox/getBounds](/reference/Hitbox/getBounds) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Hitbox/getShape](/reference/Hitbox/getShape) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Hitbox/intersects](/reference/Hitbox/intersects) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Hitbox/translateAndRotateAndResize](/reference/Hitbox/translateAndRotateAndResize) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [HtmlColor/constructor](/reference/HtmlColor/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [HtmlColor/getRandom](/reference/HtmlColor/getRandom) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Operators/absOf](/reference/Operators/absOf) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -102,18 +111,26 @@ An implemented entry has its documented overloads declared in the browser. The r | [Pen/down](/reference/Pen/down) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/eraseAll](/reference/Pen/eraseAll) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/getColor](/reference/Pen/getColor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pen/getLayer](/reference/Pen/getLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pen/getPosition](/reference/Pen/getPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/getSize](/reference/Pen/getSize) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Pen/goToBackground](/reference/Pen/goToBackground) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Pen/goToForeground](/reference/Pen/goToForeground) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pen/getTransparency](/reference/Pen/getTransparency) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/goToMousePointer](/reference/Pen/goToMousePointer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/goToRandomPosition](/reference/Pen/goToRandomPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Pen/isInBackground](/reference/Pen/isInBackground) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pen/isDown](/reference/Pen/isDown) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/setColor](/reference/Pen/setColor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pen/setLayer](/reference/Pen/setLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/setPosition](/reference/Pen/setPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/setSize](/reference/Pen/setSize) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/setTransparency](/reference/Pen/setTransparency) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/stamp](/reference/Pen/stamp) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Pen/up](/reference/Pen/up) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pixels/constructor](/reference/Pixels/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pixels/getArgb](/reference/Pixels/getArgb) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pixels/getColor](/reference/Pixels/getColor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pixels/getHeight](/reference/Pixels/getHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pixels/getWidth](/reference/Pixels/getWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Pixels/of](/reference/Pixels/of) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Polygon/addPoint](/reference/Polygon/addPoint) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Polygon/constructor](/reference/Polygon/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Random/constructor](/reference/Random/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -127,45 +144,76 @@ An implemented entry has its documented overloads declared in the browser. The r | [Random/randomX](/reference/Random/randomX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Random/randomY](/reference/Random/randomY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Rectangle/constructor](/reference/Rectangle/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shader/constructor](/reference/Shader/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shader/getName](/reference/Shader/getName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shader/set](/reference/Shader/set) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shader/setName](/reference/Shader/setName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/activate](/reference/Shaders/activate) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/add](/reference/Shaders/add) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/constructor](/reference/Shaders/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/deactivate](/reference/Shaders/deactivate) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/get](/reference/Shaders/get) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/getActive](/reference/Shaders/getActive) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/getCurrent](/reference/Shaders/getCurrent) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/getCurrentIndex](/reference/Shaders/getCurrentIndex) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/getCurrentName](/reference/Shaders/getCurrentName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/isActive](/reference/Shaders/isActive) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/next](/reference/Shaders/next) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/reset](/reference/Shaders/reset) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shaders/switchTo](/reference/Shaders/switchTo) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Shape/constructor](/reference/Shape/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Shape/contains](/reference/Shape/contains) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Shape/getBounds](/reference/Shape/getBounds) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Shape/getPoints](/reference/Shape/getPoints) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Shape/intersects](/reference/Shape/intersects) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Shape/rotate](/reference/Shape/rotate) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Shape/scale](/reference/Shape/scale) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Shape/translate](/reference/Shape/translate) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [SoundPlayback/constructor](/reference/SoundPlayback/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [SoundPlayback/isPlaying](/reference/SoundPlayback/isPlaying) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [SoundPlayback/setVolume](/reference/SoundPlayback/setVolume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [SoundPlayback/stop](/reference/SoundPlayback/stop) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/addAnimation](/reference/Sprite/addAnimation) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/addCostume](/reference/Sprite/addCostume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/addCostumes](/reference/Sprite/addCostumes) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/addSound](/reference/Sprite/addSound) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/ask](/reference/Sprite/ask) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/broadcast](/reference/Sprite/broadcast) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/changeColorEffect](/reference/Sprite/changeColorEffect) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/changeHeight](/reference/Sprite/changeHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/changePosition](/reference/Sprite/changePosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/changeSize](/reference/Sprite/changeSize) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Sprite/changeTint](/reference/Sprite/changeTint) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/changeTransparency](/reference/Sprite/changeTransparency) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/changeVolume](/reference/Sprite/changeVolume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/changeWidth](/reference/Sprite/changeWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/changeX](/reference/Sprite/changeX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/changeY](/reference/Sprite/changeY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Sprite/clone](/reference/Sprite/clone) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/constructor](/reference/Sprite/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/createClone](/reference/Sprite/createClone) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/debug](/reference/Sprite/debug) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/deleteThisClone](/reference/Sprite/deleteThisClone) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/disableHitbox](/reference/Sprite/disableHitbox) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/disableNineSlice](/reference/Sprite/disableNineSlice) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/distanceToMousePointer](/reference/Sprite/distanceToMousePointer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/distanceToSprite](/reference/Sprite/distanceToSprite) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/enableHitbox](/reference/Sprite/enableHitbox) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/extension](/reference/Sprite/extension) | desktop-only | For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others. | +| [Sprite/getAnimationFrame](/reference/Sprite/getAnimationFrame) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/getAnimationInterval](/reference/Sprite/getAnimationInterval) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getAnswer](/reference/Sprite/getAnswer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/getColorEffect](/reference/Sprite/getColorEffect) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getCurrentCostumeIndex](/reference/Sprite/getCurrentCostumeIndex) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getCurrentCostumeName](/reference/Sprite/getCurrentCostumeName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Sprite/getDeltaTime](/reference/Sprite/getDeltaTime) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getDirection](/reference/Sprite/getDirection) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getHeight](/reference/Sprite/getHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getHitbox](/reference/Sprite/getHitbox) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/getLayer](/reference/Sprite/getLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getMouse](/reference/Sprite/getMouse) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getMouseX](/reference/Sprite/getMouseX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getMouseY](/reference/Sprite/getMouseY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getPen](/reference/Sprite/getPen) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getPosition](/reference/Sprite/getPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/getRotationStyle](/reference/Sprite/getRotationStyle) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getShaders](/reference/Sprite/getShaders) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getSize](/reference/Sprite/getSize) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/getStage](/reference/Sprite/getStage) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -190,6 +238,7 @@ An implemented entry has its documented overloads declared in the browser. The r | [Sprite/hide](/reference/Sprite/hide) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/hideVariable](/reference/Sprite/hideVariable) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/ifOnEdgeBounce](/reference/Sprite/ifOnEdgeBounce) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/isAnimationPlayed](/reference/Sprite/isAnimationPlayed) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/isAsking](/reference/Sprite/isAsking) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/isClone](/reference/Sprite/isClone) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/isColorTouchingColor](/reference/Sprite/isColorTouchingColor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -205,17 +254,24 @@ An implemented entry has its documented overloads declared in the browser. The r | [Sprite/move](/reference/Sprite/move) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/nextCostume](/reference/Sprite/nextCostume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/pickRandom](/reference/Sprite/pickRandom) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/playAnimation](/reference/Sprite/playAnimation) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/playSound](/reference/Sprite/playSound) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/playSoundCopy](/reference/Sprite/playSoundCopy) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Sprite/pointInDirection](/reference/Sprite/pointInDirection) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/pointTowards](/reference/Sprite/pointTowards) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/pointTowardsMousePointer](/reference/Sprite/pointTowardsMousePointer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Sprite/pointTowardsSprite](/reference/Sprite/pointTowardsSprite) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/previousCostume](/reference/Sprite/previousCostume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/remove](/reference/Sprite/remove) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/resetAnimation](/reference/Sprite/resetAnimation) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/run](/reference/Sprite/run) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/say](/reference/Sprite/say) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/setAnimationFrame](/reference/Sprite/setAnimationFrame) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/setAnimationInterval](/reference/Sprite/setAnimationInterval) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/setColorEffect](/reference/Sprite/setColorEffect) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/setDirection](/reference/Sprite/setDirection) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/setHeight](/reference/Sprite/setHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/setHitbox](/reference/Sprite/setHitbox) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/setLayer](/reference/Sprite/setLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/setNineSlice](/reference/Sprite/setNineSlice) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/setPosition](/reference/Sprite/setPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/setRotationCenter](/reference/Sprite/setRotationCenter) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/setRotationStyle](/reference/Sprite/setRotationStyle) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -223,6 +279,7 @@ An implemented entry has its documented overloads declared in the browser. The r | [Sprite/setTint](/reference/Sprite/setTint) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/setTransparency](/reference/Sprite/setTransparency) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/setVolume](/reference/Sprite/setVolume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/setWidth](/reference/Sprite/setWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/setX](/reference/Sprite/setX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/setY](/reference/Sprite/setY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/show](/reference/Sprite/show) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -232,6 +289,7 @@ An implemented entry has its documented overloads declared in the browser. The r | [Sprite/stopSound](/reference/Sprite/stopSound) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/switchCostume](/reference/Sprite/switchCostume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/think](/reference/Sprite/think) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Sprite/toString](/reference/Sprite/toString) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/turnLeft](/reference/Sprite/turnLeft) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/turnRight](/reference/Sprite/turnRight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Sprite/whenAddedToStage](/reference/Sprite/whenAddedToStage) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -249,8 +307,7 @@ An implemented entry has its documented overloads declared in the browser. The r | [Stage/addSound](/reference/Stage/addSound) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/ask](/reference/Stage/ask) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/broadcast](/reference/Stage/broadcast) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Stage/changeColor](/reference/Stage/changeColor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Stage/changeTint](/reference/Stage/changeTint) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Stage/changeColorEffect](/reference/Stage/changeColorEffect) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/changeTransparency](/reference/Stage/changeTransparency) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/changeVolume](/reference/Stage/changeVolume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/constructor](/reference/Stage/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -258,29 +315,26 @@ An implemented entry has its documented overloads declared in the browser. The r | [Stage/debug](/reference/Stage/debug) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/display](/reference/Stage/display) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/eraseAll](/reference/Stage/eraseAll) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Stage/exit](/reference/Stage/exit) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Stage/extension](/reference/Stage/extension) | desktop-only | For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others. | | [Stage/find](/reference/Stage/find) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getAll](/reference/Stage/getAll) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getAnswer](/reference/Stage/getAnswer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getCamera](/reference/Stage/getCamera) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getColor](/reference/Stage/getColor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Stage/getColorEffect](/reference/Stage/getColorEffect) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getCurrentBackdropIndex](/reference/Stage/getCurrentBackdropIndex) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getCurrentBackdropName](/reference/Stage/getCurrentBackdropName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Stage/getDeltaTime](/reference/Stage/getDeltaTime) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Stage/getFrameRate](/reference/Stage/getFrameRate) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getHeight](/reference/Stage/getHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getMouse](/reference/Stage/getMouse) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getMouseX](/reference/Stage/getMouseX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getMouseY](/reference/Stage/getMouseY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Stage/getPixels](/reference/Stage/getPixels) | desktop-only | The desktop pixel buffer is not exposed by the browser renderer. | | [Stage/getShaders](/reference/Stage/getShaders) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Stage/getSorting](/reference/Stage/getSorting) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getTimer](/reference/Stage/getTimer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Stage/getTransparency](/reference/Stage/getTransparency) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getVolume](/reference/Stage/getVolume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/getWidth](/reference/Stage/getWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/hideVariable](/reference/Stage/hideVariable) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/isAsking](/reference/Stage/isAsking) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Stage/isDebug](/reference/Stage/isDebug) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/isKeyPressed](/reference/Stage/isKeyPressed) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/isMouseDown](/reference/Stage/isMouseDown) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/isSoundPlaying](/reference/Stage/isSoundPlaying) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -294,16 +348,19 @@ An implemented entry has its documented overloads declared in the browser. The r | [Stage/removeAll](/reference/Stage/removeAll) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/run](/reference/Stage/run) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/setColor](/reference/Stage/setColor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Stage/setColorEffect](/reference/Stage/setColorEffect) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/setCursor](/reference/Stage/setCursor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Stage/setDebug](/reference/Stage/setDebug) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/setTint](/reference/Stage/setTint) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/setTransparency](/reference/Stage/setTransparency) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/setVolume](/reference/Stage/setVolume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/showVariable](/reference/Stage/showVariable) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Stage/sortBy](/reference/Stage/sortBy) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Stage/sortByY](/reference/Stage/sortByY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/stopAllSounds](/reference/Stage/stopAllSounds) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Stage/stopSorting](/reference/Stage/stopSorting) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/stopSound](/reference/Stage/stopSound) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/switchBackdrop](/reference/Stage/switchBackdrop) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Stage/wait](/reference/Stage/wait) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Stage/waitSeconds](/reference/Stage/waitSeconds) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/waitUntil](/reference/Stage/waitUntil) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/whenBackdropSwitches](/reference/Stage/whenBackdropSwitches) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Stage/whenIReceive](/reference/Stage/whenIReceive) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -319,9 +376,11 @@ An implemented entry has its documented overloads declared in the browser. The r | [Text/getDefaultFont](/reference/Text/getDefaultFont) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/getDefaultFontSize](/reference/Text/getDefaultFontSize) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/getFont](/reference/Text/getFont) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Text/getLayer](/reference/Text/getLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/getPosition](/reference/Text/getPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/getStage](/reference/Text/getStage) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/getStyle](/reference/Text/getStyle) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Text/getText](/reference/Text/getText) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/getTextSize](/reference/Text/getTextSize) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/getWidth](/reference/Text/getWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/getX](/reference/Text/getX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -330,13 +389,14 @@ An implemented entry has its documented overloads declared in the browser. The r | [Text/goLayersForwards](/reference/Text/goLayersForwards) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/goToBackLayer](/reference/Text/goToBackLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/goToFrontLayer](/reference/Text/goToFrontLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Text/isUI](/reference/Text/isUI) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Text/hide](/reference/Text/hide) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Text/isVisible](/reference/Text/isVisible) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/nextFont](/reference/Text/nextFont) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/remove](/reference/Text/remove) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/setAlign](/reference/Text/setAlign) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/setBackgroundColor](/reference/Text/setBackgroundColor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/setFont](/reference/Text/setFont) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Text/setIsUI](/reference/Text/setIsUI) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Text/setLayer](/reference/Text/setLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/setPosition](/reference/Text/setPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/setStrokeColor](/reference/Text/setStrokeColor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/setStyle](/reference/Text/setStyle) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -345,32 +405,29 @@ An implemented entry has its documented overloads declared in the browser. The r | [Text/setWidth](/reference/Text/setWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/setX](/reference/Text/setX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/setY](/reference/Text/setY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Text/show](/reference/Text/show) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/showText](/reference/Text/showText) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/switchFont](/reference/Text/switchFont) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/useFont](/reference/Text/useFont) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Text/useFontSizes](/reference/Text/useFontSizes) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Text/useSmoothing](/reference/Text/useSmoothing) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/whenAddedToStage](/reference/Text/whenAddedToStage) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Text/whenRemovedFromStage](/reference/Text/whenRemovedFromStage) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Timer/afterMillis](/reference/Timer/afterMillis) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Timer/after](/reference/Timer/after) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Timer/constructor](/reference/Timer/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Timer/everyMillis](/reference/Timer/everyMillis) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Timer/forMillis](/reference/Timer/forMillis) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Timer/intervalMillis](/reference/Timer/intervalMillis) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Timer/millis](/reference/Timer/millis) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Timer/during](/reference/Timer/during) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Timer/every](/reference/Timer/every) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Timer/getSeconds](/reference/Timer/getSeconds) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Timer/interval](/reference/Timer/interval) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Timer/reset](/reference/Timer/reset) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Transition/constructor](/reference/Transition/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Transition/fromShader](/reference/Transition/fromShader) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Transition/getName](/reference/Transition/getName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Transition/toString](/reference/Transition/toString) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Triangle/constructor](/reference/Triangle/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [UISprite/changeHeight](/reference/UISprite/changeHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [UISprite/changeWidth](/reference/UISprite/changeWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [UISprite/constructor](/reference/UISprite/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [UISprite/disableNineSlice](/reference/UISprite/disableNineSlice) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [UISprite/setHeight](/reference/UISprite/setHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [UISprite/setNineSlice](/reference/UISprite/setNineSlice) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [UISprite/setWidth](/reference/UISprite/setWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Vector2/add](/reference/Vector2/add) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Vector2/angle](/reference/Vector2/angle) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Vector2/clone](/reference/Vector2/clone) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Vector2/constructor](/reference/Vector2/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Vector2/direction](/reference/Vector2/direction) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Vector2/distance](/reference/Vector2/distance) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Vector2/distanceSq](/reference/Vector2/distanceSq) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Vector2/dot](/reference/Vector2/dot) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -392,17 +449,18 @@ An implemented entry has its documented overloads declared in the browser. The r | [Window/constructor](/reference/Window/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/debug](/reference/Window/debug) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/exit](/reference/Window/exit) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Window/getDeltaTime](/reference/Window/getDeltaTime) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Window/getFrameSmoothing](/reference/Window/getFrameSmoothing) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/getGameSpeed](/reference/Window/getGameSpeed) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/getHeight](/reference/Window/getHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/getInstance](/reference/Window/getInstance) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/getLibraryTitle](/reference/Window/getLibraryTitle) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/getLibraryVersion](/reference/Window/getLibraryVersion) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/getStage](/reference/Window/getStage) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [Window/getTextureSampling](/reference/Window/getTextureSampling) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/getWidth](/reference/Window/getWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/isDebug](/reference/Window/isDebug) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/isPaused](/reference/Window/isPaused) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Window/isPixelArt](/reference/Window/isPixelArt) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Window/isSmoothPixelArt](/reference/Window/isSmoothPixelArt) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/isTransitioning](/reference/Window/isTransitioning) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/pause](/reference/Window/pause) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/resume](/reference/Window/resume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | @@ -411,142 +469,170 @@ An implemented entry has its documented overloads declared in the browser. The r | [Window/setStage](/reference/Window/setStage) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/step](/reference/Window/step) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/transitionToStage](/reference/Window/transitionToStage) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Window/use](/reference/Window/use) | desktop-only | Extensions load through the desktop's ServiceLoader and run against its window and render threads. The browser ships its extensions natively; it does not load external or custom extensions. | +| [Window/useFrameSmoothing](/reference/Window/useFrameSmoothing) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/useFullScreen](/reference/Window/useFullScreen) | desktop-only | The embedded browser output uses its enclosing page; this desktop window option only reports a limitation. | +| [Window/usePixelArt](/reference/Window/usePixelArt) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [Window/useSmoothPixelArt](/reference/Window/useSmoothPixelArt) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/useSplashLogo](/reference/Window/useSplashLogo) | desktop-only | The browser has no desktop splash window. This option only reports a limitation. | -| [Window/useTextureSampling](/reference/Window/useTextureSampling) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | | [Window/whenExits](/reference/Window/whenExits) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/changeX](/reference/extensions/camera/Camera/changeX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/changeY](/reference/extensions/camera/Camera/changeY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/changeZoom](/reference/extensions/camera/Camera/changeZoom) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/constructor](/reference/extensions/camera/Camera/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/getPosition](/reference/extensions/camera/Camera/getPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/getX](/reference/extensions/camera/Camera/getX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/getY](/reference/extensions/camera/Camera/getY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/getZoom](/reference/extensions/camera/Camera/getZoom) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/resetZoom](/reference/extensions/camera/Camera/resetZoom) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/setPosition](/reference/extensions/camera/Camera/setPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/setX](/reference/extensions/camera/Camera/setX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/setY](/reference/extensions/camera/Camera/setY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/setZoom](/reference/extensions/camera/Camera/setZoom) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/setZoomLimit](/reference/extensions/camera/Camera/setZoomLimit) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/toGlobalPosition](/reference/extensions/camera/Camera/toGlobalPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/toGlobalX](/reference/extensions/camera/Camera/toGlobalX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/toGlobalY](/reference/extensions/camera/Camera/toGlobalY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/toLocalPosition](/reference/extensions/camera/Camera/toLocalPosition) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/toLocalX](/reference/extensions/camera/Camera/toLocalX) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/camera/Camera/toLocalY](/reference/extensions/camera/Camera/toLocalY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/Drawing/clip](/reference/extensions/drawing/Drawing/clip) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/Drawing/constructor](/reference/extensions/drawing/Drawing/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/Drawing/image](/reference/extensions/drawing/Drawing/image) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/Drawing/imageHeight](/reference/extensions/drawing/Drawing/imageHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/Drawing/imageWidth](/reference/extensions/drawing/Drawing/imageWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/Drawing/noClip](/reference/extensions/drawing/Drawing/noClip) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/Drawing/polygon](/reference/extensions/drawing/Drawing/polygon) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/Drawing/rectangle](/reference/extensions/drawing/Drawing/rectangle) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/DrawingSprite/changeTransparency](/reference/extensions/drawing/DrawingSprite/changeTransparency) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/DrawingSprite/constructor](/reference/extensions/drawing/DrawingSprite/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/DrawingSprite/draw](/reference/extensions/drawing/DrawingSprite/draw) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/DrawingSprite/getTransparency](/reference/extensions/drawing/DrawingSprite/getTransparency) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/DrawingSprite/setIsUI](/reference/extensions/drawing/DrawingSprite/setIsUI) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/drawing/DrawingSprite/setTransparency](/reference/extensions/drawing/DrawingSprite/setTransparency) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/fs/File/constructor](/reference/extensions/fs/File/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/fs/File/load](/reference/extensions/fs/File/load) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/fs/File/loadOrCreate](/reference/extensions/fs/File/loadOrCreate) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/fs/File/loadXML](/reference/extensions/fs/File/loadXML) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/fs/File/loadXMLOrCreate](/reference/extensions/fs/File/loadXMLOrCreate) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/fs/File/save](/reference/extensions/fs/File/save) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/fs/File/saveXML](/reference/extensions/fs/File/saveXML) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/fs/SaveData/constructor](/reference/extensions/fs/SaveData/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/fs/SaveData/getLocation](/reference/extensions/fs/SaveData/getLocation) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/fs/SaveData/loadOrDefault](/reference/extensions/fs/SaveData/loadOrDefault) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/fs/SaveData/path](/reference/extensions/fs/SaveData/path) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/fs/SaveData/save](/reference/extensions/fs/SaveData/save) | awaiting-browser-support | Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract. | -| [extensions/pixels/Pixels/background](/reference/extensions/pixels/Pixels/background) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/pixels/Pixels/constructor](/reference/extensions/pixels/Pixels/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/pixels/Pixels/foreground](/reference/extensions/pixels/Pixels/foreground) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/pixels/Pixels/main](/reference/extensions/pixels/Pixels/main) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/FFmpegRecorder/constructor](/reference/extensions/recorder/FFmpegRecorder/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/FFmpegRecorder/saveFrame](/reference/extensions/recorder/FFmpegRecorder/saveFrame) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/FFmpegRecorder/stop](/reference/extensions/recorder/FFmpegRecorder/stop) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/FrameRecorder/constructor](/reference/extensions/recorder/FrameRecorder/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/FrameRecorder/saveFrame](/reference/extensions/recorder/FrameRecorder/saveFrame) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/FrameRecorder/snapshot](/reference/extensions/recorder/FrameRecorder/snapshot) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/GifRecorder/constructor](/reference/extensions/recorder/GifRecorder/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/GifRecorder/saveFrame](/reference/extensions/recorder/GifRecorder/saveFrame) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/GifRecorder/snapshot](/reference/extensions/recorder/GifRecorder/snapshot) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/GifRecorder/start](/reference/extensions/recorder/GifRecorder/start) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/GifRecorder/stop](/reference/extensions/recorder/GifRecorder/stop) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/Recorder/constructor](/reference/extensions/recorder/Recorder/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/Recorder/post](/reference/extensions/recorder/Recorder/post) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/Recorder/saveFrame](/reference/extensions/recorder/Recorder/saveFrame) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/Recorder/start](/reference/extensions/recorder/Recorder/start) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/recorder/Recorder/stop](/reference/extensions/recorder/Recorder/stop) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/shader/Shader/constructor](/reference/extensions/shader/Shader/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shader/getName](/reference/extensions/shader/Shader/getName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shader/getPShader](/reference/extensions/shader/Shader/getPShader) | desktop-only | Processing's PShader object belongs to the desktop renderer. The browser uses WebGL filters. | -| [extensions/shader/Shader/set](/reference/extensions/shader/Shader/set) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shader/setName](/reference/extensions/shader/Shader/setName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/activate](/reference/extensions/shader/Shaders/activate) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/add](/reference/extensions/shader/Shaders/add) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/constructor](/reference/extensions/shader/Shaders/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/deactivate](/reference/extensions/shader/Shaders/deactivate) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/get](/reference/extensions/shader/Shaders/get) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/getActive](/reference/extensions/shader/Shaders/getActive) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/getCurrent](/reference/extensions/shader/Shaders/getCurrent) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/getCurrentIndex](/reference/extensions/shader/Shaders/getCurrentIndex) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/getCurrentName](/reference/extensions/shader/Shaders/getCurrentName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/isActive](/reference/extensions/shader/Shaders/isActive) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/next](/reference/extensions/shader/Shaders/next) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/reset](/reference/extensions/shader/Shaders/reset) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/shader/Shaders/switchTo](/reference/extensions/shader/Shaders/switchTo) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sorting/Sorting/by](/reference/extensions/sorting/Sorting/by) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/sorting/Sorting/byY](/reference/extensions/sorting/Sorting/byY) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sorting/Sorting/constructor](/reference/extensions/sorting/Sorting/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sorting/Sorting/getComparator](/reference/extensions/sorting/Sorting/getComparator) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | -| [extensions/sorting/Sorting/isOn](/reference/extensions/sorting/Sorting/isOn) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sorting/Sorting/off](/reference/extensions/sorting/Sorting/off) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sound/SoundPlayback/close](/reference/extensions/sound/SoundPlayback/close) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sound/SoundPlayback/constructor](/reference/extensions/sound/SoundPlayback/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sound/SoundPlayback/getName](/reference/extensions/sound/SoundPlayback/getName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sound/SoundPlayback/getVolume](/reference/extensions/sound/SoundPlayback/getVolume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sound/SoundPlayback/isPlaying](/reference/extensions/sound/SoundPlayback/isPlaying) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sound/SoundPlayback/setVolume](/reference/extensions/sound/SoundPlayback/setVolume) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/sound/SoundPlayback/stop](/reference/extensions/sound/SoundPlayback/stop) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/addGlyph](/reference/extensions/text/BitmapText/addGlyph) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/constructor](/reference/extensions/text/BitmapText/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/draw](/reference/extensions/text/BitmapText/draw) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/getContent](/reference/extensions/text/BitmapText/getContent) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/getHeight](/reference/extensions/text/BitmapText/getHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/getWidth](/reference/extensions/text/BitmapText/getWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/setAlign](/reference/extensions/text/BitmapText/setAlign) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/setFont](/reference/extensions/text/BitmapText/setFont) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/setLetterSpacing](/reference/extensions/text/BitmapText/setLetterSpacing) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/setLineSpacing](/reference/extensions/text/BitmapText/setLineSpacing) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/setSpaceWidth](/reference/extensions/text/BitmapText/setSpaceWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/text/BitmapText/showText](/reference/extensions/text/BitmapText/showText) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/MapObject/constructor](/reference/extensions/tiled/MapObject/constructor) | awaiting-browser-support | Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract. | -| [extensions/tiled/MapObject/getProperty](/reference/extensions/tiled/MapObject/getProperty) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/MapObject/getPropertyBoolean](/reference/extensions/tiled/MapObject/getPropertyBoolean) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/MapObject/getPropertyFloat](/reference/extensions/tiled/MapObject/getPropertyFloat) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/MapObject/getPropertyInt](/reference/extensions/tiled/MapObject/getPropertyInt) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/MapObject/getShape](/reference/extensions/tiled/MapObject/getShape) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/MapObject/setClassName](/reference/extensions/tiled/MapObject/setClassName) | awaiting-browser-support | Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract. | -| [extensions/tiled/Property/constructor](/reference/extensions/tiled/Property/constructor) | awaiting-browser-support | Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract. | -| [extensions/tiled/Property/setText](/reference/extensions/tiled/Property/setText) | awaiting-browser-support | Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract. | -| [extensions/tiled/TiledMap/constructor](/reference/extensions/tiled/TiledMap/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getHeight](/reference/extensions/tiled/TiledMap/getHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getObjectsFromLayer](/reference/extensions/tiled/TiledMap/getObjectsFromLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getProperty](/reference/extensions/tiled/TiledMap/getProperty) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getPropertyBoolean](/reference/extensions/tiled/TiledMap/getPropertyBoolean) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getPropertyFloat](/reference/extensions/tiled/TiledMap/getPropertyFloat) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getPropertyInt](/reference/extensions/tiled/TiledMap/getPropertyInt) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getTileCollisionShapes](/reference/extensions/tiled/TiledMap/getTileCollisionShapes) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getTileHeight](/reference/extensions/tiled/TiledMap/getTileHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getTileId](/reference/extensions/tiled/TiledMap/getTileId) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getTileWidth](/reference/extensions/tiled/TiledMap/getTileWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/getWidth](/reference/extensions/tiled/TiledMap/getWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/spawn](/reference/extensions/tiled/TiledMap/spawn) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/stampLayerToBackground](/reference/extensions/tiled/TiledMap/stampLayerToBackground) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/stampLayerToForeground](/reference/extensions/tiled/TiledMap/stampLayerToForeground) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TiledMap/toString](/reference/extensions/tiled/TiledMap/toString) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | -| [extensions/tiled/TilesetImage/constructor](/reference/extensions/tiled/TilesetImage/constructor) | awaiting-browser-support | Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract. | +| [drawing/BitmapText/addGlyph](/reference/drawing/BitmapText/addGlyph) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/constructor](/reference/drawing/BitmapText/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/draw](/reference/drawing/BitmapText/draw) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/getContent](/reference/drawing/BitmapText/getContent) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/getHeight](/reference/drawing/BitmapText/getHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/getWidth](/reference/drawing/BitmapText/getWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/setAlign](/reference/drawing/BitmapText/setAlign) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/setFont](/reference/drawing/BitmapText/setFont) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/setLetterSpacing](/reference/drawing/BitmapText/setLetterSpacing) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/setLineSpacing](/reference/drawing/BitmapText/setLineSpacing) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/setSpaceWidth](/reference/drawing/BitmapText/setSpaceWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/BitmapText/showText](/reference/drawing/BitmapText/showText) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/Drawing/clip](/reference/drawing/Drawing/clip) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/Drawing/constructor](/reference/drawing/Drawing/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/Drawing/image](/reference/drawing/Drawing/image) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/Drawing/imageHeight](/reference/drawing/Drawing/imageHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/Drawing/imageWidth](/reference/drawing/Drawing/imageWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/Drawing/noClip](/reference/drawing/Drawing/noClip) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/Drawing/polygon](/reference/drawing/Drawing/polygon) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/Drawing/rectangle](/reference/drawing/Drawing/rectangle) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/DrawingExtension/constructor](/reference/drawing/DrawingExtension/constructor) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [drawing/DrawingExtension/id](/reference/drawing/DrawingExtension/id) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [drawing/DrawingExtension/install](/reference/drawing/DrawingExtension/install) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [drawing/DrawingExtension/name](/reference/drawing/DrawingExtension/name) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [drawing/DrawingExtension/requires](/reference/drawing/DrawingExtension/requires) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [drawing/DrawingExtension/version](/reference/drawing/DrawingExtension/version) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [drawing/DrawingSprite/constructor](/reference/drawing/DrawingSprite/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [drawing/DrawingSprite/draw](/reference/drawing/DrawingSprite/draw) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [extension/Canvas/clip](/reference/extension/Canvas/clip) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/constructor](/reference/extension/Canvas/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/drawImage](/reference/extension/Canvas/drawImage) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/drawImageQuad](/reference/extension/Canvas/drawImageQuad) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/drawImageRegion](/reference/extension/Canvas/drawImageRegion) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/drawOutline](/reference/extension/Canvas/drawOutline) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/drawPolygon](/reference/extension/Canvas/drawPolygon) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/drawRectangle](/reference/extension/Canvas/drawRectangle) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/drawText](/reference/extension/Canvas/drawText) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/imageHeight](/reference/extension/Canvas/imageHeight) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/imageWidth](/reference/extension/Canvas/imageWidth) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/noClip](/reference/extension/Canvas/noClip) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Canvas/setOpacity](/reference/extension/Canvas/setOpacity) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Extension/constructor](/reference/extension/Extension/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Extension/coreVersion](/reference/extension/Extension/coreVersion) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Extension/id](/reference/extension/Extension/id) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Extension/install](/reference/extension/Extension/install) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Extension/name](/reference/extension/Extension/name) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Extension/requires](/reference/extension/Extension/requires) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Extension/version](/reference/extension/Extension/version) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/addLayerDrawer](/reference/extension/ExtensionContext/addLayerDrawer) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/addOverlayDrawer](/reference/extension/ExtensionContext/addOverlayDrawer) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/afterFrame](/reference/extension/ExtensionContext/afterFrame) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/beforeTick](/reference/extension/ExtensionContext/beforeTick) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/constructor](/reference/extension/ExtensionContext/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/dispatch](/reference/extension/ExtensionContext/dispatch) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/getTickCount](/reference/extension/ExtensionContext/getTickCount) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/input](/reference/extension/ExtensionContext/input) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/isLoading](/reference/extension/ExtensionContext/isLoading) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/onExit](/reference/extension/ExtensionContext/onExit) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/onInputPoll](/reference/extension/ExtensionContext/onInputPoll) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/onKey](/reference/extension/ExtensionContext/onKey) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/onLearnerError](/reference/extension/ExtensionContext/onLearnerError) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/onMouse](/reference/extension/ExtensionContext/onMouse) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/onStageCreated](/reference/extension/ExtensionContext/onStageCreated) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/onStageDisposed](/reference/extension/ExtensionContext/onStageDisposed) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/registerImageFormat](/reference/extension/ExtensionContext/registerImageFormat) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ExtensionContext/runOnGameThread](/reference/extension/ExtensionContext/runOnGameThread) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Frame/constructor](/reference/extension/Frame/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Frame/getArgb](/reference/extension/Frame/getArgb) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Frame/getHeight](/reference/extension/Frame/getHeight) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Frame/getWidth](/reference/extension/Frame/getWidth) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/Frame/savePng](/reference/extension/Frame/savePng) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ImageDecoder/constructor](/reference/extension/ImageDecoder/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/ImageDecoder/decode](/reference/extension/ImageDecoder/decode) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/InputKey/constructor](/reference/extension/InputKey/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/InputKey/copy](/reference/extension/InputKey/copy) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/InputKey/create](/reference/extension/InputKey/create) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/InputKey/of](/reference/extension/InputKey/of) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/InputKey/toString](/reference/extension/InputKey/toString) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/InputSnapshot/constructor](/reference/extension/InputSnapshot/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/InputSnapshot/get](/reference/extension/InputSnapshot/get) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/LayerDrawer/constructor](/reference/extension/LayerDrawer/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [extension/LayerDrawer/draw](/reference/extension/LayerDrawer/draw) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [gamepad/Gamepad/constructor](/reference/gamepad/Gamepad/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [gamepad/Gamepad/getStick](/reference/gamepad/Gamepad/getStick) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [gamepad/Gamepad/getTrigger](/reference/gamepad/Gamepad/getTrigger) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [gamepad/Gamepad/isButtonPressed](/reference/gamepad/Gamepad/isButtonPressed) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [gamepad/Gamepad/isConnected](/reference/gamepad/Gamepad/isConnected) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [gamepad/GamepadListener/constructor](/reference/gamepad/GamepadListener/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [gamepad/GamepadListener/whenGamepadButtonPressed](/reference/gamepad/GamepadListener/whenGamepadButtonPressed) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [gamepad/GamepadListener/whenGamepadButtonReleased](/reference/gamepad/GamepadListener/whenGamepadButtonReleased) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [gamepad/GamepadListener/whenGamepadConnected](/reference/gamepad/GamepadListener/whenGamepadConnected) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [recorder/GifEncoder/addFrame](/reference/recorder/GifEncoder/addFrame) | desktop-only | The encoder behind the desktop's GifRecorder; recording is desktop-only. | +| [recorder/GifEncoder/constructor](/reference/recorder/GifEncoder/constructor) | desktop-only | The encoder behind the desktop's GifRecorder; recording is desktop-only. | +| [recorder/GifEncoder/finish](/reference/recorder/GifEncoder/finish) | desktop-only | The encoder behind the desktop's GifRecorder; recording is desktop-only. | +| [recorder/GifEncoder/setDelay](/reference/recorder/GifEncoder/setDelay) | desktop-only | The encoder behind the desktop's GifRecorder; recording is desktop-only. | +| [recorder/GifEncoder/setDispose](/reference/recorder/GifEncoder/setDispose) | desktop-only | The encoder behind the desktop's GifRecorder; recording is desktop-only. | +| [recorder/GifEncoder/setFrameRate](/reference/recorder/GifEncoder/setFrameRate) | desktop-only | The encoder behind the desktop's GifRecorder; recording is desktop-only. | +| [recorder/GifEncoder/setQuality](/reference/recorder/GifEncoder/setQuality) | desktop-only | The encoder behind the desktop's GifRecorder; recording is desktop-only. | +| [recorder/GifEncoder/setRepeat](/reference/recorder/GifEncoder/setRepeat) | desktop-only | The encoder behind the desktop's GifRecorder; recording is desktop-only. | +| [recorder/GifEncoder/setTransparent](/reference/recorder/GifEncoder/setTransparent) | desktop-only | The encoder behind the desktop's GifRecorder; recording is desktop-only. | +| [recorder/GifEncoder/start](/reference/recorder/GifEncoder/start) | desktop-only | The encoder behind the desktop's GifRecorder; recording is desktop-only. | +| [recorder/GifRecorder/constructor](/reference/recorder/GifRecorder/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [recorder/GifRecorder/snapshot](/reference/recorder/GifRecorder/snapshot) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [recorder/GifRecorder/start](/reference/recorder/GifRecorder/start) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [recorder/GifRecorder/stop](/reference/recorder/GifRecorder/stop) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [recorder/RecorderExtension/constructor](/reference/recorder/RecorderExtension/constructor) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [recorder/RecorderExtension/id](/reference/recorder/RecorderExtension/id) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [recorder/RecorderExtension/install](/reference/recorder/RecorderExtension/install) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [recorder/RecorderExtension/name](/reference/recorder/RecorderExtension/name) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [recorder/RecorderExtension/requires](/reference/recorder/RecorderExtension/requires) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [recorder/RecorderExtension/version](/reference/recorder/RecorderExtension/version) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [save/File/constructor](/reference/save/File/constructor) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [save/File/load](/reference/save/File/load) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [save/File/loadOrCreate](/reference/save/File/loadOrCreate) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [save/File/loadXML](/reference/save/File/loadXML) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [save/File/loadXMLOrCreate](/reference/save/File/loadXMLOrCreate) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [save/File/save](/reference/save/File/save) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [save/File/saveXML](/reference/save/File/saveXML) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [save/SaveData/constructor](/reference/save/SaveData/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [save/SaveData/getLocation](/reference/save/SaveData/getLocation) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [save/SaveData/loadOrDefault](/reference/save/SaveData/loadOrDefault) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [save/SaveData/path](/reference/save/SaveData/path) | desktop-only | This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation. | +| [save/SaveData/save](/reference/save/SaveData/save) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [save/SaveExtension/constructor](/reference/save/SaveExtension/constructor) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [save/SaveExtension/id](/reference/save/SaveExtension/id) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [save/SaveExtension/name](/reference/save/SaveExtension/name) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [save/SaveExtension/requires](/reference/save/SaveExtension/requires) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [save/SaveExtension/version](/reference/save/SaveExtension/version) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [tiled/MapObject/constructor](/reference/tiled/MapObject/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/MapObject/getProperty](/reference/tiled/MapObject/getProperty) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/MapObject/getPropertyBoolean](/reference/tiled/MapObject/getPropertyBoolean) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/MapObject/getPropertyFloat](/reference/tiled/MapObject/getPropertyFloat) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/MapObject/getPropertyInt](/reference/tiled/MapObject/getPropertyInt) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/MapObject/getShape](/reference/tiled/MapObject/getShape) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/MapObject/setClassName](/reference/tiled/MapObject/setClassName) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/Property/constructor](/reference/tiled/Property/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/Property/setText](/reference/tiled/Property/setText) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledExtension/constructor](/reference/tiled/TiledExtension/constructor) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [tiled/TiledExtension/id](/reference/tiled/TiledExtension/id) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [tiled/TiledExtension/install](/reference/tiled/TiledExtension/install) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [tiled/TiledExtension/name](/reference/tiled/TiledExtension/name) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [tiled/TiledExtension/requires](/reference/tiled/TiledExtension/requires) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [tiled/TiledExtension/version](/reference/tiled/TiledExtension/version) | desktop-only | The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively. | +| [tiled/TiledMap/constructor](/reference/tiled/TiledMap/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getHeight](/reference/tiled/TiledMap/getHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getObjectsFromLayer](/reference/tiled/TiledMap/getObjectsFromLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getProperty](/reference/tiled/TiledMap/getProperty) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getPropertyBoolean](/reference/tiled/TiledMap/getPropertyBoolean) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getPropertyFloat](/reference/tiled/TiledMap/getPropertyFloat) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getPropertyInt](/reference/tiled/TiledMap/getPropertyInt) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getTileCollisionShapes](/reference/tiled/TiledMap/getTileCollisionShapes) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getTileHeight](/reference/tiled/TiledMap/getTileHeight) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getTileId](/reference/tiled/TiledMap/getTileId) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getTileWidth](/reference/tiled/TiledMap/getTileWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/getWidth](/reference/tiled/TiledMap/getWidth) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/hideLayer](/reference/tiled/TiledMap/hideLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/showLayer](/reference/tiled/TiledMap/showLayer) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/spawn](/reference/tiled/TiledMap/spawn) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | +| [tiled/TiledMap/toString](/reference/tiled/TiledMap/toString) | desktop-only | Prints the desktop's parsed TMX tree as JSON; the browser reads maps without it. | +| [tiled/TilesetImage/constructor](/reference/tiled/TilesetImage/constructor) | implemented | Declared by the browser; behavioral limitations and compiler dialect differences still apply. | diff --git a/compatibility/browser-policy.json b/compatibility/browser-policy.json index 6ec22f61..239a130f 100644 --- a/compatibility/browser-policy.json +++ b/compatibility/browser-policy.json @@ -19,16 +19,12 @@ }, "limitations": [ "Availability describes documented member groups and browser declarations. Compilation tests do not prove rendering, timing or complete behavioral parity.", - "Fragment shaders use WebGL. Custom vertex shaders are desktop-only; the browser substitutes its default vertex shader.", - "File access, pixel-buffer, and recorder APIs are desktop-only. Tiled reads finite orthogonal TMX/TSX maps from workspace files or URLs. SaveData instead persists plain game data in IndexedDB, scoped to the hosting origin and browser profile.", + "Shaders are fragment shaders; the browser runs them with WebGL.", + "File access and recorder APIs are desktop-only; Pixels reads the stage on the graphics card. Tiled reads finite orthogonal TMX/TSX maps from workspace files or URLs. SaveData instead persists plain game data in IndexedDB, scoped to the hosting origin and browser profile.", "Reference examples are compiled with the standard flavor. Existing NRW runtime fixtures and a separate declaration inventory cover the NRW flavor.", "Java compiler dialect differences also apply, including Java package access and unsupported standard-library methods." ], "overrides": { - "Stage/getPixels": { - "status": "desktop-only", - "reason": "The desktop pixel buffer is not exposed by the browser renderer." - }, "Window/useFullScreen": { "status": "desktop-only", "reason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation." @@ -37,9 +33,153 @@ "status": "desktop-only", "reason": "The browser has no desktop splash window. This option only reports a limitation." }, - "extensions/shader/Shader/getPShader": { + "Window/use": { + "status": "desktop-only", + "reason": "Extensions load through the desktop's ServiceLoader and run against its window and render threads. The browser ships its extensions natively; it does not load external or custom extensions." + }, + "Sprite/extension": { + "status": "desktop-only", + "reason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others." + }, + "Stage/extension": { + "status": "desktop-only", + "reason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others." + }, + "drawing/DrawingExtension/constructor": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "drawing/DrawingExtension/id": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "drawing/DrawingExtension/install": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "drawing/DrawingExtension/name": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "drawing/DrawingExtension/requires": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "drawing/DrawingExtension/version": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "recorder/GifEncoder/addFrame": { + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only." + }, + "recorder/GifEncoder/constructor": { + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only." + }, + "recorder/GifEncoder/finish": { + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only." + }, + "recorder/GifEncoder/setDelay": { + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only." + }, + "recorder/GifEncoder/setDispose": { + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only." + }, + "recorder/GifEncoder/setFrameRate": { + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only." + }, + "recorder/GifEncoder/setQuality": { + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only." + }, + "recorder/GifEncoder/setRepeat": { + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only." + }, + "recorder/GifEncoder/setTransparent": { + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only." + }, + "recorder/GifEncoder/start": { + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only." + }, + "recorder/RecorderExtension/constructor": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "recorder/RecorderExtension/id": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "recorder/RecorderExtension/install": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "recorder/RecorderExtension/name": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "recorder/RecorderExtension/requires": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "recorder/RecorderExtension/version": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "save/SaveExtension/constructor": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "save/SaveExtension/id": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "save/SaveExtension/name": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "save/SaveExtension/requires": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "save/SaveExtension/version": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "tiled/TiledExtension/constructor": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "tiled/TiledExtension/id": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "tiled/TiledExtension/install": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "tiled/TiledExtension/name": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "tiled/TiledExtension/requires": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "tiled/TiledExtension/version": { + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively." + }, + "tiled/TiledMap/toString": { "status": "desktop-only", - "reason": "Processing's PShader object belongs to the desktop renderer. The browser uses WebGL filters." + "reason": "Prints the desktop's parsed TMX tree as JSON; the browser reads maps without it." } } } diff --git a/compatibility/checks/PortableBehaviorChecks.java b/compatibility/checks/PortableBehaviorChecks.java index 8b4ad7fb..d6641b7a 100644 --- a/compatibility/checks/PortableBehaviorChecks.java +++ b/compatibility/checks/PortableBehaviorChecks.java @@ -14,11 +14,11 @@ public static void run() { require(player.score == 8, "score after collecting"); coin.setX(1000); require(!player.getHitbox().intersects(coin.getHitbox()), "separated sprites"); - CheckWalker copy = (CheckWalker) player.clone(); + CheckWalker copy = player.createClone(); require(copy.score == 8 && copy.isClone(), "clone fields"); copy.score = 9; require(player.score == 8, "independent score"); - require(player.getTimer("check") != copy.getTimer("check"), "independent timers"); + require(player.getTimer() != copy.getTimer(), "independent timers"); Random.randomSeed(2026); int first = Random.randomInt(100); int second = Random.randomInt(100); diff --git a/compatibility/contract.json b/compatibility/contract.json index 5fbb4e57..1894e03a 100644 --- a/compatibility/contract.json +++ b/compatibility/contract.json @@ -22,169 +22,114 @@ "scope": "Public constructors and method groups documented by the Javadoc doclet. Overload matching uses simple erased parameter names, constructor kind and static/instance kind; qualified parameter and return types are recorded. This is a source compatibility inventory, not a binary compatibility guarantee.", "limitations": [ "Availability describes documented member groups and browser declarations. Compilation tests do not prove rendering, timing or complete behavioral parity.", - "Fragment shaders use WebGL. Custom vertex shaders are desktop-only; the browser substitutes its default vertex shader.", - "File access, pixel-buffer, and recorder APIs are desktop-only. Tiled reads finite orthogonal TMX/TSX maps from workspace files or URLs. SaveData instead persists plain game data in IndexedDB, scoped to the hosting origin and browser profile.", + "Shaders are fragment shaders; the browser runs them with WebGL.", + "File access and recorder APIs are desktop-only; Pixels reads the stage on the graphics card. Tiled reads finite orthogonal TMX/TSX maps from workspace files or URLs. SaveData instead persists plain game data in IndexedDB, scoped to the hosting origin and browser profile.", "Reference examples are compiled with the standard flavor. Existing NRW runtime fixtures and a separate declaration inventory cover the NRW flavor.", "Java compiler dialect differences also apply, including Java package access and unsupported standard-library methods." ], "referenceValidation": { "flavor": "standard", - "examples": 437, + "examples": 355, "knownUnsupportedExamples": 0 }, "members": [ { - "id": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/changeX", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "addAnimation", - "constructor": false, - "static": false, - "parameters": [ - "java.lang.String", - "java.lang.String", - "int" - ], - "returns": "void", - "parameterNames": [ - "name", - "pattern", - "frames" - ], - "parameterDescriptions": [ - "the name of the animation", - "the pattern (@see String#format) of the file names. The frame\n starts from 1.", - "the number of frames in the animation" - ], - "description": "Adds an animation to the sprite.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "addAnimation", + "name": "changeX", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.util.function.Function", - "int" + "double" ], "returns": "void", "parameterNames": [ - "name", - "builder", - "frame" + "dx" ], "parameterDescriptions": [ - "the name of the animation", - "a function that builds the file names for the animation frames", - "the number of frames in the animation. The frame starts from\n 1." + "how far to move the camera along x" ], - "description": "Adds an animation to the sprite.\n\nTo add an animation with file names \"walk_1.png\", \"walk_2.png\",\n\"walk_3.png\", you can use the following code:\n\n```java\nsprite.addAnimation(\"walk\", i -> \"walk_\" + i + \".png\", 3);\n```", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/changeY", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ { - "name": "addAnimation", + "name": "changeY", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int" + "double" ], "returns": "void", "parameterNames": [ - "name", - "path", - "frames", - "width", - "height" + "dy" ], "parameterDescriptions": [ - "the name of the animation", - "the path to the animation frames", - "the number of frames in the animation", - "the width of each frame", - "the height of each frame" + "how far to move the camera along y" ], - "description": "Adds an animation to the sprite.\n\nFor an animation sprite sheet, where each frame is of equal width and height,\nyou can use this method to add an animation by specifying the path to the\nsprite sheet, the number of frames, and the dimensions of each frame.\nFor example, for a four-frame animation arranged in a single row, each frame\nbeing 64x64 pixels, you can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64);\n```", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/changeZoom", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ { - "name": "addAnimation", + "name": "changeZoom", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int", - "int" + "double" ], "returns": "void", "parameterNames": [ - "name", - "path", - "frames", - "width", - "height", - "row" + "dz" ], "parameterDescriptions": [ - "the name of the animation", - "the path to the animation frames", - "the number of frames in the animation", - "the width of each frame", - "the height of each frame", - "the row of the animation frames" + "percentage points to add to the zoom" ], - "description": "Adds an animation to the sprite.\n\nIf the animation frames are arranged in rows in a sprite sheet, you can use\nthis method to specify which row to use for the animation.\n\nFor example, for a four-frame animation arranged in a single row, you want the second, each frame\nbeing 64x64 pixels, you can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64, 2);\n```", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/constructor", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ { - "name": "addAnimation", - "constructor": false, + "name": "Camera", + "constructor": true, "static": false, - "parameters": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int", - "int", - "boolean" - ], - "returns": "void", - "parameterNames": [ - "name", - "path", - "frames", - "width", - "height", - "column", - "useColumns" - ], - "parameterDescriptions": [ - "the name of the animation", - "the path to the animation frames", - "the number of frames in the animation", - "the width of each frame", - "the height of each frame", - "the column of the animation frames", - "whether to use columns or rows" - ], - "description": "Adds an animation to the sprite.\n\nIf the animation frames are arranged in either rows or columns in a sprite\nsheet, you can use this method to specify which column or row to use for the\nanimation. Take four frame animation arranged in a single column. Each frame is\n64x64 pixels. You can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64, 1, true); // use column 1\n```", + "parameters": [], + "returns": "org.openpatch.scratch.Camera", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A camera at (0, 0) with zoom 100. Every stage has its own: `getStage().getCamera()`.", "returnDescription": "", "scratchblock": "", "since": "" @@ -195,19 +140,19 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/clone", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/getPosition", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "clone", + "name": "getPosition", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.AnimatedSprite", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates a clone of this sprite with the same animations, playing the same\none, and puts it on the stage right behind this sprite. See\n[Sprite.clone()](../Sprite/clone).", - "returnDescription": "the clone, of the same class as this sprite", + "description": "", + "returnDescription": "the world position at the stage's centre", "scratchblock": "", "since": "" } @@ -217,38 +162,19 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/constructor", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/getX", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "AnimatedSprite", - "constructor": true, + "name": "getX", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.AnimatedSprite", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], "description": "", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "AnimatedSprite", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.AnimatedSprite" - ], - "returns": "org.openpatch.scratch.AnimatedSprite", - "parameterNames": [ - "animatedSprite" - ], - "parameterDescriptions": [ - "" - ], - "description": "", - "returnDescription": "", + "returnDescription": "the world x at the stage's centre", "scratchblock": "", "since": "" } @@ -258,19 +184,19 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/getAnimationFrame", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/getY", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "getAnimationFrame", + "name": "getY", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Gets the current animation frame.", - "returnDescription": "the current animation frame", + "description": "", + "returnDescription": "the world y at the stage's centre", "scratchblock": "", "since": "" } @@ -280,19 +206,19 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/getAnimationInterval", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/getZoom", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "getAnimationInterval", + "name": "getZoom", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Gets the interval between animation frames.", - "returnDescription": "the interval between animation frames", + "description": "", + "returnDescription": "the zoom in percent", "scratchblock": "", "since": "" } @@ -302,19 +228,19 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/isAnimationPlayed", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/resetZoom", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "isAnimationPlayed", + "name": "resetZoom", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks if the animation is played.", - "returnDescription": "true if the animation is played, false otherwise", + "description": "Back to zoom 100.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -324,46 +250,46 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/playAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/setPosition", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "playAnimation", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "double", + "double" ], "returns": "void", "parameterNames": [ - "name" + "x", + "y" ], "parameterDescriptions": [ - "the name of the animation to play" + "world x", + "world y" ], - "description": "Plays the animation with the specified name.", + "description": "Centres the camera on a world position.", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "playAnimation", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "boolean" + "org.openpatch.scratch.Vector2" ], "returns": "void", "parameterNames": [ - "name", - "once" + "position" ], "parameterDescriptions": [ - "the name of the animation to play", - "whether to play the animation once" + "world position" ], - "description": "Plays the animation with the specified name.", + "description": "Centres the camera on a world position.", "returnDescription": "", "scratchblock": "", "since": "" @@ -374,18 +300,24 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/resetAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/setX", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "resetAnimation", + "name": "setX", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Resets the animation. The animation will start from the first frame.", + "parameterNames": [ + "x" + ], + "parameterDescriptions": [ + "the world x to show at the stage's centre" + ], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -396,24 +328,24 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/setAnimationFrame", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/setY", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "setAnimationFrame", + "name": "setY", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], "returns": "void", "parameterNames": [ - "frame" + "y" ], "parameterDescriptions": [ - "the current animation frame" + "the world y to show at the stage's centre" ], - "description": "Sets the current animation frame.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -424,24 +356,24 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/setAnimationInterval", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/setZoom", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "setAnimationInterval", + "name": "setZoom", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], "returns": "void", "parameterNames": [ - "interval" + "zoom" ], "parameterDescriptions": [ - "the interval between animation frames" + "the zoom in percent" ], - "description": "Sets the interval between animation frames.", + "description": "Sets the zoom in percent: 200 shows everything twice as large, 50 half as large. It stays\nwithin the zoom limits (50 to 200 unless changed).", "returnDescription": "", "scratchblock": "", "since": "" @@ -452,19 +384,28 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/toString", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/setZoomLimit", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "toString", + "name": "setZoomLimit", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns which animation is playing and how far into it.", - "returnDescription": "the sprite as a text", + "parameters": [ + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "min", + "max" + ], + "parameterDescriptions": [ + "the smallest zoom in percent", + "the largest zoom in percent" + ], + "description": "Limits the zoom.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -474,31 +415,25 @@ "missingBrowserSignatures": [] }, { - "id": "Circle/constructor", - "owner": "org.openpatch.scratch.Circle", + "id": "Camera/toScreenPosition", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "Circle", - "constructor": true, + "name": "toScreenPosition", + "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "org.openpatch.scratch.Vector2" ], - "returns": "org.openpatch.scratch.Circle", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "x", - "y", - "radius" + "world" ], "parameterDescriptions": [ - "the x-coordinate of the circle's center", - "the y-coordinate of the circle's center", - "the radius of the circle" + "a world position" ], - "description": "Creates a circle with no specified position or size.", - "returnDescription": "", + "description": "Where a world position shows on the stage.", + "returnDescription": "the screen position (origin at the stage's centre)", "scratchblock": "", "since": "" } @@ -508,28 +443,26 @@ "missingBrowserSignatures": [] }, { - "id": "Clock/constructor", - "owner": "org.openpatch.scratch.Clock", - "signatures": [], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Clock/getDay", - "owner": "org.openpatch.scratch.Clock", + "id": "Camera/toScreenX", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "getDay", + "name": "toScreenX", "constructor": false, - "static": true, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current day of the month, from 1 to 31.", - "returnDescription": "the day of the month", - "scratchblock": "(current [date v])", + "static": false, + "parameters": [ + "double" + ], + "returns": "double", + "parameterNames": [ + "worldX" + ], + "parameterDescriptions": [ + "a world x" + ], + "description": "", + "returnDescription": "where it shows on the stage", + "scratchblock": "", "since": "" } ], @@ -538,7 +471,183 @@ "missingBrowserSignatures": [] }, { - "id": "Clock/getDayOfWeek", + "id": "Camera/toScreenY", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ + { + "name": "toScreenY", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "double", + "parameterNames": [ + "worldY" + ], + "parameterDescriptions": [ + "a world y" + ], + "description": "", + "returnDescription": "where it shows on the stage", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/toWorldPosition", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ + { + "name": "toWorldPosition", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [ + "screen" + ], + "parameterDescriptions": [ + "a screen position (origin at the stage's centre)" + ], + "description": "Which world position shows at a place on the stage.", + "returnDescription": "the world position", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/toWorldX", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ + { + "name": "toWorldX", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "double", + "parameterNames": [ + "screenX" + ], + "parameterDescriptions": [ + "an x on the stage" + ], + "description": "", + "returnDescription": "the world x shown there", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/toWorldY", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ + { + "name": "toWorldY", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "double", + "parameterNames": [ + "screenY" + ], + "parameterDescriptions": [ + "a y on the stage" + ], + "description": "", + "returnDescription": "the world y shown there", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Circle/constructor", + "owner": "org.openpatch.scratch.Circle", + "signatures": [ + { + "name": "Circle", + "constructor": true, + "static": false, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Circle", + "parameterNames": [ + "x", + "y", + "radius" + ], + "parameterDescriptions": [ + "x of the centre", + "y of the centre", + "the radius" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Clock/constructor", + "owner": "org.openpatch.scratch.Clock", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Clock/getDay", + "owner": "org.openpatch.scratch.Clock", + "signatures": [ + { + "name": "getDay", + "constructor": false, + "static": true, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the current day of the month, from 1 to 31.", + "returnDescription": "the day of the month", + "scratchblock": "(current [date v])", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Clock/getDayOfWeek", "owner": "org.openpatch.scratch.Clock", "signatures": [ { @@ -714,46 +823,30 @@ "missingBrowserSignatures": [] }, { - "id": "Color/changeColor", + "id": "Color/constructor", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "changeColor", - "constructor": false, + "name": "Color", + "constructor": true, "static": false, "parameters": [ + "double", + "double", "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "h" + "red", + "green", + "blue" ], "parameterDescriptions": [ - "A hue value. Could be any positive or negative number." + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" ], - "description": "Changes the color accordining to a hue value, which is added to the current hue value. When the\nresulting value is greater than 255 it will be reset. For example: 285 => 30.", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Color/constructor", - "owner": "org.openpatch.scratch.Color", - "signatures": [ - { - "name": "Color", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Constructs a new Color object with default values.", + "description": "A colour from red, green and blue, each from 0 to 255 (values outside are clamped). The\ncolour is opaque.", "returnDescription": "", "scratchblock": "", "since": "" @@ -763,16 +856,25 @@ "constructor": true, "static": false, "parameters": [ - "java.lang.String" + "double", + "double", + "double", + "double" ], "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "hexCode" + "red", + "green", + "blue", + "alpha" ], "parameterDescriptions": [ - "" + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255", + "opacity from 0 to 255" ], - "description": "", + "description": "A colour from red, green, blue and alpha, each from 0 to 255 (values outside are clamped).\nAn alpha of 0 is invisible, 255 opaque.", "returnDescription": "", "scratchblock": "", "since": "" @@ -782,61 +884,73 @@ "constructor": true, "static": false, "parameters": [ - "double" + "java.lang.String" ], "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "h" + "hex" ], "parameterDescriptions": [ - "the hue value" + "the hex code" ], - "description": "Constructs a new Color object with the specified hue value.", + "description": "A colour from a hex code as in HTML and CSS: `\"#ff8000\"`, `\"ff8000\"`,\n`\"#f80\"`, or with alpha `\"#ff800080\"`.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Color/equals", + "owner": "org.openpatch.scratch.Color", + "signatures": [ { - "name": "Color", - "constructor": true, + "name": "equals", + "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "java.lang.Object" ], - "returns": "org.openpatch.scratch.Color", + "returns": "boolean", "parameterNames": [ - "r", - "g", - "b" + "other" ], "parameterDescriptions": [ - "the red value", - "the green value", - "the blue value" + "" ], - "description": "Constructs a new Color object with the specified rgb values.", + "description": "Two colours are equal when they pack into the same ARGB number.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Color/fromARGB", + "owner": "org.openpatch.scratch.Color", + "signatures": [ { - "name": "Color", - "constructor": true, - "static": false, + "name": "fromARGB", + "constructor": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Color" + "int" ], "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "c" + "argb" ], "parameterDescriptions": [ - "ScratchColor object to copy" + "alpha, red, green and blue in one int" ], - "description": "Copies the received ScratchColor object.", - "returnDescription": "", + "description": "A colour from a packed ARGB number, as [toARGB()](toARGB) gives it.", + "returnDescription": "the colour", "scratchblock": "", "since": "" } @@ -846,25 +960,31 @@ "missingBrowserSignatures": [] }, { - "id": "Color/equals", + "id": "Color/fromHSB", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "equals", + "name": "fromHSB", "constructor": false, - "static": false, + "static": true, "parameters": [ - "java.lang.Object" + "double", + "double", + "double" ], - "returns": "boolean", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "other" + "hue", + "saturation", + "brightness" ], "parameterDescriptions": [ - "the object to compare with" + "the colour from 0 to 100", + "from 0 (grey) to 100 (full colour)", + "from 0 (black) to 100 (full brightness)" ], - "description": "Two colours are the same when they are the same colour.", - "returnDescription": "whether both are colours with the same red, green and blue", + "description": "A colour from Scratch's colour, saturation and brightness, each from 0 to 100. The colour\ngoes around (110 is the same as 10); saturation and brightness are clamped.", + "returnDescription": "the colour", "scratchblock": "", "since": "" } @@ -874,19 +994,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/get", + "id": "Color/getAlpha", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "get", + "name": "getAlpha", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the color value as a hex code. This is useful for comparing pixels.", - "returnDescription": "hex code", + "description": "", + "returnDescription": "alpha (opacity) from 0 (invisible) to 255 (opaque)", "scratchblock": "", "since": "" } @@ -907,8 +1027,8 @@ "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the blue value.", - "returnDescription": "blue value [0...255]", + "description": "", + "returnDescription": "blue from 0 to 255", "scratchblock": "", "since": "" } @@ -918,19 +1038,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getGreen", + "id": "Color/getBrightness", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getGreen", + "name": "getBrightness", "constructor": false, "static": false, "parameters": [], "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the green value.", - "returnDescription": "green value [0...255]", + "description": "", + "returnDescription": "brightness from 0 (black) to 100", "scratchblock": "", "since": "" } @@ -940,19 +1060,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getH", + "id": "Color/getGreen", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getH", + "name": "getGreen", "constructor": false, "static": false, "parameters": [], "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the hue value.", - "returnDescription": "hue value [0...255]", + "description": "", + "returnDescription": "green from 0 to 255", "scratchblock": "", "since": "" } @@ -962,19 +1082,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getHSB", + "id": "Color/getHue", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getHSB", + "name": "getHue", "constructor": false, "static": false, "parameters": [], "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the color value on the HSB spectrum.", - "returnDescription": "hue value [0...255]", + "description": "", + "returnDescription": "Scratch's colour (hue) from 0 to 100; 0 for greys", "scratchblock": "", "since": "" } @@ -984,19 +1104,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getL", + "id": "Color/getRed", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getL", + "name": "getRed", "constructor": false, "static": false, "parameters": [], "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the luminosity value.", - "returnDescription": "luminosity value [0...255]", + "description": "", + "returnDescription": "red from 0 to 255", "scratchblock": "", "since": "" } @@ -1006,19 +1126,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getRed", + "id": "Color/getSaturation", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getRed", + "name": "getSaturation", "constructor": false, "static": false, "parameters": [], "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the red value.", - "returnDescription": "red value [0...255]", + "description": "", + "returnDescription": "saturation from 0 (grey) to 100", "scratchblock": "", "since": "" } @@ -1028,19 +1148,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getS", + "id": "Color/hashCode", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getS", + "name": "hashCode", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the saturation value.", - "returnDescription": "saturation value [0...255]", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -1050,19 +1170,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/hashCode", + "id": "Color/toARGB", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "hashCode", + "name": "toARGB", "constructor": false, "static": false, "parameters": [], "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "", - "returnDescription": "a hash consistent with [equals(Object)](equals)", + "description": "The colour packed into one int as alpha, red, green and blue (8 bits each, rounded), the way\npixels are stored.", + "returnDescription": "the packed colour", "scratchblock": "", "since": "" } @@ -1072,50 +1192,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/setHSB", + "id": "Color/toString", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "setHSB", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "h" - ], - "parameterDescriptions": [ - "A hue value [0...255]" - ], - "description": "Setting the color value after the HSB spectrum. Saturation and Luminosity are fixed at 255.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "setHSB", + "name": "toString", "constructor": false, "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void", - "parameterNames": [ - "h", - "s", - "l" - ], - "parameterDescriptions": [ - "A hue value [0...255]", - "A saturation value [0...255]", - "A luminosity value [0...255]" - ], - "description": "Setting the color value after the HSB spectrum.", - "returnDescription": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "`#rrggbb`, or `#rrggbbaa` when not opaque", "scratchblock": "", "since": "" } @@ -1125,31 +1214,25 @@ "missingBrowserSignatures": [] }, { - "id": "Color/setRGB", + "id": "Color/withAlpha", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "setRGB", + "name": "withAlpha", "constructor": false, "static": false, "parameters": [ - "double", - "double", "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "r", - "g", - "b" + "alpha" ], "parameterDescriptions": [ - "A red value [0...255]", - "A green value [0...255]", - "A blue value [0...255]" + "opacity from 0 to 255" ], - "description": "Setting the color value after the RGB spectrum", - "returnDescription": "", + "description": "", + "returnDescription": "this colour with another alpha", "scratchblock": "", "since": "" } @@ -1159,56 +1242,25 @@ "missingBrowserSignatures": [] }, { - "id": "Color/toString", + "id": "Color/withBlue", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "toString", + "name": "withBlue", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "The colour written out, so that printing one says something.\n\nWithout this a `System.out.println(mySprite.getTint())` printed\n`org.openpatch.scratch.Color@35432107`, which tells you nothing about\nthe colour and is the first thing anyone tries when a tint looks wrong.", - "returnDescription": "the colour as `Color[r=255.0, g=128.0, b=0.0]`", - "scratchblock": "", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Ellipse/constructor", - "owner": "org.openpatch.scratch.Ellipse", - "signatures": [ - { - "name": "Ellipse", - "constructor": true, - "static": false, "parameters": [ - "double", - "double", - "double", "double" ], - "returns": "org.openpatch.scratch.Ellipse", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "x", - "y", - "width", - "height" + "blue" ], "parameterDescriptions": [ - "", - "", - "", - "" + "blue from 0 to 255" ], - "description": "Creates an ellipse with no specified position or size.", - "returnDescription": "", + "description": "", + "returnDescription": "this colour with another blue", "scratchblock": "", "since": "" } @@ -1218,47 +1270,25 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/constructor", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Color/withBrightness", + "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "Hitbox", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "org.openpatch.scratch.Hitbox", - "parameterNames": [ - "shape" - ], - "parameterDescriptions": [ - "The shape of the hitbox." - ], - "description": "Constructs a hitbox with the specified shape.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "Hitbox", - "constructor": true, + "name": "withBrightness", + "constructor": false, "static": false, "parameters": [ - "double[]", - "double[]" + "double" ], - "returns": "org.openpatch.scratch.Hitbox", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "xPoints", - "yPoints" + "brightness" ], "parameterDescriptions": [ - "The x-coordinates of the points.", - "The y-coordinates of the points." + "from 0 to 100" ], - "description": "Constructs a hitbox with the specified x and y points.", - "returnDescription": "", + "description": "", + "returnDescription": "this colour with another brightness", "scratchblock": "", "since": "" } @@ -1268,28 +1298,25 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/contains", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Color/withGreen", + "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "contains", + "name": "withGreen", "constructor": false, "static": false, "parameters": [ - "double", "double" ], - "returns": "boolean", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "x", - "y" + "green" ], "parameterDescriptions": [ - "The x-coordinate of the point.", - "The y-coordinate of the point." + "green from 0 to 255" ], - "description": "Checks if the hitbox contains a point.", - "returnDescription": "`true` if the hitbox contains the point, `false`\n otherwise.", + "description": "", + "returnDescription": "this colour with another green", "scratchblock": "", "since": "" } @@ -1299,19 +1326,25 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/getBounds", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Color/withHue", + "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getBounds", + "name": "withHue", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the smallest upright rectangle the hitbox fits into.", - "returnDescription": "the bounding box of the hitbox", + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color", + "parameterNames": [ + "hue" + ], + "parameterDescriptions": [ + "the colour from 0 to 100" + ], + "description": "Another colour (hue), keeping saturation, brightness and alpha. The colour goes around, so\n`withHue(getHue() + 10)` works like Scratch's \"change color by 10\".", + "returnDescription": "this colour with another hue", "scratchblock": "", "since": "" } @@ -1321,19 +1354,25 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/getShape", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Color/withRed", + "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getShape", + "name": "withRed", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Shape", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the shape of the hitbox.", - "returnDescription": "The shape of the hitbox.", + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color", + "parameterNames": [ + "red" + ], + "parameterDescriptions": [ + "red from 0 to 255" + ], + "description": "", + "returnDescription": "this colour with another red", "scratchblock": "", "since": "" } @@ -1343,25 +1382,25 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/intersects", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Color/withSaturation", + "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "intersects", + "name": "withSaturation", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Hitbox" + "double" ], - "returns": "boolean", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "hitbox" + "saturation" ], "parameterDescriptions": [ - "The hitbox to check for intersection." + "from 0 to 100" ], - "description": "Checks if the hitbox intersects with another hitbox.", - "returnDescription": "`true` if the hitboxes intersect, `false` otherwise.", + "description": "", + "returnDescription": "this colour with another saturation", "scratchblock": "", "since": "" } @@ -1371,39 +1410,33 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/translateAndRotateAndResize", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Ellipse/constructor", + "owner": "org.openpatch.scratch.Ellipse", "signatures": [ { - "name": "translateAndRotateAndResize", - "constructor": false, + "name": "Ellipse", + "constructor": true, "static": false, "parameters": [ - "double", - "double", "double", "double", "double", "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Ellipse", "parameterNames": [ - "degrees", - "originX", - "originY", - "translateX", - "translateY", - "size" + "x", + "y", + "width", + "height" ], "parameterDescriptions": [ - "The angle in degrees to rotate the shape.", - "The x-coordinate of the rotation origin.", - "The y-coordinate of the rotation origin.", - "The x-coordinate to translate the shape.", - "The y-coordinate to translate the shape.", - "The size to scale the shape, where 100.0 represents the\n original size." + "the smallest x of the rectangle around it", + "the smallest y of the rectangle around it", + "the width", + "the height" ], - "description": "Transforms the shape by scaling, translating, and rotating it.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -1416,21 +1449,7 @@ { "id": "HtmlColor/constructor", "owner": "org.openpatch.scratch.HtmlColor", - "signatures": [ - { - "name": "HtmlColor", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.HtmlColor", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ], + "signatures": [], "status": "implemented", "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] @@ -2036,7 +2055,7 @@ ], "description": "\"mod\" is an abbreviation for \"modulo\". Modulo returns what is left over when\nthe first input is divided by the second, with the sign of the second input,\nas the Scratch block does.", "returnDescription": "what is left of the first value after dividing by the second", - "scratchblock": "", + "scratchblock": "((x) mod (y))", "since": "" } ], @@ -2086,7 +2105,7 @@ ], "description": "Rounds a number to a specified number of decimal places.", "returnDescription": "the rounded value", - "scratchblock": "", + "scratchblock": "(round (x))", "since": "" } ], @@ -2219,12 +2238,12 @@ ], "returns": "void", "parameterNames": [ - "c" + "by" ], "parameterDescriptions": [ - "a hue value [0...255]" + "how much to change the colour (hue, 0 to 100, going around)" ], - "description": "Change color via a hue value, which is added to the current hue value", + "description": "", "returnDescription": "", "scratchblock": "change pen [color v] by (c)", "since": "" @@ -2247,12 +2266,12 @@ ], "returns": "void", "parameterNames": [ - "size" + "by" ], "parameterDescriptions": [ - "size to change" + "how much to change the line width" ], - "description": "Change the size of the pen", + "description": "", "returnDescription": "", "scratchblock": "change pen size by (size)", "since": "" @@ -2275,12 +2294,12 @@ ], "returns": "void", "parameterNames": [ - "step" + "by" ], "parameterDescriptions": [ - "the step to change the transparency by" + "how much to change the transparency" ], - "description": "Change the transparency by a step", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -2302,45 +2321,7 @@ "returns": "org.openpatch.scratch.Pen", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructs a new Pen object.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "Pen", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "org.openpatch.scratch.Pen", - "parameterNames": [ - "s" - ], - "parameterDescriptions": [ - "the Sprite object to associate with this Pen" - ], - "description": "Constructs a new Pen object associated with the given Sprite.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "Pen", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Pen" - ], - "returns": "org.openpatch.scratch.Pen", - "parameterNames": [ - "p" - ], - "parameterDescriptions": [ - "Pen object to copy" - ], - "description": "Copies a Pen object.", + "description": "A pen of your own, at (0, 0); add it to a stage with `stage.add(pen)`.", "returnDescription": "", "scratchblock": "", "since": "" @@ -2362,7 +2343,7 @@ "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Set the pen down.", + "description": "Puts the pen down: it leaves a dot, and a line wherever it moves.", "returnDescription": "", "scratchblock": "pen down", "since": "" @@ -2384,7 +2365,7 @@ "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Erases all.", + "description": "Erases everything drawn on the pen's layer, by any pen or stamp.", "returnDescription": "", "scratchblock": "erase all", "since": "" @@ -2406,8 +2387,8 @@ "returns": "org.openpatch.scratch.Color", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the current color of the pen.", - "returnDescription": "the color of the pen", + "description": "", + "returnDescription": "the colour lines are drawn in", "scratchblock": "", "since": "" } @@ -2417,19 +2398,19 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/getSize", + "id": "Pen/getLayer", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "getSize", + "name": "getLayer", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "org.openpatch.scratch.Layer", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the size of the pen", - "returnDescription": "the size of the pen", + "description": "", + "returnDescription": "the layer whose canvas the pen draws on", "scratchblock": "", "since": "" } @@ -2439,19 +2420,19 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/goToBackground", + "id": "Pen/getPosition", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "goToBackground", + "name": "getPosition", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [], "parameterDescriptions": [], - "description": "Sets the pen to the background. This method changes the state of the pen to\nindicate that it is\nno longer in the foreground.", - "returnDescription": "", + "description": "", + "returnDescription": "the pen's world position", "scratchblock": "", "since": "" } @@ -2461,19 +2442,19 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/goToForeground", + "id": "Pen/getSize", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "goToForeground", + "name": "getSize", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Moves the pen to the foreground. This method sets the pen's state to indicate\nthat it is in the\nforeground.", - "returnDescription": "", + "description": "", + "returnDescription": "the line width in stage pixels", "scratchblock": "", "since": "" } @@ -2483,19 +2464,19 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/goToMousePointer", + "id": "Pen/getTransparency", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "goToMousePointer", + "name": "getTransparency", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Moves the object to the current position of the mouse pointer.", - "returnDescription": "", + "description": "", + "returnDescription": "the transparency in percent (0 opaque, 100 invisible)", "scratchblock": "", "since": "" } @@ -2505,18 +2486,18 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/goToRandomPosition", + "id": "Pen/goToMousePointer", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "goToRandomPosition", + "name": "goToMousePointer", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Moves the object to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", + "description": "Moves the pen to the mouse pointer, drawing if it is down.", "returnDescription": "", "scratchblock": "", "since": "" @@ -2527,19 +2508,41 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/isInBackground", + "id": "Pen/goToRandomPosition", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "isInBackground", + "name": "goToRandomPosition", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Moves the pen to a random position on the stage, drawing if it is down.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pen/isDown", + "owner": "org.openpatch.scratch.Pen", + "signatures": [ + { + "name": "isDown", "constructor": false, "static": false, "parameters": [], "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns true if the pen is in the background.", - "returnDescription": "true if the pen is in the background", + "description": "", + "returnDescription": "whether the pen is down and draws when it moves", "scratchblock": "", "since": "" } @@ -2561,12 +2564,12 @@ ], "returns": "void", "parameterNames": [ - "c" + "color" ], "parameterDescriptions": [ - "color of the pen" + "the colour to draw lines in" ], - "description": "Set the color of the pen", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -2580,14 +2583,14 @@ ], "returns": "void", "parameterNames": [ - "h" + "hue" ], "parameterDescriptions": [ - "a hue value [0...255]" + "the colour from 0 to 100" ], - "description": "Set color via hue value", + "description": "Sets the colour by Scratch's colour number (hue) from 0 to 100, at full saturation and\nbrightness, like Scratch's \"set pen color to\".", "returnDescription": "", - "scratchblock": "set pen [color v] to (h)", + "scratchblock": "", "since": "" }, { @@ -2601,16 +2604,44 @@ ], "returns": "void", "parameterNames": [ - "r", - "g", - "b" + "red", + "green", + "blue" + ], + "parameterDescriptions": [ + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pen/setLayer", + "owner": "org.openpatch.scratch.Pen", + "signatures": [ + { + "name": "setLayer", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Layer" + ], + "returns": "void", + "parameterNames": [ + "layer" ], "parameterDescriptions": [ - "a red value [0...255]", - "a green value [0...255]", - "a blue value [0...255]" + "the layer whose canvas the pen draws on" ], - "description": "Set color via rgb values", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -2638,10 +2669,10 @@ "y" ], "parameterDescriptions": [ - "x coordinate", - "y coordinate" + "world x", + "world y" ], - "description": "Set the position if the pen is down.", + "description": "Moves the pen, drawing a line from where it was if it is down.", "returnDescription": "", "scratchblock": "", "since": "" @@ -2655,12 +2686,12 @@ ], "returns": "void", "parameterNames": [ - "v" + "position" ], "parameterDescriptions": [ - "the Vector2 object containing the new x and y coordinates" + "world position" ], - "description": "Sets the position of the pen using a Vector2 object.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -2686,9 +2717,9 @@ "size" ], "parameterDescriptions": [ - "size of the pen" + "the line width in stage pixels (at least 1)" ], - "description": "Set the size of the pen", + "description": "", "returnDescription": "", "scratchblock": "set pen size to (size)", "since": "" @@ -2714,9 +2745,9 @@ "transparency" ], "parameterDescriptions": [ - "transparency of the pen" + "in percent (0 opaque, 100 invisible)" ], - "description": "Set the transparency", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -2738,7 +2769,7 @@ "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Stamps the current sprite onto the canvas. If the sprite is not null, it will\nstamp either to\nthe foreground or the background based on the value of the isForeground flag.", + "description": "Stamps the pen's sprite onto the pen's layer, like Scratch's \"stamp\" block.", "returnDescription": "", "scratchblock": "stamp", "since": "" @@ -2760,7 +2791,7 @@ "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Move the pen up.", + "description": "Lifts the pen: it no longer draws.", "returnDescription": "", "scratchblock": "pen up", "since": "" @@ -2770,6 +2801,167 @@ "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, + { + "id": "Pixels/constructor", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pixels/getArgb", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [ + { + "name": "getArgb", + "constructor": false, + "static": false, + "parameters": [ + "int", + "int" + ], + "returns": "int", + "parameterNames": [ + "x", + "y" + ], + "parameterDescriptions": [ + "pixels from the left edge", + "pixels from the top edge" + ], + "description": "", + "returnDescription": "the colour there packed as alpha, red, green, blue, or 0 outside", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pixels/getColor", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [ + { + "name": "getColor", + "constructor": false, + "static": false, + "parameters": [ + "int", + "int" + ], + "returns": "org.openpatch.scratch.Color", + "parameterNames": [ + "x", + "y" + ], + "parameterDescriptions": [ + "pixels from the left edge", + "pixels from the top edge" + ], + "description": "", + "returnDescription": "the colour there, or transparent black outside", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pixels/getHeight", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [ + { + "name": "getHeight", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the height in pixels", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pixels/getWidth", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [ + { + "name": "getWidth", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the width in pixels", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pixels/of", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [ + { + "name": "of", + "constructor": false, + "static": true, + "parameters": [ + "org.openpatch.scratch.Stage" + ], + "returns": "org.openpatch.scratch.Pixels", + "parameterNames": [ + "stage" + ], + "parameterDescriptions": [ + "the stage" + ], + "description": "The stage's pixels as they are now.", + "returnDescription": "its pixels, at stage size", + "scratchblock": "", + "since": "" + }, + { + "name": "of", + "constructor": false, + "static": true, + "parameters": [ + "java.lang.String" + ], + "returns": "org.openpatch.scratch.Pixels", + "parameterNames": [ + "imagePath" + ], + "parameterDescriptions": [ + "the image" + ], + "description": "The pixels of an image file.", + "returnDescription": "its pixels", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, { "id": "Polygon/addPoint", "owner": "org.openpatch.scratch.Polygon", @@ -2788,10 +2980,10 @@ "y" ], "parameterDescriptions": [ - "the x-coordinate", - "the y-coordinate" + "x of the corner", + "y of the corner" ], - "description": "Adds a point to the polygon.", + "description": "Adds a corner after the last one.", "returnDescription": "", "scratchblock": "", "since": "" @@ -2813,7 +3005,7 @@ "returns": "org.openpatch.scratch.Polygon", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates an empty polygon.", + "description": "A polygon without corners yet; add them with [addPoint(double, double)](addPoint).", "returnDescription": "", "scratchblock": "", "since": "" @@ -2832,10 +3024,10 @@ "yPoints" ], "parameterDescriptions": [ - "an array of x-coordinates", - "an array of y-coordinates" + "x of every corner", + "y of every corner, in the same order" ], - "description": "Creates a polygon with the specified vertices.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -3207,12 +3399,12 @@ "height" ], "parameterDescriptions": [ - "the x-coordinate of the rectangle's top-left corner", - "the y-coordinate of the rectangle's top-left corner", - "the width of the rectangle", - "the height of the rectangle" + "the smallest x", + "the smallest y", + "the width", + "the height" ], - "description": "Creates a rectangle with the specified position and size.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -3223,58 +3415,27 @@ "missingBrowserSignatures": [] }, { - "id": "Shape/constructor", - "owner": "org.openpatch.scratch.Shape", + "id": "Shader/constructor", + "owner": "org.openpatch.scratch.Shader", "signatures": [], "status": "implemented", "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "Shape/contains", - "owner": "org.openpatch.scratch.Shape", - "signatures": [ - { - "name": "contains", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "boolean", - "parameterNames": [ - "x", - "y" - ], - "parameterDescriptions": [ - "the x-coordinate of the point", - "the y-coordinate of the point" - ], - "description": "Check if the shape contains a point defined by its x and y coordinates.", - "returnDescription": "true if the shape contains the point, false otherwise", - "scratchblock": "", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Shape/getBounds", - "owner": "org.openpatch.scratch.Shape", + "id": "Shader/getName", + "owner": "org.openpatch.scratch.Shader", "signatures": [ { - "name": "getBounds", + "name": "getName", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Bounds", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the bounds of the shape.", - "returnDescription": "a Bounds object representing the bounding box of the shape", + "description": "", + "returnDescription": "the shader's name", "scratchblock": "", "since": "" } @@ -3284,204 +3445,165 @@ "missingBrowserSignatures": [] }, { - "id": "Shape/intersects", - "owner": "org.openpatch.scratch.Shape", + "id": "Shader/set", + "owner": "org.openpatch.scratch.Shader", "signatures": [ { - "name": "intersects", + "name": "set", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Shape" + "java.lang.String", + "double" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "other" + "uniform", + "value" ], "parameterDescriptions": [ - "the other shape to check intersection with" + "the uniform's name in the shader", + "an `int` or `float` uniform's value" ], - "description": "Check if the shape intersects with another shape.", - "returnDescription": "true if the shapes intersect, false otherwise", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Shape/rotate", - "owner": "org.openpatch.scratch.Shape", - "signatures": [ + }, { - "name": "rotate", + "name": "set", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "java.lang.String", + "int" ], - "returns": "org.openpatch.scratch.Shape", + "returns": "void", "parameterNames": [ - "theta", - "anchorX", - "anchorY" + "uniform", + "value" ], "parameterDescriptions": [ - "the angle in degrees to rotate", - "the x-coordinate of the anchor point", - "the y-coordinate of the anchor point" + "the uniform's name", + "an `int` uniform's value" ], - "description": "Rotate the shape by the specified angle around a given anchor point.", - "returnDescription": "a new Shape object that is rotated", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Shape/scale", - "owner": "org.openpatch.scratch.Shape", - "signatures": [ + }, { - "name": "scale", + "name": "set", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "java.lang.String", + "boolean" ], - "returns": "org.openpatch.scratch.Shape", + "returns": "void", "parameterNames": [ - "scaleX", - "scaleY" + "uniform", + "value" ], "parameterDescriptions": [ - "", - "" + "the uniform's name", + "a `bool` uniform's value" ], - "description": "Check if the shape is empty.", - "returnDescription": "true if the shape is empty, false otherwise", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Shape/translate", - "owner": "org.openpatch.scratch.Shape", - "signatures": [ + }, { - "name": "translate", + "name": "set", "constructor": false, "static": false, "parameters": [ + "java.lang.String", "double", "double" ], - "returns": "org.openpatch.scratch.Shape", + "returns": "void", "parameterNames": [ - "dx", - "dy" + "uniform", + "x", + "y" ], "parameterDescriptions": [ - "the distance to translate in the x direction", - "the distance to translate in the y direction" + "the uniform's name", + "a `vec2`'s x", + "a `vec2`'s y" ], - "description": "Translate the shape by the specified distances in the x and y directions.", - "returnDescription": "a new Shape object that is translated", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "signatures": [ + }, { - "name": "addCostume", + "name": "set", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "java.lang.String", + "org.openpatch.scratch.Vector2" ], "returns": "void", "parameterNames": [ - "name" + "uniform", + "value" ], "parameterDescriptions": [ - "the name of a built-in sprite, for example \"bunny1_jump\". Add\n the sheet in front of the name, for example\n \"platformer/grass\", if the same name exists on several sheets." + "the uniform's name", + "a `vec2`" ], - "description": "Add one of the costumes that ship with Scratch for Java to the sprite. The\ncostume gets the same name as the built-in sprite. If a costume with that\nname already exists do nothing.\n\nExample usage:\n\n```java\nthis.addCostume(\"bunny1_jump\");\n```", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "addCostume", + "name": "set", "constructor": false, "static": false, "parameters": [ "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "name", - "imagePath" + "uniform", + "color" ], "parameterDescriptions": [ - "a unique name", - "a image path, or the name of a built-in sprite such as\n \"bunny1_jump\"" + "the uniform's name", + "a `vec4`: red, green, blue and alpha from 0 to 1" ], - "description": "Add a costume to the sprite. If a costume with the received name already\nexists do nothing.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "addCostume", + "name": "set", "constructor": false, "static": false, "parameters": [ "java.lang.String", - "java.lang.String", - "int", - "int", - "int", + "double[]", "int" ], "returns": "void", "parameterNames": [ - "name", - "spriteSheetPath", - "x", - "y", - "width", - "height" + "uniform", + "values", + "perElement" ], "parameterDescriptions": [ - "The name of the costume.", - "The path to the sprite sheet image file.", - "The x-coordinate of the top-left corner of the costume\n in the sprite sheet.", - "The y-coordinate of the top-left corner of the costume\n in the sprite sheet.", - "The width of the costume in the sprite sheet.", - "The height of the costume in the sprite sheet." + "the uniform's name", + "all values, one element after the other", + "values per element: 1 for `float[]`, 3 for `vec3[]`" ], - "description": "Adds a new costume to the sprite if a costume with the same name does not\nalready exist.", + "description": "An array uniform such as `uniform vec3 lights[100];`.", "returnDescription": "", "scratchblock": "", "since": "" @@ -3492,33 +3614,24 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/addCostumes", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shader/setName", + "owner": "org.openpatch.scratch.Shader", "signatures": [ { - "name": "addCostumes", + "name": "setName", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String", - "int", - "int" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "prefix", - "spriteSheet", - "tileWidth", - "tileHeight" + "name" ], "parameterDescriptions": [ - "a prefix for all generated costumes", - "a path to a sprite sheet, or the name of a built-in sprite", - "the width of a single tile", - "the height of a single tile" + "a new name" ], - "description": "Adds all tiles from a spritesheet as costumes. The costumes will be name by\nthe prefix and the\nindex in the spritesheet. For example if the prefix is \"tile\" and the\nspritesheet contains 4\ntiles, the costumes will be named \"tile0\", \"tile1\", \"tile2\", and \"tile3\".", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -3529,47 +3642,56 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/addSound", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/activate", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "addSound", + "name": "activate", "constructor": false, "static": false, "parameters": [ - "java.lang.String", "java.lang.String" ], "returns": "void", "parameterNames": [ - "name", - "soundPath" + "name" ], "parameterDescriptions": [ - "a unique name", - "a sound path, or the name of a built-in sound such as\n \"footstep_carpet_000\"" + "a shader to use in addition to the active ones" ], - "description": "Add a sound to the sprite. If a sound with the received name already exists\ndo nothing.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shaders/add", + "owner": "org.openpatch.scratch.Shaders", + "signatures": [ { - "name": "addSound", + "name": "add", "constructor": false, "static": false, "parameters": [ + "java.lang.String", "java.lang.String" ], - "returns": "void", + "returns": "org.openpatch.scratch.Shader", "parameterNames": [ - "name" + "name", + "fragmentPath" ], "parameterDescriptions": [ - "the name of a built-in sound, for example \"footstep_carpet_000\"" + "the shader's name", + "the file with the shader's body" ], - "description": "Add one of the sounds that ship with Scratch for Java to the sprite. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.\n\nExample usage:\n\n```java\nthis.addSound(\"footstep_carpet_000\");\n```", - "returnDescription": "", + "description": "Adds a shader, or returns the one of that name added before.", + "returnDescription": "the shader, to set its uniforms", "scratchblock": "", "since": "" } @@ -3579,11 +3701,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/ask", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/constructor", + "owner": "org.openpatch.scratch.Shaders", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shaders/deactivate", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "ask", + "name": "deactivate", "constructor": false, "static": false, "parameters": [ @@ -3591,14 +3721,14 @@ ], "returns": "void", "parameterNames": [ - "question" + "name" ], "parameterDescriptions": [ - "the question to show" + "a shader to stop using" ], - "description": "Asks a question and waits for an answer to be typed in. The question appears\nat the top of the stage.\n\nUnlike Scratch, this does not pause the sprite. `run()` keeps being called\nwhile the question is on screen, so check [isAsking()](isAsking) or wait for\n[getAnswer()](getAnswer) to change.", + "description": "", "returnDescription": "", - "scratchblock": "ask [question] and wait", + "scratchblock": "", "since": "" } ], @@ -3607,26 +3737,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/broadcast", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/get", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "broadcast", + "name": "get", "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "void", + "returns": "org.openpatch.scratch.Shader", "parameterNames": [ - "message" + "name" ], "parameterDescriptions": [ - "The message to broadcast." + "a shader's name" ], - "description": "Broadcasts a message to every sprite on the stage, this one included, and\nto the stage itself, as in Scratch. If the sprite is not on a stage, nothing\nhappens.", - "returnDescription": "", - "scratchblock": "broadcast [message v]", + "description": "", + "returnDescription": "the shader, or null", + "scratchblock": "", "since": "" } ], @@ -3635,47 +3765,41 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changePosition", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/getActive", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changePosition", + "name": "getActive", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "a vector representing the change in position" - ], - "description": "Changes the position of the sprite by a given vector.", - "returnDescription": "", + "parameters": [], + "returns": "java.util.List", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the shaders in use, in order", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shaders/getCurrent", + "owner": "org.openpatch.scratch.Shaders", + "signatures": [ { - "name": "changePosition", + "name": "getCurrent", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void", - "parameterNames": [ - "x", - "y" - ], - "parameterDescriptions": [ - "how far to move along the x-axis", - "how far to move along the y-axis" - ], - "description": "Changes the position of the sprite by the given amounts.", - "returnDescription": "", + "parameters": [], + "returns": "org.openpatch.scratch.Shader", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the first shader in use, or null", "scratchblock": "", "since": "" } @@ -3685,26 +3809,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeSize", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/getCurrentIndex", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changeSize", + "name": "getCurrentIndex", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "amount" - ], - "parameterDescriptions": [ - "a percentage [0...100]" - ], - "description": "Changes the size of the sprite by a given percentage.", - "returnDescription": "", - "scratchblock": "change size by (amount)", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the number of the first shader in use, or -1", + "scratchblock": "", "since": "" } ], @@ -3713,26 +3831,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeTint", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/getCurrentName", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changeTint", + "name": "getCurrentName", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "step" - ], - "parameterDescriptions": [ - "a step value" - ], - "description": "Changes the tint for the sprite by a step.", - "returnDescription": "", - "scratchblock": "change [color v] effect by (step)", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the name of the first shader in use, or null", + "scratchblock": "", "since": "" } ], @@ -3741,26 +3853,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeTransparency", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/isActive", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changeTransparency", + "name": "isActive", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], - "returns": "void", + "returns": "boolean", "parameterNames": [ - "step" + "name" ], "parameterDescriptions": [ - "a step value" + "a shader's name" ], - "description": "Changes how see-through the sprite is by a step. A positive step fades it\nout, a negative one brings it back.", - "returnDescription": "", - "scratchblock": "change [ghost v] effect by (step)", + "description": "", + "returnDescription": "whether it is in use", + "scratchblock": "", "since": "" } ], @@ -3769,26 +3881,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeVolume", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/next", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changeVolume", + "name": "next", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "step" - ], - "parameterDescriptions": [ - "how much to add to the volume, in percent" - ], - "description": "Makes every sound of this sprite louder or quieter.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Uses the next shader alone.", "returnDescription": "", - "scratchblock": "change volume by (step)", + "scratchblock": "", "since": "" } ], @@ -3797,11 +3903,52 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeX", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/reset", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changeX", + "name": "reset", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Uses no shader.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shaders/switchTo", + "owner": "org.openpatch.scratch.Shaders", + "signatures": [ + { + "name": "switchTo", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the shader to use, alone" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "switchTo", "constructor": false, "static": false, "parameters": [ @@ -3809,14 +3956,14 @@ ], "returns": "void", "parameterNames": [ - "x" + "index" ], "parameterDescriptions": [ - "number in pixels" + "the shader to use alone, counting from 0; wraps around" ], - "description": "Changes x by a certain amount", + "description": "", "returnDescription": "", - "scratchblock": "change x by (x)", + "scratchblock": "", "since": "" } ], @@ -3825,26 +3972,37 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeY", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shape/constructor", + "owner": "org.openpatch.scratch.Shape", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shape/contains", + "owner": "org.openpatch.scratch.Shape", "signatures": [ { - "name": "changeY", + "name": "contains", "constructor": false, "static": false, "parameters": [ + "double", "double" ], - "returns": "void", + "returns": "boolean", "parameterNames": [ + "x", "y" ], "parameterDescriptions": [ - "number in pixels" + "x of a point", + "y of a point" ], - "description": "Changes y by a certain amount", - "returnDescription": "", - "scratchblock": "change y by (y)", + "description": "", + "returnDescription": "whether the point lies inside the shape", + "scratchblock": "", "since": "" } ], @@ -3853,20 +4011,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/clone", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shape/getBounds", + "owner": "org.openpatch.scratch.Shape", "signatures": [ { - "name": "clone", + "name": "getBounds", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Sprite", + "returns": "org.openpatch.scratch.Bounds", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates a clone of this sprite, like Scratch's \"create clone of myself\": a\nnew sprite of the same class (a clone of a `Cat` is a `Cat`),\nwith the same costume, position, direction, size and pen, and a copy of\nthe variables of your class. It is put on the stage right behind this\nsprite, and its [whenStartsAsClone()](whenStartsAsClone) runs; the constructor does\nnot run again.\n\nNumbers, text and booleans in your variables are the clone's own. A list\nor another object is shared with the original: give the clone its own in\n[whenStartsAsClone()](whenStartsAsClone) if it needs one.\n\n```java\nBullet bullet = (Bullet) this.clone();\n```", - "returnDescription": "the clone, of the same class as this sprite", - "scratchblock": "create clone of [myself v]", + "description": "", + "returnDescription": "the smallest rectangle around the shape", + "scratchblock": "", "since": "" } ], @@ -3875,60 +4033,81 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shape/getPoints", + "owner": "org.openpatch.scratch.Shape", "signatures": [ { - "name": "Sprite", - "constructor": true, + "name": "getPoints", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Sprite", + "returns": "double[]", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructs a new Sprite object with default settings.", - "returnDescription": "", + "description": "", + "returnDescription": "the outline's points `x0, y0, x1, y1, \\u2026` (a copy)", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shape/intersects", + "owner": "org.openpatch.scratch.Shape", + "signatures": [ { - "name": "Sprite", - "constructor": true, + "name": "intersects", + "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.Shape" ], - "returns": "org.openpatch.scratch.Sprite", + "returns": "boolean", "parameterNames": [ - "name", - "imagePath" + "other" ], "parameterDescriptions": [ - "a unique name for the costume", - "a path to an image file, or the name of a built-in sprite\n such as \"slimeGreen\"" + "another shape" ], - "description": "Constructs a new Sprite object with a specified costume.", - "returnDescription": "", + "description": "", + "returnDescription": "whether the two shapes overlap with some area; shapes that only touch do not", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shape/rotate", + "owner": "org.openpatch.scratch.Shape", + "signatures": [ { - "name": "Sprite", - "constructor": true, + "name": "rotate", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double", + "double", + "double" ], - "returns": "org.openpatch.scratch.Sprite", + "returns": "org.openpatch.scratch.Shape", "parameterNames": [ - "s" + "degrees", + "anchorX", + "anchorY" ], "parameterDescriptions": [ - "a Sprite object to copy" + "the angle", + "x of the point to turn about", + "y of the point to turn about" ], - "description": "Copies a Sprite object.", - "returnDescription": "", + "description": "Turns the shape about a point, from the x axis towards the y axis (anticlockwise when y points\nup).", + "returnDescription": "the shape turned", "scratchblock": "", "since": "" } @@ -3938,25 +4117,28 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/debug", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shape/scale", + "owner": "org.openpatch.scratch.Shape", "signatures": [ { - "name": "debug", + "name": "scale", "constructor": false, "static": false, "parameters": [ - "java.lang.Object[]" + "double", + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Shape", "parameterNames": [ - "values" + "scaleX", + "scaleY" ], "parameterDescriptions": [ - "one or more values to print" + "factor along x (negative mirrors)", + "factor along y" ], - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the sprite's class name so you can tell\nwhich sprite it came from.\n\nExample:\n\n```java\nthis.debug(\"x =\", getX(), \"y =\", getY());\n// prints: [CatSprite] x = 100.0 y = 200.0\n```", - "returnDescription": "", + "description": "", + "returnDescription": "the shape scaled about the origin", "scratchblock": "", "since": "" } @@ -3966,20 +4148,29 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/deleteThisClone", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shape/translate", + "owner": "org.openpatch.scratch.Shape", "signatures": [ { - "name": "deleteThisClone", + "name": "translate", "constructor": false, "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Removes this sprite from the stage if it is a clone, like Scratch's\n\"delete this clone\". The original stays.", - "returnDescription": "", - "scratchblock": "delete this clone", + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape", + "parameterNames": [ + "dx", + "dy" + ], + "parameterDescriptions": [ + "distance along x", + "distance along y" + ], + "description": "", + "returnDescription": "the shape moved", + "scratchblock": "", "since": "" } ], @@ -3988,42 +4179,28 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/disableHitbox", - "owner": "org.openpatch.scratch.Sprite", - "signatures": [ - { - "name": "disableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Disables the hitbox for the sprite. Once the hitbox is disabled, the sprite\nwill no longer\ndetect collisions with other objects.", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ], + "id": "SoundPlayback/constructor", + "owner": "org.openpatch.scratch.SoundPlayback", + "signatures": [], "status": "implemented", "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "Sprite/distanceToMousePointer", - "owner": "org.openpatch.scratch.Sprite", + "id": "SoundPlayback/isPlaying", + "owner": "org.openpatch.scratch.SoundPlayback", "signatures": [ { - "name": "distanceToMousePointer", + "name": "isPlaying", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Calculates the distance from the current sprite to the mouse pointer.", - "returnDescription": "the distance to the mouse pointer as a double.", - "scratchblock": "(distance to [mouse-pointer v])", + "description": "", + "returnDescription": "whether this copy still plays", + "scratchblock": "", "since": "" } ], @@ -4032,26 +4209,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/distanceToSprite", - "owner": "org.openpatch.scratch.Sprite", + "id": "SoundPlayback/setVolume", + "owner": "org.openpatch.scratch.SoundPlayback", "signatures": [ { - "name": "distanceToSprite", + "name": "setVolume", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "sprite" + "volume" ], "parameterDescriptions": [ - "the other sprite to which the distance is calculated" + "from 0 to 100" ], - "description": "Calculates the Euclidean distance between this sprite and another sprite.", - "returnDescription": "the distance between this sprite and the specified sprite", - "scratchblock": "(distance to [sprite v])", + "description": "", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -4060,18 +4237,18 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/enableHitbox", - "owner": "org.openpatch.scratch.Sprite", + "id": "SoundPlayback/stop", + "owner": "org.openpatch.scratch.SoundPlayback", "signatures": [ { - "name": "enableHitbox", + "name": "stop", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Enables the hitbox for the sprite. This method sets the hitboxDisabled flag\nto false, allowing\nthe sprite to interact with other objects.", + "description": "Stops this copy.", "returnDescription": "", "scratchblock": "", "since": "" @@ -4082,42 +4259,1872 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getAnswer", + "id": "Sprite/addAnimation", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getAnswer", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the last answer that was typed in.", - "returnDescription": "the answer, or an empty string if nothing has been answered yet", - "scratchblock": "(answer)", + "parameters": [ + "java.lang.String", + "java.lang.String", + "int" + ], + "returns": "void", + "parameterNames": [ + "name", + "pattern", + "frames" + ], + "parameterDescriptions": [ + "the animation's name", + "the file names, with `%d` for the frame number", + "how many frames" + ], + "description": "Adds an animation from numbered image files: the pattern's `%d` counts from 1.\n\n```java\nthis.addAnimation(\"walk\", \"assets/walk%d.png\", 4); // walk1.png \\u2026 walk4.png\n```", + "returnDescription": "", + "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + }, + { + "name": "addAnimation", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String", + "int", + "int" + ], + "returns": "void", + "parameterNames": [ + "name", + "pattern", + "from", + "to" + ], + "parameterDescriptions": [ + "the animation's name", + "the file names, with `%d` for the frame number", + "the number of the first frame", + "the number of the last frame" + ], + "description": "Adds an animation from numbered image files, from one number to another: for files that count\nfrom 0, or to use only some of them. If `to` is smaller than `from`, it counts down.\n\n```java\nthis.addAnimation(\"hit\", \"assets/hit%d.png\", 0, 4); // hit0.png \\u2026 hit4.png\n```", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "addAnimation", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String", + "int", + "int", + "int[]" + ], + "returns": "void", + "parameterNames": [ + "name", + "sheetPath", + "width", + "height", + "frames" + ], + "parameterDescriptions": [ + "the animation's name", + "the sprite sheet", + "the width of a frame", + "the height of a frame", + "the frames to show, in order" + ], + "description": "Adds an animation from a sprite sheet: frames of equal size, numbered row by row from the\ntop left, starting at 0.\n\n```java\nthis.addAnimation(\"walk\", \"assets/walk.png\", 32, 32, 0, 1, 2, 3); // the first row\nthis.addAnimation(\"down\", \"assets/hero.png\", 32, 32, 0, 4, 8, 12); // the first column of 4\n```", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "addCostume", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name", + "imagePath" + ], + "parameterDescriptions": [ + "the costume's name, for [switchCostume(String)](switchCostume)", + "the image file (PNG, JPEG, GIF, BMP or TGA)" + ], + "description": "Adds a costume from an image file. The first costume added is the one the sprite wears.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "addCostume", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "imagePath" + ], + "parameterDescriptions": [ + "the image file" + ], + "description": "Adds a costume from an image file, named after the file.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "addCostume", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String", + "int", + "int", + "int", + "int" + ], + "returns": "void", + "parameterNames": [ + "name", + "imagePath", + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "the costume's name", + "the image file", + "left edge of the part, in pixels", + "top edge of the part, in pixels", + "width of the part", + "height of the part" + ], + "description": "Adds a costume cut out of a larger image, e.g. one frame of a sprite sheet.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/addCostumes", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "addCostumes", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String", + "int", + "int" + ], + "returns": "void", + "parameterNames": [ + "name", + "imagePath", + "width", + "height" + ], + "parameterDescriptions": [ + "the start of the costumes' names", + "the image file", + "width of one frame", + "height of one frame" + ], + "description": "Adds every frame of a sprite sheet as a costume, row by row, named `name0`,\n`name1`, \\u2026", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/addSound", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "addSound", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name", + "soundPath" + ], + "parameterDescriptions": [ + "the sound's name, for [playSound(String)](playSound)", + "the sound file" + ], + "description": "Adds a sound (WAV or OGG).", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "addSound", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "soundPath" + ], + "parameterDescriptions": [ + "the sound file" + ], + "description": "Adds a sound, named after its file.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/ask", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "ask", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "question" + ], + "parameterDescriptions": [ + "the question" + ], + "description": "Asks a question: the sprite says it in a bubble, and a box to type the answer in appears at\nthe bottom of the stage. Enter finishes it; see [Stage.ask(String)](../Stage/ask).", + "returnDescription": "", + "scratchblock": "ask [question] and wait", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/broadcast", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "broadcast", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "message" + ], + "parameterDescriptions": [ + "the message" + ], + "description": "Sends a message to the stage and every sprite on it; their [whenIReceive(String)](whenIReceive)\nruns at once, before this method returns.", + "returnDescription": "", + "scratchblock": "broadcast [message v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeColorEffect", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeColorEffect", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how much to change the colour effect" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change [color v] effect by (by)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeHeight", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeHeight", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how much higher to draw the sprite" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changePosition", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changePosition", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "dx", + "dy" + ], + "parameterDescriptions": [ + "how far to move along x", + "how far to move along y" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "changePosition", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how far to move" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeSize", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeSize", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "percent" + ], + "parameterDescriptions": [ + "how much to change the size, in percentage points" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change size by (amount)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeTransparency", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeTransparency", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how much to change the transparency" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change [ghost v] effect by (step)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeVolume", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeVolume", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how much to change the volume" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change volume by (step)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeWidth", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeWidth", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how much wider to draw the sprite" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeX", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeX", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "dx" + ], + "parameterDescriptions": [ + "how far to move along x" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change x by (x)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeY", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeY", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "dy" + ], + "parameterDescriptions": [ + "how far to move along y" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change y by (y)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/constructor", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "Sprite", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Sprite", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A sprite without costumes. Add some with [addCostume(String, String)](addCostume).", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "Sprite", + "constructor": true, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String" + ], + "returns": "org.openpatch.scratch.Sprite", + "parameterNames": [ + "name", + "imagePath" + ], + "parameterDescriptions": [ + "the costume's name", + "the image file" + ], + "description": "A sprite with one costume.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/createClone", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "createClone", + "constructor": false, + "static": false, + "parameters": [], + "returns": "T", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Makes a clone: a copy of this sprite with the same costumes, position, direction, effects and\nvariables, added to the stage just behind this sprite, as in Scratch. Its\n[whenStartsAsClone()](whenStartsAsClone) runs;\nits constructor does not. Numbers, texts and booleans in its variables are its own; lists and\nother objects are shared with this sprite until the clone gets its own in\n[whenStartsAsClone()](whenStartsAsClone).\n\n```java\nBullet bullet = this.createClone();\n```", + "returnDescription": "the clone", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/debug", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "debug", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Object[]" + ], + "returns": "void", + "parameterNames": [ + "values" + ], + "parameterDescriptions": [ + "what to print" + ], + "description": "Prints values for debugging, but only while debug mode is on (`window.setDebug(true)`\nor F12).", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/deleteThisClone", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "deleteThisClone", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Removes this sprite if it is a clone, stopping its sounds; does nothing for the original.", + "returnDescription": "", + "scratchblock": "delete this clone", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/disableHitbox", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "disableHitbox", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Touching ignores this sprite until [enableHitbox()](enableHitbox).", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/disableNineSlice", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "disableNineSlice", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Stretches the whole costume again.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/distanceToMousePointer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "distanceToMousePointer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the distance to the mouse pointer", + "scratchblock": "(distance to [mouse-pointer v])", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/distanceToSprite", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "distanceToSprite", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Sprite" + ], + "returns": "double", + "parameterNames": [ + "sprite" + ], + "parameterDescriptions": [ + "another sprite" + ], + "description": "", + "returnDescription": "the distance between the two positions", + "scratchblock": "(distance to [sprite v])", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/enableHitbox", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "enableHitbox", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Touching counts this sprite again.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/extension", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "extension", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class", + "java.util.function.Supplier" + ], + "returns": "T", + "parameterNames": [ + "type", + "factory" + ], + "parameterDescriptions": [ + "the state's class", + "makes it" + ], + "description": "An extension's state for this sprite, made on first use; a clone gets its own. For\nextensions, not for learner code.", + "returnDescription": "the sprite's one instance", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others.", + "missingBrowserSignatures": [ + { + "name": "extension", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class", + "java.util.function.Supplier" + ], + "returns": "T", + "parameterNames": [ + "type", + "factory" + ], + "parameterDescriptions": [ + "the state's class", + "makes it" + ], + "description": "An extension's state for this sprite, made on first use; a clone gets its own. For\nextensions, not for learner code.", + "returnDescription": "the sprite's one instance", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "Sprite/getAnimationFrame", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getAnimationFrame", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the frame of the current animation, counting from 0", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getAnimationInterval", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getAnimationInterval", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "how long each frame shows, in seconds", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getAnswer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getAnswer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the answer to the last question", + "scratchblock": "(answer)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getColorEffect", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getColorEffect", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the colour effect", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getCurrentCostumeIndex", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getCurrentCostumeIndex", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the current costume's number, counting from 0", + "scratchblock": "(costume [number v])", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getCurrentCostumeName", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getCurrentCostumeName", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the current costume's name, or null without costumes", + "scratchblock": "(costume [name v])", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getDirection", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getDirection", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the direction, from 0 (inclusive) to 360 (exclusive); 90 is right", + "scratchblock": "(direction)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getHeight", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getHeight", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the height the sprite is drawn at, in stage pixels", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getHitbox", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getHitbox", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Shape", + "parameterNames": [], + "parameterDescriptions": [], + "description": "The hitbox where the sprite is now, in stage coordinates: by default the rectangle around the\ncostume's painted pixels; null for a sprite without costumes.", + "returnDescription": "the hitbox, or null", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getLayer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getLayer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Layer", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the sprite's layer", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getMouse", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getMouse", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the mouse pointer's position, in world coordinates (or stage coordinates for UI)", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getMouseX", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getMouseX", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "x of the mouse pointer, in the sprite's coordinates (world, or the stage for UI)", + "scratchblock": "(mouse x)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getMouseY", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getMouseY", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "y of the mouse pointer", + "scratchblock": "(mouse y)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getPen", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getPen", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Pen", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the sprite's pen, which follows it", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getPosition", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getPosition", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the sprite's position", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getRotationStyle", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getRotationStyle", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.RotationStyle", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "how the costume follows the direction", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getShaders", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getShaders", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Shaders", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the sprite's shaders", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getSize", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getSize", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the size in percent of the costume's own size", + "scratchblock": "(size)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getStage", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getStage", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Stage", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage the sprite is on, or null", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getText", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getText", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Text", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the sprite's text, which say and think show in a bubble", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getTimer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getTimer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Timer", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "this object's timer, counting game time since it was made or reset", + "scratchblock": "(timer)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getTint", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getTint", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Color", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the tint, or null for none", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getTouchingSprite", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getTouchingSprite", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class" + ], + "returns": "T", + "parameterNames": [ + "type" + ], + "parameterDescriptions": [ + "a class of sprites" + ], + "description": "", + "returnDescription": "a sprite of that class the sprite touches, or null", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getTouchingSprites", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getTouchingSprites", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class" + ], + "returns": "java.util.List", + "parameterNames": [ + "type" + ], + "parameterDescriptions": [ + "a class of sprites" + ], + "description": "", + "returnDescription": "every sprite of that class the sprite touches", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getTransparency", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getTransparency", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the transparency in percent", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getVolume", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getVolume", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "this object's volume from 0 to 100", + "scratchblock": "(volume)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getWidth", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getWidth", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the width the sprite is drawn at, in stage pixels", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getX", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getX", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "x of the sprite's position", + "scratchblock": "(x position)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getY", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getY", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "y of the sprite's position", + "scratchblock": "(y position)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/glide", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "glide", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "seconds", + "x", + "y" + ], + "parameterDescriptions": [ + "how long the glide takes", + "x of the target", + "y of the target" + ], + "description": "Glides to a position in a number of seconds of game time; the sprite keeps running its code\nmeanwhile. A new glide replaces one that is still going.", + "returnDescription": "", + "scratchblock": "glide (seconds) secs to x: (x) y: (y)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goLayersBackwards", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goLayersBackwards", + "constructor": false, + "static": false, + "parameters": [ + "int" + ], + "returns": "void", + "parameterNames": [ + "number" + ], + "parameterDescriptions": [ + "how many sprites of its layer to move behind" + ], + "description": "", + "returnDescription": "", + "scratchblock": "go [backward v] (number) layers", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goLayersForwards", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goLayersForwards", + "constructor": false, + "static": false, + "parameters": [ + "int" + ], + "returns": "void", + "parameterNames": [ + "number" + ], + "parameterDescriptions": [ + "how many sprites of its layer to move in front of" + ], + "description": "", + "returnDescription": "", + "scratchblock": "go [forward v] (number) layers", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goToBackLayer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goToBackLayer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Moves the sprite behind every other sprite of its layer.", + "returnDescription": "", + "scratchblock": "go to [back v] layer", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goToFrontLayer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goToFrontLayer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Moves the sprite in front of every other sprite of its layer.", + "returnDescription": "", + "scratchblock": "go to [front v] layer", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goToMousePointer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goToMousePointer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Goes to the mouse pointer.", + "returnDescription": "", + "scratchblock": "go to [mouse-pointer v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goToRandomPosition", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goToRandomPosition", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Goes to a random position on the stage.", + "returnDescription": "", + "scratchblock": "go to [random position v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goToSprite", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goToSprite", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Sprite" + ], + "returns": "void", + "parameterNames": [ + "sprite" + ], + "parameterDescriptions": [ + "the sprite whose position to go to" + ], + "description": "", + "returnDescription": "", + "scratchblock": "go to [sprite v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/hide", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "hide", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Hides the sprite: it is not drawn, cannot be touched and cannot be clicked.", + "returnDescription": "", + "scratchblock": "hide", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/hideVariable", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "hideVariable", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the label of a variable to hide again" + ], + "description": "", + "returnDescription": "", + "scratchblock": "hide variable [name v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/ifOnEdgeBounce", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "ifOnEdgeBounce", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Turns around when touching an edge of the stage and moves back inside, as in Scratch.", + "returnDescription": "", + "scratchblock": "if on edge, bounce", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isAnimationPlayed", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isAnimationPlayed", + "constructor": false, + "static": false, + "parameters": [], + "returns": "boolean", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether an animation played with `once` reached its last frame", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isAsking", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isAsking", + "constructor": false, + "static": false, + "parameters": [], + "returns": "boolean", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether a question is waiting for its answer", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "Sprite/getCurrentCostumeIndex", + "id": "Sprite/isClone", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getCurrentCostumeIndex", + "name": "isClone", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the current costume index", - "returnDescription": "a costume index", - "scratchblock": "(costume [number v])", + "description": "", + "returnDescription": "whether this sprite is a clone", + "scratchblock": "", "since": "" } ], @@ -4126,20 +6133,79 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getCurrentCostumeName", + "id": "Sprite/isColorTouchingColor", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getCurrentCostumeName", + "name": "isColorTouchingColor", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Color", + "org.openpatch.scratch.Color" + ], + "returns": "boolean", + "parameterNames": [ + "mine", + "color" + ], + "parameterDescriptions": [ + "a colour of the sprite", + "the colour to look for underneath" + ], + "description": "Whether a colour of the sprite touches a colour on the stage, like Scratch's \"color is\ntouching color\".", + "returnDescription": "whether they touch", + "scratchblock": "<color [#ff0000] is touching [#00ff00]?>", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isGliding", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isGliding", "constructor": false, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the current costume name", - "returnDescription": "a costume name", - "scratchblock": "(costume [name v])", + "description": "", + "returnDescription": "whether a glide is still going", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isKeyPressed", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isKeyPressed", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "boolean", + "parameterNames": [ + "key" + ], + "parameterDescriptions": [ + "a key" + ], + "description": "", + "returnDescription": "whether the key is held down", + "scratchblock": "<key [space v] pressed?>", "since": "" } ], @@ -4148,19 +6214,47 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getDeltaTime", + "id": "Sprite/isMouseDown", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getDeltaTime", + "name": "isMouseDown", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Gets the seconds passed since the last frame.", - "returnDescription": "seconds since last frame", + "description": "", + "returnDescription": "whether a mouse button is held down", + "scratchblock": "<mouse down?>", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isSoundPlaying", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isSoundPlaying", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "boolean", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "a sound's name" + ], + "description": "", + "returnDescription": "whether it is playing", "scratchblock": "", "since": "" } @@ -4170,20 +6264,73 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getDirection", + "id": "Sprite/isTouchingColor", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getDirection", + "name": "isTouchingColor", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Color" + ], + "returns": "boolean", + "parameterNames": [ + "color" + ], + "parameterDescriptions": [ + "the colour to look for" + ], + "description": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "returnDescription": "whether the sprite touches it", + "scratchblock": "<touching color [#ff0000]?>", + "since": "" + }, + { + "name": "isTouchingColor", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "boolean", + "parameterNames": [ + "red", + "green", + "blue" + ], + "parameterDescriptions": [ + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" + ], + "description": "", + "returnDescription": "whether the sprite touches that colour", + "scratchblock": "<touching color [#ff0000]?>", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isTouchingEdge", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isTouchingEdge", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the direction of the sprite.", - "returnDescription": "the direction [0...360]", - "scratchblock": "(direction)", + "description": "", + "returnDescription": "whether the sprite's hitbox reaches an edge of the stage", + "scratchblock": "<touching [edge v]?>", "since": "" } ], @@ -4192,20 +6339,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getHeight", + "id": "Sprite/isTouchingMousePointer", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getHeight", + "name": "isTouchingMousePointer", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "returnDescription": "the height of the sprite", - "scratchblock": "", + "description": "", + "returnDescription": "whether the mouse pointer is over the sprite's hitbox", + "scratchblock": "<touching [mouse-pointer v]?>", "since": "" } ], @@ -4214,19 +6361,66 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getHitbox", + "id": "Sprite/isTouchingSprite", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getHitbox", + "name": "isTouchingSprite", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Sprite" + ], + "returns": "boolean", + "parameterNames": [ + "sprite" + ], + "parameterDescriptions": [ + "another sprite" + ], + "description": "", + "returnDescription": "whether the two hitboxes overlap (touching edges do not count); a hidden sprite\n touches nothing, and the UI layer never touches the world", + "scratchblock": "<touching [sprite v]?>", + "since": "" + }, + { + "name": "isTouchingSprite", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class" + ], + "returns": "boolean", + "parameterNames": [ + "type" + ], + "parameterDescriptions": [ + "a class of sprites" + ], + "description": "", + "returnDescription": "whether the sprite touches any sprite of that class (or a subclass)", + "scratchblock": "<touching [sprite v]?>", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isVisible", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isVisible", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Hitbox", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the hitbox of the sprite based on its current costume, position, and\nrotation. If the\nsprite has a hitbox already defined, it updates and returns it. Otherwise, it\ncalculates a new\nhitbox based on the sprite's dimensions and rotation.", - "returnDescription": "the hitbox of the sprite", + "description": "", + "returnDescription": "whether the sprite is shown", "scratchblock": "", "since": "" } @@ -4236,20 +6430,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getMouse", + "id": "Sprite/move", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getMouse", + "name": "move", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "steps" + ], + "parameterDescriptions": [ + "how far, in stage pixels (negative moves backwards)" + ], + "description": "Moves forward in the sprite's direction.", + "returnDescription": "", + "scratchblock": "move (steps) steps", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/nextCostume", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "nextCostume", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the current position of the mouse cursor.", - "returnDescription": "a Vector2 object representing the current mouse cursor position, with\n the x-coordinate\n obtained from getMouseX() and the y-coordinate obtained from\n getMouseY().", - "scratchblock": "", + "description": "Switches to the next costume, after the last one to the first.", + "returnDescription": "", + "scratchblock": "next costume", "since": "" } ], @@ -4258,20 +6480,29 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getMouseX", + "id": "Sprite/pickRandom", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getMouseX", + "name": "pickRandom", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current x-position of the mouse cursor", - "returnDescription": "x-position", - "scratchblock": "(mouse x)", + "parameters": [ + "int", + "int" + ], + "returns": "int", + "parameterNames": [ + "from", + "to" + ], + "parameterDescriptions": [ + "the lowest", + "the highest" + ], + "description": "A random whole number between two numbers, both included.", + "returnDescription": "the number", + "scratchblock": "(pick random (from) to (to))", "since": "" } ], @@ -4280,20 +6511,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getMouseY", + "id": "Sprite/playAnimation", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getMouseY", + "name": "playAnimation", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current y-position of the mouse cursor", - "returnDescription": "y-position", - "scratchblock": "(mouse y)", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the animation's name" + ], + "description": "Plays an animation, over and over. Call it every tick (in `run()`): it shows the next\nframe each time the animation interval has passed, and starts from the first frame when\nanother animation was playing before.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "playAnimation", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "boolean" + ], + "returns": "void", + "parameterNames": [ + "name", + "once" + ], + "parameterDescriptions": [ + "the animation's name", + "whether to stop at the last frame instead of starting over" + ], + "description": "Plays an animation; call it every tick.", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -4302,20 +6561,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getPen", + "id": "Sprite/playSound", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getPen", + "name": "playSound", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Pen", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the pen of the sprite.", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the sound's name" + ], + "description": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "start sound [name v]", "since": "" } ], @@ -4324,19 +6589,28 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getPosition", + "id": "Sprite/playSoundCopy", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getPosition", + "name": "playSoundCopy", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Retrieves the current position of the sprite.", - "returnDescription": "A [Vector2](../Vector2/index) object representing the x and y coordinates of the\n sprite.", + "parameters": [ + "java.lang.String", + "double" + ], + "returns": "org.openpatch.scratch.SoundPlayback", + "parameterNames": [ + "name", + "volume" + ], + "parameterDescriptions": [ + "the sound's name", + "the copy's volume from 0 to 100" + ], + "description": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "returnDescription": "the copy, to stop it or change its volume", "scratchblock": "", "since": "" } @@ -4346,19 +6620,44 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getShaders", + "id": "Sprite/pointTowards", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getShaders", + "name": "pointTowards", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the shaders of this sprite. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.\n\nExample usage:\n\n```java\nthis.getShaders().add(\"blur\", \"blur.frag\", null);\nthis.getShaders().switchTo(\"blur\");\n```\n\nA sprite draws with one shader: with several active, the first of them.", - "returnDescription": "the shaders", + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void", + "parameterNames": [ + "position" + ], + "parameterDescriptions": [ + "where to point" + ], + "description": "Points towards a position.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "pointTowards", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Sprite" + ], + "returns": "void", + "parameterNames": [ + "sprite" + ], + "parameterDescriptions": [ + "the sprite to point at" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4368,20 +6667,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getSize", + "id": "Sprite/pointTowardsMousePointer", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getSize", + "name": "pointTowardsMousePointer", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the size of the sprite.", - "returnDescription": "size in percentage", - "scratchblock": "(size)", + "description": "Points towards the mouse pointer.", + "returnDescription": "", + "scratchblock": "point towards [mouse-pointer v]", "since": "" } ], @@ -4390,20 +6689,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getStage", + "id": "Sprite/previousCostume", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getStage", + "name": "previousCostume", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Stage", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the current stage associated with this sprite.", - "returnDescription": "the stage associated with this sprite", - "scratchblock": "", + "description": "Switches to the previous costume, before the first one to the last.", + "returnDescription": "", + "scratchblock": "switch costume to (previous costume)", "since": "" } ], @@ -4412,19 +6711,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getText", + "id": "Sprite/remove", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getText", + "name": "remove", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Text", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the text associated with this sprite.", - "returnDescription": "the text associated with this sprite", + "description": "Removes the sprite from its stage.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4434,38 +6733,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getTimer", + "id": "Sprite/resetAnimation", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getTimer", + "name": "resetAnimation", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Timer", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Return the default timer", - "returnDescription": "the default timer", - "scratchblock": "(timer)", - "since": "" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "org.openpatch.scratch.Timer", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "" - ], - "description": "Return a timer by name", - "returnDescription": "a timer", + "description": "Starts the current animation from its first frame again.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4475,19 +6755,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getTint", + "id": "Sprite/run", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getTint", + "name": "run", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Color", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the tint value of the current costume.", - "returnDescription": "the tint value of the current costume, or null if there are no\n costumes.", + "description": "Runs every tick, 60 times a second of game time. Override it with the sprite's code.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4497,26 +6777,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getTouchingSprite", + "id": "Sprite/say", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getTouchingSprite", + "name": "say", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "java.lang.String" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "c" + "text" ], "parameterDescriptions": [ - "the class object of the type of sprite to check for" + "what the sprite says" ], - "description": "Returns the first sprite of the specified type that is currently touching\nthis sprite.", - "returnDescription": "the first sprite of the specified type that is touching this sprite,\n or null if no such\n sprite is found", - "scratchblock": "", + "description": "Shows a speech bubble until the sprite says something else; an empty text removes it.", + "returnDescription": "", + "scratchblock": "say [text]", + "since": "" + }, + { + "name": "say", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "double" + ], + "returns": "void", + "parameterNames": [ + "text", + "seconds" + ], + "parameterDescriptions": [ + "what the sprite says", + "how long" + ], + "description": "Shows a speech bubble for a number of seconds of game time.", + "returnDescription": "", + "scratchblock": "say [text] for (seconds) seconds", "since": "" } ], @@ -4525,25 +6827,25 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getTouchingSprites", + "id": "Sprite/setAnimationFrame", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getTouchingSprites", + "name": "setAnimationFrame", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "int" ], - "returns": "java.util.List", + "returns": "void", "parameterNames": [ - "c" + "frame" ], "parameterDescriptions": [ - "the class of the type of sprites to return" + "the frame of the current animation to show next, counting from 0" ], - "description": "Returns a list of sprites of the specified type that are currently touching\nthis sprite.", - "returnDescription": "a list of sprites of the specified type that are touching this\n sprite, or null if the\n stage is not set", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4553,19 +6855,25 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getTransparency", + "id": "Sprite/setAnimationInterval", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getTransparency", + "name": "setAnimationInterval", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Gets the transparency of the current costume.", - "returnDescription": "how see-through the sprite is, 0 solid and 100 invisible", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "how long each frame shows" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4575,20 +6883,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getVolume", + "id": "Sprite/setColorEffect", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getVolume", + "name": "setColorEffect", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns how loud the sounds of this sprite play.", - "returnDescription": "the volume, from 0 to 100", - "scratchblock": "(volume)", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "value" + ], + "parameterDescriptions": [ + "the effect" + ], + "description": "Scratch's colour effect: shifts every colour of the costume around the colour wheel. 0 is no\nchange; 100 is halfway round; 200 is all the way round again. Like Scratch, it gives colours\ntoo grey or too dark to show a hue a little one, so white and black are tinted too.", + "returnDescription": "", + "scratchblock": "set [color v] effect to (value)", "since": "" } ], @@ -4597,20 +6911,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getWidth", + "id": "Sprite/setDirection", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getWidth", + "name": "setDirection", "constructor": false, "static": false, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "returnDescription": "the width of the sprite", - "scratchblock": "", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "degrees" + ], + "parameterDescriptions": [ + "the direction" + ], + "description": "Points in a direction: 0 up, 90 right, 180 down, 270 left; other numbers go around.", + "returnDescription": "", + "scratchblock": "point in direction (degrees)", "since": "" } ], @@ -4619,20 +6939,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getX", + "id": "Sprite/setHeight", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getX", + "name": "setHeight", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the x coordinate of the sprite", - "returnDescription": "a x coordinate", - "scratchblock": "(x position)", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "height" + ], + "parameterDescriptions": [ + "the height in stage pixels; 0 to follow the costume and size again" + ], + "description": "Draws the sprite this high; see [setWidth(double)](setWidth).", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -4641,20 +6967,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getY", + "id": "Sprite/setHitbox", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getY", + "name": "setHitbox", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the y coordinate of the sprite", - "returnDescription": "a y coordinate", - "scratchblock": "(y position)", + "parameters": [ + "org.openpatch.scratch.Shape" + ], + "returns": "void", + "parameterNames": [ + "shape" + ], + "parameterDescriptions": [ + "the hitbox" + ], + "description": "Sets the hitbox: the shape that counts for touching, in costume pixels (origin at the\ncostume's top left corner, y down). It turns, grows and mirrors with the sprite.", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -4663,32 +6995,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/glide", + "id": "Sprite/setLayer", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "glide", + "name": "setLayer", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "org.openpatch.scratch.Layer" ], "returns": "void", "parameterNames": [ - "seconds", - "x", - "y" + "layer" ], "parameterDescriptions": [ - "how long the trip should take", - "where to end up", - "where to end up" + "the layer" ], - "description": "Slides the sprite to a place over the given time, instead of jumping there.\n\nUnlike Scratch this does not hold up the sprite: `run()` keeps being called\nwhile the sprite is on its way. Use [isGliding()](isGliding) to tell whether it\nhas arrived.", + "description": "Moves the sprite to another layer, in front of the sprites already there. A sprite in\n[Layer.UI](../Layer/UI) ignores the camera; its pen moves to the UI layer too.", "returnDescription": "", - "scratchblock": "glide (seconds) secs to x: (x) y: (y)", + "scratchblock": "", "since": "" } ], @@ -4697,26 +7023,35 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goLayersBackwards", + "id": "Sprite/setNineSlice", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goLayersBackwards", + "name": "setNineSlice", "constructor": false, "static": false, "parameters": [ + "int", + "int", + "int", "int" ], "returns": "void", "parameterNames": [ - "number" + "top", + "right", + "bottom", + "left" ], "parameterDescriptions": [ - "the number of layers to move the sprite backwards" + "costume pixels at the top that keep their height", + "costume pixels at the right that keep their width", + "costume pixels at the bottom that keep their height", + "costume pixels at the left that keep their width" ], - "description": "Moves the sprite backwards by a specified number of layers in the stage. If\nthe sprite is not\npart of a stage, the method does nothing.", + "description": "Stretches only the middle of the costume when the sprite is drawn at its own width and\nheight: the four corners keep their size (scaled with the sprite's size), the edges stretch\nalong one side.", "returnDescription": "", - "scratchblock": "go [backward v] (number) layers", + "scratchblock": "", "since": "" } ], @@ -4725,26 +7060,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goLayersForwards", + "id": "Sprite/setPosition", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goLayersForwards", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "int" + "double", + "double" ], "returns": "void", "parameterNames": [ - "number" + "x", + "y" ], "parameterDescriptions": [ - "the number of layers to move the sprite forward" + "x of the new position", + "y of the new position" ], - "description": "Moves the sprite forward by a specified number of layers within its stage.", + "description": "Goes to a position; with the pen down, it draws a line there.", "returnDescription": "", - "scratchblock": "go [forward v] (number) layers", + "scratchblock": "go to x: (x) y: (y)", + "since": "" + }, + { + "name": "setPosition", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void", + "parameterNames": [ + "position" + ], + "parameterDescriptions": [ + "the new position" + ], + "description": "", + "returnDescription": "", + "scratchblock": "go to x: (x) y: (y)", "since": "" } ], @@ -4753,20 +7110,29 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goToBackLayer", + "id": "Sprite/setRotationCenter", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goToBackLayer", + "name": "setRotationCenter", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Moves the sprite to the back layer of the stage. If the sprite is not\nassociated with any\nstage, the method returns without performing any action.", + "parameterNames": [ + "x", + "y" + ], + "parameterDescriptions": [ + "pixels from the left edge", + "pixels from the top edge" + ], + "description": "Sets the point of the costumes the sprite turns around and stands on, in costume pixels from\nthe top left corner. Without it, that is the centre of each costume.", "returnDescription": "", - "scratchblock": "go to [back v] layer", + "scratchblock": "", "since": "" } ], @@ -4775,20 +7141,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goToFrontLayer", + "id": "Sprite/setRotationStyle", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goToFrontLayer", + "name": "setRotationStyle", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.RotationStyle" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Moves this sprite to the front layer of the stage. If the sprite is not part\nof any stage, the\nmethod does nothing.", + "parameterNames": [ + "style" + ], + "parameterDescriptions": [ + "how the costume follows the direction" + ], + "description": "", "returnDescription": "", - "scratchblock": "go to [front v] layer", + "scratchblock": "set rotation style [left-right v]", "since": "" } ], @@ -4797,20 +7169,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goToMousePointer", + "id": "Sprite/setSize", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goToMousePointer", + "name": "setSize", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Moves the sprite to the current position of the mouse pointer. This method\nupdates the sprite's\nposition to the coordinates of the mouse cursor.", + "parameterNames": [ + "percent" + ], + "parameterDescriptions": [ + "the size in percent of the costume's own size" + ], + "description": "", "returnDescription": "", - "scratchblock": "go to [mouse-pointer v]", + "scratchblock": "set size to (percentage) %", "since": "" } ], @@ -4819,20 +7197,51 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goToRandomPosition", + "id": "Sprite/setTint", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goToRandomPosition", + "name": "setTint", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Color" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Moves the sprite to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", + "parameterNames": [ + "color" + ], + "parameterDescriptions": [ + "the tint, or null for none" + ], + "description": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", "returnDescription": "", - "scratchblock": "go to [random position v]", + "scratchblock": "", + "since": "" + }, + { + "name": "setTint", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "red", + "green", + "blue" + ], + "parameterDescriptions": [ + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -4841,26 +7250,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goToSprite", + "id": "Sprite/setTransparency", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goToSprite", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double" ], "returns": "void", "parameterNames": [ - "sprite" + "percent" ], "parameterDescriptions": [ - "the sprite to move to" + "0 opaque, 100 invisible" ], - "description": "Moves this sprite to the position of the specified sprite.", + "description": "Scratch's ghost effect.", "returnDescription": "", - "scratchblock": "go to [sprite v]", + "scratchblock": "set [ghost v] effect to (transparency)", "since": "" } ], @@ -4869,20 +7278,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/hide", + "id": "Sprite/setVolume", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "hide", + "name": "setVolume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Hides the sprite. The pen is not effected.", + "parameterNames": [ + "volume" + ], + "parameterDescriptions": [ + "this object's volume from 0 to 100" + ], + "description": "", "returnDescription": "", - "scratchblock": "hide", + "scratchblock": "set volume to (percent) %", "since": "" } ], @@ -4891,26 +7306,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/hideVariable", + "id": "Sprite/setWidth", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "hideVariable", + "name": "setWidth", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "double" ], "returns": "void", "parameterNames": [ - "name" + "width" ], "parameterDescriptions": [ - "the name the monitor was shown with" + "the width in stage pixels; 0 to follow the costume and size again" ], - "description": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", + "description": "Draws the sprite this wide, whatever its costume's width and size: for buttons, panels and\nplatforms. With [setNineSlice(int, int, int, int)](setNineSlice) the corners keep their size.", "returnDescription": "", - "scratchblock": "hide variable [name v]", + "scratchblock": "", "since": "" } ], @@ -4919,20 +7334,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/ifOnEdgeBounce", + "id": "Sprite/setX", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "ifOnEdgeBounce", + "name": "setX", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Checks if the sprite is on the edge of the stage and bounces it back if it\nis. The sprite's\ndirection is reversed when it hits the left or right border, and it is\nreversed and rotated by\n180 degrees when it hits the top or bottom border. The method does nothing if\nthe hitbox is\ndisabled or if the sprite is a UI element. It also does nothing if the\nsprite has not been added to a stage yet.", + "parameterNames": [ + "x" + ], + "parameterDescriptions": [ + "the new x" + ], + "description": "", "returnDescription": "", - "scratchblock": "if on edge, bounce", + "scratchblock": "set x to (x)", "since": "" } ], @@ -4941,20 +7362,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isAsking", + "id": "Sprite/setY", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isAsking", + "name": "setY", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Checks whether a question is on screen and still waiting for an answer.", - "returnDescription": "true while a question is waiting", - "scratchblock": "", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "y" + ], + "parameterDescriptions": [ + "the new y" + ], + "description": "", + "returnDescription": "", + "scratchblock": "set y to (y)", "since": "" } ], @@ -4963,20 +7390,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isClone", + "id": "Sprite/show", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isClone", + "name": "show", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Whether this sprite is a clone, made by [clone()](clone).", - "returnDescription": "true for a clone, false for the original", - "scratchblock": "", + "description": "Shows the sprite.", + "returnDescription": "", + "scratchblock": "show", "since": "" } ], @@ -4985,29 +7412,29 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isColorTouchingColor", + "id": "Sprite/showVariable", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isColorTouchingColor", + "name": "showVariable", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" + "java.lang.String", + "java.util.function.Supplier" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "color", - "other" + "name", + "value" ], "parameterDescriptions": [ - "a colour of this sprite's costume", - "the colour to look for under it" + "the label", + "gives the value to show" ], - "description": "Checks whether a colour of the sprite is touching a colour on the stage:\nonly the parts of the costume painted in `color` count. A car whose\nfront bumper is red can ask whether the bumper touches the grass.\n\n```java\nif (this.isColorTouchingColor(HtmlColor.RED, HtmlColor.GREEN)) {\n this.say(\"Off the road!\");\n}\n```", - "returnDescription": "true if the colour touches the other colour", - "scratchblock": "<color [#ff0000] is touching [#00ff00]?>", + "description": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.\n\n```java\nthis.showVariable(\"score\", () -> this.score);\n```", + "returnDescription": "", + "scratchblock": "show variable [name v]", "since": "" } ], @@ -5016,48 +7443,39 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isGliding", + "id": "Sprite/stamp", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isGliding", + "name": "stamp", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks whether the sprite is still on its way to a place it was told to\nglide to.", - "returnDescription": "true while it is still moving", - "scratchblock": "", + "description": "Stamps the costume onto the canvas of the sprite's pen layer (behind the sprites unless the\npen was moved): a picture of the sprite as it looks now, effects included, that stays.", + "returnDescription": "", + "scratchblock": "stamp", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Sprite/isKeyPressed", - "owner": "org.openpatch.scratch.Sprite", - "signatures": [ + }, { - "name": "isKeyPressed", + "name": "stamp", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.Layer" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "keyCode" + "layer" ], "parameterDescriptions": [ - "a key" + "the layer" ], - "description": "Returns true if the key is pressed", - "returnDescription": "key pressed", - "scratchblock": "<key [space v] pressed?>", + "description": "Stamps the costume onto the canvas of a layer.", + "returnDescription": "", + "scratchblock": "stamp", "since": "" } ], @@ -5066,20 +7484,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isMouseDown", + "id": "Sprite/stopAllSounds", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isMouseDown", + "name": "stopAllSounds", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns true is the mouse button is down", - "returnDescription": "mouse button down", - "scratchblock": "<mouse down?>", + "description": "Stops every sound this object started.", + "returnDescription": "", + "scratchblock": "stop all sounds", "since": "" } ], @@ -5088,25 +7506,25 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isSoundPlaying", + "id": "Sprite/stopSound", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isSoundPlaying", + "name": "stopSound", "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ "name" ], "parameterDescriptions": [ - "Name of the sound" + "the sound to stop" ], - "description": "Returns true if the sound if playing", - "returnDescription": "playing", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -5116,95 +7534,45 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isTouchingColor", + "id": "Sprite/switchCostume", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isTouchingColor", + "name": "switchCostume", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "java.lang.String" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "color" + "name" ], "parameterDescriptions": [ - "the colour to look for" + "the costume's name" ], - "description": "Checks whether the sprite is touching a colour: whether anything it paints\nlies over that colour on the stage - on the backdrop, on what the pen drew,\nor on another sprite.\n\nAs in Scratch, colours that are nearly the same count, so anti-aliased\nedges still match. Only what is under the painted part of the costume\ncounts, not the empty space around it, and not the hitbox.\n\n```java\nif (this.isTouchingColor(HtmlColor.RED)) {\n this.say(\"Ouch!\");\n}\n```\n\nThe time it takes grows with the size of the sprite, not of the stage.", - "returnDescription": "true if the sprite is touching the colour", - "scratchblock": "<touching color [#ff0000]?>", + "description": "Switches to the costume with that name; an unknown name changes nothing.", + "returnDescription": "", + "scratchblock": "switch costume to [name v]", "since": "" }, { - "name": "isTouchingColor", + "name": "switchCostume", "constructor": false, "static": false, "parameters": [ - "double", - "double", "double" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "r", - "g", - "b" + "index" ], "parameterDescriptions": [ - "the red part [0...255]", - "the green part [0...255]", - "the blue part [0...255]" + "the costume's number" ], - "description": "Checks whether the sprite is touching a colour given by its red, green and\nblue parts.", - "returnDescription": "true if the sprite is touching the colour", - "scratchblock": "", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Sprite/isTouchingEdge", - "owner": "org.openpatch.scratch.Sprite", - "signatures": [ - { - "name": "isTouchingEdge", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns true if the rectangle which contains the image is outside of the\nstage", - "returnDescription": "true if outside", - "scratchblock": "<touching [edge v]?>", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Sprite/isTouchingMousePointer", - "owner": "org.openpatch.scratch.Sprite", - "signatures": [ - { - "name": "isTouchingMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns true is the mouse pointer is touching the hitbox of the sprite.", - "returnDescription": "true if touching", - "scratchblock": "<touching [mouse-pointer v]?>", + "description": "Switches to a costume by number, counting from 0; numbers wrap around like Scratch's.", + "returnDescription": "", + "scratchblock": "switch costume to [name v]", "since": "" } ], @@ -5213,45 +7581,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isTouchingSprite", + "id": "Sprite/think", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isTouchingSprite", + "name": "think", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "java.lang.String" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "sprite" + "text" ], "parameterDescriptions": [ - "The sprite to check for collision with." + "what the sprite thinks" ], - "description": "Checks if this sprite is touching another sprite.", - "returnDescription": "true if this sprite is touching the specified sprite, false\n otherwise. Returns false if\n the specified sprite is the same as this sprite, if the stage is\n null, if the specified\n sprite is null, not shown, or has its hitbox disabled.", - "scratchblock": "<touching [sprite v]?>", + "description": "Shows a thought bubble until the sprite thinks something else; an empty text removes it.", + "returnDescription": "", + "scratchblock": "think [text]", "since": "" }, { - "name": "isTouchingSprite", + "name": "think", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "java.lang.String", + "double" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "c" + "text", + "seconds" ], "parameterDescriptions": [ - "the class type of the sprite to check for collision" + "what the sprite thinks", + "how long" ], - "description": "Checks if this sprite is touching any sprite of the specified class type.", - "returnDescription": "true if this sprite is touching any sprite of the specified class\n type, false otherwise", - "scratchblock": "", + "description": "Shows a thought bubble for a number of seconds of game time.", + "returnDescription": "", + "scratchblock": "think [text] for (seconds) seconds", "since": "" } ], @@ -5260,19 +7631,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isVisible", + "id": "Sprite/toString", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isVisible", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns if the sprite is visible", - "returnDescription": "is visible", + "description": "The sprite's centre of the costume on the stage, as Scratch's \"x position\"/\"y position\".", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -5282,11 +7653,11 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/move", + "id": "Sprite/turnLeft", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "move", + "name": "turnLeft", "constructor": false, "static": false, "parameters": [ @@ -5294,33 +7665,14 @@ ], "returns": "void", "parameterNames": [ - "steps" - ], - "parameterDescriptions": [ - "a number of pixels" - ], - "description": "Moves the sprite towards the current rotation by the received steps.", - "returnDescription": "", - "scratchblock": "move (steps) steps", - "since": "" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void", - "parameterNames": [ - "v" + "degrees" ], "parameterDescriptions": [ - "a vector" + "how far to turn anticlockwise" ], - "description": "Moves the sprite in the direction of the given vector. The length of the\nvector determines how\nmove the sprite will move in this direction.", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "turn left (degrees) degrees", "since": "" } ], @@ -5329,20 +7681,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/nextCostume", + "id": "Sprite/turnRight", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "nextCostume", + "name": "turnRight", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Switch to the next costume.", + "parameterNames": [ + "degrees" + ], + "parameterDescriptions": [ + "how far to turn clockwise" + ], + "description": "", "returnDescription": "", - "scratchblock": "next costume", + "scratchblock": "turn right (degrees) degrees", "since": "" } ], @@ -5351,29 +7709,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/pickRandom", + "id": "Sprite/whenAddedToStage", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "pickRandom", + "name": "whenAddedToStage", "constructor": false, "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "int", - "parameterNames": [ - "from", - "to" - ], - "parameterDescriptions": [ - "the lower bound of the range (inclusive)", - "the upper bound of the range (exclusive)" - ], - "description": "Returns a random integer between the specified range.", - "returnDescription": "a random integer between the specified range", - "scratchblock": "(pick random (from) to (to))", + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Called when the sprite was added to a stage. Override it to react.", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -5382,11 +7731,11 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/playSound", + "id": "Sprite/whenBackdropSwitches", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "playSound", + "name": "whenBackdropSwitches", "constructor": false, "static": false, "parameters": [ @@ -5397,11 +7746,11 @@ "name" ], "parameterDescriptions": [ - "the sound name" + "the new backdrop's name" ], - "description": "Plays a sound.\n\nEvery sprite plays its own copy, so ten sprites playing the same sound are\nheard ten times at once. One sprite only plays a sound once at a time:\nplaying it again while it is still going does nothing.", + "description": "Called when the stage switches its backdrop.", "returnDescription": "", - "scratchblock": "start sound [name v]\n\nplaySoundCopy() returns an independent SoundPlayback with its own volume\nand can overlap earlier plays of the same sound.", + "scratchblock": "when backdrop switches to [name v]", "since": "" } ], @@ -5410,29 +7759,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/playSoundCopy", + "id": "Sprite/whenClicked", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "playSoundCopy", + "name": "whenClicked", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "double" - ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "parameterNames": [ - "name", - "volume" - ], - "parameterDescriptions": [ - "a sound already added with addSound()", - "volume from 0 to 100 percent" - ], - "description": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this sprite.\nThe sprite's ordinary volume does not change a copy's explicit volume.", - "returnDescription": "this individual playback, also usable in try-with-resources", - "scratchblock": "", + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Called when this sprite is clicked: a mouse button is pressed over its hitbox, and no sprite\nin front of it is under the pointer.", + "returnDescription": "", + "scratchblock": "when this sprite clicked", "since": "" } ], @@ -5441,45 +7781,54 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/pointInDirection", + "id": "Sprite/whenIReceive", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "pointInDirection", + "name": "whenIReceive", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "degrees" + "message" ], "parameterDescriptions": [ - "The direction in degrees to point the sprite. 0 degrees is up,\n 90 degrees is to the right, 180 degrees is down, and 270\n degrees is to the left." + "the message" ], - "description": "Points the sprite in the specified direction.", + "description": "Called when a message is broadcast.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "when I receive [message v]", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/whenKeyPressed", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ { - "name": "pointInDirection", + "name": "whenKeyPressed", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.KeyCode" ], "returns": "void", "parameterNames": [ - "v" + "key" ], "parameterDescriptions": [ - "the target vector to point towards" + "the key" ], - "description": "Points the sprite in the direction of the given vector.", + "description": "Called when a key is pressed, once per press (holding a key down does not repeat it).", "returnDescription": "", - "scratchblock": "", + "scratchblock": "when [space v] key pressed", "since": "" } ], @@ -5488,20 +7837,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/pointTowardsMousePointer", + "id": "Sprite/whenKeyReleased", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "pointTowardsMousePointer", + "name": "whenKeyReleased", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Points the sprite towards the current position of the mouse pointer. This\nmethod calculates the\nangle between the sprite's current position and the mouse pointer's position,\nthen sets the\nsprite's direction accordingly.", + "parameterNames": [ + "key" + ], + "parameterDescriptions": [ + "the key" + ], + "description": "Called when a key is released.", "returnDescription": "", - "scratchblock": "point towards [mouse-pointer v]", + "scratchblock": "", "since": "" } ], @@ -5510,26 +7865,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/pointTowardsSprite", + "id": "Sprite/whenMouseClicked", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "pointTowardsSprite", + "name": "whenMouseClicked", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "org.openpatch.scratch.MouseCode" ], "returns": "void", "parameterNames": [ - "s" + "button" ], "parameterDescriptions": [ - "the sprite to point towards" + "the button" ], - "description": "Points the current sprite towards the specified sprite.", + "description": "Called when a mouse button is pressed anywhere on the stage.", "returnDescription": "", - "scratchblock": "point towards [sprite v]", + "scratchblock": "", "since": "" } ], @@ -5538,20 +7893,29 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/previousCostume", + "id": "Sprite/whenMouseMoved", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "previousCostume", + "name": "whenMouseMoved", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Switch to the previous costume.", + "parameterNames": [ + "x", + "y" + ], + "parameterDescriptions": [ + "x of the mouse pointer (world)", + "y of the mouse pointer (world)" + ], + "description": "Called when the mouse moves.", "returnDescription": "", - "scratchblock": "switch costume to (previous costume)", + "scratchblock": "", "since": "" } ], @@ -5560,18 +7924,18 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/remove", + "id": "Sprite/whenRemovedFromStage", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "remove", + "name": "whenRemovedFromStage", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Removes this sprite from its current stage. For \"delete this clone\", see\n[deleteThisClone()](deleteThisClone).", + "description": "Called when the sprite was removed from its stage. Override it to react.", "returnDescription": "", "scratchblock": "", "since": "" @@ -5582,20 +7946,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/run", + "id": "Sprite/whenStartsAsClone", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "run", + "name": "whenStartsAsClone", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is intended to be overridden by subclasses to define the behavior\nof the sprite\nwhen it is run. By default, this method does nothing.\n\nIt is called every frame.", + "description": "Called in a new clone, right after it was made.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "when I start as a clone", "since": "" } ], @@ -5604,48 +7968,64 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/say", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/add", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "say", + "name": "add", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Sprite" ], "returns": "void", "parameterNames": [ - "text" + "sprite" ], "parameterDescriptions": [ - "The text to be displayed in the speech bubble." + "the sprite" ], - "description": "Makes the sprite display a speech bubble with the specified text.", + "description": "Adds a sprite, in front of the sprites of its layer. A sprite can only be on one stage; it\nleaves the old one.", "returnDescription": "", - "scratchblock": "say [text]", + "scratchblock": "", "since": "" }, { - "name": "say", + "name": "add", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "int" + "org.openpatch.scratch.Pen" ], "returns": "void", "parameterNames": [ - "text", - "millis" + "pen" + ], + "parameterDescriptions": [ + "the pen" + ], + "description": "Adds a pen of its own.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "add", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Text" + ], + "returns": "void", + "parameterNames": [ + "text" ], "parameterDescriptions": [ - "The message to be displayed.", - "The duration in milliseconds for which the message will be\n displayed." + "the text" ], - "description": "Displays a text message for a specified duration.", + "description": "Adds a text of its own.", "returnDescription": "", - "scratchblock": "say [text] for (millis) seconds", + "scratchblock": "", "since": "" } ], @@ -5654,43 +8034,71 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setDirection", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/addBackdrop", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setDirection", + "name": "addBackdrop", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String", + "java.lang.String" ], "returns": "void", "parameterNames": [ - "degrees" + "name", + "imagePath" ], "parameterDescriptions": [ - "between 0 and 360" + "the backdrop's name", + "the image file" ], - "description": "Sets the direction of the sprite to a given degrees. When this value is 0 the\nsprite moves\nup, when it is 180 it moves down.", + "description": "Adds a backdrop. The first one added is shown.", "returnDescription": "", - "scratchblock": "point in direction (degrees)", + "scratchblock": "", "since": "" }, { - "name": "setDirection", + "name": "addBackdrop", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "v" + "imagePath" ], "parameterDescriptions": [ - "a vector" + "the image file, or a built-in sprite's name" + ], + "description": "Adds a backdrop, named after its file.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "addBackdrop", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String", + "boolean" + ], + "returns": "void", + "parameterNames": [ + "name", + "imagePath", + "stretch" ], - "description": "Sets the direction of the sprite to the direction of a given vector.", + "parameterDescriptions": [ + "the backdrop's name", + "the image file, or a built-in sprite's name", + "whether to stretch it to the stage's size" + ], + "description": "Adds a backdrop, optionally stretched to the stage's size.", "returnDescription": "", "scratchblock": "", "since": "" @@ -5701,43 +8109,46 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setHitbox", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/addSound", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setHitbox", + "name": "addSound", "constructor": false, "static": false, "parameters": [ - "double[]" + "java.lang.String", + "java.lang.String" ], "returns": "void", "parameterNames": [ - "points" + "name", + "soundPath" ], "parameterDescriptions": [ - "an array of integers representing the x and y coordinates of\n the hitbox vertices.\n The length of the array should be even, with each pair of\n integers representing a point (x,\n y)." + "the sound's name, for [playSound(String)](playSound)", + "the sound file" ], - "description": "Sets the hitbox for the sprite using the provided points. The points should\nbe provided in\npairs representing the x and y coordinates.", + "description": "Adds a sound (WAV or OGG).", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "setHitbox", + "name": "addSound", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Shape" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "shape" + "soundPath" ], "parameterDescriptions": [ - "the shape to be used for the hitbox" + "the sound file" ], - "description": "Sets the hitbox for the sprite using the specified shape.", + "description": "Adds a sound, named after its file.", "returnDescription": "", "scratchblock": "", "since": "" @@ -5748,48 +8159,82 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setPosition", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/ask", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setPosition", + "name": "ask", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "x", - "y" + "question" ], "parameterDescriptions": [ - "a x coordinate", - "a y coordinate" + "the question" ], - "description": "Sets the position of the sprite", + "description": "Asks a question in a box along the bottom of the stage, as Scratch does, with a field to type\nthe answer in. Enter or the check button finishes it: then [isAsking()](isAsking) is false and [getAnswer()](getAnswer) has the answer.\nWhile a question is open, keys go to the answer box, not to the stage and its sprites.", "returnDescription": "", - "scratchblock": "go to x: (x) y: (y)", + "scratchblock": "ask [question] and wait", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/broadcast", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "setPosition", + "name": "broadcast", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "message" + ], + "parameterDescriptions": [ + "the message" + ], + "description": "Sends a message to every sprite and then the stage; their `whenIReceive` runs at once.", + "returnDescription": "", + "scratchblock": "broadcast [message v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/changeColorEffect", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ + { + "name": "changeColorEffect", + "constructor": false, + "static": false, + "parameters": [ + "double" ], "returns": "void", "parameterNames": [ - "v" + "by" ], "parameterDescriptions": [ - "a vector" + "how much to change the backdrop's colour effect" ], - "description": "Sets the position of the sprite based on the coordinates of a given vector.", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "change [color v] effect by (by)", "since": "" } ], @@ -5798,29 +8243,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setRotationCenter", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/changeTransparency", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setRotationCenter", + "name": "changeTransparency", "constructor": false, "static": false, "parameters": [ - "double", "double" ], "returns": "void", "parameterNames": [ - "x", - "y" + "by" ], "parameterDescriptions": [ - "the x-coordinate in the costume, from its left edge", - "the y-coordinate in the costume, from its top edge" + "how much to change the backdrop's transparency" ], - "description": "Sets the point of the costume the sprite turns around - Scratch's rotation\ncenter. It is also the point that sits at the sprite's position, so it is\nwhere the pen draws from and what `goTo` puts in place.\n\nThe point is given in the costume's own pixels, counted from its top left\ncorner, the same way as [setHitbox(double...)](setHitbox): a sword whose hilt\nis 12 pixels from the left and 60 from the top swings around the hilt with\n`setRotationCenter(12, 60)`. It grows and shrinks with the sprite's\nsize and holds for every costume of the sprite. Without it, a sprite turns\naround the middle of its costume.\n\n```java\nthis.addCostume(\"hand\", \"assets/clock-hand.png\");\nthis.setRotationCenter(8, 100); // the end of the hand\n```", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "change [ghost v] effect by (step)", "since": "" } ], @@ -5829,26 +8271,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setRotationStyle", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/changeVolume", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setRotationStyle", + "name": "changeVolume", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.RotationStyle" + "double" ], "returns": "void", "parameterNames": [ - "style" + "by" ], "parameterDescriptions": [ - "the rotation style to be set" + "how much to change the volume" ], - "description": "Sets the rotation style for the sprite.", + "description": "", "returnDescription": "", - "scratchblock": "set rotation style [left-right v]", + "scratchblock": "change volume by (step)", "since": "" } ], @@ -5857,26 +8299,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setSize", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/constructor", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setSize", + "name": "Stage", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Stage", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A stage the size of the window.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/count", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ + { + "name": "count", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.Class" ], - "returns": "void", + "returns": "int", "parameterNames": [ - "percentage" + "type" ], "parameterDescriptions": [ - "a percentage [0...100]" + "a class of sprites" ], - "description": "Sets the size of the sprite.", - "returnDescription": "", - "scratchblock": "set size to (percentage) %", + "description": "", + "returnDescription": "how many sprites of that class are on the stage", + "scratchblock": "", "since": "" } ], @@ -5885,70 +8349,76 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setTint", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/debug", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setTint", + "name": "debug", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "java.lang.Object[]" ], "returns": "void", "parameterNames": [ - "c" + "values" ], "parameterDescriptions": [ - "a color object" + "what to print" ], - "description": "Sets the tint for the sprite with an color object.", + "description": "Prints values for debugging, but only while debug mode is on.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/display", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "setTint", + "name": "display", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "r", - "g", - "b" + "text" ], "parameterDescriptions": [ - "a red value [0...255]", - "a green value [0...255]", - "a blue value [0...255]" + "what to show" ], - "description": "Sets the tint for the sprite with rgb.", + "description": "Shows a text in a band along the bottom of the stage until something else is displayed; an\nempty text removes the band.", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "setTint", + "name": "display", "constructor": false, "static": false, "parameters": [ + "java.lang.String", "double" ], "returns": "void", "parameterNames": [ - "h" + "text", + "seconds" ], "parameterDescriptions": [ - "a hue value [0...255]" + "what to show", + "how long" ], - "description": "Sets the tint for the sprite with a hue.", + "description": "Shows a text in a band along the bottom of the stage for a number of seconds of game time.", "returnDescription": "", - "scratchblock": "set [color v] effect to (h)", + "scratchblock": "", "since": "" } ], @@ -5957,26 +8427,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setTransparency", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/eraseAll", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setTransparency", + "name": "eraseAll", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "transparency" - ], - "parameterDescriptions": [ - "[0...100], 0 solid and 100 invisible" - ], - "description": "Sets how see-through the sprite is, as Scratch's ghost effect does: 0 is the\nsolid sprite you start with and 100 is invisible. Anything outside that is\npinned to it.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Erases everything every pen drew and everything stamped, on every layer.", "returnDescription": "", - "scratchblock": "set [ghost v] effect to (transparency)", + "scratchblock": "erase all", "since": "" } ], @@ -5985,54 +8449,80 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setVolume", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/extension", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setVolume", + "name": "extension", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.Class", + "java.util.function.Supplier" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "percent" + "type", + "factory" ], "parameterDescriptions": [ - "0 for silent, 100 for full volume" + "the state's class", + "makes it" ], - "description": "Sets how loud every sound of this sprite plays.", - "returnDescription": "", - "scratchblock": "set volume to (percent) %", + "description": "An extension's state for this stage, made on first use. For extensions, not for learner code.", + "returnDescription": "the stage's one instance", + "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others.", + "missingBrowserSignatures": [ + { + "name": "extension", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class", + "java.util.function.Supplier" + ], + "returns": "T", + "parameterNames": [ + "type", + "factory" + ], + "parameterDescriptions": [ + "the state's class", + "makes it" + ], + "description": "An extension's state for this stage, made on first use. For extensions, not for learner code.", + "returnDescription": "the stage's one instance", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "Sprite/setX", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/find", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setX", + "name": "find", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.Class" ], - "returns": "void", + "returns": "java.util.List", "parameterNames": [ - "x" + "type" ], "parameterDescriptions": [ - "a x coordinate" + "a class of sprites" ], - "description": "Sets the x coordinate", - "returnDescription": "", - "scratchblock": "set x to (x)", + "description": "", + "returnDescription": "every sprite of that class (subclasses included), back to front", + "scratchblock": "", "since": "" } ], @@ -6041,26 +8531,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setY", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getAll", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setY", + "name": "getAll", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "y" - ], - "parameterDescriptions": [ - "a y coordinate" - ], - "description": "Sets the y coordinate", - "returnDescription": "", - "scratchblock": "set y to (y)", + "parameters": [], + "returns": "java.util.List", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "every sprite on the stage, back to front, layer by layer", + "scratchblock": "", "since": "" } ], @@ -6069,20 +8553,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/show", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getAnswer", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "show", + "name": "getAnswer", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Shows the sprite.", - "returnDescription": "", - "scratchblock": "show", + "description": "", + "returnDescription": "the answer to the last question, \"\" before the first", + "scratchblock": "(answer)", "since": "" } ], @@ -6091,29 +8575,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/showVariable", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getCamera", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "showVariable", + "name": "getCamera", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "java.util.function.Supplier" - ], - "returns": "void", - "parameterNames": [ - "name", - "value" - ], - "parameterDescriptions": [ - "the variable's name, shown after the sprite's", - "gives the value to show; asked for it every frame" - ], - "description": "Shows a monitor for one of this sprite's variables in the top left corner\nof the stage, like Scratch's variable monitors: \"Cat: score\" and the\ncurrent value, updated every frame. Showing the same name again replaces\nthe monitor; it goes away with the sprite.\n\n```java\npublic Cat() {\n this.addCostume(\"cat\", \"bunny1_stand\");\n this.showVariable(\"lives\", () -> lives);\n}\n```", - "returnDescription": "", - "scratchblock": "show variable [name v]", + "parameters": [], + "returns": "org.openpatch.scratch.Camera", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage's camera", + "scratchblock": "", "since": "" } ], @@ -6122,38 +8597,41 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/stamp", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getColor", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "stamp", + "name": "getColor", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Color", "parameterNames": [], "parameterDescriptions": [], - "description": "Stamps the current sprite to the background. A stamp is a non interactive\nversion of the sprite.", - "returnDescription": "", - "scratchblock": "stamp", + "description": "", + "returnDescription": "the colour behind the backdrop", + "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/getColorEffect", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "stamp", + "name": "getColorEffect", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Layer" - ], - "returns": "void", - "parameterNames": [ - "layer" - ], - "parameterDescriptions": [ - "which layer to stamp onto" - ], - "description": "Stamps the sprite onto one of the stage's layers. A stamp is a picture of\nthe sprite that stays where it is put, and is not interactive.\n\nExample usage:\n\n```java\nthis.stamp(Layer.UI);\n```", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the backdrop's colour effect", "scratchblock": "", "since": "" } @@ -6163,20 +8641,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/stopAllSounds", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getCurrentBackdropIndex", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "stopAllSounds", + "name": "getCurrentBackdropIndex", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "Stops the playing of all sounds of the sprite.", - "returnDescription": "", - "scratchblock": "stop all sounds", + "description": "", + "returnDescription": "the current backdrop's number, counting from 0", + "scratchblock": "(backdrop [number v])", "since": "" } ], @@ -6185,26 +8663,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/stopSound", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getCurrentBackdropName", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "stopSound", + "name": "getCurrentBackdropName", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "Name of the sound" - ], - "description": "Stops the playing of the sound with the given name", - "returnDescription": "", - "scratchblock": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the current backdrop's name, or null without backdrops", + "scratchblock": "(backdrop [name v])", "since": "" } ], @@ -6213,45 +8685,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/switchCostume", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getHeight", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "switchCostume", - "constructor": false, - "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the name of a costume" - ], - "description": "Switch to a costume by name.", - "returnDescription": "", - "scratchblock": "switch costume to [name v]", - "since": "" - }, - { - "name": "switchCostume", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "index" - ], - "parameterDescriptions": [ - "The index of the costume to switch to." - ], - "description": "Switches the current costume of the sprite to the costume at the specified\nindex.", - "returnDescription": "", - "scratchblock": "switch costume to (index)", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage's height in stage pixels", + "scratchblock": "", "since": "" } ], @@ -6260,48 +8707,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/think", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getMouse", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "think", - "constructor": false, - "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "text" - ], - "parameterDescriptions": [ - "The text to be displayed in the thought bubble." - ], - "description": "Displays a thought bubble with the specified text.", - "returnDescription": "", - "scratchblock": "think [text]", - "since": "" - }, - { - "name": "think", + "name": "getMouse", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "int" - ], - "returns": "void", - "parameterNames": [ - "text", - "millis" - ], - "parameterDescriptions": [ - "The text to be displayed in the thought bubble.", - "The duration in milliseconds for which the thought bubble will\n be displayed." - ], - "description": "Displays a thought bubble with the specified text for a given duration.", - "returnDescription": "", - "scratchblock": "think [text] for (millis) seconds", + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the mouse pointer in world coordinates", + "scratchblock": "", "since": "" } ], @@ -6310,26 +8729,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/turnLeft", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getMouseX", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "turnLeft", + "name": "getMouseX", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "degrees" - ], - "parameterDescriptions": [ - "between 0 and 360" - ], - "description": "Rotates the sprite by a certain degrees to the left.", - "returnDescription": "", - "scratchblock": "turn left (degrees) degrees", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "x of the mouse pointer in world coordinates", + "scratchblock": "(mouse x)", "since": "" } ], @@ -6338,26 +8751,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/turnRight", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getMouseY", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "turnRight", + "name": "getMouseY", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "degrees" - ], - "parameterDescriptions": [ - "between 0 and 360" - ], - "description": "Rotates the sprite by a certain degrees to the right.", - "returnDescription": "", - "scratchblock": "turn right (degrees) degrees", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "y of the mouse pointer in world coordinates", + "scratchblock": "(mouse y)", "since": "" } ], @@ -6366,19 +8773,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenAddedToStage", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getShaders", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenAddedToStage", + "name": "getShaders", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Shaders", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is called when the sprite is added to the stage. Override this\nmethod to define\ncustom behavior when the sprite is added to the stage.", - "returnDescription": "", + "description": "", + "returnDescription": "the stage's shaders, applied to the picture of its world layers", "scratchblock": "", "since": "" } @@ -6388,26 +8795,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenBackdropSwitches", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getTimer", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenBackdropSwitches", + "name": "getTimer", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the name of the backdrop to switch to" - ], - "description": "This method is called when the backdrop switches to the specified name.\nOverride this method to\ndefine custom behavior.", - "returnDescription": "", - "scratchblock": "when backdrop switches to [name v]", + "parameters": [], + "returns": "org.openpatch.scratch.Timer", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "this object's timer, counting game time since it was made or reset", + "scratchblock": "(timer)", "since": "" } ], @@ -6416,20 +8817,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenClicked", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getTransparency", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenClicked", + "name": "getTransparency", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is called when the sprite is clicked. Override this method to\ndefine custom\nbehavior for the sprite when it is clicked.", - "returnDescription": "", - "scratchblock": "when this sprite clicked", + "description": "", + "returnDescription": "the backdrop's transparency in percent", + "scratchblock": "", "since": "" } ], @@ -6438,26 +8839,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenIReceive", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getVolume", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenIReceive", + "name": "getVolume", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "message" - ], - "parameterDescriptions": [ - "The message that is received." - ], - "description": "This method is called when a message is received. Override this method to\ndefine custom\nbehavior.", - "returnDescription": "", - "scratchblock": "when I receive [message v]", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "this object's volume from 0 to 100", + "scratchblock": "(volume)", "since": "" } ], @@ -6466,26 +8861,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenKeyPressed", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getWidth", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenKeyPressed", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void", - "parameterNames": [ - "keyCode" - ], - "parameterDescriptions": [ - "the key that was pressed" - ], - "description": "This method is called when a key is pressed. Override this method to define\ncustom behavior.", - "returnDescription": "", - "scratchblock": "when [space v] key pressed", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage's width in stage pixels", + "scratchblock": "", "since": "" } ], @@ -6494,26 +8883,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenKeyReleased", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/hideVariable", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenKeyReleased", + "name": "hideVariable", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "keyCode" + "name" ], "parameterDescriptions": [ - "the key that was released" + "the label of a variable to hide again" ], - "description": "This method is called when a key is released. Override this method to define\ncustom behavior.", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "hide variable [name v]", "since": "" } ], @@ -6522,25 +8911,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenMouseClicked", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/isAsking", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenMouseClicked", + "name": "isAsking", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.MouseCode" - ], - "returns": "void", - "parameterNames": [ - "mouseCode" - ], - "parameterDescriptions": [ - "The code representing the mouse button that was clicked." - ], - "description": "This method is called when a mouse click event occurs. Override this method\nto define custom\nbehavior.", - "returnDescription": "", + "parameters": [], + "returns": "boolean", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether a question is waiting for its answer", "scratchblock": "", "since": "" } @@ -6550,29 +8933,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenMouseMoved", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/isKeyPressed", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenMouseMoved", + "name": "isKeyPressed", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "org.openpatch.scratch.KeyCode" ], - "returns": "void", + "returns": "boolean", "parameterNames": [ - "x", - "y" + "key" ], "parameterDescriptions": [ - "The x-coordinate of the mouse pointer.", - "The y-coordinate of the mouse pointer." + "a key" ], - "description": "This method is called when the mouse is moved. Override this method to define\ncustom behavior.", - "returnDescription": "", - "scratchblock": "", + "description": "", + "returnDescription": "whether the key is held down", + "scratchblock": "<key [space v] pressed?>", "since": "" } ], @@ -6581,20 +8961,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenRemovedFromStage", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/isMouseDown", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenRemovedFromStage", + "name": "isMouseDown", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is called when the sprite is removed from the stage. Override\nthis method to define\ncustom behavior when the sprite is removed.", - "returnDescription": "", - "scratchblock": "", + "description": "", + "returnDescription": "whether a mouse button is held down", + "scratchblock": "<mouse down?>", "since": "" } ], @@ -6603,20 +8983,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenStartsAsClone", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/isSoundPlaying", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenStartsAsClone", + "name": "isSoundPlaying", "constructor": false, "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Runs when this sprite was just made as a clone, like Scratch's \"when I\nstart as a clone\". Override it to give clones their own behaviour, for\nexample to send a bullet on its way.\n\n```java\npublic void whenStartsAsClone() {\n this.show();\n this.goToRandomPosition();\n}\n```", - "returnDescription": "", - "scratchblock": "when I start as a clone", + "parameters": [ + "java.lang.String" + ], + "returns": "boolean", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "a sound's name" + ], + "description": "", + "returnDescription": "whether it is playing", + "scratchblock": "", "since": "" } ], @@ -6625,64 +9011,79 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/add", + "id": "Stage/nextBackdrop", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "add", + "name": "nextBackdrop", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "sprite" - ], - "parameterDescriptions": [ - "the sprite to add" - ], - "description": "Adds a sprite to the stage. Sprites are drawn in the order they were added, so a sprite added\nlater is drawn on top of one added earlier.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Switches to the next backdrop, after the last to the first.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "next backdrop", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/pickRandom", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "add", + "name": "pickRandom", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Text" + "int", + "int" ], - "returns": "void", + "returns": "int", "parameterNames": [ - "text" + "from", + "to" ], "parameterDescriptions": [ - "a text" + "the lowest", + "the highest" ], - "description": "Add a text object to the stage", - "returnDescription": "", - "scratchblock": "", + "description": "A random whole number between two numbers, both included.", + "returnDescription": "the number", + "scratchblock": "(pick random (from) to (to))", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/playSound", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "add", + "name": "playSound", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Pen" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "pen" + "name" ], "parameterDescriptions": [ - "the Pen object to be added to the stage" + "the sound's name" ], - "description": "Adds a Pen object to the stage.", + "description": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "start sound [name v]", "since": "" } ], @@ -6691,73 +9092,73 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/addBackdrop", + "id": "Stage/playSoundCopy", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "addBackdrop", + "name": "playSoundCopy", "constructor": false, "static": false, "parameters": [ "java.lang.String", - "java.lang.String", - "boolean" + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.SoundPlayback", "parameterNames": [ "name", - "imagePath", - "stretch" + "volume" ], "parameterDescriptions": [ - "a unique name", - "a image path, or the name of a built-in sprite such as\n \"bg_castle\"", - "stretch image to window size" + "the sound's name", + "the copy's volume from 0 to 100" ], - "description": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "returnDescription": "", + "description": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "returnDescription": "the copy, to stop it or change its volume", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/previousBackdrop", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "addBackdrop", + "name": "previousBackdrop", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "java.lang.String" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "name", - "imagePath" - ], - "parameterDescriptions": [ - "a unique name", - "a image path, or the name of a built-in sprite such as\n \"bg_castle\"" - ], - "description": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Switches to the previous backdrop, before the first to the last.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "switch backdrop to [previous backdrop v]", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/randomBackdrop", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "addBackdrop", + "name": "randomBackdrop", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the name of a built-in sprite, for example \"bg_castle\". Add the\n sheet in front of the name, for example \"platformer/grass\", if\n the same name exists on several sheets." - ], - "description": "Add one of the backdrops that ship with Scratch for Java to the stage. The\nbackdrop gets the same name as the built-in sprite. If a backdrop with that\nname already exists do nothing.\n\nExample usage:\n\n```java\nthis.addBackdrop(\"bg_castle\");\n```", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Switches to a random backdrop other than the current one (if there is another).", "returnDescription": "", - "scratchblock": "", + "scratchblock": "switch backdrop to [random backdrop v]", "since": "" } ], @@ -6766,104 +9167,83 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/addSound", + "id": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "addSound", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.Text" ], "returns": "void", "parameterNames": [ - "name", - "soundPath" + "text" ], "parameterDescriptions": [ - "a unique name", - "a sound path, or the name of a built-in sound such as\n \"footstep_carpet_000\"" + "a text of its own to remove" ], - "description": "Add a sound to the stage. If a sound with the received name already exists do\nnothing.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "addSound", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Sprite" ], "returns": "void", "parameterNames": [ - "name" + "sprite" ], "parameterDescriptions": [ - "the name of a built-in sound, for example \"footstep_carpet_000\"" + "the sprite" ], - "description": "Add one of the sounds that ship with Scratch for Java to the stage. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.\n\nExample usage:\n\n```java\nthis.addSound(\"footstep_carpet_000\");\n```", + "description": "Removes a sprite.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/ask", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "ask", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Pen" ], "returns": "void", "parameterNames": [ - "question" + "pen" ], "parameterDescriptions": [ - "the question to show" + "a pen of its own to remove" ], - "description": "Asks a question and waits for an answer to be typed in. A box appears at the\nbottom of the stage; whatever is typed goes into it until Enter is pressed.\n\nUnlike Scratch, this does not pause anything. Your `run()` keeps being\ncalled while the question is on screen, so check [isAsking()](isAsking) or wait\nfor [getAnswer()](getAnswer) to change:\n\n```java\npublic void run() {\n if (!this.isAsking() && this.getAnswer().isEmpty()) {\n this.ask(\"What is your name?\");\n }\n if (!this.getAnswer().isEmpty()) {\n this.display(\"Hello \" + this.getAnswer() + \"!\");\n }\n}\n```", + "description": "", "returnDescription": "", - "scratchblock": "ask [question] and wait", + "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/broadcast", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "broadcast", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "java.lang.Class" ], "returns": "void", "parameterNames": [ - "message" + "type" ], "parameterDescriptions": [ - "The message to broadcast." + "the class" ], - "description": "Broadcasts a message to every sprite on the stage and to the stage itself,\nas in Scratch. Each of them runs its `whenIReceive` method with the\nmessage.", + "description": "Removes every sprite of a class (subclasses included).", "returnDescription": "", - "scratchblock": "broadcast [message v]", + "scratchblock": "", "since": "" } ], @@ -6872,24 +9252,18 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/changeColor", + "id": "Stage/removeAll", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "changeColor", + "name": "removeAll", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "h" - ], - "parameterDescriptions": [ - "a step value" - ], - "description": "Changes the background color by adding a step to the hue value.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Removes every sprite, text and pen: an empty stage (backdrops and what was drawn stay).", "returnDescription": "", "scratchblock": "", "since": "" @@ -6900,26 +9274,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/changeTint", + "id": "Stage/run", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "changeTint", + "name": "run", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "step" - ], - "parameterDescriptions": [ - "a step value" - ], - "description": "Changes the colour the backdrop is tinted with by a step.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Runs every tick before the sprites' `run()`. Override it with the stage's code.", "returnDescription": "", - "scratchblock": "change [color v] effect by (step)", + "scratchblock": "", "since": "" } ], @@ -6928,54 +9296,51 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/changeTransparency", + "id": "Stage/setColor", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "changeTransparency", + "name": "setColor", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "step" + "color" ], "parameterDescriptions": [ - "a step value" + "the colour behind the backdrop" ], - "description": "Changes how see-through the backdrop is by a step. A positive step fades it\nout, a negative one brings it back.", + "description": "", "returnDescription": "", - "scratchblock": "change [ghost v] effect by (step)", + "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/changeVolume", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "changeVolume", + "name": "setColor", "constructor": false, "static": false, "parameters": [ + "double", + "double", "double" ], "returns": "void", "parameterNames": [ - "step" + "red", + "green", + "blue" ], "parameterDescriptions": [ - "how much to add to the volume, in percent" + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" ], - "description": "Makes every sound of this stage louder or quieter.", + "description": "", "returnDescription": "", - "scratchblock": "change volume by (step)", + "scratchblock": "", "since": "" } ], @@ -6984,20 +9349,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/constructor", + "id": "Stage/setColorEffect", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "Stage", - "constructor": true, + "name": "setColorEffect", + "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Constructs a new Stage. A stage is as big as the window it is shown in, so\nthe window has to exist first:\n\n```java\nWindow myWindow = new Window(480, 360);\nmyWindow.setStage(new MyStage());\n```", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "value" + ], + "parameterDescriptions": [ + "the effect" + ], + "description": "Scratch's colour effect on the backdrop: shifts its colours around the colour wheel (200 is\nall the way round). Like Scratch, it gives colours too grey or too dark to show a hue a\nlittle one, so white and black are tinted too.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "set [color v] effect to (value)", "since": "" } ], @@ -7006,52 +9377,49 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/count", + "id": "Stage/setCursor", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "count", + "name": "setCursor", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "java.lang.String" ], - "returns": "int", + "returns": "void", "parameterNames": [ - "c" + "path" ], "parameterDescriptions": [ - "the class of the sprites to count" + "an image file, or a built-in sprite's name" ], - "description": "Returns the number of sprites of the specified class.", - "returnDescription": "the number of sprites of the specified class", + "description": "Shows an image instead of the mouse pointer while the mouse is over the stage.", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/debug", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "debug", + "name": "setCursor", "constructor": false, "static": false, "parameters": [ - "java.lang.Object[]" + "java.lang.String", + "int", + "int" ], "returns": "void", "parameterNames": [ - "values" + "path", + "x", + "y" ], "parameterDescriptions": [ - "one or more values to print" + "an image file, or a built-in sprite's name", + "pixels from the image's left edge to the point that clicks", + "pixels from the image's top edge to the point that clicks" ], - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the stage's class name so you can tell\nwhich stage it came from.\n\nExample:\n\n```java\nthis.debug(\"score =\", score, \"lives =\", lives);\n// prints: [MyStage] score = 5 lives = 3\n```", + "description": "Shows an image instead of the mouse pointer.", "returnDescription": "", "scratchblock": "", "since": "" @@ -7062,48 +9430,54 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/display", + "id": "Stage/setTint", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "display", + "name": "setTint", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "text" + "color" ], "parameterDescriptions": [ - "the text to be displayed" + "the tint, or null for none" ], - "description": "Displays the given text on the stage.", + "description": "Multiplies the backdrop by a colour. Not a Scratch block: Scratch's colour effect is\n[setColorEffect(double)](setColorEffect).", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/setTransparency", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "display", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "int" + "double" ], "returns": "void", "parameterNames": [ - "text", - "millis" + "percent" ], "parameterDescriptions": [ - "The text to be displayed.", - "The duration in milliseconds for which the text will be\n displayed." + "0 opaque, 100 invisible" ], - "description": "Displays the given text on the screen for a specified duration.", + "description": "Scratch's ghost effect on the backdrop: the stage colour shows through.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "set [ghost v] effect to (transparency)", "since": "" } ], @@ -7112,20 +9486,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/eraseAll", + "id": "Stage/setVolume", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "eraseAll", + "name": "setVolume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Erases all lines on the pen layer.", + "parameterNames": [ + "volume" + ], + "parameterDescriptions": [ + "this object's volume from 0 to 100" + ], + "description": "", "returnDescription": "", - "scratchblock": "erase all", + "scratchblock": "set volume to (percent) %", "since": "" } ], @@ -7134,20 +9514,29 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/exit", + "id": "Stage/showVariable", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "exit", + "name": "showVariable", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "java.lang.String", + "java.util.function.Supplier" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Close the window and therefore the whole application.", + "parameterNames": [ + "name", + "value" + ], + "parameterDescriptions": [ + "the label", + "gives the value to show" + ], + "description": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.\n\n```java\nthis.showVariable(\"score\", () -> this.score);\n```", "returnDescription": "", - "scratchblock": "", + "scratchblock": "show variable [name v]", "since": "" } ], @@ -7156,24 +9545,24 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/find", + "id": "Stage/sortBy", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "find", + "name": "sortBy", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "java.util.Comparator" ], - "returns": "java.util.List", + "returns": "void", "parameterNames": [ - "c" + "comparator" ], "parameterDescriptions": [ - "Class" + "the order" ], - "description": "Find sprites of a given class.", + "description": "Draws and runs the sprites of each layer in the order a comparator gives, back to front.", "returnDescription": "", "scratchblock": "", "since": "" @@ -7184,19 +9573,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getAll", + "id": "Stage/sortByY", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getAll", + "name": "sortByY", "constructor": false, "static": false, "parameters": [], - "returns": "java.util.List", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves a list of all sprites in the current stage.", - "returnDescription": "a list containing all sp", + "description": "Draws and runs the sprites of each layer sorted by their y position: lower sprites in front,\nas in a top-down game. Applies from the next tick on, until [stopSorting()](stopSorting).", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7206,20 +9595,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getAnswer", + "id": "Stage/stopAllSounds", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getAnswer", + "name": "stopAllSounds", "constructor": false, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the last answer that was typed in.", - "returnDescription": "the answer, or an empty string if nothing has been answered yet", - "scratchblock": "(answer)", + "description": "Stops every sound this object started.", + "returnDescription": "", + "scratchblock": "stop all sounds", "since": "" } ], @@ -7228,19 +9617,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getCamera", + "id": "Stage/stopSorting", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getCamera", + "name": "stopSorting", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.camera.Camera", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the current camera instance associated with this stage.", - "returnDescription": "the current Camera object.", + "description": "Keeps the order the sprites have now and stops sorting them.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7250,19 +9639,25 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getColor", + "id": "Stage/stopSound", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getColor", + "name": "stopSound", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current color of the stage.", - "returnDescription": "the current color", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the sound to stop" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7272,42 +9667,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getCurrentBackdropIndex", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ - { - "name": "getCurrentBackdropIndex", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current backdrop index", - "returnDescription": "a backdrop index", - "scratchblock": "(backdrop [number v])", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/getCurrentBackdropName", + "id": "Stage/switchBackdrop", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getCurrentBackdropName", + "name": "switchBackdrop", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current backdrop name", - "returnDescription": "a backdrop name", - "scratchblock": "(backdrop [name v])", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the backdrop's name" + ], + "description": "Switches to the backdrop with that name and tells the stage and every sprite\n(`whenBackdropSwitches`); an unknown name changes nothing.", + "returnDescription": "", + "scratchblock": "switch backdrop to [name v]", "since": "" } ], @@ -7316,19 +9695,25 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getDeltaTime", + "id": "Stage/waitSeconds", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getDeltaTime", + "name": "waitSeconds", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Gets the seconds passed since the last frame.", - "returnDescription": "secons since last frame", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "how long" + ], + "description": "Holds up the code that calls it for a number of seconds. Called in `main` (a program\nwritten straight down the page), the game keeps running meanwhile and the seconds are game\ntime. Called in `run()` or an event, the whole game waits, as it does for any slow\ncode; the window stays responsive.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7338,20 +9723,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getFrameRate", + "id": "Stage/waitUntil", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getFrameRate", + "name": "waitUntil", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Get the frame rate of the application.", - "returnDescription": "the frame rate", - "scratchblock": "", + "parameters": [ + "java.util.function.BooleanSupplier" + ], + "returns": "void", + "parameterNames": [ + "condition" + ], + "parameterDescriptions": [ + "checked about every millisecond" + ], + "description": "Holds up the code that calls it until a condition is true; see [waitSeconds(double)](waitSeconds).", + "returnDescription": "", + "scratchblock": "wait until <condition>", "since": "" } ], @@ -7360,19 +9751,25 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getHeight", + "id": "Stage/whenBackdropSwitches", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getHeight", + "name": "whenBackdropSwitches", "constructor": false, "static": false, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "returnDescription": "the height of the sprite", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the new backdrop's name" + ], + "description": "Called when the backdrop switches.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7382,20 +9779,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getMouse", + "id": "Stage/whenIReceive", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getMouse", + "name": "whenIReceive", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current position of the mouse cursor as a Vector2", - "returnDescription": "mouse position", - "scratchblock": "", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "message" + ], + "parameterDescriptions": [ + "the message" + ], + "description": "Called when a message is broadcast.", + "returnDescription": "", + "scratchblock": "when I receive [message v]", "since": "" } ], @@ -7404,20 +9807,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getMouseX", + "id": "Stage/whenKeyPressed", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getMouseX", + "name": "whenKeyPressed", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current x-position of the mouse cursor", - "returnDescription": "x-position", - "scratchblock": "(mouse x)", + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "void", + "parameterNames": [ + "key" + ], + "parameterDescriptions": [ + "the key" + ], + "description": "Called when a key is pressed, once per press.", + "returnDescription": "", + "scratchblock": "when [space v] key pressed", "since": "" } ], @@ -7426,20 +9835,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getMouseY", + "id": "Stage/whenKeyReleased", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getMouseY", + "name": "whenKeyReleased", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current y-position of the mouse cursor", - "returnDescription": "y-position", - "scratchblock": "(mouse y)", + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "void", + "parameterNames": [ + "key" + ], + "parameterDescriptions": [ + "the key" + ], + "description": "Called when a key is released.", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -7448,41 +9863,53 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getPixels", + "id": "Stage/whenMouseClicked", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getPixels", + "name": "whenMouseClicked", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.pixels.Pixels", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the colours of everything this stage has drawn.\n\nExample usage:\n\n```java\nint[] colours = this.getPixels().main();\n```", - "returnDescription": "the pixels", - "scratchblock": "", + "parameters": [ + "org.openpatch.scratch.MouseCode" + ], + "returns": "void", + "parameterNames": [ + "button" + ], + "parameterDescriptions": [ + "the button" + ], + "description": "Called when a mouse button is pressed anywhere on the stage.", + "returnDescription": "", + "scratchblock": "when stage clicked", "since": "" } ], - "status": "desktop-only", - "reason": "The desktop pixel buffer is not exposed by the browser renderer.", + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "Stage/getShaders", + "id": "Stage/whenMouseWheelMoved", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getShaders", + "name": "whenMouseWheelMoved", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the shaders of this stage. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.\n\nExample usage:\n\n```java\nthis.getShaders().add(\"blur\", \"blur.frag\", null);\nthis.getShaders().switchTo(\"blur\");\n```\n\nSeveral shaders can be active at once with `activate`: the stage\ndraws with each in turn, in the order they were added.", - "returnDescription": "the shaders", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "steps" + ], + "parameterDescriptions": [ + "notches; positive is towards the user" + ], + "description": "Called when the mouse wheel turns.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7492,19 +9919,28 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getSorting", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/addFont", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getSorting", + "name": "addFont", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.sorting.Sorting", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the order in which the sprites of this stage are drawn.\n\nExample usage:\n\n```java\nthis.getSorting().byY();\n```", - "returnDescription": "the sorting", + "parameters": [ + "java.lang.String", + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name", + "path" + ], + "parameterDescriptions": [ + "the font's name", + "the TTF or OTF file" + ], + "description": "Adds a font this text can switch to; the first one added is used.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7514,38 +9950,78 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getTimer", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/constructor", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getTimer", - "constructor": false, + "name": "Text", + "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Timer", + "returns": "org.openpatch.scratch.Text", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the timer", - "returnDescription": "the timer", - "scratchblock": "(timer)", + "description": "An empty plain text at (0, 0).", + "returnDescription": "", + "scratchblock": "", "since": "" }, { - "name": "getTimer", - "constructor": false, + "name": "Text", + "constructor": true, "static": false, "parameters": [ - "java.lang.String" + "java.lang.String", + "double", + "double", + "double" ], - "returns": "org.openpatch.scratch.Timer", + "returns": "org.openpatch.scratch.Text", "parameterNames": [ - "name" + "text", + "x", + "y", + "width" ], "parameterDescriptions": [ - "a name" + "what it says", + "x of its position", + "y of its position (the first line's baseline)", + "where lines wrap; 0 for no wrapping" ], - "description": "Returns a timer by name", - "returnDescription": "the timer", + "description": "A plain text.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "Text", + "constructor": true, + "static": false, + "parameters": [ + "java.lang.String", + "double", + "double", + "double", + "org.openpatch.scratch.TextStyle" + ], + "returns": "org.openpatch.scratch.Text", + "parameterNames": [ + "text", + "x", + "y", + "width", + "style" + ], + "parameterDescriptions": [ + "what it says", + "x of its position", + "y of its position: the first baseline for plain text, the bottom edge of a box", + "where lines wrap; 0 for no wrapping", + "plain, box, speech or thought bubble" + ], + "description": "A text in a style.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7555,20 +10031,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getVolume", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getAlign", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getVolume", + "name": "getAlign", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "org.openpatch.scratch.TextAlign", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns how loud the sounds of this stage play.", - "returnDescription": "the volume, from 0 to 100", - "scratchblock": "(volume)", + "description": "", + "returnDescription": "the alignment", + "scratchblock": "", "since": "" } ], @@ -7577,19 +10053,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getWidth", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getCurrentFontIndex", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getWidth", + "name": "getCurrentFontIndex", "constructor": false, "static": false, "parameters": [], "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "returnDescription": "the width of the sprite", + "description": "", + "returnDescription": "the number of the font in use, counting from 0; -1 for the default font", "scratchblock": "", "since": "" } @@ -7599,26 +10075,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/hideVariable", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getCurrentFontName", + "owner": "org.openpatch.scratch.Text", "signatures": [ - { - "name": "hideVariable", - "constructor": false, - "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the name the monitor was shown with" - ], - "description": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "returnDescription": "", - "scratchblock": "hide variable [name v]", + { + "name": "getCurrentFontName", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the name of the font in use, or null for the default font", + "scratchblock": "", "since": "" } ], @@ -7627,19 +10097,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/isAsking", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getDefaultFont", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "isAsking", + "name": "getDefaultFont", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "boolean", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks whether a question is on screen and still waiting for an answer.", - "returnDescription": "true while a question is waiting", + "description": "", + "returnDescription": "the default font file", "scratchblock": "", "since": "" } @@ -7649,19 +10119,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/isDebug", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getDefaultFontSize", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "isDebug", + "name": "getDefaultFontSize", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "boolean", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks if the application is in debug mode.", - "returnDescription": "true if the application is in debug mode, false otherwise.", + "description": "", + "returnDescription": "the default font size", "scratchblock": "", "since": "" } @@ -7671,26 +10141,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/isKeyPressed", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getFont", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "isKeyPressed", + "name": "getFont", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "boolean", - "parameterNames": [ - "keyCode" - ], - "parameterDescriptions": [ - "a key" - ], - "description": "Returns true if the key is pressed", - "returnDescription": "key pressed", - "scratchblock": "<key [space v] pressed?>", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the font file, or null for the default font", + "scratchblock": "", "since": "" } ], @@ -7699,20 +10163,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/isMouseDown", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getLayer", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "isMouseDown", + "name": "getLayer", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "org.openpatch.scratch.Layer", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns true is the mouse button is down", - "returnDescription": "mouse button down", - "scratchblock": "<mouse down?>", + "description": "", + "returnDescription": "the layer", + "scratchblock": "", "since": "" } ], @@ -7721,25 +10185,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/isSoundPlaying", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getPosition", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "isSoundPlaying", + "name": "getPosition", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "boolean", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "" - ], - "description": "Returns true if the sound if playing", - "returnDescription": "playing", + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the position", "scratchblock": "", "since": "" } @@ -7749,20 +10207,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/nextBackdrop", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getStage", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "nextBackdrop", + "name": "getStage", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Stage", "parameterNames": [], "parameterDescriptions": [], - "description": "Switch to the next backdrop.", - "returnDescription": "", - "scratchblock": "next backdrop", + "description": "", + "returnDescription": "the stage the text is on (a sprite's text: the sprite's stage), or null", + "scratchblock": "", "since": "" } ], @@ -7771,29 +10229,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/pickRandom", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getStyle", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "pickRandom", + "name": "getStyle", "constructor": false, "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "int", - "parameterNames": [ - "from", - "to" - ], - "parameterDescriptions": [ - "the lower bound of the range (inclusive)", - "the upper bound of the range (inclusive)" - ], - "description": "Returns a random integer between the specified range (inclusive).", - "returnDescription": "a random integer between `from` and `to` (inclusive)", - "scratchblock": "(pick random (from) to (to))", + "parameters": [], + "returns": "org.openpatch.scratch.TextStyle", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the style", + "scratchblock": "", "since": "" } ], @@ -7802,26 +10251,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/playSound", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getText", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "playSound", + "name": "getText", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the sound name" - ], - "description": "Plays a sound.\n\nplaySoundCopy() returns an independent SoundPlayback with its own volume\nand can overlap earlier plays of the same sound.", - "returnDescription": "", - "scratchblock": "start sound [name v]", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "what the text says", + "scratchblock": "", "since": "" } ], @@ -7830,28 +10273,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/playSoundCopy", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getTextSize", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "playSoundCopy", + "name": "getTextSize", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "double" - ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "parameterNames": [ - "name", - "volume" - ], - "parameterDescriptions": [ - "a sound already added with addSound()", - "volume from 0 to 100 percent" - ], - "description": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this stage.\nThe stage's ordinary volume does not change a copy's explicit volume.", - "returnDescription": "this individual playback, also usable in try-with-resources", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the font size, or the default", "scratchblock": "", "since": "" } @@ -7861,20 +10295,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/previousBackdrop", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getWidth", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "previousBackdrop", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Switch to the previous backdrop.", - "returnDescription": "", - "scratchblock": "switch backdrop to [previous backdrop v]", + "description": "", + "returnDescription": "where lines wrap; 0 for no wrapping", + "scratchblock": "", "since": "" } ], @@ -7883,20 +10317,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/randomBackdrop", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getX", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "randomBackdrop", + "name": "getX", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Switch to a random backdrop.", - "returnDescription": "", - "scratchblock": "switch backdrop to [random backdrop v]", + "description": "", + "returnDescription": "x of the position", + "scratchblock": "", "since": "" } ], @@ -7905,83 +10339,76 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/remove", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getY", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void", - "parameterNames": [ - "sprite" - ], - "parameterDescriptions": [ - "the sprite to be removed" - ], - "description": "Removes the specified sprite from the stage.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "remove", + "name": "getY", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Pen" - ], - "returns": "void", - "parameterNames": [ - "pen" - ], - "parameterDescriptions": [ - "the pen to be removed" - ], - "description": "Removes the specified pen from the stage.", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "y of the position", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/goLayersBackwards", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "remove", + "name": "goLayersBackwards", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Text" + "int" ], "returns": "void", "parameterNames": [ - "text" + "number" ], "parameterDescriptions": [ - "the text to be removed" + "how many texts to move behind" ], - "description": "Removes the specified text from the stage.", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "go [backward v] (number) layers", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/goLayersForwards", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "remove", + "name": "goLayersForwards", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "int" ], "returns": "void", "parameterNames": [ - "c" + "number" ], "parameterDescriptions": [ - "the class of the sprites to remove" + "how many texts to move in front of" ], - "description": "Removes all sprites of the specified class from the stage.", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "go [forward v] (number) layers", "since": "" } ], @@ -7990,20 +10417,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/removeAll", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/goToBackLayer", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "removeAll", + "name": "goToBackLayer", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Removes all elements from the stage.", + "description": "Draws this text behind the other texts.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "go to [back v] layer", "since": "" } ], @@ -8012,20 +10439,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/run", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/goToFrontLayer", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "run", + "name": "goToFrontLayer", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Executes the main logic of the stage. This method should be overridden by\nsubclasses to define\nthe specific behavior of the stage.", + "description": "Draws this text in front of the other texts.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "go to [front v] layer", "since": "" } ], @@ -8034,69 +10461,41 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setColor", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/hide", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setColor", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "h" - ], - "parameterDescriptions": [ - "a hue value [0...255]" - ], - "description": "Sets the background color via a hue value", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "setColor", + "name": "hide", "constructor": false, "static": false, - "parameters": [ - "double", - "double", - "double" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "r", - "g", - "b" - ], - "parameterDescriptions": [ - "a red value [0...255]", - "a green value [0...255]", - "a blue value [0...255]" - ], - "description": "Sets the background color via a rgb value", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Hides the text.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/isVisible", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "setColor", + "name": "isVisible", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void", - "parameterNames": [ - "c" - ], - "parameterDescriptions": [ - "the new color to be set" - ], - "description": "Sets the color of the stage.", - "returnDescription": "", + "parameters": [], + "returns": "boolean", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether the text is shown", "scratchblock": "", "since": "" } @@ -8106,49 +10505,40 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setCursor", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/nextFont", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setCursor", + "name": "nextFont", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "path" - ], - "parameterDescriptions": [ - "a path to an image file, or the name of a built-in sprite" - ], - "description": "Sets the cursor image for the stage.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Switches to the next font added, after the last to the first.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/remove", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "setCursor", + "name": "remove", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "int", - "int" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "path", - "x", - "y" - ], - "parameterDescriptions": [ - "a path to an image file, or the name of a built-in sprite", - "the x-coordinate of the cursor's active spot", - "the y-coordinate of the cursor's active spot" - ], - "description": "Sets the cursor image and its active spot coordinates.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Removes the text from its stage.", "returnDescription": "", "scratchblock": "", "since": "" @@ -8159,24 +10549,24 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setDebug", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setAlign", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setDebug", + "name": "setAlign", "constructor": false, "static": false, "parameters": [ - "boolean" + "org.openpatch.scratch.TextAlign" ], "returns": "void", "parameterNames": [ - "debug" + "align" ], "parameterDescriptions": [ - "a boolean value where `true` enables debug mode and\n `false` disables\n it." + "how lines sit relative to the position" ], - "description": "Enables or disables the debug mode for the application.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -8187,51 +10577,51 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setTint", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setBackgroundColor", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setTint", + "name": "setBackgroundColor", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "r", - "g", - "b" + "color" ], "parameterDescriptions": [ - "a red value [0...255]", - "a green value [0...255]", - "a blue value [0...255]" + "the fill of a box or bubble" ], - "description": "Sets the colour the backdrop is tinted with.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "setTint", + "name": "setBackgroundColor", "constructor": false, "static": false, "parameters": [ + "double", + "double", "double" ], "returns": "void", "parameterNames": [ - "h" + "red", + "green", + "blue" ], "parameterDescriptions": [ - "" + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" ], - "description": "Sets the colour the backdrop is tinted with, as a hue.", + "description": "", "returnDescription": "", - "scratchblock": "set [color v] effect to (h)", + "scratchblock": "", "since": "" } ], @@ -8240,26 +10630,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setTransparency", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setFont", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setTransparency", + "name": "setFont", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "transparency" + "path" ], "parameterDescriptions": [ - "[0...100], 0 solid and 100 invisible" + "the font file for this text, or null for the default font" ], - "description": "Sets how see-through the backdrop is, as Scratch's ghost effect does: 0 is\nthe solid backdrop you start with and 100 is invisible.", + "description": "", "returnDescription": "", - "scratchblock": "set [ghost v] effect to (transparency)", + "scratchblock": "", "since": "" } ], @@ -8268,26 +10658,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setVolume", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setLayer", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setVolume", + "name": "setLayer", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Layer" ], "returns": "void", "parameterNames": [ - "percent" + "layer" ], "parameterDescriptions": [ - "0 for silent, 100 for full volume" + "the layer" ], - "description": "Sets how loud every sound of this stage plays.", + "description": "Moves the text to another layer: [Layer.UI](../Layer/UI) keeps it in place when the camera moves;\nany other layer puts it into the world, in front of the foreground.", "returnDescription": "", - "scratchblock": "set volume to (percent) %", + "scratchblock": "", "since": "" } ], @@ -8296,77 +10686,46 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/showVariable", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setPosition", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "showVariable", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.util.function.Supplier" + "double", + "double" ], "returns": "void", "parameterNames": [ - "name", - "value" + "x", + "y" ], "parameterDescriptions": [ - "what the monitor says", - "gives the value to show; asked for it every frame" + "x of the position", + "y of the position" ], - "description": "Shows a monitor for a variable in the top left corner of the stage, like\nScratch's variable monitors: the name and the current value, updated every\nframe. Showing the same name again replaces the monitor.\n\n```java\nthis.showVariable(\"score\", () -> score);\n```", - "returnDescription": "", - "scratchblock": "show variable [name v]", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/stopAllSounds", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ - { - "name": "stopAllSounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Stops the playing of all sounds of the stage.", + "description": "", "returnDescription": "", - "scratchblock": "stop all sounds", + "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/stopSound", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "stopSound", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Vector2" ], "returns": "void", "parameterNames": [ - "name" + "position" ], "parameterDescriptions": [ - "Name of the sound" + "the position" ], - "description": "Stops the playing of the sound with the given name", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -8377,54 +10736,51 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/switchBackdrop", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setStrokeColor", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "switchBackdrop", + "name": "setStrokeColor", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "name" + "color" ], "parameterDescriptions": [ - "the name of a backdrop" + "the outline of a box or bubble" ], - "description": "Switch to a backdrop by name.", + "description": "", "returnDescription": "", - "scratchblock": "switch backdrop to [name v]", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/wait", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + "scratchblock": "", + "since": "" + }, { - "name": "wait", + "name": "setStrokeColor", "constructor": false, "static": false, "parameters": [ - "int" + "double", + "double", + "double" ], "returns": "void", "parameterNames": [ - "millis" + "red", + "green", + "blue" ], "parameterDescriptions": [ - "Milliseconds" + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" ], - "description": "Stop the execution of the whole applications for the given milliseconds.", + "description": "", "returnDescription": "", - "scratchblock": "wait (millis) seconds", + "scratchblock": "", "since": "" } ], @@ -8433,26 +10789,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/waitUntil", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setStyle", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "waitUntil", + "name": "setStyle", "constructor": false, "static": false, "parameters": [ - "java.util.function.BooleanSupplier" + "org.openpatch.scratch.TextStyle" ], "returns": "void", "parameterNames": [ - "condition" + "style" ], "parameterDescriptions": [ - "checked over and over until it is true" + "plain, box, speech or thought bubble" ], - "description": "Waits until something becomes true, then carries on.\n\nLike [wait(int)](wait) this holds up the code that calls it, not the whole\nprogram: sprites keep running and the stage keeps drawing while it waits.\nThat makes it useful for setting a scene up in a constructor, and a bad idea\ninside `run()`, which is called once per frame and should return quickly.\n\n```java\nthis.ask(\"What is your name?\");\nthis.waitUntil(() -> !this.isAsking());\nthis.display(\"Hello \" + this.getAnswer() + \"!\");\n```", + "description": "", "returnDescription": "", - "scratchblock": "wait until <condition>", + "scratchblock": "", "since": "" } ], @@ -8461,54 +10817,51 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/whenBackdropSwitches", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setTextColor", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "whenBackdropSwitches", + "name": "setTextColor", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "name" + "color" ], "parameterDescriptions": [ - "the name of the backdrop to switch to" + "the colour of the letters" ], - "description": "This method is called when the backdrop switches to the specified name.\nOverride this method to\nadd custom behavior.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/whenIReceive", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "whenIReceive", + "name": "setTextColor", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "double", + "double", + "double" ], "returns": "void", "parameterNames": [ - "message" + "red", + "green", + "blue" ], "parameterDescriptions": [ - "The message that triggers this method." + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" ], - "description": "This method is called when a specific message is received. Override this\nmethod to add custom\nbehavior.", + "description": "", "returnDescription": "", - "scratchblock": "when I receive [message v]", + "scratchblock": "", "since": "" } ], @@ -8517,26 +10870,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/whenKeyPressed", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setTextSize", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "whenKeyPressed", + "name": "setTextSize", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double" ], "returns": "void", "parameterNames": [ - "keyCode" + "size" ], "parameterDescriptions": [ - "the key that was pressed" + "the font size in stage units (in pixel-art mode rounded to whole font pixels when\n drawn)" ], - "description": "This method is called when a key is pressed. Override this method to add\ncustom behavior.", + "description": "", "returnDescription": "", - "scratchblock": "when [space v] key pressed", + "scratchblock": "", "since": "" } ], @@ -8545,24 +10898,24 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/whenKeyReleased", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setWidth", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "whenKeyReleased", + "name": "setWidth", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double" ], "returns": "void", "parameterNames": [ - "keyCode" + "width" ], "parameterDescriptions": [ - "the key that was released" + "where lines wrap, in stage units; 0 for no wrapping" ], - "description": "This method is called when a key is released. Override this method to add\ncustom behavior.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -8573,26 +10926,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/whenMouseClicked", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setX", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "whenMouseClicked", + "name": "setX", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.MouseCode" + "double" ], "returns": "void", "parameterNames": [ - "mouseEvent" + "x" ], "parameterDescriptions": [ - "The mouse event that triggered this method." + "x of the position" ], - "description": "This method is called when a mouse click event occurs. Overwrite this method\nto add custom\nbehavior.", + "description": "", "returnDescription": "", - "scratchblock": "when stage clicked", + "scratchblock": "", "since": "" } ], @@ -8601,24 +10954,24 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/whenMouseWheelMoved", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setY", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "whenMouseWheelMoved", + "name": "setY", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], "returns": "void", "parameterNames": [ - "steps" + "y" ], "parameterDescriptions": [ - "the number of steps the mouse wheel has moved. Positive values\n indicate movement\n away from the user, while negative values indicate movement\n towards the user." + "y of the position" ], - "description": "This method is called when the mouse wheel is moved. Overwrite this method to\nadd custom\nbehavior.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -8629,27 +10982,18 @@ "missingBrowserSignatures": [] }, { - "id": "Text/addFont", + "id": "Text/show", "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "addFont", + "name": "show", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "java.lang.String" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "name", - "path" - ], - "parameterDescriptions": [ - "the name of the font to be added", - "the path to the font file" - ], - "description": "Adds a new font to the list of fonts if it does not already exist.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Shows the text.", "returnDescription": "", "scratchblock": "", "since": "" @@ -8660,138 +11004,125 @@ "missingBrowserSignatures": [] }, { - "id": "Text/constructor", + "id": "Text/showText", "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "Text", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Text", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Constructs a new Text object with default values. The text is initialized to an empty string,\npositioned at (0, 0), with a default size of 0. The text style is set to plain and the text\nis centred on its position, as every text is. Call [setAlign(TextAlign)](setAlign) for anything\nelse.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "Text", - "constructor": true, + "name": "showText", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "java.lang.String" ], - "returns": "org.openpatch.scratch.Text", + "returns": "void", "parameterNames": [ - "s" + "text" ], "parameterDescriptions": [ - "the Sprite to associate with this Text object" + "what it says; an empty text hides a bubble" ], - "description": "Constructs a new Text object associated with a given Sprite.", + "description": "Shows the text with new words until it is changed or hidden.", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "Text", - "constructor": true, + "name": "showText", + "constructor": false, "static": false, "parameters": [ "java.lang.String", - "double", - "double", "double" ], - "returns": "org.openpatch.scratch.Text", + "returns": "void", "parameterNames": [ "text", - "x", - "y", - "width" + "seconds" ], "parameterDescriptions": [ - "the text to be displayed", - "the x-coordinate of the text's position", - "the y-coordinate of the text's position", - "the width of the text" + "what it says", + "how long" ], - "description": "Constructs a new Text object with the specified text, position, and width.", + "description": "Shows the text for a number of seconds of game time, then hides it.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/switchFont", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "Text", - "constructor": true, + "name": "switchFont", + "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double", - "double", - "double", - "org.openpatch.scratch.TextStyle" + "java.lang.String" ], - "returns": "org.openpatch.scratch.Text", + "returns": "void", "parameterNames": [ - "text", - "x", - "y", - "width", - "style" + "name" ], "parameterDescriptions": [ - "the text content to be displayed", - "the x-coordinate of the text's position", - "the y-coordinate of the text's position", - "the width of the text area", - "the style to be applied to the text" + "the name of a font added with [addFont(String, String)](addFont)" ], - "description": "Constructs a new Text object with the specified text, position, width, and style.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/useFont", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "Text", - "constructor": true, - "static": false, + "name": "useFont", + "constructor": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Text" + "java.lang.String" ], - "returns": "org.openpatch.scratch.Text", + "returns": "void", "parameterNames": [ - "t" + "path" ], "parameterDescriptions": [ - "the Text object to copy" + "a TTF or OTF file" ], - "description": "Copy constructor for the Text class. Creates a new Text object by copying the properties of the\ngiven Text object.", + "description": "The font every text uses unless it sets its own, from now on. Without it, texts use Ubuntu\nMono, or Jersey 10 in pixel-art mode.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Text/getAlign", - "owner": "org.openpatch.scratch.Text", - "signatures": [ + }, { - "name": "getAlign", + "name": "useFont", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.TextAlign", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns where the text sits relative to its position.", - "returnDescription": "the alignment", + "static": true, + "parameters": [ + "java.lang.String", + "double" + ], + "returns": "void", + "parameterNames": [ + "path", + "pixelSize" + ], + "parameterDescriptions": [ + "a TTF or OTF file", + "the size at which one font pixel is one stage pixel" + ], + "description": "A pixel font as default font, with the size at which one of its pixels is one stage pixel:\nfor a pixel font whose outlines do not show its grid (most do: then [useFont(String)](useFont)\nis enough). In pixel-art mode sizes are rounded to whole pixels of it.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -8801,19 +11132,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getCurrentFontIndex", + "id": "Text/whenAddedToStage", "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getCurrentFontIndex", + "name": "whenAddedToStage", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the index of the current font.", - "returnDescription": "the index of the current font", + "description": "Called when the text was added to a stage.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -8823,19 +11154,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getCurrentFontName", + "id": "Text/whenRemovedFromStage", "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getCurrentFontName", + "name": "whenRemovedFromStage", "constructor": false, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the name of the current font.", - "returnDescription": "the name of the current font, or `null` if no fonts are available.", + "description": "Called when the text was removed from its stage.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -8845,19 +11176,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getDefaultFont", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/after", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getDefaultFont", + "name": "after", "constructor": false, - "static": true, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the font that text is written in by default.", - "returnDescription": "the path to the font file", + "static": false, + "parameters": [ + "double" + ], + "returns": "boolean", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "how long to wait" + ], + "description": "False for a number of seconds from the first call on, true afterwards.", + "returnDescription": "whether that time is over", "scratchblock": "", "since": "" } @@ -8867,19 +11204,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getDefaultFontSize", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/constructor", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getDefaultFontSize", - "constructor": false, - "static": true, + "name": "Timer", + "constructor": true, + "static": false, "parameters": [], - "returns": "int", + "returns": "org.openpatch.scratch.Timer", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the size text is written in by default.", - "returnDescription": "the font size", + "description": "A timer starting now.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -8889,19 +11226,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getFont", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/during", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getFont", + "name": "during", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Retrieves the name of the font.", - "returnDescription": "the name of the font as a String.", + "parameters": [ + "double" + ], + "returns": "boolean", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "how long" + ], + "description": "True for a number of seconds from the first call on, false afterwards.", + "returnDescription": "whether that time is still running", "scratchblock": "", "since": "" } @@ -8911,19 +11254,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getPosition", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/every", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getPosition", + "name": "every", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Retrieves the current position as a Vector2 object.", - "returnDescription": "a Vector2 object representing the current x and y coordinates.", + "parameters": [ + "double" + ], + "returns": "boolean", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "the period" + ], + "description": "True once every number of seconds: the first time that many seconds after the first call,\nthen again each time as many seconds have passed.", + "returnDescription": "whether the period is over", "scratchblock": "", "since": "" } @@ -8933,19 +11282,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getStage", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/getSeconds", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getStage", + "name": "getSeconds", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Stage", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the current stage associated with this object.", - "returnDescription": "the current stage", + "description": "", + "returnDescription": "the seconds of game time since the timer started or was reset", "scratchblock": "", "since": "" } @@ -8955,19 +11304,47 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getStyle", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/interval", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getStyle", + "name": "interval", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.TextStyle", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the style the text is drawn in.", - "returnDescription": "the style, never null", + "parameters": [ + "double" + ], + "returns": "boolean", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "how long each phase lasts" + ], + "description": "Alternates: true for a number of seconds, then false for as long, and so on.", + "returnDescription": "whether it is in an \"on\" phase", + "scratchblock": "", + "since": "" + }, + { + "name": "interval", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double" + ], + "returns": "boolean", + "parameterNames": [ + "on", + "off" + ], + "parameterDescriptions": [ + "how long it is true", + "how long it is false" + ], + "description": "Alternates: true for `on` seconds, then false for `off` seconds, and so on.", + "returnDescription": "whether it is in an \"on\" phase", "scratchblock": "", "since": "" } @@ -8977,20 +11354,20 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getTextSize", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/reset", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getTextSize", + "name": "reset", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the size of the text.", - "returnDescription": "the size of the text as an integer", - "scratchblock": "", + "description": "Starts the timer again from 0, and every method below with it.", + "returnDescription": "", + "scratchblock": "reset timer", "since": "" } ], @@ -8999,19 +11376,33 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getWidth", - "owner": "org.openpatch.scratch.Text", + "id": "Transition/constructor", + "owner": "org.openpatch.scratch.Transition", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Transition/fromShader", + "owner": "org.openpatch.scratch.Transition", "signatures": [ { - "name": "getWidth", + "name": "fromShader", "constructor": false, - "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the width of the text.", - "returnDescription": "the width of the text as a double", + "static": true, + "parameters": [ + "java.lang.String" + ], + "returns": "org.openpatch.scratch.Transition", + "parameterNames": [ + "path" + ], + "parameterDescriptions": [ + "the file with the body" + ], + "description": "A transition of your own: a shader body with `from`, `to` (the two pictures),\n`progress` (0 to 1), `uv` and `color`.", + "returnDescription": "the transition", "scratchblock": "", "since": "" } @@ -9021,19 +11412,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getX", - "owner": "org.openpatch.scratch.Text", + "id": "Transition/getName", + "owner": "org.openpatch.scratch.Transition", "signatures": [ { - "name": "getX", + "name": "getName", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the x-coordinate of this object.", - "returnDescription": "the x-coordinate as a double", + "description": "", + "returnDescription": "the built-in name or the shader file", "scratchblock": "", "since": "" } @@ -9043,19 +11434,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getY", - "owner": "org.openpatch.scratch.Text", + "id": "Transition/toString", + "owner": "org.openpatch.scratch.Transition", "signatures": [ { - "name": "getY", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the y-coordinate of this object.", - "returnDescription": "the y-coordinate as a double", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -9065,26 +11456,41 @@ "missingBrowserSignatures": [] }, { - "id": "Text/goLayersBackwards", - "owner": "org.openpatch.scratch.Text", + "id": "Triangle/constructor", + "owner": "org.openpatch.scratch.Triangle", "signatures": [ { - "name": "goLayersBackwards", - "constructor": false, + "name": "Triangle", + "constructor": true, "static": false, "parameters": [ - "int" + "double", + "double", + "double", + "double", + "double", + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Triangle", "parameterNames": [ - "number" + "x1", + "y1", + "x2", + "y2", + "x3", + "y3" ], "parameterDescriptions": [ - "the number of layers to move the text backwards" + "x of the first corner", + "y of the first corner", + "x of the second corner", + "y of the second corner", + "x of the third corner", + "y of the third corner" ], - "description": "Moves the text backwards by a specified number of layers in the stage. If\nthe text is not on a stage, the method does nothing.", + "description": "", "returnDescription": "", - "scratchblock": "go [backward v] (number) layers", + "scratchblock": "", "since": "" } ], @@ -9093,26 +11499,26 @@ "missingBrowserSignatures": [] }, { - "id": "Text/goLayersForwards", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/add", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "goLayersForwards", + "name": "add", "constructor": false, "static": false, "parameters": [ - "int" + "org.openpatch.scratch.Vector2" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "number" + "v" ], "parameterDescriptions": [ - "the number of layers to move the text forward" + "" ], - "description": "Moves the text forward by a specified number of layers within its stage. If\nthe text is not on a stage, the method does nothing.", - "returnDescription": "", - "scratchblock": "go [forward v] (number) layers", + "description": "Adds another vector and returns the result", + "returnDescription": "the sum", + "scratchblock": "", "since": "" } ], @@ -9121,20 +11527,20 @@ "missingBrowserSignatures": [] }, { - "id": "Text/goToBackLayer", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/angle", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "goToBackLayer", + "name": "angle", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Moves this text to the back layer of the stage, behind every other text on\nit. If the text is not on a stage, the method does nothing.\n\nTexts are drawn on top of the sprites, so this orders a text against the\nother texts rather than against the sprites.", - "returnDescription": "", - "scratchblock": "go to [back v] layer", + "description": "Returns the angle of the vector.", + "returnDescription": "the angle", + "scratchblock": "", "since": "" } ], @@ -9143,20 +11549,20 @@ "missingBrowserSignatures": [] }, { - "id": "Text/goToFrontLayer", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/clone", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "goToFrontLayer", + "name": "clone", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [], "parameterDescriptions": [], - "description": "Moves this text to the front layer of the stage, in front of every other\ntext on it. If the text is not on a stage, the method does nothing.\n\nTexts are drawn on top of the sprites, so this orders a text against the\nother texts rather than against the sprites.", - "returnDescription": "", - "scratchblock": "go to [front v] layer", + "description": "Creates a clone of the vector", + "returnDescription": "the cloned vector", + "scratchblock": "", "since": "" } ], @@ -9165,40 +11571,59 @@ "missingBrowserSignatures": [] }, { - "id": "Text/isUI", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/constructor", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "isUI", - "constructor": false, + "name": "Vector2", + "constructor": true, "static": false, "parameters": [], - "returns": "boolean", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks if the current instance is a UI element.", - "returnDescription": "`true` if this instance is a UI element, `false` otherwise.", + "description": "Constructor for the null vector.", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Text/nextFont", - "owner": "org.openpatch.scratch.Text", - "signatures": [ + }, { - "name": "nextFont", - "constructor": false, + "name": "Vector2", + "constructor": true, + "static": false, + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [ + "x", + "y" + ], + "parameterDescriptions": [ + "x-coordinate", + "y-coordinate" + ], + "description": "Constructor for a 2D vector.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "Vector2", + "constructor": true, "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Advances to the next font in the list of available fonts. The current font index is incremented\nby one and wraps around to the beginning of the list if it exceeds the number of available\nfonts.", + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [ + "v" + ], + "parameterDescriptions": [ + "a vector" + ], + "description": "Copy constructor for copying a vector.", "returnDescription": "", "scratchblock": "", "since": "" @@ -9209,19 +11634,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/remove", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/direction", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "remove", + "name": "direction", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Removes this object from its current stage if it is associated with one. If the object is not\nassociated with any stage, this method does nothing.", - "returnDescription": "", + "description": "Returns the direction of the vector in Scratch's degrees: 0 points up, 90 to the right, 180\ndown and 270 to the left, the way `setDirection` on a sprite counts. [angle()](angle)\ncounts the mathematical way instead (0 to the right, anticlockwise).", + "returnDescription": "the direction in degrees between 0 (inclusive) and 360 (exclusive)", "scratchblock": "", "since": "" } @@ -9231,25 +11656,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setAlign", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/distance", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setAlign", + "name": "distance", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.TextAlign" + "org.openpatch.scratch.Vector2" ], - "returns": "void", + "returns": "double", "parameterNames": [ - "align" + "v" ], "parameterDescriptions": [ - "where the text should sit relative to its position" + "a vector" ], - "description": "Sets the alignment of the text.", - "returnDescription": "", + "description": "Calculates the distance to another vector.", + "returnDescription": "the distance", "scratchblock": "", "since": "" } @@ -9259,69 +11684,53 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setBackgroundColor", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/distanceSq", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setBackgroundColor", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int", - "int" - ], - "returns": "void", - "parameterNames": [ - "r", - "g", - "b" - ], - "parameterDescriptions": [ - "the red component of the color (0-255)", - "the green component of the color (0-255)", - "the blue component of the color (0-255)" - ], - "description": "Sets the background color using the specified RGB values.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "setBackgroundColor", + "name": "distanceSq", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Vector2" ], - "returns": "void", + "returns": "double", "parameterNames": [ - "h" + "v" ], "parameterDescriptions": [ - "the hue value for the background color" + "a vector" ], - "description": "Sets the background color using the specified hue value.", - "returnDescription": "", + "description": "Calculates the squared distance to another vector.", + "returnDescription": "the squared distance", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/dot", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setBackgroundColor", + "name": "dot", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "org.openpatch.scratch.Vector2" ], - "returns": "void", + "returns": "double", "parameterNames": [ - "c" + "v" ], "parameterDescriptions": [ - "the new background color to be set" + "a vector" ], - "description": "Sets the background color of the text.", - "returnDescription": "", + "description": "Calculates the dot product.", + "returnDescription": "the dot product", "scratchblock": "", "since": "" } @@ -9331,25 +11740,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setFont", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/equals", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setFont", + "name": "equals", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "java.lang.Object" ], - "returns": "void", + "returns": "boolean", "parameterNames": [ - "name" + "obj" ], "parameterDescriptions": [ - "the name of the font to be set" + "the object to compare with" ], - "description": "Sets the font name for the text.", - "returnDescription": "", + "description": "Compares this vector with another object.", + "returnDescription": "true if the other object is a vector with the same x- and y-coordinate", "scratchblock": "", "since": "" } @@ -9359,25 +11768,28 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setIsUI", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/fromPolar", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setIsUI", + "name": "fromPolar", "constructor": false, - "static": false, + "static": true, "parameters": [ - "boolean" + "double", + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "isUI" + "magnitude", + "angle" ], "parameterDescriptions": [ - "a boolean indicating whether this object is part of the UI" + "of the vector", + "of the vector" ], - "description": "Sets the UI status of this object.", - "returnDescription": "", + "description": "Constructor method for constructing a vector based on polar coordinates.", + "returnDescription": "a vector", "scratchblock": "", "since": "" } @@ -9387,47 +11799,41 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setPosition", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/getX", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setPosition", + "name": "getX", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void", - "parameterNames": [ - "x", - "y" - ], - "parameterDescriptions": [ - "a x coordinate", - "a y coordinate" - ], - "description": "Sets the position of the text", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the x coordinate of the vector", + "returnDescription": "the x coordinate", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/getY", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setPosition", + "name": "getY", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "the Vector2 object containing the x and y coordinates" - ], - "description": "Sets the position of the text object using a Vector2 object.", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the y coordinate of the vector", + "returnDescription": "the y coordinate", "scratchblock": "", "since": "" } @@ -9437,69 +11843,63 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setStrokeColor", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/hashCode", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setStrokeColor", + "name": "hashCode", "constructor": false, "static": false, - "parameters": [ - "int", - "int", - "int" - ], - "returns": "void", - "parameterNames": [ - "r", - "g", - "b" - ], - "parameterDescriptions": [ - "the red component of the color (0-255)", - "the green component of the color (0-255)", - "the blue component of the color (0-255)" - ], - "description": "Sets the stroke color using the specified RGB values.", - "returnDescription": "", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the hash code of the vector. Vectors that are equal have the same hash code, which is\nwhat lets them be used as keys in a `HashMap`.", + "returnDescription": "the hash code of the vector", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/length", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setStrokeColor", + "name": "length", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "h" - ], - "parameterDescriptions": [ - "the hue value for the stroke color" - ], - "description": "Sets the stroke color using the specified hue value.", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Calculates the length of the vector.", + "returnDescription": "the length of the vector", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/lengthSq", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setStrokeColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void", - "parameterNames": [ - "c" - ], - "parameterDescriptions": [ - "the color to set as the stroke color" - ], - "description": "Sets the stroke color for the text.", - "returnDescription": "", + "name": "lengthSq", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Calculates the squared length of the vector.", + "returnDescription": "the squared length of the vector", "scratchblock": "", "since": "" } @@ -9509,25 +11909,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setStyle", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/multiply", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setStyle", + "name": "multiply", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.TextStyle" + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "style" + "scalar" ], "parameterDescriptions": [ - "the TextStyle to be applied to the text" + "a scalar" ], - "description": "Sets the style of the text.", - "returnDescription": "", + "description": "Multiplies a scalar and return the result.", + "returnDescription": "the vector", "scratchblock": "", "since": "" } @@ -9537,69 +11937,69 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setTextColor", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/normalVector", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setTextColor", + "name": "normalVector", "constructor": false, "static": false, - "parameters": [ - "int", - "int", - "int" - ], - "returns": "void", - "parameterNames": [ - "r", - "g", - "b" - ], - "parameterDescriptions": [ - "the red component of the color (0-255)", - "the green component of the color (0-255)", - "the blue component of the color (0-255)" - ], - "description": "Sets the text color using RGB values.", - "returnDescription": "", + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the normal vector, which is perpendicular to the vector.", + "returnDescription": "a normal vector", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/reverse", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setTextColor", + "name": "reverse", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "h" - ], - "parameterDescriptions": [ - "the hue value for the text color" - ], - "description": "Sets the text color using the specified hue value.", - "returnDescription": "", + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Reverses a vector and returns the result.", + "returnDescription": "the reversed vector", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/rotateBy", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setTextColor", + "name": "rotateBy", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "c" + "angle" ], "parameterDescriptions": [ - "the new color to be set for the text" + "an angle between [0, ..., 360]" ], - "description": "Sets the color of the text.", - "returnDescription": "", + "description": "Rotates the vector by an angle and returns the result.", + "returnDescription": "the rotated vector", "scratchblock": "", "since": "" } @@ -9609,25 +12009,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setTextSize", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/rotateTo", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setTextSize", + "name": "rotateTo", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "size" + "angle" ], "parameterDescriptions": [ - "the new size of the text" + "an angle between [0,...,360]" ], - "description": "Sets the size of the text.", - "returnDescription": "", + "description": "Rotates the vector to a given angle and returns the result.", + "returnDescription": "the rotated vector", "scratchblock": "", "since": "" } @@ -9637,25 +12037,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setWidth", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/sub", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setWidth", + "name": "sub", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Vector2" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "width" + "v" ], "parameterDescriptions": [ - "the new width to set" + "" ], - "description": "Sets the width of the text.", - "returnDescription": "", + "description": "Substracts another vector and returns the result", + "returnDescription": "the difference", "scratchblock": "", "since": "" } @@ -9665,25 +12065,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setX", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/toString", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setX", + "name": "toString", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "x" - ], - "parameterDescriptions": [ - "the new x-coordinate value" - ], - "description": "Sets the x-coordinate for this object.", - "returnDescription": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the vector as a text, for example `Vector2[60.0, 80.0]`.", + "returnDescription": "the vector as a text", "scratchblock": "", "since": "" } @@ -9693,25 +12087,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setY", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/unitVector", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setY", + "name": "unitVector", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "y" - ], - "parameterDescriptions": [ - "the new Y coordinate value" - ], - "description": "Sets the Y coordinate of the text.", - "returnDescription": "", + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the unit vector.", + "returnDescription": "a unit vector", "scratchblock": "", "since": "" } @@ -9721,124 +12109,112 @@ "missingBrowserSignatures": [] }, { - "id": "Text/showText", - "owner": "org.openpatch.scratch.Text", + "id": "Window/constructor", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "showText", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "text" - ], - "parameterDescriptions": [ - "The text to be displayed. If the text is null or empty, the text will be set to\n null." - ], - "description": "Displays the specified text.", + "parameters": [], + "returns": "org.openpatch.scratch.Window", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A window of 480 × 360, Scratch's stage size.", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "showText", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, "parameters": [ - "java.lang.String", - "int" + "java.lang.String" ], - "returns": "void", + "returns": "org.openpatch.scratch.Window", "parameterNames": [ - "text", - "millis" + "assets" ], "parameterDescriptions": [ - "The text to be displayed.", - "The duration in milliseconds for which the text should be displayed." + "the folder, e.g. `\"assets\"`" ], - "description": "Displays the specified text for a given duration.", + "description": "A window of 480 × 360 that loads every image, sound and font in a folder before the first\nframe, showing a loading screen.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Text/switchFont", - "owner": "org.openpatch.scratch.Text", - "signatures": [ + }, { - "name": "switchFont", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, "parameters": [ - "java.lang.String" + "int", + "int" ], - "returns": "void", + "returns": "org.openpatch.scratch.Window", "parameterNames": [ - "name" + "width", + "height" ], "parameterDescriptions": [ - "the name of the font to switch to" + "the stage width", + "the stage height" ], - "description": "Switches the current font to the font with the specified name.", + "description": "A window whose stage has this size in stage pixels. The window opens at that size (in pixel\nart at the largest whole multiple that fits the screen) and scales the stage to fit when it\nis resized.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Text/useFont", - "owner": "org.openpatch.scratch.Text", - "signatures": [ + }, { - "name": "useFont", - "constructor": false, - "static": true, + "name": "Window", + "constructor": true, + "static": false, "parameters": [ - "java.lang.String", - "int" + "int", + "int", + "java.lang.String" ], - "returns": "void", - "parameterNames": [ - "path", - "size" + "returns": "org.openpatch.scratch.Window", + "parameterNames": [ + "width", + "height", + "assets" ], "parameterDescriptions": [ - "the path to a .ttf or .otf file", - "the size to write in" + "the stage width", + "the stage height", + "the folder, or null" ], - "description": "Chooses the font all text is written in, and how big it is.\n\nCall it before the first stage is created. The font is loaded while the\nwindow starts up, so choosing one later is not reliable.\n\n```java\npublic static void main(String[] args) {\n Text.useFont(\"assets/Retro Gaming.ttf\", 11);\n new MyStage();\n}\n```", + "description": "A window of a size that loads a folder of assets first.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/debug", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "useFont", + "name": "debug", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String" + "java.lang.Object[]" ], "returns": "void", "parameterNames": [ - "path" + "values" ], "parameterDescriptions": [ - "the path to a .ttf or .otf file" + "what to print" ], - "description": "Chooses the font all text is written in, keeping the current size.", + "description": "Prints values, but only in debug mode.", "returnDescription": "", "scratchblock": "", "since": "" @@ -9849,24 +12225,18 @@ "missingBrowserSignatures": [] }, { - "id": "Text/useFontSizes", - "owner": "org.openpatch.scratch.Text", + "id": "Window/exit", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "useFontSizes", + "name": "exit", "constructor": false, - "static": true, - "parameters": [ - "int[]" - ], + "static": false, + "parameters": [], "returns": "void", - "parameterNames": [ - "sizes" - ], - "parameterDescriptions": [ - "the sizes to prepare" - ], - "description": "Prepares several sizes of the font in advance. Only needed when text is\nshown at more than one size, so that every size looks sharp.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Ends the program: [whenExits()](whenExits) runs first.", "returnDescription": "", "scratchblock": "", "since": "" @@ -9877,25 +12247,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/useSmoothing", - "owner": "org.openpatch.scratch.Text", + "id": "Window/getFrameSmoothing", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "useSmoothing", + "name": "getFrameSmoothing", "constructor": false, "static": true, - "parameters": [ - "boolean" - ], - "returns": "void", - "parameterNames": [ - "smooth" - ], - "parameterDescriptions": [ - "true to smooth the letters" - ], - "description": "Chooses whether letters are smoothed. Turn it off for pixel fonts.", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the frame smoothing in percent, 0 when off", "scratchblock": "", "since": "" } @@ -9905,38 +12269,41 @@ "missingBrowserSignatures": [] }, { - "id": "Text/whenAddedToStage", - "owner": "org.openpatch.scratch.Text", + "id": "Window/getGameSpeed", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "whenAddedToStage", + "name": "getGameSpeed", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is called when the object is added to the stage. Override this method to define\ncustom behavior when the object is added to the stage.", - "returnDescription": "", + "description": "", + "returnDescription": "the game speed", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/getHeight", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "whenAddedToStage", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void", - "parameterNames": [ - "stage" - ], - "parameterDescriptions": [ - "The stage to which the text is added." - ], - "description": "This method is called when the text is added to the stage. Override this method to define\ncustom behavior when the text.", - "returnDescription": "", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage height in stage pixels", "scratchblock": "", "since": "" } @@ -9946,38 +12313,41 @@ "missingBrowserSignatures": [] }, { - "id": "Text/whenRemovedFromStage", - "owner": "org.openpatch.scratch.Text", + "id": "Window/getInstance", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "whenRemovedFromStage", + "name": "getInstance", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Window", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is called when the object is removed from the stage. Override this method to define\ncustom behavior that should occur when the object is no longer part of the stage.", - "returnDescription": "", + "description": "", + "returnDescription": "the window, or null before it was created", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/getLibraryTitle", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "whenRemovedFromStage", + "name": "getLibraryTitle", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void", - "parameterNames": [ - "stage" - ], - "parameterDescriptions": [ - "The stage from which the text is removed." - ], - "description": "This method is called when the text is removed from the stage. Override this method to define\ncustom behavior that should occur.", - "returnDescription": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "\"Scratch for Java\"", "scratchblock": "", "since": "" } @@ -9987,25 +12357,19 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/afterMillis", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/getLibraryVersion", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "afterMillis", + "name": "getLibraryVersion", "constructor": false, "static": false, - "parameters": [ - "int" - ], - "returns": "boolean", - "parameterNames": [ - "millis" - ], - "parameterDescriptions": [ - "the number of milliseconds to check against" - ], - "description": "Checks if the specified number of milliseconds has passed since the method was first called.", - "returnDescription": "true if the specified number of milliseconds has passed since the method was first\n called, false otherwise", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the version of Scratch for Java, e.g. \"7.0.0\"", "scratchblock": "", "since": "" } @@ -10015,19 +12379,19 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/constructor", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/getStage", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "Timer", - "constructor": true, + "name": "getStage", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Timer", + "returns": "org.openpatch.scratch.Stage", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructs a new Timer object.", - "returnDescription": "", + "description": "", + "returnDescription": "the stage shown", "scratchblock": "", "since": "" } @@ -10037,25 +12401,19 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/everyMillis", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/getWidth", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "everyMillis", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "int" - ], - "returns": "boolean", - "parameterNames": [ - "millis" - ], - "parameterDescriptions": [ - "The number of milliseconds to wait before returning true." - ], - "description": "Checks if the specified number of milliseconds has passed since the last time this method\nreturned true.", - "returnDescription": "true if the specified number of milliseconds has passed since the last call that\n returned true, false otherwise.", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage width in stage pixels", "scratchblock": "", "since": "" } @@ -10065,25 +12423,19 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/forMillis", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/isDebug", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "forMillis", + "name": "isDebug", "constructor": false, "static": false, - "parameters": [ - "int" - ], + "parameters": [], "returns": "boolean", - "parameterNames": [ - "millis" - ], - "parameterDescriptions": [ - "the number of milliseconds to check against" - ], - "description": "Checks if the specified amount of milliseconds has passed since the method was first called. If\nthe method is called for the first time, it initializes the start time.", - "returnDescription": "true if the current time is less than the start time plus the specified milliseconds,\n false otherwise", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether debug mode is on", "scratchblock": "", "since": "" } @@ -10093,94 +12445,85 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/isPaused", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "intervalMillis", + "name": "isPaused", "constructor": false, "static": false, - "parameters": [ - "int" - ], + "parameters": [], "returns": "boolean", - "parameterNames": [ - "millis" - ], - "parameterDescriptions": [ - "the interval in milliseconds to check" - ], - "description": "Checks if the specified interval in milliseconds has passed.", - "returnDescription": "true if the interval has passed, false otherwise", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether the game is paused", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/isPixelArt", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "intervalMillis", + "name": "isPixelArt", "constructor": false, - "static": false, - "parameters": [ - "int", - "boolean" - ], + "static": true, + "parameters": [], "returns": "boolean", - "parameterNames": [ - "millis", - "skipFirst" - ], - "parameterDescriptions": [ - "the interval in milliseconds to check", - "if true, the first interval will be skipped" - ], - "description": "Checks if the specified interval in milliseconds has passed.", - "returnDescription": "true if the interval has passed, false otherwise", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether pixel-art mode is on", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/isSmoothPixelArt", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "intervalMillis", + "name": "isSmoothPixelArt", "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], + "static": true, + "parameters": [], "returns": "boolean", - "parameterNames": [ - "millis1", - "millis2" - ], - "parameterDescriptions": [ - "the first interval in milliseconds to check", - "the second interval in milliseconds to check" - ], - "description": "Checks if the specified interval in milliseconds has passed.", - "returnDescription": "true if the interval has passed, false otherwise", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether the pixel art scrolls smoothly (see [useSmoothPixelArt()](useSmoothPixelArt))", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/isTransitioning", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "intervalMillis", + "name": "isTransitioning", "constructor": false, "static": false, - "parameters": [ - "int", - "int", - "boolean" - ], + "parameters": [], "returns": "boolean", - "parameterNames": [ - "millis1", - "millis2", - "skipFirst" - ], - "parameterDescriptions": [ - "the first interval in milliseconds to check", - "the second interval in milliseconds to check", - "if true, the first interval will be skipped" - ], - "description": "Checks if the specified interval in milliseconds has passed.", - "returnDescription": "true if the interval has passed, false otherwise", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether a transition is in progress", "scratchblock": "", "since": "" } @@ -10190,20 +12533,20 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/millis", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/pause", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "millis", + "name": "pause", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "int", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the number of milliseconds of game time since the program started.\nGame time stands still while the game is paused and runs slower or faster\nwith the game speed (see [Window.pause()](../Window/pause) and\n[Window.setGameSpeed(double)](../Window/setGameSpeed)); without either, it is the real time.", - "returnDescription": "the milliseconds of game time since the program started", - "scratchblock": "(timer)", + "description": "Pauses the game: no ticks run; keys and the mouse still reach the stage and sprites.", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -10212,20 +12555,20 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/reset", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/resume", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "reset", + "name": "resume", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Resets the timer.", + "description": "Goes on after [pause()](pause).", "returnDescription": "", - "scratchblock": "reset timer", + "scratchblock": "", "since": "" } ], @@ -10234,39 +12577,24 @@ "missingBrowserSignatures": [] }, { - "id": "Triangle/constructor", - "owner": "org.openpatch.scratch.Triangle", + "id": "Window/setDebug", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "Triangle", - "constructor": true, + "name": "setDebug", + "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double", - "double", - "double", - "double" + "boolean" ], - "returns": "org.openpatch.scratch.Triangle", + "returns": "void", "parameterNames": [ - "x1", - "y1", - "x2", - "y2", - "x3", - "y3" + "debug" ], "parameterDescriptions": [ - "the x-coordinate of the first vertex", - "the y-coordinate of the first vertex", - "the x-coordinate of the second vertex", - "the y-coordinate of the second vertex", - "the x-coordinate of the third vertex", - "the y-coordinate of the third vertex" + "on or off" ], - "description": "Creates a triangle with the specified vertices.", + "description": "Debug mode shows what its panel in the bottom right corner has ticked: hitboxes, positions,\nthe mouse and camera, touching pairs, hidden sprites, the clones and the frame rate, and it\nlets `debug(\\u2026)` print. F12 switches it too, and `-Dscratch4j.debug=\\u2026` presets\nwhich options are on.", "returnDescription": "", "scratchblock": "", "since": "" @@ -10277,11 +12605,11 @@ "missingBrowserSignatures": [] }, { - "id": "UISprite/changeHeight", - "owner": "org.openpatch.scratch.UISprite", + "id": "Window/setGameSpeed", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "changeHeight", + "name": "setGameSpeed", "constructor": false, "static": false, "parameters": [ @@ -10289,12 +12617,12 @@ ], "returns": "void", "parameterNames": [ - "amount" + "speed" ], "parameterDescriptions": [ - "how many pixels to add to the height" + "the game speed" ], - "description": "Changes the height of the sprite by the given number of pixels.", + "description": "How fast the game runs: 1 is normal, 2 twice as fast, 0.5 half as fast; up to 8. Each tick\nstill is 1/60 s of game time; there are more or fewer of them per second.", "returnDescription": "", "scratchblock": "", "since": "" @@ -10305,24 +12633,24 @@ "missingBrowserSignatures": [] }, { - "id": "UISprite/changeWidth", - "owner": "org.openpatch.scratch.UISprite", + "id": "Window/setStage", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "changeWidth", + "name": "setStage", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Stage" ], "returns": "void", "parameterNames": [ - "amount" + "stage" ], "parameterDescriptions": [ - "how many pixels to add to the width" + "the stage" ], - "description": "Changes the width of the sprite by the given number of pixels.", + "description": "Shows a stage from the next tick on.", "returnDescription": "", "scratchblock": "", "since": "" @@ -10333,18 +12661,18 @@ "missingBrowserSignatures": [] }, { - "id": "UISprite/constructor", - "owner": "org.openpatch.scratch.UISprite", + "id": "Window/step", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "UISprite", - "constructor": true, + "name": "step", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.UISprite", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates a sprite that is drawn as part of the user interface.", + "description": "While paused: runs exactly one tick.", "returnDescription": "", "scratchblock": "", "since": "" @@ -10355,83 +12683,74 @@ "missingBrowserSignatures": [] }, { - "id": "UISprite/disableNineSlice", - "owner": "org.openpatch.scratch.UISprite", + "id": "Window/transitionToStage", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "disableNineSlice", + "name": "transitionToStage", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Stage", + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Lets the whole costume stretch again.", + "parameterNames": [ + "stage", + "seconds" + ], + "parameterDescriptions": [ + "the stage", + "how long" + ], + "description": "Fades to a stage through black.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "UISprite/setHeight", - "owner": "org.openpatch.scratch.UISprite", - "signatures": [ + }, { - "name": "setHeight", + "name": "transitionToStage", "constructor": false, "static": false, "parameters": [ + "java.util.function.Supplier", "double" ], "returns": "void", "parameterNames": [ - "height" + "stage", + "seconds" ], "parameterDescriptions": [ - "the height in pixels" + "makes the stage, e.g. `() -> new Level2()`", + "how long" ], - "description": "Sets the height of the sprite in pixels.", + "description": "Fades to a stage made now, on the game thread: a slow constructor shows the loading screen\ninstead of freezing the window.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "UISprite/setNineSlice", - "owner": "org.openpatch.scratch.UISprite", - "signatures": [ + }, { - "name": "setNineSlice", + "name": "transitionToStage", "constructor": false, "static": false, "parameters": [ - "int", - "int", - "int", - "int" + "java.util.function.Supplier", + "org.openpatch.scratch.Transition", + "double" ], "returns": "void", "parameterNames": [ - "top", - "right", - "bottom", - "left" + "stage", + "transition", + "seconds" ], "parameterDescriptions": [ - "how many pixels of the costume belong to the top edge", - "how many pixels of the costume belong to the right edge", - "how many pixels of the costume belong to the bottom edge", - "how many pixels of the costume belong to the left edge" + "makes the stage", + "how", + "how long" ], - "description": "Keeps the corners and edges of the costume from stretching when the sprite\nis resized, so that a button costume can be made any size.", + "description": "Shows a stage made now through a transition.\n\n```java\nwindow.transitionToStage(() -> new Level2(), Transition.SLIDE_LEFT, 0.5);\n```", "returnDescription": "", "scratchblock": "", "since": "" @@ -10442,53 +12761,73 @@ "missingBrowserSignatures": [] }, { - "id": "UISprite/setWidth", - "owner": "org.openpatch.scratch.UISprite", + "id": "Window/use", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "setWidth", + "name": "use", "constructor": false, - "static": false, + "static": true, "parameters": [ - "double" + "org.openpatch.scratch.extension.Extension" ], "returns": "void", "parameterNames": [ - "width" + "extension" ], "parameterDescriptions": [ - "the width in pixels" + "the extension" ], - "description": "Sets the width of the sprite in pixels.", + "description": "Uses an extension that does not register itself through `META-INF/services` (one in\nyour own project). Call it before `new Window`.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "Extensions load through the desktop's ServiceLoader and run against its window and render threads. The browser ships its extensions natively; it does not load external or custom extensions.", + "missingBrowserSignatures": [ + { + "name": "use", + "constructor": false, + "static": true, + "parameters": [ + "org.openpatch.scratch.extension.Extension" + ], + "returns": "void", + "parameterNames": [ + "extension" + ], + "parameterDescriptions": [ + "the extension" + ], + "description": "Uses an extension that does not register itself through `META-INF/services` (one in\nyour own project). Call it before `new Window`.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "Vector2/add", - "owner": "org.openpatch.scratch.Vector2", + "id": "Window/useFrameSmoothing", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "add", + "name": "useFrameSmoothing", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Vector2" + "double" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "v" + "percent" ], "parameterDescriptions": [ - "" + "how much of the previous frame each presented one keeps, 0 to 100" ], - "description": "Adds another vector and returns the result", - "returnDescription": "the sum", + "description": "Frame smoothing: each frame is presented mixed with the one before it, this much in percent.\nA screen that holds each frame until the next (every 60 Hz LCD) smears whatever moves,\nbecause the eye gets one picture per 16.7 ms; two pictures per frame (50 is a good value)\nlook like one picture per 8.3 ms and smear about half as much. The world keeps its pixels:\nthe moment nothing moves, current and previous frame are the same and the picture is fully\nsharp. While things move, edges are softer \\u2014 that is the trade. Call it before\n`new Window`; 0 (the default) turns it off.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10498,19 +12837,41 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/angle", - "owner": "org.openpatch.scratch.Vector2", + "id": "Window/useFullScreen", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "angle", + "name": "useFullScreen", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "double", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the angle of the vector.", - "returnDescription": "the angle", + "description": "Opens the window full screen (a borderless window at the screen's size). Call it before `new Window`.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/usePixelArt", + "owner": "org.openpatch.scratch.Window", + "signatures": [ + { + "name": "usePixelArt", + "constructor": false, + "static": true, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Pixel-art mode: images are not smoothed, the stage scales by whole numbers only, the default\nfont is Jersey 10 and font sizes are rounded to its pixels. Call it before `new Window`.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10520,19 +12881,19 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/clone", - "owner": "org.openpatch.scratch.Vector2", + "id": "Window/useSmoothPixelArt", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "clone", + "name": "useSmoothPixelArt", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates a clone of the vector", - "returnDescription": "the cloned vector", + "description": "Smooth pixel art (Godot's \"canvas items\" way of showing pixel art): as [usePixelArt()](usePixelArt),\nbut the camera moves without snapping and zoom works at any factor. The world is drawn at the\nwindow's resolution with the sprites still sampled by nearest neighbour, so every pixel stays\na sharp square while things move \\u2014 the grid wobbles by a screen pixel instead of the picture\nstepping whole stage pixels (the look of Hyper Light Drifter, as Godot's guide puts it). With\nit, scrolling does not need [useFrameSmoothing(double)](useFrameSmoothing). Call it before\n`new Window`.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10542,59 +12903,105 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/constructor", - "owner": "org.openpatch.scratch.Vector2", + "id": "Window/useSplashLogo", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "Vector2", - "constructor": true, + "name": "useSplashLogo", + "constructor": false, + "static": true, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "path" + ], + "parameterDescriptions": [ + "an image" + ], + "description": "The logo on the loading screen. Call it before `new Window`.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The browser has no desktop splash window. This option only reports a limitation.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/whenExits", + "owner": "org.openpatch.scratch.Window", + "signatures": [ + { + "name": "whenExits", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructor for the null vector.", + "description": "Called when the program ends, on the game thread. Override it to save, say.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "drawing/BitmapText/addGlyph", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "signatures": [ { - "name": "Vector2", - "constructor": true, + "name": "addGlyph", + "constructor": false, "static": false, "parameters": [ - "double", - "double" + "char", + "java.lang.String" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "x", - "y" + "character", + "path" ], "parameterDescriptions": [ - "x-coordinate", - "y-coordinate" + "the character to replace", + "its image or built-in costume name" ], - "description": "Constructor for a 2D vector.", + "description": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "drawing/BitmapText/constructor", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "signatures": [ { - "name": "Vector2", + "name": "BitmapText", "constructor": true, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "org.openpatch.scratch.drawing.BitmapText", "parameterNames": [ - "v" + "pattern" ], "parameterDescriptions": [ - "a vector" + "image path with an integer format, e.g. \"assets/font%03d.png\"" ], - "description": "Copy constructor for copying a vector.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -10605,25 +13012,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/distance", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/draw", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "distance", + "name": "draw", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.drawing.Drawing" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "v" + "drawing" ], "parameterDescriptions": [ - "a vector" + "the current frame's canvas" ], - "description": "Calculates the distance to another vector.", - "returnDescription": "the distance", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10633,25 +13040,19 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/distanceSq", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/getContent", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "distanceSq", + "name": "getContent", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "double", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "a vector" - ], - "description": "Calculates the squared distance to another vector.", - "returnDescription": "the squared distance", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the text being shown", "scratchblock": "", "since": "" } @@ -10661,25 +13062,19 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/dot", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/getHeight", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "dot", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], + "parameters": [], "returns": "double", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "a vector" - ], - "description": "Calculates the dot product.", - "returnDescription": "the dot product", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the displayed text's height, including line spacing and sprite size", "scratchblock": "", "since": "" } @@ -10689,25 +13084,19 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/equals", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/getWidth", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "equals", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "java.lang.Object" - ], - "returns": "boolean", - "parameterNames": [ - "obj" - ], - "parameterDescriptions": [ - "the object to compare with" - ], - "description": "Compares this vector with another object.", - "returnDescription": "true if the other object is a vector with the same x- and y-coordinate", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the displayed text's width, including the sprite's size", "scratchblock": "", "since": "" } @@ -10717,28 +13106,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/fromPolar", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/setAlign", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "fromPolar", + "name": "setAlign", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double", - "double" + "org.openpatch.scratch.TextAlign" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "magnitude", - "angle" + "align" ], "parameterDescriptions": [ - "of the vector", - "of the vector" + "LEFT, CENTER or RIGHT (DEFAULT means LEFT)" ], - "description": "Constructor method for constructing a vector based on polar coordinates.", - "returnDescription": "a vector", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10748,19 +13134,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/getX", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/setFont", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "getX", + "name": "setFont", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the x coordinate of the vector", - "returnDescription": "the x coordinate", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "pattern" + ], + "parameterDescriptions": [ + "glyph path with one integer format for the Unicode code point" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10770,19 +13162,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/getY", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/setLetterSpacing", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "getY", + "name": "setLetterSpacing", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the y coordinate of the vector", - "returnDescription": "the y coordinate", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "spacing" + ], + "parameterDescriptions": [ + "gap between characters; negative values allow italic glyphs to overlap" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10792,19 +13190,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/hashCode", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/setLineSpacing", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "hashCode", + "name": "setLineSpacing", "constructor": false, "static": false, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the hash code of the vector. Vectors that are equal have the same hash code, which is\nwhat lets them be used as keys in a `HashMap`.", - "returnDescription": "the hash code of the vector", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "spacing" + ], + "parameterDescriptions": [ + "extra pixels between lines" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10814,19 +13218,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/length", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/setSpaceWidth", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "length", + "name": "setSpaceWidth", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Calculates the length of the vector.", - "returnDescription": "the length of the vector", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "width" + ], + "parameterDescriptions": [ + "width of a space, in unscaled pixels" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10836,19 +13246,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/lengthSq", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/showText", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "lengthSq", + "name": "showText", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Calculates the squared length of the vector.", - "returnDescription": "the squared length of the vector", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "text" + ], + "parameterDescriptions": [ + "text to show, including spaces and newlines" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10858,25 +13274,34 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/multiply", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/clip", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "multiply", + "name": "clip", "constructor": false, "static": false, "parameters": [ + "double", + "double", + "double", "double" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "scalar" + "x", + "y", + "width", + "height" ], "parameterDescriptions": [ - "a scalar" + "x of its centre", + "y of its centre", + "its width", + "its height" ], - "description": "Multiplies a scalar and return the result.", - "returnDescription": "the vector", + "description": "Draws only inside a rectangle until [noClip()](noClip); a turned sprite clips to the rectangle\naround the turned one.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10886,19 +13311,70 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/normalVector", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/constructor", + "owner": "org.openpatch.scratch.drawing.Drawing", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "drawing/Drawing/image", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "normalVector", + "name": "image", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the normal vector, which is perpendicular to the vector.", - "returnDescription": "a normal vector", + "parameters": [ + "java.lang.String", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "path", + "x", + "y" + ], + "parameterDescriptions": [ + "an image file or a built-in sprite name", + "x of its centre", + "y of its centre" + ], + "description": "An image at its own size, centred on a point.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "image", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "double", + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "path", + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "an image file or a built-in sprite name", + "x of its centre", + "y of its centre", + "the width", + "the height" + ], + "description": "An image stretched to a size, centred on a point.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10908,19 +13384,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/reverse", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/imageHeight", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "reverse", + "name": "imageHeight", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Reverses a vector and returns the result.", - "returnDescription": "the reversed vector", + "parameters": [ + "java.lang.String" + ], + "returns": "int", + "parameterNames": [ + "path" + ], + "parameterDescriptions": [ + "an image file or a built-in sprite name" + ], + "description": "", + "returnDescription": "its height in pixels", "scratchblock": "", "since": "" } @@ -10930,25 +13412,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/rotateBy", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/imageWidth", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "rotateBy", + "name": "imageWidth", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "int", "parameterNames": [ - "angle" + "path" ], "parameterDescriptions": [ - "an angle between [0, ..., 360]" + "an image file or a built-in sprite name" ], - "description": "Rotates the vector by an angle and returns the result.", - "returnDescription": "the rotated vector", + "description": "", + "returnDescription": "its width in pixels", "scratchblock": "", "since": "" } @@ -10958,25 +13440,19 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/rotateTo", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/noClip", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "rotateTo", + "name": "noClip", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [ - "angle" - ], - "parameterDescriptions": [ - "an angle between [0,...,360]" - ], - "description": "Rotates the vector to a given angle and returns the result.", - "returnDescription": "the rotated vector", + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Draws everywhere again.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10986,25 +13462,31 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/sub", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/polygon", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "sub", + "name": "polygon", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "double[]", + "double[]", + "org.openpatch.scratch.Color" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "v" + "x", + "y", + "color" ], "parameterDescriptions": [ - "" + "x of every corner", + "y of every corner", + "the fill" ], - "description": "Substracts another vector and returns the result", - "returnDescription": "the difference", + "description": "A filled polygon.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -11014,19 +13496,37 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/toString", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/rectangle", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "toString", + "name": "rectangle", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the vector as a text, for example `Vector2[60.0, 80.0]`.", - "returnDescription": "the vector as a text", + "parameters": [ + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" + ], + "returns": "void", + "parameterNames": [ + "x", + "y", + "width", + "height", + "color" + ], + "parameterDescriptions": [ + "x of its centre", + "y of its centre", + "its width", + "its height", + "the fill" + ], + "description": "A filled rectangle centred on a point.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -11036,289 +13536,247 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/unitVector", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/DrawingExtension/constructor", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", "signatures": [ { - "name": "unitVector", - "constructor": false, + "name": "DrawingExtension", + "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2", + "returns": "org.openpatch.scratch.drawing.DrawingExtension", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the unit vector.", - "returnDescription": "a unit vector", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/constructor", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "Window", + "name": "DrawingExtension", "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Window", + "returns": "org.openpatch.scratch.drawing.DrawingExtension", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructs a new Window with default dimensions. The default width is 480\npixels and the\ndefault height is 360 pixels.\n\nA folder named `assets` is loaded while the loading screen shows, if\nthe project has one.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "drawing/DrawingExtension/id", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "signatures": [ { - "name": "Window", - "constructor": true, + "name": "id", + "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "org.openpatch.scratch.Window", - "parameterNames": [ - "assets" - ], - "parameterDescriptions": [ - "the path to the assets to be used in the window" - ], - "description": "Constructs a new Window with the specified assets. The window will have a\ndefault width of 480\npixels and a height of 360 pixels.\n\nThe images, sounds and fonts in that folder are loaded while the loading\nscreen shows, so they are ready when a sprite first uses them. Without\nit, a folder named `assets` is loaded, if there is one.", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "Window", - "constructor": true, + "name": "id", + "constructor": false, "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "org.openpatch.scratch.Window", - "parameterNames": [ - "width", - "height" - ], - "parameterDescriptions": [ - "the width of the window", - "the height of the window" - ], - "description": "Constructs a new Window with the specified width and height.\n\nA folder named `assets` is loaded while the loading screen shows, if\nthe project has one.", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "drawing/DrawingExtension/install", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "signatures": [ { - "name": "Window", - "constructor": true, + "name": "install", + "constructor": false, "static": false, "parameters": [ - "int", - "int", - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext" ], - "returns": "org.openpatch.scratch.Window", + "returns": "void", "parameterNames": [ - "width", - "height", - "assets" + "ctx" ], "parameterDescriptions": [ - "the width of the window", - "the height of the window\n\nThe images, sounds and fonts in the assets folder are loaded while the\nloading screen shows, so they are ready when a sprite first uses them.\nWithout it, a folder named `assets` is loaded, if there is one.", - "the path to the assets" + "" ], - "description": "Constructs a new Window with the specified width, height, and assets path.\nEnsures that only\none instance of Window can be created.\n\nThe single exception is the window Java builds by itself: a class that\nextends Window and has a `main` method which is not static is\ninstantiated by the JVM before `main` is called, so the\n`new MyWindow()` in that `main` would be the second window. That\none reuses the first instead of failing.", + "description": "Every layer gets a drawer that lets the stage's visible drawing sprites of that layer draw,\nback to front.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/debug", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "debug", + "name": "install", "constructor": false, "static": false, "parameters": [ - "java.lang.Object[]" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "values" + "ctx" ], "parameterDescriptions": [ - "one or more values to print" + "" ], - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the window's class name.\n\nExample:\n\n```java\nthis.debug(\"fps =\", getFps());\n// prints: [MyWindow] fps = 60\n```", + "description": "Every layer gets a drawer that lets the stage's visible drawing sprites of that layer draw,\nback to front.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/exit", - "owner": "org.openpatch.scratch.Window", + "id": "drawing/DrawingExtension/name", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", "signatures": [ { - "name": "exit", + "name": "name", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Exits the application by invoking the `whenExits` method and then calling the\n`exit` method on\nthe `Applet` instance.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/getDeltaTime", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "getDeltaTime", + "name": "name", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Gets the seconds of game time passed since the last frame. While the game\nis paused this is 0, and at half speed half the real time.", - "returnDescription": "seconds since last frame", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/getGameSpeed", - "owner": "org.openpatch.scratch.Window", + "id": "drawing/DrawingExtension/requires", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", "signatures": [ { - "name": "getGameSpeed", + "name": "requires", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "The game speed set with [setGameSpeed(double)](setGameSpeed).", - "returnDescription": "1 for normal speed", + "description": "First-party extensions are released together with the core.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/getHeight", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "getHeight", + "name": "requires", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the height of the current window.", - "returnDescription": "the height of the window in pixels", + "description": "First-party extensions are released together with the core.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/getInstance", - "owner": "org.openpatch.scratch.Window", + "id": "drawing/DrawingExtension/version", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", "signatures": [ { - "name": "getInstance", + "name": "version", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Window", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the singleton instance of the Window class.", - "returnDescription": "the singleton instance of Window", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/getLibraryTitle", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "getLibraryTitle", + "name": "version", "constructor": false, "static": false, "parameters": [], "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the title of the library.", - "returnDescription": "the title of the library as a String", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/getLibraryVersion", - "owner": "org.openpatch.scratch.Window", + "id": "drawing/DrawingSprite/constructor", + "owner": "org.openpatch.scratch.drawing.DrawingSprite", "signatures": [ { - "name": "getLibraryVersion", - "constructor": false, + "name": "DrawingSprite", + "constructor": true, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "org.openpatch.scratch.drawing.DrawingSprite", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the version of the library.", - "returnDescription": "the version of the library as a String", + "description": "A drawing sprite; it has no hitbox unless given one.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -11328,19 +13786,25 @@ "missingBrowserSignatures": [] }, { - "id": "Window/getStage", - "owner": "org.openpatch.scratch.Window", + "id": "drawing/DrawingSprite/draw", + "owner": "org.openpatch.scratch.drawing.DrawingSprite", "signatures": [ { - "name": "getStage", + "name": "draw", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Retrieves the current stage from the Applet instance.", - "returnDescription": "the current Stage object", + "parameters": [ + "org.openpatch.scratch.drawing.Drawing" + ], + "returns": "void", + "parameterNames": [ + "drawing" + ], + "parameterDescriptions": [ + "what to draw with, in the sprite's own coordinates" + ], + "description": "Draws the sprite; called every frame on the game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -11350,1398 +13814,1512 @@ "missingBrowserSignatures": [] }, { - "id": "Window/getTextureSampling", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/clip", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "getTextureSampling", + "name": "clip", "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.TextureSampling", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns how pictures are being smoothed.", - "returnDescription": "the current setting", + "static": false, + "parameters": [ + "double", + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "x of its centre", + "y of its centre", + "its width", + "its height" + ], + "description": "Draws only inside a rectangle (axis-aligned on the screen) until [noClip()](noClip).", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/getWidth", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "getWidth", + "name": "clip", "constructor": false, "static": false, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Retrieves the width of the current window.", - "returnDescription": "the width of the window in pixels", + "parameters": [ + "double", + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "x of its centre", + "y of its centre", + "its width", + "its height" + ], + "description": "Draws only inside a rectangle (axis-aligned on the screen) until [noClip()](noClip).", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + ] + }, + { + "id": "extension/Canvas/constructor", + "owner": "org.openpatch.scratch.extension.Canvas", + "signatures": [], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "Window/isDebug", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawImage", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "isDebug", + "name": "drawImage", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Checks if the application is in debug mode.\n\nDebug mode can be toggled at runtime by pressing F12.", - "returnDescription": "true if the application is in debug mode, false otherwise.", + "parameters": [ + "java.lang.String", + "double", + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "path", + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "the image", + "x of its centre", + "y of its centre", + "its width", + "its height" + ], + "description": "An image (a file or a built-in sprite name), centred on a point.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/isPaused", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "isPaused", + "name": "drawImage", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Whether the game is paused.", - "returnDescription": "true while paused", + "parameters": [ + "java.lang.String", + "double", + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "path", + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "the image", + "x of its centre", + "y of its centre", + "its width", + "its height" + ], + "description": "An image (a file or a built-in sprite name), centred on a point.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/isTransitioning", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawImageQuad", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "isTransitioning", + "name": "drawImageQuad", "constructor": false, - "static": true, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns whether a stage transition is in progress, including creation of\nthe destination stage.\n\nWhile a transition is running, calls to\n[transitionToStage(Stage, int)](transitionToStage) are ignored. A program that moves\nthe player or builds a new stage in the same breath as a warp should\nuse [transitionToStage(Supplier, int)](transitionToStage) so those changes are deferred\nuntil the screen is black and skipped when a transition is already running.", - "returnDescription": "`true` while a transition is in progress, `false` otherwise", + "static": false, + "parameters": [ + "java.lang.String", + "int", + "int", + "int", + "int", + "double[]" + ], + "returns": "void", + "parameterNames": [ + "path", + "sx", + "sy", + "sw", + "sh", + "corners" + ], + "parameterDescriptions": [ + "the image", + "the region's left edge in image pixels", + "its top edge", + "its width", + "its height", + "where the region's top-left, top-right, bottom-right and bottom-left corners go:\n `x0, y0, \\u2026, x3, y3`" + ], + "description": "A region of an image on any quad: turned, mirrored, sheared.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/pause", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "pause", + "name": "drawImageQuad", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "java.lang.String", + "int", + "int", + "int", + "int", + "double[]" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Pauses the game: `run()` is no longer called, and timers, gliding\nand animations stand still. The window keeps drawing, so the paused\npicture stays visible, and keys and clicks still reach methods like\n`whenKeyPressed`, so a key can [resume()](resume) the game.", + "parameterNames": [ + "path", + "sx", + "sy", + "sw", + "sh", + "corners" + ], + "parameterDescriptions": [ + "the image", + "the region's left edge in image pixels", + "its top edge", + "its width", + "its height", + "where the region's top-left, top-right, bottom-right and bottom-left corners go:\n `x0, y0, \\u2026, x3, y3`" + ], + "description": "A region of an image on any quad: turned, mirrored, sheared.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/resume", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawImageRegion", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "resume", + "name": "drawImageRegion", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "java.lang.String", + "int", + "int", + "int", + "int", + "double", + "double", + "double", + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Lets a paused game go on where it stopped.", + "parameterNames": [ + "path", + "sx", + "sy", + "sw", + "sh", + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "the image", + "the region's left edge in image pixels", + "its top edge", + "its width", + "its height", + "x of the centre", + "y of the centre", + "the width to draw it at", + "the height to draw it at" + ], + "description": "A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/setDebug", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "setDebug", + "name": "drawImageRegion", "constructor": false, "static": false, "parameters": [ - "boolean" + "java.lang.String", + "int", + "int", + "int", + "int", + "double", + "double", + "double", + "double" ], "returns": "void", "parameterNames": [ - "debug" + "path", + "sx", + "sy", + "sw", + "sh", + "x", + "y", + "width", + "height" ], "parameterDescriptions": [ - "a boolean value where `true` enables debug mode and\n `false` disables\n it." + "the image", + "the region's left edge in image pixels", + "its top edge", + "its width", + "its height", + "x of the centre", + "y of the centre", + "the width to draw it at", + "the height to draw it at" ], - "description": "Enables or disables the debug mode for the application.\n\nDebug mode shows sprite positions, hitboxes, and other debug information.\nIt can also be toggled at runtime by pressing F12.", + "description": "A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/setGameSpeed", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawOutline", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "setGameSpeed", + "name": "drawOutline", "constructor": false, "static": false, "parameters": [ + "double[]", + "double[]", + "org.openpatch.scratch.Color", "double" ], "returns": "void", "parameterNames": [ - "speed" + "xs", + "ys", + "stroke", + "weight" ], "parameterDescriptions": [ - "1 for normal speed, smaller for slower, larger for faster" + "x of every corner", + "y of every corner", + "the outline's colour", + "the outline's width" ], - "description": "Makes the game run slower or faster: 1 is normal, 0.5 half as fast, 2\ntwice as fast. `run()`, timers, gliding and animations all follow,\nso the whole game looks like slow motion; the window keeps drawing\nsmoothly.", + "description": "The outline of a polygon.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/setStage", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "setStage", + "name": "drawOutline", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Stage" + "double[]", + "double[]", + "org.openpatch.scratch.Color", + "double" ], "returns": "void", "parameterNames": [ - "stage" + "xs", + "ys", + "stroke", + "weight" ], "parameterDescriptions": [ - "the new stage to be set" + "x of every corner", + "y of every corner", + "the outline's colour", + "the outline's width" ], - "description": "Sets the current stage of the application.", + "description": "The outline of a polygon.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/step", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawPolygon", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "step", + "name": "drawPolygon", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double[]", + "double[]", + "org.openpatch.scratch.Color" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "While the game is paused: runs it for exactly one frame (every\n`run()` once) and pauses again. Useful to watch closely what\nhappens, for example when two sprites touch.", + "parameterNames": [ + "xs", + "ys", + "fill" + ], + "parameterDescriptions": [ + "x of every corner", + "y of every corner, in the same order", + "its colour" + ], + "description": "A filled polygon, concave ones included.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/transitionToStage", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "transitionToStage", + "name": "drawPolygon", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Stage", - "int" + "double[]", + "double[]", + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "stage", - "duration" + "xs", + "ys", + "fill" ], "parameterDescriptions": [ - "the new stage to transition to", - "the duration of the transition in milliseconds" + "x of every corner", + "y of every corner, in the same order", + "its colour" ], - "description": "Transitions to a new stage with a specified duration.", + "description": "A filled polygon, concave ones included.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "extension/Canvas/drawRectangle", + "owner": "org.openpatch.scratch.extension.Canvas", + "signatures": [ { - "name": "transitionToStage", + "name": "drawRectangle", "constructor": false, "static": false, "parameters": [ - "java.util.function.Supplier", - "int" + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "stage", - "duration" + "x", + "y", + "width", + "height", + "fill" ], "parameterDescriptions": [ - "creates the destination stage; must return a non-null stage", - "the duration, using the same timing as the Stage overload" + "x of its centre", + "y of its centre", + "its width", + "its height", + "its colour" ], - "description": "Fades to black, creates the destination stage, then fades it in.\n\nThe supplier is called exactly once, when the screen is black. It is\nnever called when another transition is already running. Move shared\nsprites and update game state inside the supplier so those changes happen\nonly when the transition is accepted, while the old stage is hidden.\nThe call returns immediately; the supplier runs later on the animation thread.", + "description": "A filled rectangle centred on a point.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/useFullScreen", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "useFullScreen", + "name": "drawRectangle", "constructor": false, - "static": true, - "parameters": [], + "static": false, + "parameters": [ + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Makes the window fill the whole screen.\n\nCall it before the first stage is created, because the size of the window is\nsettled the moment it opens:\n\n```java\npublic static void main(String[] args) {\n Window.useFullScreen();\n new MyStage();\n}\n```", + "parameterNames": [ + "x", + "y", + "width", + "height", + "fill" + ], + "parameterDescriptions": [ + "x of its centre", + "y of its centre", + "its width", + "its height", + "its colour" + ], + "description": "A filled rectangle centred on a point.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "desktop-only", - "reason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/useSplashLogo", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawText", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "useSplashLogo", + "name": "drawText", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String" + "java.lang.String", + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "path" + "text", + "x", + "y", + "size", + "color" ], "parameterDescriptions": [ - "a path to an image file or the name of a built-in sprite, or\n `null` for the Scratch for Java logo" + "the text", + "where it starts", + "its baseline", + "the font size", + "the colour of the letters" ], - "description": "Puts your own picture on the loading screen in place of the Scratch for Java\nlogo. The picture fades in while your project starts and fades out again\nonce it is ready.\n\nIt is shrunk to fit if it is large, and never enlarged, so a picture of\nroughly 300 by 300 looks right in a window of the usual size.\n\nCall it before the first stage is created, because the loading screen is the\nfirst thing the window draws:\n\n```java\npublic static void main(String[] args) {\n Window.useSplashLogo(\"assets/logo.png\");\n new MyStage();\n}\n```", + "description": "A line of text whose first baseline starts at a point, in the default font.", "returnDescription": "", "scratchblock": "", "since": "" } ], "status": "desktop-only", - "reason": "The browser has no desktop splash window. This option only reports a limitation.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/useTextureSampling", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "useTextureSampling", + "name": "drawText", "constructor": false, - "static": true, + "static": false, "parameters": [ - "org.openpatch.scratch.TextureSampling" + "java.lang.String", + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "sampling" + "text", + "x", + "y", + "size", + "color" ], "parameterDescriptions": [ - "how to smooth pictures" + "the text", + "where it starts", + "its baseline", + "the font size", + "the colour of the letters" ], - "description": "Chooses how pictures are smoothed when they are drawn larger or smaller than\nthey really are. Pixel art usually wants [TextureSampling.POINT](../TextureSampling/POINT).\n\nCall it before the first stage is created.\n\n```java\nWindow.useTextureSampling(TextureSampling.POINT);\nnew MyStage();\n```", + "description": "A line of text whose first baseline starts at a point, in the default font.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/whenExits", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/imageHeight", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "whenExits", + "name": "imageHeight", "constructor": false, "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "This method is called when the window exits. Override this method to define\ncustom behavior\nwhen the window is closed.", - "returnDescription": "", + "parameters": [ + "java.lang.String" + ], + "returns": "int", + "parameterNames": [ + "path" + ], + "parameterDescriptions": [ + "an image or a built-in sprite name" + ], + "description": "", + "returnDescription": "its height in pixels", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/changeX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "changeX", + "name": "imageHeight", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], - "returns": "void", + "returns": "int", "parameterNames": [ - "x" + "path" ], "parameterDescriptions": [ - "number in pixels" + "an image or a built-in sprite name" ], - "description": "Changes x by a certain amount", - "returnDescription": "", + "description": "", + "returnDescription": "its height in pixels", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/changeY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Canvas/imageWidth", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "changeY", + "name": "imageWidth", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], - "returns": "void", + "returns": "int", "parameterNames": [ - "y" + "path" ], "parameterDescriptions": [ - "number in pixels" + "an image or a built-in sprite name" ], - "description": "Changes y by a certain amount", - "returnDescription": "", + "description": "", + "returnDescription": "its width in pixels", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/changeZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "changeZoom", + "name": "imageWidth", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], - "returns": "void", + "returns": "int", "parameterNames": [ - "dz" + "path" ], "parameterDescriptions": [ - "the amount to change the zoom level by" + "an image or a built-in sprite name" ], - "description": "Changes the zoom level by a certain amount", - "returnDescription": "", + "description": "", + "returnDescription": "its width in pixels", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/constructor", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Canvas/noClip", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "Camera", - "constructor": true, + "name": "noClip", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.camera.Camera", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructs a new Camera with default values. The default position is (0, 0) and the default\nzoom level is 100.", + "description": "Draws everywhere again.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/getPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "getPosition", + "name": "noClip", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the position of the sprite", - "returnDescription": "a vector", + "description": "Draws everywhere again.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/getX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Canvas/setOpacity", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "getX", + "name": "setOpacity", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the x coordinate of the sprite", - "returnDescription": "a x coordinate", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "opacity" + ], + "parameterDescriptions": [ + "how opaque what follows is drawn, 0 to 1" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/getY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "getY", + "name": "setOpacity", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the y coordinate of the sprite", - "returnDescription": "a y coordinate", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "opacity" + ], + "parameterDescriptions": [ + "how opaque what follows is drawn, 0 to 1" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + ] + }, + { + "id": "extension/Extension/constructor", + "owner": "org.openpatch.scratch.extension.Extension", + "signatures": [], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/camera/Camera/getZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/coreVersion", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "getZoom", + "name": "coreVersion", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "double", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the zoom level", - "returnDescription": "the zoom level", + "description": "The version of the core library, e.g. `\"7.0.0\"`.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/resetZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "resetZoom", + "name": "coreVersion", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Resets the zoom level to 100", + "description": "The version of the core library, e.g. `\"7.0.0\"`.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/setPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/id", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "setPosition", + "name": "id", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void", - "parameterNames": [ - "x", - "y" - ], - "parameterDescriptions": [ - "a x coordinate", - "a y coordinate" - ], - "description": "Sets the position of the sprite", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A short unique id such as `\"tiled\"`, used in messages.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "setPosition", + "name": "id", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "a vector" - ], - "description": "Sets the position of the sprite based on the coordinates of a given vector.", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A short unique id such as `\"tiled\"`, used in messages.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/setX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/install", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "setX", + "name": "install", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "x" + "ctx" ], "parameterDescriptions": [ - "a x coordinate" + "" ], - "description": "Sets the x coordinate", + "description": "Adds the extension's hooks. Called once, on the window thread, before the first stage.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/setY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "setY", + "name": "install", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "y" + "ctx" ], "parameterDescriptions": [ - "a y coordinate" + "" ], - "description": "Sets the y coordinate", + "description": "Adds the extension's hooks. Called once, on the window thread, before the first stage.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/setZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/name", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "setZoom", + "name": "name", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "zoom" - ], - "parameterDescriptions": [ - "the zoom level" - ], - "description": "Sets the zoom", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A name for people, such as `\"Tiled maps\"`.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "name", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A name for people, such as `\"Tiled maps\"`.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/camera/Camera/setZoomLimit", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/requires", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "setZoomLimit", + "name": "requires", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void", - "parameterNames": [ - "low", - "high" - ], - "parameterDescriptions": [ - "the lower limit", - "the upper limit" - ], - "description": "Sets the zoom limits", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "The core versions this extension works with: `\"7\"` means any 7.x, `\"7.1\"` 7.1\nor newer, `\"7.1.2\"` 7.1.2 or newer, always below the next major version.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "requires", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "The core versions this extension works with: `\"7\"` means any 7.x, `\"7.1\"` 7.1\nor newer, `\"7.1.2\"` 7.1.2 or newer, always below the next major version.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/camera/Camera/toGlobalPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/version", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "toGlobalPosition", + "name": "version", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "local camera coordinates" - ], - "description": "Converts local camera coordinates to screen coordinates", - "returnDescription": "screen coordinates", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "The extension's own version.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "version", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "The extension's own version.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/camera/Camera/toGlobalX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/ExtensionContext/addLayerDrawer", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "toGlobalX", + "name": "addLayerDrawer", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Layer", + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "x" + "layer", + "drawer" ], "parameterDescriptions": [ - "local camera x coordinate" + "", + "" ], - "description": "Converts local camera x coordinate to screen x coordinate", - "returnDescription": "screen x coordinate", + "description": "Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles,\ndrawings. Game thread, when the draw list is made.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/toGlobalY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "toGlobalY", + "name": "addLayerDrawer", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Layer", + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "y" + "layer", + "drawer" ], "parameterDescriptions": [ - "local camera y coordinate" + "", + "" ], - "description": "Converts local camera y coordinate to screen y coordinate", - "returnDescription": "screen y coordinate", + "description": "Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles,\ndrawings. Game thread, when the draw list is made.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/toLocalPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/ExtensionContext/addOverlayDrawer", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "toLocalPosition", + "name": "addOverlayDrawer", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "v" + "drawer" ], "parameterDescriptions": [ - "screen coordinates" + "" ], - "description": "Converts screen coordinates to local camera coordinates", - "returnDescription": "local coordinates", + "description": "Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave\nit out (Studio's watch pins). Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/toLocalX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "toLocalX", + "name": "addOverlayDrawer", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "x" + "drawer" ], "parameterDescriptions": [ - "screen x coordinate" + "" ], - "description": "Converts screen x coordinate to local camera x coordinate", - "returnDescription": "local x coordinate", + "description": "Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave\nit out (Studio's watch pins). Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/toLocalY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/ExtensionContext/afterFrame", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "toLocalY", + "name": "afterFrame", "constructor": false, "static": false, "parameters": [ - "double" + "java.util.function.BiConsumer" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "y" + "hook" ], "parameterDescriptions": [ - "screen y coordinate" + "" ], - "description": "Converts screen y coordinate to local camera y coordinate", - "returnDescription": "local y coordinate", + "description": "After a frame was drawn, on the window thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/Drawing/clip", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "clip", + "name": "afterFrame", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double", - "double" + "java.util.function.BiConsumer" ], "returns": "void", "parameterNames": [ - "x", - "y", - "width", - "height" + "hook" ], "parameterDescriptions": [ - "centre x", - "centre y", - "clip width", - "clip height" + "" ], - "description": "Limits subsequent drawing to a centred rectangle. This replaces the previous\nclip; it is always cleared when the sprite finishes drawing. For a rotated\nsprite, the clip is the screen-aligned bounding box of this rectangle.", + "description": "After a frame was drawn, on the window thread.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/Drawing/constructor", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", - "signatures": [], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/drawing/Drawing/image", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "extension/ExtensionContext/beforeTick", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "image", + "name": "beforeTick", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double", - "double" + "java.util.function.Consumer" ], "returns": "void", "parameterNames": [ - "path", - "x", - "y" + "hook" ], "parameterDescriptions": [ - "image file or built-in costume", - "centre x", - "centre y" + "" ], - "description": "Draws an image at its original size. A built-in costume name also works.", + "description": "Every tick, after the tick's input and before timers and `run()`. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "image", + "name": "beforeTick", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double", - "double", - "double", - "double" + "java.util.function.Consumer" ], "returns": "void", "parameterNames": [ - "path", - "x", - "y", - "width", - "height" + "hook" ], "parameterDescriptions": [ - "image file or built-in costume", - "centre x", - "centre y", - "drawn width in pixels", - "drawn height in pixels" + "" ], - "description": "Draws an image at the requested size, preserving its source in the cache.", + "description": "Every tick, after the tick's input and before timers and `run()`. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + ] + }, + { + "id": "extension/ExtensionContext/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "signatures": [], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/drawing/Drawing/imageHeight", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "extension/ExtensionContext/dispatch", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "imageHeight", + "name": "dispatch", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Stage", + "java.lang.Class", + "java.util.function.Consumer" ], - "returns": "int", + "returns": "void", "parameterNames": [ - "path" + "stage", + "listener", + "call" ], "parameterDescriptions": [ - "image file or built-in costume" + "", + "", + "" ], - "description": "", - "returnDescription": "its original height in pixels", + "description": "Calls a listener interface on the stage and every sprite of it that implements it, at the\npoint of the tick where key events arrive. Learner exceptions thrown there stop the game like\nany learner exception. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/Drawing/imageWidth", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "imageWidth", + "name": "dispatch", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Stage", + "java.lang.Class", + "java.util.function.Consumer" ], - "returns": "int", + "returns": "void", "parameterNames": [ - "path" + "stage", + "listener", + "call" ], "parameterDescriptions": [ - "image file or built-in costume" + "", + "", + "" ], - "description": "", - "returnDescription": "its original width in pixels", + "description": "Calls a listener interface on the stage and every sprite of it that implements it, at the\npoint of the tick where key events arrive. Learner exceptions thrown there stop the game like\nany learner exception. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/drawing/Drawing/noClip", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "extension/ExtensionContext/getTickCount", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "noClip", + "name": "getTickCount", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "long", "parameterNames": [], "parameterDescriptions": [], - "description": "Removes this sprite's clip.", - "returnDescription": "", + "description": "", + "returnDescription": "ticks run so far", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "getTickCount", + "constructor": false, + "static": false, + "parameters": [], + "returns": "long", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "ticks run so far", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/drawing/Drawing/polygon", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "extension/ExtensionContext/input", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "polygon", + "name": "input", "constructor": false, "static": false, "parameters": [ - "double[]", - "double[]", - "org.openpatch.scratch.Color" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "x", - "y", - "color" + "key" ], "parameterDescriptions": [ - "x coordinates", - "y coordinates (same length as x)", - "fill colour" + "" ], - "description": "Draws a filled polygon with at least three points. Concave polygons are\nsupported; crossing outlines are not.", + "description": "This batch's copy of a slot of the input snapshot. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/Drawing/rectangle", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "rectangle", + "name": "input", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double", - "double", - "org.openpatch.scratch.Color" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "x", - "y", - "width", - "height", - "color" + "key" ], "parameterDescriptions": [ - "centre x", - "centre y", - "width in pixels", - "height in pixels", - "fill colour" + "" ], - "description": "Draws a filled rectangle centred on (x,y).", + "description": "This batch's copy of a slot of the input snapshot. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/drawing/DrawingSprite/changeTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "id": "extension/ExtensionContext/isLoading", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "changeTransparency", + "name": "isLoading", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "step" - ], - "parameterDescriptions": [ - "change in percentage points" - ], + "parameters": [], + "returns": "boolean", + "parameterNames": [], + "parameterDescriptions": [], "description": "", - "returnDescription": "", + "returnDescription": "whether the loading screen is up", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/DrawingSprite/constructor", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "DrawingSprite", - "constructor": true, + "name": "isLoading", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates a custom drawing sprite.", - "returnDescription": "", + "description": "", + "returnDescription": "whether the loading screen is up", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/drawing/DrawingSprite/draw", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "id": "extension/ExtensionContext/onExit", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "draw", + "name": "onExit", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "java.lang.Runnable" ], "returns": "void", "parameterNames": [ - "drawing" + "hook" ], "parameterDescriptions": [ - "this frame's canvas in local Scratch coordinates" + "" ], - "description": "Draws this frame's appearance. Override this method; use run() for changes\nto game state, since a paused game can still be redrawn.", + "description": "At the end of the program, after `whenExits()`. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/DrawingSprite/getTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "getTransparency", + "name": "onExit", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", - "returnDescription": "transparency in percent", + "parameters": [ + "java.lang.Runnable" + ], + "returns": "void", + "parameterNames": [ + "hook" + ], + "parameterDescriptions": [ + "" + ], + "description": "At the end of the program, after `whenExits()`. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/drawing/DrawingSprite/setIsUI", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "id": "extension/ExtensionContext/onInputPoll", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "setIsUI", + "name": "onInputPoll", "constructor": false, "static": false, "parameters": [ - "boolean" + "java.util.function.Consumer" ], "returns": "void", "parameterNames": [ - "isUI" + "hook" ], "parameterDescriptions": [ - "true for UI, false for the game world" + "" ], - "description": "Chooses whether the drawing stays fixed on screen as UI.", + "description": "Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into\nthe snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/DrawingSprite/setTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "setTransparency", + "name": "onInputPoll", "constructor": false, "static": false, "parameters": [ - "double" + "java.util.function.Consumer" ], "returns": "void", "parameterNames": [ - "percent" + "hook" ], "parameterDescriptions": [ - "0 solid, 100 invisible" + "" ], - "description": "", + "description": "Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into\nthe snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/fs/File/constructor", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/onKey", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "File", - "constructor": true, + "name": "onKey", + "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.fs.File", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", + "parameters": [ + "java.util.function.Consumer" + ], + "returns": "void", + "parameterNames": [ + "hook" + ], + "parameterDescriptions": [ + "" + ], + "description": "Every key press and release, before learner code sees it; observe only. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" @@ -12751,14 +15329,20 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "File", - "constructor": true, + "name": "onKey", + "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.fs.File", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", + "parameters": [ + "java.util.function.Consumer" + ], + "returns": "void", + "parameterNames": [ + "hook" + ], + "parameterDescriptions": [ + "" + ], + "description": "Every key press and release, before learner code sees it; observe only. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" @@ -12766,28 +15350,25 @@ ] }, { - "id": "extensions/fs/File/load", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/onLearnerError", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "load", + "name": "onLearnerError", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the file from which the object is to be loaded", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from a file at the given path.", - "returnDescription": "the loaded object of the specified class", + "description": "A learner exception stopped the game. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -12796,52 +15377,46 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "load", + "name": "onLearnerError", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the file from which the object is to be loaded", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from a file at the given path.", - "returnDescription": "the loaded object of the specified class", + "description": "A learner exception stopped the game. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/fs/File/loadOrCreate", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/onMouse", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "loadOrCreate", + "name": "onMouse", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the file from which the object is to be loaded", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", - "returnDescription": "the loaded object of the specified class, or a new instance if the\n file does not exist", + "description": "Every mouse event, before learner code sees it; observe only. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -12850,52 +15425,46 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "loadOrCreate", + "name": "onMouse", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the file from which the object is to be loaded", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", - "returnDescription": "the loaded object of the specified class, or a new instance if the\n file does not exist", + "description": "Every mouse event, before learner code sees it; observe only. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/fs/File/loadXML", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/onStageCreated", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "loadXML", + "name": "onStageCreated", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the XML file", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from an XML file at the given path.", - "returnDescription": "the object loaded from the XML file", + "description": "A stage was made (on the thread that made it, usually the game thread or main).", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -12904,52 +15473,46 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "loadXML", + "name": "onStageCreated", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the XML file", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from an XML file at the given path.", - "returnDescription": "the object loaded from the XML file", + "description": "A stage was made (on the thread that made it, usually the game thread or main).", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/fs/File/loadXMLOrCreate", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/onStageDisposed", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "loadXMLOrCreate", + "name": "onStageDisposed", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the XML file", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", - "returnDescription": "the object loaded from the XML file, or a new instance if the file\n does not exist", + "description": "A stage stopped being shown. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -12958,51 +15521,48 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "loadXMLOrCreate", + "name": "onStageDisposed", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the XML file", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", - "returnDescription": "the object loaded from the XML file, or a new instance if the file\n does not exist", + "description": "A stage stopped being shown. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/fs/File/save", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/registerImageFormat", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "save", + "name": "registerImageFormat", "constructor": false, - "static": true, + "static": false, "parameters": [ "java.lang.String", - "T" + "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder" ], "returns": "void", "parameterNames": [ - "path", - "obj" + "suffix", + "decoder" ], "parameterDescriptions": [ - "the path where the object should be saved", - "the object to be saved" + "", + "" ], - "description": "Saves the given object to the specified path in the default file type (JSON).", + "description": "Images whose name ends in `suffix` (e.g. `\".ase\"`) are decoded by\n`decoder`.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13012,23 +15572,23 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "save", + "name": "registerImageFormat", "constructor": false, - "static": true, + "static": false, "parameters": [ "java.lang.String", - "T" + "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder" ], "returns": "void", "parameterNames": [ - "path", - "obj" + "suffix", + "decoder" ], "parameterDescriptions": [ - "the path where the object should be saved", - "the object to be saved" + "", + "" ], - "description": "Saves the given object to the specified path in the default file type (JSON).", + "description": "Images whose name ends in `suffix` (e.g. `\".ase\"`) are decoded by\n`decoder`.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13036,27 +15596,24 @@ ] }, { - "id": "extensions/fs/File/saveXML", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/runOnGameThread", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "saveXML", + "name": "runOnGameThread", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "T" + "java.lang.Runnable" ], "returns": "void", "parameterNames": [ - "path", - "obj" + "task" ], "parameterDescriptions": [ - "the path where the XML file will be saved", - "the object to be saved as XML" + "" ], - "description": "Saves the given object as an XML file at the specified path.", + "description": "Runs a task at the start of the next tick, before input.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13066,23 +15623,20 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "saveXML", + "name": "runOnGameThread", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "T" + "java.lang.Runnable" ], "returns": "void", "parameterNames": [ - "path", - "obj" + "task" ], "parameterDescriptions": [ - "the path where the XML file will be saved", - "the object to be saved as XML" + "" ], - "description": "Saves the given object as an XML file at the specified path.", + "description": "Runs a task at the start of the next tick, before input.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13090,103 +15644,99 @@ ] }, { - "id": "extensions/fs/SaveData/constructor", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", + "id": "extension/Frame/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "signatures": [], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [] + }, + { + "id": "extension/Frame/getArgb", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", "signatures": [ { - "name": "SaveData", - "constructor": true, + "name": "getArgb", + "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "java.lang.String", - "java.lang.Class" - ], - "returns": "org.openpatch.scratch.extensions.fs.SaveData", - "parameterNames": [ - "gameId", - "slot", - "type" - ], - "parameterDescriptions": [ - "a stable identifier, for example org.openpatch.coincatcher", - "a slot name, for example slot1, slot2 or slot3", - "the data class to load" - ], - "description": "Selects a game's save slot without creating a file or opening a database.", + "parameters": [], + "returns": "int[]", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Straight ARGB, top row first.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/fs/SaveData/getLocation", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "getLocation", + "name": "getArgb", "constructor": false, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "int[]", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", - "returnDescription": "a description of the save location", + "description": "Straight ARGB, top row first.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/fs/SaveData/loadOrDefault", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", + "id": "extension/Frame/getHeight", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", "signatures": [ { - "name": "loadOrDefault", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "java.util.function.Supplier" - ], - "returns": "T", - "parameterNames": [ - "defaults" - ], - "parameterDescriptions": [ - "creates initial progress for a missing slot; called only when missing" - ], - "description": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", - "returnDescription": "loaded progress, or the supplied defaults for a missing slot", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "getHeight", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/fs/SaveData/path", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", + "id": "extension/Frame/getWidth", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", "signatures": [ { - "name": "path", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "java.nio.file.Path", + "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", - "returnDescription": "the desktop file path", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -13195,62 +15745,62 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "path", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "java.nio.file.Path", + "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", - "returnDescription": "the desktop file path", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/fs/SaveData/save", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", + "id": "extension/Frame/savePng", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", "signatures": [ { - "name": "save", + "name": "savePng", "constructor": false, "static": false, "parameters": [ - "T" + "java.nio.file.Path" ], "returns": "void", "parameterNames": [ - "data" + "file" ], "parameterDescriptions": [ - "the progress to save; must not be null" + "" ], - "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "save", + "name": "savePng", "constructor": false, "static": false, "parameters": [ - "T" + "java.nio.file.Path" ], "returns": "void", "parameterNames": [ - "data" + "file" ], "parameterDescriptions": [ - "the progress to save; must not be null" + "" ], - "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13258,52 +15808,32 @@ ] }, { - "id": "extensions/pixels/Pixels/background", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "signatures": [ - { - "name": "background", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int[]", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the pixels of the background layer, where the pen and stamps draw.", - "returnDescription": "one colour per pixel", - "scratchblock": "", - "since": "" - } - ], + "id": "extension/ImageDecoder/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder", + "signatures": [], "status": "desktop-only", "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/pixels/Pixels/constructor", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", + "id": "extension/ImageDecoder/decode", + "owner": "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder", "signatures": [ { - "name": "Pixels", - "constructor": true, + "name": "decode", + "constructor": false, "static": false, "parameters": [ - "processing.core.PGraphics", - "processing.core.PGraphics", - "processing.core.PGraphics" + "byte[]" ], - "returns": "org.openpatch.scratch.extensions.pixels.Pixels", + "returns": "org.openpatch.scratch.extension.ExtensionContext.DecodedImage", "parameterNames": [ - "mainBuffer", - "backgroundBuffer", - "foregroundBuffer" + "file" ], "parameterDescriptions": [ - "where the sprites are drawn", - "where the background is drawn", - "where the foreground is drawn" + "" ], - "description": "Creates the pixel access for a stage.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13313,117 +15843,101 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "Pixels", - "constructor": true, + "name": "decode", + "constructor": false, "static": false, "parameters": [ - "processing.core.PGraphics", - "processing.core.PGraphics", - "processing.core.PGraphics" + "byte[]" ], - "returns": "org.openpatch.scratch.extensions.pixels.Pixels", + "returns": "org.openpatch.scratch.extension.ExtensionContext.DecodedImage", "parameterNames": [ - "mainBuffer", - "backgroundBuffer", - "foregroundBuffer" - ], - "parameterDescriptions": [ - "where the sprites are drawn", - "where the background is drawn", - "where the foreground is drawn" - ], - "description": "Creates the pixel access for a stage.", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ] - }, - { - "id": "extensions/pixels/Pixels/foreground", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "signatures": [ - { - "name": "foreground", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int[]", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the pixels of the foreground layer.", - "returnDescription": "one colour per pixel", + "file" + ], + "parameterDescriptions": [ + "" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } - ], + ] + }, + { + "id": "extension/InputKey/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "signatures": [], "status": "desktop-only", "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/pixels/Pixels/main", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", + "id": "extension/InputKey/copy", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", "signatures": [ { - "name": "main", + "name": "copy", "constructor": false, "static": false, - "parameters": [], - "returns": "int[]", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the pixels of the layer the sprites are drawn on.", - "returnDescription": "one colour per pixel", + "parameters": [ + "T", + "T" + ], + "returns": "void", + "parameterNames": [ + "from", + "into" + ], + "parameterDescriptions": [ + "", + "" + ], + "description": "For the core: copies one state into another.", + "returnDescription": "", "scratchblock": "", "since": "" } ], "status": "desktop-only", "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/recorder/FFmpegRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "signatures": [ + "missingBrowserSignatures": [ { - "name": "FFmpegRecorder", - "constructor": true, + "name": "copy", + "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "T", + "T" ], - "returns": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", + "returns": "void", "parameterNames": [ - "path" + "from", + "into" ], "parameterDescriptions": [ - "the path where the recording will be saved\n \n\nThis constructor initializes the FFmpegRecorder by creating a temporary directory and\n setting up a pattern for temporary PNG files. If the temporary directory cannot be created,\n an error message is printed to the console." + "", + "" ], - "description": "Constructs an FFmpegRecorder object with the specified path.", + "description": "For the core: copies one state into another.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/recorder/FFmpegRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", + "id": "extension/InputKey/create", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", "signatures": [ { - "name": "saveFrame", + "name": "create", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "T", "parameterNames": [], "parameterDescriptions": [], - "description": "Saves the current frame using the specified pattern.", + "description": "For the core: makes a state for this key.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13433,14 +15947,14 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "saveFrame", + "name": "create", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "T", "parameterNames": [], "parameterDescriptions": [], - "description": "Saves the current frame using the specified pattern.", + "description": "For the core: makes a state for this key.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13448,68 +15962,78 @@ ] }, { - "id": "extensions/recorder/FFmpegRecorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", + "id": "extension/InputKey/of", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", "signatures": [ { - "name": "stop", + "name": "of", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Stops the recording process and converts the recorded frames into a video file using FFmpeg.\n\nThis method overrides the `stop` method from the superclass. It first calls the superclass's\n`stop` method, then checks if the temporary directory (`tmpDir`) is not null. If it is not\nnull, it constructs a command to run FFmpeg, which converts the recorded frames (stored as PNG\nfiles) into a video file with the specified frame rate and codec.\n\nThe FFmpeg command is executed, and a message is printed to the console indicating that the\nvideo conversion is in progress. If there is an error during the execution of the command, the\nerror message is printed to the console.", - "returnDescription": "", + "static": true, + "parameters": [ + "java.lang.String", + "java.util.function.Supplier", + "java.util.function.BiConsumer" + ], + "returns": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "parameterNames": [ + "name", + "factory", + "copy" + ], + "parameterDescriptions": [ + "for messages", + "makes an empty state (twice: one per thread)", + "copies the window thread's state into the game thread's: (from, into)" + ], + "description": "", + "returnDescription": "the key", "scratchblock": "", "since": "" } ], "status": "desktop-only", "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/recorder/FrameRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "signatures": [ + "missingBrowserSignatures": [ { - "name": "FrameRecorder", - "constructor": true, - "static": false, + "name": "of", + "constructor": false, + "static": true, "parameters": [ - "java.lang.String" + "java.lang.String", + "java.util.function.Supplier", + "java.util.function.BiConsumer" ], - "returns": "org.openpatch.scratch.extensions.recorder.FrameRecorder", + "returns": "org.openpatch.scratch.extension.ExtensionContext.InputKey", "parameterNames": [ - "outputFolder" + "name", + "factory", + "copy" ], "parameterDescriptions": [ - "the folder where the recorded frames will be saved" + "for messages", + "makes an empty state (twice: one per thread)", + "copies the window thread's state into the game thread's: (from, into)" ], - "description": "Constructs a new FrameRecorder with the specified output folder.", - "returnDescription": "", + "description": "", + "returnDescription": "the key", "scratchblock": "", "since": "" } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/recorder/FrameRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", + "id": "extension/InputKey/toString", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", "signatures": [ { - "name": "saveFrame", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Saves the current frame of the stage to the specified output folder. The frame is saved as a\nPNG file with a filename pattern \"#######.png\". The exact filename will be generated based on\nthe current frame number. The picture is the stage at its own size, also when the window is\nbigger.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13519,14 +16043,14 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "saveFrame", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Saves the current frame of the stage to the specified output folder. The frame is saved as a\nPNG file with a filename pattern \"#######.png\". The exact filename will be generated based on\nthe current frame number. The picture is the stage at its own size, also when the window is\nbigger.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13534,24 +16058,32 @@ ] }, { - "id": "extensions/recorder/FrameRecorder/snapshot", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", + "id": "extension/InputSnapshot/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputSnapshot", + "signatures": [], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [] + }, + { + "id": "extension/InputSnapshot/get", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputSnapshot", "signatures": [ { - "name": "snapshot", + "name": "get", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "filename" + "key" ], "parameterDescriptions": [ - "the name of the file to save the snapshot to" + "" ], - "description": "Takes a snapshot of the current frame and saves it to the specified filename.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13561,20 +16093,20 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "snapshot", + "name": "get", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "filename" + "key" ], "parameterDescriptions": [ - "the name of the file to save the snapshot to" + "" ], - "description": "Takes a snapshot of the current frame and saves it to the specified filename.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13582,46 +16114,35 @@ ] }, { - "id": "extensions/recorder/GifRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "signatures": [ - { - "name": "GifRecorder", - "constructor": true, - "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "parameterNames": [ - "filePath" - ], - "parameterDescriptions": [ - "the path where the GIF file will be saved" - ], - "description": "Constructs a new GifRecorder object.", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ], + "id": "extension/LayerDrawer/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer", + "signatures": [], "status": "desktop-only", "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/GifRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", + "id": "extension/LayerDrawer/draw", + "owner": "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer", "signatures": [ { - "name": "saveFrame", + "name": "draw", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Stage", + "org.openpatch.scratch.extension.Canvas" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Saves the current frame of the stage as a GIF image.\n\nThis method captures the stage at its own size, sets the frame rate, and adds the frame to\nthe GIF encoder. A window that is bigger than the stage (maximized, say) records the stage\nwithout the bars around it, and the frames keep their size when the window changes during the\nrecording.\n\nNote: This method catches and ignores any NullPointerException that may occur.", + "parameterNames": [ + "stage", + "canvas" + ], + "parameterDescriptions": [ + "", + "" + ], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13631,14 +16152,23 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "saveFrame", + "name": "draw", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Stage", + "org.openpatch.scratch.extension.Canvas" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Saves the current frame of the stage as a GIF image.\n\nThis method captures the stage at its own size, sets the frame rate, and adds the frame to\nthe GIF encoder. A window that is bigger than the stage (maximized, say) records the stage\nwithout the bars around it, and the frames keep their size when the window changes during the\nrecording.\n\nNote: This method catches and ignores any NullPointerException that may occur.", + "parameterNames": [ + "stage", + "canvas" + ], + "parameterDescriptions": [ + "", + "" + ], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13646,795 +16176,822 @@ ] }, { - "id": "extensions/recorder/GifRecorder/snapshot", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", + "id": "gamepad/Gamepad/constructor", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "gamepad/Gamepad/getStick", + "owner": "org.openpatch.scratch.gamepad.Gamepad", "signatures": [ { - "name": "snapshot", + "name": "getStick", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the\ncurrent frame, and then finishes the encoding process.", - "returnDescription": "", + "static": true, + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadStick" + ], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [ + "stick" + ], + "parameterDescriptions": [ + "the stick to ask about" + ], + "description": "Where the first connected controller's stick points, (0, 0) if there is none.", + "returnDescription": "its position, x \\u22121 to 1 and y \\u22121 to 1 (up is positive)", "scratchblock": "", "since": "" - } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [ + }, { - "name": "snapshot", + "name": "getStick", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the\ncurrent frame, and then finishes the encoding process.", - "returnDescription": "", + "static": true, + "parameters": [ + "int", + "org.openpatch.scratch.gamepad.GamepadStick" + ], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [ + "player", + "stick" + ], + "parameterDescriptions": [ + "the player, 1 to 4", + "the stick to ask about" + ], + "description": "Where the player's controller's stick points, (0, 0) if it is not connected.", + "returnDescription": "its position, x \\u22121 to 1 and y \\u22121 to 1 (up is positive)", "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/GifRecorder/start", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", + "id": "gamepad/Gamepad/getTrigger", + "owner": "org.openpatch.scratch.gamepad.Gamepad", "signatures": [ { - "name": "start", + "name": "getTrigger", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Starts the GIF recording process.", - "returnDescription": "", + "static": true, + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadTrigger" + ], + "returns": "double", + "parameterNames": [ + "trigger" + ], + "parameterDescriptions": [ + "the trigger to ask about" + ], + "description": "How far down the first connected controller's trigger is, 0 if there is none.", + "returnDescription": "how far it is pressed, 0 (not at all) to 1 (fully)", "scratchblock": "", "since": "" - } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/recorder/GifRecorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "signatures": [ + }, { - "name": "stop", + "name": "getTrigger", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Stops the GIF recording process and finalizes the GIF file.", - "returnDescription": "", + "static": true, + "parameters": [ + "int", + "org.openpatch.scratch.gamepad.GamepadTrigger" + ], + "returns": "double", + "parameterNames": [ + "player", + "trigger" + ], + "parameterDescriptions": [ + "the player, 1 to 4", + "the trigger to ask about" + ], + "description": "How far down the player's controller's trigger is, 0 if it is not connected.", + "returnDescription": "how far it is pressed, 0 (not at all) to 1 (fully)", "scratchblock": "", "since": "" } ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/Recorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", + "id": "gamepad/Gamepad/isButtonPressed", + "owner": "org.openpatch.scratch.gamepad.Gamepad", "signatures": [ { - "name": "Recorder", - "constructor": true, - "static": false, + "name": "isButtonPressed", + "constructor": false, + "static": true, "parameters": [ - "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.gamepad.GamepadButton" ], - "returns": "org.openpatch.scratch.extensions.recorder.Recorder", + "returns": "boolean", "parameterNames": [ - "path", - "ext" + "button" ], "parameterDescriptions": [ - "the file path where the recording will be saved", - "the file extension to be used for the recording" + "the button to ask about" ], - "description": "Constructs a new Recorder object with the specified file path and extension. If the provided\npath does not end with the specified extension, the extension is appended to the path.", - "returnDescription": "", + "description": "Whether any controller has the button down.", + "returnDescription": "whether it is down on any connected controller", "scratchblock": "", "since": "" - } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [ + }, { - "name": "Recorder", - "constructor": true, - "static": false, + "name": "isButtonPressed", + "constructor": false, + "static": true, "parameters": [ - "java.lang.String", - "java.lang.String" + "int", + "org.openpatch.scratch.gamepad.GamepadButton" ], - "returns": "org.openpatch.scratch.extensions.recorder.Recorder", + "returns": "boolean", "parameterNames": [ - "path", - "ext" + "player", + "button" ], "parameterDescriptions": [ - "the file path where the recording will be saved", - "the file extension to be used for the recording" + "the player, 1 to 4", + "the button to ask about" ], - "description": "Constructs a new Recorder object with the specified file path and extension. If the provided\npath does not end with the specified extension, the extension is appended to the path.", - "returnDescription": "", + "description": "Whether the player's controller has the button down.", + "returnDescription": "whether it is down on that player's controller", "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/Recorder/post", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", + "id": "gamepad/Gamepad/isConnected", + "owner": "org.openpatch.scratch.gamepad.Gamepad", "signatures": [ { - "name": "post", + "name": "isConnected", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Called after each frame is drawn. This method is registered with the Applet class to ensure\nthat frames are saved at the appropriate time during the recording process.", + "description": "Whether any controller is connected.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [ + }, { - "name": "post", + "name": "isConnected", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Called after each frame is drawn. This method is registered with the Applet class to ensure\nthat frames are saved at the appropriate time during the recording process.", - "returnDescription": "", + "static": true, + "parameters": [ + "int" + ], + "returns": "boolean", + "parameterNames": [ + "player" + ], + "parameterDescriptions": [ + "the player, 1 to 4" + ], + "description": "Whether a controller sits in the player's slot.", + "returnDescription": "whether that slot has a controller", "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "gamepad/GamepadListener/constructor", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/Recorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", + "id": "gamepad/GamepadListener/whenGamepadButtonPressed", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", "signatures": [ { - "name": "saveFrame", + "name": "whenGamepadButtonPressed", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadButton" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Saves the current frame. This method should be implemented by subclasses to define the specific\nbehavior for saving a frame.", + "parameterNames": [ + "button" + ], + "parameterDescriptions": [ + "the button that was pressed" + ], + "description": "A button went down on one of the controllers.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [ - { - "name": "saveFrame", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Saves the current frame. This method should be implemented by subclasses to define the specific\nbehavior for saving a frame.", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ] + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/Recorder/start", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", + "id": "gamepad/GamepadListener/whenGamepadButtonReleased", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", "signatures": [ { - "name": "start", + "name": "whenGamepadButtonReleased", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadButton" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Starts the recording process.", + "parameterNames": [ + "button" + ], + "parameterDescriptions": [ + "the button that was released" + ], + "description": "A button came up on one of the controllers.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/Recorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", + "id": "gamepad/GamepadListener/whenGamepadConnected", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", "signatures": [ { - "name": "stop", + "name": "whenGamepadConnected", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "int" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Stops the recording process.", + "parameterNames": [ + "player" + ], + "parameterDescriptions": [ + "the player whose slot got a controller, 1 to 4" + ], + "description": "A controller appeared in a player's slot.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "extensions/shader/Shader/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shader", + "id": "recorder/GifEncoder/addFrame", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "Shader", - "constructor": true, + "name": "addFrame", + "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String", - "java.lang.String" + "int[]", + "int", + "int" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader", + "returns": "boolean", "parameterNames": [ - "name", - "fragmentShaderPath", - "vertexShaderPath" + "argb", + "width", + "height" ], "parameterDescriptions": [ - "unique name", - "path to the fragment shader file", - "path to the vertex shader file, or null for Processing's default one" + "int array containing the frame's pixels, top row first.", + "int frame width.", + "int frame height." ], - "description": "Constructor", - "returnDescription": "", + "description": "Adds next GIF frame as an ARGB pixel array, top row first (0xAARRGGBB). The alpha channel is\nignored. The frame is not written immediately, but is actually deferred until the next frame\nis received so that timing data can be inserted. Invoking finish() flushes all\nframes. The size of the first frame is used for all subsequent frames; frames of another size\nare scaled with nearest-neighbour sampling.", + "returnDescription": "true if successful.", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "Shader", - "constructor": true, + "name": "addFrame", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.shader.Shader" + "int[]", + "int", + "int" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader", + "returns": "boolean", "parameterNames": [ - "shader" + "argb", + "width", + "height" ], "parameterDescriptions": [ - "shader" + "int array containing the frame's pixels, top row first.", + "int frame width.", + "int frame height." ], - "description": "Copy constructor", - "returnDescription": "", + "description": "Adds next GIF frame as an ARGB pixel array, top row first (0xAARRGGBB). The alpha channel is\nignored. The frame is not written immediately, but is actually deferred until the next frame\nis received so that timing data can be inserted. Invoking finish() flushes all\nframes. The size of the first frame is used for all subsequent frames; frames of another size\nare scaled with nearest-neighbour sampling.", + "returnDescription": "true if successful.", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shader/getName", - "owner": "org.openpatch.scratch.extensions.shader.Shader", + "id": "recorder/GifEncoder/constructor", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "getName", - "constructor": false, + "name": "GifEncoder", + "constructor": true, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "org.openpatch.scratch.recorder.GifEncoder", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the name", - "returnDescription": "the name", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ + { + "name": "GifEncoder", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.recorder.GifEncoder", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/shader/Shader/getPShader", - "owner": "org.openpatch.scratch.extensions.shader.Shader", + "id": "recorder/GifEncoder/finish", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "getPShader", + "name": "finish", "constructor": false, "static": false, "parameters": [], - "returns": "processing.opengl.PShader", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the shader", - "returnDescription": "the shader", + "description": "Flushes any pending data and closes output file. If writing to an OutputStream, the stream is\nnot closed.", + "returnDescription": "true if finished", "scratchblock": "", "since": "" } ], "status": "desktop-only", - "reason": "Processing's PShader object belongs to the desktop renderer. The browser uses WebGL filters.", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "missingBrowserSignatures": [ { - "name": "getPShader", + "name": "finish", "constructor": false, "static": false, "parameters": [], - "returns": "processing.opengl.PShader", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the shader", - "returnDescription": "the shader", + "description": "Flushes any pending data and closes output file. If writing to an OutputStream, the stream is\nnot closed.", + "returnDescription": "true if finished", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", + "id": "recorder/GifEncoder/setDelay", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "set", + "name": "setDelay", "constructor": false, "static": false, "parameters": [ - "java.lang.String", "int" ], "returns": "void", "parameterNames": [ - "name", - "x" + "ms" ], "parameterDescriptions": [ - "the name of the uniform in the shader file", - "the value" + "int delay time in milliseconds" ], - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "description": "Sets the delay time between each frame, or changes it for subsequent frames (applies to last\nframe added).", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "set", + "name": "setDelay", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "boolean" + "int" ], "returns": "void", "parameterNames": [ - "name", - "x" + "ms" ], "parameterDescriptions": [ - "", - "" + "int delay time in milliseconds" ], - "description": "", + "description": "Sets the delay time between each frame, or changes it for subsequent frames (applies to last\nframe added).", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "recorder/GifEncoder/setDispose", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "signatures": [ { - "name": "set", + "name": "setDispose", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double" + "int" ], "returns": "void", "parameterNames": [ - "name", - "x" + "code" ], "parameterDescriptions": [ - "", - "" + "int disposal code." ], - "description": "", + "description": "Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default\nis 0 if no transparent color has been set, otherwise 2.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "set", + "name": "setDispose", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "int", "int" ], "returns": "void", "parameterNames": [ - "name", - "x", - "y" + "code" ], "parameterDescriptions": [ - "", - "", - "" + "int disposal code." ], - "description": "", + "description": "Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default\nis 0 if no transparent color has been set, otherwise 2.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "recorder/GifEncoder/setFrameRate", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "signatures": [ { - "name": "set", + "name": "setFrameRate", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "boolean", - "boolean" + "float" ], "returns": "void", "parameterNames": [ - "name", - "x", - "y" + "fps" ], "parameterDescriptions": [ - "", - "", - "" + "float frame rate (frames per second)" ], - "description": "", + "description": "Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "set", + "name": "setFrameRate", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double", - "double" + "float" ], "returns": "void", "parameterNames": [ - "name", - "x", - "y" + "fps" ], "parameterDescriptions": [ - "", - "", - "" + "float frame rate (frames per second)" ], - "description": "", + "description": "Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "recorder/GifEncoder/setQuality", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "signatures": [ { - "name": "set", + "name": "setQuality", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "org.openpatch.scratch.Vector2" + "int" ], "returns": "void", "parameterNames": [ - "name", - "vec" + "quality" ], "parameterDescriptions": [ - "", - "" + "int greater than 0." ], - "description": "", + "description": "Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by\nthe GIF specification). Lower values (minimum = 1) produce better colors, but slow processing\nsignificantly. 10 is the default, and produces good color mapping at reasonable speeds. Values\ngreater than 20 do not yield significant improvements in speed.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "set", + "name": "setQuality", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "int[]", "int" ], "returns": "void", "parameterNames": [ - "name", - "values", - "ncoords" + "quality" ], "parameterDescriptions": [ - "", - "", - "" + "int greater than 0." ], - "description": "", + "description": "Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by\nthe GIF specification). Lower values (minimum = 1) produce better colors, but slow processing\nsignificantly. 10 is the default, and produces good color mapping at reasonable speeds. Values\ngreater than 20 do not yield significant improvements in speed.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "recorder/GifEncoder/setRepeat", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "signatures": [ { - "name": "set", + "name": "setRepeat", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double[]", "int" ], "returns": "void", "parameterNames": [ - "name", - "values", - "ncoords" + "iter" ], "parameterDescriptions": [ - "", - "", - "" + "int number of iterations." ], - "description": "", + "description": "Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play\nindefinitely. Must be invoked before the first image is added.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "set", + "name": "setRepeat", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "org.openpatch.scratch.Color" + "int" ], "returns": "void", "parameterNames": [ - "name", - "c" + "iter" ], "parameterDescriptions": [ - "", - "" + "int number of iterations." ], - "description": "", + "description": "Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play\nindefinitely. Must be invoked before the first image is added.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shader/setName", - "owner": "org.openpatch.scratch.extensions.shader.Shader", + "id": "recorder/GifEncoder/setTransparent", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "setName", + "name": "setTransparent", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "int" ], "returns": "void", "parameterNames": [ - "name" + "rgb" ], "parameterDescriptions": [ - "unique name" + "int color (0xRRGGBB) to be treated as transparent on display, or -1 for none." ], - "description": "Sets the name", + "description": "Sets the transparent color for the last added frame and any subsequent frames. Since all\ncolors are subject to modification in the quantization process, the color in the final palette\nfor each frame closest to the given color becomes the transparent color for that frame. May be\nset to -1 to indicate no transparent color.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/shader/Shaders/activate", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "signatures": [ + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "activate", + "name": "setTransparent", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "int" ], "returns": "void", "parameterNames": [ - "name" + "rgb" ], "parameterDescriptions": [ - "the name of the shader" + "int color (0xRRGGBB) to be treated as transparent on display, or -1 for none." ], - "description": "Draws with the shader of the given name as well, without stopping the\nothers. Active shaders take turns in the order they were added, each\nworking on what the one before it drew, so a stage can be tinted and\nwobble at the same time. A sprite draws with the first of its active\nshaders only.", + "description": "Sets the transparent color for the last added frame and any subsequent frames. Since all\ncolors are subject to modification in the quantization process, the color in the final palette\nfor each frame closest to the given color becomes the transparent color for that frame. May be\nset to -1 to indicate no transparent color.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shaders/add", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/GifEncoder/start", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "add", + "name": "start", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String", - "java.lang.String" + "java.io.OutputStream" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader", + "returns": "boolean", "parameterNames": [ - "name", - "fragmentShaderPath", - "vertexShaderPath" + "os" ], "parameterDescriptions": [ - "a unique name", - "the path to the fragment shader", - "the path to the vertex shader, may be null" + "OutputStream on which GIF images are written." ], - "description": "Adds a shader. If a shader with the given name already exists, that one is\nreturned instead.\n\nThe first shader added is drawn with right away; the ones after it wait\nuntil [switchTo(String)](switchTo), [next()](next) or\n[activate(String)](activate) picks them.\n\nThe vertex shader is usually `null`, which uses Processing's default\none. In the browser any other vertex shader is ignored.", - "returnDescription": "the shader", + "description": "Initiates GIF file creation on the given stream. The stream is not closed automatically.", + "returnDescription": "false if initial write failed.", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/shader/Shaders/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "signatures": [ + }, { - "name": "Shaders", - "constructor": true, + "name": "start", + "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "org.openpatch.scratch.extensions.shader.Shaders", + "returns": "boolean", "parameterNames": [ - "owner" + "file" ], "parameterDescriptions": [ - "what the shaders belong to, used in error messages: \"sprite\" or\n \"stage\"" + "String containing output file name." ], - "description": "Creates an empty set of shaders.", - "returnDescription": "", + "description": "Initiates writing of a GIF file with the specified name.", + "returnDescription": "false if open or initial write failed.", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "Shaders", - "constructor": true, + "name": "start", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.shader.Shaders" + "java.io.OutputStream" ], - "returns": "org.openpatch.scratch.extensions.shader.Shaders", + "returns": "boolean", "parameterNames": [ - "s" + "os" ], "parameterDescriptions": [ - "the shaders to copy" + "OutputStream on which GIF images are written." ], - "description": "Copies a set of shaders.", - "returnDescription": "", + "description": "Initiates GIF file creation on the given stream. The stream is not closed automatically.", + "returnDescription": "false if initial write failed.", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/shader/Shaders/deactivate", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "signatures": [ + }, { - "name": "deactivate", + "name": "start", "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "void", + "returns": "boolean", "parameterNames": [ - "name" + "file" ], "parameterDescriptions": [ - "the name of the shader" + "String containing output file name." ], - "description": "Stops drawing with the shader of the given name. The other active shaders\nstay.", - "returnDescription": "", + "description": "Initiates writing of a GIF file with the specified name.", + "returnDescription": "false if open or initial write failed.", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shaders/get", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/GifRecorder/constructor", + "owner": "org.openpatch.scratch.recorder.GifRecorder", "signatures": [ { - "name": "get", - "constructor": false, + "name": "GifRecorder", + "constructor": true, "static": false, "parameters": [ "java.lang.String" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader", + "returns": "org.openpatch.scratch.recorder.GifRecorder", "parameterNames": [ - "name" + "path" ], "parameterDescriptions": [ - "the name of the shader" + "the GIF file to write; `.gif` is added when missing" ], - "description": "Returns a shader by name.", - "returnDescription": "the shader, or null if there is none with that name", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -14444,19 +17001,19 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/shader/Shaders/getActive", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/GifRecorder/snapshot", + "owner": "org.openpatch.scratch.recorder.GifRecorder", "signatures": [ { - "name": "getActive", + "name": "snapshot", "constructor": false, "static": false, "parameters": [], - "returns": "java.util.List", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the shaders drawn with, in the order they take turns: the order in\nwhich they were added.", - "returnDescription": "a new list of the active shaders, empty if there are none", + "description": "Saves the next frame as a GIF of one frame.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -14466,19 +17023,19 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/shader/Shaders/getCurrent", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/GifRecorder/start", + "owner": "org.openpatch.scratch.recorder.GifRecorder", "signatures": [ { - "name": "getCurrent", + "name": "start", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shader", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the shader currently drawn with. With several active, this is the\nfirst of them.", - "returnDescription": "the current shader, or null if there is none", + "description": "Starts recording from the next frame on.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -14488,19 +17045,19 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/shader/Shaders/getCurrentIndex", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/GifRecorder/stop", + "owner": "org.openpatch.scratch.recorder.GifRecorder", "signatures": [ { - "name": "getCurrentIndex", + "name": "stop", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the position of the current shader.", - "returnDescription": "the position, or -1 if no shader is in use", + "description": "Stops recording and finishes the file.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -14510,188 +17067,155 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/shader/Shaders/getCurrentName", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/RecorderExtension/constructor", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "getCurrentName", - "constructor": false, + "name": "RecorderExtension", + "constructor": true, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "org.openpatch.scratch.recorder.RecorderExtension", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the name of the current shader.", - "returnDescription": "the name, or null if no shader is in use", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/shader/Shaders/isActive", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "isActive", - "constructor": false, + "name": "RecorderExtension", + "constructor": true, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "boolean", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the name of the shader" - ], - "description": "Returns whether the shader of the given name is drawn with.", - "returnDescription": "true if the shader is active", + "parameters": [], + "returns": "org.openpatch.scratch.recorder.RecorderExtension", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shaders/next", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/RecorderExtension/id", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "next", + "name": "id", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Switches to the next shader, in the order they were added. After the last\none comes the first one again. It is then the only one drawn with.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/shader/Shaders/reset", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "reset", + "name": "id", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Stops drawing with shaders, so the sprite or stage looks as it does\nwithout one. The shaders are kept: [switchTo(String)](switchTo),\n[next()](next) or [activate(String)](activate) brings one back.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shaders/switchTo", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/RecorderExtension/install", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "switchTo", + "name": "install", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "name" + "ctx" ], "parameterDescriptions": [ - "the name of the shader" + "" ], - "description": "Switches to the shader with the given name, or with the given position in\nthe order the shaders were added. It is then the only one drawn with. A\nname that is not there leaves the shaders as they are and prints which ones\nthere are.", + "description": "Hands every drawn frame to the recorders that are recording; frames are read back only then.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "switchTo", + "name": "install", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "index" + "ctx" ], "parameterDescriptions": [ - "the position of the shader" + "" ], - "description": "Switches to the shader at the given position. It is then the only one drawn\nwith.", + "description": "Hands every drawn frame to the recorders that are recording; frames are read back only then.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/sorting/Sorting/by", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", + "id": "recorder/RecorderExtension/name", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "by", + "name": "name", "constructor": false, "static": false, - "parameters": [ - "java.util.Comparator" - ], - "returns": "void", - "parameterNames": [ - "comparator" - ], - "parameterDescriptions": [ - "decides which of two sprites is drawn first" - ], - "description": "Draws sprites in an order of your own.", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "missingBrowserSignatures": [ { - "name": "by", + "name": "name", "constructor": false, "static": false, - "parameters": [ - "java.util.Comparator" - ], - "returns": "void", - "parameterNames": [ - "comparator" - ], - "parameterDescriptions": [ - "decides which of two sprites is drawn first" - ], - "description": "Draws sprites in an order of your own.", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -14699,244 +17223,356 @@ ] }, { - "id": "extensions/sorting/Sorting/byY", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", + "id": "recorder/RecorderExtension/requires", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "byY", + "name": "requires", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Draws sprites that are further down the stage in front of sprites that are\nfurther up, which is what a view from above usually wants.", + "description": "First-party extensions are released together with the core.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/sorting/Sorting/constructor", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "Sorting", - "constructor": true, + "name": "requires", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.sorting.Sorting", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "", + "description": "First-party extensions are released together with the core.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/sorting/Sorting/getComparator", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", + "id": "recorder/RecorderExtension/version", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "getComparator", + "name": "version", "constructor": false, "static": false, "parameters": [], - "returns": "java.util.Comparator", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the order currently used.", - "returnDescription": "the comparator, or null if the sprites are not sorted", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "missingBrowserSignatures": [ { - "name": "getComparator", + "name": "version", "constructor": false, "static": false, "parameters": [], - "returns": "java.util.Comparator", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the order currently used.", - "returnDescription": "the comparator, or null if the sprites are not sorted", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/sorting/Sorting/isOn", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", + "id": "save/File/constructor", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "isOn", - "constructor": false, + "name": "File", + "constructor": true, "static": false, "parameters": [], - "returns": "boolean", + "returns": "org.openpatch.scratch.save.File", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks whether the sprites are being sorted.", - "returnDescription": "true if an order is set", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/sorting/Sorting/off", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", + "id": "save/File/load", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "off", + "name": "load", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Draws sprites in the order they were added, which is the default.", - "returnDescription": "", + "static": true, + "parameters": [ + "java.lang.String", + "java.lang.Class" + ], + "returns": "T", + "parameterNames": [ + "path", + "cls" + ], + "parameterDescriptions": [ + "the path to the file from which the object is to be loaded", + "the class of the object to be loaded" + ], + "description": "Loads an object of the specified class from a file at the given path.", + "returnDescription": "the loaded object of the specified class", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/sound/SoundPlayback/close", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/File/loadOrCreate", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "close", + "name": "loadOrCreate", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Stops this playback.", - "returnDescription": "", + "static": true, + "parameters": [ + "java.lang.String", + "java.lang.Class" + ], + "returns": "T", + "parameterNames": [ + "path", + "cls" + ], + "parameterDescriptions": [ + "the path to the file from which the object is to be loaded", + "the class of the object to be loaded" + ], + "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", + "returnDescription": "the loaded object of the specified class, or a new instance if the\n file does not exist", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/sound/SoundPlayback/constructor", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "signatures": [], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "id": "save/File/loadXML", + "owner": "org.openpatch.scratch.save.File", + "signatures": [ + { + "name": "loadXML", + "constructor": false, + "static": true, + "parameters": [ + "java.lang.String", + "java.lang.Class" + ], + "returns": "T", + "parameterNames": [ + "path", + "cls" + ], + "parameterDescriptions": [ + "the path to the XML file", + "the class of the object to be loaded" + ], + "description": "Loads an object of the specified class from an XML file at the given path.", + "returnDescription": "the object loaded from the XML file", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/sound/SoundPlayback/getName", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/File/loadXMLOrCreate", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "getName", + "name": "loadXMLOrCreate", "constructor": false, - "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", - "returnDescription": "the name of the sound", + "static": true, + "parameters": [ + "java.lang.String", + "java.lang.Class" + ], + "returns": "T", + "parameterNames": [ + "path", + "cls" + ], + "parameterDescriptions": [ + "the path to the XML file", + "the class of the object to be loaded" + ], + "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", + "returnDescription": "the object loaded from the XML file, or a new instance if the file\n does not exist", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/sound/SoundPlayback/getVolume", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/File/save", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "getVolume", + "name": "save", "constructor": false, - "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", - "returnDescription": "this playback's volume in percent", + "static": true, + "parameters": [ + "java.lang.String", + "T" + ], + "returns": "void", + "parameterNames": [ + "path", + "obj" + ], + "parameterDescriptions": [ + "the path where the object should be saved", + "the object to be saved" + ], + "description": "Saves the given object to the specified path in the default file type (JSON).", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "save", + "constructor": false, + "static": true, + "parameters": [ + "java.lang.String", + "T" + ], + "returns": "void", + "parameterNames": [ + "path", + "obj" + ], + "parameterDescriptions": [ + "the path where the object should be saved", + "the object to be saved" + ], + "description": "Saves the given object to the specified path in the default file type (JSON).", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/sound/SoundPlayback/isPlaying", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/File/saveXML", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "isPlaying", + "name": "saveXML", "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", - "returnDescription": "whether this playback is queued or playing", + "static": true, + "parameters": [ + "java.lang.String", + "T" + ], + "returns": "void", + "parameterNames": [ + "path", + "obj" + ], + "parameterDescriptions": [ + "the path where the XML file will be saved", + "the object to be saved as XML" + ], + "description": "Saves the given object as an XML file at the specified path.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "saveXML", + "constructor": false, + "static": true, + "parameters": [ + "java.lang.String", + "T" + ], + "returns": "void", + "parameterNames": [ + "path", + "obj" + ], + "parameterDescriptions": [ + "the path where the XML file will be saved", + "the object to be saved as XML" + ], + "description": "Saves the given object as an XML file at the specified path.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/sound/SoundPlayback/setVolume", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/SaveData/constructor", + "owner": "org.openpatch.scratch.save.SaveData", "signatures": [ { - "name": "setVolume", - "constructor": false, + "name": "SaveData", + "constructor": true, "static": false, "parameters": [ - "double" + "java.lang.String", + "java.lang.String", + "java.lang.Class" ], - "returns": "void", + "returns": "org.openpatch.scratch.save.SaveData", "parameterNames": [ - "percent" + "gameId", + "slot", + "type" ], "parameterDescriptions": [ - "volume in percent" + "a stable identifier, for example org.openpatch.coincatcher", + "a slot name, for example slot1, slot2 or slot3", + "the data class to load" ], - "description": "Changes only this playback's volume. Values outside 0..100 are clamped.", + "description": "Selects a game's save slot without creating a file or opening a database.", "returnDescription": "", "scratchblock": "", "since": "" @@ -14947,19 +17583,19 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/sound/SoundPlayback/stop", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/SaveData/getLocation", + "owner": "org.openpatch.scratch.save.SaveData", "signatures": [ { - "name": "stop", + "name": "getLocation", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Stops this playback, leaving other copies alone.", - "returnDescription": "", + "description": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", + "returnDescription": "a description of the save location", "scratchblock": "", "since": "" } @@ -14969,28 +17605,25 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/text/BitmapText/addGlyph", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveData/loadOrDefault", + "owner": "org.openpatch.scratch.save.SaveData", "signatures": [ { - "name": "addGlyph", + "name": "loadOrDefault", "constructor": false, "static": false, "parameters": [ - "char", - "java.lang.String" + "java.util.function.Supplier" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "character", - "path" + "defaults" ], "parameterDescriptions": [ - "the character to replace", - "its image or built-in costume name" + "creates initial progress for a missing slot; called only when missing" ], - "description": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", - "returnDescription": "", + "description": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", + "returnDescription": "loaded progress, or the supplied defaults for a missing slot", "scratchblock": "", "since": "" } @@ -15000,52 +17633,60 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/text/BitmapText/constructor", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveData/path", + "owner": "org.openpatch.scratch.save.SaveData", "signatures": [ { - "name": "BitmapText", - "constructor": true, + "name": "path", + "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "org.openpatch.scratch.extensions.text.BitmapText", - "parameterNames": [ - "pattern" - ], - "parameterDescriptions": [ - "image path with an integer format, e.g. \"assets/font%03d.png\"" - ], - "description": "", - "returnDescription": "", + "parameters": [], + "returns": "java.nio.file.Path", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "returnDescription": "the desktop file path", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "path", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.nio.file.Path", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "returnDescription": "the desktop file path", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/text/BitmapText/draw", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveData/save", + "owner": "org.openpatch.scratch.save.SaveData", "signatures": [ { - "name": "draw", + "name": "save", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "T" ], "returns": "void", "parameterNames": [ - "drawing" + "data" ], "parameterDescriptions": [ - "the current frame's canvas" + "the progress to save; must not be null" ], - "description": "", + "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", "returnDescription": "", "scratchblock": "", "since": "" @@ -15056,249 +17697,159 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/text/BitmapText/getContent", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveExtension/constructor", + "owner": "org.openpatch.scratch.save.SaveExtension", "signatures": [ { - "name": "getContent", - "constructor": false, + "name": "SaveExtension", + "constructor": true, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "org.openpatch.scratch.save.SaveExtension", "parameterNames": [], "parameterDescriptions": [], "description": "", - "returnDescription": "the text being shown", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/text/BitmapText/getHeight", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "getHeight", - "constructor": false, + "name": "SaveExtension", + "constructor": true, "static": false, "parameters": [], - "returns": "int", + "returns": "org.openpatch.scratch.save.SaveExtension", "parameterNames": [], "parameterDescriptions": [], "description": "", - "returnDescription": "the displayed text's height, including line spacing and sprite size", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/text/BitmapText/getWidth", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveExtension/id", + "owner": "org.openpatch.scratch.save.SaveExtension", "signatures": [ { - "name": "getWidth", + "name": "id", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], "description": "", - "returnDescription": "the displayed text's width, including the sprite's size", - "scratchblock": "", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/text/BitmapText/setAlign", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "signatures": [ - { - "name": "setAlign", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.TextAlign" - ], - "returns": "void", - "parameterNames": [ - "align" - ], - "parameterDescriptions": [ - "LEFT, CENTER or RIGHT (DEFAULT means LEFT)" - ], - "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/text/BitmapText/setFont", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "setFont", + "name": "id", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "pattern" - ], - "parameterDescriptions": [ - "glyph path with one integer format for the Unicode code point" - ], + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], "description": "", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/text/BitmapText/setLetterSpacing", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveExtension/name", + "owner": "org.openpatch.scratch.save.SaveExtension", "signatures": [ { - "name": "setLetterSpacing", + "name": "name", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "spacing" - ], - "parameterDescriptions": [ - "gap between characters; negative values allow italic glyphs to overlap" - ], + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/text/BitmapText/setLineSpacing", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "setLineSpacing", + "name": "name", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "spacing" - ], - "parameterDescriptions": [ - "extra pixels between lines" - ], + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], "description": "", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/text/BitmapText/setSpaceWidth", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveExtension/requires", + "owner": "org.openpatch.scratch.save.SaveExtension", "signatures": [ { - "name": "setSpaceWidth", + "name": "requires", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "width" - ], - "parameterDescriptions": [ - "width of a space, in unscaled pixels" - ], - "description": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "First-party extensions are released together with the core.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/text/BitmapText/showText", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "showText", + "name": "requires", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "text" - ], - "parameterDescriptions": [ - "text to show, including spaces and newlines" - ], - "description": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "First-party extensions are released together with the core.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/tiled/MapObject/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "save/SaveExtension/version", + "owner": "org.openpatch.scratch.save.SaveExtension", "signatures": [ { - "name": "MapObject", - "constructor": true, + "name": "version", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.MapObject", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -15307,15 +17858,34 @@ "since": "" } ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "missingBrowserSignatures": [ + { + "name": "version", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "tiled/MapObject/constructor", + "owner": "org.openpatch.scratch.tiled.MapObject", + "signatures": [ { "name": "MapObject", "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.MapObject", + "returns": "org.openpatch.scratch.tiled.MapObject", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -15323,11 +17893,14 @@ "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getProperty", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "getProperty", @@ -15354,8 +17927,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/getPropertyBoolean", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyBoolean", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "getPropertyBoolean", @@ -15382,8 +17955,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/getPropertyFloat", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyFloat", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "getPropertyFloat", @@ -15410,8 +17983,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/getPropertyInt", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyInt", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "getPropertyInt", @@ -15438,8 +18011,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/getShape", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getShape", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "getShape", @@ -15460,8 +18033,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/setClassName", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/setClassName", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "setClassName", @@ -15483,11 +18056,38 @@ "since": "" } ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", - "missingBrowserSignatures": [ + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "tiled/Property/constructor", + "owner": "org.openpatch.scratch.tiled.Property", + "signatures": [ { - "name": "setClassName", + "name": "Property", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.tiled.Property", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "tiled/Property/setText", + "owner": "org.openpatch.scratch.tiled.Property", + "signatures": [ + { + "name": "setText", "constructor": false, "static": false, "parameters": [ @@ -15495,28 +18095,31 @@ ], "returns": "void", "parameterNames": [ - "className" + "text" ], "parameterDescriptions": [ - "" + "the element text" ], - "description": "Tiled 1.9 renamed an object's type to class; both end up in [type](type)\n(an explicit type wins).", + "description": "Multi-line strings are written as the element's text instead of a value\nattribute.", "returnDescription": "", "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/Property/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.Property", + "id": "tiled/TiledExtension/constructor", + "owner": "org.openpatch.scratch.tiled.TiledExtension", "signatures": [ { - "name": "Property", + "name": "TiledExtension", "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.Property", + "returns": "org.openpatch.scratch.tiled.TiledExtension", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -15525,15 +18128,15 @@ "since": "" } ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "missingBrowserSignatures": [ { - "name": "Property", + "name": "TiledExtension", "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.Property", + "returns": "org.openpatch.scratch.tiled.TiledExtension", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -15544,47 +18147,191 @@ ] }, { - "id": "extensions/tiled/Property/setText", - "owner": "org.openpatch.scratch.extensions.tiled.Property", + "id": "tiled/TiledExtension/id", + "owner": "org.openpatch.scratch.tiled.TiledExtension", "signatures": [ { - "name": "setText", + "name": "id", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ + { + "name": "id", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "tiled/TiledExtension/install", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "signatures": [ + { + "name": "install", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "text" + "ctx" ], "parameterDescriptions": [ - "the element text" + "" ], - "description": "Multi-line strings are written as the element's text instead of a value\nattribute.", + "description": "Every layer of a stage draws its shown map layers, only the part the camera shows.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "missingBrowserSignatures": [ { - "name": "setText", + "name": "install", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "text" + "ctx" ], "parameterDescriptions": [ - "the element text" + "" ], - "description": "Multi-line strings are written as the element's text instead of a value\nattribute.", + "description": "Every layer of a stage draws its shown map layers, only the part the camera shows.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "tiled/TiledExtension/name", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "signatures": [ + { + "name": "name", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ + { + "name": "name", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "tiled/TiledExtension/requires", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "signatures": [ + { + "name": "requires", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "First-party extensions are released together with the core.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ + { + "name": "requires", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "First-party extensions are released together with the core.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "tiled/TiledExtension/version", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "signatures": [ + { + "name": "version", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ + { + "name": "version", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -15592,8 +18339,8 @@ ] }, { - "id": "extensions/tiled/TiledMap/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/constructor", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "TiledMap", @@ -15602,7 +18349,7 @@ "parameters": [ "java.lang.String" ], - "returns": "org.openpatch.scratch.extensions.tiled.TiledMap", + "returns": "org.openpatch.scratch.tiled.TiledMap", "parameterNames": [ "path" ], @@ -15622,7 +18369,7 @@ "java.lang.String", "org.openpatch.scratch.Stage" ], - "returns": "org.openpatch.scratch.extensions.tiled.TiledMap", + "returns": "org.openpatch.scratch.tiled.TiledMap", "parameterNames": [ "path", "stage" @@ -15642,8 +18389,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getHeight", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getHeight", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getHeight", @@ -15664,8 +18411,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getObjectsFromLayer", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getObjectsFromLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getObjectsFromLayer", @@ -15674,7 +18421,7 @@ "parameters": [ "java.lang.String" ], - "returns": "org.openpatch.scratch.extensions.tiled.MapObject[]", + "returns": "org.openpatch.scratch.tiled.MapObject[]", "parameterNames": [ "name" ], @@ -15692,8 +18439,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getProperty", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getProperty", @@ -15742,8 +18489,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getPropertyBoolean", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyBoolean", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getPropertyBoolean", @@ -15770,8 +18517,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getPropertyFloat", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyFloat", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getPropertyFloat", @@ -15798,8 +18545,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getPropertyInt", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyInt", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getPropertyInt", @@ -15826,8 +18573,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getTileCollisionShapes", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileCollisionShapes", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getTileCollisionShapes", @@ -15879,8 +18626,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getTileHeight", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileHeight", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getTileHeight", @@ -15901,8 +18648,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getTileId", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileId", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getTileId", @@ -15935,8 +18682,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getTileWidth", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileWidth", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getTileWidth", @@ -15957,8 +18704,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getWidth", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getWidth", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getWidth", @@ -15979,25 +18726,25 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/spawn", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/hideLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { - "name": "spawn", + "name": "hideLayer", "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "java.util.List", + "returns": "void", "parameterNames": [ - "layerName" + "name" ], "parameterDescriptions": [ - "the object layer" + "the tile layer's name in Tiled" ], - "description": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.\n\nThe sprite's class needs one of these constructors, tried in this order:\none that takes the [MapObject](../MapObject/index) (to read its name and properties), one\nthat takes `(double x, double y)`, or one without parameters. Either\nway the sprite is put where the object is. An object drawn as an area\n(a rectangle, an ellipse or a polygon) also gives the sprite that area as\nits hitbox, which is how walls and water work without a costume.\n\nObjects whose type is not a sprite class, or that have no type, are left\nalone, so a layer can hold markers the program reads itself.\n\n```java\nTiledMap map = new TiledMap(\"level.tmx\", this);\nmap.spawn(\"Objects\");\n```", - "returnDescription": "the sprites that were made, in the order of the layer", + "description": "Stops drawing a tile layer shown with [showLayer(String, Layer)](showLayer).", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -16007,24 +18754,27 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/stampLayerToBackground", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/showLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { - "name": "stampLayerToBackground", + "name": "showLayer", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "java.lang.String", + "org.openpatch.scratch.Layer" ], "returns": "void", "parameterNames": [ - "name" + "name", + "layer" ], "parameterDescriptions": [ - "the name of the layer to be stamped onto the background" + "the tile layer's name in Tiled", + "the stage's layer to draw it in" ], - "description": "Stamps a specified layer onto the background.", + "description": "Shows a tile layer of the map in a layer of the stage, drawn every frame from now on (only\nthe tiles the camera shows). The map's top left corner is at (0, 0) of the world; the map\nextends right and down.\n\n```java\nmap.showLayer(\"ground\", Layer.BACKGROUND);\nmap.showLayer(\"trees\", Layer.FOREGROUND);\n```", "returnDescription": "", "scratchblock": "", "since": "" @@ -16035,25 +18785,25 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/stampLayerToForeground", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/spawn", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { - "name": "stampLayerToForeground", + "name": "spawn", "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "void", + "returns": "java.util.List", "parameterNames": [ - "name" + "layerName" ], "parameterDescriptions": [ - "the name of the layer to be stamped to the foreground" + "the object layer" ], - "description": "Stamps the specified layer to the foreground.", - "returnDescription": "", + "description": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.\n\nThe sprite's class needs one of these constructors, tried in this order:\none that takes the [MapObject](../MapObject/index) (to read its name and properties), one\nthat takes `(double x, double y)`, or one without parameters. Either\nway the sprite is put where the object is. An object drawn as an area\n(a rectangle, an ellipse or a polygon) also gives the sprite that area as\nits hitbox, which is how walls and water work without a costume.\n\nObjects whose type is not a sprite class, or that have no type, are left\nalone, so a layer can hold markers the program reads itself.\n\n```java\nTiledMap map = new TiledMap(\"level.tmx\", this);\nmap.spawn(\"Objects\");\n```", + "returnDescription": "the sprites that were made, in the order of the layer", "scratchblock": "", "since": "" } @@ -16063,8 +18813,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/toString", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/toString", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "toString", @@ -16080,20 +18830,15 @@ "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/tiled/TilesetImage/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TilesetImage", - "signatures": [ + "status": "desktop-only", + "reason": "Prints the desktop's parsed TMX tree as JSON; the browser reads maps without it.", + "missingBrowserSignatures": [ { - "name": "TilesetImage", - "constructor": true, + "name": "toString", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.TilesetImage", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -16101,16 +18846,18 @@ "scratchblock": "", "since": "" } - ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", - "missingBrowserSignatures": [ + ] + }, + { + "id": "tiled/TilesetImage/constructor", + "owner": "org.openpatch.scratch.tiled.TilesetImage", + "signatures": [ { "name": "TilesetImage", "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.TilesetImage", + "returns": "org.openpatch.scratch.tiled.TilesetImage", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -16118,7 +18865,10 @@ "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] } ] } diff --git a/compatibility/probes/LifecycleProbe.java b/compatibility/probes/LifecycleProbe.java index 9fbd72a9..cb0f1306 100644 --- a/compatibility/probes/LifecycleProbe.java +++ b/compatibility/probes/LifecycleProbe.java @@ -1,6 +1,4 @@ import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.shader.Shaders; -import org.openpatch.scratch.extensions.sorting.Sorting; public class LifecycleProbe { public static void main(String[] args) { @@ -39,11 +37,12 @@ class ProbeStage extends Stage { ProbeSprite original; ProbeSprite copy; int frames = 0; + Timer elapsed = new Timer(); ProbeStage() { Window.getInstance().pause(); original = new ProbeSprite(); add(original); - copy = (ProbeSprite) original.clone(); + copy = (ProbeSprite) original.createClone(); copy.getPen().setSize(9); copy.shared[0] = 2; System.out.println("clone.constructor=" + ProbeSprite.constructions); @@ -70,21 +69,18 @@ class ProbeStage extends Stage { System.out.println("readded.messages=" + copy.messages); remove(copy); System.out.println("removed.again=" + copy.removals); - Pen pen = new Pen(original); + Pen pen = new Pen(); pen.setColor(255, 0, 0); - Pen copiedPen = new Pen(pen); - copiedPen.changeColor(30); + Pen other = new Pen(); + other.setColor(0, 255, 0); + other.changeColor(30); System.out.println("pen.color=" + (pen.getColor().getRed() == 255)); Text text = new Text("hello", 20, 30, 100); - Text copiedText = new Text(text); + Text copiedText = new Text("hello", 40, 30, 100); copiedText.setX(40); System.out.println("text.copy=" + (text.getX() == 20 && copiedText.getY() == 30)); - new Text(original); - Shaders shaders = new Shaders("probe"); - System.out.println("shaders.copy=" + (new Shaders(shaders).getCurrentIndex() == shaders.getCurrentIndex())); - System.out.println("color.hash=" + (new Color(255, 128, 0).hashCode() == -1348971425)); - System.out.println("sorting=" + !new Sorting().isOn()); - new HtmlColor(); + System.out.println("shaders.copy=" + (original.getShaders() != copy.getShaders())); + System.out.println("color.hash=" + (new Color(255, 128, 0).hashCode() == -32768)); text.remove(); copiedText.remove(); showVariable("frames", () -> frames); @@ -92,10 +88,10 @@ class ProbeStage extends Stage { showVariable("array", () -> original.shared); showVariable("broken", () -> { throw new RuntimeException("supplier failure"); }); original.showVariable("score", () -> original.score); - showVariable("timer", () -> original.getTimer("elapsed").afterMillis(100)); + showVariable("timer", () -> elapsed.after(0.1)); showVariable("unused", () -> 99); hideVariable("unused"); - original.say("timed", 100); + original.say("timed", 0.1); original.glide(0.1, 90, -20); System.out.println("ready"); } diff --git a/compatibility/probes/lifecycle-expected.txt b/compatibility/probes/lifecycle-expected.txt index c075f2c1..48ac4090 100644 --- a/compatibility/probes/lifecycle-expected.txt +++ b/compatibility/probes/lifecycle-expected.txt @@ -18,5 +18,4 @@ pen.color=true text.copy=true shaders.copy=true color.hash=true -sorting=true ready diff --git a/core/.project b/core/.project new file mode 100644 index 00000000..7cb58635 --- /dev/null +++ b/core/.project @@ -0,0 +1,34 @@ + + + scratch + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1792662947241 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/core/pom.xml b/core/pom.xml new file mode 100644 index 00000000..056510ac --- /dev/null +++ b/core/pom.xml @@ -0,0 +1,148 @@ + + 4.0.0 + + + org.openpatch + scratch-parent + 6.5.0 + + + + scratch + jar + Scratch for Java + + + + org.lwjgllwjgl + org.lwjgllwjgl-glfw + org.lwjgllwjgl-opengl + org.lwjgllwjgl-openal + org.lwjgllwjgl-stb + org.lwjgllwjgl-tinyfd + + org.lwjgllwjglnatives-linuxruntime + org.lwjgllwjgl-glfwnatives-linuxruntime + org.lwjgllwjgl-openglnatives-linuxruntime + org.lwjgllwjgl-openalnatives-linuxruntime + org.lwjgllwjgl-stbnatives-linuxruntime + org.lwjgllwjgl-tinyfdnatives-linuxruntime + org.lwjgllwjglnatives-linux-arm64runtime + org.lwjgllwjgl-glfwnatives-linux-arm64runtime + org.lwjgllwjgl-openglnatives-linux-arm64runtime + org.lwjgllwjgl-openalnatives-linux-arm64runtime + org.lwjgllwjgl-stbnatives-linux-arm64runtime + org.lwjgllwjgl-tinyfdnatives-linux-arm64runtime + org.lwjgllwjglnatives-macosruntime + org.lwjgllwjgl-glfwnatives-macosruntime + org.lwjgllwjgl-openglnatives-macosruntime + org.lwjgllwjgl-openalnatives-macosruntime + org.lwjgllwjgl-stbnatives-macosruntime + org.lwjgllwjgl-tinyfdnatives-macosruntime + org.lwjgllwjglnatives-macos-arm64runtime + org.lwjgllwjgl-glfwnatives-macos-arm64runtime + org.lwjgllwjgl-openglnatives-macos-arm64runtime + org.lwjgllwjgl-openalnatives-macos-arm64runtime + org.lwjgllwjgl-stbnatives-macos-arm64runtime + org.lwjgllwjgl-tinyfdnatives-macos-arm64runtime + org.lwjgllwjglnatives-windowsruntime + org.lwjgllwjgl-glfwnatives-windowsruntime + org.lwjgllwjgl-openglnatives-windowsruntime + org.lwjgllwjgl-openalnatives-windowsruntime + org.lwjgllwjgl-stbnatives-windowsruntime + org.lwjgllwjgl-tinyfdnatives-windowsruntime + org.lwjgllwjglnatives-windows-arm64runtime + org.lwjgllwjgl-glfwnatives-windows-arm64runtime + org.lwjgllwjgl-openglnatives-windows-arm64runtime + org.lwjgllwjgl-openalnatives-windows-arm64runtime + org.lwjgllwjgl-stbnatives-windows-arm64runtime + org.lwjgllwjgl-tinyfdnatives-windows-arm64runtime + + + + + src/main/java + + + + + + nrw + + ${project.build.directory}/nrw-sources + true + true + + + + + org.codehaus.mojo + exec-maven-plugin + + + generate-nrw-sources + generate-sources + + exec + + + ${java.home}/bin/java + ${project.basedir} + + src/build/NrwVariant.java + src/main/java + ${project.build.directory}/nrw-sources + + + + + + + + + + + + ${scratch.sourceDirectory} + + + src/main/resources + + + + src/main/resources-filtered + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + default-testCompile + + + + --add-modules + java.desktop,java.compiler + --add-reads + org.openpatch.scratch=java.desktop,java.compiler + + + + + + + + diff --git a/src/tools/java/variants/NrwVariant.java b/core/src/build/NrwVariant.java similarity index 97% rename from src/tools/java/variants/NrwVariant.java rename to core/src/build/NrwVariant.java index 9305157c..a7a636b5 100644 --- a/src/tools/java/variants/NrwVariant.java +++ b/core/src/build/NrwVariant.java @@ -1,4 +1,4 @@ -package variants; + import java.io.IOException; import java.io.UncheckedIOException; @@ -34,7 +34,7 @@ *

* It runs in the {@code nrw} profile of the pom, before compiling, through the * java launcher, since nothing has been compiled at that point: - * {@code java src/tools/java/variants/NrwVariant.java src/main/java target/nrw-sources}. + * {@code java src/build/NrwVariant.java src/main/java target/nrw-sources}. */ public final class NrwVariant { diff --git a/core/src/main/java/module-info.java b/core/src/main/java/module-info.java new file mode 100644 index 00000000..141914a4 --- /dev/null +++ b/core/src/main/java/module-info.java @@ -0,0 +1,18 @@ +/** + * Scratch for Java. Learners use {@code org.openpatch.scratch}; extensions also use + * {@code org.openpatch.scratch.extension}. Everything under {@code org.openpatch.scratch.internal} + * may change without notice and is not exported. + */ +module org.openpatch.scratch { + requires org.lwjgl; + requires org.lwjgl.glfw; + requires org.lwjgl.opengl; + requires org.lwjgl.openal; + requires org.lwjgl.stb; + requires org.lwjgl.tinyfd; + + exports org.openpatch.scratch; + exports org.openpatch.scratch.extension; + + uses org.openpatch.scratch.extension.Extension; +} diff --git a/core/src/main/java/org/openpatch/scratch/Bounds.java b/core/src/main/java/org/openpatch/scratch/Bounds.java new file mode 100644 index 00000000..4b791ccc --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Bounds.java @@ -0,0 +1,21 @@ +package org.openpatch.scratch; + +/** + * A rectangle along the axes: the bounds of a shape. + * + * @param x the smallest x + * @param y the smallest y + * @param width the width + * @param height the height + */ +public record Bounds(double x, double y, double width, double height) { + + /** + * @param other another rectangle + * @return whether the two overlap with some area; rectangles that only touch do not + */ + public boolean intersects(Bounds other) { + return this.x < other.x + other.width && this.x + this.width > other.x && this.y < other.y + other.height + && this.y + this.height > other.y; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Camera.java b/core/src/main/java/org/openpatch/scratch/Camera.java new file mode 100644 index 00000000..9df909a1 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Camera.java @@ -0,0 +1,219 @@ +package org.openpatch.scratch; + +/** + * The camera of a stage: which part of the world the stage shows. Every layer but + * {@link Layer#UI} follows it, the backdrop included; pens draw where the camera shows their + * position when they draw. Unused, it shows the world as it is: position (0, 0), zoom 100. + * + *

{@code
+ * Camera camera = this.getStage().getCamera();
+ * camera.setPosition(player.getX(), player.getY());
+ * }
+ * + *

World coordinates are where sprites are; screen coordinates are where something shows on + * the stage, with (0, 0) in its centre. The mouse is reported in world coordinates by + * {@code getMouseX()}, so it can be compared with sprite positions directly. + */ +public final class Camera { + + private double x; + private double y; + private double zoom = 100; + private double zoomMin = 50; + private double zoomMax = 200; + + /** A camera at (0, 0) with zoom 100. Every stage has its own: {@code getStage().getCamera()}. */ + public Camera() {} + + /** + * Centres the camera on a world position. + * + * @param x world x + * @param y world y + * + * @example.files CameraSetPosition.java + */ + public void setPosition(double x, double y) { + this.x = x; + this.y = y; + } + + /** + * Centres the camera on a world position. + * + * @param position world position + * + * @example.files CameraSetPosition.java + */ + public void setPosition(Vector2 position) { + this.setPosition(position.getX(), position.getY()); + } + + /** + * @return the world position at the stage's centre + * + * @example.files CameraGetPosition.java + */ + public Vector2 getPosition() { + return new Vector2(this.x, this.y); + } + + /** + * @return the world x at the stage's centre + * + * @example.files CameraGetX.java + */ + public double getX() { + return this.x; + } + + /** + * @param x the world x to show at the stage's centre + * + * @example.files CameraSetX.java + */ + public void setX(double x) { + this.x = x; + } + + /** + * @param dx how far to move the camera along x + * + * @example.files CameraChangeX.java + */ + public void changeX(double dx) { + this.x += dx; + } + + /** + * @return the world y at the stage's centre + * + * @example.files CameraGetY.java + */ + public double getY() { + return this.y; + } + + /** + * @param y the world y to show at the stage's centre + * + * @example.files CameraSetY.java + */ + public void setY(double y) { + this.y = y; + } + + /** + * @param dy how far to move the camera along y + * + * @example.files CameraChangeY.java + */ + public void changeY(double dy) { + this.y += dy; + } + + /** + * Sets the zoom in percent: 200 shows everything twice as large, 50 half as large. It stays + * within the zoom limits (50 to 200 unless changed). + * + * @param zoom the zoom in percent + * + * @example.files CameraSetZoom.java + */ + public void setZoom(double zoom) { + this.zoom = Math.max(this.zoomMin, Math.min(this.zoomMax, zoom)); + } + + /** + * @param dz percentage points to add to the zoom + * + * @example.files CameraChangeZoom.java + */ + public void changeZoom(double dz) { + this.setZoom(this.zoom + dz); + } + + /** + * @return the zoom in percent + * + * @example.files CameraGetZoom.java + */ + public double getZoom() { + return this.zoom; + } + + /** + * Back to zoom 100. + * + * @example.files CameraResetZoom.java + */ + public void resetZoom() { + this.zoom = 100; + } + + /** + * Limits the zoom. + * + * @param min the smallest zoom in percent + * @param max the largest zoom in percent + * + * @example.files CameraSetZoomLimit.java + */ + public void setZoomLimit(double min, double max) { + this.zoomMin = min; + this.zoomMax = max; + this.setZoom(this.zoom); + } + + /** + * Where a world position shows on the stage. + * + * @param world a world position + * @return the screen position (origin at the stage's centre) + */ + public Vector2 toScreenPosition(Vector2 world) { + return new Vector2(this.toScreenX(world.getX()), this.toScreenY(world.getY())); + } + + /** + * @param worldX a world x + * @return where it shows on the stage + */ + public double toScreenX(double worldX) { + return (worldX - this.x) * this.zoom / 100; + } + + /** + * @param worldY a world y + * @return where it shows on the stage + */ + public double toScreenY(double worldY) { + return (worldY - this.y) * this.zoom / 100; + } + + /** + * Which world position shows at a place on the stage. + * + * @param screen a screen position (origin at the stage's centre) + * @return the world position + */ + public Vector2 toWorldPosition(Vector2 screen) { + return new Vector2(this.toWorldX(screen.getX()), this.toWorldY(screen.getY())); + } + + /** + * @param screenX an x on the stage + * @return the world x shown there + */ + public double toWorldX(double screenX) { + return screenX * 100 / this.zoom + this.x; + } + + /** + * @param screenY a y on the stage + * @return the world y shown there + */ + public double toWorldY(double screenY) { + return screenY * 100 / this.zoom + this.y; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Circle.java b/core/src/main/java/org/openpatch/scratch/Circle.java new file mode 100644 index 00000000..ce7c6003 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Circle.java @@ -0,0 +1,16 @@ +package org.openpatch.scratch; + +import org.openpatch.scratch.internal.geom.Geometry; + +/** A circle. */ +public class Circle extends Shape { + + /** + * @param x x of the centre + * @param y y of the centre + * @param radius the radius + */ + public Circle(double x, double y, double radius) { + this.setPoints(Geometry.ellipse(x, y, radius, radius)); + } +} diff --git a/src/main/java/org/openpatch/scratch/Clock.java b/core/src/main/java/org/openpatch/scratch/Clock.java similarity index 100% rename from src/main/java/org/openpatch/scratch/Clock.java rename to core/src/main/java/org/openpatch/scratch/Clock.java diff --git a/core/src/main/java/org/openpatch/scratch/Color.java b/core/src/main/java/org/openpatch/scratch/Color.java new file mode 100644 index 00000000..910cb358 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Color.java @@ -0,0 +1,300 @@ +package org.openpatch.scratch; + +/** + * A colour. Colours never change: {@code withHue(…)} and the other {@code with} methods return a + * new colour, so a colour can be shared, kept in a constant ({@link HtmlColor}) or handed to + * several sprites without one of them changing it for the others. + * + *

A colour can be given in two ways: + * + *

    + *
  • red, green and blue from 0 to 255, plus an optional alpha (opacity) from 0 to 255: + * {@code new Color(255, 128, 0)}; + *
  • Scratch's colour, saturation and brightness, each from 0 to 100: + * {@code Color.fromHSB(50, 100, 100)}. The colour (hue) goes around: 0 is red, about 17 + * yellow, 33 green, 50 cyan, 67 blue, 83 magenta, 100 red again. + *
+ * + *
{@code
+ * Color orange = new Color(255, 128, 0);
+ * Color lighter = orange.withBrightness(100).withSaturation(50);
+ * Color next = orange.withHue(orange.getHue() + 10);
+ * }
+ */ +public final class Color { + + private final double red, green, blue, alpha; + + /** + * A colour from red, green and blue, each from 0 to 255 (values outside are clamped). The + * colour is opaque. + * + * @param red red from 0 to 255 + * @param green green from 0 to 255 + * @param blue blue from 0 to 255 + */ + public Color(double red, double green, double blue) { + this(red, green, blue, 255); + } + + /** + * A colour from red, green, blue and alpha, each from 0 to 255 (values outside are clamped). + * An alpha of 0 is invisible, 255 opaque. + * + * @param red red from 0 to 255 + * @param green green from 0 to 255 + * @param blue blue from 0 to 255 + * @param alpha opacity from 0 to 255 + */ + public Color(double red, double green, double blue, double alpha) { + this.red = clamp(red, 255); + this.green = clamp(green, 255); + this.blue = clamp(blue, 255); + this.alpha = clamp(alpha, 255); + } + + /** + * A colour from a hex code as in HTML and CSS: {@code "#ff8000"}, {@code "ff8000"}, + * {@code "#f80"}, or with alpha {@code "#ff800080"}. + * + * @param hex the hex code + */ + public Color(String hex) { + int[] rgba = parseHex(hex); + this.red = rgba[0]; + this.green = rgba[1]; + this.blue = rgba[2]; + this.alpha = rgba[3]; + } + + /** + * A colour from Scratch's colour, saturation and brightness, each from 0 to 100. The colour + * goes around (110 is the same as 10); saturation and brightness are clamped. + * + * @param hue the colour from 0 to 100 + * @param saturation from 0 (grey) to 100 (full colour) + * @param brightness from 0 (black) to 100 (full brightness) + * @return the colour + */ + public static Color fromHSB(double hue, double saturation, double brightness) { + double h = wrap(hue, 100) / 100 * 6; + double s = clamp(saturation, 100) / 100; + double v = clamp(brightness, 100) / 100; + int sector = (int) Math.floor(h) % 6; + double f = h - Math.floor(h); + double p = v * (1 - s), q = v * (1 - s * f), t = v * (1 - s * (1 - f)); + double r, g, b; + switch (sector) { + case 0 -> { r = v; g = t; b = p; } + case 1 -> { r = q; g = v; b = p; } + case 2 -> { r = p; g = v; b = t; } + case 3 -> { r = p; g = q; b = v; } + case 4 -> { r = t; g = p; b = v; } + default -> { r = v; g = p; b = q; } + } + // whole channels, as Scratch keeps colours (6.x gave 252 here, not 251.99999999999977) + return new Color(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)); + } + + /** + * A colour from a packed ARGB number, as {@link #toARGB()} gives it. + * + * @param argb alpha, red, green and blue in one int + * @return the colour + */ + public static Color fromARGB(int argb) { + return new Color((argb >> 16) & 0xff, (argb >> 8) & 0xff, argb & 0xff, argb >>> 24); + } + + /** + * @return red from 0 to 255 + * + * @example.files ColorGetRed.java + */ + public double getRed() { + return this.red; + } + + /** + * @return green from 0 to 255 + * + * @example.files ColorGetGreen.java + */ + public double getGreen() { + return this.green; + } + + /** + * @return blue from 0 to 255 + * + * @example.files ColorGetBlue.java + */ + public double getBlue() { + return this.blue; + } + + /** @return alpha (opacity) from 0 (invisible) to 255 (opaque) */ + public double getAlpha() { + return this.alpha; + } + + /** @return Scratch's colour (hue) from 0 to 100; 0 for greys */ + public double getHue() { + double max = Math.max(this.red, Math.max(this.green, this.blue)); + double min = Math.min(this.red, Math.min(this.green, this.blue)); + double d = max - min; + if (d == 0) { + return 0; + } + double h; + if (max == this.red) { + h = ((this.green - this.blue) / d) % 6; + } else if (max == this.green) { + h = (this.blue - this.red) / d + 2; + } else { + h = (this.red - this.green) / d + 4; + } + return wrap(h / 6 * 100, 100); + } + + /** @return saturation from 0 (grey) to 100 */ + public double getSaturation() { + double max = Math.max(this.red, Math.max(this.green, this.blue)); + double min = Math.min(this.red, Math.min(this.green, this.blue)); + return max == 0 ? 0 : (max - min) / max * 100; + } + + /** @return brightness from 0 (black) to 100 */ + public double getBrightness() { + return Math.max(this.red, Math.max(this.green, this.blue)) / 255 * 100; + } + + /** + * @param red red from 0 to 255 + * @return this colour with another red + */ + public Color withRed(double red) { + return new Color(red, this.green, this.blue, this.alpha); + } + + /** + * @param green green from 0 to 255 + * @return this colour with another green + */ + public Color withGreen(double green) { + return new Color(this.red, green, this.blue, this.alpha); + } + + /** + * @param blue blue from 0 to 255 + * @return this colour with another blue + */ + public Color withBlue(double blue) { + return new Color(this.red, this.green, blue, this.alpha); + } + + /** + * @param alpha opacity from 0 to 255 + * @return this colour with another alpha + */ + public Color withAlpha(double alpha) { + return new Color(this.red, this.green, this.blue, alpha); + } + + /** + * Another colour (hue), keeping saturation, brightness and alpha. The colour goes around, so + * {@code withHue(getHue() + 10)} works like Scratch's "change color by 10". + * + * @param hue the colour from 0 to 100 + * @return this colour with another hue + */ + public Color withHue(double hue) { + return fromHSB(hue, this.getSaturation(), this.getBrightness()).withAlpha(this.alpha); + } + + /** + * @param saturation from 0 to 100 + * @return this colour with another saturation + */ + public Color withSaturation(double saturation) { + return fromHSB(this.getHue(), saturation, this.getBrightness()).withAlpha(this.alpha); + } + + /** + * @param brightness from 0 to 100 + * @return this colour with another brightness + */ + public Color withBrightness(double brightness) { + return fromHSB(this.getHue(), this.getSaturation(), brightness).withAlpha(this.alpha); + } + + /** + * The colour packed into one int as alpha, red, green and blue (8 bits each, rounded), the way + * pixels are stored. + * + * @return the packed colour + */ + public int toARGB() { + return (int) Math.round(this.alpha) << 24 | (int) Math.round(this.red) << 16 + | (int) Math.round(this.green) << 8 | (int) Math.round(this.blue); + } + + /** + * @return {@code #rrggbb}, or {@code #rrggbbaa} when not opaque + * + * @example.files ColorToString.java + */ + @Override + public String toString() { + int argb = this.toARGB(); + String rgb = String.format("#%06x", argb & 0xffffff); + return (argb >>> 24) == 255 ? rgb : rgb + String.format("%02x", argb >>> 24); + } + + /** Two colours are equal when they pack into the same ARGB number. */ + @Override + public boolean equals(Object other) { + return other instanceof Color c && c.toARGB() == this.toARGB(); + } + + @Override + public int hashCode() { + return this.toARGB(); + } + + private static double clamp(double value, double max) { + return Double.isNaN(value) ? 0 : Math.max(0, Math.min(max, value)); + } + + private static double wrap(double value, double range) { + double w = value % range; + return w < 0 ? w + range : w; + } + + private static int[] parseHex(String hex) { + String h = hex.trim(); + if (h.startsWith("#")) { + h = h.substring(1); + } + if (h.length() == 3 || h.length() == 4) { + StringBuilder doubled = new StringBuilder(); + for (char c : h.toCharArray()) { + doubled.append(c).append(c); + } + h = doubled.toString(); + } + if (h.length() != 6 && h.length() != 8) { + throw new IllegalArgumentException("Not a colour: \"" + hex + "\". Use a hex code such as \"#ff8000\"."); + } + try { + long value = Long.parseLong(h, 16); + if (h.length() == 6) { + return new int[] {(int) (value >> 16) & 0xff, (int) (value >> 8) & 0xff, (int) value & 0xff, 255}; + } + return new int[] {(int) (value >> 24) & 0xff, (int) (value >> 16) & 0xff, (int) (value >> 8) & 0xff, + (int) value & 0xff}; + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Not a colour: \"" + hex + "\". Use a hex code such as \"#ff8000\".", e); + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Ellipse.java b/core/src/main/java/org/openpatch/scratch/Ellipse.java new file mode 100644 index 00000000..29e2686e --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Ellipse.java @@ -0,0 +1,17 @@ +package org.openpatch.scratch; + +import org.openpatch.scratch.internal.geom.Geometry; + +/** An ellipse inside a rectangle along the axes. */ +public class Ellipse extends Shape { + + /** + * @param x the smallest x of the rectangle around it + * @param y the smallest y of the rectangle around it + * @param width the width + * @param height the height + */ + public Ellipse(double x, double y, double width, double height) { + this.setPoints(Geometry.ellipse(x + width / 2, y + height / 2, width / 2, height / 2)); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/HtmlColor.java b/core/src/main/java/org/openpatch/scratch/HtmlColor.java new file mode 100644 index 00000000..561aed9f --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/HtmlColor.java @@ -0,0 +1,599 @@ +package org.openpatch.scratch; + +import java.util.Random; + +/** + * Provides predefined HTML colors as Color objects. + * + * @see HTML Color Names + * + *

The constants never change: colours are immutable. + * + *

{@code
+ * Color myColor = HtmlColor.CORNFLOWER_BLUE;
+ * }
+ * + * @example.files HtmlColorAll.java + */ +public final class HtmlColor { + + private HtmlColor() {} + + /** The color Alice Blue. */ + public static final Color ALICE_BLUE = new Color("#F0F8FF"); + + /** The color Antique White. */ + public static final Color ANTIQUE_WHITE = new Color("#FAEBD7"); + + /** The color Aqua. */ + public static final Color AQUA = new Color("#00FFFF"); + + /** The color Aquamarine. */ + public static final Color AQUAMARINE = new Color("#7FFFD4"); + + /** The color Azure. */ + public static final Color AZURE = new Color("#F0FFFF"); + + /** The color Beige. */ + public static final Color BEIGE = new Color("#F5F5DC"); + + /** The color Bisque. */ + public static final Color BISQUE = new Color("#FFE4C4"); + + /** The color Black. */ + public static final Color BLACK = new Color("#000000"); + + /** The color Blanched Almond. */ + public static final Color BLANCHED_ALMOND = new Color("#FFEBCD"); + + /** The color Blue. */ + public static final Color BLUE = new Color("#0000FF"); + + /** The color Blue Violet. */ + public static final Color BLUE_VIOLET = new Color("#8A2BE2"); + + /** The color Brown. */ + public static final Color BROWN = new Color("#A52A2A"); + + /** The color Burlywood. */ + public static final Color BURLYWOOD = new Color("#DEB887"); + + /** The color Cadet Blue. */ + public static final Color CADET_BLUE = new Color("#5F9EA0"); + + /** The color Chartreuse. */ + public static final Color CHARTREUSE = new Color("#7FFF00"); + + /** The color Chocolate. */ + public static final Color CHOCOLATE = new Color("#D2691E"); + + /** The color Coral. */ + public static final Color CORAL = new Color("#FF7F50"); + + /** The color Cornflower Blue. */ + public static final Color CORNFLOWER_BLUE = new Color("#6495ED"); + + /** The color Cornsilk. */ + public static final Color CORNSILK = new Color("#FFF8DC"); + + /** The color Crimson. */ + public static final Color CRIMSON = new Color("#DC143C"); + + /** The color Cyan. */ + public static final Color CYAN = new Color("#00FFFF"); + + /** The color Dark Blue. */ + public static final Color DARK_BLUE = new Color("#00008B"); + + /** The color Dark Cyan. */ + public static final Color DARK_CYAN = new Color("#008B8B"); + + /** The color Dark Goldenrod. */ + public static final Color DARK_GOLDENROD = new Color("#B8860B"); + + /** The color Dark Gray. */ + public static final Color DARK_GRAY = new Color("#A9A9A9"); + + /** The color Dark Green. */ + public static final Color DARK_GREEN = new Color("#006400"); + + /** The color Dark Khaki. */ + public static final Color DARK_KHAKI = new Color("#BDB76B"); + + /** The color Dark Magenta. */ + public static final Color DARK_MAGENTA = new Color("#8B008B"); + + /** The color Dark Olive Green. */ + public static final Color DARK_OLIVE_GREEN = new Color("#556B2F"); + + /** The color Dark Orange. */ + public static final Color DARK_ORANGE = new Color("#FF8C00"); + + /** The color Dark Orchid. */ + public static final Color DARK_ORCHID = new Color("#9932CC"); + + /** The color Dark Red. */ + public static final Color DARK_RED = new Color("#8B0000"); + + /** The color Dark Salmon. */ + public static final Color DARK_SALMON = new Color("#E9967A"); + + /** The color Dark Sea Green. */ + public static final Color DARK_SEA_GREEN = new Color("#8FBC8F"); + + /** The color Dark Slate Blue. */ + public static final Color DARK_SLATE_BLUE = new Color("#483D8B"); + + /** The color Dark Slate Gray. */ + public static final Color DARK_SLATE_GRAY = new Color("#2F4F4F"); + + /** The color Dark Turquoise. */ + public static final Color DARK_TURQUOISE = new Color("#00CED1"); + + /** The color Dark Violet. */ + public static final Color DARK_VIOLET = new Color("#9400D3"); + + /** The color Deep Pink. */ + public static final Color DEEP_PINK = new Color("#FF1493"); + + /** The color Deep Sky Blue. */ + public static final Color DEEP_SKY_BLUE = new Color("#00BFFF"); + + /** The color Dim Gray. */ + public static final Color DIM_GRAY = new Color("#696969"); + + /** The color Dodger Blue. */ + public static final Color DODGER_BLUE = new Color("#1E90FF"); + + /** The color Firebrick. */ + public static final Color FIREBRICK = new Color("#B22222"); + + /** The color Floral White. */ + public static final Color FLORAL_WHITE = new Color("#FFFAF0"); + + /** The color Forest Green. */ + public static final Color FOREST_GREEN = new Color("#228B22"); + + /** The color Fuchsia. */ + public static final Color FUCHSIA = new Color("#FF00FF"); + + /** The color Gainsboro. */ + public static final Color GAINSBORO = new Color("#DCDCDC"); + + /** The color Ghost White. */ + public static final Color GHOST_WHITE = new Color("#F8F8FF"); + + /** The color Gold. */ + public static final Color GOLD = new Color("#FFD700"); + + /** The color Goldenrod. */ + public static final Color GOLDENROD = new Color("#DAA520"); + + /** The color Gray. */ + public static final Color GRAY = new Color("#808080"); + + /** The color Green. */ + public static final Color GREEN = new Color("#008000"); + + /** The color Green Yellow. */ + public static final Color GREEN_YELLOW = new Color("#ADFF2F"); + + /** The color Honeydew. */ + public static final Color HONEYDEW = new Color("#F0FFF0"); + + /** The color Hot Pink. */ + public static final Color HOT_PINK = new Color("#FF69B4"); + + /** The color Indian Red. */ + public static final Color INDIAN_RED = new Color("#CD5C5C"); + + /** The color Indigo. */ + public static final Color INDIGO = new Color("#4B0082"); + + /** The color Ivory. */ + public static final Color IVORY = new Color("#FFFFF0"); + + /** The color Khaki. */ + public static final Color KHAKI = new Color("#F0E68C"); + + /** The color Lavender. */ + public static final Color LAVENDER = new Color("#E6E6FA"); + + /** The color Lavender Blush. */ + public static final Color LAVENDER_BLUSH = new Color("#FFF0F5"); + + /** The color Lawn Green. */ + public static final Color LAWN_GREEN = new Color("#7CFC00"); + + /** The color Lemon Chiffon. */ + public static final Color LEMON_CHIFFON = new Color("#FFFACD"); + + /** The color Light Blue. */ + public static final Color LIGHT_BLUE = new Color("#ADD8E6"); + + /** The color Light Coral. */ + public static final Color LIGHT_CORAL = new Color("#F08080"); + + /** The color Light Cyan. */ + public static final Color LIGHT_CYAN = new Color("#E0FFFF"); + + /** The color Light Goldenrod Yellow. */ + public static final Color LIGHT_GOLDENROD_YELLOW = new Color("#FAFAD2"); + + /** The color Light Gray. */ + public static final Color LIGHT_GRAY = new Color("#D3D3D3"); + + /** The color Light Green. */ + public static final Color LIGHT_GREEN = new Color("#90EE90"); + + /** The color Light Pink. */ + public static final Color LIGHT_PINK = new Color("#FFB6C1"); + + /** The color Light Salmon. */ + public static final Color LIGHT_SALMON = new Color("#FFA07A"); + + /** The color Light Sea Green. */ + public static final Color LIGHT_SEA_GREEN = new Color("#20B2AA"); + + /** The color Light Sky Blue. */ + public static final Color LIGHT_SKY_BLUE = new Color("#87CEFA"); + + /** The color Light Slate Gray. */ + public static final Color LIGHT_SLATE_GRAY = new Color("#778899"); + + /** The color Light Steel Blue. */ + public static final Color LIGHT_STEEL_BLUE = new Color("#B0C4DE"); + + /** The color Light Yellow. */ + public static final Color LIGHT_YELLOW = new Color("#FFFFE0"); + + /** The color Lime. */ + public static final Color LIME = new Color("#00FF00"); + + /** The color Lime Green. */ + public static final Color LIME_GREEN = new Color("#32CD32"); + + /** The color Linen. */ + public static final Color LINEN = new Color("#FAF0E6"); + + /** The color Magenta. */ + public static final Color MAGENTA = new Color("#FF00FF"); + + /** The color Maroon. */ + public static final Color MAROON = new Color("#800000"); + + /** The color Medium Aquamarine. */ + public static final Color MEDIUM_AQUAMARINE = new Color("#66CDAA"); + + /** The color Medium Blue. */ + public static final Color MEDIUM_BLUE = new Color("#0000CD"); + + /** The color Medium Orchid. */ + public static final Color MEDIUM_ORCHID = new Color("#BA55D3"); + + /** The color Medium Purple. */ + public static final Color MEDIUM_PURPLE = new Color("#9370DB"); + + /** The color Medium Sea Green. */ + public static final Color MEDIUM_SEA_GREEN = new Color("#3CB371"); + + /** The color Medium Slate Blue. */ + public static final Color MEDIUM_SLATE_BLUE = new Color("#7B68EE"); + + /** The color Medium Spring Green. */ + public static final Color MEDIUM_SPRING_GREEN = new Color("#00FA9A"); + + /** The color Medium Turquoise. */ + public static final Color MEDIUM_TURQUOISE = new Color("#48D1CC"); + + /** The color Medium Violet Red. */ + public static final Color MEDIUM_VIOLET_RED = new Color("#C71585"); + + /** The color Midnight Blue. */ + public static final Color MIDNIGHT_BLUE = new Color("#191970"); + + /** The color Mint Cream. */ + public static final Color MINT_CREAM = new Color("#F5FFFA"); + + /** The color Misty Rose. */ + public static final Color MISTY_ROSE = new Color("#FFE4E1"); + + /** The color Moccasin. */ + public static final Color MOCCASIN = new Color("#FFE4B5"); + + /** The color Navajo White. */ + public static final Color NAVAJO_WHITE = new Color("#FFDEAD"); + + /** The color Navy. */ + public static final Color NAVY = new Color("#000080"); + + /** The color Old Lace. */ + public static final Color OLD_LACE = new Color("#FDF5E6"); + + /** The color Olive. */ + public static final Color OLIVE = new Color("#808000"); + + /** The color Olive Drab. */ + public static final Color OLIVE_DRAB = new Color("#6B8E23"); + + /** The color Orange. */ + public static final Color ORANGE = new Color("#FFA500"); + + /** The color Orange Red. */ + public static final Color ORANGE_RED = new Color("#FF4500"); + + /** The color Orchid. */ + public static final Color ORCHID = new Color("#DA70D6"); + + /** The color Pale Goldenrod. */ + public static final Color PALE_GOLDENROD = new Color("#EEE8AA"); + + /** The color Pale Green. */ + public static final Color PALE_GREEN = new Color("#98FB98"); + + /** The color Pale Turquoise. */ + public static final Color PALE_TURQUOISE = new Color("#AFEEEE"); + + /** The color Pale Violet Red. */ + public static final Color PALE_VIOLET_RED = new Color("#DB7093"); + + /** The color Papaya Whip. */ + public static final Color PAPAYA_WHIP = new Color("#FFEFD5"); + + /** The color Peach Puff. */ + public static final Color PEACH_PUFF = new Color("#FFDAB9"); + + /** The color Peru. */ + public static final Color PERU = new Color("#CD853F"); + + /** The color Pink. */ + public static final Color PINK = new Color("#FFC0CB"); + + /** The color Plum. */ + public static final Color PLUM = new Color("#DDA0DD"); + + /** The color Powder Blue. */ + public static final Color POWDER_BLUE = new Color("#B0E0E6"); + + /** The color Purple. */ + public static final Color PURPLE = new Color("#800080"); + + /** The color Red. */ + public static final Color RED = new Color("#FF0000"); + + /** The color Rosy Brown. */ + public static final Color ROSY_BROWN = new Color("#BC8F8F"); + + /** The color Royal Blue. */ + public static final Color ROYAL_BLUE = new Color("#4169E1"); + + /** The color Saddle Brown. */ + public static final Color SADDLE_BROWN = new Color("#8B4513"); + + /** The color Salmon. */ + public static final Color SALMON = new Color("#FA8072"); + + /** The color Sandy Brown. */ + public static final Color SANDY_BROWN = new Color("#F4A460"); + + /** The color Sea Green. */ + public static final Color SEA_GREEN = new Color("#2E8B57"); + + /** The color Seashell. */ + public static final Color SEASHELL = new Color("#FFF5EE"); + + /** The color Sienna. */ + public static final Color SIENNA = new Color("#A0522D"); + + /** The color Silver. */ + public static final Color SILVER = new Color("#C0C0C0"); + + /** The color Sky Blue. */ + public static final Color SKY_BLUE = new Color("#87CEEB"); + + /** The color Slate Blue. */ + public static final Color SLATE_BLUE = new Color("#6A5ACD"); + + /** The color Slate Gray. */ + public static final Color SLATE_GRAY = new Color("#708090"); + + /** The color Snow. */ + public static final Color SNOW = new Color("#FFFAFA"); + + /** The color Spring Green. */ + public static final Color SPRING_GREEN = new Color("#00FF7F"); + + /** The color Steel Blue. */ + public static final Color STEEL_BLUE = new Color("#4682B4"); + + /** The color Tan. */ + public static final Color TAN = new Color("#D2B48C"); + + /** The color Teal. */ + public static final Color TEAL = new Color("#008080"); + + /** The color Thistle. */ + public static final Color THISTLE = new Color("#D8BFD8"); + + /** The color Tomato. */ + public static final Color TOMATO = new Color("#FF6347"); + + /** The color Turquoise. */ + public static final Color TURQUOISE = new Color("#40E0D0"); + + /** The color Violet. */ + public static final Color VIOLET = new Color("#EE82EE"); + + /** The color Wheat. */ + public static final Color WHEAT = new Color("#F5DEB3"); + + /** The color White. */ + public static final Color WHITE = new Color("#FFFFFF"); + + /** The color White Smoke. */ + public static final Color WHITE_SMOKE = new Color("#F5F5F5"); + + /** The color Yellow. */ + public static final Color YELLOW = new Color("#FFFF00"); + + /** The color Yellow Green. */ + public static final Color YELLOW_GREEN = new Color("#9ACD32"); + + private static final Random RANDOM = new Random(); + + /** The predefined HTML colors. */ + private static final Color[] COLORS = + new Color[] { + ALICE_BLUE, + ANTIQUE_WHITE, + AQUA, + AQUAMARINE, + AZURE, + BEIGE, + BISQUE, + BLACK, + BLANCHED_ALMOND, + BLUE, + BLUE_VIOLET, + BROWN, + BURLYWOOD, + CADET_BLUE, + CHARTREUSE, + CHOCOLATE, + CORAL, + CORNFLOWER_BLUE, + CORNSILK, + CRIMSON, + CYAN, + DARK_BLUE, + DARK_CYAN, + DARK_GOLDENROD, + DARK_GRAY, + DARK_GREEN, + DARK_KHAKI, + DARK_MAGENTA, + DARK_OLIVE_GREEN, + DARK_ORANGE, + DARK_ORCHID, + DARK_RED, + DARK_SALMON, + DARK_SEA_GREEN, + DARK_SLATE_BLUE, + DARK_SLATE_GRAY, + DARK_TURQUOISE, + DARK_VIOLET, + DEEP_PINK, + DEEP_SKY_BLUE, + DIM_GRAY, + DODGER_BLUE, + FIREBRICK, + FLORAL_WHITE, + FOREST_GREEN, + FUCHSIA, + GAINSBORO, + GHOST_WHITE, + GOLD, + GOLDENROD, + GRAY, + GREEN, + GREEN_YELLOW, + HONEYDEW, + HOT_PINK, + INDIAN_RED, + INDIGO, + IVORY, + KHAKI, + LAVENDER, + LAVENDER_BLUSH, + LAWN_GREEN, + LEMON_CHIFFON, + LIGHT_BLUE, + LIGHT_CORAL, + LIGHT_CYAN, + LIGHT_GOLDENROD_YELLOW, + LIGHT_GRAY, + LIGHT_GREEN, + LIGHT_PINK, + LIGHT_SALMON, + LIGHT_SEA_GREEN, + LIGHT_SKY_BLUE, + LIGHT_SLATE_GRAY, + LIGHT_STEEL_BLUE, + LIGHT_YELLOW, + LIME, + LIME_GREEN, + LINEN, + MAGENTA, + MAROON, + MEDIUM_AQUAMARINE, + MEDIUM_BLUE, + MEDIUM_ORCHID, + MEDIUM_PURPLE, + MEDIUM_SEA_GREEN, + MEDIUM_SLATE_BLUE, + MEDIUM_SPRING_GREEN, + MEDIUM_TURQUOISE, + MEDIUM_VIOLET_RED, + MIDNIGHT_BLUE, + MINT_CREAM, + MISTY_ROSE, + MOCCASIN, + NAVAJO_WHITE, + NAVY, + OLD_LACE, + OLIVE, + OLIVE_DRAB, + ORANGE, + ORANGE_RED, + ORCHID, + PALE_GOLDENROD, + PALE_GREEN, + PALE_TURQUOISE, + PALE_VIOLET_RED, + PAPAYA_WHIP, + PEACH_PUFF, + PERU, + PINK, + PLUM, + POWDER_BLUE, + PURPLE, + RED, + ROSY_BROWN, + ROYAL_BLUE, + SADDLE_BROWN, + SALMON, + SANDY_BROWN, + SEA_GREEN, + SEASHELL, + SIENNA, + SILVER, + SKY_BLUE, + SLATE_BLUE, + SLATE_GRAY, + SNOW, + SPRING_GREEN, + STEEL_BLUE, + TAN, + TEAL, + THISTLE, + TOMATO, + TURQUOISE, + VIOLET, + WHEAT, + WHITE, + WHITE_SMOKE, + YELLOW, + YELLOW_GREEN + }; + + /** + * Returns a random HTML color. + * + * @return a random Color from the predefined HTML colors + * + * @example.files HtmlColorGetRandom.java + */ + public static final Color getRandom() { + return COLORS[RANDOM.nextInt(COLORS.length)]; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/KeyCode.java b/core/src/main/java/org/openpatch/scratch/KeyCode.java new file mode 100644 index 00000000..877b1793 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/KeyCode.java @@ -0,0 +1,130 @@ +package org.openpatch.scratch; + +/** + * Key codes for keyboard input handling. + * + *

Use these constants to check which key was pressed or released. + * + *

+ * {@code
+ * // In whenKeyPressed:
+ * if (keyCode == KeyCode.SPACE) { ... }
+ *
+ * // In isKeyPressed:
+ * if (this.isKeyPressed(KeyCode.UP)) { ... }
+ * }
+ * 
+ * + *

Letters and digits name the key that shows them on the keyboard's layout: on a German + * keyboard, the key with Z on it is {@code KeyCode.Z}. Other keys are named by their place. + */ +public enum KeyCode { + ENTER, + BACKSPACE, + TAB, + CANCEL, + CLEAR, + SHIFT, + CTRL, + ALT, + PAUSE, + CAPS_LOCK, + ESCAPE, + SPACE, + PAGE_UP, + PAGE_DOWN, + END, + HOME, + LEFT, + UP, + RIGHT, + DOWN, + COMMA, + MINUS, + PERIOD, + SLASH, + DIGIT_0, + DIGIT_1, + DIGIT_2, + DIGIT_3, + DIGIT_4, + DIGIT_5, + DIGIT_6, + DIGIT_7, + DIGIT_8, + DIGIT_9, + SEMICOLON, + EQUALS, + A, + B, + C, + D, + E, + F, + G, + H, + I, + J, + K, + L, + M, + N, + O, + P, + Q, + R, + S, + T, + U, + V, + W, + X, + Y, + Z, + OPEN_BRACKET, + BACK_SLASH, + CLOSE_BRACKET, + NUMPAD_0, + NUMPAD_1, + NUMPAD_2, + NUMPAD_3, + NUMPAD_4, + NUMPAD_5, + NUMPAD_6, + NUMPAD_7, + NUMPAD_8, + NUMPAD_9, + MULTIPLY, + ADD, + SUBTRACT, + DECIMAL, + DIVIDE, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + F11, + F12, + DELETE, + NUM_LOCK, + SCROLL_LOCK, + PRINT_SCREEN, + INSERT, + HELP, + META, + BACK_QUOTE, + QUOTE, + KP_UP, + KP_DOWN, + KP_LEFT, + KP_RIGHT, + WINDOWS, + CONTEXT_MENU, + UNKNOWN +} diff --git a/core/src/main/java/org/openpatch/scratch/Launcher.java b/core/src/main/java/org/openpatch/scratch/Launcher.java new file mode 100644 index 00000000..9cd3670d --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Launcher.java @@ -0,0 +1,72 @@ +package org.openpatch.scratch; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; + +/** + * Starts a program so that its window runs on the process's first thread, which macOS requires + * (with {@code -XstartOnFirstThread}); the program's {@code main} runs on a second thread. Studio + * starts every run and every exported game this way; a plain {@code java} + * run does not need it. + * + *

java -XstartOnFirstThread -cp game.jar org.openpatch.scratch.Launcher MyGame
+ * + * @ignore-in-docs + */ +public final class Launcher { + + private static final BlockingQueue firstThread = new LinkedBlockingQueue<>(); + private static volatile boolean active; + + private Launcher() {} + + /** Whether the window has to run on the first thread. */ + public static boolean isActive() { + return active; + } + + /** Hands the window loop to the first thread; it does not return before the program ends. */ + public static void runOnFirstThread(Runnable windowLoop) { + firstThread.add(windowLoop); + } + + /** + * @param args the main class, then its arguments + * @throws Exception when the main class cannot be found + */ + public static void main(String[] args) throws Exception { + if (args.length == 0) { + System.err.println("usage: java [-XstartOnFirstThread] org.openpatch.scratch.Launcher
[args…]"); + System.exit(2); + } + active = true; + Method learnerMain = Class.forName(args[0], false, Launcher.class.getClassLoader()).getMethod("main", + String[].class); + String[] learnerArgs = Arrays.copyOfRange(args, 1, args.length); + Thread learner = new Thread(() -> { + try { + learnerMain.invoke(null, (Object) learnerArgs); + } catch (InvocationTargetException e) { + e.getCause().printStackTrace(); + } catch (ReflectiveOperationException e) { + e.printStackTrace(); + } + }, "main"); + learner.start(); + // a main that never opens a window ends the program when it returns + while (true) { + Runnable windowLoop = firstThread.poll(20, TimeUnit.MILLISECONDS); + if (windowLoop != null) { + windowLoop.run(); + return; + } + if (!learner.isAlive()) { + return; + } + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Layer.java b/core/src/main/java/org/openpatch/scratch/Layer.java new file mode 100644 index 00000000..8f59bb8c --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Layer.java @@ -0,0 +1,33 @@ +package org.openpatch.scratch; + +/** + * One of the four layers a stage draws, from back to front, after its backdrop. + * + *

Every layer holds sprites, in Scratch's order within the layer ({@code goToFrontLayer()} + * means the front of the sprite's own layer), and a canvas for pen strokes and stamps, created + * when a pen or stamp first uses it. Sprites, texts and pens are in {@link #MAIN} unless they are + * moved with {@code setLayer}; a pen draws onto the canvas of its own layer, which for a sprite's + * pen is {@link #BACKGROUND}, behind the sprites, as in Scratch. + * + *

{@code
+ * this.setLayer(Layer.FOREGROUND);
+ * }
+ */ +public enum Layer { + + /** Behind the sprites of {@link #MAIN}: scenery, and where pens draw by default. */ + BACKGROUND, + + /** Where sprites are unless they are moved. */ + MAIN, + + /** In front of the sprites of {@link #MAIN}. */ + FOREGROUND, + + /** + * In front of everything and unaffected by the camera: buttons, scores, menus. Drawn at the + * window's resolution, so it stays sharp. Colour sensing and {@code isTouchingSprite} between + * the world and the UI ignore it. + */ + UI +} diff --git a/src/main/java/org/openpatch/scratch/MouseCode.java b/core/src/main/java/org/openpatch/scratch/MouseCode.java similarity index 100% rename from src/main/java/org/openpatch/scratch/MouseCode.java rename to core/src/main/java/org/openpatch/scratch/MouseCode.java diff --git a/src/main/java/org/openpatch/scratch/Operators.java b/core/src/main/java/org/openpatch/scratch/Operators.java similarity index 97% rename from src/main/java/org/openpatch/scratch/Operators.java rename to core/src/main/java/org/openpatch/scratch/Operators.java index 1d3facae..3b55b217 100644 --- a/src/main/java/org/openpatch/scratch/Operators.java +++ b/core/src/main/java/org/openpatch/scratch/Operators.java @@ -59,6 +59,8 @@ public static final double constrain(double amt, double low, double high) { * @param amt the value to constrain * @param low minimum limit * @param high maximum limit + * + * @example.files OperatorsConstrain.java */ public static final int constrain(int amt, int low, int high) { return (amt < low) ? low : ((amt > high) ? high : amt); @@ -111,6 +113,8 @@ public static final double max(double... v) { * * @param v values * @return the minimum + * + * @example.files OperatorsMin.java */ public static final int min(int... v) { int m = Integer.MAX_VALUE; @@ -129,6 +133,8 @@ public static final int min(int... v) { * * @param v values * @return the maximum + * + * @example.files OperatorsMax.java */ public static final int max(int... v) { int m = Integer.MIN_VALUE; @@ -184,6 +190,9 @@ public static final int round(double x) { * @param x a value * @param precision the number of decimal places to round to * @return the rounded value + * + * @scratchblock (round (x)) + * @example.files OperatorsRound.java */ public static final double round(double x, int precision) { double scale = Math.pow(10, precision); @@ -220,6 +229,9 @@ public static final double mod(double x, double y) { * @param x first value * @param y second value * @return what is left of the first value after dividing by the second + * + * @scratchblock ((x) mod (y)) + * @example.files OperatorsMod.java */ public static final int mod(int x, int y) { return ((x % y) + y) % y; @@ -248,6 +260,8 @@ public static final int absOf(int x) { * @return the absolute value * * @scratchblock ([abs v] of (x)) + * + * @example.files OperatorsAbsOf.java */ public static final double absOf(double x) { return Math.abs(x); diff --git a/core/src/main/java/org/openpatch/scratch/Pen.java b/core/src/main/java/org/openpatch/scratch/Pen.java new file mode 100644 index 00000000..7a30e112 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Pen.java @@ -0,0 +1,290 @@ +package org.openpatch.scratch; + +/** + * A pen draws lines onto the canvas of its layer, like Scratch's pen. Every sprite has one + * ({@code getPen()}) that follows it; a pen of your own can be added to a stage and moved with + * {@link #setPosition(double, double)}. + * + *

What a pen draws stays where it was drawn on the screen: a camera moving later does not move + * it. A sprite's pen draws onto {@link Layer#BACKGROUND}, behind the sprites, unless it is moved + * with {@link #setLayer(Layer)}. + * + *

{@code
+ * this.getPen().setColor(new Color(255, 0, 0));
+ * this.getPen().setSize(4);
+ * this.getPen().down();
+ * this.move(50);
+ * }
+ */ +public class Pen { + + private Stage stage; + private Sprite sprite; + private Layer layer = Layer.BACKGROUND; + private Color color = new Color(0, 0, 255); + private double size = 1; + private double transparency; + private boolean down; + private double x, y; + + /** A pen of your own, at (0, 0); add it to a stage with {@code stage.add(pen)}. */ + public Pen() {} + + /** The pen of a sprite: it follows the sprite. */ + Pen(Sprite sprite) { + this.sprite = sprite; + } + + /** A copy of {@code pen} for a clone: settings and up/down, as Scratch copies the pen state. */ + Pen(Pen pen, Sprite sprite) { + this.sprite = sprite; + this.layer = pen.layer; + this.color = pen.color; + this.size = pen.size; + this.transparency = pen.transparency; + this.down = pen.down; + this.x = pen.x; + this.y = pen.y; + } + + private Stage stage() { + return this.sprite != null ? this.sprite.getStage() : this.stage; + } + + void setStage(Stage stage) { + this.stage = stage; + } + + /** + * @return the colour lines are drawn in + * + * @example.files PenGetColor.java + */ + public Color getColor() { + return this.color; + } + + /** + * @param color the colour to draw lines in + * + * @example.files PenSetColor.java + */ + public void setColor(Color color) { + this.color = color; + } + + /** + * Sets the colour by Scratch's colour number (hue) from 0 to 100, at full saturation and + * brightness, like Scratch's "set pen color to". + * + * @param hue the colour from 0 to 100 + * + * @example.files PenSetColor.java + */ + public void setColor(double hue) { + this.color = Color.fromHSB(hue, 100, 100).withAlpha(this.color.getAlpha()); + } + + /** + * @param red red from 0 to 255 + * @param green green from 0 to 255 + * @param blue blue from 0 to 255 + * + * @example.files PenSetColor.java + */ + public void setColor(double red, double green, double blue) { + this.color = new Color(red, green, blue); + } + + /** + * @param by how much to change the colour (hue, 0 to 100, going around) + * + * @example.files PenChangeColor.java + * @scratchblock change pen [color v] by (c) + */ + public void changeColor(double by) { + this.color = this.color.withHue(this.color.getHue() + by); + } + + /** + * @return the line width in stage pixels + * + * @example.files PenGetSize.java + */ + public double getSize() { + return this.size; + } + + /** + * @param size the line width in stage pixels (at least 1) + * + * @example.files PenSetSize.java + * @scratchblock set pen size to (size) + */ + public void setSize(double size) { + this.size = Math.max(1, size); + } + + /** + * @param by how much to change the line width + * + * @example.files PenChangeSize.java + * @scratchblock change pen size by (size) + */ + public void changeSize(double by) { + this.setSize(this.size + by); + } + + /** @return the transparency in percent (0 opaque, 100 invisible) */ + public double getTransparency() { + return this.transparency; + } + + /** + * @param transparency in percent (0 opaque, 100 invisible) + * + * @example.files PenSetTransparency.java + */ + public void setTransparency(double transparency) { + this.transparency = Math.max(0, Math.min(100, transparency)); + } + + /** + * @param by how much to change the transparency + * + * @example.files PenChangeTransparency.java + */ + public void changeTransparency(double by) { + this.setTransparency(this.transparency + by); + } + + /** @return the layer whose canvas the pen draws on */ + public Layer getLayer() { + return this.layer; + } + + /** @param layer the layer whose canvas the pen draws on */ + public void setLayer(Layer layer) { + this.layer = layer; + } + + /** @return whether the pen is down and draws when it moves */ + public boolean isDown() { + return this.down; + } + + /** + * Puts the pen down: it leaves a dot, and a line wherever it moves. + * + * @example.files PenDown.java + * @scratchblock pen down + */ + public void down() { + this.down = true; + this.draw(this.x, this.y, this.x, this.y); + } + + /** + * Lifts the pen: it no longer draws. + * + * @example.files PenUp.java + * @scratchblock pen up + */ + public void up() { + this.down = false; + } + + /** + * Moves the pen, drawing a line from where it was if it is down. + * + * @param x world x + * @param y world y + * + * @example.files PenSetPosition.java + */ + public void setPosition(double x, double y) { + double fromX = this.x, fromY = this.y; + this.x = x; + this.y = y; + if (this.down) { + this.draw(fromX, fromY, x, y); + } + } + + /** + * @param position world position + * + * @example.files PenSetPosition.java + */ + public void setPosition(Vector2 position) { + this.setPosition(position.getX(), position.getY()); + } + + /** + * Moves the pen to a random position on the stage, drawing if it is down. + * + * @example.files PenGoToRandomPosition.java + */ + public void goToRandomPosition() { + Stage stage = this.stage(); + double halfW = stage == null ? 240 : stage.getWidth() / 2.0, halfH = stage == null ? 180 : stage.getHeight() / 2.0; + this.setPosition(Random.random(-halfW, halfW), Random.random(-halfH, halfH)); + } + + /** + * Moves the pen to the mouse pointer, drawing if it is down. + * + * @example.files PenGoToMousePointer.java + */ + public void goToMousePointer() { + Stage stage = this.stage(); + if (stage != null) { + this.setPosition(stage.getMouse()); + } + } + + /** @return the pen's world position */ + public Vector2 getPosition() { + return new Vector2(this.x, this.y); + } + + /** + * Stamps the pen's sprite onto the pen's layer, like Scratch's "stamp" block. + * + * @scratchblock stamp + * @example.files PenStamp.java + */ + public void stamp() { + if (this.sprite != null) { + this.sprite.stamp(this.layer); + } + } + + /** + * Erases everything drawn on the pen's layer, by any pen or stamp. + * + * @example.files PenEraseAll.java + * @scratchblock erase all + */ + public void eraseAll() { + Stage stage = this.stage(); + if (stage != null) { + stage.eraseLayer(this.layer); + } + } + + /** Where a sprite's pen is when the sprite moves without drawing (going to a new stage, say). */ + void jumpTo(double x, double y) { + this.x = x; + this.y = y; + } + + private void draw(double fromX, double fromY, double toX, double toY) { + Stage stage = this.stage(); + if (stage == null) { + return; + } + int argb = this.color.withAlpha(this.color.getAlpha() * (1 - this.transparency / 100)).toARGB(); + stage.penLine(this.layer, fromX, fromY, toX, toY, this.size, argb); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Pixels.java b/core/src/main/java/org/openpatch/scratch/Pixels.java new file mode 100644 index 00000000..71b90746 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Pixels.java @@ -0,0 +1,80 @@ +package org.openpatch.scratch; + +import org.openpatch.scratch.internal.image.Image; +import org.openpatch.scratch.internal.image.Images; + +/** + * The pixels of the stage or of an image file, to read colours from. Coordinates count pixels + * from the top left corner (0, 0). + * + *
{@code
+ * Pixels terrain = Pixels.of("assets/terrain.png");
+ * boolean solid = terrain.getColor(10, 20).getAlpha() > 0;
+ *
+ * Pixels screen = Pixels.of(this.getStage());
+ * }
+ * + *

The stage's pixels are what its world layers show at that moment: backdrop, stage colour, + * pen strokes, stamps and sprites with their effects, the same as colour sensing sees. Texts, + * shaders and the UI layer are not included. + */ +public final class Pixels { + + private final int width, height; + private final int[] argb; + + private Pixels(int width, int height, int[] argb) { + this.width = width; + this.height = height; + this.argb = argb; + } + + /** + * The stage's pixels as they are now. + * + * @param stage the stage + * @return its pixels, at stage size + */ + public static Pixels of(Stage stage) { + return new Pixels(stage.getWidth(), stage.getHeight(), stage.compositor(null).render()); + } + + /** + * The pixels of an image file. + * + * @param imagePath the image + * @return its pixels + */ + public static Pixels of(String imagePath) { + Image image = Images.load(imagePath); + return new Pixels(image.getWidth(), image.getHeight(), image.getArgb().clone()); + } + + /** @return the width in pixels */ + public int getWidth() { + return this.width; + } + + /** @return the height in pixels */ + public int getHeight() { + return this.height; + } + + /** + * @param x pixels from the left edge + * @param y pixels from the top edge + * @return the colour there, or transparent black outside + */ + public Color getColor(int x, int y) { + return Color.fromARGB(this.getArgb(x, y)); + } + + /** + * @param x pixels from the left edge + * @param y pixels from the top edge + * @return the colour there packed as alpha, red, green, blue, or 0 outside + */ + public int getArgb(int x, int y) { + return x < 0 || y < 0 || x >= this.width || y >= this.height ? 0 : this.argb[y * this.width + x]; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Polygon.java b/core/src/main/java/org/openpatch/scratch/Polygon.java new file mode 100644 index 00000000..ba4579df --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Polygon.java @@ -0,0 +1,43 @@ +package org.openpatch.scratch; + +import java.util.Arrays; + +/** A polygon given by its corners, concave ones included. The outline closes by itself. */ +public class Polygon extends Shape { + + private double[] corners = new double[0]; + + /** A polygon without corners yet; add them with {@link #addPoint(double, double)}. */ + public Polygon() {} + + /** + * @param xPoints x of every corner + * @param yPoints y of every corner, in the same order + */ + public Polygon(double[] xPoints, double[] yPoints) { + if (xPoints.length != yPoints.length) { + throw new IllegalArgumentException("xPoints and yPoints must have the same length"); + } + this.corners = new double[2 * xPoints.length]; + for (int i = 0; i < xPoints.length; i++) { + this.corners[2 * i] = xPoints[i]; + this.corners[2 * i + 1] = yPoints[i]; + } + this.setPoints(this.corners); + } + + /** + * Adds a corner after the last one. + * + * @param x x of the corner + * @param y y of the corner + * + * @example.files PolygonAddPoint.java + */ + public void addPoint(double x, double y) { + this.corners = Arrays.copyOf(this.corners, this.corners.length + 2); + this.corners[this.corners.length - 2] = x; + this.corners[this.corners.length - 1] = y; + this.setPoints(this.corners); + } +} diff --git a/src/main/java/org/openpatch/scratch/Random.java b/core/src/main/java/org/openpatch/scratch/Random.java similarity index 93% rename from src/main/java/org/openpatch/scratch/Random.java rename to core/src/main/java/org/openpatch/scratch/Random.java index 7cebae2f..cd344494 100644 --- a/src/main/java/org/openpatch/scratch/Random.java +++ b/core/src/main/java/org/openpatch/scratch/Random.java @@ -1,6 +1,6 @@ package org.openpatch.scratch; -import org.openpatch.scratch.internal.Applet; +import org.openpatch.scratch.internal.Game; import org.openpatch.scratch.internal.OpenSimplex2S; /** @@ -55,6 +55,8 @@ public static double noise(double x) { * @param x x-coordinate * @param y y-coordinate * @return the noise value + * + * @example.files RandomNoise.java */ public static double noise(double x, double y) { return OpenSimplex2S.noise2(noiseSeed, x, y); @@ -67,6 +69,8 @@ public static double noise(double x, double y) { * @param y y-coordinate * @param z z-coordinate * @return the noise value + * + * @example.files RandomNoise.java */ public static double noise(double x, double y, double z) { return OpenSimplex2S.noise3_ImproveXY(noiseSeed, x, y, z); @@ -103,7 +107,7 @@ public static Vector2 randomVector2() { */ public static double randomX() { return Random.random( - -Applet.getInstance().getRenderWidth() / 2.0, Applet.getInstance().getRenderWidth() / 2.0); + -Game.current().getWidth() / 2.0, Game.current().getWidth() / 2.0); } /** @@ -115,8 +119,8 @@ public static double randomX() { */ public static double randomY() { return Random.random( - -Applet.getInstance().getRenderHeight() / 2.0, - Applet.getInstance().getRenderHeight() / 2.0); + -Game.current().getHeight() / 2.0, + Game.current().getHeight() / 2.0); } /** @@ -158,6 +162,8 @@ public static int randomInt(int max) { * * @param max the maximum double * @return a random double + * + * @example.files RandomRandom.java */ public static double random(double max) { return getRandom().nextDouble() * max; diff --git a/core/src/main/java/org/openpatch/scratch/Rectangle.java b/core/src/main/java/org/openpatch/scratch/Rectangle.java new file mode 100644 index 00000000..a61f2349 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Rectangle.java @@ -0,0 +1,15 @@ +package org.openpatch.scratch; + +/** A rectangle along the axes. */ +public class Rectangle extends Shape { + + /** + * @param x the smallest x + * @param y the smallest y + * @param width the width + * @param height the height + */ + public Rectangle(double x, double y, double width, double height) { + this.setPoints(new double[] {x, y, x + width, y, x + width, y + height, x, y + height}); + } +} diff --git a/src/main/java/org/openpatch/scratch/RotationStyle.java b/core/src/main/java/org/openpatch/scratch/RotationStyle.java similarity index 100% rename from src/main/java/org/openpatch/scratch/RotationStyle.java rename to core/src/main/java/org/openpatch/scratch/RotationStyle.java diff --git a/src/main/java/org/openpatch/scratch/ScratchException.java b/core/src/main/java/org/openpatch/scratch/ScratchException.java similarity index 100% rename from src/main/java/org/openpatch/scratch/ScratchException.java rename to core/src/main/java/org/openpatch/scratch/ScratchException.java diff --git a/core/src/main/java/org/openpatch/scratch/Shader.java b/core/src/main/java/org/openpatch/scratch/Shader.java new file mode 100644 index 00000000..1502b3b8 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Shader.java @@ -0,0 +1,169 @@ +package org.openpatch.scratch; + +import java.nio.charset.StandardCharsets; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import org.openpatch.scratch.internal.draw.ShaderDraw; +import org.openpatch.scratch.internal.image.Images; + +/** + * A shader: a small program the graphics card runs for every pixel of a sprite (or of the whole + * stage) to change how it looks. You write only the body; every shader gets the same header: + * + *

{@code
+ * uniform sampler2D costume;   // the costume (or the stage's picture)
+ * uniform vec2 resolution;     // its size in pixels
+ * uniform float time;          // game time in seconds
+ * in vec2 uv;                  // where in the costume: (0, 0) top left, (1, 1) bottom right
+ * out vec4 color;              // the colour to draw
+ * }
+ * + *
{@code
+ * void main() {
+ *   vec4 c = texture(costume, uv);
+ *   float g = (c.r + c.g + c.b) / 3.0;
+ *   color = vec4(g, g, g, c.a);
+ * }
+ * }
+ * + *

Colours have straight (not premultiplied) alpha. Values of your own come in through + * uniforms you declare and set with {@link #set(String, double)} and friends; the header's + * {@code time} and {@code resolution} are filled in for you and cannot be set. + */ +public final class Shader { + + /** Names the header declares: setting them is an error. */ + private static final Set HEADER = Set.of("costume", "resolution", "time", "uv", "color"); + + private String name; + private final String path; + private final String source; + private final Map uniforms = new LinkedHashMap<>(); + + Shader(String name, String fragmentPath) { + this.name = name; + this.path = fragmentPath; + byte[] bytes = Images.read(fragmentPath); + if (bytes == null) { + throw new IllegalArgumentException("Shader not found: " + fragmentPath); + } + this.source = new String(bytes, StandardCharsets.UTF_8); + } + + Shader(Shader shader) { + this.name = shader.name; + this.path = shader.path; + this.source = shader.source; + this.uniforms.putAll(shader.uniforms); + } + + /** @return the shader's name */ + public String getName() { + return this.name; + } + + /** @param name a new name */ + public void setName(String name) { + this.name = name; + } + + private void put(String uniform, Object value) { + if (HEADER.contains(uniform)) { + throw new IllegalArgumentException("\"" + uniform + "\" is filled in by Scratch for Java; remove the line " + + "that sets it, or use a uniform of your own with another name."); + } + synchronized (this.uniforms) { + this.uniforms.put(uniform, value); + } + } + + /** + * @param uniform the uniform's name in the shader + * @param value an {@code int} or {@code float} uniform's value + * + * @example.files ShaderSet.java + */ + public void set(String uniform, double value) { + this.put(uniform, new float[] {(float) value}); + } + + /** + * @param uniform the uniform's name + * @param value an {@code int} uniform's value + * + * @example.files ShaderSet.java + */ + public void set(String uniform, int value) { + this.put(uniform, new int[] {value}); + } + + /** + * @param uniform the uniform's name + * @param value a {@code bool} uniform's value + * + * @example.files ShaderSet.java + */ + public void set(String uniform, boolean value) { + this.put(uniform, new int[] {value ? 1 : 0}); + } + + /** + * @param uniform the uniform's name + * @param x a {@code vec2}'s x + * @param y a {@code vec2}'s y + * + * @example.files ShaderSet.java + */ + public void set(String uniform, double x, double y) { + this.put(uniform, new float[] {(float) x, (float) y}); + } + + /** + * @param uniform the uniform's name + * @param value a {@code vec2} + * + * @example.files ShaderSet.java + */ + public void set(String uniform, Vector2 value) { + this.set(uniform, value.getX(), value.getY()); + } + + /** + * @param uniform the uniform's name + * @param color a {@code vec4}: red, green, blue and alpha from 0 to 1 + * + * @example.files ShaderSet.java + */ + public void set(String uniform, Color color) { + this.put(uniform, new float[] {(float) (color.getRed() / 255), (float) (color.getGreen() / 255), + (float) (color.getBlue() / 255), (float) (color.getAlpha() / 255)}); + } + + /** + * An array uniform such as {@code uniform vec3 lights[100];}. + * + * @param uniform the uniform's name + * @param values all values, one element after the other + * @param perElement values per element: 1 for {@code float[]}, 3 for {@code vec3[]} + * + * @example.files ShaderSet.java + */ + public void set(String uniform, double[] values, int perElement) { + float[] f = new float[values.length + 1]; + f[0] = perElement; + for (int i = 0; i < values.length; i++) { + f[i + 1] = (float) values[i]; + } + this.put(uniform + "[]", f); + } + + /** The body and a copy of the uniforms, for the draw list. */ + ShaderDraw toDraw() { + synchronized (this.uniforms) { + Map copy = new LinkedHashMap<>(); + this.uniforms.forEach((k, v) -> copy.put(k, v instanceof float[] f ? f.clone() : ((int[]) v).clone())); + return new ShaderDraw(this.path, this.source, copy); + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Shaders.java b/core/src/main/java/org/openpatch/scratch/Shaders.java new file mode 100644 index 00000000..542b0a89 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Shaders.java @@ -0,0 +1,185 @@ +package org.openpatch.scratch; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openpatch.scratch.internal.draw.ShaderDraw; + +/** + * The shaders of a sprite or of the stage. The first one added is used at once; more than one + * can be active, applied in the order they were added. + * + *

{@code
+ * Shader waves = this.getShaders().add("waves", "assets/waves.frag");
+ * waves.set("strength", 0.02);
+ * }
+ */ +public final class Shaders { + + private final List shaders = new ArrayList<>(); + private final Set active = new LinkedHashSet<>(); + private boolean activateFirst = true; + + Shaders() {} + + Shaders(Shaders other) { + this.activateFirst = other.activateFirst; + for (Shader s : other.shaders) { + Shader copy = new Shader(s); + this.shaders.add(copy); + if (other.active.contains(s)) { + this.active.add(copy); + } + } + } + + /** + * Adds a shader, or returns the one of that name added before. + * + * @param name the shader's name + * @param fragmentPath the file with the shader's body + * @return the shader, to set its uniforms + * + * @example.files ShadersAdd.java + */ + public Shader add(String name, String fragmentPath) { + Shader existing = this.get(name); + if (existing != null) { + return existing; + } + Shader shader = new Shader(name, fragmentPath); + if (this.shaders.isEmpty() && this.activateFirst) { + this.active.add(shader); + } + this.shaders.add(shader); + return shader; + } + + /** + * @param name a shader's name + * @return the shader, or null + */ + public Shader get(String name) { + for (Shader s : this.shaders) { + if (s.getName().equals(name)) { + return s; + } + } + return null; + } + + /** + * @param name the shader to use, alone + * + * @example.files ShadersSwitchTo.java + */ + public void switchTo(String name) { + Shader s = this.get(name); + if (s != null) { + this.active.clear(); + this.active.add(s); + } + } + + /** + * @param index the shader to use alone, counting from 0; wraps around + * + * @example.files ShadersSwitchTo.java + */ + public void switchTo(double index) { + if (!this.shaders.isEmpty()) { + this.active.clear(); + this.active.add(this.shaders.get(Math.floorMod((int) Math.floor(index), this.shaders.size()))); + } + } + + /** + * Uses the next shader alone. + * + * @example.files ShadersNext.java + */ + public void next() { + this.switchTo(this.getCurrentIndex() + 1); + } + + /** + * Uses no shader. + * + * @example.files ShadersReset.java + */ + public void reset() { + this.active.clear(); + this.activateFirst = false; + } + + /** + * @param name a shader to use in addition to the active ones + * + * @example.files ShadersActivate.java + */ + public void activate(String name) { + Shader s = this.get(name); + if (s != null) { + this.active.add(s); + } + } + + /** + * @param name a shader to stop using + * + * @example.files ShadersActivate.java + */ + public void deactivate(String name) { + Shader s = this.get(name); + if (s != null) { + this.active.remove(s); + } + } + + /** + * @param name a shader's name + * @return whether it is in use + */ + public boolean isActive(String name) { + Shader s = this.get(name); + return s != null && this.active.contains(s); + } + + /** @return the shaders in use, in order */ + public List getActive() { + List result = new ArrayList<>(); + for (Shader s : this.shaders) { + if (this.active.contains(s)) { + result.add(s); + } + } + return result; + } + + /** @return the first shader in use, or null */ + public Shader getCurrent() { + List active = this.getActive(); + return active.isEmpty() ? null : active.get(0); + } + + /** @return the number of the first shader in use, or -1 */ + public int getCurrentIndex() { + Shader current = this.getCurrent(); + return current == null ? -1 : this.shaders.indexOf(current); + } + + /** @return the name of the first shader in use, or null */ + public String getCurrentName() { + Shader current = this.getCurrent(); + return current == null ? null : current.getName(); + } + + List toDraw() { + List out = new ArrayList<>(); + for (Shader s : this.getActive()) { + out.add(s.toDraw()); + } + return List.copyOf(out); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Shape.java b/core/src/main/java/org/openpatch/scratch/Shape.java new file mode 100644 index 00000000..0bc991c0 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Shape.java @@ -0,0 +1,152 @@ +package org.openpatch.scratch; + +import org.openpatch.scratch.internal.geom.Geometry; + +/** + * A shape on the stage: a polygon, rectangle, circle, ellipse or triangle. Shapes serve as + * hitboxes ({@code sprite.setHitbox(...)}) and can be tested against each other. Circles and + * ellipses are stored as polygons that stay within a quarter pixel of the true outline. + * + *

Shapes that only touch, along an edge or at a corner, do not intersect. + */ +public class Shape { + + private double[] ring = new double[0]; + private Bounds bounds; + private double[][] pieces; + private Boolean convex; + + /** An empty shape, for subclasses that set their points. */ + protected Shape() {} + + private Shape(double[] ring) { + this.ring = ring; + } + + /** + * A shape from the points of its outline. + * + * @param points {@code x0, y0, x1, y1, …}; the outline is closed + * @return the shape + */ + static Shape of(double[] points) { + return new Shape(points.clone()); + } + + /** + * Sets the outline; subclasses call it from their constructors. + * + * @param points {@code x0, y0, x1, y1, …}; the outline is closed + */ + protected void setPoints(double[] points) { + if (points.length % 2 != 0) { + throw new IllegalArgumentException("A shape needs pairs of x and y."); + } + this.ring = points.clone(); + this.bounds = null; + this.pieces = null; + this.convex = null; + } + + /** @return the outline's points {@code x0, y0, x1, y1, …} (a copy) */ + public double[] getPoints() { + return this.ring.clone(); + } + + /** + * @param x x of a point + * @param y y of a point + * @return whether the point lies inside the shape + * + * @example.files ShapeContains.java + */ + public boolean contains(double x, double y) { + return this.ring.length >= 6 && Geometry.contains(this.ring, x, y); + } + + /** + * @param other another shape + * @return whether the two shapes overlap with some area; shapes that only touch do not + * + * @example.files ShapeIntersects.java + */ + public boolean intersects(Shape other) { + if (this.ring.length < 6 || other.ring.length < 6) { + return false; + } + Bounds a = this.getBounds(), b = other.getBounds(); + if (!a.intersects(b)) { + return false; + } + if (this.isConvex() && other.isConvex()) { + return Geometry.convexOverlap(this.ring, other.ring); + } + return Geometry.overlap(this.pieces(), other.pieces()); + } + + private boolean isConvex() { + if (this.convex == null) { + this.convex = Geometry.isConvex(this.ring); + } + return this.convex; + } + + private double[][] pieces() { + if (this.pieces == null) { + this.pieces = Geometry.convexPieces(this.ring); + } + return this.pieces; + } + + /** + * @param scaleX factor along x (negative mirrors) + * @param scaleY factor along y + * @return the shape scaled about the origin + * + * @example.files ShapeScale.java + */ + public Shape scale(double scaleX, double scaleY) { + return new Shape(Geometry.transform(this.ring, scaleX, 0, 0, scaleY, 0, 0)); + } + + /** + * @param dx distance along x + * @param dy distance along y + * @return the shape moved + * + * @example.files ShapeTranslate.java + */ + public Shape translate(double dx, double dy) { + return new Shape(Geometry.transform(this.ring, 1, 0, 0, 1, dx, dy)); + } + + /** + * Turns the shape about a point, from the x axis towards the y axis (anticlockwise when y points + * up). + * + * @param degrees the angle + * @param anchorX x of the point to turn about + * @param anchorY y of the point to turn about + * @return the shape turned + * + * @example.files ShapeRotate.java + */ + public Shape rotate(double degrees, double anchorX, double anchorY) { + double r = Math.toRadians(degrees), cos = Math.cos(r), sin = Math.sin(r); + return new Shape(Geometry.transform(this.ring, cos, sin, -sin, cos, + anchorX - cos * anchorX + sin * anchorY, anchorY - sin * anchorX - cos * anchorY)); + } + + /** + * @return the smallest rectangle around the shape + * + * @example.files ShapeGetBounds.java + */ + public Bounds getBounds() { + if (this.bounds == null) { + double[] b = Geometry.bounds(this.ring); + this.bounds = new Bounds(b[0], b[1], b[2] - b[0], b[3] - b[1]); + } + return this.bounds; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/SoundPlayback.java b/core/src/main/java/org/openpatch/scratch/SoundPlayback.java new file mode 100644 index 00000000..8eb8e034 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/SoundPlayback.java @@ -0,0 +1,43 @@ +package org.openpatch.scratch; + +import org.openpatch.scratch.internal.audio.AudioEngine; + +/** + * One copy of a sound started with {@code playSoundCopy}: it can be stopped or made louder or + * quieter while it plays, independently of other copies. + */ +public final class SoundPlayback { + + private final int handle; + + SoundPlayback(int handle) { + this.handle = handle; + } + + /** + * Stops this copy. + * + * @example.files SoundPlaybackExample.java + */ + public void stop() { + AudioEngine.get().stop(this.handle); + } + + /** + * @return whether this copy still plays + * + * @example.files SoundPlaybackExample.java + */ + public boolean isPlaying() { + return AudioEngine.get().isPlaying(this.handle); + } + + /** + * @param volume from 0 to 100 + * + * @example.files SoundPlaybackExample.java + */ + public void setVolume(double volume) { + AudioEngine.get().setVolume(this.handle, Math.max(0, Math.min(100, volume)) / 100); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Sprite.java b/core/src/main/java/org/openpatch/scratch/Sprite.java new file mode 100644 index 00000000..768db8d6 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Sprite.java @@ -0,0 +1,2164 @@ +package org.openpatch.scratch; + +import java.util.ArrayList; +import java.util.List; +import org.openpatch.scratch.internal.Costume; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.Monitor; +import org.openpatch.scratch.internal.SoundBank; +import org.openpatch.scratch.internal.compose.Compositor; +import org.openpatch.scratch.internal.draw.Effects; +import org.openpatch.scratch.internal.draw.SpriteDraw; +import org.openpatch.scratch.internal.geom.Geometry; +import org.openpatch.scratch.internal.image.Images; + +/** + * A sprite: an object on the stage with costumes, a position and a direction, and code that runs + * every tick in {@link #run()}, like a sprite and its scripts in Scratch. + * + *

{@code
+ * public class Cat extends Sprite {
+ *   public Cat() {
+ *     this.addCostume("cat", "assets/cat.png");
+ *   }
+ *
+ *   public void run() {
+ *     this.move(2);
+ *     this.ifOnEdgeBounce();
+ *   }
+ * }
+ * }
+ * + *

Positions are Scratch's: (0, 0) is the centre of the stage, x grows to the right and y + * upwards. Directions are Scratch's too: 0 points up, 90 to the right (the start direction), 180 + * down, 270 to the left. Everything a sprite does happens in ticks of 1/60 s of game time, so + * {@code move(5)} in {@code run()} moves 5 steps per tick on every computer. + */ +public class Sprite implements Cloneable { + + /** Direction pointing up (0 degrees). */ + public static final double DIRECTION_UP = 0; + /** Direction pointing right (90 degrees), where a new sprite points. */ + public static final double DIRECTION_RIGHT = 90; + /** Direction pointing down (180 degrees). */ + public static final double DIRECTION_DOWN = 180; + /** Direction pointing left (270 degrees). */ + public static final double DIRECTION_LEFT = 270; + + private Stage stage; + private List costumes = new ArrayList<>(); + private int currentCostume; + private double[] rotationCenter; + private double x, y; + private double direction = 90; + private double size = 100; + private RotationStyle rotationStyle = RotationStyle.ALL_AROUND; + private boolean visible = true; + private Layer layer = Layer.MAIN; + private double colorEffect; + private double transparency; + private Color tint; + private Shape hitbox; + // the last world hitbox and what it was made from (shapes cannot change, so it can be shared) + private Shape worldHitbox; + private Costume worldHitboxCostume; + private Shape worldHitboxLocal; + private double[] worldHitboxCentre; + private RotationStyle worldHitboxStyle; + private double[] worldHitboxKey; + private boolean hitboxDisabled; + private boolean isClone; + private Pen pen; + private SoundBank sounds = new SoundBank(); + private Timer timer = new Timer(); + private Text text; + private java.util.Map monitors = new java.util.LinkedHashMap<>(); + private Shaders shaders = new Shaders(); + // animations: name -> costume indices; playing one advances it every interval of game time + private java.util.Map animations = new java.util.HashMap<>(); + private String animation; + private int animationFrame; + private boolean animationDone; + private double animationInterval = 0.12; + private double animationLastStep; + // a size of its own instead of the costume's at `size` percent, optionally nine-sliced + private double width, height; + private int[] nineSlice; + // glide: from, to, and how far along in ticks + private double glideFromX, glideFromY, glideToX, glideToY; + private int glideTicks, glideTick = -1; + + private org.openpatch.scratch.internal.ExtensionHost.Attachments attachments = + new org.openpatch.scratch.internal.ExtensionHost.Attachments(); + + /** + * An extension's state for this sprite, made on first use; a clone gets its own. For + * extensions, not for learner code. + * + * @param type the state's class + * @param factory makes it + * @param the state + * @return the sprite's one instance + */ + public T extension(Class type, java.util.function.Supplier factory) { + return this.attachments.get(type, factory); + } + + /** A sprite without costumes. Add some with {@link #addCostume(String, String)}. */ + public Sprite() { + this.pen = new Pen(this); + this.text = new Text(this); + } + + /** + * A sprite with one costume. + * + * @param name the costume's name + * @param imagePath the image file + */ + public Sprite(String name, String imagePath) { + this(); + this.addCostume(name, imagePath); + } + + // ---- stage ----------------------------------------------------------------- + + /** + * Called when the sprite was added to a stage. Override it to react. + * + * @example.files SpriteWhenAddedToStage.java + */ + public void whenAddedToStage() {} + + /** + * Called when the sprite was removed from its stage. Override it to react. + * + * @example.files SpriteWhenRemovedFromStage.java + */ + public void whenRemovedFromStage() {} + + /** + * @return the stage the sprite is on, or null + * + * @example.files SpriteGetStage.java + */ + public Stage getStage() { + return this.stage; + } + + void setStage(Stage stage) { + this.stage = stage; + } + + /** + * Removes the sprite from its stage. + * + * @example.files SpriteRemove.java + */ + public void remove() { + if (this.stage != null) { + this.stage.remove(this); + } + } + + /** + * Prints values for debugging, but only while debug mode is on ({@code window.setDebug(true)} + * or F12). + * + * @param values what to print + * + * @example.files SpriteDebug.java + */ + public void debug(Object... values) { + Game game = Game.currentOrNull(); + if (game != null && game.isDebug()) { + StringBuilder line = new StringBuilder(this.getClass().getSimpleName()).append(':'); + for (Object v : values) { + line.append(' ').append(v); + } + System.out.println(line); + } + } + + /** + * Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is + * read every frame. + * + *

{@code
+   * this.showVariable("score", () -> this.score);
+   * }
+ * + * @param name the label + * @param value gives the value to show + * + * @scratchblock show variable [name v] + * @example.files SpriteShowVariable.java + */ + public void showVariable(String name, java.util.function.Supplier value) { + this.monitors.put(name, new Monitor(monitorOwner() + ": " + name, value)); + } + + /** + * @param name the label of a variable to hide again + * + * @scratchblock hide variable [name v] + * @example.files SpriteHideVariable.java + */ + public void hideVariable(String name) { + this.monitors.remove(name); + } + + private String monitorOwner() { + String owner = this.getClass().getSimpleName(); + return owner.isEmpty() ? "Sprite" : owner; + } + + java.util.Collection monitors() { + return this.monitors.values(); + } + + // ---- costumes -------------------------------------------------------------- + + /** + * Adds a costume from an image file. The first costume added is the one the sprite wears. + * + * @param name the costume's name, for {@link #switchCostume(String)} + * @param imagePath the image file (PNG, JPEG, GIF, BMP or TGA) + * + * @example.files SpriteAddCostume.java + */ + public void addCostume(String name, String imagePath) { + this.costumes.add(new Costume(name, Images.load(imagePath))); + } + + /** + * Adds a costume from an image file, named after the file. + * + * @param imagePath the image file + * + * @example.files SpriteAddCostume.java + */ + public void addCostume(String imagePath) { + String file = imagePath.substring(Math.max(imagePath.lastIndexOf('/'), imagePath.lastIndexOf('\\')) + 1); + int dot = file.lastIndexOf('.'); + this.addCostume(dot > 0 ? file.substring(0, dot) : file, imagePath); + } + + /** + * Adds a costume cut out of a larger image, e.g. one frame of a sprite sheet. + * + * @param name the costume's name + * @param imagePath the image file + * @param x left edge of the part, in pixels + * @param y top edge of the part, in pixels + * @param width width of the part + * @param height height of the part + * + * @example.files SpriteAddCostume.java + */ + public void addCostume(String name, String imagePath, int x, int y, int width, int height) { + this.costumes.add(new Costume(name, Images.load(imagePath).region(x, y, width, height))); + } + + /** + * Adds every frame of a sprite sheet as a costume, row by row, named {@code name0}, + * {@code name1}, … + * + * @param name the start of the costumes' names + * @param imagePath the image file + * @param width width of one frame + * @param height height of one frame + * + * @example.files SpriteAddCostumes.java + */ + public void addCostumes(String name, String imagePath, int width, int height) { + var sheet = Images.load(imagePath); + int i = 0; + for (int y = 0; y + height <= sheet.getHeight(); y += height) { + for (int x = 0; x + width <= sheet.getWidth(); x += width) { + this.costumes.add(new Costume(name + i++, sheet.region(x, y, width, height))); + } + } + } + + /** + * Switches to the costume with that name; an unknown name changes nothing. + * + * @param name the costume's name + * + * @scratchblock switch costume to [name v] + * @example.files SpriteSwitchCostume.java + */ + public void switchCostume(String name) { + for (int i = 0; i < this.costumes.size(); i++) { + if (this.costumes.get(i).name().equals(name)) { + this.currentCostume = i; + return; + } + } + } + + /** + * Switches to a costume by number, counting from 0; numbers wrap around like Scratch's. + * + * @param index the costume's number + * + * @scratchblock switch costume to [name v] + * @example.files SpriteSwitchCostume.java + */ + public void switchCostume(double index) { + if (!this.costumes.isEmpty()) { + this.currentCostume = Math.floorMod((int) Math.floor(index), this.costumes.size()); + } + } + + /** + * Switches to the next costume, after the last one to the first. + * + * @scratchblock next costume + * @example.files SpriteNextCostume.java + */ + public void nextCostume() { + this.switchCostume(this.currentCostume + 1); + } + + /** + * Switches to the previous costume, before the first one to the last. + * + * @scratchblock switch costume to (previous costume) + * @example.files SpritePreviousCostume.java + */ + public void previousCostume() { + this.switchCostume(this.currentCostume - 1); + } + + /** + * @return the current costume's name, or null without costumes + * + * @example.files SpriteGetCurrentCostumeName.java + * @scratchblock (costume [name v]) + */ + public String getCurrentCostumeName() { + return this.costumes.isEmpty() ? null : this.costumes.get(this.currentCostume).name(); + } + + /** + * @return the current costume's number, counting from 0 + * + * @example.files SpriteGetCurrentCostumeIndex.java + * @scratchblock (costume [number v]) + */ + public int getCurrentCostumeIndex() { + return this.currentCostume; + } + + Costume costume() { + return this.costumes.isEmpty() ? null : this.costumes.get(this.currentCostume); + } + + // ---- animations ------------------------------------------------------------------- + + /** + * Adds an animation from numbered image files: the pattern's {@code %d} counts from 1. + * + *
{@code
+   * this.addAnimation("walk", "assets/walk%d.png", 4); // walk1.png … walk4.png
+   * }
+ * + * @param name the animation's name + * @param pattern the file names, with {@code %d} for the frame number + * @param frames how many frames + * + * @example.folder AnimatedSpriteAddAnimation + */ + public void addAnimation(String name, String pattern, int frames) { + int[] numbers = new int[frames]; + for (int i = 0; i < frames; i++) { + numbers[i] = i + 1; + } + this.addNumberedAnimation(name, pattern, numbers); + } + + /** + * Adds an animation from numbered image files, from one number to another: for files that count + * from 0, or to use only some of them. If {@code to} is smaller than {@code from}, it counts down. + * + *
{@code
+   * this.addAnimation("hit", "assets/hit%d.png", 0, 4); // hit0.png … hit4.png
+   * }
+ * + * @param name the animation's name + * @param pattern the file names, with {@code %d} for the frame number + * @param from the number of the first frame + * @param to the number of the last frame + * + * @example.folder AnimatedSpriteAddAnimation + */ + public void addAnimation(String name, String pattern, int from, int to) { + int step = to >= from ? 1 : -1; + int[] numbers = new int[Math.abs(to - from) + 1]; + for (int i = 0; i < numbers.length; i++) { + numbers[i] = from + i * step; + } + this.addNumberedAnimation(name, pattern, numbers); + } + + private void addNumberedAnimation(String name, String pattern, int[] numbers) { + int[] indices = new int[numbers.length]; + for (int i = 0; i < numbers.length; i++) { + indices[i] = this.costumes.size(); + this.costumes.add(new Costume(name + "#" + i, Images.load(String.format(pattern, numbers[i])))); + } + this.animations.put(name, indices); + } + + /** + * Adds an animation from a sprite sheet: frames of equal size, numbered row by row from the + * top left, starting at 0. + * + *
{@code
+   * this.addAnimation("walk", "assets/walk.png", 32, 32, 0, 1, 2, 3);   // the first row
+   * this.addAnimation("down", "assets/hero.png", 32, 32, 0, 4, 8, 12);  // the first column of 4
+   * }
+ * + * @param name the animation's name + * @param sheetPath the sprite sheet + * @param width the width of a frame + * @param height the height of a frame + * @param frames the frames to show, in order + * + * @example.folder AnimatedSpriteAddAnimation + */ + public void addAnimation(String name, String sheetPath, int width, int height, int... frames) { + var sheet = Images.load(sheetPath); + int columns = Math.max(1, sheet.getWidth() / width); + int[] indices = new int[frames.length]; + for (int i = 0; i < frames.length; i++) { + int column = frames[i] % columns, row = frames[i] / columns; + indices[i] = this.costumes.size(); + this.costumes.add(new Costume(name + "#" + i, sheet.region(column * width, row * height, width, height))); + } + this.animations.put(name, indices); + } + + /** + * Plays an animation, over and over. Call it every tick (in {@code run()}): it shows the next + * frame each time the animation interval has passed, and starts from the first frame when + * another animation was playing before. + * + * @param name the animation's name + * + * @example.folder AnimatedSpritePlayAnimation + */ + public void playAnimation(String name) { + this.playAnimation(name, false); + } + + /** + * Plays an animation; call it every tick. + * + * @param name the animation's name + * @param once whether to stop at the last frame instead of starting over + * + * @example.folder AnimatedSpritePlayAnimation + */ + public void playAnimation(String name, boolean once) { + int[] frames = this.animations.get(name); + if (frames == null || frames.length == 0) { + return; + } + double now = Game.currentOrNull() == null ? 0 : Game.current().getTime(); + if (!name.equals(this.animation)) { + this.animation = name; + this.animationFrame = 0; + this.animationDone = false; + this.animationLastStep = now; + } else if (now - this.animationLastStep >= this.animationInterval - 1e-9 && !this.animationDone) { + this.animationLastStep = now; + if (this.animationFrame + 1 < frames.length) { + this.animationFrame++; + } else if (once) { + this.animationDone = true; + } else { + this.animationFrame = 0; + } + } + this.currentCostume = frames[this.animationFrame]; + } + + /** + * @param frame the frame of the current animation to show next, counting from 0 + * + * @example.folder AnimatedSpriteSetAnimationFrame + */ + public void setAnimationFrame(int frame) { + int[] frames = this.animation == null ? null : this.animations.get(this.animation); + this.animationFrame = frames == null ? Math.max(0, frame) : Math.floorMod(frame, frames.length); + if (frames != null) { + this.currentCostume = frames[this.animationFrame]; + } + } + + /** + * Starts the current animation from its first frame again. + * + * @example.folder AnimatedSpriteResetAnimation + */ + public void resetAnimation() { + this.animationFrame = 0; + this.animationDone = false; + this.animation = null; + } + + /** + * @param seconds how long each frame shows + * + * @example.folder AnimatedSpriteSetAnimationInterval + */ + public void setAnimationInterval(double seconds) { + this.animationInterval = Math.max(0, seconds); + } + + /** + * @return how long each frame shows, in seconds + * + * @example.folder AnimatedSpriteGetAnimationInterval + */ + public double getAnimationInterval() { + return this.animationInterval; + } + + /** + * @return the frame of the current animation, counting from 0 + * + * @example.folder AnimatedSpriteGetAnimationFrame + */ + public int getAnimationFrame() { + return this.animationFrame; + } + + /** + * @return whether an animation played with {@code once} reached its last frame + * + * @example.folder AnimatedSpriteIsAnimationPlayed + */ + public boolean isAnimationPlayed() { + return this.animationDone; + } + + /** + * Sets the point of the costumes the sprite turns around and stands on, in costume pixels from + * the top left corner. Without it, that is the centre of each costume. + * + * @param x pixels from the left edge + * @param y pixels from the top edge + * + * @example.files SpriteSetRotationCenter.java + */ + public void setRotationCenter(double x, double y) { + this.rotationCenter = new double[] {x, y}; + } + + // ---- sound ---------------------------------------------------------------------- + + /** + * Adds a sound (WAV or OGG). + * + * @param name the sound's name, for {@link #playSound(String)} + * @param soundPath the sound file + * + * @example.files SpriteAddSound.java + */ + public void addSound(String name, String soundPath) { + this.sounds.add(name, soundPath); + } + + /** + * Adds a sound, named after its file. + * + * @param soundPath the sound file + * + * @example.files SpriteAddSound.java + */ + public void addSound(String soundPath) { + String file = soundPath.substring(Math.max(soundPath.lastIndexOf('/'), soundPath.lastIndexOf('\\')) + 1); + int dot = file.lastIndexOf('.'); + this.addSound(dot > 0 ? file.substring(0, dot) : file, soundPath); + } + + /** + * Starts a sound, like Scratch's "start sound"; a sound that is still playing is not started + * again. + * + * @param name the sound's name + * + * @scratchblock start sound [name v] + * @example.files SpritePlaySound.java + */ + public void playSound(String name) { + this.sounds.play(name); + } + + /** + * Starts another copy of a sound, which plays alongside the others: for shots, steps, coins. + * + * @param name the sound's name + * @param volume the copy's volume from 0 to 100 + * @return the copy, to stop it or change its volume + * + * @example.files SoundPlaybackExample.java + */ + public SoundPlayback playSoundCopy(String name, double volume) { + return new SoundPlayback(this.sounds.playCopy(name, volume)); + } + + /** + * @param name the sound to stop + * + * @example.files SpriteStopSound.java + */ + public void stopSound(String name) { + this.sounds.stop(name); + } + + /** + * Stops every sound this object started. + * + * @scratchblock stop all sounds + * @example.files SpriteStopAllSounds.java + */ + public void stopAllSounds() { + this.sounds.stopAll(); + } + + /** + * @param name a sound's name + * @return whether it is playing + * + * @example.files SpriteIsSoundPlaying.java + */ + public boolean isSoundPlaying(String name) { + return this.sounds.isPlaying(name); + } + + /** + * @param volume this object's volume from 0 to 100 + * + * @scratchblock set volume to (percent) % + * @example.files SpriteSetVolume.java + */ + public void setVolume(double volume) { + this.sounds.setVolume(volume); + } + + /** + * @param by how much to change the volume + * + * @scratchblock change volume by (step) + * @example.files SpriteChangeVolume.java + */ + public void changeVolume(double by) { + this.sounds.setVolume(this.sounds.getVolume() + by); + } + + /** + * @return this object's volume from 0 to 100 + * + * @scratchblock (volume) + * @example.files SpriteGetVolume.java + */ + public double getVolume() { + return this.sounds.getVolume(); + } + + // ---- looks ------------------------------------------------------------------- + + /** + * Shows the sprite. + * + * @scratchblock show + * @example.files SpriteShow.java + */ + public void show() { + this.visible = true; + } + + /** + * Hides the sprite: it is not drawn, cannot be touched and cannot be clicked. + * + * @scratchblock hide + * @example.files SpriteHide.java + */ + public void hide() { + this.visible = false; + } + + /** + * @return whether the sprite is shown + * + * @example.files SpriteIsVisible.java + */ + public boolean isVisible() { + return this.visible; + } + + /** + * @return the size in percent of the costume's own size + * + * @scratchblock (size) + * @example.files SpriteGetSize.java + */ + public double getSize() { + return this.size; + } + + /** + * @param percent the size in percent of the costume's own size + * + * @scratchblock set size to (percentage) % + * @example.files SpriteSetSize.java + */ + public void setSize(double percent) { + this.size = Math.max(0, percent); + } + + /** + * @param percent how much to change the size, in percentage points + * + * @scratchblock change size by (amount) + * @example.files SpriteChangeSize.java + */ + public void changeSize(double percent) { + this.setSize(this.size + percent); + } + + /** + * @return the width the sprite is drawn at, in stage pixels + * + * @example.files SpriteGetWidth.java + */ + public double getWidth() { + Costume c = this.costume(); + return this.width > 0 ? this.width : c == null ? 0 : c.image().getWidth() * this.size / 100; + } + + /** + * @return the height the sprite is drawn at, in stage pixels + * + * @example.files SpriteGetHeight.java + */ + public double getHeight() { + Costume c = this.costume(); + return this.height > 0 ? this.height : c == null ? 0 : c.image().getHeight() * this.size / 100; + } + + /** + * Draws the sprite this wide, whatever its costume's width and size: for buttons, panels and + * platforms. With {@link #setNineSlice(int, int, int, int)} the corners keep their size. + * + * @param width the width in stage pixels; 0 to follow the costume and size again + * + * @example.files UISpriteSetWidth.java + */ + public void setWidth(double width) { + this.width = Math.max(0, width); + } + + /** + * Draws the sprite this high; see {@link #setWidth(double)}. + * + * @param height the height in stage pixels; 0 to follow the costume and size again + * + * @example.files UISpriteSetHeight.java + */ + public void setHeight(double height) { + this.height = Math.max(0, height); + } + + /** + * @param by how much wider to draw the sprite + * + * @example.files UISpriteChangeWidth.java + */ + public void changeWidth(double by) { + this.setWidth(this.getWidth() + by); + } + + /** + * @param by how much higher to draw the sprite + * + * @example.files UISpriteChangeHeight.java + */ + public void changeHeight(double by) { + this.setHeight(this.getHeight() + by); + } + + /** + * Stretches only the middle of the costume when the sprite is drawn at its own width and + * height: the four corners keep their size (scaled with the sprite's size), the edges stretch + * along one side. + * + * @param top costume pixels at the top that keep their height + * @param right costume pixels at the right that keep their width + * @param bottom costume pixels at the bottom that keep their height + * @param left costume pixels at the left that keep their width + * + * @example.files UISpriteSetNineSlice.java + */ + public void setNineSlice(int top, int right, int bottom, int left) { + this.nineSlice = new int[] {left, top, right, bottom}; + } + + /** + * Stretches the whole costume again. + * + * @example.files UISpriteDisableNineSlice.java + */ + public void disableNineSlice() { + this.nineSlice = null; + } + + /** + * Scratch's colour effect: shifts every colour of the costume around the colour wheel. 0 is no + * change; 100 is halfway round; 200 is all the way round again. Like Scratch, it gives colours + * too grey or too dark to show a hue a little one, so white and black are tinted too. + * + * @param value the effect + * + * @example.files SpriteSetColorEffect.java + * @scratchblock set [color v] effect to (value) + */ + public void setColorEffect(double value) { + this.colorEffect = value; + } + + /** + * @param by how much to change the colour effect + * + * @example.files SpriteChangeColorEffect.java + * @scratchblock change [color v] effect by (by) + */ + public void changeColorEffect(double by) { + this.colorEffect += by; + } + + /** @return the colour effect */ + public double getColorEffect() { + return this.colorEffect; + } + + /** + * Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a + * Scratch block: Scratch's colour effect is {@link #setColorEffect(double)}. + * + * @param color the tint, or null for none + * + * @example.files SpriteSetTint.java + */ + public void setTint(Color color) { + this.tint = color; + } + + /** + * @param red red from 0 to 255 + * @param green green from 0 to 255 + * @param blue blue from 0 to 255 + * + * @example.files SpriteSetTint.java + */ + public void setTint(double red, double green, double blue) { + this.tint = new Color(red, green, blue); + } + + /** + * @return the tint, or null for none + * + * @example.files SpriteGetTint.java + */ + public Color getTint() { + return this.tint; + } + + /** + * Scratch's ghost effect. + * + * @param percent 0 opaque, 100 invisible + * + * @example.files SpriteSetTransparency.java + * @scratchblock set [ghost v] effect to (transparency) + */ + public void setTransparency(double percent) { + this.transparency = Math.max(0, Math.min(100, percent)); + } + + /** + * @param by how much to change the transparency + * + * @example.files SpriteChangeTransparency.java + * @scratchblock change [ghost v] effect by (step) + */ + public void changeTransparency(double by) { + this.setTransparency(this.transparency + by); + } + + /** + * @return the transparency in percent + * + * @example.files SpriteGetTransparency.java + */ + public double getTransparency() { + return this.transparency; + } + + Effects effects() { + return new Effects(this.colorEffect, this.transparency, this.tint == null ? 0xffffffff : this.tint.toARGB()); + } + + // ---- layers ------------------------------------------------------------------ + + /** + * Moves the sprite to another layer, in front of the sprites already there. A sprite in + * {@link Layer#UI} ignores the camera; its pen moves to the UI layer too. + * + * @param layer the layer + */ + public void setLayer(Layer layer) { + Layer old = this.layer; + this.layer = layer; + if (layer == Layer.UI && this.pen.getLayer() == Layer.BACKGROUND) { + this.pen.setLayer(Layer.UI); + } else if (old == Layer.UI && layer != Layer.UI && this.pen.getLayer() == Layer.UI) { + this.pen.setLayer(Layer.BACKGROUND); + } + if (this.stage != null && old != layer) { + this.stage.moveToLayer(this, old); + } + } + + /** @return the sprite's layer */ + public Layer getLayer() { + return this.layer; + } + + /** + * Moves the sprite in front of every other sprite of its layer. + * + * @example.files SpriteGoToFrontLayer.java + * @scratchblock go to [front v] layer + */ + public void goToFrontLayer() { + if (this.stage != null) { + this.stage.reorder(this, Integer.MAX_VALUE); + } + } + + /** + * Moves the sprite behind every other sprite of its layer. + * + * @example.files SpriteGoToBackLayer.java + * @scratchblock go to [back v] layer + */ + public void goToBackLayer() { + if (this.stage != null) { + this.stage.reorder(this, Integer.MIN_VALUE); + } + } + + /** + * @param number how many sprites of its layer to move in front of + * + * @example.files SpriteGoLayersForwards.java + * @scratchblock go [forward v] (number) layers + */ + public void goLayersForwards(int number) { + if (this.stage != null) { + this.stage.reorder(this, number); + } + } + + /** + * @param number how many sprites of its layer to move behind + * + * @example.files SpriteGoLayersBackwards.java + * @scratchblock go [backward v] (number) layers + */ + public void goLayersBackwards(int number) { + this.goLayersForwards(-number); + } + + // ---- motion ------------------------------------------------------------------- + + /** + * @return x of the sprite's position + * + * @example.files SpriteGetX.java + * @scratchblock (x position) + */ + public double getX() { + return this.x; + } + + /** + * @return y of the sprite's position + * + * @example.files SpriteGetY.java + * @scratchblock (y position) + */ + public double getY() { + return this.y; + } + + /** + * @return the sprite's position + * + * @example.files SpriteGetPosition.java + */ + public Vector2 getPosition() { + return new Vector2(this.x, this.y); + } + + /** + * Goes to a position; with the pen down, it draws a line there. + * + * @param x x of the new position + * @param y y of the new position + * + * @scratchblock go to x: (x) y: (y) + * @example.files SpriteSetPosition.java + */ + public void setPosition(double x, double y) { + this.x = x; + this.y = y; + this.pen.setPosition(x, y); + } + + /** + * @param position the new position + * + * @scratchblock go to x: (x) y: (y) + * @example.files SpriteSetPosition.java + */ + public void setPosition(Vector2 position) { + this.setPosition(position.getX(), position.getY()); + } + + /** + * @param x the new x + * + * @scratchblock set x to (x) + * @example.files SpriteSetX.java + */ + public void setX(double x) { + this.setPosition(x, this.y); + } + + /** + * @param y the new y + * + * @scratchblock set y to (y) + * @example.files SpriteSetY.java + */ + public void setY(double y) { + this.setPosition(this.x, y); + } + + /** + * @param dx how far to move along x + * + * @scratchblock change x by (x) + * @example.files SpriteChangeX.java + */ + public void changeX(double dx) { + this.setPosition(this.x + dx, this.y); + } + + /** + * @param dy how far to move along y + * + * @scratchblock change y by (y) + * @example.files SpriteChangeY.java + */ + public void changeY(double dy) { + this.setPosition(this.x, this.y + dy); + } + + /** + * @param dx how far to move along x + * @param dy how far to move along y + * + * @example.files SpriteChangePosition.java + */ + public void changePosition(double dx, double dy) { + this.setPosition(this.x + dx, this.y + dy); + } + + /** + * @param by how far to move + * + * @example.files SpriteChangePosition.java + */ + public void changePosition(Vector2 by) { + this.changePosition(by.getX(), by.getY()); + } + + /** + * Moves forward in the sprite's direction. + * + * @param steps how far, in stage pixels (negative moves backwards) + * + * @scratchblock move (steps) steps + * @example.files SpriteMove.java + */ + public void move(double steps) { + double[] d = heading(this.direction); + this.setPosition(this.x + steps * d[0], this.y + steps * d[1]); + } + + /** + * The unit step of a direction (0 up, 90 right), exact at the four main directions: moving + * right does not drift 6e-16 up (6.x printed 0.0 there, and so does Scratch). + */ + static double[] heading(double direction) { + double d = ((direction % 360) + 360) % 360; + if (d == 0) { + return new double[] {0, 1}; + } else if (d == 90) { + return new double[] {1, 0}; + } else if (d == 180) { + return new double[] {0, -1}; + } else if (d == 270) { + return new double[] {-1, 0}; + } + double radians = Math.toRadians(d); + return new double[] {Math.sin(radians), Math.cos(radians)}; + } + + /** + * @return the direction, from 0 (inclusive) to 360 (exclusive); 90 is right + * + * @example.files SpriteGetDirection.java + * @scratchblock (direction) + */ + public double getDirection() { + return this.direction; + } + + /** + * Points in a direction: 0 up, 90 right, 180 down, 270 left; other numbers go around. + * + * @param degrees the direction + * + * @scratchblock point in direction (degrees) + * @example.files SpriteSetDirection.java + */ + public void setDirection(double degrees) { + double d = degrees % 360; + this.direction = d < 0 ? d + 360 : d; + } + + /** + * @param degrees how far to turn clockwise + * + * @scratchblock turn right (degrees) degrees + * @example.files SpriteTurnRight.java + */ + public void turnRight(double degrees) { + this.setDirection(this.direction + degrees); + } + + /** + * @param degrees how far to turn anticlockwise + * + * @scratchblock turn left (degrees) degrees + * @example.files SpriteTurnLeft.java + */ + public void turnLeft(double degrees) { + this.setDirection(this.direction - degrees); + } + + /** + * Points towards a position. + * + * @param position where to point + */ + public void pointTowards(Vector2 position) { + double dx = position.getX() - this.x, dy = position.getY() - this.y; + if (dx != 0 || dy != 0) { + this.setDirection(new Vector2(dx, dy).direction()); + } + } + + /** @param sprite the sprite to point at */ + public void pointTowards(Sprite sprite) { + this.pointTowards(sprite.getPosition()); + } + + /** + * Points towards the mouse pointer. + * + * @example.files SpritePointTowardsMousePointer.java + * @scratchblock point towards [mouse-pointer v] + */ + public void pointTowardsMousePointer() { + this.pointTowards(this.getMouse()); + } + + /** + * @param style how the costume follows the direction + * + * @example.files SpriteSetRotationStyle.java + * @scratchblock set rotation style [left-right v] + */ + public void setRotationStyle(RotationStyle style) { + this.rotationStyle = style; + } + + /** @return how the costume follows the direction */ + public RotationStyle getRotationStyle() { + return this.rotationStyle; + } + + /** + * Goes to a random position on the stage. + * + * @scratchblock go to [random position v] + * @example.files SpriteGoToRandomPosition.java + */ + public void goToRandomPosition() { + Stage stage = this.stageOrThrow("goToRandomPosition"); + this.setPosition(Random.randomInt(-stage.getWidth() / 2, stage.getWidth() / 2), + Random.randomInt(-stage.getHeight() / 2, stage.getHeight() / 2)); + } + + /** + * Goes to the mouse pointer. + * + * @scratchblock go to [mouse-pointer v] + * @example.files SpriteGoToMousePointer.java + */ + public void goToMousePointer() { + this.setPosition(this.getMouse()); + } + + /** + * @param sprite the sprite whose position to go to + * + * @scratchblock go to [sprite v] + * @example.files SpriteGoToSprite.java + */ + public void goToSprite(Sprite sprite) { + this.setPosition(sprite.getPosition()); + } + + /** + * Glides to a position in a number of seconds of game time; the sprite keeps running its code + * meanwhile. A new glide replaces one that is still going. + * + * @param seconds how long the glide takes + * @param x x of the target + * @param y y of the target + * + * @scratchblock glide (seconds) secs to x: (x) y: (y) + * @example.files SpriteGlide.java + */ + public void glide(double seconds, double x, double y) { + this.glideFromX = this.x; + this.glideFromY = this.y; + this.glideToX = x; + this.glideToY = y; + this.glideTicks = Math.max(1, (int) Math.round(seconds * 60)); + this.glideTick = 0; + } + + /** + * @return whether a glide is still going + * + * @example.files SpriteIsGliding.java + */ + public boolean isGliding() { + return this.glideTick >= 0; + } + + /** One tick of the glide, before run(). */ + void advanceGlide() { + if (this.glideTick < 0) { + return; + } + this.glideTick++; + double t = Math.min(1, this.glideTick / (double) this.glideTicks); + this.setPosition(this.glideFromX + (this.glideToX - this.glideFromX) * t, + this.glideFromY + (this.glideToY - this.glideFromY) * t); + if (t >= 1) { + this.glideTick = -1; + } + } + + /** + * Turns around when touching an edge of the stage and moves back inside, as in Scratch. + * + * @example.files SpriteIfOnEdgeBounce.java + * @scratchblock if on edge, bounce + */ + public void ifOnEdgeBounce() { + Stage stage = this.stage; + if (stage == null) { + return; + } + Bounds b = this.getHitbox() == null ? null : this.getHitbox().getBounds(); + if (b == null) { + return; + } + double halfW = stage.getWidth() / 2.0, halfH = stage.getHeight() / 2.0; + double left = halfW + b.x(), right = halfW - (b.x() + b.width()); + double bottom = halfH + b.y(), top = halfH - (b.y() + b.height()); + double nearest = Math.min(Math.min(left, right), Math.min(top, bottom)); + if (nearest > 0) { + return; + } + double[] d = heading(this.direction); + double dx = d[0], dy = d[1]; + if (nearest == left) { + dx = Math.max(0.2, Math.abs(dx)); + } else if (nearest == right) { + dx = -Math.max(0.2, Math.abs(dx)); + } else if (nearest == top) { + dy = -Math.max(0.2, Math.abs(dy)); + } else { + dy = Math.max(0.2, Math.abs(dy)); + } + this.setDirection(new Vector2(dx, dy).direction()); + // back inside, as Scratch's keepInFence does + double moveX = 0, moveY = 0; + if (left < 0) { + moveX = -left; + } else if (right < 0) { + moveX = right; + } + if (bottom < 0) { + moveY = -bottom; + } else if (top < 0) { + moveY = top; + } + this.setPosition(this.x + moveX, this.y + moveY); + } + + // ---- where the costume is: one transform for drawing, hitboxes, stamps and sensing ---- + + /** Whether the left-right rotation style shows the costume mirrored. */ + boolean isMirrored() { + return this.rotationStyle == RotationStyle.LEFT_RIGHT && this.direction > 180; + } + + /** The costume's rotation centre in its pixels. */ + double[] origin(Costume c) { + return this.rotationCenter != null ? this.rotationCenter + : new double[] {c.image().getWidth() / 2.0, c.image().getHeight() / 2.0}; + } + + /** Stretch of the costume: its own width and height if set, else the size in percent. */ + double[] scale(Costume c) { + double s = this.size / 100; + double sx = this.width > 0 ? this.width / c.image().getWidth() : s; + double sy = this.height > 0 ? this.height / c.image().getHeight() : s; + return new double[] {sx, sy}; + } + + /** Clockwise turn of the costume in degrees: the direction minus 90 when it turns all around. */ + double drawnRotation() { + return this.rotationStyle == RotationStyle.ALL_AROUND ? this.direction - 90 : 0; + } + + /** + * (getHitbox caches the world hitbox on this method's inputs: keep them in step with it.) + * + * The affine map from costume pixels (origin top left, y down) to world coordinates (y up): + * {@code x' = a·u + c·v + e}, {@code y' = b·u + d·v + f} as {a, b, c, d, e, f}. + */ + double[] costumeToWorld(Costume c) { + double[] o = this.origin(c); + double[] scale = this.scale(c); + double sx = this.isMirrored() ? -scale[0] : scale[0], sy = scale[1]; + double r = Math.toRadians(this.drawnRotation()); + double cos = Math.cos(r), sin = Math.sin(r); + double a = sx * cos, b = -sx * sin, cc = -sy * sin, d = -sy * cos; + return new double[] {a, b, cc, d, this.x - a * o[0] - cc * o[1], this.y - b * o[0] - d * o[1]}; + } + + /** + * @return the sprite's shaders + * + * @example.files SpriteGetShaders.java + */ + public Shaders getShaders() { + return this.shaders; + } + + SpriteDraw toDraw() { + Costume c = this.costume(); + if (!this.visible || c == null) { + return null; + } + double[] o = this.origin(c); + double[] scale = this.scale(c); + boolean ownSize = this.width > 0 || this.height > 0; + return new SpriteDraw(c.image(), this.x, this.y, o[0], o[1], this.isMirrored() ? -scale[0] : scale[0], + scale[1], this.drawnRotation(), this.effects(), ownSize && this.nineSlice != null ? this.nineSlice.clone() : null, + this.size / 100, this.getWidth(), this.getHeight(), this.shaders.toDraw()); + } + + // ---- hitbox and sensing --------------------------------------------------------- + + /** + * Sets the hitbox: the shape that counts for touching, in costume pixels (origin at the + * costume's top left corner, y down). It turns, grows and mirrors with the sprite. + * + * @param shape the hitbox + * + * @example.files SpriteSetHitbox.java + */ + public void setHitbox(Shape shape) { + this.hitbox = shape; + } + + /** + * The rectangle around the painted pixels of the costume where the sprite is now, whatever + * hitbox it has: bubbles hang off it (a hitbox set to the feet would put them at the knees). + */ + Shape paintedOutline() { + Costume c = this.costume(); + if (c == null || !this.visible) { + return null; + } + double[] m = this.costumeToWorld(c); + return Shape.of(Geometry.transform(c.outline(), m[0], m[1], m[2], m[3], m[4], m[5])); + } + + /** + * Where the costume's painted pixels are in the world, or null: only there can the sprite show a + * colour. Without a hitbox of its own that is its (cached) hitbox. + */ + Bounds paintedBounds() { + Shape s = this.hitbox == null ? this.getHitbox() : this.paintedOutline(); + return s == null ? null : s.getBounds(); + } + + /** + * Touching ignores this sprite until {@link #enableHitbox()}. + * + * @example.files SpriteDisableHitbox.java + */ + public void disableHitbox() { + this.hitboxDisabled = true; + } + + /** + * Touching counts this sprite again. + * + * @example.files SpriteEnableHitbox.java + */ + public void enableHitbox() { + this.hitboxDisabled = false; + } + + /** + * The hitbox where the sprite is now, in stage coordinates: by default the rectangle around the + * costume's painted pixels; null for a sprite without costumes. + * + * @return the hitbox, or null + * + * @example.files SpriteGetHitbox.java + */ + public Shape getHitbox() { + Costume c = this.costume(); + if (this.hitbox == null && c == null) { + return null; + } + // touching checks ask for it once per pair: made again only when one of the inputs of + // costumeToWorld / framelessToWorld (or the costume, or the hitbox) changed + double[] k = this.worldHitboxKey; + if (this.worldHitbox != null && c == this.worldHitboxCostume && this.hitbox == this.worldHitboxLocal + && this.rotationCenter == this.worldHitboxCentre && this.rotationStyle == this.worldHitboxStyle + && this.x == k[0] && this.y == k[1] && this.direction == k[2] && this.size == k[3] + && this.width == k[4] && this.height == k[5]) { + return this.worldHitbox; + } + double[] m = c != null ? this.costumeToWorld(c) : this.framelessToWorld(); + double[] local = this.hitbox != null ? this.hitbox.getPoints() : c.outline(); + this.worldHitbox = Shape.of(Geometry.transform(local, m[0], m[1], m[2], m[3], m[4], m[5])); + this.worldHitboxCostume = c; + this.worldHitboxLocal = this.hitbox; + this.worldHitboxCentre = this.rotationCenter; + this.worldHitboxStyle = this.rotationStyle; + this.worldHitboxKey = new double[] {this.x, this.y, this.direction, this.size, this.width, this.height}; + return this.worldHitbox; + } + + /** + * Where a hitbox without a costume lands: the sprite's position is the frame's origin (a + * costume's top-left with its rotation centre there), y running down like a costume's pixels. + * Map sprites work this way: their area is their hitbox, and they are put where their object + * is. + */ + private double[] framelessToWorld() { + double s = this.size / 100; + double sx = this.isMirrored() ? -s : s; + double r = Math.toRadians(this.drawnRotation()); + double cos = Math.cos(r), sin = Math.sin(r); + return new double[] {sx * cos, -sx * sin, -s * sin, -s * cos, this.x, this.y}; + } + + /** The hitbox that counts for touching: none when hidden, disabled, or without a hitbox and costume. */ + Shape touchHitbox() { + return !this.visible || this.hitboxDisabled ? null : this.getHitbox(); + } + + /** + * @param sprite another sprite + * @return whether the two hitboxes overlap (touching edges do not count); a hidden sprite + * touches nothing, and the UI layer never touches the world + * + * @scratchblock <touching [sprite v]?> + * @example.files SpriteIsTouchingSprite.java + */ + public boolean isTouchingSprite(Sprite sprite) { + Shape mine = this.touchHitbox(); + return mine != null && this.touches(mine, sprite); + } + + /** Whether another sprite touches this one, whose hitbox is {@code mine}: asked once per check. */ + private boolean touches(Shape mine, Sprite sprite) { + if (sprite == this || sprite.stage != this.stage || (sprite.layer == Layer.UI) != (this.layer == Layer.UI)) { + return false; + } + Shape theirs = sprite.touchHitbox(); + return theirs != null && mine.intersects(theirs); + } + + /** + * @param type a class of sprites + * @return whether the sprite touches any sprite of that class (or a subclass) + * + * @scratchblock <touching [sprite v]?> + * @example.files SpriteIsTouchingSprite.java + */ + public boolean isTouchingSprite(Class type) { + return this.getTouchingSprite(type) != null; + } + + /** + * @param type a class of sprites + * @param the class + * @return a sprite of that class the sprite touches, or null + * + * @example.files SpriteGetTouchingSprite.java + */ + public T getTouchingSprite(Class type) { + Shape mine = this.stage == null ? null : this.touchHitbox(); + if (mine == null) { + return null; + } + for (Sprite s : this.stage.spritesInOrder()) { + if (type.isInstance(s) && this.touches(mine, s)) { + return type.cast(s); + } + } + return null; + } + + // nrw-standard-begin + /** + * @param type a class of sprites + * @param the class + * @return every sprite of that class the sprite touches + * + * @example.files SpriteGetTouchingSprites.java + */ + public List getTouchingSprites(Class type) { + List touching = new ArrayList<>(); + Shape mine = this.stage == null ? null : this.touchHitbox(); + if (mine != null) { + for (Sprite s : this.stage.spritesInOrder()) { + if (type.isInstance(s) && this.touches(mine, s)) { + touching.add(type.cast(s)); + } + } + } + return touching; + } + // nrw-standard-end + // nrw: /** + // nrw: * Every sprite of a class the sprite touches, in the {@code List} of the NRW Zentralabitur, + // nrw: * which has to be in your project next to your own classes. + // nrw: * + // nrw: * @param type a class of sprites + // nrw: * @param the class + // nrw: * @param your {@code List} type + // nrw: * @return a new list of the sprites touched + // nrw: */ + // nrw: public L getTouchingSprites(Class type) { + // nrw: List touching = new ArrayList<>(); + // nrw: Shape mine = this.stage == null ? null : this.touchHitbox(); + // nrw: if (mine != null) { + // nrw: for (Sprite s : this.stage.spritesInOrder()) { + // nrw: if (type.isInstance(s) && this.touches(mine, s)) { + // nrw: touching.add(type.cast(s)); + // nrw: } + // nrw: } + // nrw: } + // nrw: return org.openpatch.scratch.internal.NrwList.of(touching, type, this.getClass()); + // nrw: } + + /** + * The costume on the screen for the compositor, or null when not shown. + * + * @param withGhost false for the sensing sprite itself: its own ghost effect does not hide it + */ + Compositor.Picture picture(boolean withGhost) { + Costume c = this.costume(); + if (!this.visible || c == null || this.stage == null || this.layer == Layer.UI) { + return null; + } + Effects e = this.effects(); + if (!withGhost) { + e = new Effects(e.colorEffect(), 0, e.tint()); + } + int[] slice = this.width > 0 || this.height > 0 ? this.nineSlice : null; + if (slice == null) { + return new Compositor.Picture(c.image(), this.stage.toScreen(this.costumeToWorld(c)), e); + } + // the renderer's cuts (SpriteDraw.slices), in evenly stretched costume pixels + int iw = c.image().getWidth(), ih = c.image().getHeight(); + double[] scale = this.scale(c); + return new Compositor.Picture(c.image(), this.stage.toScreen(this.costumeToWorld(c)), e, + cuts(SpriteDraw.slices(iw, slice[0], slice[2], iw * scale[0], this.size / 100), scale[0], iw), + cuts(SpriteDraw.slices(ih, slice[1], slice[3], ih * scale[1], this.size / 100), scale[1], ih)); + } + + private static double[][] cuts(double[][] slices, double scale, int size) { + double[] from = slices[0].clone(), to = slices[1].clone(); + for (int i = 0; i < from.length; i++) { + from[i] /= scale; + to[i] *= size; + } + return new double[][] {from, to}; + } + + /** + * Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as + * the stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with + * their effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small + * tolerance. + * + * @param color the colour to look for + * @return whether the sprite touches it + * + * @example.files SpriteIsTouchingColor.java + * @scratchblock <touching color [#ff0000]?> + */ + public boolean isTouchingColor(Color color) { + Compositor.Picture self = this.picture(false); + return self != null && this.stage.compositor(this).touches(self, null, color.toARGB()); + } + + /** + * @param red red from 0 to 255 + * @param green green from 0 to 255 + * @param blue blue from 0 to 255 + * @return whether the sprite touches that colour + * + * @example.files SpriteIsTouchingColor.java + * @scratchblock <touching color [#ff0000]?> + */ + public boolean isTouchingColor(double red, double green, double blue) { + return this.isTouchingColor(new Color(red, green, blue)); + } + + /** + * Whether a colour of the sprite touches a colour on the stage, like Scratch's "color is + * touching color". + * + * @param mine a colour of the sprite + * @param color the colour to look for underneath + * @return whether they touch + * + * @example.files SpriteIsColorTouchingColor.java + * @scratchblock <color [#ff0000] is touching [#00ff00]?> + */ + public boolean isColorTouchingColor(Color mine, Color color) { + Compositor.Picture self = this.picture(false); + return self != null && this.stage.compositor(this).touches(self, mine.toARGB(), color.toARGB()); + } + + /** + * @return whether the mouse pointer is over the sprite's hitbox + * + * @scratchblock <touching [mouse-pointer v]?> + * @example.files SpriteIsTouchingMousePointer.java + */ + public boolean isTouchingMousePointer() { + Shape h = this.touchHitbox(); + Vector2 m = this.getMouse(); + return h != null && h.contains(m.getX(), m.getY()); + } + + /** + * @return whether the sprite's hitbox reaches an edge of the stage + * + * @example.files SpriteIsTouchingEdge.java + * @scratchblock <touching [edge v]?> + */ + public boolean isTouchingEdge() { + Shape h = this.touchHitbox(); + if (h == null || this.stage == null) { + return false; + } + Bounds b = h.getBounds(); + double halfW = this.stage.getWidth() / 2.0, halfH = this.stage.getHeight() / 2.0; + return b.x() <= -halfW || b.y() <= -halfH || b.x() + b.width() >= halfW || b.y() + b.height() >= halfH; + } + + /** + * @return the distance to the mouse pointer + * + * @example.files SpriteDistanceToMousePointer.java + * @scratchblock (distance to [mouse-pointer v]) + */ + public double distanceToMousePointer() { + return this.getMouse().distance(this.getPosition()); + } + + /** + * @param sprite another sprite + * @return the distance between the two positions + * + * @example.files SpriteDistanceToSprite.java + * @scratchblock (distance to [sprite v]) + */ + public double distanceToSprite(Sprite sprite) { + return sprite.getPosition().distance(this.getPosition()); + } + + /** + * @return this object's timer, counting game time since it was made or reset + * + * @scratchblock (timer) + * @example.files SpriteGetTimer.java + */ + public Timer getTimer() { + return this.timer; + } + + // ---- input ------------------------------------------------------------------- + + /** + * @return x of the mouse pointer, in the sprite's coordinates (world, or the stage for UI) + * + * @scratchblock (mouse x) + * @example.files SpriteGetMouseX.java + */ + public double getMouseX() { + return this.getMouse().getX(); + } + + /** + * @return y of the mouse pointer + * + * @scratchblock (mouse y) + * @example.files SpriteGetMouseY.java + */ + public double getMouseY() { + return this.getMouse().getY(); + } + + /** + * @return the mouse pointer's position, in world coordinates (or stage coordinates for UI) + * + * @example.files SpriteGetMouse.java + */ + public Vector2 getMouse() { + Game game = Game.currentOrNull(); + if (game == null) { + return new Vector2(0, 0); + } + double mx = game.getInput().getMouseX(), my = game.getInput().getMouseY(); + if (this.layer == Layer.UI || this.stage == null) { + return new Vector2(mx, my); + } + Camera camera = this.stage.getCamera(); + return new Vector2(camera.toWorldX(mx), camera.toWorldY(my)); + } + + /** + * @return whether a mouse button is held down + * + * @example.files SpriteIsMouseDown.java + * @scratchblock <mouse down?> + */ + public boolean isMouseDown() { + Game game = Game.currentOrNull(); + return game != null && game.getInput().isMouseDown(); + } + + /** + * @param key a key + * @return whether the key is held down + * + * @example.files SpriteIsKeyPressed.java + * @scratchblock <key [space v] pressed?> + */ + public boolean isKeyPressed(KeyCode key) { + Game game = Game.currentOrNull(); + return game != null && game.getInput().isKeyDown(key); + } + + /** + * Called when a key is pressed, once per press (holding a key down does not repeat it). + * + * @param key the key + * + * @example.files SpriteWhenKeyPressed.java + * @scratchblock when [space v] key pressed + */ + public void whenKeyPressed(KeyCode key) {} + + /** + * Called when a key is released. + * + * @param key the key + * + * @example.files SpriteWhenKeyReleased.java + */ + public void whenKeyReleased(KeyCode key) {} + + /** + * Called when the mouse moves. + * + * @param x x of the mouse pointer (world) + * @param y y of the mouse pointer (world) + * + * @example.files SpriteWhenMouseMoved.java + */ + public void whenMouseMoved(double x, double y) {} + + /** + * Called when a mouse button is pressed anywhere on the stage. + * + * @param button the button + * + * @example.files SpriteWhenMouseClicked.java + */ + public void whenMouseClicked(MouseCode button) {} + + /** + * Called when this sprite is clicked: a mouse button is pressed over its hitbox, and no sprite + * in front of it is under the pointer. + * + * @example.files SpriteWhenClicked.java + * @scratchblock when this sprite clicked + */ + public void whenClicked() {} + + // ---- events and broadcasts --------------------------------------------------------- + + /** + * Sends a message to the stage and every sprite on it; their {@link #whenIReceive(String)} + * runs at once, before this method returns. + * + * @param message the message + * + * @scratchblock broadcast [message v] + * @example.files SpriteBroadcast.java + */ + public void broadcast(String message) { + if (this.stage != null) { + this.stage.broadcast(message); + } + } + + /** + * Called when a message is broadcast. + * + * @param message the message + * + * @scratchblock when I receive [message v] + * @example.files SpriteWhenIReceive.java + */ + public void whenIReceive(String message) {} + + /** + * Called when the stage switches its backdrop. + * + * @param name the new backdrop's name + * + * @example.files SpriteWhenBackdropSwitches.java + * @scratchblock when backdrop switches to [name v] + */ + public void whenBackdropSwitches(String name) {} + + /** + * A random whole number between two numbers, both included. + * + * @param from the lowest + * @param to the highest + * @return the number + * + * @example.files SpritePickRandom.java + * @scratchblock (pick random (from) to (to)) + */ + public int pickRandom(int from, int to) { + return Random.randomInt(from, to); + } + + /** + * Runs every tick, 60 times a second of game time. Override it with the sprite's code. + * + * @example.files SpriteRun.java + */ + public void run() {} + + // ---- say and think ------------------------------------------------------------- + + /** + * @return the sprite's text, which say and think show in a bubble + * + * @example.files SpriteGetText.java + */ + public Text getText() { + return this.text; + } + + /** + * Shows a speech bubble until the sprite says something else; an empty text removes it. + * + * @param text what the sprite says + * + * @scratchblock say [text] + * @example.files SpriteSay.java + */ + public void say(String text) { + this.text.setStyle(TextStyle.SPEAK); + this.text.showText(text); + } + + /** + * Shows a speech bubble for a number of seconds of game time. + * + * @param text what the sprite says + * @param seconds how long + * + * @scratchblock say [text] for (seconds) seconds + */ + public void say(String text, double seconds) { + this.text.setStyle(TextStyle.SPEAK); + this.text.showText(text, seconds); + } + + /** + * Shows a thought bubble until the sprite thinks something else; an empty text removes it. + * + * @param text what the sprite thinks + * + * @scratchblock think [text] + * @example.files SpriteThink.java + */ + public void think(String text) { + this.text.setStyle(TextStyle.THINK); + this.text.showText(text); + } + + /** + * Shows a thought bubble for a number of seconds of game time. + * + * @param text what the sprite thinks + * @param seconds how long + * + * @scratchblock think [text] for (seconds) seconds + */ + public void think(String text, double seconds) { + this.text.setStyle(TextStyle.THINK); + this.text.showText(text, seconds); + } + + /** + * Asks a question: the sprite says it in a bubble, and a box to type the answer in appears at + * the bottom of the stage. Enter finishes it; see {@link Stage#ask(String)}. + * + * @param question the question + * + * @scratchblock ask [question] and wait + * @example.files SpriteAsk.java + */ + public void ask(String question) { + if (this.stage != null) { + this.say(question); + this.stage.askForSprite(this, question); + } + } + + /** + * @return whether a question is waiting for its answer + * + * @example.files SpriteIsAsking.java + */ + public boolean isAsking() { + return this.stage != null && this.stage.isAsking(); + } + + /** + * @return the answer to the last question + * + * @scratchblock (answer) + * @example.files SpriteGetAnswer.java + */ + public String getAnswer() { + return this.stage == null ? "" : this.stage.getAnswer(); + } + + // ---- clones ------------------------------------------------------------------- + + /** + * Makes a clone: a copy of this sprite with the same costumes, position, direction, effects and + * variables, added to the stage just behind this sprite, as in Scratch. Its + * {@link #whenStartsAsClone()} runs; + * its constructor does not. Numbers, texts and booleans in its variables are its own; lists and + * other objects are shared with this sprite until the clone gets its own in + * {@link #whenStartsAsClone()}. + * + *
{@code
+   * Bullet bullet = this.createClone();
+   * }
+ * + * @param the sprite's class (no cast needed) + * @return the clone + */ + @SuppressWarnings("unchecked") + public T createClone() { + Sprite copy; + try { + copy = (Sprite) super.clone(); + } catch (CloneNotSupportedException e) { + throw new IllegalStateException(e); + } + copy.costumes = new ArrayList<>(this.costumes); + copy.animations = new java.util.HashMap<>(this.animations); + copy.animation = null; + copy.pen = new Pen(this.pen, copy); + copy.text = new Text(copy); + copy.timer = new Timer(); + copy.sounds = this.sounds.copy(); + copy.shaders = new Shaders(this.shaders); + copy.monitors = new java.util.LinkedHashMap<>(); // a sprite's monitors are not its clones' + copy.isClone = true; + copy.attachments = new org.openpatch.scratch.internal.ExtensionHost.Attachments(); + copy.stage = null; + copy.glideTick = -1; + copy.copyStateFrom(this); + if (this.stage != null) { + this.stage.addClone(copy, this); + } + copy.whenStartsAsClone(); + return (T) copy; + } + + /** Hook for state that must not be shared with a clone; parts of the sprite added later use it. */ + void copyStateFrom(Sprite original) {} + + /** + * Not for sprites: use {@link #createClone()}. + * + * @return never + * @throws CloneNotSupportedException always + * + * @example.files AnimatedSpriteClone.java + */ + @Override + protected final Object clone() throws CloneNotSupportedException { + throw new CloneNotSupportedException("Use createClone() to clone a sprite."); + } + + /** + * Called in a new clone, right after it was made. + * + * @scratchblock when I start as a clone + * @example.files SpriteWhenStartsAsClone.java + */ + public void whenStartsAsClone() {} + + /** + * @return whether this sprite is a clone + * + * @example.files SpriteIsClone.java + */ + public boolean isClone() { + return this.isClone; + } + + /** + * Removes this sprite if it is a clone, stopping its sounds; does nothing for the original. + * + * @scratchblock delete this clone + * @example.files SpriteDeleteThisClone.java + */ + public void deleteThisClone() { + if (this.isClone) { + this.sounds.stopAll(); + this.remove(); + } + } + + // ---- pen and stamps ----------------------------------------------------------------- + + /** + * @return the sprite's pen, which follows it + * + * @example.files SpriteGetPen.java + */ + public Pen getPen() { + return this.pen; + } + + /** + * Stamps the costume onto the canvas of the sprite's pen layer (behind the sprites unless the + * pen was moved): a picture of the sprite as it looks now, effects included, that stays. + * + * @example.files SpriteStamp.java + * @scratchblock stamp + */ + public void stamp() { + this.stamp(this.pen.getLayer()); + } + + /** + * Stamps the costume onto the canvas of a layer. + * + * @param layer the layer + * + * @example.files SpriteStamp.java + * @scratchblock stamp + */ + public void stamp(Layer layer) { + Costume c = this.costume(); + if (c != null && this.stage != null) { + this.stage.stamp(layer, c.image(), this.costumeToWorld(c), this.effects(), this.layer == Layer.UI); + } + } + + // ---- helpers ------------------------------------------------------------------ + + private Stage stageOrThrow(String method) { + if (this.stage == null) { + throw new IllegalStateException(method + "() needs the sprite to be on a stage. Add it first."); + } + return this.stage; + } + + /** + * The sprite's centre of the costume on the stage, as Scratch's "x position"/"y position". + * + * @example.files AnimatedSpriteToString.java + */ + @Override + public String toString() { + return this.getClass().getSimpleName() + " at (" + this.x + ", " + this.y + ")"; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Stage.java b/core/src/main/java/org/openpatch/scratch/Stage.java new file mode 100644 index 00000000..e95b3625 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Stage.java @@ -0,0 +1,1584 @@ +package org.openpatch.scratch; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import org.openpatch.scratch.internal.Costume; +import org.openpatch.scratch.internal.DebugOption; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.Monitor; +import org.openpatch.scratch.internal.SoundBank; +import org.openpatch.scratch.internal.canvas.Canvas; +import org.openpatch.scratch.internal.compose.Compositor; +import org.openpatch.scratch.internal.draw.AskDraw; +import org.openpatch.scratch.internal.draw.CameraDraw; +import org.openpatch.scratch.internal.draw.DrawList; +import org.openpatch.scratch.internal.draw.Effects; +import org.openpatch.scratch.internal.draw.Item; +import org.openpatch.scratch.internal.draw.LayerDraw; +import org.openpatch.scratch.internal.draw.ShapeDraw; +import org.openpatch.scratch.internal.draw.SpriteDraw; +import org.openpatch.scratch.internal.draw.TextDraw; +import org.openpatch.scratch.internal.image.Image; +import org.openpatch.scratch.internal.image.Images; +import org.openpatch.scratch.internal.input.InputEvent; +import org.openpatch.scratch.internal.text.TextLayout; + +/** + * A stage: one screen of a program, with its backdrops, sprites, texts and pens, and code that + * runs every tick in {@link #run()}. The window shows one stage at a time + * ({@code window.setStage(new MyStage())}). + * + *
{@code
+ * public class MyStage extends Stage {
+ *   public MyStage() {
+ *     this.addBackdrop("forest", "assets/forest.png");
+ *     this.add(new Cat());
+ *   }
+ * }
+ * }
+ * + *

A stage needs the window to exist, since the window sets its size: create the window first. + */ +public class Stage { + + static { + Game.register(new SceneBridge()); + } + + private static final java.util.concurrent.atomic.AtomicInteger IDS = new java.util.concurrent.atomic.AtomicInteger(); + + private final int id = IDS.incrementAndGet(); + private final int width; + private final int height; + /** Sprites per layer (Layer.ordinal()), back to front. */ + private final List> sprites = new ArrayList<>(); + // spritesInOrder(), until the sprites change + private List inOrder; + private final List pens = new ArrayList<>(); + private final List texts = new ArrayList<>(); + private final java.util.Map monitors = new java.util.LinkedHashMap<>(); + private final SoundBank sounds = new SoundBank(); + private final Canvas[] canvases = new Canvas[Layer.values().length]; + private final List backdrops = new ArrayList<>(); + private final List stretched = new ArrayList<>(); + private String cursor; + private Effects backdropEffects = Effects.NONE; + private int cursorX, cursorY; + private int currentBackdrop; + private Color color = new Color(255, 255, 255); + private final Camera camera = new Camera(); + private Comparator sorting; + private final Timer timer = new Timer(); + private final Shaders shaders = new Shaders(); + // display: a band along the bottom of the stage, in the UI layer, above the ask box + private final Text displayBand = new Text("", 0, 0, 0, TextStyle.BOX); + // the ask box of the last draw list: where its check button is + private AskDraw askBox; + private String question; + private Sprite askingSprite; + private final StringBuilder typed = new StringBuilder(); + private String answer = ""; + + /** A stage the size of the window. */ + public Stage() { + Game game = Game.current(); + this.width = game.getWidth(); + this.height = game.getHeight(); + for (int i = 0; i < Layer.values().length; i++) { + this.sprites.add(new ArrayList<>()); + } + game.getExtensions().stageCreated(this); + this.displayBand.setLayer(Layer.UI); + this.displayBand.setAlign(TextAlign.LEFT); + this.displayBand.setBandWidth(this.width - 2 * AskDraw.MARGIN); + this.displayBand.hide(); + } + + /** + * @return the stage's width in stage pixels + * + * @example.files StageGetWidth.java + */ + public int getWidth() { + return this.width; + } + + /** + * @return the stage's height in stage pixels + * + * @example.files StageGetHeight.java + */ + public int getHeight() { + return this.height; + } + + /** + * @return the stage's shaders, applied to the picture of its world layers + * + * @example.files StageGetShaders.java + */ + public Shaders getShaders() { + return this.shaders; + } + + private final org.openpatch.scratch.internal.ExtensionHost.Attachments attachments = + new org.openpatch.scratch.internal.ExtensionHost.Attachments(); + + /** + * An extension's state for this stage, made on first use. For extensions, not for learner code. + * + * @param type the state's class + * @param factory makes it + * @param the state + * @return the stage's one instance + */ + public T extension(Class type, java.util.function.Supplier factory) { + return this.attachments.get(type, factory); + } + + /** + * @return the stage's camera + * + * @example.files StageGetCamera.java + */ + public Camera getCamera() { + return this.camera; + } + + /** + * Prints values for debugging, but only while debug mode is on. + * + * @param values what to print + * + * @example.files StageDebug.java + */ + public void debug(Object... values) { + Game game = Game.currentOrNull(); + if (game != null && game.isDebug()) { + StringBuilder line = new StringBuilder(this.getClass().getSimpleName()).append(':'); + for (Object v : values) { + line.append(' ').append(v); + } + System.out.println(line); + } + } + + /** + * Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is + * read every frame. + * + *

{@code
+   * this.showVariable("score", () -> this.score);
+   * }
+ * + * @param name the label + * @param value gives the value to show + * + * @scratchblock show variable [name v] + * @example.files StageShowVariable.java + */ + public void showVariable(String name, java.util.function.Supplier value) { + this.monitors.put(name, new Monitor(name, value)); + } + + /** + * @param name the label of a variable to hide again + * + * @scratchblock hide variable [name v] + * @example.files StageHideVariable.java + */ + public void hideVariable(String name) { + this.monitors.remove(name); + } + + // ---- sprites ------------------------------------------------------------------- + + /** + * Adds a sprite, in front of the sprites of its layer. A sprite can only be on one stage; it + * leaves the old one. + * + * @param sprite the sprite + * + * @example.files StageAdd.java + */ + public void add(Sprite sprite) { + if (sprite.getStage() == this) { + return; + } + if (sprite.getStage() != null) { + sprite.getStage().remove(sprite); + } + this.sprites.get(sprite.getLayer().ordinal()).add(sprite); + this.inOrder = null; + sprite.setStage(this); + sprite.getPen().jumpTo(sprite.getX(), sprite.getY()); + sprite.whenAddedToStage(); + } + + /** + * Adds a pen of its own. + * + * @param pen the pen + * + * @example.files StageAdd.java + */ + public void add(Pen pen) { + if (!this.pens.contains(pen)) { + this.pens.add(pen); + pen.setStage(this); + } + } + + /** + * Adds a text of its own. + * + * @param text the text + * + * @example.files StageAdd.java + */ + public void add(Text text) { + if (text.getStage() == this) { + return; + } + if (text.getStage() != null) { + text.getStage().remove(text); + } + this.texts.add(text); + text.setStage(this); + text.whenAddedToStage(); + } + + /** + * @param text a text of its own to remove + * + * @example.files StageRemove.java + */ + public void remove(Text text) { + if (this.texts.remove(text)) { + text.setStage(null); + text.whenRemovedFromStage(); + } + } + + /** + * Removes a sprite. + * + * @param sprite the sprite + * + * @example.files StageRemove.java + */ + public void remove(Sprite sprite) { + if (sprite.getStage() != this) { + return; + } + this.sprites.get(sprite.getLayer().ordinal()).remove(sprite); + this.inOrder = null; + sprite.setStage(null); + sprite.whenRemovedFromStage(); + } + + /** + * @param pen a pen of its own to remove + * + * @example.files StageRemove.java + */ + public void remove(Pen pen) { + if (this.pens.remove(pen)) { + pen.setStage(null); + } + } + + /** + * Removes every sprite of a class (subclasses included). + * + * @param type the class + * + * @example.files StageRemove.java + */ + public void remove(Class type) { + for (Sprite s : this.spritesInOrder()) { + if (type.isInstance(s)) { + this.remove(s); + } + } + } + + /** + * Removes every sprite, text and pen: an empty stage (backdrops and what was drawn stay). + * + * @example.files StageRemoveAll.java + */ + public void removeAll() { + for (Sprite s : this.spritesInOrder()) { + this.remove(s); + } + for (Text t : List.copyOf(this.texts)) { + this.remove(t); + } + for (Pen p : List.copyOf(this.pens)) { + this.remove(p); + } + } + + // nrw-standard-begin + /** + * @return every sprite on the stage, back to front, layer by layer + * + * @example.files StageGetAll.java + */ + public List getAll() { + return new ArrayList<>(this.spritesInOrder()); + } + // nrw-standard-end + // nrw: /** + // nrw: * Every sprite on the stage, back to front, layer by layer, in the {@code List} of the NRW + // nrw: * Zentralabitur, which has to be in your project next to your own classes. + // nrw: * + // nrw: * @param your {@code List} type + // nrw: * @return a new list of all sprites + // nrw: */ + // nrw: public L getAll() { + // nrw: return org.openpatch.scratch.internal.NrwList.of(this.spritesInOrder(), this.getClass()); + // nrw: } + + // nrw-standard-begin + + /** + * @param type a class of sprites + * @param the class + * @return every sprite of that class (subclasses included), back to front + * + * @example.files StageFind.java + */ + public List find(Class type) { + List found = new ArrayList<>(); + for (Sprite s : this.spritesInOrder()) { + if (type.isInstance(s)) { + found.add(type.cast(s)); + } + } + return found; + } + // nrw-standard-end + // nrw: /** + // nrw: * Every sprite of a class (subclasses included), back to front, in the {@code List} of the + // nrw: * NRW Zentralabitur, which has to be in your project next to your own classes. + // nrw: * + // nrw: * @param type a class of sprites + // nrw: * @param the class + // nrw: * @param your {@code List} type + // nrw: * @return a new list of the sprites of that class + // nrw: */ + // nrw: public L find(Class type) { + // nrw: List found = new ArrayList<>(); + // nrw: for (Sprite s : this.spritesInOrder()) { + // nrw: if (type.isInstance(s)) { + // nrw: found.add(type.cast(s)); + // nrw: } + // nrw: } + // nrw: return org.openpatch.scratch.internal.NrwList.of(found, type, this.getClass()); + // nrw: } + + /** + * @param type a class of sprites + * @param the class + * @return how many sprites of that class are on the stage + * + * @example.files StageCount.java + */ + public int count(Class type) { + int n = 0; + for (List layer : this.sprites) { + for (Sprite s : layer) { + if (type.isInstance(s)) { + n++; + } + } + } + return n; + } + + /** + * All sprites in drawing (and running) order, as they were when asked: callers go through it while + * sprites come and go. Made again only after the sprites changed. + */ + List spritesInOrder() { + if (this.inOrder == null) { + List all = new ArrayList<>(); + for (List layer : this.sprites) { + all.addAll(layer); + } + this.inOrder = List.copyOf(all); + } + return this.inOrder; + } + + void addClone(Sprite clone, Sprite original) { + List layer = this.sprites.get(clone.getLayer().ordinal()); + // behind the original, as in Scratch + int index = layer.indexOf(original); + layer.add(Math.max(index, 0), clone); + this.inOrder = null; + clone.setStage(this); + clone.whenAddedToStage(); + } + + void moveToLayer(Sprite sprite, Layer from) { + this.sprites.get(from.ordinal()).remove(sprite); + this.sprites.get(sprite.getLayer().ordinal()).add(sprite); + this.inOrder = null; + } + + /** Moves a text among the stage's texts: by {@code steps} forwards (negative: backwards). */ + void reorder(Text text, int steps) { + int from = this.texts.indexOf(text); + if (from < 0) { + return; + } + this.texts.remove(from); + long to = (long) from + steps; + this.texts.add((int) Math.max(0, Math.min(this.texts.size(), to)), text); + } + + /** Moves a sprite within its layer: by {@code steps} forwards (negative: backwards). */ + void reorder(Sprite sprite, int steps) { + List layer = this.sprites.get(sprite.getLayer().ordinal()); + int from = layer.indexOf(sprite); + if (from < 0) { + return; + } + layer.remove(from); + long to = (long) from + steps; + layer.add((int) Math.max(0, Math.min(layer.size(), to)), sprite); + this.inOrder = null; + } + + /** + * Draws and runs the sprites of each layer sorted by their y position: lower sprites in front, + * as in a top-down game. Applies from the next tick on, until {@link #stopSorting()}. + */ + public void sortByY() { + this.sorting = Comparator.comparingDouble(Sprite::getY).reversed(); + } + + /** + * Draws and runs the sprites of each layer in the order a comparator gives, back to front. + * + * @param comparator the order + */ + public void sortBy(Comparator comparator) { + this.sorting = comparator; + } + + /** Keeps the order the sprites have now and stops sorting them. */ + public void stopSorting() { + this.sorting = null; + } + + // ---- backdrops and colour ---------------------------------------------------------- + + /** + * Adds a backdrop. The first one added is shown. + * + * @param name the backdrop's name + * @param imagePath the image file + * + * @example.files StageAddBackdrop.java + */ + public void addBackdrop(String name, String imagePath) { + this.addBackdrop(name, imagePath, false); + } + + /** + * Adds a backdrop, named after its file. + * + * @param imagePath the image file, or a built-in sprite's name + * + * @example.files StageAddBackdrop.java + */ + public void addBackdrop(String imagePath) { + String file = imagePath.substring(Math.max(imagePath.lastIndexOf('/'), imagePath.lastIndexOf('\\')) + 1); + int dot = file.lastIndexOf('.'); + this.addBackdrop(dot > 0 ? file.substring(0, dot) : file, imagePath); + } + + /** + * Adds a backdrop, optionally stretched to the stage's size. + * + * @param name the backdrop's name + * @param imagePath the image file, or a built-in sprite's name + * @param stretch whether to stretch it to the stage's size + * + * @example.files StageAddBackdrop.java + */ + public void addBackdrop(String name, String imagePath, boolean stretch) { + for (Costume c : this.backdrops) { + if (c.name().equals(name)) { + return; + } + } + this.backdrops.add(new Costume(name, Images.load(imagePath))); + this.stretched.add(stretch); + } + + /** The backdrop's costume → world map: centred on the origin, stretched if asked for. */ + private double[] backdropToWorld(int index) { + Image image = this.backdrops.get(index).image(); + double sx = this.stretched.get(index) ? (double) this.width / image.getWidth() : 1; + double sy = this.stretched.get(index) ? (double) this.height / image.getHeight() : 1; + return new double[] {sx, 0, 0, -sy, -image.getWidth() * sx / 2, image.getHeight() * sy / 2}; + } + + /** + * Shows an image instead of the mouse pointer while the mouse is over the stage. + * + * @param path an image file, or a built-in sprite's name + * + * @example.files StageSetCursor.java + */ + public void setCursor(String path) { + this.setCursor(path, 0, 0); + } + + /** + * Shows an image instead of the mouse pointer. + * + * @param path an image file, or a built-in sprite's name + * @param x pixels from the image's left edge to the point that clicks + * @param y pixels from the image's top edge to the point that clicks + * + * @example.files StageSetCursor.java + */ + public void setCursor(String path, int x, int y) { + Images.load(path); // fails now, not when the window draws + this.cursor = path; + this.cursorX = x; + this.cursorY = y; + } + + /** + * Switches to the backdrop with that name and tells the stage and every sprite + * ({@code whenBackdropSwitches}); an unknown name changes nothing. + * + * @param name the backdrop's name + * + * @scratchblock switch backdrop to [name v] + * @example.files StageSwitchBackdrop.java + */ + public void switchBackdrop(String name) { + for (int i = 0; i < this.backdrops.size(); i++) { + if (this.backdrops.get(i).name().equals(name)) { + this.showBackdrop(i); + return; + } + } + } + + /** + * Switches to the next backdrop, after the last to the first. + * + * @scratchblock next backdrop + * @example.files StageNextBackdrop.java + */ + public void nextBackdrop() { + if (!this.backdrops.isEmpty()) { + this.showBackdrop((this.currentBackdrop + 1) % this.backdrops.size()); + } + } + + /** + * Switches to the previous backdrop, before the first to the last. + * + * @scratchblock switch backdrop to [previous backdrop v] + * @example.files StagePreviousBackdrop.java + */ + public void previousBackdrop() { + if (!this.backdrops.isEmpty()) { + this.showBackdrop(Math.floorMod(this.currentBackdrop - 1, this.backdrops.size())); + } + } + + /** + * Switches to a random backdrop other than the current one (if there is another). + * + * @scratchblock switch backdrop to [random backdrop v] + * @example.files StageRandomBackdrop.java + */ + public void randomBackdrop() { + int n = this.backdrops.size(); + if (n > 1) { + int pick = Random.randomInt(0, n - 2); + this.showBackdrop(pick >= this.currentBackdrop ? pick + 1 : pick); + } + } + + private void showBackdrop(int index) { + this.currentBackdrop = index; + String name = this.backdrops.get(index).name(); + this.whenBackdropSwitches(name); + for (Sprite s : this.spritesInOrder()) { + s.whenBackdropSwitches(name); + } + } + + /** + * @return the current backdrop's name, or null without backdrops + * + * @example.files StageGetCurrentBackdropName.java + * @scratchblock (backdrop [name v]) + */ + public String getCurrentBackdropName() { + return this.backdrops.isEmpty() ? null : this.backdrops.get(this.currentBackdrop).name(); + } + + /** + * @return the current backdrop's number, counting from 0 + * + * @example.files StageGetCurrentBackdropIndex.java + * @scratchblock (backdrop [number v]) + */ + public int getCurrentBackdropIndex() { + return this.currentBackdrop; + } + + /** + * Called when the backdrop switches. + * + * @param name the new backdrop's name + * + * @example.files StageWhenBackdropSwitches.java + */ + public void whenBackdropSwitches(String name) {} + + /** + * Scratch's colour effect on the backdrop: shifts its colours around the colour wheel (200 is + * all the way round). Like Scratch, it gives colours too grey or too dark to show a hue a + * little one, so white and black are tinted too. + * + * @param value the effect + * + * @example.files StageSetColorEffect.java + * @scratchblock set [color v] effect to (value) + */ + public void setColorEffect(double value) { + this.backdropEffects = new Effects(value, this.backdropEffects.transparency(), this.backdropEffects.tint()); + } + + /** + * @param by how much to change the backdrop's colour effect + * + * @example.files StageChangeColorEffect.java + * @scratchblock change [color v] effect by (by) + */ + public void changeColorEffect(double by) { + this.setColorEffect(this.backdropEffects.colorEffect() + by); + } + + /** @return the backdrop's colour effect */ + public double getColorEffect() { + return this.backdropEffects.colorEffect(); + } + + /** + * Scratch's ghost effect on the backdrop: the stage colour shows through. + * + * @param percent 0 opaque, 100 invisible + * + * @example.files StageSetTransparency.java + * @scratchblock set [ghost v] effect to (transparency) + */ + public void setTransparency(double percent) { + this.backdropEffects = new Effects(this.backdropEffects.colorEffect(), Math.max(0, Math.min(100, percent)), + this.backdropEffects.tint()); + } + + /** + * @param by how much to change the backdrop's transparency + * + * @example.files StageChangeTransparency.java + * @scratchblock change [ghost v] effect by (step) + */ + public void changeTransparency(double by) { + this.setTransparency(this.backdropEffects.transparency() + by); + } + + /** @return the backdrop's transparency in percent */ + public double getTransparency() { + return this.backdropEffects.transparency(); + } + + /** + * Multiplies the backdrop by a colour. Not a Scratch block: Scratch's colour effect is + * {@link #setColorEffect(double)}. + * + * @param color the tint, or null for none + * + * @example.files StageSetTint.java + */ + public void setTint(Color color) { + this.backdropEffects = new Effects(this.backdropEffects.colorEffect(), this.backdropEffects.transparency(), + color == null ? 0xffffffff : color.toARGB()); + } + + /** + * @param color the colour behind the backdrop + * + * @example.files StageSetColor.java + */ + public void setColor(Color color) { + this.color = color; + } + + /** + * @param red red from 0 to 255 + * @param green green from 0 to 255 + * @param blue blue from 0 to 255 + * + * @example.files StageSetColor.java + */ + public void setColor(double red, double green, double blue) { + this.color = new Color(red, green, blue); + } + + /** + * @return the colour behind the backdrop + * + * @example.files StageGetColor.java + */ + public Color getColor() { + return this.color; + } + + // ---- sound ---------------------------------------------------------------------- + + /** + * Adds a sound (WAV or OGG). + * + * @param name the sound's name, for {@link #playSound(String)} + * @param soundPath the sound file + * + * @example.files StageAddSound.java + */ + public void addSound(String name, String soundPath) { + this.sounds.add(name, soundPath); + } + + /** + * Adds a sound, named after its file. + * + * @param soundPath the sound file + * + * @example.files StageAddSound.java + */ + public void addSound(String soundPath) { + String file = soundPath.substring(Math.max(soundPath.lastIndexOf('/'), soundPath.lastIndexOf('\\')) + 1); + int dot = file.lastIndexOf('.'); + this.addSound(dot > 0 ? file.substring(0, dot) : file, soundPath); + } + + /** + * Starts a sound, like Scratch's "start sound"; a sound that is still playing is not started + * again. + * + * @param name the sound's name + * + * @scratchblock start sound [name v] + * @example.files StagePlaySound.java + */ + public void playSound(String name) { + this.sounds.play(name); + } + + /** + * Starts another copy of a sound, which plays alongside the others: for shots, steps, coins. + * + * @param name the sound's name + * @param volume the copy's volume from 0 to 100 + * @return the copy, to stop it or change its volume + * + * @example.files SoundPlaybackExample.java + */ + public SoundPlayback playSoundCopy(String name, double volume) { + return new SoundPlayback(this.sounds.playCopy(name, volume)); + } + + /** + * @param name the sound to stop + * + * @example.files StageStopSound.java + */ + public void stopSound(String name) { + this.sounds.stop(name); + } + + /** + * Stops every sound this object started. + * + * @scratchblock stop all sounds + * @example.files StageStopAllSounds.java + */ + public void stopAllSounds() { + this.sounds.stopAll(); + } + + /** + * @param name a sound's name + * @return whether it is playing + * + * @example.files StageIsSoundPlaying.java + */ + public boolean isSoundPlaying(String name) { + return this.sounds.isPlaying(name); + } + + /** + * @param volume this object's volume from 0 to 100 + * + * @scratchblock set volume to (percent) % + * @example.files StageSetVolume.java + */ + public void setVolume(double volume) { + this.sounds.setVolume(volume); + } + + /** + * @param by how much to change the volume + * + * @scratchblock change volume by (step) + * @example.files StageChangeVolume.java + */ + public void changeVolume(double by) { + this.sounds.setVolume(this.sounds.getVolume() + by); + } + + /** + * @return this object's volume from 0 to 100 + * + * @scratchblock (volume) + * @example.files StageGetVolume.java + */ + public double getVolume() { + return this.sounds.getVolume(); + } + + // ---- canvases: pens and stamps ------------------------------------------------------ + + Canvas canvas(Layer layer) { + Canvas c = this.canvases[layer.ordinal()]; + if (c == null) { + c = new Canvas(this.width, this.height); + this.canvases[layer.ordinal()] = c; + } + return c; + } + + /** A pen line between two world points; the canvas is fixed on screen, so the camera applies now. */ + void penLine(Layer layer, double x0, double y0, double x1, double y1, double size, int argb) { + double zoom = layer == Layer.UI ? 1 : this.camera.getZoom() / 100; + if (layer == Layer.UI) { + this.canvas(layer).line(x0, y0, x1, y1, size, argb); + } else { + this.canvas(layer).line(this.camera.toScreenX(x0), this.camera.toScreenY(y0), this.camera.toScreenX(x1), + this.camera.toScreenY(y1), size * zoom, argb); + } + } + + void stamp(Layer layer, Image costume, double[] costumeToWorld, Effects effects, boolean ui) { + double[] m = costumeToWorld; + if (!ui && layer != Layer.UI) { + // world → screen: scale by zoom around the camera position + double z = this.camera.getZoom() / 100, cx = this.camera.getX(), cy = this.camera.getY(); + m = new double[] {m[0] * z, m[1] * z, m[2] * z, m[3] * z, (m[4] - cx) * z, (m[5] - cy) * z}; + } + this.canvas(layer).stamp(costume, m, effects); + } + + void eraseLayer(Layer layer) { + Canvas c = this.canvases[layer.ordinal()]; + if (c != null) { + c.eraseAll(); + } + } + + /** + * Erases everything every pen drew and everything stamped, on every layer. + * + * @scratchblock erase all + * @example.files StageEraseAll.java + */ + public void eraseAll() { + for (Layer layer : Layer.values()) { + this.eraseLayer(layer); + } + } + + // ---- colour sensing and pixels: one CPU compositor ------------------------------------ + + /** World → screen through the camera, applied to a costume → world map. */ + double[] toScreen(double[] m) { + double z = this.camera.getZoom() / 100, cx = this.camera.getX(), cy = this.camera.getY(); + return new double[] {m[0] * z, m[1] * z, m[2] * z, m[3] * z, (m[4] - cx) * z, (m[5] - cy) * z}; + } + + /** The world layers as they are now, back to front, without {@code left}. */ + Compositor compositor(Sprite left) { + // a sprite asking about colours sees only the sprites whose painted pixels can lie under it + // (the camera only moves and zooms: overlapping in the world is overlapping on the screen) + Bounds near = left == null ? null : left.paintedBounds(); + List parts = new ArrayList<>(); + if (!this.backdrops.isEmpty()) { + Image image = this.backdrops.get(this.currentBackdrop).image(); + parts.add(new Compositor.Picture(image, this.toScreen(this.backdropToWorld(this.currentBackdrop)), + this.backdropEffects)); + } + for (Layer layer : new Layer[] {Layer.BACKGROUND, Layer.MAIN, Layer.FOREGROUND}) { + Canvas canvas = this.canvases[layer.ordinal()]; + if (canvas != null) { + parts.add(new Compositor.CanvasPart(canvas)); + } + for (Sprite s : this.sprites.get(layer.ordinal())) { + if (s == left || (near != null && !overlaps(near, s.paintedBounds()))) { + continue; + } + Compositor.Picture picture = s.picture(true); + if (picture != null) { + parts.add(picture); + } + } + } + return new Compositor(this.width, this.height, this.color.toARGB(), parts); + } + + /** Whether two boxes overlap or lie within a pixel of each other (sampling rounds to pixels). */ + private static boolean overlaps(Bounds a, Bounds b) { + return b != null && b.x() <= a.x() + a.width() + 1 && a.x() <= b.x() + b.width() + 1 + && b.y() <= a.y() + a.height() + 1 && a.y() <= b.y() + b.height() + 1; + } + + // ---- events -------------------------------------------------------------------------- + + /** + * Sends a message to every sprite and then the stage; their {@code whenIReceive} runs at once. + * + * @param message the message + * + * @scratchblock broadcast [message v] + * @example.files StageBroadcast.java + */ + public void broadcast(String message) { + for (Sprite s : this.spritesInOrder()) { + s.whenIReceive(message); + } + this.whenIReceive(message); + } + + /** + * Called when a message is broadcast. + * + * @param message the message + * + * @scratchblock when I receive [message v] + * @example.files StageWhenIReceive.java + */ + public void whenIReceive(String message) {} + + /** + * Called when a key is pressed, once per press. + * + * @param key the key + * + * @example.files StageWhenKeyPressed.java + * @scratchblock when [space v] key pressed + */ + public void whenKeyPressed(KeyCode key) {} + + /** + * Called when a key is released. + * + * @param key the key + * + * @example.files StageWhenKeyReleased.java + */ + public void whenKeyReleased(KeyCode key) {} + + /** + * Called when a mouse button is pressed anywhere on the stage. + * + * @param button the button + * + * @scratchblock when stage clicked + * @example.files StageWhenMouseClicked.java + */ + public void whenMouseClicked(MouseCode button) {} + + /** + * Called when the mouse wheel turns. + * + * @param steps notches; positive is towards the user + * + * @example.files StageWhenMouseWheelMoved.java + */ + public void whenMouseWheelMoved(double steps) {} + + /** + * @param key a key + * @return whether the key is held down + * + * @example.files StageIsKeyPressed.java + * @scratchblock <key [space v] pressed?> + */ + public boolean isKeyPressed(KeyCode key) { + return Game.current().getInput().isKeyDown(key); + } + + /** + * @return whether a mouse button is held down + * + * @example.files StageIsMouseDown.java + * @scratchblock <mouse down?> + */ + public boolean isMouseDown() { + return Game.current().getInput().isMouseDown(); + } + + /** + * @return the mouse pointer in world coordinates + * + * @example.files StageGetMouse.java + */ + public Vector2 getMouse() { + var input = Game.current().getInput(); + return new Vector2(this.camera.toWorldX(input.getMouseX()), this.camera.toWorldY(input.getMouseY())); + } + + /** + * @return x of the mouse pointer in world coordinates + * + * @scratchblock (mouse x) + * @example.files StageGetMouseX.java + */ + public double getMouseX() { + return this.getMouse().getX(); + } + + /** + * @return y of the mouse pointer in world coordinates + * + * @scratchblock (mouse y) + * @example.files StageGetMouseY.java + */ + public double getMouseY() { + return this.getMouse().getY(); + } + + /** + * A random whole number between two numbers, both included. + * + * @param from the lowest + * @param to the highest + * @return the number + * + * @example.files StagePickRandom.java + * @scratchblock (pick random (from) to (to)) + */ + public int pickRandom(int from, int to) { + return Random.randomInt(from, to); + } + + /** + * @return this object's timer, counting game time since it was made or reset + * + * @scratchblock (timer) + * @example.files StageGetTimer.java + */ + public Timer getTimer() { + return this.timer; + } + + // ---- waiting ---------------------------------------------------------------------- + + /** + * Holds up the code that calls it for a number of seconds. Called in {@code main} (a program + * written straight down the page), the game keeps running meanwhile and the seconds are game + * time. Called in {@code run()} or an event, the whole game waits, as it does for any slow + * code; the window stays responsive. + * + * @param seconds how long + */ + public void waitSeconds(double seconds) { + Game game = Game.current(); + if (game.isGameThread() || game.isHeadless()) { + sleep(Math.round(seconds * 1000)); + return; + } + double until = game.getTime() + seconds; + while (game.getTime() < until - 1e-9 && game.getStopped() == null) { + sleep(1); + } + } + + /** + * Holds up the code that calls it until a condition is true; see {@link #waitSeconds(double)}. + * + * @param condition checked about every millisecond + * + * @scratchblock wait until <condition> + * @example.files StageWaitUntil.java + */ + public void waitUntil(java.util.function.BooleanSupplier condition) { + while (!condition.getAsBoolean()) { + sleep(1); + } + } + + private static void sleep(long millis) { + try { + Thread.sleep(Math.max(0, millis)); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + + // ---- display and ask ------------------------------------------------------------------ + + /** + * Shows a text in a band along the bottom of the stage until something else is displayed; an + * empty text removes the band. + * + * @param text what to show + * + * @example.files StageDisplay.java + */ + public void display(String text) { + this.displayBand.showText(text); + } + + /** + * Shows a text in a band along the bottom of the stage for a number of seconds of game time. + * + * @param text what to show + * @param seconds how long + * + * @example.files StageDisplay.java + */ + public void display(String text, double seconds) { + this.displayBand.showText(text, seconds); + } + + /** + * Asks a question in a box along the bottom of the stage, as Scratch does, with a field to type + * the answer in. Enter or the check button finishes it: then {@link #isAsking()} is false and {@link #getAnswer()} has the answer. + * While a question is open, keys go to the answer box, not to the stage and its sprites. + * + * @param question the question + * + * @scratchblock ask [question] and wait + * @example.files StageAsk.java + */ + public void ask(String question) { + this.askingSprite = null; + this.startAsking(question); + } + + void askForSprite(Sprite sprite, String question) { + this.askingSprite = sprite; + this.startAsking(question); + } + + private void startAsking(String question) { + this.question = question; + this.typed.setLength(0); + } + + /** + * @return whether a question is waiting for its answer + * + * @example.files StageIsAsking.java + */ + public boolean isAsking() { + return this.question != null; + } + + /** + * @return the answer to the last question, "" before the first + * + * @scratchblock (answer) + * @example.files StageGetAnswer.java + */ + public String getAnswer() { + return this.answer; + } + + /** Keys and characters while a question is open. */ + private void typeIntoAnswer(InputEvent event) { + if (event instanceof InputEvent.Typed t) { + this.typed.appendCodePoint(t.codepoint()); + } else if (event instanceof InputEvent.Repeat r) { + if (r.key() == KeyCode.BACKSPACE && this.typed.length() > 0) { + this.typed.setLength(this.typed.offsetByCodePoints(this.typed.length(), -1)); + } + } else if (event instanceof InputEvent.Key k && k.pressed()) { + if (k.key() == KeyCode.BACKSPACE && this.typed.length() > 0) { + this.typed.setLength(this.typed.offsetByCodePoints(this.typed.length(), -1)); + } else if (k.key() == KeyCode.ENTER) { + this.submitAnswer(); + } + } + } + + private void submitAnswer() { + this.answer = this.typed.toString(); + this.question = null; + this.typed.setLength(0); + if (this.askingSprite != null) { + this.askingSprite.say(""); // the question's bubble goes with the question + this.askingSprite = null; + } + } + + /** + * Runs every tick before the sprites' {@code run()}. Override it with the stage's code. + * + * @example.files StageRun.java + */ + public void run() {} + + // ---- the tick and the draw list (through SceneBridge) ------------------------------------ + + void tick() { + if (this.sorting != null) { + for (List layer : this.sprites) { + layer.sort(this.sorting); + } + this.inOrder = null; + } + List order = this.spritesInOrder(); + for (Sprite s : order) { + if (s.getStage() == this) { + s.advanceGlide(); + } + } + this.run(); + for (Sprite s : order) { + // a sprite removed earlier in this tick does not run any more + if (s.getStage() == this) { + s.run(); + } + } + // timed texts and bubbles count game time + for (Text t : List.copyOf(this.texts)) { + t.tick(); + } + for (Sprite s : this.spritesInOrder()) { + s.getText().tick(); + } + this.displayBand.tick(); + } + + void dispatch(InputEvent event) { + if (this.question != null && (event instanceof InputEvent.Key || event instanceof InputEvent.Typed + || event instanceof InputEvent.Repeat)) { + this.typeIntoAnswer(event); + return; + } + if (this.question != null && this.askBox != null && event instanceof InputEvent.Button b && b.pressed() + && this.askBox.onButton(b.x(), b.y())) { + this.submitAnswer(); // the check button, as in Scratch + return; + } + if (event instanceof InputEvent.Key k) { + if (k.pressed()) { + this.whenKeyPressed(k.key()); + for (Sprite s : this.spritesInOrder()) { + s.whenKeyPressed(k.key()); + } + } else { + this.whenKeyReleased(k.key()); + for (Sprite s : this.spritesInOrder()) { + s.whenKeyReleased(k.key()); + } + } + } else if (event instanceof InputEvent.Button b && b.pressed()) { + this.whenMouseClicked(b.button()); + List order = this.spritesInOrder(); + for (Sprite s : order) { + s.whenMouseClicked(b.button()); + } + // only the frontmost sprite under the pointer is clicked (decision log, Phase 2) + for (int i = order.size() - 1; i >= 0; i--) { + Sprite s = order.get(i); + if (s.getStage() == this && s.isTouchingMousePointer()) { + s.whenClicked(); + break; + } + } + } else if (event instanceof InputEvent.Move) { + Vector2 m = this.getMouse(); + for (Sprite s : this.spritesInOrder()) { + Vector2 at = s.getMouse(); + s.whenMouseMoved(at.getX(), at.getY()); + } + } else if (event instanceof InputEvent.Wheel w) { + this.whenMouseWheelMoved(w.steps()); + } + } + + DrawList draw(long tick) { + List layers = new ArrayList<>(); + Game current = Game.currentOrNull(); + boolean debug = current != null && current.isDebug(); + // which parts of debug mode are on; the panel switches them + Set debugOn = debug ? current.getDebugOptions() : Set.of(); + for (Layer layer : Layer.values()) { + // extensions' drawers first: after the layer's canvas, before its sprites + List items = new ArrayList<>(current == null ? List.of() : current.getExtensions().drawLayer(layer, this)); + for (Sprite s : this.sprites.get(layer.ordinal())) { + SpriteDraw d = s.toDraw(); + if (d != null) { + items.add(d); + } + } + if (debugOn.contains(DebugOption.HITBOXES)) { + // hitboxes in front of the layer's sprites: what touching uses + for (Sprite s : this.sprites.get(layer.ordinal())) { + Shape hitbox = s.touchHitbox(); + if (hitbox != null) { + items.add(new ShapeDraw(hitbox.getPoints(), 0, DEBUG_COLOR, 2)); + } + } + } + if (debugOn.contains(DebugOption.INVISIBLE)) { + // hidden sprites take part in nothing; their outline shows where they are + for (Sprite s : this.sprites.get(layer.ordinal())) { + if (!s.isVisible()) { + Shape hitbox = s.getHitbox(); + if (hitbox != null) { + items.add(new ShapeDraw(hitbox.getPoints(), 0, HIDDEN_DEBUG_COLOR, 1)); + } + } + } + } + Canvas canvas = this.canvases[layer.ordinal()]; + layers.add(new LayerDraw(layer.ordinal(), canvas != null, canvas == null ? List.of() : canvas.takeChanges(), + items, layer != Layer.UI)); + } + SpriteDraw backdrop = null; + if (!this.backdrops.isEmpty()) { + Image image = this.backdrops.get(this.currentBackdrop).image(); + double[] m = this.backdropToWorld(this.currentBackdrop); + backdrop = new SpriteDraw(image, 0, 0, image.getWidth() / 2.0, image.getHeight() / 2.0, m[0], -m[3], 0, + this.backdropEffects, null, 1, 0, 0, List.of()); + } + // texts of the world and bubbles go into the sharp overlay, UI texts in front of the UI layer + List overlay = new ArrayList<>(), ui = new ArrayList<>(); + for (Text t : this.texts) { + TextDraw d = t.toDraw(); + if (d != null) { + (t.getLayer() == Layer.UI ? ui : overlay).add(d); + } + } + for (Sprite s : this.spritesInOrder()) { + TextDraw d = s.getText().toDraw(); + if (d != null) { + (s.getLayer() == Layer.UI ? ui : overlay).add(d); + } + } + // at the bottom: the ask box, and the display band above it + double bottom = -this.height / 2.0 + AskDraw.MARGIN; + this.askBox = this.question == null ? null : this.askBox(bottom, tick); + if (this.askBox != null) { + bottom += this.askBox.height() + 4; + } + if (this.displayBand.isVisible()) { + this.displayBand.setPosition(-this.width / 2.0 + 8, bottom); + ui.add(this.displayBand.toDraw()); + } + if (debug) { + this.debugTexts(overlay, ui, layers.get(Layer.UI.ordinal()).items(), + layers.get(Layer.FOREGROUND.ordinal()).items(), debugOn); + } + // what extensions draw above everything, and the panel that switches the debug options; + // both stay out of captures, like the frame rate + List overlayItems = new ArrayList<>(current == null ? List.of() : current.getExtensions().drawOverlay(this)); + if (debug) { + overlayItems.addAll(current.getDebugPanel().items(current.getWidth(), current.getHeight(), debugOn)); + } + return new DrawList(this.id, tick, this.width, this.height, this.color.toARGB(), backdrop, + new CameraDraw(this.camera.getX(), this.camera.getY(), this.camera.getZoom()), layers, + List.copyOf(overlay), List.copyOf(ui), this.askBox, debugOn.contains(DebugOption.FPS), + this.shaders.toDraw(), + this.monitorDraws(), null, List.copyOf(overlayItems), + this.cursor == null ? null : new org.openpatch.scratch.internal.draw.CursorDraw(Images.load(this.cursor), + this.cursorX, this.cursorY)); + } + + /** + * Scratch's ask box standing on {@code bottom}: the question when the stage asks (a sprite's + * question is in its bubble), then the answer field, which shows the end of a long answer. + */ + private AskDraw askBox(double bottom, long tick) { + double width = this.width - 2 * AskDraw.MARGIN; + TextLayout question = this.askingSprite == null && !this.question.isEmpty() + ? this.displayBand.layoutOf(this.question, width - 2 * AskDraw.PADDING) : null; + double room = width - 2 * AskDraw.PADDING - AskDraw.INSET - AskDraw.BUTTON - 2 * AskDraw.BUTTON_INSET; + String shown = this.typed.toString(); + TextLayout answer = this.displayBand.layoutOf(shown, 0); + while (answer.width() > room && !shown.isEmpty()) { + shown = shown.substring(shown.offsetByCodePoints(0, 1)); + answer = this.displayBand.layoutOf(shown, 0); + } + double height = AskDraw.heightFor(question == null ? 0 : question.height()); + boolean caret = tick / 30 % 2 == 0; // blinks every half second + return new AskDraw(question, answer, -this.width / 2.0 + AskDraw.MARGIN, bottom + height, width, height, caret); + } + + /** The colour of everything debug mode draws, as in 6.x. */ + private static final int DEBUG_COLOR = 0xffff0000; + /** The outline of a hidden sprite in debug mode, which takes part in nothing. */ + private static final int HIDDEN_DEBUG_COLOR = 0xff00c8ff; + + /** + * What debug mode shows besides the hitboxes, switched by its options: each visible sprite's + * direction above it and its name and position on it, a line between the centres of every pair + * of touching sprites, a crosshair at the mouse with its world coordinates and the camera under + * the frame rate, and the number of clones. + */ + private void debugTexts(List overlay, List ui, List uiItems, List worldItems, + Set on) { + if (on.contains(DebugOption.LABELS)) { + for (Sprite s : this.spritesInOrder()) { + if (!s.isVisible()) { + continue; + } + List into = s.getLayer() == Layer.UI ? ui : overlay; + into.add(debugText("Direction: " + round2(s.getDirection()), s.getX(), s.getY() + s.getHeight() / 2 + 10, 1)); + into.add(debugText(spriteName(s) + " (" + round2(s.getX()) + ", " + round2(s.getY()) + ")", + s.getX(), s.getY(), 1)); + } + } + if (on.contains(DebugOption.TOUCHING)) { + // a line between the centres of every touching pair, on the front world layer + List sprites = this.spritesInOrder(); + for (int i = 0; i < sprites.size(); i++) { + Sprite a = sprites.get(i); + if (a.getLayer() == Layer.UI) { + continue; // drawn in the world's view, which the UI never follows + } + for (int j = i + 1; j < sprites.size(); j++) { + Sprite b = sprites.get(j); + if (a.isTouchingSprite(b)) { + worldItems.add(new ShapeDraw(new double[] {a.getX(), a.getY(), b.getX(), b.getY()}, 0, DEBUG_COLOR, 1)); + } + } + } + } + if (on.contains(DebugOption.MOUSE)) { + Game game = Game.currentOrNull(); + if (game != null) { + double mx = game.getInput().getMouseX(), my = game.getInput().getMouseY(); + double w = this.width / 2.0, h = this.height / 2.0; + uiItems.add(new ShapeDraw(new double[] {mx, -h, mx, h}, 0, DEBUG_COLOR, 1)); + uiItems.add(new ShapeDraw(new double[] {-w, my, w, my}, 0, DEBUG_COLOR, 1)); + ui.add(debugText("(" + round2(this.camera.toWorldX(mx)) + ", " + round2(this.camera.toWorldY(my)) + ")", + mx + 4, my + 8, 0)); + } + ui.add(debugText("Camera: (" + round2(this.camera.getX()) + ", " + round2(this.camera.getY()) + ") " + + round2(this.camera.getZoom()) + "%", this.width / 2.0 - 6, this.height / 2.0 - 24, 2)); + } + if (on.contains(DebugOption.CLONES)) { + int clones = 0; + for (Sprite s : this.spritesInOrder()) { + if (s.isClone()) { + clones++; + } + } + ui.add(debugText("Clones: " + clones, this.width / 2.0 - 6, this.height / 2.0 - 40, 2)); + } + } + + /** A sprite's name for the debug label: its class, and clones say so. */ + private static String spriteName(Sprite s) { + String name = s.getClass().getSimpleName(); + if (name.isEmpty()) { + name = "Sprite"; + } + return s.isClone() ? name + " (clone)" : name; + } + + /** A line of debug text centred vertically on y; {@code align} 0 starts, 1 centres, 2 ends at x. */ + private static TextDraw debugText(String text, double x, double y, int align) { + var layout = org.openpatch.scratch.internal.text.TextLayout.of(text, + org.openpatch.scratch.internal.text.Font.defaultFont(), 12, 0); + double left = align == 1 ? x - layout.width() / 2 : align == 2 ? x - layout.width() : x; + var font = layout.font(); + double top = y + (font.ascent(12) + font.descent(12)) / 2; + return new TextDraw(layout, left, top, layout.width(), layout.height(), 0, DEBUG_COLOR, TextDraw.Box.NONE, 0, 0, 0, + 0); + } + + private static double round2(double value) { + return Math.round(value * 100) / 100.0; + } + + /** Stage monitors first, then the sprites', stacked from the top left. */ + private List monitorDraws() { + List all = new ArrayList<>(this.monitors.values()); + for (Sprite s : this.spritesInOrder()) { + all.addAll(s.monitors()); + } + List out = new ArrayList<>(); + var font = org.openpatch.scratch.internal.text.Font.defaultFont(); + double y = this.height / 2.0 - 6; + for (Monitor m : all) { + out.add(m.toDraw(font, -this.width / 2.0 + 6, y)); + y -= org.openpatch.scratch.internal.draw.MonitorDraw.STEP; + } + return List.copyOf(out); + } + + /** The stage's side of {@link Game.Scene}: plumbing that stays out of the public API. */ + private static final class SceneBridge implements Game.Scene { + + @Override + public void tick(Stage stage) { + stage.tick(); + } + + @Override + public void dispatch(Stage stage, InputEvent event) { + stage.dispatch(event); + } + + @Override + public DrawList draw(Stage stage, long tick) { + return stage.draw(tick); + } + + @Override + public void shown(Stage stage, boolean shown) { + if (shown) { + // the renderer may have let go of this stage's canvas textures meanwhile + for (Canvas c : stage.canvases) { + if (c != null) { + c.resendAll(); + } + } + } + } + + @Override + public void exit(Stage stage) {} + + @Override + public List sprites(Stage stage) { + return stage.spritesInOrder(); + } + + @Override + public int id(Stage stage) { + return stage.id; + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Text.java b/core/src/main/java/org/openpatch/scratch/Text.java new file mode 100644 index 00000000..8a3e2cf9 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Text.java @@ -0,0 +1,716 @@ +package org.openpatch.scratch; + +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.draw.TextDraw; +import org.openpatch.scratch.internal.text.Font; +import org.openpatch.scratch.internal.text.TextLayout; + +/** + * A text on the stage: plain, in a box, or in a speech or thought bubble. Every sprite has one + * for {@code say} and {@code think}; texts of your own are added to a stage with + * {@code stage.add(text)}. + * + *
{@code
+ * Text score = new Text("Score: 0", -200, 160, 0);
+ * score.setLayer(Layer.UI);
+ * stage.add(score);
+ * }
+ * + *

Texts are laid out from the font file at their nominal size, in stage units, so where lines + * break and how large boxes and bubbles are never depends on the window. They are drawn at the + * window's resolution, in front of the foreground layer (or in the UI layer), and stay sharp. + */ +public class Text { + + /** A sprite's bubble wraps at this width. */ + private static final double BUBBLE_MAX_WIDTH = 330; + /** A bubble is at least this wide, so that a short word still looks like a bubble. */ + private static final double BUBBLE_MIN_WIDTH = 80; + private static final double PADDING = 8; + + private static volatile String defaultFont; + private static volatile int defaultFontGrid; + + private Stage stage; + private final Sprite sprite; + private String text = ""; + private double x, y; + private double width; + private TextStyle style = TextStyle.PLAIN; + private TextAlign align = TextAlign.CENTER; // every text is centred on its position, as in 6.x + private Color textColor = new Color(0, 0, 0); + private Color backgroundColor = new Color(255, 255, 255); + private Color strokeColor = new Color(201, 201, 201); + private String font; + private final java.util.LinkedHashMap fonts = new java.util.LinkedHashMap<>(); + private double size; + private Layer layer = Layer.MAIN; + private boolean shown = true; + private int ticksLeft = -1; + /** For the stage's display band and the ask box: the box spans this width, whatever it says. */ + private double bandWidth; + + /** An empty plain text at (0, 0). */ + public Text() { + this.sprite = null; + } + + /** A sprite's text for say and think. */ + Text(Sprite sprite) { + this.sprite = sprite; + this.shown = false; + } + + /** + * A plain text. + * + * @param text what it says + * @param x x of its position + * @param y y of its position (the first line's baseline) + * @param width where lines wrap; 0 for no wrapping + */ + public Text(String text, double x, double y, double width) { + this(text, x, y, width, TextStyle.PLAIN); + } + + /** + * A text in a style. + * + * @param text what it says + * @param x x of its position + * @param y y of its position: the first baseline for plain text, the bottom edge of a box + * @param width where lines wrap; 0 for no wrapping + * @param style plain, box, speech or thought bubble + */ + public Text(String text, double x, double y, double width, TextStyle style) { + this.sprite = null; + this.text = text; + this.x = x; + this.y = y; + this.width = width; + this.style = style; + } + + // ---- the default font ------------------------------------------------------------- + + /** + * The font every text uses unless it sets its own, from now on. Without it, texts use Ubuntu + * Mono, or Jersey 10 in pixel-art mode. + * + * @param path a TTF or OTF file + * + * @example.files TextUseFont.java + */ + public static void useFont(String path) { + defaultFont = path; + defaultFontGrid = 0; + } + + /** + * A pixel font as default font, with the size at which one of its pixels is one stage pixel: + * for a pixel font whose outlines do not show its grid (most do: then {@link #useFont(String)} + * is enough). In pixel-art mode sizes are rounded to whole pixels of it. + * + * @param path a TTF or OTF file + * @param pixelSize the size at which one font pixel is one stage pixel + * + * @example.files TextUseFont.java + */ + public static void useFont(String path, double pixelSize) { + Font font = Font.load(path); + defaultFont = path; + defaultFontGrid = (int) Math.max(1, Math.round(font.getUnitsPerEm() / pixelSize)); + } + + /** + * @return the default font file + * + * @example.files TextGetDefaultFont.java + */ + public static String getDefaultFont() { + String path = defaultFont; + return path != null ? path : pixelArt() ? Font.PIXEL_ART : Font.DEFAULT; + } + + /** + * @return the default font size + * + * @example.files TextGetDefaultFontSize.java + */ + public static double getDefaultFontSize() { + return pixelArt() ? Font.pixelArtFont().roundToPixelGrid(18) : 14; + } + + // ---- stage -------------------------------------------------------------------------- + + /** + * Called when the text was added to a stage. + * + * @example.files TextWhenAddedToStage.java + */ + public void whenAddedToStage() {} + + /** + * Called when the text was removed from its stage. + * + * @example.files TextWhenRemovedFromStage.java + */ + public void whenRemovedFromStage() {} + + /** + * @return the stage the text is on (a sprite's text: the sprite's stage), or null + * + * @example.files TextGetStage.java + */ + public Stage getStage() { + return this.sprite != null ? this.sprite.getStage() : this.stage; + } + + void setStage(Stage stage) { + this.stage = stage; + } + + /** + * Removes the text from its stage. + * + * @example.files TextRemove.java + */ + public void remove() { + if (this.stage != null) { + this.stage.remove(this); + } + } + + // ---- what it says --------------------------------------------------------------------- + + /** + * Shows the text with new words until it is changed or hidden. + * + * @param text what it says; an empty text hides a bubble + * + * @example.files TextShowText.java + */ + public void showText(String text) { + this.text = text == null ? "" : text; + this.shown = true; + this.ticksLeft = -1; + } + + /** + * Shows the text for a number of seconds of game time, then hides it. + * + * @param text what it says + * @param seconds how long + * + * @example.files TextShowText.java + */ + public void showText(String text, double seconds) { + this.showText(text); + this.ticksLeft = Math.max(1, (int) Math.round(seconds * 60)); + } + + /** @return what the text says */ + public String getText() { + return this.text; + } + + /** Shows the text. */ + public void show() { + this.shown = true; + } + + /** Hides the text. */ + public void hide() { + this.shown = false; + } + + /** @return whether the text is shown */ + public boolean isVisible() { + return this.shown && !this.text.isEmpty(); + } + + void setBandWidth(double width) { + this.bandWidth = width; + } + + /** One tick of the lifetime of a timed text. */ + void tick() { + if (this.ticksLeft > 0 && --this.ticksLeft == 0) { + this.shown = false; + this.ticksLeft = -1; + } + } + + // ---- place and look ---------------------------------------------------------------- + + /** + * @param x x of the position + * @param y y of the position + * + * @example.files TextSetPosition.java + */ + public void setPosition(double x, double y) { + this.x = x; + this.y = y; + } + + /** + * @param position the position + * + * @example.files TextSetPosition.java + */ + public void setPosition(Vector2 position) { + this.setPosition(position.getX(), position.getY()); + } + + /** + * @return the position + * + * @example.files TextGetPosition.java + */ + public Vector2 getPosition() { + return new Vector2(this.x, this.y); + } + + /** + * @param x x of the position + * + * @example.files TextSetX.java + */ + public void setX(double x) { + this.x = x; + } + + /** + * @return x of the position + * + * @example.files TextGetX.java + */ + public double getX() { + return this.x; + } + + /** + * @param y y of the position + * + * @example.files TextSetY.java + */ + public void setY(double y) { + this.y = y; + } + + /** + * @return y of the position + * + * @example.files TextGetY.java + */ + public double getY() { + return this.y; + } + + /** + * @param width where lines wrap, in stage units; 0 for no wrapping + * + * @example.files TextSetWidth.java + */ + public void setWidth(double width) { + this.width = Math.max(0, width); + } + + /** + * @return where lines wrap; 0 for no wrapping + * + * @example.files TextGetWidth.java + */ + public double getWidth() { + return this.width; + } + + /** + * @param style plain, box, speech or thought bubble + * + * @example.files TextSetStyle.java + */ + public void setStyle(TextStyle style) { + this.style = style; + } + + /** + * @return the style + * + * @example.files TextGetStyle.java + */ + public TextStyle getStyle() { + return this.style; + } + + /** + * @param align how lines sit relative to the position + * + * @example.files TextSetAlign.java + */ + public void setAlign(TextAlign align) { + this.align = align == null ? TextAlign.CENTER : align; + } + + /** + * @return the alignment + * + * @example.files TextGetAlign.java + */ + public TextAlign getAlign() { + return this.align; + } + + /** + * @param color the colour of the letters + * + * @example.files TextSetTextColor.java + */ + public void setTextColor(Color color) { + this.textColor = color; + } + + /** + * @param red red from 0 to 255 + * @param green green from 0 to 255 + * @param blue blue from 0 to 255 + * + * @example.files TextSetTextColor.java + */ + public void setTextColor(double red, double green, double blue) { + this.textColor = new Color(red, green, blue); + } + + /** + * @param color the fill of a box or bubble + * + * @example.files TextSetBackgroundColor.java + */ + public void setBackgroundColor(Color color) { + this.backgroundColor = color; + } + + /** + * @param red red from 0 to 255 + * @param green green from 0 to 255 + * @param blue blue from 0 to 255 + * + * @example.files TextSetBackgroundColor.java + */ + public void setBackgroundColor(double red, double green, double blue) { + this.backgroundColor = new Color(red, green, blue); + } + + /** + * @param color the outline of a box or bubble + * + * @example.files TextSetStrokeColor.java + */ + public void setStrokeColor(Color color) { + this.strokeColor = color; + } + + /** + * @param red red from 0 to 255 + * @param green green from 0 to 255 + * @param blue blue from 0 to 255 + * + * @example.files TextSetStrokeColor.java + */ + public void setStrokeColor(double red, double green, double blue) { + this.strokeColor = new Color(red, green, blue); + } + + /** + * Adds a font this text can switch to; the first one added is used. + * + * @param name the font's name + * @param path the TTF or OTF file + * + * @example.files TextAddFont.java + */ + public void addFont(String name, String path) { + if (this.fonts.isEmpty()) { + this.font = path; + } + this.fonts.putIfAbsent(name, path); + } + + /** + * @param name the name of a font added with {@link #addFont(String, String)} + * + * @example.files TextSwitchFont.java + */ + public void switchFont(String name) { + String path = this.fonts.get(name); + if (path != null) { + this.font = path; + } + } + + /** + * Switches to the next font added, after the last to the first. + * + * @example.files TextNextFont.java + */ + public void nextFont() { + if (this.fonts.isEmpty()) { + return; + } + java.util.List paths = new java.util.ArrayList<>(this.fonts.values()); + this.font = paths.get((paths.indexOf(this.font) + 1) % paths.size()); + } + + /** + * @return the name of the font in use, or null for the default font + * + * @example.files TextGetCurrentFontName.java + */ + public String getCurrentFontName() { + for (var e : this.fonts.entrySet()) { + if (e.getValue().equals(this.font)) { + return e.getKey(); + } + } + return null; + } + + /** + * @return the number of the font in use, counting from 0; -1 for the default font + * + * @example.files TextGetCurrentFontIndex.java + */ + public int getCurrentFontIndex() { + return new java.util.ArrayList<>(this.fonts.values()).indexOf(this.font); + } + + /** + * Draws this text in front of the other texts. + * + * @example.files TextGoToFrontLayer.java + * @scratchblock go to [front v] layer + */ + public void goToFrontLayer() { + Stage stage = this.getStage(); + if (stage != null && this.sprite == null) { + stage.reorder(this, Integer.MAX_VALUE); + } + } + + /** + * Draws this text behind the other texts. + * + * @example.files TextGoToBackLayer.java + * @scratchblock go to [back v] layer + */ + public void goToBackLayer() { + Stage stage = this.getStage(); + if (stage != null && this.sprite == null) { + stage.reorder(this, Integer.MIN_VALUE); + } + } + + /** + * @param number how many texts to move in front of + * + * @example.files TextGoLayersForwards.java + * @scratchblock go [forward v] (number) layers + */ + public void goLayersForwards(int number) { + Stage stage = this.getStage(); + if (stage != null && this.sprite == null) { + stage.reorder(this, number); + } + } + + /** + * @param number how many texts to move behind + * + * @example.files TextGoLayersBackwards.java + * @scratchblock go [backward v] (number) layers + */ + public void goLayersBackwards(int number) { + this.goLayersForwards(-number); + } + + /** + * @param path the font file for this text, or null for the default font + * + * @example.files TextSetFont.java + */ + public void setFont(String path) { + this.font = path; + } + + /** + * @return the font file, or null for the default font + * + * @example.files TextGetFont.java + */ + public String getFont() { + return this.font; + } + + /** + * @param size the font size in stage units (in pixel-art mode rounded to whole font pixels when + * drawn) + * + * @example.files TextSetTextSize.java + */ + public void setTextSize(double size) { + this.size = Math.max(1, size); + } + + /** + * @return the font size, or the default + * + * @example.files TextGetTextSize.java + */ + public double getTextSize() { + return this.size > 0 ? this.size : this.defaultSize(); + } + + /** + * Moves the text to another layer: {@link Layer#UI} keeps it in place when the camera moves; + * any other layer puts it into the world, in front of the foreground. + * + * @param layer the layer + */ + public void setLayer(Layer layer) { + this.layer = layer; + } + + /** @return the layer */ + public Layer getLayer() { + return this.layer; + } + + // ---- layout --------------------------------------------------------------------- + + private static boolean pixelArt() { + Game game = Game.currentOrNull(); + return game != null && game.isPixelArt(); + } + + private double defaultSize() { + return getDefaultFontSize(); + } + + Font resolveFont() { + if (this.font != null) { + return Font.load(this.font); + } + String path = defaultFont; + if (path != null) { + Font f = Font.load(path); + return defaultFontGrid > 0 ? f.withPixelGrid(defaultFontGrid) : f; + } + return pixelArt() ? Font.pixelArtFont() : Font.defaultFont(); + } + + /** The layout as it would be drawn now: font, size and wrapping resolved. */ + TextLayout layout() { + boolean bubble = this.style == TextStyle.SPEAK || this.style == TextStyle.THINK; + double wrap = bubble && (this.sprite != null || this.width <= 0) ? BUBBLE_MAX_WIDTH + : this.bandWidth > 0 ? this.bandWidth : this.width; + double inner = this.style == TextStyle.PLAIN ? wrap : wrap - 2 * PADDING; + return this.layoutOf(this.text, wrap > 0 ? Math.max(1, inner) : 0); + } + + /** Other words in this text's font and size (the ask box draws its own card around them). */ + TextLayout layoutOf(String words, double maxWidth) { + Font f = this.resolveFont(); + double s = this.getTextSize(); + if (pixelArt()) { + s = f.roundToPixelGrid(s); + } + return TextLayout.of(words, f, s, maxWidth); + } + + /** The draw-list entry, or null when nothing is shown. */ + TextDraw toDraw() { + if (!this.isVisible()) { + return null; + } + TextLayout layout = this.layout(); + double anchorX = this.x, anchorY = this.y; + if (this.sprite != null) { + // a sprite's bubble hangs off the top right corner of the painted pixels + Shape outline = this.sprite.paintedOutline(); + if (outline == null) { + anchorX = this.sprite.getX(); + anchorY = this.sprite.getY(); + } else { + Bounds b = outline.getBounds(); + anchorX = b.x() + b.width(); + anchorY = b.y() + b.height(); + } + } + int alignCode = switch (this.align) { + case LEFT -> 0; + case RIGHT -> 2; + default -> 1; // centred on its position, as 6.x had every text + }; + TextDraw.Box box = switch (this.style) { + case PLAIN -> TextDraw.Box.NONE; + case BOX -> TextDraw.Box.PLAIN; + case SPEAK -> TextDraw.Box.SPEECH; + case THINK -> TextDraw.Box.THOUGHT; + }; + double boxWidth, boxHeight, padding; + if (box == TextDraw.Box.NONE) { + padding = 0; + boxWidth = layout.width(); + boxHeight = layout.height(); + } else { + padding = PADDING; + boxWidth = layout.width() + 2 * PADDING; + if (box != TextDraw.Box.PLAIN) { + boxWidth = Math.max(BUBBLE_MIN_WIDTH, boxWidth); + } + boxHeight = layout.height() + 2 * PADDING; + if (this.bandWidth > 0) { + boxWidth = this.bandWidth; + } + } + // horizontally: the anchor is the left edge, the centre or the right edge of the box + double left = switch (alignCode) { + case 1 -> anchorX - boxWidth / 2; + case 2 -> anchorX - boxWidth; + default -> anchorX; + }; + // vertically: plain text's first line is centred on its position and further lines hang + // below (6.x, Processing's textAlign CENTER: a number put under a line sits on it); boxes + // stand on their bottom edge + double top = box == TextDraw.Box.NONE + ? anchorY + (layout.font().ascent(layout.size()) + layout.font().descent(layout.size())) / 2 + : anchorY + boxHeight; + double tailX = anchorX; + Stage stage = this.getStage(); + if (this.sprite != null) { + // a bubble grows to the right of the sprite, or to its left when there is no room, and + // stays below the stage's top edge, as in Scratch + Shape outline = this.sprite.paintedOutline(); + double camX = 0, camY = 0, zoom = 1; + if (stage != null && this.sprite.getLayer() != Layer.UI) { + camX = stage.getCamera().getX(); + camY = stage.getCamera().getY(); + zoom = stage.getCamera().getZoom() / 100; + } + double halfW = stage == null ? Double.MAX_VALUE : stage.getWidth() / 2.0 / zoom; + double halfH = stage == null ? Double.MAX_VALUE : stage.getHeight() / 2.0 / zoom; + left = anchorX; + if (left + boxWidth > camX + halfW && outline != null) { + double leftEdge = outline.getBounds().x(); + left = leftEdge - boxWidth; + tailX = leftEdge; // the tail starts at the sprite's left edge: drawn mirrored + } + // neither side has room: keep it on the stage anyway + left = Math.max(camX - halfW, Math.min(left, camX + halfW - boxWidth)); + top = Math.min(top, camY + halfH); + } + return new TextDraw(layout, left, top, boxWidth, boxHeight, alignCode, this.textColor.toARGB(), box, + this.backgroundColor.toARGB(), this.strokeColor.toARGB(), padding, tailX); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/TextAlign.java b/core/src/main/java/org/openpatch/scratch/TextAlign.java new file mode 100644 index 00000000..82e0ebc4 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/TextAlign.java @@ -0,0 +1,25 @@ +package org.openpatch.scratch; + +/** + * Where a piece of text sits relative to its position. + * + *

{@code
+ * myText.setAlign(TextAlign.LEFT);
+ * }
+ * + * @see Text#setAlign(TextAlign) + */ +public enum TextAlign { + + /** Whatever the text style already uses. */ + DEFAULT, + + /** Centred on its position. */ + CENTER, + + /** Its right edge at its position. */ + RIGHT, + + /** Its left edge at its position. */ + LEFT +} diff --git a/src/main/java/org/openpatch/scratch/TextStyle.java b/core/src/main/java/org/openpatch/scratch/TextStyle.java similarity index 100% rename from src/main/java/org/openpatch/scratch/TextStyle.java rename to core/src/main/java/org/openpatch/scratch/TextStyle.java diff --git a/core/src/main/java/org/openpatch/scratch/Timer.java b/core/src/main/java/org/openpatch/scratch/Timer.java new file mode 100644 index 00000000..8f30afb7 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Timer.java @@ -0,0 +1,133 @@ +package org.openpatch.scratch; + +import org.openpatch.scratch.internal.Game; + +/** + * A timer counting game time in seconds, like Scratch's timer: it stops while the game is paused + * and runs faster at a higher game speed, so it agrees with everything else that happens in + * ticks. Every stage and sprite has one ({@code getTimer()}); make more as fields with + * {@code new Timer()}. + * + *
{@code
+ * private Timer shooting = new Timer();
+ *
+ * public void run() {
+ *   if (this.isKeyPressed(KeyCode.SPACE) && this.shooting.every(0.25)) {
+ *     this.shoot();
+ *   }
+ * }
+ * }
+ */ +public class Timer { + + private double start; + private double everyStart = Double.NaN, duringStart = Double.NaN, afterStart = Double.NaN; + private double intervalStart = Double.NaN; + private boolean intervalOff; + + /** A timer starting now. */ + public Timer() { + this.start = now(); + } + + private static double now() { + Game game = Game.currentOrNull(); + return game == null ? 0 : game.getTime(); + } + + /** + * Starts the timer again from 0, and every method below with it. + * + * @example.files TimerReset.java + * @scratchblock reset timer + */ + public void reset() { + this.start = now(); + this.everyStart = this.duringStart = this.afterStart = this.intervalStart = Double.NaN; + this.intervalOff = false; + } + + /** @return the seconds of game time since the timer started or was reset */ + public double getSeconds() { + return now() - this.start; + } + + /** + * True once every number of seconds: the first time that many seconds after the first call, + * then again each time as many seconds have passed. + * + * @param seconds the period + * @return whether the period is over + */ + public boolean every(double seconds) { + double t = now(); + if (Double.isNaN(this.everyStart)) { + this.everyStart = t; + } + if (t >= this.everyStart + seconds - 1e-9) { + this.everyStart = t; + return true; + } + return false; + } + + /** + * True for a number of seconds from the first call on, false afterwards. + * + * @param seconds how long + * @return whether that time is still running + */ + public boolean during(double seconds) { + double t = now(); + if (Double.isNaN(this.duringStart)) { + this.duringStart = t; + } + return t < this.duringStart + seconds - 1e-9; + } + + /** + * False for a number of seconds from the first call on, true afterwards. + * + * @param seconds how long to wait + * @return whether that time is over + */ + public boolean after(double seconds) { + double t = now(); + if (Double.isNaN(this.afterStart)) { + this.afterStart = t; + } + return t >= this.afterStart + seconds - 1e-9; + } + + /** + * Alternates: true for a number of seconds, then false for as long, and so on. + * + * @param seconds how long each phase lasts + * @return whether it is in an "on" phase + */ + public boolean interval(double seconds) { + return this.interval(seconds, seconds); + } + + /** + * Alternates: true for {@code on} seconds, then false for {@code off} seconds, and so on. + * + * @param on how long it is true + * @param off how long it is false + * @return whether it is in an "on" phase + */ + public boolean interval(double on, double off) { + double t = now(); + if (Double.isNaN(this.intervalStart)) { + this.intervalStart = t; + } + while (true) { + double phase = this.intervalOff ? off : on; + if (t < this.intervalStart + phase - 1e-9 || phase <= 0 && on <= 0 && off <= 0) { + return !this.intervalOff; + } + this.intervalStart += phase; + this.intervalOff = !this.intervalOff; + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Transition.java b/core/src/main/java/org/openpatch/scratch/Transition.java new file mode 100644 index 00000000..2fec5aae --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Transition.java @@ -0,0 +1,73 @@ +package org.openpatch.scratch; + +import java.nio.charset.StandardCharsets; +import org.openpatch.scratch.internal.image.Images; + +/** + * How one stage gives way to the next in {@code window.transitionToStage(…)}. A transition is a + * small shader that mixes the old stage's picture ({@code from}) and the new one's ({@code to}) + * by {@code progress}, from 0 to 1; the built-in ones cover the usual cases, and + * {@link #fromShader(String)} makes one of your own: + * + *
{@code
+ * void main() {
+ *   color = mix(texture(from, uv), texture(to, uv), progress);
+ * }
+ * }
+ * + *

During a transition the old stage stands still, the new stage's {@code run()} starts once the + * transition is over, and input is ignored. + */ +public final class Transition { + + /** Fades the old stage to black, then the new one in. */ + public static final Transition FADE = new Transition("fade", null); + /** Blends the old stage into the new one. */ + public static final Transition CROSSFADE = new Transition("crossfade", null); + /** The new stage pushes the old one out to the left. */ + public static final Transition SLIDE_LEFT = new Transition("slide-left", null); + /** The new stage pushes the old one out to the right. */ + public static final Transition SLIDE_RIGHT = new Transition("slide-right", null); + /** The new stage pushes the old one out upwards. */ + public static final Transition SLIDE_UP = new Transition("slide-up", null); + /** The new stage pushes the old one out downwards. */ + public static final Transition SLIDE_DOWN = new Transition("slide-down", null); + + private final String name; + private final String source; + + private Transition(String name, String source) { + this.name = name; + this.source = source; + } + + /** + * A transition of your own: a shader body with {@code from}, {@code to} (the two pictures), + * {@code progress} (0 to 1), {@code uv} and {@code color}. + * + * @param path the file with the body + * @return the transition + */ + public static Transition fromShader(String path) { + byte[] bytes = Images.read(path); + if (bytes == null) { + throw new IllegalArgumentException("Transition shader not found: " + path); + } + return new Transition(path, new String(bytes, StandardCharsets.UTF_8)); + } + + /** @return the built-in name or the shader file */ + public String getName() { + return this.name; + } + + /** The shader body of a transition of one's own; null for the built-in ones. */ + String getSource() { + return this.source; + } + + @Override + public String toString() { + return this.name; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/Triangle.java b/core/src/main/java/org/openpatch/scratch/Triangle.java new file mode 100644 index 00000000..b9c745c6 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Triangle.java @@ -0,0 +1,17 @@ +package org.openpatch.scratch; + +/** A triangle. */ +public class Triangle extends Shape { + + /** + * @param x1 x of the first corner + * @param y1 y of the first corner + * @param x2 x of the second corner + * @param y2 y of the second corner + * @param x3 x of the third corner + * @param y3 y of the third corner + */ + public Triangle(double x1, double y1, double x2, double y2, double x3, double y3) { + this.setPoints(new double[] {x1, y1, x2, y2, x3, y3}); + } +} diff --git a/src/main/java/org/openpatch/scratch/Vector2.java b/core/src/main/java/org/openpatch/scratch/Vector2.java similarity index 92% rename from src/main/java/org/openpatch/scratch/Vector2.java rename to core/src/main/java/org/openpatch/scratch/Vector2.java index cd17c4a3..5e55b04c 100644 --- a/src/main/java/org/openpatch/scratch/Vector2.java +++ b/core/src/main/java/org/openpatch/scratch/Vector2.java @@ -122,6 +122,18 @@ public double angle() { return Math.atan2(y, x) * 180 / Math.PI; } + /** + * Returns the direction of the vector in Scratch's degrees: 0 points up, 90 to the right, 180 + * down and 270 to the left, the way {@code setDirection} on a sprite counts. {@link #angle()} + * counts the mathematical way instead (0 to the right, anticlockwise). + * + * @return the direction in degrees between 0 (inclusive) and 360 (exclusive) + */ + public double direction() { + double direction = (90 - this.angle()) % 360; + return direction < 0 ? direction + 360 : direction; + } + /** * Returns the unit vector. * diff --git a/core/src/main/java/org/openpatch/scratch/Window.java b/core/src/main/java/org/openpatch/scratch/Window.java new file mode 100644 index 00000000..c5cbf8fb --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/Window.java @@ -0,0 +1,405 @@ +package org.openpatch.scratch; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Supplier; +import org.openpatch.scratch.extension.Extension; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.Natives; +import org.openpatch.scratch.internal.window.WindowHost; + +/** + * The window of a program: there is one, created first, and it shows one stage at a time. + * + *

{@code
+ * public static void main(String[] args) {
+ *   Window window = new Window(480, 360);
+ *   window.setStage(new MyStage());
+ * }
+ * }
+ * + *

The constructor returns at once; the window runs on a thread of its own and the game ticks + * 60 times a second of game time. {@code main} may carry on, e.g. with + * {@code stage.waitSeconds(…)} between steps. + */ +public class Window { + + private static volatile Window instance; + private static boolean fullScreen; + private static boolean pixelArt; + private static boolean smoothPixelArt; + private static double frameSmoothing; + private static String splashLogo; + private static final List registered = new ArrayList<>(); + + private final Game game; + private final WindowHost host; + + /** A window of 480 × 360, Scratch's stage size. */ + public Window() { + this(480, 360, null); + } + + /** + * A window of 480 × 360 that loads every image, sound and font in a folder before the first + * frame, showing a loading screen. + * + * @param assets the folder, e.g. {@code "assets"} + */ + public Window(String assets) { + this(480, 360, assets); + } + + /** + * A window whose stage has this size in stage pixels. The window opens at that size (in pixel + * art at the largest whole multiple that fits the screen) and scales the stage to fit when it + * is resized. + * + * @param width the stage width + * @param height the stage height + */ + public Window(int width, int height) { + this(width, height, null); + } + + /** + * A window of a size that loads a folder of assets first. + * + * @param width the stage width + * @param height the stage height + * @param assets the folder, or null + */ + public Window(int width, int height, String assets) { + org.openpatch.scratch.internal.Release.start(); + Natives.init(); + synchronized (Window.class) { + if (instance != null) { + throw new IllegalStateException("There can only be one window. Use setStage to show another stage."); + } + instance = this; + } + this.game = Game.start(width, height); + this.game.setPixelArt(pixelArt); + this.game.getExtensions().install( + org.openpatch.scratch.internal.Extensions.discover(List.copyOf(registered), Extension.coreVersion())); + this.host = WindowHost.start(this.game, this, new WindowHost.Settings(this.getLibraryTitle(), fullScreen, + pixelArt, smoothPixelArt, frameSmoothing, splashLogo, assets, List.copyOf(registered))); + } + + /** + * @return the window, or null before it was created + * + * @example.files WindowGetInstance.java + */ + public static Window getInstance() { + return instance; + } + + // ---- settings before the window opens -------------------------------------------------- + + /** + * Opens the window full screen (a borderless window at the screen's size). Call it before {@code new Window}. + * + * @example.files WindowUseFullScreen.java + */ + public static void useFullScreen() { + fullScreen = true; + } + + /** + * Pixel-art mode: images are not smoothed, the stage scales by whole numbers only, the default + * font is Jersey 10 and font sizes are rounded to its pixels. Call it before {@code new Window}. + */ + public static void usePixelArt() { + pixelArt = true; + } + + /** @return whether pixel-art mode is on */ + public static boolean isPixelArt() { + return pixelArt; + } + + /** + * Smooth pixel art (Godot's "canvas items" way of showing pixel art): as {@link #usePixelArt()}, + * but the camera moves without snapping and zoom works at any factor. The world is drawn at the + * window's resolution with the sprites still sampled by nearest neighbour, so every pixel stays + * a sharp square while things move — the grid wobbles by a screen pixel instead of the picture + * stepping whole stage pixels (the look of Hyper Light Drifter, as Godot's guide puts it). With + * it, scrolling does not need {@link #useFrameSmoothing(double)}. Call it before + * {@code new Window}. + */ + public static void useSmoothPixelArt() { + pixelArt = true; + smoothPixelArt = true; + } + + /** @return whether the pixel art scrolls smoothly (see {@link #useSmoothPixelArt()}) */ + public static boolean isSmoothPixelArt() { + return smoothPixelArt; + } + + /** + * Frame smoothing: each frame is presented mixed with the one before it, this much in percent. + * A screen that holds each frame until the next (every 60 Hz LCD) smears whatever moves, + * because the eye gets one picture per 16.7 ms; two pictures per frame (50 is a good value) + * look like one picture per 8.3 ms and smear about half as much. The world keeps its pixels: + * the moment nothing moves, current and previous frame are the same and the picture is fully + * sharp. While things move, edges are softer — that is the trade. Call it before + * {@code new Window}; 0 (the default) turns it off. + * + * @param percent how much of the previous frame each presented one keeps, 0 to 100 + */ + public static void useFrameSmoothing(double percent) { + frameSmoothing = Math.max(0, Math.min(100, percent)); + } + + /** @return the frame smoothing in percent, 0 when off */ + public static double getFrameSmoothing() { + return frameSmoothing; + } + + /** + * The logo on the loading screen. Call it before {@code new Window}. + * + * @param path an image + * + * @example.files WindowUseSplashLogo.java + */ + public static void useSplashLogo(String path) { + splashLogo = path; + } + + /** + * Uses an extension that does not register itself through {@code META-INF/services} (one in + * your own project). Call it before {@code new Window}. + * + * @param extension the extension + */ + public static void use(Extension extension) { + registered.add(extension); + } + + // ---- the game ------------------------------------------------------------------------- + + /** + * Pauses the game: no ticks run; keys and the mouse still reach the stage and sprites. + * + * @example.files WindowPause.java + */ + public void pause() { + this.game.setPaused(true); + } + + /** + * Goes on after {@link #pause()}. + * + * @example.files WindowPause.java + */ + public void resume() { + this.game.setPaused(false); + } + + /** + * @return whether the game is paused + * + * @example.files WindowPause.java + */ + public boolean isPaused() { + return this.game.isPaused(); + } + + /** + * While paused: runs exactly one tick. + * + * @example.files WindowStep.java + */ + public void step() { + this.game.step(); + } + + /** + * How fast the game runs: 1 is normal, 2 twice as fast, 0.5 half as fast; up to 8. Each tick + * still is 1/60 s of game time; there are more or fewer of them per second. + * + * @param speed the game speed + * + * @example.files WindowSetGameSpeed.java + */ + public void setGameSpeed(double speed) { + this.game.setGameSpeed(speed); + } + + /** + * @return the game speed + * + * @example.files WindowSetGameSpeed.java + */ + public double getGameSpeed() { + return this.game.getGameSpeed(); + } + + /** + * @return whether debug mode is on + * + * @example.files WindowIsDebug.java + */ + public boolean isDebug() { + return this.game.isDebug(); + } + + /** + * Debug mode shows what its panel in the bottom right corner has ticked: hitboxes, positions, + * the mouse and camera, touching pairs, hidden sprites, the clones and the frame rate, and it + * lets {@code debug(…)} print. F12 switches it too, and {@code -Dscratch4j.debug=…} presets + * which options are on. + * + * @param debug on or off + * + * @example.files WindowSetDebug.java + */ + public void setDebug(boolean debug) { + this.game.setDebug(debug); + } + + /** + * Prints values, but only in debug mode. + * + * @param values what to print + * + * @example.files WindowDebug.java + */ + public void debug(Object... values) { + if (this.game.isDebug()) { + StringBuilder line = new StringBuilder("Window:"); + for (Object v : values) { + line.append(' ').append(v); + } + System.out.println(line); + } + } + + /** + * @return the stage width in stage pixels + * + * @example.files WindowGetWidth.java + */ + public int getWidth() { + return this.game.getWidth(); + } + + /** + * @return the stage height in stage pixels + * + * @example.files WindowGetHeight.java + */ + public int getHeight() { + return this.game.getHeight(); + } + + // ---- stages ----------------------------------------------------------------------------- + + /** + * Shows a stage from the next tick on. + * + * @param stage the stage + * + * @example.files WindowSetStage.java + */ + public void setStage(Stage stage) { + if (this.game.isGameThread()) { + this.game.setStage(stage); + } else { + this.game.runOnGameThread(() -> this.game.setStage(stage)); + } + } + + /** + * @return the stage shown + * + * @example.files WindowGetStage.java + */ + public Stage getStage() { + return this.game.getStage(); + } + + /** + * Fades to a stage through black. + * + * @param stage the stage + * @param seconds how long + * + * @example.files WindowTransitionToStage.java + */ + public void transitionToStage(Stage stage, double seconds) { + this.transitionToStage(() -> stage, Transition.FADE, seconds); + } + + /** + * Fades to a stage made now, on the game thread: a slow constructor shows the loading screen + * instead of freezing the window. + * + * @param stage makes the stage, e.g. {@code () -> new Level2()} + * @param seconds how long + * + * @example.files WindowTransitionToStage.java + */ + public void transitionToStage(Supplier stage, double seconds) { + this.transitionToStage(stage, Transition.FADE, seconds); + } + + /** + * Shows a stage made now through a transition. + * + *

{@code
+   * window.transitionToStage(() -> new Level2(), Transition.SLIDE_LEFT, 0.5);
+   * }
+ * + * @param stage makes the stage + * @param transition how + * @param seconds how long + * + * @example.files WindowTransitionToStage.java + */ + public void transitionToStage(Supplier stage, Transition transition, double seconds) { + this.game.transition(stage, transition.getName(), transition.getSource(), seconds); + } + + /** @return whether a transition is in progress */ + public boolean isTransitioning() { + return this.game.isTransitioning(); + } + + /** + * Ends the program: {@link #whenExits()} runs first. + * + * @example.files WindowExit.java + */ + public void exit() { + this.host.close(); + } + + /** + * Called when the program ends, on the game thread. Override it to save, say. + * + * @example.files WindowWhenExits.java + */ + public void whenExits() {} + + /** + * @return the version of Scratch for Java, e.g. "7.0.0" + * + * @example.files WindowGetLibraryVersion.java + */ + public String getLibraryVersion() { + return Extension.coreVersion(); + } + + /** + * @return "Scratch for Java" + * + * @example.files WindowGetLibraryTitle.java + */ + public String getLibraryTitle() { + return "Scratch for Java"; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/extension/Canvas.java b/core/src/main/java/org/openpatch/scratch/extension/Canvas.java new file mode 100644 index 00000000..e35ea279 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/extension/Canvas.java @@ -0,0 +1,216 @@ +package org.openpatch.scratch.extension; + +import java.util.ArrayList; +import java.util.List; +import org.openpatch.scratch.Color; +import org.openpatch.scratch.internal.draw.ClipDraw; +import org.openpatch.scratch.internal.draw.ImageDraw; +import org.openpatch.scratch.internal.draw.Item; +import org.openpatch.scratch.internal.draw.ShapeDraw; +import org.openpatch.scratch.internal.draw.TextDraw; +import org.openpatch.scratch.internal.image.Image; +import org.openpatch.scratch.internal.image.Images; +import org.openpatch.scratch.internal.text.Font; +import org.openpatch.scratch.internal.text.TextLayout; + +/** + * What a layer drawer draws with: it records into the draw list, nothing is drawn at once and no + * OpenGL is exposed. Coordinates are those of the layer: world coordinates (Scratch's, y up) for + * the world layers, stage coordinates for the UI layer and the overlay. Game thread only, and only + * during the drawer's call. + */ +public final class Canvas { + + static { + org.openpatch.scratch.internal.CanvasAccess.register(new org.openpatch.scratch.internal.CanvasAccess.Access() { + @Override + public Canvas create() { + return new Canvas(); + } + + @Override + public List finish(Canvas canvas) { + canvas.closed = true; + return canvas.items; + } + }); + } + + private final List items = new ArrayList<>(); + private float opacity = 1; + private boolean closed; + + private Canvas() {} + + private void open() { + if (this.closed) { + throw new IllegalStateException("Draw only while the drawer is called; this canvas has expired."); + } + } + + /** @param opacity how opaque what follows is drawn, 0 to 1 */ + public void setOpacity(double opacity) { + this.opacity = (float) Math.max(0, Math.min(1, opacity)); + } + + /** + * An image (a file or a built-in sprite name), centred on a point. + * + * @param path the image + * @param x x of its centre + * @param y y of its centre + * @param width its width + * @param height its height + */ + public void drawImage(String path, double x, double y, double width, double height) { + Image image = Images.load(path); + this.drawImageRegion(path, 0, 0, image.getWidth(), image.getHeight(), x, y, width, height); + } + + /** + * A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font. + * + * @param path the image + * @param sx the region's left edge in image pixels + * @param sy its top edge + * @param sw its width + * @param sh its height + * @param x x of the centre + * @param y y of the centre + * @param width the width to draw it at + * @param height the height to draw it at + */ + public void drawImageRegion(String path, int sx, int sy, int sw, int sh, double x, double y, double width, + double height) { + double l = x - width / 2, r = x + width / 2, t = y + height / 2, b = y - height / 2; + this.drawImageQuad(path, sx, sy, sw, sh, new double[] {l, t, r, t, r, b, l, b}); + } + + /** + * A region of an image on any quad: turned, mirrored, sheared. + * + * @param path the image + * @param sx the region's left edge in image pixels + * @param sy its top edge + * @param sw its width + * @param sh its height + * @param corners where the region's top-left, top-right, bottom-right and bottom-left corners go: + * {@code x0, y0, …, x3, y3} + */ + public void drawImageQuad(String path, int sx, int sy, int sw, int sh, double[] corners) { + this.open(); + if (corners.length != 8) { + throw new IllegalArgumentException("A quad has four corners: 8 numbers."); + } + this.items.add(new ImageDraw(Images.load(path), sx, sy, sw, sh, corners.clone(), this.opacity)); + } + + /** + * A filled polygon, concave ones included. + * + * @param xs x of every corner + * @param ys y of every corner, in the same order + * @param fill its colour + */ + public void drawPolygon(double[] xs, double[] ys, Color fill) { + this.open(); + if (xs.length < 3 || xs.length != ys.length) { + throw new IllegalArgumentException("A polygon needs equally many x and y and at least three corners."); + } + this.items.add(new ShapeDraw(points(xs, ys), this.withOpacity(fill), 0, 0)); + } + + /** + * The outline of a polygon. + * + * @param xs x of every corner + * @param ys y of every corner + * @param stroke the outline's colour + * @param weight the outline's width + */ + public void drawOutline(double[] xs, double[] ys, Color stroke, double weight) { + this.open(); + this.items.add(new ShapeDraw(points(xs, ys), 0, this.withOpacity(stroke), weight)); + } + + /** + * A filled rectangle centred on a point. + * + * @param x x of its centre + * @param y y of its centre + * @param width its width + * @param height its height + * @param fill its colour + */ + public void drawRectangle(double x, double y, double width, double height, Color fill) { + this.drawPolygon(new double[] {x - width / 2, x + width / 2, x + width / 2, x - width / 2}, + new double[] {y + height / 2, y + height / 2, y - height / 2, y - height / 2}, fill); + } + + /** + * A line of text whose first baseline starts at a point, in the default font. + * + * @param text the text + * @param x where it starts + * @param y its baseline + * @param size the font size + * @param color the colour of the letters + */ + public void drawText(String text, double x, double y, double size, Color color) { + this.open(); + TextLayout layout = TextLayout.of(text, Font.defaultFont(), size, 0); + this.items.add(new TextDraw(layout, x, y + layout.font().ascent(size), layout.width(), layout.height(), 0, + this.withOpacity(color), TextDraw.Box.NONE, 0, 0, 0, 0)); + } + + /** + * Draws only inside a rectangle (axis-aligned on the screen) until {@link #noClip()}. + * + * @param x x of its centre + * @param y y of its centre + * @param width its width + * @param height its height + */ + public void clip(double x, double y, double width, double height) { + this.open(); + this.items.add(new ClipDraw(true, x - width / 2, y - height / 2, x + width / 2, y + height / 2)); + } + + /** Draws everywhere again. */ + public void noClip() { + this.open(); + this.items.add(ClipDraw.END); + } + + /** + * @param path an image or a built-in sprite name + * @return its width in pixels + */ + public int imageWidth(String path) { + return Images.load(path).getWidth(); + } + + /** + * @param path an image or a built-in sprite name + * @return its height in pixels + */ + public int imageHeight(String path) { + return Images.load(path).getHeight(); + } + + private int withOpacity(Color c) { + return c.withAlpha(c.getAlpha() * this.opacity).toARGB(); + } + + private static double[] points(double[] xs, double[] ys) { + double[] p = new double[xs.length * 2]; + for (int i = 0; i < xs.length; i++) { + if (!Double.isFinite(xs[i]) || !Double.isFinite(ys[i])) { + throw new IllegalArgumentException("Coordinates must be finite numbers."); + } + p[2 * i] = xs[i]; + p[2 * i + 1] = ys[i]; + } + return p; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/extension/Extension.java b/core/src/main/java/org/openpatch/scratch/extension/Extension.java new file mode 100644 index 00000000..3cbf1f4f --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/extension/Extension.java @@ -0,0 +1,79 @@ +package org.openpatch.scratch.extension; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.util.Properties; + +/** + * An extension: found through {@link java.util.ServiceLoader} (a line in + * {@code META-INF/services/org.openpatch.scratch.extension.Extension}) or registered with + * {@code Window.use(...)}, installed once when the window is created. Learner code never sees + * it. + * + *

The metadata lives in code, not in a resource file, because the fat jar shades every + * first-party extension into one jar, where a fixed resource path would survive only once. + */ +public interface Extension { + + /** A short unique id such as {@code "tiled"}, used in messages. */ + String id(); + + /** A name for people, such as {@code "Tiled maps"}. */ + String name(); + + /** The extension's own version. */ + String version(); + + /** + * The core versions this extension works with: {@code "7"} means any 7.x, {@code "7.1"} 7.1 + * or newer, {@code "7.1.2"} 7.1.2 or newer, always below the next major version. + */ + default String requires() { + return "7"; + } + + /** Adds the extension's hooks. Called once, on the window thread, before the first stage. */ + default void install(ExtensionContext ctx) {} + + /** The version of the core library, e.g. {@code "7.0.0"}. */ + static String coreVersion() { + return CoreVersion.VALUE; + } +} + +/** + * Read once from the version file Maven fills in. This core is the version 7 extension API; until + * the release workflow sets 7.x the pom still carries the last release's number (6.5.0 on the v7 + * branch), which would make every extension that requires 7 refuse to run. Such a build reports + * 7.0.0; a 7.x or later version is reported as it is. + */ +final class CoreVersion { + static final int API_MAJOR = 7; + static final String VALUE = effective(read()); + + static String effective(String version) { + try { + int major = Integer.parseInt(version.split("[.-]")[0]); + return major < API_MAJOR ? API_MAJOR + ".0.0" : version; + } catch (NumberFormatException e) { + return version; + } + } + + private CoreVersion() {} + + private static String read() { + try (InputStream in = Extension.class.getResourceAsStream( + "/org/openpatch/scratch/internal/version.properties")) { + if (in == null) { + return "0"; + } + Properties p = new Properties(); + p.load(in); + return p.getProperty("version", "0"); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/extension/ExtensionContext.java b/core/src/main/java/org/openpatch/scratch/extension/ExtensionContext.java new file mode 100644 index 00000000..12dd5081 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/extension/ExtensionContext.java @@ -0,0 +1,189 @@ +package org.openpatch.scratch.extension; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Supplier; +import org.openpatch.scratch.KeyCode; +import org.openpatch.scratch.Layer; +import org.openpatch.scratch.MouseCode; +import org.openpatch.scratch.Stage; + +/** + * What an extension may hook into. Each method says + * which thread its hook runs on. An exception thrown by a hook is printed once, naming the + * extension, and the hook is switched off; the game goes on. + */ +public interface ExtensionContext { + + /** A key went down or up (auto-repeat never arrives). */ + record KeyEvent(KeyCode key, boolean pressed) {} + + /** Something the mouse did, in stage coordinates. */ + record MouseEvent(Kind kind, MouseCode button, double x, double y, double wheel) { + /** What happened. */ + public enum Kind { + PRESS, + RELEASE, + MOVE, + WHEEL + } + } + + /** An exception from learner code, with the learner's frame (null if there is none). */ + record LearnerError(Throwable error, StackTraceElement learnerFrame) {} + + /** A drawn frame at stage size; its pixels are read back only when asked for. */ + interface Frame { + int getWidth(); + + int getHeight(); + + /** Straight ARGB, top row first. */ + int[] getArgb(); + + void savePng(Path file) throws IOException; + } + + /** Decoded pixels from an image format of an extension's. */ + record DecodedImage(int width, int height, int[] argb) {} + + /** Turns the bytes of an image file into pixels; runs on loading threads. */ + @FunctionalInterface + interface ImageDecoder { + DecodedImage decode(byte[] file) throws IOException; + } + + /** Draws into a layer of a stage. */ + @FunctionalInterface + interface LayerDrawer { + void draw(Stage stage, Canvas canvas); + } + + /** + * A slot in the input snapshot: polled on the window thread, copied to the game thread with + * each batch of ticks, so no locking is needed. + * + * @param the state kept in the slot + */ + final class InputKey { + final String name; + final Supplier factory; + final BiConsumer copy; + + private InputKey(String name, Supplier factory, BiConsumer copy) { + this.name = name; + this.factory = factory; + this.copy = copy; + } + + /** + * @param name for messages + * @param factory makes an empty state (twice: one per thread) + * @param copy copies the window thread's state into the game thread's: (from, into) + * @param the state + * @return the key + */ + public static InputKey of(String name, Supplier factory, BiConsumer copy) { + return new InputKey<>(name, factory, copy); + } + + /** For the core: makes a state for this key. */ + public T create() { + return this.factory.get(); + } + + /** For the core: copies one state into another. */ + public void copy(T from, T into) { + this.copy.accept(from, into); + } + + @Override + public String toString() { + return this.name; + } + } + + /** The window thread's side of the input snapshot, filled by {@link #onInputPoll}. */ + interface InputSnapshot { + T get(InputKey key); + } + + // ---- game thread --------------------------------------------------------------------- + + /** A stage was made (on the thread that made it, usually the game thread or main). */ + void onStageCreated(Consumer hook); + + /** A stage stopped being shown. Game thread. */ + void onStageDisposed(Consumer hook); + + /** Every tick, after the tick's input and before timers and {@code run()}. Game thread. */ + void beforeTick(Consumer hook); + + /** Every key press and release, before learner code sees it; observe only. Game thread. */ + void onKey(Consumer hook); + + /** Every mouse event, before learner code sees it; observe only. Game thread. */ + void onMouse(Consumer hook); + + /** At the end of the program, after {@code whenExits()}. Game thread. */ + void onExit(Runnable hook); + + /** A learner exception stopped the game. Game thread. */ + void onLearnerError(Consumer hook); + + /** + * Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles, + * drawings. Game thread, when the draw list is made. + */ + void addLayerDrawer(Layer layer, LayerDrawer drawer); + + /** + * Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave + * it out (Studio's watch pins). Game thread. + */ + void addOverlayDrawer(LayerDrawer drawer); + + /** + * Calls a listener interface on the stage and every sprite of it that implements it, at the + * point of the tick where key events arrive. Learner exceptions thrown there stop the game like + * any learner exception. Game thread. + * + * @param the listener interface + */ + void dispatch(Stage stage, Class listener, Consumer call); + + /** This batch's copy of a slot of the input snapshot. Game thread. */ + T input(InputKey key); + + /** @return ticks run so far */ + long getTickCount(); + + /** @return whether the loading screen is up */ + boolean isLoading(); + + // ---- window thread --------------------------------------------------------------------- + + /** + * Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into + * the snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed. + */ + void onInputPoll(Consumer hook); + + /** After a frame was drawn, on the window thread. */ + void afterFrame(BiConsumer hook); + + // ---- any thread ------------------------------------------------------------------------ + + /** Runs a task at the start of the next tick, before input. */ + void runOnGameThread(Runnable task); + + // ---- loading threads --------------------------------------------------------------------- + + /** + * Images whose name ends in {@code suffix} (e.g. {@code ".ase"}) are decoded by + * {@code decoder}. + */ + void registerImageFormat(String suffix, ImageDecoder decoder); +} diff --git a/core/src/main/java/org/openpatch/scratch/extension/package-info.java b/core/src/main/java/org/openpatch/scratch/extension/package-info.java new file mode 100644 index 00000000..4969dc5f --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/extension/package-info.java @@ -0,0 +1,10 @@ +/** + * The public extension API: what an extension jar uses to add to Scratch for Java without + * touching its internals. First-party extensions (tiled, save, recorder, drawing) are built on + * it alone, which the build checks. + * + *

Desktop only: the online IDE has every first-party extension built in and loads no others. + * + * @desktop-only + */ +package org.openpatch.scratch.extension; diff --git a/core/src/main/java/org/openpatch/scratch/internal/Assets.java b/core/src/main/java/org/openpatch/scratch/internal/Assets.java new file mode 100644 index 00000000..bfb15d77 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/Assets.java @@ -0,0 +1,276 @@ +package org.openpatch.scratch.internal; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.FileSystem; +import java.nio.file.FileSystemNotFoundException; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.stream.Stream; +import org.openpatch.scratch.internal.image.Image; +import org.openpatch.scratch.internal.image.Images; +import org.openpatch.scratch.internal.text.Font; + +/** + * Preloads an assets folder while the loading screen shows: + * the folder given to the window, else a folder named {@code assets} if the project has one. + * + *

A worker thread decodes every image, font and sound into the caches a sprite's + * {@code addCostume} or {@code addSound} reads, by the path the sprite would write + * ({@code assets/cat.png}); the window thread then uploads the decoded images a few milliseconds + * per frame ({@link #nextUpload()}), so the screen keeps moving. Progress counts both steps. + */ +public final class Assets { + + /** The folder that is preloaded when the window is given none. */ + public static final String DEFAULT_FOLDER = "assets"; + + /** The program's preloader, for {@link #noteLoadedLate}. */ + private static volatile Assets active; + + private final String folder; + private final boolean named; + private final ConcurrentLinkedQueue uploads = new ConcurrentLinkedQueue<>(); + private volatile boolean listed; + private volatile boolean decoded; + private volatile int total; + private volatile int done; + private volatile String current = ""; + + private Assets(String folder) { + this.named = folder != null; + this.folder = folder != null ? folder : DEFAULT_FOLDER; + } + + /** Starts preloading on a daemon thread; nothing to do when there is no such folder. */ + public static Assets start(String folder) { + Assets assets = new Assets(folder); + active = assets; + Thread worker = new Thread(assets::load, "scratch4j-assets"); + worker.setDaemon(true); + worker.start(); + return assets; + } + + /** + * Notes a file loaded while the program was already running: it was not ready when first used, + * so the game may have stuttered while it loaded. Debug mode says which file, and how to load + * it while the loading screen shows. + * + * @param type the kind of file, e.g. "image" + * @param path the path it was loaded by + */ + public static void noteLoadedLate(String type, String path) { + Assets assets = active; + Game game = Game.currentOrNull(); + if (assets == null || !assets.isDone() || game == null || !game.isDebug()) { + return; + } + String prefix = assets.folder.replace('\\', '/').replaceAll("/+$", "") + "/"; + String hint = path.replace('\\', '/').startsWith(prefix) + ? "the folder '" + assets.folder + "' could not be loaded in advance" + : "put it into '" + assets.folder + "' to load it while the loading screen shows"; + System.out.println("[Debug] Loaded " + type + " late: " + path + " (" + hint + ")"); + } + + /** Whether every file is decoded and every image uploaded. */ + public boolean isDone() { + return this.listed && this.decoded && this.uploads.isEmpty(); + } + + /** 0 … 1; images count twice (decoding, uploading). */ + public double progress() { + if (!this.listed) { + return 0; + } + int total = this.total; + return total == 0 ? 1 : Math.min(1, (this.done - this.uploads.size()) / (double) total); + } + + /** "Image: assets/cat.png", or what the loader is doing. */ + public String current() { + return this.current; + } + + /** Window thread: the next decoded image to upload, or null. */ + public Image nextUpload() { + return this.uploads.poll(); + } + + private void load() { + try { + Font.defaultFont(); + Path root = findFolder(this.folder); + if (root == null) { + if (this.named) { + reportMissingFolder(this.folder); + } + return; + } + this.current = "Finding files..."; + List all = list(this.folder, root); + List images = new ArrayList<>(), fonts = new ArrayList<>(), sounds = new ArrayList<>(); + for (String file : all) { + if (hasExtension(file, ".png", ".jpg", ".jpeg", ".gif", ".bmp")) { + images.add(file); + } else if (hasExtension(file, ".ttf", ".otf")) { + fonts.add(file); + } else if (hasExtension(file, ".wav", ".ogg")) { + sounds.add(file); + } + } + this.total = images.size() * 2 + fonts.size() + sounds.size(); + this.listed = true; + for (String file : images) { + this.step("Image", file, () -> this.uploads.add(Images.load(file)), 2); + } + for (String file : fonts) { + this.step("Font", file, () -> Font.load(file), 1); + } + for (String file : sounds) { + this.step("Sound", file, () -> SoundBank.preload(file), 1); + } + } catch (IOException | RuntimeException e) { + System.err.println("Scratch for Java: could not load the assets folder '" + this.folder + "': " + e); + } finally { + // whatever went wrong, the project must not wait on its loading screen + this.listed = true; + this.decoded = true; + this.done = this.total; + } + } + + /** One file; a file that cannot be loaded is reported when the program uses it, not here. */ + private void step(String type, String file, Runnable load, int weight) { + this.current = type + ": " + file; + try { + load.run(); + this.done += weight; + } catch (RuntimeException e) { + this.done += weight; + } + } + + /** + * Finds an assets folder relative to the working directory, else on the classpath (also inside + * a jar, whether or not the jar has an entry for the folder itself). + * + * @return the folder, or null if there is none + */ + static Path findFolder(String folder) { + folder = folder.replaceFirst("^~", java.util.regex.Matcher.quoteReplacement(System.getProperty("user.home"))); + Path onDisk = Path.of(folder); + if (Files.isDirectory(onDisk)) { + return onDisk; + } + if (onDisk.isAbsolute()) { + return null; + } + var resource = Thread.currentThread().getContextClassLoader().getResource(folder); + if (resource != null) { + try { + Path onClasspath = classpathFolder(resource.toURI()); + if (onClasspath != null && Files.isDirectory(onClasspath)) { + return onClasspath; + } + } catch (URISyntaxException | IOException | RuntimeException e) { + // look into the jars instead + } + } + return folderInsideAJar(folder); + } + + /** + * Looks for a folder inside the jars on the classpath. A jar only has the folder as a resource + * of its own when it was packed with an entry for it, which not every tool writes. + */ + private static Path folderInsideAJar(String folder) { + try { + var manifests = Thread.currentThread().getContextClassLoader().getResources("META-INF/MANIFEST.MF"); + while (manifests.hasMoreElements()) { + String manifest = manifests.nextElement().toString(); + if (!manifest.startsWith("jar:")) { + continue; + } + URI jar = URI.create(manifest.substring(0, manifest.indexOf("!/") + 2)); + FileSystem opened = null; + FileSystem fs; + try { + fs = FileSystems.getFileSystem(jar); + } catch (FileSystemNotFoundException e) { + fs = opened = FileSystems.newFileSystem(jar, Map.of()); + } + Path candidate = fs.getPath(folder); + if (Files.isDirectory(candidate)) { + return candidate; // left open: the files are read from it afterwards + } + if (opened != null) { + opened.close(); + } + } + } catch (IOException | RuntimeException e) { + // no such folder in any jar + } + return null; + } + + private static Path classpathFolder(URI uri) throws IOException { + if ("file".equals(uri.getScheme())) { + return Path.of(uri); + } + if (!"jar".equals(uri.getScheme())) { + return null; + } + try { + return Path.of(uri); + } catch (FileSystemNotFoundException e) { + FileSystems.newFileSystem(uri, Map.of()); // left open: the files are read from it afterwards + return Path.of(uri); + } + } + + /** + * The files of an assets folder by the paths a sprite would use for them: the folder as it was + * written, then the path inside it, sorted. + */ + static List list(String folder, Path root) throws IOException { + String prefix = folder.replace('\\', '/').replaceAll("/+$", ""); + try (Stream files = Files.walk(root)) { + return files.filter(Files::isRegularFile) + .map(f -> prefix + "/" + root.relativize(f).toString().replace('\\', '/')) + .sorted() + .toList(); + } + } + + private static boolean hasExtension(String file, String... extensions) { + String lower = file.toLowerCase(Locale.ROOT); + for (String extension : extensions) { + if (lower.endsWith(extension)) { + return true; + } + } + return false; + } + + private static void reportMissingFolder(String folder) { + System.err.println("\n=============================================="); + System.err.println("WARNING: Assets folder not found!"); + System.err.println("=============================================="); + System.err.println("You wrote: " + folder); + System.err.println("Java looked at: " + Path.of(folder).toAbsolutePath()); + System.err.println("\nNothing is loaded in advance, so each image and sound"); + System.err.println("is loaded the first time it is used."); + System.err.println("\nTip: Check the folder name for typos. A folder named"); + System.err.println(" 'assets' is found without naming it at all:"); + System.err.println(" new Window(480, 360);"); + System.err.println("==============================================\n"); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/BuiltinAssets.java b/core/src/main/java/org/openpatch/scratch/internal/BuiltinAssets.java new file mode 100644 index 00000000..902aa361 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/BuiltinAssets.java @@ -0,0 +1,129 @@ +package org.openpatch.scratch.internal; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * The sprites bundled with the library (Kenney's CC0 sheets), by name: {@code "slimeGreen"} or, + * when a name is in two sheets, {@code "platformer/slimeGreen"}. Read from the sheets' texture + * atlases ({@code images/.xml}). + */ +public final class BuiltinAssets { + + private static final String[] SHEETS = {"platformer", "jumper", "space_shooter", "tappy_plane", "cat"}; + private static final String BASE = "images/"; + /** One {@code }: the atlases are machine-written, so attributes are regular. */ + private static final Pattern SUB_TEXTURE = Pattern.compile("]*?)/?>"); + private static final Pattern ATTRIBUTE = Pattern.compile("(\\w+)\\s*=\\s*\"([^\"]*)\""); + + /** A sprite of a sheet: its region and the way it is drawn facing (0 up, 90 right, …). */ + public record Entry(String name, String sheet, int x, int y, int width, int height, double direction) { + public String sheetPath() { + return BASE + this.sheet + ".png"; + } + } + + private static Map assets; + + private BuiltinAssets() {} + + private static synchronized Map assets() { + if (assets != null) { + return assets; + } + Map loaded = new LinkedHashMap<>(); + for (String sheet : SHEETS) { + // through the class, not its loader: on the module path images/ is a package of the module + try (InputStream in = BuiltinAssets.class.getResourceAsStream("/" + BASE + sheet + ".xml")) { + if (in == null) { + continue; + } + String xml = new String(in.readAllBytes(), StandardCharsets.UTF_8); + Matcher sub = SUB_TEXTURE.matcher(xml); + while (sub.find()) { + Map a = new LinkedHashMap<>(); + Matcher attr = ATTRIBUTE.matcher(sub.group(1)); + while (attr.find()) { + a.put(attr.group(1), attr.group(2)); + } + String name = a.get("name"); + if (name == null) { + continue; + } + String simple = Suggestions.stripExtension(name); + String qualified = key(sheet + "/" + simple); + if (loaded.containsKey(qualified)) { + continue; // a few sprites are listed twice in the same atlas: keep the first + } + Entry entry = new Entry(simple, sheet, Integer.parseInt(a.get("x")), Integer.parseInt(a.get("y")), + Integer.parseInt(a.get("width")), Integer.parseInt(a.get("height")), + a.containsKey("direction") ? Double.parseDouble(a.get("direction")) : 90); + loaded.put(qualified, entry); + loaded.putIfAbsent(key(simple), entry); // the qualified name is unique, the bare one first-come + } + } catch (IOException | RuntimeException e) { + // a broken atlas must never stop a program: only its sprites are missing + } + } + assets = loaded; + return assets; + } + + private static String key(String name) { + return Suggestions.normalise(name); + } + + /** "platformer/grass" is a built-in name, "sprites/cat.png" a path: the extension tells. */ + public static boolean isBuiltinName(String name) { + if (name == null || name.isEmpty() || name.indexOf('\\') >= 0 || name.startsWith("~") || name.startsWith("/")) { + return false; + } + String last = name.substring(name.lastIndexOf('/') + 1); + return last.indexOf('.') < 0; + } + + public static Entry get(String name) { + return name == null ? null : assets().get(key(name)); + } + + public static List getNames() { + List names = new ArrayList<>(); + for (Entry e : new LinkedHashSet<>(assets().values())) { + if (!names.contains(e.name())) { + names.add(e.name()); + } + } + return names; + } + + public static List getEntries() { + return new ArrayList<>(new LinkedHashSet<>(assets().values())); + } + + /** The bundled sheets, in lookup order (the docs' asset pages list them). */ + public static List getSheets() { + return List.of(SHEETS); + } + + /** + * The name to write in code for a sprite: its bare name, unless an earlier sheet already claims + * it, then {@code sheet/name}. + */ + public static String getReferenceName(Entry entry) { + Entry bare = get(entry.name()); + return bare == entry ? entry.name() : entry.sheet() + "/" + entry.name(); + } + + /** Names close to a mistyped one, best first, for "did you mean …?". */ + public static List suggest(String name, int limit) { + return Suggestions.closestTo(getNames(), name, limit); + } +} diff --git a/src/main/java/org/openpatch/scratch/internal/BuiltinSounds.java b/core/src/main/java/org/openpatch/scratch/internal/BuiltinSounds.java similarity index 95% rename from src/main/java/org/openpatch/scratch/internal/BuiltinSounds.java rename to core/src/main/java/org/openpatch/scratch/internal/BuiltinSounds.java index cbd7b626..3d7f1924 100644 --- a/src/main/java/org/openpatch/scratch/internal/BuiltinSounds.java +++ b/core/src/main/java/org/openpatch/scratch/internal/BuiltinSounds.java @@ -74,7 +74,9 @@ private static URL resourceRoot() { return url; } } - return BuiltinSounds.class.getClassLoader().getResource(BASE); + URL url = BuiltinSounds.class.getClassLoader().getResource(BASE); + // on the module path the folder is a package of the module: only its classes can see it + return url != null ? url : BuiltinSounds.class.getResource("/" + BASE); } private static void collect(Path root, Map into) throws java.io.IOException { diff --git a/core/src/main/java/org/openpatch/scratch/internal/CanvasAccess.java b/core/src/main/java/org/openpatch/scratch/internal/CanvasAccess.java new file mode 100644 index 00000000..1f455ec8 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/CanvasAccess.java @@ -0,0 +1,43 @@ +package org.openpatch.scratch.internal; + +import java.util.List; +import org.openpatch.scratch.extension.Canvas; +import org.openpatch.scratch.internal.draw.Item; + +/** The core's way to make a {@link Canvas} and take what was recorded, kept out of its public API. */ +public final class CanvasAccess { + + /** Implemented by Canvas itself, registered when its class loads. */ + public interface Access { + Canvas create(); + + List finish(Canvas canvas); + } + + private static volatile Access access; + + private CanvasAccess() {} + + public static void register(Access implementation) { + access = implementation; + } + + private static Access access() { + if (access == null) { + try { + Class.forName(Canvas.class.getName(), true, Canvas.class.getClassLoader()); + } catch (ClassNotFoundException e) { + throw new IllegalStateException(e); + } + } + return access; + } + + public static Canvas create() { + return access().create(); + } + + public static List finish(Canvas canvas) { + return access().finish(canvas); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/ContentBounds.java b/core/src/main/java/org/openpatch/scratch/internal/ContentBounds.java new file mode 100644 index 00000000..1f447cf8 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/ContentBounds.java @@ -0,0 +1,43 @@ +package org.openpatch.scratch.internal; + +import java.util.Collections; +import java.util.Map; +import java.util.WeakHashMap; +import org.openpatch.scratch.internal.image.Image; + +/** The rectangle around an image's painted pixels, cached per image (images never change). */ +final class ContentBounds { + + private static final Map CACHE = Collections.synchronizedMap(new WeakHashMap<>()); + + private ContentBounds() {} + + /** A ring {left, top, right, top, right, bottom, left, bottom}; callers must not change it. */ + static double[] of(Image image) { + return CACHE.computeIfAbsent(image, ContentBounds::compute); + } + + private static double[] compute(Image image) { + int w = image.getWidth(), h = image.getHeight(); + int[] argb = image.getArgb(); + int left = w, right = -1, top = h, bottom = -1; + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { + if ((argb[y * w + x] >>> 24) != 0) { + left = Math.min(left, x); + right = Math.max(right, x); + top = Math.min(top, y); + bottom = Math.max(bottom, y); + } + } + } + if (right < 0) { + left = 0; + top = 0; + right = w - 1; + bottom = h - 1; + } + double l = left, t = top, r = right + 1, b = bottom + 1; + return new double[] {l, t, r, t, r, b, l, b}; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/Costume.java b/core/src/main/java/org/openpatch/scratch/internal/Costume.java new file mode 100644 index 00000000..82a7febc --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/Costume.java @@ -0,0 +1,22 @@ +package org.openpatch.scratch.internal; + +import org.openpatch.scratch.internal.image.Image; + +/** + * A named costume or backdrop. Its image is shared with clones and never changed. + * + * @param name the name learners switch to + * @param image the pixels + */ +public record Costume(String name, Image image) { + + /** + * The default hitbox: the rectangle around the painted pixels (alpha above 0), as a ring in + * costume pixels (origin top left, y down). Costumes are often drawn into a larger canvas, and + * touching that empty space looks like a bug. A costume without any painted pixel gets its full + * rectangle. + */ + public double[] outline() { + return ContentBounds.of(this.image); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/DebugOption.java b/core/src/main/java/org/openpatch/scratch/internal/DebugOption.java new file mode 100644 index 00000000..3cc5f6b5 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/DebugOption.java @@ -0,0 +1,71 @@ +package org.openpatch.scratch.internal; + +import java.util.EnumSet; +import java.util.Locale; +import java.util.Set; + +/** + * What debug mode ({@code Window.setDebug(true)}, F12) shows. Each of these can be switched in + * the debug panel while it runs; {@code -Dscratch4j.debug=hitboxes,labels,…} presets which are on + * when debug mode starts (names case-insensitive, {@code all} and {@code none} included). + */ +public enum DebugOption { + + /** The hitboxes that count for touching, in front of their layer's sprites. */ + HITBOXES("Hitboxes"), + + /** Every visible sprite's name, position and direction. */ + LABELS("Positions"), + + /** The crosshair at the mouse, the world coordinates under it and the camera's view. */ + MOUSE("Mouse & camera"), + + /** A line between the centres of every pair of sprites that touch. */ + TOUCHING("Touching pairs"), + + /** Outlines of hidden sprites, which take part in nothing. */ + INVISIBLE("Hidden sprites"), + + /** How many clones exist, next to the camera's view. */ + CLONES("Clone count"), + + /** The frame rate the window measures, top right. */ + FPS("Frame rate"); + + /** What the debug panel writes next to the checkbox. */ + public final String label; + + DebugOption(String label) { + this.label = label; + } + + /** + * The options {@code -Dscratch4j.debug} names, or the familiar overlay (hitboxes, positions, + * mouse and camera, frame rate) without the property. + */ + public static Set parse(String property) { + if (property == null) { + return EnumSet.of(HITBOXES, LABELS, MOUSE, FPS); + } + EnumSet options = EnumSet.noneOf(DebugOption.class); + if (property.isBlank()) { + return options; + } + for (String name : property.split(",")) { + name = name.trim(); + if (name.isEmpty()) { + continue; + } + if (name.equalsIgnoreCase("all")) { + options.addAll(EnumSet.allOf(DebugOption.class)); + continue; + } + try { + options.add(valueOf(name.toUpperCase(Locale.ROOT))); + } catch (IllegalArgumentException e) { + System.err.println("Scratch for Java: unknown debug option '" + name + "'"); + } + } + return options; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/DebugPanel.java b/core/src/main/java/org/openpatch/scratch/internal/DebugPanel.java new file mode 100644 index 00000000..459e42a9 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/DebugPanel.java @@ -0,0 +1,136 @@ +package org.openpatch.scratch.internal; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import org.openpatch.scratch.internal.draw.Item; +import org.openpatch.scratch.internal.draw.ShapeDraw; +import org.openpatch.scratch.internal.draw.TextDraw; +import org.openpatch.scratch.internal.text.Font; +import org.openpatch.scratch.internal.text.TextLayout; + +/** + * The debug mode panel in the bottom right corner: a chip that opens a list of checkboxes, one + * per {@link DebugOption}. Clicks on it never reach the learner ({@code Game} asks + * {@link #press} first and drops the event); its items go out with the draw list's + * {@code overlayItems}, so captures stay without it. Everything here runs on the game thread. + */ +public final class DebugPanel { + + private static final double FONT_SIZE = 12; + private static final double MARGIN = 6; + private static final double PAD = 6; + private static final double ROW = 18; + private static final double BOX = 9; + private static final int BACKGROUND = 0xd0121212; + private static final int BORDER = 0xff8a8a8a; + private static final int TEXT = 0xffffffff; + private static final int CHECKED = 0x66ff4444; + + private static final DebugOption[] OPTIONS = DebugOption.values(); + + private final Font font = Font.defaultFont(); + private final TextLayout chip = TextLayout.of("Debug", this.font, FONT_SIZE, 0); + private final double labelWidth = this.widestLabel(); + private final double width = PAD + BOX + 6 + this.labelWidth + PAD; + private final double height = PAD + ROW * (OPTIONS.length + 1) + PAD; + private final double chipWidth = this.chip.width() + 2 * PAD; + private final double chipHeight = this.chip.height() + 2 * PAD; + + /** Whether the list of checkboxes stands open. */ + private boolean open; + + /** + * A mouse press at a stage coordinate: opens and closes the panel and ticks its checkboxes. + * + * @return whether the press was on the panel and must not reach the learner + */ + public boolean press(double x, double y, int stageWidth, int stageHeight, Set options) { + if (!this.open) { + if (this.inside(x, y, this.chipLeft(stageWidth), this.bottom(stageHeight), this.chipWidth, + this.chipHeight)) { + this.open = true; + return true; + } + return false; + } + if (!this.inside(x, y, this.left(stageWidth), this.bottom(stageHeight), this.width, this.height)) { + return false; + } + // the row the press lands in, 0 the title that closes the panel again + int row = (int) ((this.bottom(stageHeight) + this.height - y - PAD) / ROW); + if (row <= 0) { + this.open = false; + } else if (row <= OPTIONS.length) { + DebugOption option = OPTIONS[row - 1]; + if (!options.remove(option)) { + options.add(option); + } + } + return true; + } + + /** The panel's items for the draw list's {@code overlayItems}. */ + public List items(int stageWidth, int stageHeight, Set options) { + if (!this.open) { + return List.of(new TextDraw(this.chip, this.chipLeft(stageWidth), + this.bottom(stageHeight) + this.chipHeight, this.chipWidth, this.chipHeight, 0, TEXT, + TextDraw.Box.PLAIN, BACKGROUND, BORDER, PAD, 0)); + } + double left = this.left(stageWidth), bottom = this.bottom(stageHeight); + List items = new ArrayList<>(); + items.add(new ShapeDraw(new double[] {left, bottom, left + this.width, bottom, left + this.width, + bottom + this.height, left, bottom + this.height}, BACKGROUND, BORDER, 1)); + double ascent = this.font.ascent(FONT_SIZE), descent = this.font.descent(FONT_SIZE); + for (int row = 0; row <= OPTIONS.length; row++) { + double centre = bottom + this.height - PAD - ROW * row - ROW / 2; + if (row == 0) { + items.add(this.text("Debug", left + PAD, centre, ascent, descent)); + continue; + } + DebugOption option = OPTIONS[row - 1]; + double bx = left + PAD, by = centre - BOX / 2; + items.add(new ShapeDraw(new double[] {bx, by, bx + BOX, by, bx + BOX, by + BOX, bx, by + BOX}, + options.contains(option) ? CHECKED : 0, 0xffffffff, 1)); + items.add(this.text(option.label, bx + BOX + 6, centre, ascent, descent)); + } + return items; + } + + /** + * A text item centred on a row. {@code TextDraw} wants the box's top edge, and the letters hang + * downwards from it by {@code ascent + descent} ({@code Font.descent} is positive), so the top + * edge lies half the ink height above the row's centre — the way {@code Stage}'s debug texts + * centre theirs. + */ + private TextDraw text(String label, double x, double centre, double ascent, double descent) { + TextLayout layout = TextLayout.of(label, this.font, FONT_SIZE, 0); + return new TextDraw(layout, x, centre + (ascent + descent) / 2, layout.width(), layout.height(), 0, TEXT, + TextDraw.Box.NONE, 0, 0, 0, 0); + } + + private double left(int stageWidth) { + return stageWidth / 2.0 - MARGIN - this.width; + } + + private double chipLeft(int stageWidth) { + return stageWidth / 2.0 - MARGIN - this.chipWidth; + } + + /** The panel's and the chip's bottom edge, above the stage's bottom margin. */ + private double bottom(int stageHeight) { + return -stageHeight / 2.0 + MARGIN; + } + + private boolean inside(double x, double y, double left, double bottom, double w, double h) { + return x >= left && x <= left + w && y >= bottom && y <= bottom + h; + } + + private double widestLabel() { + double widest = this.chip.width(); + for (DebugOption option : OPTIONS) { + widest = Math.max(widest, TextLayout.of(option.label, this.font, FONT_SIZE, 0).width()); + } + return widest; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/ExtensionHost.java b/core/src/main/java/org/openpatch/scratch/internal/ExtensionHost.java new file mode 100644 index 00000000..7b1e02c3 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/ExtensionHost.java @@ -0,0 +1,357 @@ +package org.openpatch.scratch.internal; + +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import org.openpatch.scratch.Layer; +import org.openpatch.scratch.Sprite; +import org.openpatch.scratch.Stage; +import org.openpatch.scratch.extension.Canvas; +import org.openpatch.scratch.extension.Extension; +import org.openpatch.scratch.extension.ExtensionContext; +import org.openpatch.scratch.internal.draw.Item; + +/** + * The installed extensions' hooks and where the core calls them. One per game; each extension + * gets a context of its own, so a hook that throws can name its extension. + */ +public final class ExtensionHost { + + /** A hook with the extension it belongs to; switched off after its first exception. */ + private static final class Hook { + final Extension owner; + final T body; + volatile boolean off; + + Hook(Extension owner, T body) { + this.owner = owner; + this.body = body; + } + + void run(Consumer call) { + if (this.off) { + return; + } + try { + call.accept(this.body); + } catch (LearnerCallFailed e) { + throw e; // learner code's fault, not the extension's: the game stops as for any learner error + } catch (RuntimeException e) { + this.off = true; + System.err.println("Scratch for Java: the extension \"" + this.owner.id() + "\" failed and one of its " + + "parts is switched off: " + e); + e.printStackTrace(); + } + } + } + + /** An exception from learner code an extension called through {@code dispatch}. */ + public static final class LearnerCallFailed extends RuntimeException { + LearnerCallFailed(Throwable cause) { + super(cause); + } + } + + private static final Map IMAGE_FORMATS = new ConcurrentHashMap<>(); + + private final Game game; + private final List installed = new CopyOnWriteArrayList<>(); + private final List>> stageCreated = new CopyOnWriteArrayList<>(); + private final List>> stageDisposed = new CopyOnWriteArrayList<>(); + private final List>> beforeTick = new CopyOnWriteArrayList<>(); + private final List>> keys = new CopyOnWriteArrayList<>(); + private final List>> mice = new CopyOnWriteArrayList<>(); + private final Map>> layerDrawers = new EnumMap<>(Layer.class); + private final List> overlayDrawers = new CopyOnWriteArrayList<>(); + private final List>> polls = new CopyOnWriteArrayList<>(); + private final List>> afterFrame = new CopyOnWriteArrayList<>(); + // the input snapshot: the window thread's states and the game thread's copies + private final Map, Object> polled = new IdentityHashMap<>(); + private final Map, Object> handedOver = new IdentityHashMap<>(); + private volatile boolean loading; + + public ExtensionHost(Game game) { + this.game = game; + for (Layer layer : Layer.values()) { + this.layerDrawers.put(layer, new CopyOnWriteArrayList<>()); + } + } + + /** Installs extensions; one that throws while installing is left out with a message. */ + public void install(List extensions) { + for (Extension e : extensions) { + try { + e.install(new Context(e)); + this.installed.add(e); + } catch (RuntimeException ex) { + System.err.println("Scratch for Java: the extension \"" + e.id() + "\" could not be installed: " + ex); + } + } + } + + public List getInstalled() { + return List.copyOf(this.installed); + } + + public void setLoading(boolean loading) { + this.loading = loading; + } + + /** The decoder an extension registered for a file name, or null. */ + public static ExtensionContext.ImageDecoder imageFormat(String path) { + String lower = path.toLowerCase(java.util.Locale.ROOT); + for (var e : IMAGE_FORMATS.entrySet()) { + if (lower.endsWith(e.getKey())) { + return e.getValue(); + } + } + return null; + } + + // ---- where the core calls the hooks ------------------------------------------------------- + + public void stageCreated(Stage stage) { + for (var h : this.stageCreated) { + h.run(c -> c.accept(stage)); + } + } + + public void stageDisposed(Stage stage) { + for (var h : this.stageDisposed) { + h.run(c -> c.accept(stage)); + } + } + + public void beforeTick(Stage stage) { + for (var h : this.beforeTick) { + h.run(c -> c.accept(stage)); + } + } + + public void key(ExtensionContext.KeyEvent event) { + for (var h : this.keys) { + h.run(c -> c.accept(event)); + } + } + + public void mouse(ExtensionContext.MouseEvent event) { + for (var h : this.mice) { + h.run(c -> c.accept(event)); + } + } + + /** What the layer's drawers draw this frame, for the draw list. */ + public List drawLayer(Layer layer, Stage stage) { + List> drawers = this.layerDrawers.get(layer); + if (drawers.isEmpty()) { + return List.of(); + } + List items = new ArrayList<>(); + for (var h : drawers) { + Canvas canvas = CanvasAccess.create(); + try { + h.run(d -> d.draw(stage, canvas)); + } catch (LearnerCallFailed e) { + // made while building the draw list: report it here, the frame is drawn without the rest + this.game.failLearner(e.getCause()); + } + items.addAll(CanvasAccess.finish(canvas)); + } + return items; + } + + public List drawOverlay(Stage stage) { + if (this.overlayDrawers.isEmpty()) { + return List.of(); + } + List items = new ArrayList<>(); + for (var h : this.overlayDrawers) { + Canvas canvas = CanvasAccess.create(); + h.run(d -> d.draw(stage, canvas)); + items.addAll(CanvasAccess.finish(canvas)); + } + return items; + } + + /** Window thread, once per batch: the extensions poll their devices. */ + public void poll() { + if (this.polls.isEmpty()) { + return; + } + ExtensionContext.InputSnapshot snapshot = new ExtensionContext.InputSnapshot() { + @Override + @SuppressWarnings("unchecked") + public T get(ExtensionContext.InputKey key) { + return (T) ExtensionHost.this.polled.computeIfAbsent(key, k -> key.create()); + } + }; + for (var h : this.polls) { + h.run(c -> c.accept(snapshot)); + } + } + + /** + * Window thread, while the game thread waits for its batch: the polled states are copied into + * the game thread's. + */ + @SuppressWarnings({"unchecked", "rawtypes"}) + public void handOver() { + for (var e : this.polled.entrySet()) { + ExtensionContext.InputKey key = e.getKey(); + Object into = this.handedOver.computeIfAbsent(key, k -> key.create()); + key.copy(e.getValue(), into); + } + } + + public void afterFrame(Stage stage, ExtensionContext.Frame frame) { + for (var h : this.afterFrame) { + h.run(c -> c.accept(stage, frame)); + } + } + + public boolean wantsFrames() { + return !this.afterFrame.isEmpty(); + } + + // ---- one extension's view ------------------------------------------------------------------- + + private final class Context implements ExtensionContext { + private final Extension owner; + + Context(Extension owner) { + this.owner = owner; + } + + private Hook hook(T body) { + return new Hook<>(this.owner, body); + } + + @Override + public void onStageCreated(Consumer hook) { + ExtensionHost.this.stageCreated.add(this.hook(hook)); + } + + @Override + public void onStageDisposed(Consumer hook) { + ExtensionHost.this.stageDisposed.add(this.hook(hook)); + } + + @Override + public void beforeTick(Consumer hook) { + ExtensionHost.this.beforeTick.add(this.hook(hook)); + } + + @Override + public void onKey(Consumer hook) { + ExtensionHost.this.keys.add(this.hook(hook)); + } + + @Override + public void onMouse(Consumer hook) { + ExtensionHost.this.mice.add(this.hook(hook)); + } + + @Override + public void onExit(Runnable hook) { + Hook h = this.hook(hook); + ExtensionHost.this.game.onExit(() -> h.run(Runnable::run)); + } + + @Override + public void onLearnerError(Consumer hook) { + Hook> h = this.hook(hook); + ExtensionHost.this.game.onLearnerError( + e -> h.run(c -> c.accept(new LearnerError(e.error(), e.learnerFrame())))); + } + + @Override + public void addLayerDrawer(Layer layer, LayerDrawer drawer) { + ExtensionHost.this.layerDrawers.get(layer).add(this.hook(drawer)); + } + + @Override + public void addOverlayDrawer(LayerDrawer drawer) { + ExtensionHost.this.overlayDrawers.add(this.hook(drawer)); + } + + @Override + public void dispatch(Stage stage, Class listener, Consumer call) { + requireGameThread("dispatch"); + // learner code: its exceptions stop the game like any learner exception + try { + if (listener.isInstance(stage)) { + call.accept(listener.cast(stage)); + } + for (Sprite s : Game.spritesOf(stage)) { + if (listener.isInstance(s) && s.getStage() == stage) { + call.accept(listener.cast(s)); + } + } + } catch (LearnerCallFailed e) { + throw e; + } catch (RuntimeException | Error e) { + throw new LearnerCallFailed(e); + } + } + + @Override + @SuppressWarnings("unchecked") + public T input(InputKey key) { + requireGameThread("input"); + return (T) ExtensionHost.this.handedOver.computeIfAbsent(key, k -> key.create()); + } + + @Override + public long getTickCount() { + return ExtensionHost.this.game.getTickCount(); + } + + @Override + public boolean isLoading() { + return ExtensionHost.this.loading; + } + + @Override + public void onInputPoll(Consumer hook) { + ExtensionHost.this.polls.add(this.hook(hook)); + } + + @Override + public void afterFrame(BiConsumer hook) { + ExtensionHost.this.afterFrame.add(this.hook(hook)); + } + + @Override + public void runOnGameThread(Runnable task) { + ExtensionHost.this.game.runOnGameThread(task); + } + + @Override + public void registerImageFormat(String suffix, ImageDecoder decoder) { + IMAGE_FORMATS.put(suffix.toLowerCase(java.util.Locale.ROOT), decoder); + } + + private void requireGameThread(String method) { + if (!ExtensionHost.this.game.isGameThread()) { + throw new IllegalStateException(method + " belongs to the game thread, not to " + Thread.currentThread().getName() + + " (extension \"" + this.owner.id() + "\")."); + } + } + } + + /** Attachments: an extension's state per stage or sprite, made on first use. */ + public static final class Attachments { + private final Map, Object> values = new HashMap<>(); + + public synchronized T get(Class type, java.util.function.Supplier factory) { + return type.cast(this.values.computeIfAbsent(type, t -> factory.get())); + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/Extensions.java b/core/src/main/java/org/openpatch/scratch/internal/Extensions.java new file mode 100644 index 00000000..fee3b614 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/Extensions.java @@ -0,0 +1,89 @@ +package org.openpatch.scratch.internal; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.ServiceConfigurationError; +import java.util.ServiceLoader; +import org.openpatch.scratch.extension.Extension; + +/** Finds the extensions on the classpath and decides which of them may be installed. */ +public final class Extensions { + + private Extensions() {} + + /** + * The extensions found by {@link ServiceLoader} followed by {@code registered}, without + * duplicate ids (the first wins) and without those whose {@link Extension#requires()} the + * core does not meet. Each one left out is reported on {@code System.err} in one line. + */ + public static List discover(List registered, String coreVersion) { + List found = new ArrayList<>(); + ServiceLoader loader = ServiceLoader.load(Extension.class, Extensions.class.getClassLoader()); + for (var it = loader.iterator(); ; ) { + try { + if (!it.hasNext()) { + break; + } + found.add(it.next()); + } catch (ServiceConfigurationError e) { + System.err.println("Scratch for Java: an extension could not be loaded: " + e.getMessage()); + } + } + found.addAll(registered); + return select(found, coreVersion); + } + + static List select(List candidates, String coreVersion) { + Map byId = new LinkedHashMap<>(); + for (Extension e : candidates) { + Extension first = byId.get(e.id()); + if (first != null) { + System.err.printf("Scratch for Java: two extensions with the id \"%s\": %s is used, %s is not.%n", + e.id(), first.getClass().getName(), e.getClass().getName()); + continue; + } + if (!satisfies(e.requires(), coreVersion)) { + System.err.printf("Scratch for Java: %s %s needs Scratch for Java %s or newer below %d, " + + "but this is %s. It is not installed.%n", + e.name(), e.version(), e.requires(), major(e.requires()) + 1, coreVersion); + continue; + } + byId.put(e.id(), e); + } + return List.copyOf(byId.values()); + } + + /** Whether a core of version {@code core} meets {@code requires} (see {@link Extension#requires()}). */ + static boolean satisfies(String requires, String core) { + int[] need = parse(requires), have = parse(core); + if (need[0] != have[0]) { + return false; + } + for (int i = 1; i < 3; i++) { + if (have[i] != need[i]) { + return have[i] > need[i]; + } + } + return true; + } + + private static int major(String version) { + return parse(version)[0]; + } + + /** "7", "7.1" or "7.1.2", ignoring a suffix such as "-SNAPSHOT"; missing parts are 0. */ + private static int[] parse(String version) { + int[] parts = new int[3]; + String[] split = version.split("-", 2)[0].split("\\."); + for (int i = 0; i < Math.min(3, split.length); i++) { + try { + parts[i] = Integer.parseInt(split[i].trim()); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("not a version: \"" + version + "\"", e); + } + } + return parts; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/Game.java b/core/src/main/java/org/openpatch/scratch/internal/Game.java new file mode 100644 index 00000000..6ed7c875 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/Game.java @@ -0,0 +1,573 @@ +package org.openpatch.scratch.internal; + +import java.util.EnumSet; +import java.util.List; +import java.util.Queue; +import java.util.Set; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Consumer; +import org.openpatch.scratch.KeyCode; +import org.openpatch.scratch.MouseCode; +import org.openpatch.scratch.Stage; +import org.openpatch.scratch.internal.draw.DrawList; +import org.openpatch.scratch.internal.input.InputEvent; +import org.openpatch.scratch.internal.input.InputState; +import org.openpatch.scratch.internal.loop.TickClock; + +/** + * The running program, one per process: the stage size, the current stage, the ticks, the input + * the game thread sees, and what happens when learner code throws. {@code Window} creates it + * together with a GLFW window; tests create it with {@link #headless(int, int)} and call + * {@link #runTicks(int)} themselves, which makes the calling thread the game thread. Nothing here + * touches OpenGL. + * + *

Everything but {@link #post(InputEvent)}, {@link #runOnGameThread(Runnable)} and the + * getters for the stage size runs on the game thread. + */ +public final class Game { + + /** + * What the game needs from the scene classes, which keep their plumbing out of the public + * API: {@code Stage} registers the implementation when it is loaded (the JDK's "shared + * secrets" pattern). + */ + public interface Scene { + + /** Timers, broadcasts, glides, animations, then {@code run()} of the stage and its sprites. */ + void tick(Stage stage); + + /** Hands an input event to the stage and its sprites (whenKeyPressed, whenClicked, …). */ + void dispatch(Stage stage, InputEvent event); + + /** Describes the stage for the renderer. */ + DrawList draw(Stage stage, long tick); + + /** The stage becomes the current one, or stops being it. */ + void shown(Stage stage, boolean shown); + + /** Runs {@code whenExits()}. */ + void exit(Stage stage); + + /** + * The stage's sprites back to front, as a java.util.List: core code must not call getAll(), + * whose type differs in the NRW build. + */ + java.util.List sprites(Stage stage); + + /** The stage's id in draw lists. */ + int id(Stage stage); + } + + /** The stage's sprites back to front, whatever build this is (see {@link Scene#sprites}). */ + public static java.util.List spritesOf(Stage stage) { + return scene().sprites(stage); + } + + private static volatile Scene scene; + private static volatile Game current; + + private final int width; + private final int height; + private final boolean headless; + private final InputState input = new InputState(); + private final Queue events = new ConcurrentLinkedQueue<>(); + private volatile long makingStageSince; + private final Queue tasks = new ConcurrentLinkedQueue<>(); + private final List> errorListeners = new CopyOnWriteArrayList<>(); + // presses that happened on the current stage: only these get a release + private final Set keysPressedHere = EnumSet.noneOf(KeyCode.class); + private final Set buttonsPressedHere = EnumSet.noneOf(MouseCode.class); + + private volatile Stage stage; + private volatile long tick; + private volatile LearnerError stopped; + private volatile Thread gameThread; + private volatile boolean debug; + // which parts of debug mode are on: -Dscratch4j.debug presets them, the panel switches them + private final Set debugOptions = DebugOption.parse(System.getProperty("scratch4j.debug")); + private final DebugPanel debugPanel = new DebugPanel(); + private volatile boolean pixelArt; + private final List exitHooks = new CopyOnWriteArrayList<>(); + // read by the window's tick clock every frame + private volatile boolean paused; + private volatile double gameSpeed = 1; + private final java.util.concurrent.atomic.AtomicInteger steps = new java.util.concurrent.atomic.AtomicInteger(); + // a transition in progress (game thread only) + private Stage transitionFrom; + private DrawList transitionFromList; + private String transitionName, transitionSource; + private int transitionTicks, transitionTick; + /** From the request until the transition is over: further requests are ignored (6.x). */ + private final AtomicBoolean transitionAsked = new AtomicBoolean(); + + private final ExtensionHost extensions = new ExtensionHost(this); + + private Game(int width, int height, boolean headless) { + if (width <= 0 || height <= 0) { + throw new IllegalArgumentException("The stage needs a width and height above 0, not " + width + " x " + + height + "."); + } + this.width = width; + this.height = height; + this.headless = headless; + } + + /** Called by {@code Window}: the one game of this process. */ + public static synchronized Game start(int width, int height) { + if (current != null) { + throw new IllegalStateException("There can only be one window. Use setStage to show another stage."); + } + current = new Game(width, height, false); + return current; + } + + /** + * A game without a window, for tests: replaces any previous one. The thread that calls + * {@link #runTicks(int)} is its game thread. + */ + public static synchronized Game headless(int width, int height) { + current = new Game(width, height, true); + return current; + } + + /** The running game; a stage or sprite created before the window gets this message. */ + public static Game current() { + Game game = current; + if (game == null) { + throw new IllegalStateException( + "There is no window yet. Create it first, e.g. new Window(480, 360), then the stage."); + } + return game; + } + + /** The running game, or null before the window exists. */ + public static Game currentOrNull() { + return current; + } + + /** Called once by {@code Stage}'s static initializer. */ + public static void register(Scene implementation) { + scene = implementation; + } + + private static Scene scene() { + if (scene == null) { + // Stage registers itself when its class is initialised + try { + Class.forName(Stage.class.getName(), true, Stage.class.getClassLoader()); + } catch (ClassNotFoundException e) { + throw new IllegalStateException(e); + } + } + return scene; + } + + public int getWidth() { + return this.width; + } + + public int getHeight() { + return this.height; + } + + public boolean isHeadless() { + return this.headless; + } + + /** The installed extensions' hooks. */ + public ExtensionHost getExtensions() { + return this.extensions; + } + + public boolean isDebug() { + return this.debug; + } + + public void setDebug(boolean debug) { + this.debug = debug; + } + + /** Which parts of debug mode are shown; the debug panel switches these while it runs. */ + public Set getDebugOptions() { + return this.debugOptions; + } + + /** The panel that switches the debug options, shown while debug mode is on. */ + public DebugPanel getDebugPanel() { + return this.debugPanel; + } + + /** Pixel-art display mode: set by Window before the first stage. */ + public boolean isPixelArt() { + return this.pixelArt; + } + + public void setPixelArt(boolean pixelArt) { + this.pixelArt = pixelArt; + } + + // ---- pause and speed (any thread; the window's tick clock reads them) ----------- + + public boolean isPaused() { + return this.paused; + } + + public void setPaused(boolean paused) { + this.paused = paused; + } + + /** While paused: one more tick. */ + public void step() { + this.steps.incrementAndGet(); + } + + /** Steps asked for since the last call, for the tick clock. */ + public int takeSteps() { + return this.steps.getAndSet(0); + } + + public double getGameSpeed() { + return this.gameSpeed; + } + + public void setGameSpeed(double speed) { + if (!(speed >= 0 && speed <= TickClock.MAX_TICKS_PER_FRAME)) { + throw new IllegalArgumentException("The game speed has to be between 0 and 8, not " + speed + "."); + } + this.gameSpeed = speed; + } + + // ---- stages --------------------------------------------------------------- + + public Stage getStage() { + return this.stage; + } + + /** + * Shows {@code stage} from the next tick on. Presses on the old stage get no release on the new + * one. + */ + public void setStage(Stage stage) { + Stage old = this.stage; + if (old == stage) { + return; + } + this.stage = stage; + this.keysPressedHere.clear(); + this.buttonsPressedHere.clear(); + if (old != null) { + scene().shown(old, false); + this.extensions.stageDisposed(old); + } + if (stage != null) { + scene().shown(stage, true); + } + } + + /** + * Shows the stage {@code next} makes, through a transition: {@code next} runs on the game thread + * at the start of the next tick; the old stage stands still meanwhile, input is dropped, and the + * new stage's {@code run()} starts once the transition is over. Requests made meanwhile (also + * from inside {@code next}) are ignored, as in 6.x: two sprites touching a door in the same tick + * build one level, not two. Any thread. + * + * @param name a built-in transition's name, or a shader file + * @param source a transition shader's body, or null for a built-in one + */ + public void transition(java.util.function.Supplier next, String name, String source, + double seconds) { + if (!this.transitionAsked.compareAndSet(false, true)) { + return; + } + this.runOnGameThread(() -> { + Stage from = this.stage; + // the old stage's picture before the supplier runs: it may move sprites over to the new one + DrawList fromList = from == null ? null : scene().draw(from, this.tick); + Stage to; + this.makingStageSince = System.nanoTime(); + try { + to = next.get(); + } catch (Throwable t) { + this.transitionAsked.set(false); + throw t; + } finally { + this.makingStageSince = 0; + } + int ticks = (int) Math.round(seconds * 60); + if (from == null || ticks <= 0) { + this.setStage(to); + this.transitionAsked.set(false); + return; + } + this.transitionFromList = fromList; + this.transitionFrom = from; + this.transitionName = name; + this.transitionSource = source; + this.transitionTicks = ticks; + this.transitionTick = 0; + this.setStage(to); + }); + } + + /** + * Since when ({@code System.nanoTime()}) a transition's stage supplier has been running, or 0: + * the window shows the loading screen when it takes long. Any thread. + */ + public long makingStageSince() { + return this.makingStageSince; + } + + /** Drops input that arrived while nothing could take it (the loading screen). Any thread. */ + public void dropInput() { + this.events.clear(); + } + + /** + * Drops input during a transition: no handler sees it, but what is held follows it, so a key + * released meanwhile is not stuck down afterwards. Game thread. + */ + private void dropInputDuringTransition() { + for (InputEvent event; (event = this.events.poll()) != null; ) { + if (event instanceof InputEvent.Key k && !k.pressed()) { + this.keysPressedHere.remove(k.key()); + } else if (event instanceof InputEvent.Button b && !b.pressed()) { + this.buttonsPressedHere.remove(b.button()); + } + this.input.apply(event); + } + } + + /** Whether a transition is in progress (game thread). */ + public boolean isTransitioning() { + return this.transitionFrom != null; + } + + // ---- ticks ------------------------------------------------------------------ + + /** Ticks run so far. */ + public long getTickCount() { + return this.tick; + } + + /** Game time in seconds: ticks × 1/60. Stops while paused, follows the game speed. */ + public double getTime() { + return this.tick * TickClock.TICK; + } + + /** The thread running the ticks, or null before the first tick. */ + public Thread getGameThread() { + return this.gameThread; + } + + /** Whether the current thread is the game thread (true before the first tick, for set-up code). */ + public boolean isGameThread() { + Thread t = this.gameThread; + return t == null || t == Thread.currentThread(); + } + + /** + * Runs a batch of ticks on the calling thread, which becomes the game thread. The batch's first + * tick gets the input queued since the last batch. After a learner exception nothing runs any + * more. + */ + public void runTicks(int ticks) { + this.gameThread = Thread.currentThread(); + for (int i = 0; i < ticks && this.stopped == null; i++) { + this.tick(i == 0); + } + } + + private void tick(boolean first) { + try { + for (Runnable task; (task = this.tasks.poll()) != null; ) { + task.run(); + } + Stage stage = this.stage; + if (this.transitionFrom != null) { + // both stages stand still and input is dropped + this.dropInputDuringTransition(); + if (++this.transitionTick >= this.transitionTicks) { + this.transitionFrom = null; + this.transitionFromList = null; + this.transitionAsked.set(false); + } + return; + } + if (first) { + this.deliverInput(stage); + } + if (stage != null) { + this.extensions.beforeTick(stage); + scene().tick(stage); + } + } catch (Throwable t) { + this.failLearner(t); + } finally { + this.tick++; + } + } + + /** + * Hands out queued input without running a tick: while paused, events still reach learner + * code (6.x documents it for keys). Called by the window instead of a batch of 0 ticks. + */ + public void runInputOnly() { + this.gameThread = Thread.currentThread(); + if (this.stopped != null) { + return; + } + try { + for (Runnable task; (task = this.tasks.poll()) != null; ) { + task.run(); + } + if (this.transitionFrom == null) { + this.deliverInput(this.stage); + } + } catch (Throwable t) { + this.stop(LearnerError.of(t)); + } + } + + private void deliverInput(Stage stage) { + for (InputEvent event; (event = this.events.poll()) != null; ) { + this.input(stage, event); + } + } + + private void input(Stage stage, InputEvent event) { + boolean deliver = true; + if (event instanceof InputEvent.Key k) { + if (k.pressed()) { + this.keysPressedHere.add(k.key()); + } else { + deliver = this.keysPressedHere.remove(k.key()); + } + } else if (event instanceof InputEvent.Button b) { + if (this.debug && b.pressed() + && this.debugPanel.press(b.x(), b.y(), this.width, this.height, this.debugOptions)) { + return; // a click on the debug panel: neither the learner nor the mouse state sees it + } + if (b.pressed()) { + this.buttonsPressedHere.add(b.button()); + } else { + deliver = this.buttonsPressedHere.remove(b.button()); + } + } + this.input.apply(event); + if (event instanceof InputEvent.Key k) { + this.extensions.key(new org.openpatch.scratch.extension.ExtensionContext.KeyEvent(k.key(), k.pressed())); + } else if (event instanceof InputEvent.Button b) { + this.extensions.mouse(new org.openpatch.scratch.extension.ExtensionContext.MouseEvent(b.pressed() + ? org.openpatch.scratch.extension.ExtensionContext.MouseEvent.Kind.PRESS + : org.openpatch.scratch.extension.ExtensionContext.MouseEvent.Kind.RELEASE, b.button(), b.x(), b.y(), 0)); + } else if (event instanceof InputEvent.Move m) { + this.extensions.mouse(new org.openpatch.scratch.extension.ExtensionContext.MouseEvent( + org.openpatch.scratch.extension.ExtensionContext.MouseEvent.Kind.MOVE, null, m.x(), m.y(), 0)); + } else if (event instanceof InputEvent.Wheel w) { + this.extensions.mouse(new org.openpatch.scratch.extension.ExtensionContext.MouseEvent( + org.openpatch.scratch.extension.ExtensionContext.MouseEvent.Kind.WHEEL, null, this.input.getMouseX(), + this.input.getMouseY(), w.steps())); + } + if (deliver && stage != null) { + scene().dispatch(stage, event); + } + } + + /** Describes the current stage for the renderer; called after a batch, on the game thread. */ + public DrawList drawList() { + Stage stage = this.stage; + if (stage == null) { + return null; + } + DrawList list = scene().draw(stage, this.tick); + if (this.transitionFrom != null) { + list = list.withTransition(new org.openpatch.scratch.internal.draw.TransitionDraw(this.transitionFromList, + this.transitionName, this.transitionSource, this.transitionTick / (double) this.transitionTicks)); + } + return list; + } + + /** The id the current stage's draw lists carry, or 0 without a stage. */ + public int drawListStageId() { + Stage stage = this.stage; + return stage == null ? 0 : scene().id(stage); + } + + /** The keyboard and mouse as the game thread sees them in this tick. */ + public InputState getInput() { + return this.input; + } + + /** Queues an event for the start of the next batch; any thread. */ + public void post(InputEvent event) { + this.events.add(event); + } + + /** Runs {@code task} at the start of the next tick, before input; any thread. */ + public void runOnGameThread(Runnable task) { + this.tasks.add(task); + } + + // ---- learner errors and the end ------------------------------------------------ + + /** Called with every learner exception that stops the game (Studio's IDE control). */ + public void onLearnerError(Consumer listener) { + this.errorListeners.add(listener); + } + + /** The exception that stopped the game, or null while it runs. */ + public LearnerError getStopped() { + return this.stopped; + } + + /** Learner code threw (directly, or through an extension's dispatch): the game stops. */ + public void failLearner(Throwable t) { + if (t instanceof ExtensionHost.LearnerCallFailed && t.getCause() != null) { + t = t.getCause(); + } + if (this.stopped == null) { + this.stop(LearnerError.of(t)); + } + } + + private void stop(LearnerError error) { + this.stopped = error; + System.err.print(error.message()); + if (Boolean.getBoolean("scratch4j.fullTraces") || error.learnerFrame() == null) { + error.error().printStackTrace(); + } + for (Consumer listener : this.errorListeners) { + try { + listener.accept(error); + } catch (RuntimeException e) { + e.printStackTrace(); + } + } + } + + /** Runs at the end, on the game thread: {@code Window.whenExits()}, extensions' onExit. */ + public void onExit(Runnable hook) { + this.exitHooks.add(hook); + } + + /** The end of the program, on the game thread: the stage's and the exit hooks. */ + public void exit() { + Stage stage = this.stage; + if (stage != null) { + try { + scene().exit(stage); + } catch (Throwable t) { + System.err.print(LearnerError.of(t).message()); + } + } + for (Runnable hook : this.exitHooks) { + try { + hook.run(); + } catch (Throwable t) { + System.err.print(LearnerError.of(t).message()); + } + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/LearnerError.java b/core/src/main/java/org/openpatch/scratch/internal/LearnerError.java new file mode 100644 index 00000000..fb581da1 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/LearnerError.java @@ -0,0 +1,95 @@ +package org.openpatch.scratch.internal; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * An exception from learner code, with the learner's frame found: the first stack frame outside + * the library, the JDK and LWJGL. That is the line a learner has to look at, so it is named + * first. + * + * @param error what was thrown + * @param learnerFrame the learner's frame, or null if the trace has none (an error inside the + * library) + */ +public record LearnerError(Throwable error, StackTraceElement learnerFrame) { + + private static final String[] PLATFORM = {"java.", "javax.", "jdk.", "sun.", "com.sun.", "org.lwjgl."}; + + /** Finds the learner's frame of {@code error}. */ + public static LearnerError of(Throwable error) { + return new LearnerError(error, learnerFrame(error.getStackTrace())); + } + + /** The first frame of a learner class, or null. */ + public static StackTraceElement learnerFrame(StackTraceElement[] trace) { + for (StackTraceElement e : trace) { + if (isLearnerFrame(e)) { + return e; + } + } + return null; + } + + /** + * Whether a frame belongs to learner code. A class counts as the library's when it was loaded + * from the library's own jar or folder, so the library's tests and examples count as learner + * code although they share its package names. + */ + public static boolean isLearnerFrame(StackTraceElement e) { + String name = e.getClassName(); + for (String prefix : PLATFORM) { + if (name.startsWith(prefix)) { + return false; + } + } + if (!name.startsWith("org.openpatch.scratch.")) { + return true; + } + try { + Class type = Class.forName(name, false, LearnerError.class.getClassLoader()); + return !Objects.equals(location(type), location(LearnerError.class)); + } catch (ClassNotFoundException | LinkageError | SecurityException ex) { + return false; + } + } + + private static Object location(Class type) { + var domain = type.getProtectionDomain(); + return domain == null || domain.getCodeSource() == null ? null : domain.getCodeSource().getLocation(); + } + + /** {@code MySprite.run (MySprite.java:12)}, or the exception's own first frame. */ + public static String describe(StackTraceElement e) { + String simple = e.getClassName().substring(e.getClassName().lastIndexOf('.') + 1); + return simple + "." + e.getMethodName() + " (" + e.getFileName() + ":" + e.getLineNumber() + ")"; + } + + /** + * What is printed for a learner: the place in the learner's code, then what happened, then the + * learner's frames, then the full trace for the curious. + */ + public String message() { + StringBuilder out = new StringBuilder(); + String what = this.error.getClass().getSimpleName() + + (this.error.getMessage() == null ? "" : ": " + this.error.getMessage()); + if (this.learnerFrame != null) { + out.append("Error in ").append(describe(this.learnerFrame)).append(": ").append(what).append('\n'); + } else { + out.append("Error: ").append(what).append('\n'); + } + List learner = new ArrayList<>(); + for (StackTraceElement e : this.error.getStackTrace()) { + if (isLearnerFrame(e)) { + learner.add(e); + } + } + for (StackTraceElement e : learner) { + out.append(" at ").append(e).append('\n'); + } + // a released game ends with an error box instead (Release) + out.append(Release.isOn() ? "The game has stopped.\n" : "The game has stopped. The window stays open until you close it.\n"); + return out.toString(); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/Monitor.java b/core/src/main/java/org/openpatch/scratch/internal/Monitor.java new file mode 100644 index 00000000..f4b812d8 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/Monitor.java @@ -0,0 +1,58 @@ +package org.openpatch.scratch.internal; + +import java.util.function.Supplier; +import org.openpatch.scratch.internal.draw.MonitorDraw; +import org.openpatch.scratch.internal.text.Font; +import org.openpatch.scratch.internal.text.TextLayout; + +/** A variable shown on the stage, read when the draw list is made (on the game thread). */ +public final class Monitor { + + private static final double SIZE = 12; + + private final String label; + private final Supplier value; + + public Monitor(String label, Supplier value) { + this.label = label; + this.value = value; + } + + /** The value as text: whole doubles without ".0", others to two places; "?" if reading fails. */ + public String text() { + Object current; + try { + current = this.value.get(); + } catch (RuntimeException e) { + return "?"; + } + return format(current); + } + + static String format(Object value) { + if (value == null) { + return ""; + } + if (value instanceof Double || value instanceof Float) { + double d = ((Number) value).doubleValue(); + if (d == Math.rint(d) && Math.abs(d) < 1e15) { + return String.valueOf((long) d); + } + return String.valueOf(Math.round(d * 100) / 100.0); + } + if (value instanceof int[] a) { + return java.util.Arrays.toString(a); + } + if (value instanceof double[] a) { + return java.util.Arrays.toString(a); + } + if (value instanceof Object[] a) { + return java.util.Arrays.toString(a); + } + return String.valueOf(value); + } + + public MonitorDraw toDraw(Font font, double x, double y) { + return new MonitorDraw(TextLayout.of(this.label, font, SIZE, 0), TextLayout.of(this.text(), font, SIZE, 0), x, y); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/Natives.java b/core/src/main/java/org/openpatch/scratch/internal/Natives.java new file mode 100644 index 00000000..38fba11b --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/Natives.java @@ -0,0 +1,24 @@ +package org.openpatch.scratch.internal; + +/** Settings LWJGL must see before it loads; call {@link #init()} before the first LWJGL call. */ +public final class Natives { + + private static boolean done; + + private Natives() {} + + /** + * On Java 25 and newer, LWJGL's default memory backend uses {@code sun.misc.Unsafe}, which the + * JDK warns about; its FFM backend (in the jar's {@code META-INF/versions/25}, hence the fat + * jar's {@code Multi-Release}) does not. A choice made with the system property wins. + */ + public static synchronized void init() { + if (done) { + return; + } + done = true; + if (Runtime.version().feature() >= 25 && System.getProperty("org.lwjgl.system.memoryBackend") == null) { + System.setProperty("org.lwjgl.system.memoryBackend", "org.lwjgl.system.MemoryBackendFFM"); + } + } +} diff --git a/src/main/java/org/openpatch/scratch/internal/NrwList.java b/core/src/main/java/org/openpatch/scratch/internal/NrwList.java similarity index 100% rename from src/main/java/org/openpatch/scratch/internal/NrwList.java rename to core/src/main/java/org/openpatch/scratch/internal/NrwList.java diff --git a/src/main/java/org/openpatch/scratch/internal/OpenSimplex2S.java b/core/src/main/java/org/openpatch/scratch/internal/OpenSimplex2S.java similarity index 100% rename from src/main/java/org/openpatch/scratch/internal/OpenSimplex2S.java rename to core/src/main/java/org/openpatch/scratch/internal/OpenSimplex2S.java diff --git a/core/src/main/java/org/openpatch/scratch/internal/Preview.java b/core/src/main/java/org/openpatch/scratch/internal/Preview.java new file mode 100644 index 00000000..dc8ee6bd --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/Preview.java @@ -0,0 +1,307 @@ +package org.openpatch.scratch.internal; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.openpatch.scratch.Layer; +import org.openpatch.scratch.Sprite; +import org.openpatch.scratch.Stage; + +/** + * What Studio's stage designer needs from a running program: {@code frame.png} (the stage at stage + * size) and {@code stage.json} (its sprites, which fields hold them, where they are). + * + *

    + *
  • {@code -Dscratch4j.preview=}: the first frame of the stage (or of the stage class + * {@code -Dscratch4j.preview.stage=}), then the program ends; the sprites in the + * fields {@code -Dscratch4j.preview.omit=a,b} are left out of the picture. + *
  • {@code -Dscratch4j.capture=}: the first frame of every stage into + * {@code //} while the program keeps running + * ({@code -Dscratch4j.capture.omit=Stage:a,b;Other:c}). + *
+ * + *

The description is made on the game thread (it reads the stage's fields); the picture is + * taken on the window thread from the draw list made right after it. + */ +public final class Preview { + + static final long TIMEOUT_MILLIS = 30_000; + private static final String FOLDER = System.getProperty("scratch4j.preview"); + private static final String STAGE = System.getProperty("scratch4j.preview.stage"); + private static final Set OMIT = names(System.getProperty("scratch4j.preview.omit")); + private static final String CAPTURE = System.getProperty("scratch4j.capture"); + private static final Map> CAPTURE_OMIT = omitByStage(System.getProperty("scratch4j.capture.omit")); + + /** A picture to take: where, and the description to write next to it. */ + public record Shot(int stageId, Path folder, String json, boolean thenExit) {} + + private static final Set described = Collections.synchronizedSet(new LinkedHashSet<>()); + private static volatile Shot pending; + private static volatile boolean done; + private static boolean requested; + private static List hidden = List.of(); + + private Preview() {} + + public static boolean isPreview() { + return FOLDER != null && !FOLDER.isBlank(); + } + + public static boolean isCapture() { + return CAPTURE != null && !CAPTURE.isBlank(); + } + + /** Window thread, once: a preview that never gets a stage still ends, with a message for Studio. */ + public static void startTimeout() { + if (!isPreview()) { + return; + } + Thread timeout = new Thread(() -> { + try { + Thread.sleep(TIMEOUT_MILLIS); + } catch (InterruptedException e) { + return; + } + if (!done) { + fail("No stage was shown within " + TIMEOUT_MILLIS / 1000 + " seconds."); + } + }, "scratch4j-preview-timeout"); + timeout.setDaemon(true); + timeout.start(); + } + + /** + * Game thread, after a batch and before its draw list: describes the stage the first time it is + * shown (after its first tick), hides omitted sprites for the picture. + */ + public static void beforeDraw(Game game) { + if (done || (!isPreview() && !isCapture()) || game.getTickCount() == 0) { + return; + } + Stage stage = game.getStage(); + if (stage == null) { + return; + } + String name = stage.getClass().getSimpleName(); + if (isPreview() && STAGE != null && !STAGE.isBlank() && !name.equals(STAGE) + && !stage.getClass().getName().equals(STAGE)) { + if (!requested) { + requested = true; + game.setStage(make(stage.getClass().getClassLoader(), stage.getClass().getPackageName())); + } + return; + } + int id = stageId(game); + if (!described.add(id)) { + return; + } + Set omit = isPreview() ? OMIT : CAPTURE_OMIT.getOrDefault(name, Set.of()); + Map fields = fieldsOf(stage); + List sprites = Game.spritesOf(stage); + List visible = new ArrayList<>(); + List hide = new ArrayList<>(); + for (Sprite s : sprites) { + visible.add(s.isVisible()); + String field = fields.get(s); + if (field != null && omit.contains(field) && s.isVisible()) { + hide.add(s); + } + } + String json = describe(game, stage, sprites, visible, fields, omit); + for (Sprite s : hide) { + s.hide(); + } + hidden = hide; + Path folder = isPreview() ? Path.of(FOLDER) : Path.of(CAPTURE).resolve(name); + pending = new Shot(id, folder, json, isPreview()); + if (isPreview()) { + done = true; + } + } + + /** Game thread, right after the draw list: omitted sprites show again. */ + public static void afterDraw() { + for (Sprite s : hidden) { + s.show(); + } + hidden = List.of(); + } + + /** Window thread: the picture to take for this draw list, if any (taken once). */ + public static Shot take(int stageId) { + Shot shot = pending; + if (shot != null && shot.stageId() == stageId) { + pending = null; + return shot; + } + return null; + } + + /** Writes {@code stage.json} after {@code frame.png}: an editor waiting for it then finds both. */ + public static void write(Shot shot) throws IOException { + Files.createDirectories(shot.folder()); + Files.writeString(shot.folder().resolve("stage.json"), shot.json(), StandardCharsets.UTF_8); + } + + private static int stageId(Game game) { + return game.drawListStageId(); + } + + private static Stage make(ClassLoader loader, String packageName) { + List names = new ArrayList<>(); + names.add(STAGE); + if (!packageName.isEmpty() && !STAGE.contains(".")) { + names.add(packageName + "." + STAGE); + } + for (String name : names) { + try { + Class type = Class.forName(name, true, loader); + var constructor = type.getDeclaredConstructor(); + constructor.setAccessible(true); + return (Stage) constructor.newInstance(); + } catch (ClassNotFoundException e) { + // try the next name + } catch (NoSuchMethodException e) { + fail(STAGE + " has no constructor without arguments, so it cannot be previewed on its own."); + } catch (ReflectiveOperationException | RuntimeException e) { + Throwable cause = e.getCause() == null ? e : e.getCause(); + fail("Making " + STAGE + " failed: " + cause); + } + } + fail("There is no stage class " + STAGE + "."); + return null; + } + + /** Which field of the stage holds which sprite: the stage designer edits the constructor by them. */ + private static Map fieldsOf(Stage stage) { + Map out = new IdentityHashMap<>(); + for (Class type = stage.getClass(); type != null && type != Stage.class; type = type.getSuperclass()) { + for (Field field : type.getDeclaredFields()) { + if (!Sprite.class.isAssignableFrom(field.getType())) { + continue; + } + try { + field.setAccessible(true); + if (field.get(stage) instanceof Sprite sprite) { + out.putIfAbsent(sprite, field.getName()); + } + } catch (ReflectiveOperationException | RuntimeException e) { + // a field we may not read: the sprite stays unnamed + } + } + } + return out; + } + + private static String describe(Game game, Stage stage, List sprites, List visible, + Map fields, Set omit) { + var camera = stage.getCamera(); + StringBuilder json = new StringBuilder("{\n"); + json.append(" \"stage\": ").append(string(stage.getClass().getName())).append(",\n"); + json.append(" \"width\": ").append(game.getWidth()).append(",\n"); + json.append(" \"height\": ").append(game.getHeight()).append(",\n"); + json.append(" \"camera\": {\"x\": ").append(number(camera.getX())).append(", \"y\": ") + .append(number(camera.getY())).append(", \"zoom\": ").append(number(camera.getZoom())).append("},\n"); + json.append(" \"sprites\": ["); + for (int i = 0; i < sprites.size(); i++) { + Sprite s = sprites.get(i); + String field = fields.get(s); + json.append(i == 0 ? "\n" : ",\n").append(" {") + .append("\"class\": ").append(string(s.getClass().getName())) + .append(", \"field\": ").append(field == null ? "null" : string(field)) + .append(", \"x\": ").append(number(s.getX())) + .append(", \"y\": ").append(number(s.getY())) + .append(", \"width\": ").append(number(s.getWidth())) + .append(", \"height\": ").append(number(s.getHeight())) + .append(", \"direction\": ").append(number(s.getDirection())) + .append(", \"size\": ").append(number(s.getSize())) + .append(", \"costume\": ").append(string(s.getCurrentCostumeName())) + .append(", \"visible\": ").append(visible.get(i)) + .append(", \"ui\": ").append(s.getLayer() == Layer.UI) + .append(", \"layer\": ").append(string(s.getLayer().name())) + .append(", \"omitted\": ").append(field != null && omit.contains(field)) + .append("}"); + } + json.append(sprites.isEmpty() ? "]\n" : "\n ]\n").append("}\n"); + return json.toString(); + } + + /** Ends a preview that cannot be made: {@code stage.json} holds the reason, for Studio to show. */ + static void fail(String reason) { + done = true; + try { + Path folder = Path.of(FOLDER); + Files.createDirectories(folder); + Files.deleteIfExists(folder.resolve("frame.png")); + Files.writeString(folder.resolve("stage.json"), "{\n \"error\": " + string(reason) + "\n}\n", + StandardCharsets.UTF_8); + } catch (IOException e) { + System.err.println("scratch4j preview: " + reason); + } + Runtime.getRuntime().halt(2); + } + + private static Set names(String list) { + Set out = new LinkedHashSet<>(); + if (list != null) { + for (String name : list.split(",")) { + if (!name.isBlank()) { + out.add(name.strip()); + } + } + } + return out; + } + + private static Map> omitByStage(String spec) { + Map> out = new HashMap<>(); + if (spec != null) { + for (String part : spec.split(";")) { + int colon = part.indexOf(':'); + if (colon > 0) { + out.put(part.substring(0, colon).strip(), names(part.substring(colon + 1))); + } + } + } + return out; + } + + private static String number(double value) { + return value == Math.rint(value) && Math.abs(value) < 1e15 ? Long.toString((long) value) + : Double.toString(value); + } + + private static String string(String value) { + if (value == null) { + return "null"; + } + StringBuilder out = new StringBuilder("\""); + for (char c : value.toCharArray()) { + switch (c) { + case '"' -> out.append("\\\""); + case '\\' -> out.append("\\\\"); + case '\n' -> out.append("\\n"); + case '\r' -> out.append("\\r"); + case '\t' -> out.append("\\t"); + default -> { + if (c < 0x20) { + out.append(String.format("\\u%04x", (int) c)); + } else { + out.append(c); + } + } + } + } + return out.append('"').toString(); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/Release.java b/core/src/main/java/org/openpatch/scratch/internal/Release.java new file mode 100644 index 00000000..7d3fcbb1 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/Release.java @@ -0,0 +1,178 @@ +package org.openpatch.scratch.internal; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.Locale; +import org.lwjgl.util.tinyfd.TinyFileDialogs; + +/** + * A released game: started with + * {@code -Dscratch4j.release=} (Studio's export sets it), the program copies what it + * prints to {@code //logs/latest.log} (the run before kept as + * {@code previous.log}) and, when it crashes, says so in a native message box naming that log + * before it ends. Without the property nothing changes: in class, the console shows the error and + * the window stays open. + */ +public final class Release { + + private static final String NAME = System.getProperty("scratch4j.release"); + private static volatile Path log; + + private Release() {} + + /** Whether this run is a released game. */ + public static boolean isOn() { + return NAME != null && !NAME.isBlank(); + } + + /** Once, before anything is printed: stdout and stderr go to the log file as well. */ + public static synchronized void start() { + if (!isOn() || log != null) { + return; + } + try { + Path folder = dataFolder(System.getProperty("os.name"), Path.of(System.getProperty("user.home")), + System.getenv("LOCALAPPDATA"), System.getenv("XDG_DATA_HOME")).resolve(safe(NAME)).resolve("logs"); + Files.createDirectories(folder); + Path latest = folder.resolve("latest.log"); + if (Files.exists(latest)) { + Files.move(latest, folder.resolve("previous.log"), StandardCopyOption.REPLACE_EXISTING); + } + OutputStream file = new FileOutputStream(latest.toFile()); + System.setOut(new PrintStream(new Both(System.out, file), true, StandardCharsets.UTF_8)); + System.setErr(new PrintStream(new Both(System.err, file), true, StandardCharsets.UTF_8)); + log = latest; + System.out.println(NAME + " (Scratch for Java " + Release.class.getPackage().getImplementationVersion() + + ", Java " + System.getProperty("java.version") + ", " + System.getProperty("os.name") + " " + + System.getProperty("os.arch") + ")"); + } catch (IOException | RuntimeException e) { + System.err.println("Scratch for Java: could not open the log file: " + e); + } + } + + /** + * In a released game: an error box saying the game crashed and where its log is (blocks until + * closed). Does nothing otherwise. + * + * @param what one sentence on what went wrong + */ + public static void crashed(String what) { + if (!isOn()) { + return; + } + String message = what + "\n\n" + (log != null ? "The log is at\n" + log : "There is no log file."); + System.err.println(message); + try { + TinyFileDialogs.tinyfd_messageBox(boxText(NAME), wrap(boxText(message), 70), "ok", "error", 1); + } catch (Throwable t) { + System.err.println("Scratch for Java: could not show the error box: " + t); + } + } + + /** + * Text tinyfd accepts: it refuses ' " ` and $ before a letter (it hands the text to a shell), + * showing "INVALID MESSAGE WITH QUOTES" instead; and zenity reads it as Pango markup, falling + * back to its own "An error has occurred" for {@code }. Look-alikes read the same + * everywhere, where escaping would show {@code <} on Windows and macOS. + */ + static String boxText(String text) { + return text.replace('"', '\u201d').replace('\'', '\u2019').replace('`', '\u2019').replace('$', '.') + .replace('<', '\u2039').replace('>', '\u203a').replace('&', '+'); + } + + /** Lines of at most {@code width} characters (tinyfd does not wrap), broken after a space or a slash. */ + static String wrap(String text, int width) { + StringBuilder out = new StringBuilder(); + for (String line : text.split("\n", -1)) { + while (line.length() > width) { + int at = Math.max(line.lastIndexOf(' ', width), Math.max(line.lastIndexOf('/', width - 1), + line.lastIndexOf('\\', width - 1))); + int cut = at > 0 ? at + 1 : width; + out.append(line.substring(0, cut).stripTrailing()).append('\n'); + line = line.substring(cut).stripLeading(); + } + out.append(line).append('\n'); + } + return out.substring(0, out.length() - 1); + } + + /** Where per-user data lives: as the save extension's {@code SaveData}, kept the same by hand. */ + static Path dataFolder(String os, Path home, String localAppData, String xdgDataHome) { + os = os.toLowerCase(Locale.ROOT); + if (os.startsWith("windows")) { + return absolute(localAppData) != null ? absolute(localAppData) : home.resolve("AppData/Local"); + } + if (os.startsWith("mac") || os.startsWith("darwin")) { + return home.resolve("Library/Application Support"); + } + return absolute(xdgDataHome) != null ? absolute(xdgDataHome) : home.resolve(".local/share"); + } + + private static Path absolute(String value) { + if (value == null || value.isBlank()) { + return null; + } + Path path = Path.of(value); + return path.isAbsolute() ? path : null; + } + + /** A game name as a folder name: letters, digits, dot, dash, underscore. */ + static String safe(String name) { + String folder = name.strip().replaceAll("[^A-Za-z0-9._-]", "_").replaceAll("^\\.+", "_"); + return folder.isEmpty() ? "game" : folder; + } + + /** Writes to the console and the file; a full disk does not stop the game. */ + private static final class Both extends OutputStream { + private final OutputStream console; + private final OutputStream file; + private boolean fileFailed; + + Both(OutputStream console, OutputStream file) { + this.console = console; + this.file = file; + } + + @Override + public synchronized void write(int b) throws IOException { + this.console.write(b); + if (!this.fileFailed) { + try { + this.file.write(b); + } catch (IOException e) { + this.fileFailed = true; + } + } + } + + @Override + public synchronized void write(byte[] b, int off, int len) throws IOException { + this.console.write(b, off, len); + if (!this.fileFailed) { + try { + this.file.write(b, off, len); + } catch (IOException e) { + this.fileFailed = true; + } + } + } + + @Override + public synchronized void flush() throws IOException { + this.console.flush(); + if (!this.fileFailed) { + try { + this.file.flush(); + } catch (IOException e) { + this.fileFailed = true; + } + } + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/SoundBank.java b/core/src/main/java/org/openpatch/scratch/internal/SoundBank.java new file mode 100644 index 00000000..3997609b --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/SoundBank.java @@ -0,0 +1,123 @@ +package org.openpatch.scratch.internal; + +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import org.openpatch.scratch.internal.audio.AudioEngine; +import org.openpatch.scratch.internal.audio.SoundData; + +/** + * The sounds of a sprite or stage, by name: each decoded once (shared by path across the + * program), the "main" playback per name for {@code playSound}, and the object's volume. + */ +public final class SoundBank { + + private static final Map DECODED = new ConcurrentHashMap<>(); + + private final Map sounds = new LinkedHashMap<>(); + private final Map playing = new LinkedHashMap<>(); + private final Set copies = new HashSet<>(); + private final Set warned = new HashSet<>(); + private double volume = 100; + + /** A bank for a clone: the same sounds and volume, nothing playing. */ + public SoundBank copy() { + SoundBank copy = new SoundBank(); + copy.sounds.putAll(this.sounds); + copy.volume = this.volume; + return copy; + } + + /** Decodes a WAV or OGG file into the cache {@link #add} reads (the assets preloader). */ + public static void preload(String path) { + DECODED.computeIfAbsent(path, SoundData::load); + } + + /** Decodes a WAV or OGG file (once per path in the program) and names it. */ + public void add(String name, String path) { + this.sounds.put(name, DECODED.computeIfAbsent(path, p -> { + SoundData data = SoundData.load(p); + Assets.noteLoadedLate("sound", p); + return data; + })); + } + + /** Starts a sound unless it is playing already. */ + public void play(String name) { + SoundData data = this.find(name); + if (data == null) { + return; + } + Integer handle = this.playing.get(name); + AudioEngine engine = AudioEngine.get(); + if (handle != null && engine.isPlaying(handle)) { + return; + } + this.playing.put(name, engine.play(engine.buffer(data), this.volume / 100, false)); + } + + /** Starts another copy of a sound, at a volume of its own (0–100); returns its handle. */ + public int playCopy(String name, double volume) { + SoundData data = this.find(name); + if (data == null) { + return 0; + } + AudioEngine engine = AudioEngine.get(); + int handle = engine.play(engine.buffer(data), clamp(volume) / 100 * this.volume / 100, false); + this.copies.add(handle); + return handle; + } + + public boolean isPlaying(String name) { + Integer handle = this.playing.get(name); + return handle != null && AudioEngine.get().isPlaying(handle); + } + + public void stop(String name) { + Integer handle = this.playing.remove(name); + if (handle != null) { + AudioEngine.get().stop(handle); + } + } + + /** Stops this object's sounds, copies included; other objects' sounds play on. */ + public void stopAll() { + AudioEngine engine = AudioEngine.get(); + for (int handle : this.playing.values()) { + engine.stop(handle); + } + for (int handle : this.copies) { + engine.stop(handle); + } + this.playing.clear(); + this.copies.clear(); + } + + public double getVolume() { + return this.volume; + } + + /** Scratch's volume, 0–100, for the sounds playing now and the ones to come. */ + public void setVolume(double volume) { + this.volume = clamp(volume); + AudioEngine engine = AudioEngine.get(); + for (int handle : this.playing.values()) { + engine.setVolume(handle, this.volume / 100); + } + } + + private SoundData find(String name) { + SoundData data = this.sounds.get(name); + if (data == null && this.warned.add(name)) { + System.err.println("Scratch for Java: there is no sound called \"" + name + "\". " + + (this.sounds.isEmpty() ? "Add it first with addSound." : "Sounds: " + this.sounds.keySet())); + } + return data; + } + + private static double clamp(double v) { + return Math.max(0, Math.min(100, v)); + } +} diff --git a/src/main/java/org/openpatch/scratch/internal/Suggestions.java b/core/src/main/java/org/openpatch/scratch/internal/Suggestions.java similarity index 100% rename from src/main/java/org/openpatch/scratch/internal/Suggestions.java rename to core/src/main/java/org/openpatch/scratch/internal/Suggestions.java diff --git a/core/src/main/java/org/openpatch/scratch/internal/audio/AudioEngine.java b/core/src/main/java/org/openpatch/scratch/internal/audio/AudioEngine.java new file mode 100644 index 00000000..ea0e049c --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/audio/AudioEngine.java @@ -0,0 +1,275 @@ +package org.openpatch.scratch.internal.audio; + +import static org.lwjgl.openal.AL10.*; +import static org.lwjgl.openal.ALC10.*; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.IntBuffer; +import java.util.Arrays; +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.Map; +import org.lwjgl.openal.AL; +import org.lwjgl.openal.ALC; +import org.lwjgl.openal.ALCCapabilities; +import org.lwjgl.system.MemoryUtil; +import org.openpatch.scratch.internal.Natives; + +/** + * The one OpenAL connection of the process: every sound uploads once into a buffer and plays on a + * pool of sources, so the same sound can ring out many times at once. + */ +public final class AudioEngine { + + private static final int POOL = 32; + + private static AudioEngine instance; + + private final boolean silent; + private long device; + private long context; + private final int[] sources = new int[POOL]; + private final long[] started = new long[POOL]; // when each source last started + private final double[] volumes = new double[POOL]; // the per-sound gain, master volume on top + private final int[] handles = new int[POOL]; // the live handle of each source, 0 when none + private final Map buffers = new IdentityHashMap<>(); // identity: a sound uploads once + private final Map slots = new HashMap<>(); // handle -> pool slot + private double masterVolume = 1.0; + private boolean closed; + private int nextHandle; + + /** + * The one engine of the process, created on first use. On a machine without an audio device the + * engine is silent: every method does nothing or returns a default, and never throws. + */ + public static synchronized AudioEngine get() { + if (AudioEngine.instance == null) { + AudioEngine.instance = new AudioEngine(); + } + return AudioEngine.instance; + } + + private AudioEngine() { + long device = 0; + boolean silent = true; + try { + Natives.init(); // LWJGL's memory backend must be chosen before its first call + device = alcOpenDevice((ByteBuffer) null); + if (device != 0) { + ALCCapabilities alc = ALC.createCapabilities(device); + this.context = alcCreateContext(device, (IntBuffer) null); + alcMakeContextCurrent(this.context); + AL.createCapabilities(alc); + silent = false; + } + } catch (Throwable t) { + // a machine that cannot open a device must not take the library down: go silent instead + this.destroyContext(); + if (device != 0) { + try { + alcCloseDevice(device); + } catch (Throwable ignored) { + // teardown is best effort + } + device = 0; + } + } + this.device = device; + this.silent = silent; + if (silent) { + // the one and only reaction to a machine without audio: stay silent, never throw + System.err.println("Scratch for Java: no audio device, sounds stay silent."); + } + } + + /** + * Uploads {@code data} and returns the buffer id, 0 on a silent engine. The same sound data + * uploads once, whatever it is asked for. + */ + public synchronized int buffer(SoundData data) { + if (this.silent || this.closed || data == null) { + return 0; + } + Integer cached = this.buffers.get(data); + if (cached != null) { + return cached; + } + int format = data.channels() == 1 + ? (data.bits() == 8 ? AL_FORMAT_MONO8 : AL_FORMAT_MONO16) + : (data.bits() == 8 ? AL_FORMAT_STEREO8 : AL_FORMAT_STEREO16); + byte[] pcm = data.pcm(); + // alBufferData copies on upload, so a scratch direct buffer is enough and ours to free + ByteBuffer direct = MemoryUtil.memAlloc(pcm.length).put(pcm).flip(); + int buffer = alGenBuffers(); + if (data.bits() == 8) { + // 8-bit is unsigned in both WAV and OpenAL, 16-bit signed LE likewise: copy as is + alBufferData(buffer, format, direct, data.sampleRate()); + } else { + alBufferData(buffer, format, direct.order(ByteOrder.LITTLE_ENDIAN).asShortBuffer(), data.sampleRate()); + } + MemoryUtil.memFree(direct); + this.buffers.put(data, buffer); + return buffer; + } + + /** + * Plays {@code buffer} on a stopped source, or the one that started longest ago. The returned + * handle stays valid until its source is reused or stopped; a silent engine returns 0. + */ + public synchronized int play(int buffer, double volume, boolean loop) { + if (this.silent || this.closed || buffer == 0) { + return 0; + } + this.createPool(); + int pick = 0; + for (int i = 0; i < POOL; i++) { + if (this.state(this.sources[i]) != AL_PLAYING) { + pick = i; // a free source is always better than stealing one + break; + } + if (this.started[i] < this.started[pick]) { + pick = i; // all busy: steal the one that started longest ago + } + } + int handle = ++this.nextHandle; + if (this.handles[pick] != 0) { + this.slots.remove(this.handles[pick]); // the reused source ends the old handle + } + this.handles[pick] = handle; + this.slots.put(handle, pick); + this.volumes[pick] = clamp(volume); + int source = this.sources[pick]; + alSourcei(source, AL_BUFFER, buffer); + alSourcef(source, AL_GAIN, (float) (this.volumes[pick] * this.masterVolume)); + alSourcei(source, AL_LOOPING, loop ? AL_TRUE : AL_FALSE); // a reused source keeps no settings + alSourcePlay(source); + this.started[pick] = System.nanoTime(); + return handle; + } + + /** Stops the sound behind {@code handle}, if it still plays. */ + public synchronized void stop(int handle) { + Integer slot = this.slots.remove(handle); + if (slot == null || this.silent || this.closed) { + return; + } + alSourceStop(this.sources[slot]); + this.handles[slot] = 0; + } + + /** Whether the sound behind {@code handle} still plays; a reused or stopped handle does not. */ + public synchronized boolean isPlaying(int handle) { + Integer slot = this.slots.get(handle); + if (slot == null || this.silent || this.closed) { + return false; + } + return this.state(this.sources[slot]) == AL_PLAYING; + } + + /** Sets the gain of the sound behind {@code handle}, 0..1, master volume on top. */ + public synchronized void setVolume(int handle, double volume) { + Integer slot = this.slots.get(handle); + if (slot == null || this.silent || this.closed) { + return; + } + this.volumes[slot] = clamp(volume); + alSourcef(this.sources[slot], AL_GAIN, (float) (this.volumes[slot] * this.masterVolume)); + } + + /** Stops every sound, handles included. */ + public synchronized void stopAll() { + if (this.silent || this.closed) { + return; + } + for (int i = 0; i < POOL; i++) { + if (this.sources[i] != 0) { + alSourceStop(this.sources[i]); + } + } + this.slots.clear(); + Arrays.fill(this.handles, 0); + } + + /** Sets the master volume, 0..1, for the sounds playing now and the ones to come. */ + public synchronized void setMasterVolume(double volume) { + this.masterVolume = clamp(volume); + if (this.silent || this.closed) { + return; + } + for (int i = 0; i < POOL; i++) { + if (this.sources[i] != 0) { + alSourcef(this.sources[i], AL_GAIN, (float) (this.volumes[i] * this.masterVolume)); + } + } + } + + /** The master volume, 0..1. */ + public synchronized double getMasterVolume() { + return this.masterVolume; + } + + /** Whether this machine has no audio device and the engine stays silent. */ + public synchronized boolean isSilent() { + return this.silent; + } + + /** Stops and deletes sources and buffers, destroys the context and closes the device. */ + public synchronized void close() { + if (this.closed) { + return; + } + this.closed = true; + this.slots.clear(); + Arrays.fill(this.handles, 0); + if (this.silent) { + return; + } + for (int source : this.sources) { + if (source != 0) { + alSourceStop(source); + alDeleteSources(source); + } + } + for (int buffer : this.buffers.values()) { + alDeleteBuffers(buffer); + } + this.destroyContext(); + if (this.device != 0) { + alcCloseDevice(this.device); + this.device = 0; + } + } + + private void createPool() { + if (this.sources[0] != 0) { + return; + } + for (int i = 0; i < POOL; i++) { + this.sources[i] = alGenSources(); + } + } + + private int state(int source) { + int[] state = new int[1]; + alGetSourcei(source, AL_SOURCE_STATE, state); + return state[0]; + } + + private void destroyContext() { + if (this.context == 0) { + return; + } + try { + alcMakeContextCurrent(0L); + alcDestroyContext(this.context); + } catch (Throwable ignored) { + // teardown is best effort + } + this.context = 0; + } + + private static double clamp(double volume) { + return Math.max(0.0, Math.min(1.0, volume)); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/audio/SoundData.java b/core/src/main/java/org/openpatch/scratch/internal/audio/SoundData.java new file mode 100644 index 00000000..51ec3da6 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/audio/SoundData.java @@ -0,0 +1,178 @@ +package org.openpatch.scratch.internal.audio; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.IntBuffer; +import java.nio.ShortBuffer; +import org.lwjgl.BufferUtils; +import org.lwjgl.stb.STBVorbis; +import org.lwjgl.system.MemoryUtil; +import org.openpatch.scratch.internal.Natives; +import org.openpatch.scratch.internal.image.Images; + +/** + * A sound decoded to raw PCM, ready for OpenAL: 8- or 16-bit, mono or stereo, little-endian as + * WAV stores it (8-bit unsigned, 16-bit signed). + */ +public final class SoundData { + + private final int channels; + private final int sampleRate; + private final int bits; + private final byte[] pcm; + private final double seconds; + + private SoundData(int channels, int sampleRate, int bits, byte[] pcm) { + this.channels = channels; + this.sampleRate = sampleRate; + this.bits = bits; + this.pcm = pcm; + this.seconds = pcm.length / (channels * sampleRate * (bits / 8.0)); + } + + /** The channel count: 1 for mono, 2 for stereo. */ + public int channels() { + return this.channels; + } + + /** The sample rate in hertz. */ + public int sampleRate() { + return this.sampleRate; + } + + /** The bits per sample: 8 (unsigned) or 16 (signed). */ + public int bits() { + return this.bits; + } + + /** The decoded PCM. Callers must not modify the returned array. */ + public byte[] pcm() { + return this.pcm; + } + + /** How long the sound plays, in seconds. */ + public double seconds() { + return this.seconds; + } + + /** + * Decodes the bytes of a sound file, a PCM WAV or an OGG. + * + * @param file the bytes of the whole file + * @param name the path or label of the sound, used in error messages + * @throws IOException when the bytes are neither a PCM WAV nor an OGG, or malformed + */ + public static SoundData decode(byte[] file, String name) throws IOException { + if (file.length >= 12 && startsWith(file, 0, "RIFF") && startsWith(file, 8, "WAVE")) { + return decodeWav(file, name); + } + if (file.length >= 4 && startsWith(file, 0, "OggS")) { + return decodeOgg(file, name); + } + throw new IOException(name + ": only WAV (PCM) and OGG sounds are supported"); + } + + /** + * Reads and decodes the sound at {@code path}: a file relative to the working directory, else a + * resource on the classpath. + * + * @throws IllegalArgumentException when there is no such sound or it cannot be decoded + */ + public static SoundData load(String path) { + // a built-in sound by name ("click"), as a sprite costume can be a built-in sprite + if (org.openpatch.scratch.internal.BuiltinAssets.isBuiltinName(path)) { + String resource = org.openpatch.scratch.internal.BuiltinSounds.get(path); + if (resource != null) { + path = resource; + } + } + byte[] bytes = Images.read(path); + if (bytes == null) { + throw new IllegalArgumentException("Sound not found: " + path); + } + try { + return decode(bytes, path); + } catch (IOException e) { + throw new IllegalArgumentException(e.getMessage(), e); + } + } + + private static boolean startsWith(byte[] file, int offset, String magic) { + for (int i = 0; i < magic.length(); i++) { + if (file[offset + i] != magic.charAt(i)) { + return false; + } + } + return true; + } + + /** RIFF/WAVE by hand: PCM only, the one variant Scratch projects ship. */ + private static SoundData decodeWav(byte[] file, String name) throws IOException { + ByteBuffer buffer = ByteBuffer.wrap(file).order(ByteOrder.LITTLE_ENDIAN); + buffer.position(12); // behind "RIFF", the size and "WAVE" + int formatTag = 0; + int channels = 0; + int rate = 0; + int bits = 0; + byte[] samples = null; + while (buffer.remaining() >= 8) { + int id = buffer.getInt(); + int size = buffer.getInt(); + // chunks are word aligned: an odd body carries a pad byte before the next header + long end = (long) buffer.position() + (size & 0xFFFFFFFFL) + (size & 1); + int next = (int) Math.min(end, buffer.limit()); + if (id == 0x20746D66 /* "fmt " */ && size >= 16 && buffer.remaining() >= 16) { + formatTag = buffer.getShort() & 0xFFFF; + channels = buffer.getShort() & 0xFFFF; + rate = buffer.getInt(); + buffer.getInt(); // byte rate, follows from the rest + buffer.getShort(); // block align + bits = buffer.getShort() & 0xFFFF; + if (formatTag == 0xFFFE /* WAVE_FORMAT_EXTENSIBLE */ && size >= 26 && buffer.remaining() >= 10) { + // the real format tag hides in the sub-format GUID, behind the extra fields + buffer.getShort(); // cbSize + buffer.getShort(); // valid bits per sample + buffer.getInt(); // channel mask + formatTag = buffer.getShort() & 0xFFFF; + } + } else if (id == 0x61746164 /* "data" */) { + int length = (int) Math.min(size & 0xFFFFFFFFL, buffer.remaining()); + samples = new byte[length]; + buffer.get(samples); + } + buffer.position(next); // skips unknown chunks and their pad byte + } + if (formatTag != 1 /* PCM */ || (bits != 8 && bits != 16) || (channels != 1 && channels != 2) + || rate <= 0 || samples == null) { + throw new IOException(name + " is not an 8- or 16-bit PCM mono/stereo WAV"); + } + return new SoundData(channels, rate, bits, samples); + } + + private static SoundData decodeOgg(byte[] file, String name) throws IOException { + Natives.init(); // loads the native libraries before the first LWJGL call + ByteBuffer encoded = MemoryUtil.memAlloc(file.length).put(file).flip(); + IntBuffer channels = BufferUtils.createIntBuffer(1); + IntBuffer rate = BufferUtils.createIntBuffer(1); + ShortBuffer pcm = STBVorbis.stb_vorbis_decode_memory(encoded, channels, rate); + MemoryUtil.memFree(encoded); // the decode buffer is ours + if (pcm == null) { + throw new IOException("stb_vorbis could not decode " + name); + } + int count = pcm.remaining(); + byte[] bytes = new byte[count * 2]; + for (int i = 0; i < count; i++) { + short sample = pcm.get(); + // OpenAL and WAV agree on little-endian: the low byte comes first + bytes[2 * i] = (byte) sample; + bytes[2 * i + 1] = (byte) (sample >> 8); + } + MemoryUtil.memFree(pcm); // the decode buffer is ours + int decodedChannels = channels.get(0); + if (decodedChannels != 1 && decodedChannels != 2) { + throw new IOException(name + ": only mono and stereo sounds are supported"); + } + return new SoundData(decodedChannels, rate.get(0), 16, bytes); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/audio/package-info.java b/core/src/main/java/org/openpatch/scratch/internal/audio/package-info.java new file mode 100644 index 00000000..27539e5e --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/audio/package-info.java @@ -0,0 +1,4 @@ +/** + * Sound through OpenAL Soft: files decode once into buffers, played on a pool of sources. + */ +package org.openpatch.scratch.internal.audio; diff --git a/core/src/main/java/org/openpatch/scratch/internal/canvas/Canvas.java b/core/src/main/java/org/openpatch/scratch/internal/canvas/Canvas.java new file mode 100644 index 00000000..f11d9736 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/canvas/Canvas.java @@ -0,0 +1,204 @@ +package org.openpatch.scratch.internal.canvas; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openpatch.scratch.internal.draw.CanvasRegion; +import org.openpatch.scratch.internal.draw.Effects; +import org.openpatch.scratch.internal.image.Image; + +/** + * A layer's canvas: stage-sized ARGB pixels on the CPU, top row first, straight alpha. Pen + * strokes, stamps and erasing change it at once, in program order, so colour sensing sees exactly + * what the statements before it drew. What changed since the last + * {@link #takeChanges()} is copied into the draw list for upload. + * + *

Drawing methods take screen coordinates: Scratch's stage coordinates (origin in the centre, y + * up) after the camera. Used on the game thread only. + */ +public final class Canvas { + + private final int width, height; + private final int[] argb; + private final List changes = new ArrayList<>(); + private int changedX0 = Integer.MAX_VALUE, changedY0 = Integer.MAX_VALUE, changedX1 = -1, changedY1 = -1; + + public Canvas(int width, int height) { + this.width = width; + this.height = height; + this.argb = new int[width * height]; + } + + public int getWidth() { + return this.width; + } + + public int getHeight() { + return this.height; + } + + /** The pixel at canvas pixel {@code (px, py)} (y down), or transparent outside. */ + public int get(int px, int py) { + if (px < 0 || py < 0 || px >= this.width || py >= this.height) { + return 0; + } + return this.argb[py * this.width + px]; + } + + /** The pixel under the screen point {@code (x, y)}, or transparent outside. */ + public int at(double x, double y) { + return this.get((int) Math.floor(x + this.width / 2.0), (int) Math.floor(this.height / 2.0 - y)); + } + + /** A copy of all pixels, top row first. */ + public int[] copyPixels() { + return this.argb.clone(); + } + + /** An anti-aliased line with round caps; {@code size} is its width in stage pixels. */ + public void line(double x0, double y0, double x1, double y1, double size, int color) { + double ax = x0 + this.width / 2.0, ay = this.height / 2.0 - y0; + double bx = x1 + this.width / 2.0, by = this.height / 2.0 - y1; + double r = Math.max(size, 0.5) / 2; + int left = Math.max(0, (int) Math.floor(Math.min(ax, bx) - r - 1)); + int right = Math.min(this.width - 1, (int) Math.ceil(Math.max(ax, bx) + r + 1)); + int top = Math.max(0, (int) Math.floor(Math.min(ay, by) - r - 1)); + int bottom = Math.min(this.height - 1, (int) Math.ceil(Math.max(ay, by) + r + 1)); + if (left > right || top > bottom) { + return; + } + double dx = bx - ax, dy = by - ay, length2 = dx * dx + dy * dy; + int alpha = color >>> 24; + for (int py = top; py <= bottom; py++) { + for (int px = left; px <= right; px++) { + double cx = px + 0.5 - ax, cy = py + 0.5 - ay; + double t = length2 == 0 ? 0 : Math.max(0, Math.min(1, (cx * dx + cy * dy) / length2)); + double distance = Math.hypot(cx - t * dx, cy - t * dy); + double coverage = Math.max(0, Math.min(1, r + 0.5 - distance)); + if (coverage > 0) { + int i = py * this.width + px; + this.argb[i] = over(this.argb[i], color, (int) Math.round(alpha * coverage)); + } + } + } + this.changed(left, top, right, bottom); + } + + /** A round dot, as a pen leaves when it goes down without moving. */ + public void dot(double x, double y, double size, int color) { + this.line(x, y, x, y, size, color); + } + + /** + * Draws a costume through an affine transform from costume pixels (y down, origin top left) to + * screen coordinates: {@code x' = a·u + c·v + e}, {@code y' = b·u + d·v + f}. Each canvas pixel + * takes the costume pixel under its centre (nearest), so stamps look like the sprite in pixel + * art and smooth costumes stay sharp at size 100. + */ + public void stamp(Image costume, double[] costumeToScreen, Effects effects) { + double a = costumeToScreen[0], b = costumeToScreen[1], c = costumeToScreen[2]; + double d = costumeToScreen[3], e = costumeToScreen[4], f = costumeToScreen[5]; + double det = a * d - b * c; + if (det == 0) { + return; + } + int cw = costume.getWidth(), ch = costume.getHeight(); + // screen bounds of the costume's corners, as canvas pixels + double minX = Double.POSITIVE_INFINITY, minY = Double.POSITIVE_INFINITY; + double maxX = Double.NEGATIVE_INFINITY, maxY = Double.NEGATIVE_INFINITY; + for (int corner = 0; corner < 4; corner++) { + double u = (corner & 1) * cw, v = (corner >> 1) * ch; + double px = a * u + c * v + e + this.width / 2.0; + double py = this.height / 2.0 - (b * u + d * v + f); + minX = Math.min(minX, px); + maxX = Math.max(maxX, px); + minY = Math.min(minY, py); + maxY = Math.max(maxY, py); + } + int left = Math.max(0, (int) Math.floor(minX)), right = Math.min(this.width - 1, (int) Math.ceil(maxX)); + int top = Math.max(0, (int) Math.floor(minY)), bottom = Math.min(this.height - 1, (int) Math.ceil(maxY)); + if (left > right || top > bottom) { + return; + } + int[] pixels = costume.getArgb(); + for (int py = top; py <= bottom; py++) { + double sy = this.height / 2.0 - (py + 0.5); + for (int px = left; px <= right; px++) { + double sx = px + 0.5 - this.width / 2.0; + // inverse of the affine map: screen → costume + double rx = sx - e, ry = sy - f; + double u = (d * rx - c * ry) / det, v = (-b * rx + a * ry) / det; + if (u < 0 || v < 0 || u >= cw || v >= ch) { + continue; + } + int src = effects.apply(pixels[(int) v * cw + (int) u]); + if ((src >>> 24) != 0) { + int i = py * this.width + px; + this.argb[i] = over(this.argb[i], src, src >>> 24); + } + } + } + this.changed(left, top, right, bottom); + } + + /** Clears the whole canvas. */ + public void eraseAll() { + Arrays.fill(this.argb, 0); + // an erase replaces everything before it: earlier regions need not be uploaded + this.changes.clear(); + this.changedX0 = this.changedY0 = Integer.MAX_VALUE; + this.changedX1 = this.changedY1 = -1; + this.changed(0, 0, this.width - 1, this.height - 1); + } + + /** {@code color} with alpha {@code a} over {@code dst}, straight alpha. */ + static int over(int dst, int color, int a) { + if (a <= 0) { + return dst; + } + int da = dst >>> 24; + if (a >= 255 || da == 0) { + return Math.min(a, 255) << 24 | (color & 0xffffff); + } + int outA = a + da * (255 - a) / 255; + int r = (((color >> 16) & 0xff) * a + ((dst >> 16) & 0xff) * da * (255 - a) / 255) / outA; + int g = (((color >> 8) & 0xff) * a + ((dst >> 8) & 0xff) * da * (255 - a) / 255) / outA; + int b = ((color & 0xff) * a + (dst & 0xff) * da * (255 - a) / 255) / outA; + return outA << 24 | r << 16 | g << 8 | b; + } + + private void changed(int x0, int y0, int x1, int y1) { + this.changedX0 = Math.min(this.changedX0, x0); + this.changedY0 = Math.min(this.changedY0, y0); + this.changedX1 = Math.max(this.changedX1, x1); + this.changedY1 = Math.max(this.changedY1, y1); + } + + /** The next {@link #takeChanges()} hands out the whole canvas: the stage is shown again. */ + public void resendAll() { + this.changes.clear(); + this.changedX0 = this.changedY0 = Integer.MAX_VALUE; + this.changedX1 = this.changedY1 = -1; + this.changed(0, 0, this.width - 1, this.height - 1); + } + + /** + * The regions changed since the last call, oldest first, as copies: one bounding rectangle of + * everything drawn since the last erase (or the last call), plus the full canvas after an erase. + */ + public List takeChanges() { + if (this.changedX1 >= 0) { + int w = this.changedX1 - this.changedX0 + 1, h = this.changedY1 - this.changedY0 + 1; + int[] copy = new int[w * h]; + for (int row = 0; row < h; row++) { + System.arraycopy(this.argb, (this.changedY0 + row) * this.width + this.changedX0, copy, row * w, w); + } + this.changes.add(new CanvasRegion(this.changedX0, this.changedY0, w, h, copy)); + this.changedX0 = this.changedY0 = Integer.MAX_VALUE; + this.changedX1 = this.changedY1 = -1; + } + List taken = List.copyOf(this.changes); + this.changes.clear(); + return taken; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/canvas/package-info.java b/core/src/main/java/org/openpatch/scratch/internal/canvas/package-info.java new file mode 100644 index 00000000..5639f841 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/canvas/package-info.java @@ -0,0 +1,2 @@ +/** The CPU canvases of the layers: pen strokes, stamps and erasing, applied at once. */ +package org.openpatch.scratch.internal.canvas; diff --git a/core/src/main/java/org/openpatch/scratch/internal/compose/Compositor.java b/core/src/main/java/org/openpatch/scratch/internal/compose/Compositor.java new file mode 100644 index 00000000..9949d3a9 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/compose/Compositor.java @@ -0,0 +1,245 @@ +package org.openpatch.scratch.internal.compose; + +import java.util.List; +import org.openpatch.scratch.internal.canvas.Canvas; +import org.openpatch.scratch.internal.draw.Effects; +import org.openpatch.scratch.internal.image.Image; + +/** + * The one CPU compositor behind colour sensing and {@code Pixels}: what + * the world layers show at a stage pixel, the same on every GPU, in the same tick, without a + * window. Shaders, texts and the UI layer are not part of it. + * + *

Built for one question from the scene as it is at that statement, back to front: the stage + * colour, then {@link Part}s (the backdrop, canvases, sprites). Coordinates are screen coordinates + * (Scratch's: origin in the centre, y up) after the camera; pixel {@code (px, py)} of the stage + * (y down) is sampled at its centre. + */ +public final class Compositor { + + /** Something the compositor stacks: a costume on the screen, or a canvas. */ + public sealed interface Part permits Picture, CanvasPart {} + + /** A layer's canvas, fixed on screen. */ + public record CanvasPart(Canvas canvas) implements Part {} + + /** + * A costume through an affine map from costume pixels (origin top left, y down) to screen + * coordinates, with effects. + */ + public static final class Picture implements Part { + private final int[] pixels; + private final int width, height; + private final double ia, ib, ic, id, ie, iff; + private final Effects effects; + // no effects to apply: decided once, not for every sampled pixel + private final boolean plain; + private final double[][] cutsU, cutsV; + final double minX, minY, maxX, maxY; + + /** + * @param image the costume + * @param costumeToScreen {a, b, c, d, e, f}: {@code x' = a·u + c·v + e}, {@code y' = b·u + d·v + f} + * @param effects applied to every sampled pixel + */ + public Picture(Image image, double[] costumeToScreen, Effects effects) { + this(image, costumeToScreen, effects, null, null); + } + + /** + * A nine-sliced costume: {@code costumeToScreen} stretches the costume evenly, the cuts then + * move each sampled point to the costume pixel the renderer shows there. + * + * @param cutsU across: the cuts in evenly stretched costume pixels and the costume pixels they + * show, as {@code {positions, pixels}}; null for none + * @param cutsV the same downwards + */ + public Picture(Image image, double[] costumeToScreen, Effects effects, double[][] cutsU, double[][] cutsV) { + this.pixels = image.getArgb(); + this.width = image.getWidth(); + this.height = image.getHeight(); + this.effects = effects; + this.plain = effects.isNone(); + this.cutsU = cutsU; + this.cutsV = cutsV; + double a = costumeToScreen[0], b = costumeToScreen[1], c = costumeToScreen[2], d = costumeToScreen[3]; + double e = costumeToScreen[4], f = costumeToScreen[5]; + double det = a * d - b * c; + if (det == 0) { + // shrunk to nothing: covers no pixel + this.ia = this.ib = this.ic = this.id = this.ie = this.iff = 0; + this.minX = this.minY = Double.POSITIVE_INFINITY; + this.maxX = this.maxY = Double.NEGATIVE_INFINITY; + return; + } + // screen → costume + this.ia = d / det; + this.ib = -b / det; + this.ic = -c / det; + this.id = a / det; + this.ie = (c * f - d * e) / det; + this.iff = (b * e - a * f) / det; + double minX = Double.POSITIVE_INFINITY, minY = Double.POSITIVE_INFINITY; + double maxX = Double.NEGATIVE_INFINITY, maxY = Double.NEGATIVE_INFINITY; + for (int corner = 0; corner < 4; corner++) { + double u = (corner & 1) * this.width, v = (corner >> 1) * this.height; + double x = a * u + c * v + e, y = b * u + d * v + f; + minX = Math.min(minX, x); + maxX = Math.max(maxX, x); + minY = Math.min(minY, y); + maxY = Math.max(maxY, y); + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + } + + /** The costume pixel (effects applied) under a screen point, or transparent. */ + public int sample(double x, double y) { + if (x < this.minX || x > this.maxX || y < this.minY || y > this.maxY) { + return 0; + } + double u = this.ia * x + this.ic * y + this.ie, v = this.ib * x + this.id * y + this.iff; + if (u < 0 || v < 0 || u >= this.width || v >= this.height) { + return 0; + } + int pu, pv; + if (this.cutsU == null && this.cutsV == null) { + pu = (int) u; + pv = (int) v; + } else { + pu = cut(this.cutsU, u, this.width); + pv = cut(this.cutsV, v, this.height); + } + int pixel = this.pixels[pv * this.width + pu]; + return this.plain ? pixel : this.effects.apply(pixel); + } + + /** The costume pixel shown at an evenly stretched position: piecewise linear between cuts. */ + private static int cut(double[][] cuts, double at, int size) { + double p = at; + if (cuts != null) { + double[] from = cuts[0], to = cuts[1]; + int i = 0; + while (i + 2 < from.length && at >= from[i + 1]) { + i++; + } + double span = from[i + 1] - from[i]; + p = span > 0 ? to[i] + (at - from[i]) / span * (to[i + 1] - to[i]) : to[i]; + } + return Math.max(0, Math.min(size - 1, (int) p)); + } + + boolean overlapsBox(double minX, double minY, double maxX, double maxY) { + return this.maxX >= minX && this.minX <= maxX && this.maxY >= minY && this.minY <= maxY; + } + } + + private final int width, height; + private final int background; + private final List parts; + + /** + * @param width the stage width + * @param height the stage height + * @param stageColor ARGB behind everything (made opaque) + * @param backToFront the parts, back to front + */ + public Compositor(int width, int height, int stageColor, List backToFront) { + this.width = width; + this.height = height; + this.background = stageColor | 0xff000000; + this.parts = backToFront; + } + + /** The opaque colour the world layers show at stage pixel {@code (px, py)} (y down). */ + public int colorAt(int px, int py) { + double x = px + 0.5 - this.width / 2.0, y = this.height / 2.0 - (py + 0.5); + return this.composite(this.parts, px, py, x, y); + } + + /** Every stage pixel, top row first: what {@code Pixels.of(stage)} returns. */ + public int[] render() { + int[] out = new int[this.width * this.height]; + for (int py = 0; py < this.height; py++) { + for (int px = 0; px < this.width; px++) { + out[py * this.width + px] = this.colorAt(px, py); + } + } + return out; + } + + /** + * Scratch's "touching colour" and "colour is touching colour": does any pixel of {@code self} + * (whose colour matches {@code mine}, if given) lie over a pixel of the other parts whose + * colour matches {@code target}? {@code self} must not be among the parts. + * + * @param self the sensing sprite, its own ghost effect left out + * @param mine ARGB the sprite's pixel must match, or null for any painted pixel + * @param target ARGB to look for underneath + */ + public boolean touches(Picture self, Integer mine, int target) { + int targetKey = key(target); + int mineKey = mine == null ? 0 : key(mine); + int left = Math.max(0, (int) Math.floor(self.minX + this.width / 2.0)); + int right = Math.min(this.width - 1, (int) Math.ceil(self.maxX + this.width / 2.0)); + int top = Math.max(0, (int) Math.floor(this.height / 2.0 - self.maxY)); + int bottom = Math.min(this.height - 1, (int) Math.ceil(this.height / 2.0 - self.minY)); + if (left > right || top > bottom) { + return false; + } + // only the parts near the sprite matter + List near = this.parts.stream() + .filter(p -> !(p instanceof Picture pic) || pic.overlapsBox(self.minX, self.minY, self.maxX, self.maxY)) + .toList(); + for (int py = top; py <= bottom; py++) { + double y = this.height / 2.0 - (py + 0.5); + for (int px = left; px <= right; px++) { + double x = px + 0.5 - this.width / 2.0; + int own = self.sample(x, y); + if ((own >>> 24) == 0 || (mine != null && key(own) != mineKey)) { + continue; + } + if (key(this.composite(near, px, py, x, y)) == targetKey) { + return true; + } + } + } + return false; + } + + /** Front to back with coverage, as the screen shows it; opaque result. */ + private int composite(List parts, int px, int py, double x, double y) { + double r = 0, g = 0, b = 0, covered = 0; + for (int i = parts.size() - 1; i >= 0 && covered < 0.999; i--) { + Part part = parts.get(i); + int c = part instanceof Picture pic ? pic.sample(x, y) : ((CanvasPart) part).canvas().get(px, py); + int alpha = c >>> 24; + if (alpha == 0) { + continue; + } + double a = alpha / 255.0 * (1 - covered); + r += a * ((c >> 16) & 0xff); + g += a * ((c >> 8) & 0xff); + b += a * (c & 0xff); + covered += a; + } + if (covered < 0.999) { + double a = 1 - covered; + r += a * ((this.background >> 16) & 0xff); + g += a * ((this.background >> 8) & 0xff); + b += a * (this.background & 0xff); + } + return 0xff000000 | clamp(r) << 16 | clamp(g) << 8 | clamp(b); + } + + /** Scratch's colour tolerance: the top 5 bits of red and green, 4 of blue. */ + public static int key(int argb) { + return argb & 0xf8f8f0; + } + + private static int clamp(double v) { + return (int) Math.max(0, Math.min(255, Math.round(v))); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/AskDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/AskDraw.java new file mode 100644 index 00000000..634af226 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/AskDraw.java @@ -0,0 +1,59 @@ +package org.openpatch.scratch.internal.draw; + +import org.openpatch.scratch.internal.text.TextLayout; + +/** + * The ask box as Scratch shows it: a white card along the bottom of the stage with the question + * (when the stage asks) above a rounded answer field that ends in a round check button. In stage + * coordinates (y up); {@code (x, y)} is the card's top-left corner. Drawn above the UI layer. + * + * @param question the question's lines, or null when a sprite asks (its bubble shows the question) + * @param answer what has been typed, as far as it fits into the field + * @param x left edge of the card + * @param y top edge of the card + * @param width width of the card + * @param height height of the card + * @param caret whether the blinking caret is shown in this frame + */ +public record AskDraw(TextLayout question, TextLayout answer, double x, double y, double width, double height, + boolean caret) { + + /** Scratch's measures (scratch-gui's question box), in stage units. */ + public static final double MARGIN = 8, PADDING = 16, GAP = 8, FIELD = 32, INSET = 12, BUTTON = 24, + BUTTON_INSET = 4; + + /** @return the height of a card for a question of this many stage units, 0 for none */ + public static double heightFor(double questionHeight) { + return 2 * PADDING + FIELD + (questionHeight > 0 ? questionHeight + GAP : 0); + } + + /** @return the answer field's left edge */ + public double fieldX() { + return this.x + PADDING; + } + + /** @return the answer field's top edge */ + public double fieldY() { + return this.y - this.height + PADDING + FIELD; + } + + /** @return the answer field's width */ + public double fieldWidth() { + return this.width - 2 * PADDING; + } + + /** @return the centre of the check button, x */ + public double buttonX() { + return this.fieldX() + this.fieldWidth() - BUTTON_INSET - BUTTON / 2; + } + + /** @return the centre of the check button, y */ + public double buttonY() { + return this.fieldY() - FIELD / 2; + } + + /** @return whether a point (stage coordinates) is on the check button */ + public boolean onButton(double px, double py) { + return Math.hypot(px - this.buttonX(), py - this.buttonY()) <= BUTTON / 2; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/CameraDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/CameraDraw.java new file mode 100644 index 00000000..7c0fe0ee --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/CameraDraw.java @@ -0,0 +1,10 @@ +package org.openpatch.scratch.internal.draw; + +/** + * The camera: the world point {@code (x, y)} is drawn at the stage's centre, and the world is + * scaled by {@code zoom / 100} around it. The identity is {@code (0, 0, 100)}. + */ +public record CameraDraw(double x, double y, double zoom) { + + public static final CameraDraw IDENTITY = new CameraDraw(0, 0, 100); +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/CanvasRegion.java b/core/src/main/java/org/openpatch/scratch/internal/draw/CanvasRegion.java new file mode 100644 index 00000000..439bc4b5 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/CanvasRegion.java @@ -0,0 +1,8 @@ +package org.openpatch.scratch.internal.draw; + +/** + * A copy of a changed part of a layer's canvas: {@code argb} holds {@code width × height} + * pixels, top row first, straight alpha. {@code x, y} is its top-left corner in canvas pixels + * (y down, as the canvas stores them). + */ +public record CanvasRegion(int x, int y, int width, int height, int[] argb) {} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/ClipDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/ClipDraw.java new file mode 100644 index 00000000..9a03a030 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/ClipDraw.java @@ -0,0 +1,10 @@ +package org.openpatch.scratch.internal.draw; + +/** + * Starts or ends clipping: items after it are drawn only inside the rectangle (layer + * coordinates, y up, axis-aligned on the screen) until a ClipDraw with {@code active} false. + */ +public record ClipDraw(boolean active, double left, double bottom, double right, double top) implements Item { + + public static final ClipDraw END = new ClipDraw(false, 0, 0, 0, 0); +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/CursorDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/CursorDraw.java new file mode 100644 index 00000000..f6a2113d --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/CursorDraw.java @@ -0,0 +1,6 @@ +package org.openpatch.scratch.internal.draw; + +import org.openpatch.scratch.internal.image.Image; + +/** A custom mouse pointer: the image and the pixel of it that clicks. */ +public record CursorDraw(Image image, int hotX, int hotY) {} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/DrawList.java b/core/src/main/java/org/openpatch/scratch/internal/draw/DrawList.java new file mode 100644 index 00000000..281d3148 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/DrawList.java @@ -0,0 +1,56 @@ +package org.openpatch.scratch.internal.draw; + +import java.util.List; + +/** + * One frame's worth of scene, in stage coordinates (origin in the centre, y up). + * + * @param stageId which stage this is: canvas textures belong to a stage + * @param tick the number of ticks run when this list was made + * @param width the stage width in stage pixels + * @param height the stage height in stage pixels + * @param stageColor the colour behind everything, ARGB + * @param backdrop the current backdrop at the world origin, following the camera like the world + * layers (as in 6.x), or null + * @param camera the view transform of the world layers + * @param layers the four layers from back to front ({@code Layer.ordinal()} indexes them) + * @param overlay speech bubbles and world texts, in front of the foreground layer and following + * the camera, drawn at window resolution + * @param ui texts of the UI layer and the display band, at window resolution, in front of the + * UI layer's sprites + * @param ask the ask box while a question waits for its answer, in front of the UI texts, or null + * @param debug whether the frame rate is shown, the one measured part of the debug overlay (its + * outlines and texts are items already, switched by the debug options) + * @param stageShaders the stage's active shaders, applied in order to the world layers' picture + * @param monitors variable monitors, above everything else + * @param transition the transition from the previous stage, or null + * @param overlayItems what extensions draw above everything, and the debug panel, in stage + * coordinates; left out of captures + * @param cursor the image shown instead of the mouse pointer, or null for the system's + */ +public record DrawList( + int stageId, + long tick, + int width, + int height, + int stageColor, + SpriteDraw backdrop, + CameraDraw camera, + List layers, + List overlay, + List ui, + AskDraw ask, + boolean debug, + List stageShaders, + List monitors, + TransitionDraw transition, + List overlayItems, + CursorDraw cursor) { + + /** The same list with a transition in front of it. */ + public DrawList withTransition(TransitionDraw transition) { + return new DrawList(this.stageId, this.tick, this.width, this.height, this.stageColor, this.backdrop, this.camera, + this.layers, this.overlay, this.ui, this.ask, this.debug, this.stageShaders, this.monitors, transition, + this.overlayItems, this.cursor); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/Effects.java b/core/src/main/java/org/openpatch/scratch/internal/draw/Effects.java new file mode 100644 index 00000000..3da17f42 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/Effects.java @@ -0,0 +1,102 @@ +package org.openpatch.scratch.internal.draw; + +/** + * The graphic effects of a sprite. {@link #apply(int)} is the definition: the CPU (stamps, + * colour sensing) uses it directly, and the renderer's shader does the same maths. + * + * @param colorEffect Scratch's colour effect: shifts the hue by {@code colorEffect / 200} of a + * turn (0 = none, wraps at 200) + * @param transparency Scratch's ghost effect in percent (0 = opaque, 100 = invisible) + * @param tint ARGB colour the costume is multiplied by ({@code 0xffffffff} = none) + */ +public record Effects(double colorEffect, double transparency, int tint) { + + public static final Effects NONE = new Effects(0, 0, 0xffffffff); + + /** + * Scratch's own thresholds (sprite.frag in scratch-render): colours darker or greyer than this + * are forced to carry a little hue, so the colour effect stays visible on white and black. + */ + private static final double MIN_LIGHTNESS = 0.11 / 2; + + private static final double MIN_SATURATION = 0.09; + + public boolean isNone() { + return this.colorEffect % 200 == 0 && this.transparency == 0 && this.tint == 0xffffffff; + } + + /** A costume pixel (straight ARGB) with the effects applied, in the order hue, tint, ghost. */ + public int apply(int argb) { + int a = argb >>> 24; + if (a == 0 || this.isNone()) { + return argb; + } + int r = (argb >> 16) & 0xff, g = (argb >> 8) & 0xff, b = argb & 0xff; + double shift = this.colorEffect % 200; + if (shift != 0) { + int[] rgb = shiftHue(r, g, b, shift / 200); + r = rgb[0]; + g = rgb[1]; + b = rgb[2]; + } + if (this.tint != 0xffffffff) { + r = r * ((this.tint >> 16) & 0xff) / 255; + g = g * ((this.tint >> 8) & 0xff) / 255; + b = b * (this.tint & 0xff) / 255; + a = a * (this.tint >>> 24) / 255; + } + if (this.transparency != 0) { + double keep = 1 - Math.max(0, Math.min(100, this.transparency)) / 100; + a = (int) Math.round(a * keep); + } + return a << 24 | r << 16 | g << 8 | b; + } + + /** + * Turns the hue by {@code turns} (0..1) in HSV, as Scratch does: values too dark or too grey to + * show a hue are forced to carry a little, so the shift is visible on white and black too. + */ + static int[] shiftHue(int r, int g, int b, double turns) { + double rn = r / 255.0, gn = g / 255.0, bn = b / 255.0; + double max = Math.max(rn, Math.max(gn, bn)); + double d = max - Math.min(rn, Math.min(gn, bn)); + double h; + if (d == 0) { + h = 0; + } else if (max == rn) { + h = ((((gn - bn) / d) % 6 + 6) % 6) / 6; + } else if (max == gn) { + h = (((bn - rn) / d) + 2) / 6; + } else { + h = (((rn - gn) / d) + 4) / 6; + } + double s = max == 0 ? 0 : d / max; + double v = max; + if (v < MIN_LIGHTNESS) { + h = 0; + s = 1; + v = MIN_LIGHTNESS; + } else if (s < MIN_SATURATION) { + h = 0; + s = MIN_SATURATION; + } + h = (h + turns) % 1; + if (h < 0) { + h += 1; + } + double hh = h * 6; + int sector = (int) Math.floor(hh) % 6; + double f = hh - Math.floor(hh); + double p = v * (1 - s), q = v * (1 - s * f), t = v * (1 - s * (1 - f)); + double[] rgb = switch (sector) { + case 0 -> new double[] {v, t, p}; + case 1 -> new double[] {q, v, p}; + case 2 -> new double[] {p, v, t}; + case 3 -> new double[] {p, q, v}; + case 4 -> new double[] {t, p, v}; + default -> new double[] {v, p, q}; + }; + return new int[] {(int) Math.round(rgb[0] * 255), (int) Math.round(rgb[1] * 255), + (int) Math.round(rgb[2] * 255)}; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/ImageDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/ImageDraw.java new file mode 100644 index 00000000..3c9d2114 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/ImageDraw.java @@ -0,0 +1,19 @@ +package org.openpatch.scratch.internal.draw; + +import org.openpatch.scratch.internal.image.Image; + +/** + * A region of an image on any quad, for extensions drawing through the Canvas API (map tiles, + * bitmap glyphs, drawings). Consecutive image draws of the same image are drawn together. + * + * @param image the image + * @param sx the region's left edge in image pixels + * @param sy its top edge + * @param sw its width + * @param sh its height + * @param corners the quad in layer coordinates (y up): top-left, top-right, bottom-right, + * bottom-left as {@code x0, y0, …, x3, y3} + * @param opacity 0 invisible … 1 opaque + */ +public record ImageDraw(Image image, int sx, int sy, int sw, int sh, double[] corners, float opacity) + implements Item {} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/Item.java b/core/src/main/java/org/openpatch/scratch/internal/draw/Item.java new file mode 100644 index 00000000..61412156 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/Item.java @@ -0,0 +1,4 @@ +package org.openpatch.scratch.internal.draw; + +/** Something a layer draws: a sprite, a shape, an image region, a text, or a clip. */ +public sealed interface Item permits SpriteDraw, ShapeDraw, ImageDraw, TextDraw, ClipDraw {} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/LayerDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/LayerDraw.java new file mode 100644 index 00000000..0d116051 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/LayerDraw.java @@ -0,0 +1,17 @@ +package org.openpatch.scratch.internal.draw; + +import java.util.List; + +/** + * One layer: its canvas (fixed on screen, unaffected by the camera) and then its items, back to + * front. + * + * @param index {@code Layer.ordinal()} + * @param canvas whether the layer has a canvas at all (created on first use of a pen or stamp) + * @param canvasChanges the canvas regions changed since the previous draw list, oldest first; the + * renderer uploads them in this order + * @param items sprites and shapes, back to front + * @param world whether the camera applies (every layer but UI) + */ +public record LayerDraw(int index, boolean canvas, List canvasChanges, List items, + boolean world) {} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/MonitorDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/MonitorDraw.java new file mode 100644 index 00000000..c3621f55 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/MonitorDraw.java @@ -0,0 +1,13 @@ +package org.openpatch.scratch.internal.draw; + +import org.openpatch.scratch.internal.text.TextLayout; + +/** + * A variable monitor as Scratch shows it: the label, then the value in an orange pill, in a box + * whose top-left corner is at {@code (x, y)} (stage coordinates, y up). Drawn above the UI layer. + */ +public record MonitorDraw(TextLayout label, TextLayout value, double x, double y) { + + /** Height of a monitor box, and the step between stacked ones, in stage units. */ + public static final double HEIGHT = 24, STEP = 28; +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/ShaderDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/ShaderDraw.java new file mode 100644 index 00000000..5fccf401 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/ShaderDraw.java @@ -0,0 +1,14 @@ +package org.openpatch.scratch.internal.draw; + +import java.util.Map; + +/** + * A student shader (fragment body in the 7.0 format) and the values of its uniforms at the end + * of the batch. {@code time} and {@code resolution} are filled in by the renderer. + * + * @param name the shader's name, for compile errors + * @param source the body the student wrote; the renderer prepends the header + * @param uniforms name → {@code float[]} (1–4 values, or an array of them with {@code arrayStride} + * values each) or {@code int[]}, copied at the end of the batch + */ +public record ShaderDraw(String name, String source, Map uniforms) {} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/ShapeDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/ShapeDraw.java new file mode 100644 index 00000000..b7aae39f --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/ShapeDraw.java @@ -0,0 +1,11 @@ +package org.openpatch.scratch.internal.draw; + +/** + * A polygon outline or filled polygon in stage coordinates, e.g. a debug hitbox. + * + * @param points {@code x0, y0, x1, y1, …}, closed + * @param fill ARGB fill, 0 for none + * @param stroke ARGB outline, 0 for none + * @param strokeWeight outline width in stage pixels + */ +public record ShapeDraw(double[] points, int fill, int stroke, double strokeWeight) implements Item {} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/SpriteDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/SpriteDraw.java new file mode 100644 index 00000000..d2c028fe --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/SpriteDraw.java @@ -0,0 +1,64 @@ +package org.openpatch.scratch.internal.draw; + +import org.openpatch.scratch.internal.image.Image; + +/** + * A costume on the stage. The costume's pixel {@code (originX, originY)} (its rotation centre, + * y down) lands on {@code (x, y)}; around that point the costume is scaled by + * {@code scaleX, scaleY} (a negative {@code scaleX} mirrors it, for the left-right rotation style) + * and turned clockwise by {@code rotation} degrees. + * + * @param costume the image, shared and never changed after loading; renderers may key textures + * on its identity + * @param nineSlice for a sprite drawn at a set width and height: the four insets (left, top, + * right, bottom) in costume pixels whose corners keep their size; null otherwise + * @param sliceScale how big the insets are drawn, per costume pixel: the sprite's size / 100 + * @param width the width to stretch to with {@code nineSlice}, in stage pixels + * @param height the height to stretch to with {@code nineSlice}, in stage pixels + * @param shaders the sprite's active shaders in order, with their uniform values; empty for none + */ +public record SpriteDraw( + Image costume, + double x, + double y, + double originX, + double originY, + double scaleX, + double scaleY, + double rotation, + Effects effects, + int[] nineSlice, + double sliceScale, + double width, + double height, + java.util.List shaders) implements Item { + + /** + * Where one axis of a nine-sliced costume is cut, as 6.x's UISprite cut it: the insets keep + * their size (times {@code scale}), the middle stretches over the rest, even when it is empty + * in the costume (a bar as high as its two caps). Drawn smaller than its insets, the insets + * shrink together instead of folding over each other. + * + * @param costume the costume's width (or height) in pixels + * @param start the inset at the left (or top), in costume pixels + * @param end the inset at the right (or bottom), in costume pixels + * @param drawn the drawn width (or height) + * @param scale drawn size of a costume pixel of the insets + * @return the drawn positions of the cuts and their texture coordinates (0–1), each from 0 to + * the end; one piece when the insets do not fit into the costume + */ + public static double[][] slices(int costume, int start, int end, double drawn, double scale) { + if (start < 0 || end < 0 || start + end > costume || costume <= 0) { + return new double[][] {{0, drawn}, {0, 1}}; + } + double a = start * scale, b = end * scale; + if (a + b > drawn) { + double f = a + b > 0 ? drawn / (a + b) : 0; + a *= f; + b *= f; + } + return new double[][] { + {0, a, drawn - b, drawn}, + {0, start / (double) costume, (costume - end) / (double) costume, 1}}; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/TextDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/TextDraw.java new file mode 100644 index 00000000..48043aae --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/TextDraw.java @@ -0,0 +1,33 @@ +package org.openpatch.scratch.internal.draw; + +import org.openpatch.scratch.internal.text.TextLayout; + +/** + * Laid-out text at a place on the stage, with its box. Lines are offset within the box by + * {@code align}; glyph positions come from the layout, in stage units at the nominal size. + * + * @param layout lines and glyphs + * @param x left edge of the box in stage coordinates + * @param y top edge of the box in stage coordinates (y up: the box extends downwards) + * @param width width of the box + * @param height height of the box + * @param align 0 left, 1 centre, 2 right: how lines sit within the box, inside the padding + * @param color ARGB of the letters + * @param box how the box is drawn: none, a plain rounded box, or a speech or thought bubble + * @param boxColor ARGB fill of the box + * @param boxStroke ARGB outline of the box + * @param padding space between the box's edge and the letters + * @param tailX for bubbles: the x the tail starts from (the speaking sprite's corner); a tail in + * the right half of the box points the other way (the bubble is on the sprite's left) + */ +public record TextDraw(TextLayout layout, double x, double y, double width, double height, int align, int color, + Box box, int boxColor, int boxStroke, double padding, double tailX) implements Item { + + /** The box around a text. */ + public enum Box { + NONE, + PLAIN, + SPEECH, + THOUGHT + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/TransitionDraw.java b/core/src/main/java/org/openpatch/scratch/internal/draw/TransitionDraw.java new file mode 100644 index 00000000..3580f71f --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/TransitionDraw.java @@ -0,0 +1,12 @@ +package org.openpatch.scratch.internal.draw; + +/** + * A transition in progress: the old stage's last frame and how far along it is. The draw list + * it belongs to is the new stage's. + * + * @param from the old stage's draw list, as it was when the transition started + * @param name a built-in transition ("fade", "crossfade", "slide-left", …) or a shader's file + * @param source a transition shader's body; null for the built-in ones + * @param progress from 0 to 1 + */ +public record TransitionDraw(DrawList from, String name, String source, double progress) {} diff --git a/core/src/main/java/org/openpatch/scratch/internal/draw/package-info.java b/core/src/main/java/org/openpatch/scratch/internal/draw/package-info.java new file mode 100644 index 00000000..80646496 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/draw/package-info.java @@ -0,0 +1,6 @@ +/** + * The draw list: what the game thread hands the renderer at the end of a batch of ticks. + * Immutable records only; the renderer reads nothing else of the scene, + * so it needs no locks and learner objects can change while a frame is drawn. + */ +package org.openpatch.scratch.internal.draw; diff --git a/core/src/main/java/org/openpatch/scratch/internal/geom/Geometry.java b/core/src/main/java/org/openpatch/scratch/internal/geom/Geometry.java new file mode 100644 index 00000000..fae33aed --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/geom/Geometry.java @@ -0,0 +1,246 @@ +package org.openpatch.scratch.internal.geom; + +import java.util.ArrayList; +import java.util.List; + +/** + * Polygon geometry for shapes and hitboxes, without {@code java.awt.geom}. A polygon is one closed + * ring of points {@code {x0, y0, x1, y1, …}}, its last point not repeating the first. Plain arrays + * and plain maths, so the online IDE can port it line by line. + * + *

The rule for overlapping is the one 6.x had: shapes that only touch (along an edge or at a + * point) do not overlap; their overlap has no area. + */ +public final class Geometry { + + private Geometry() {} + + /** Whether the ring is convex; collinear points are allowed, the winding does not matter. */ + public static boolean isConvex(double[] ring) { + int n = ring.length / 2; + if (n < 3) { + return false; + } + int sign = 0; + for (int i = 0; i < n; i++) { + int j = (i + 1) % n, k = (i + 2) % n; + double cross = (ring[2 * j] - ring[2 * i]) * (ring[2 * k + 1] - ring[2 * j + 1]) + - (ring[2 * j + 1] - ring[2 * i + 1]) * (ring[2 * k] - ring[2 * j]); + if (cross == 0) { + continue; + } + int s = cross > 0 ? 1 : -1; + if (sign == 0) { + sign = s; + } else if (sign != s) { + return false; + } + } + return sign != 0; + } + + /** The signed area (shoelace); positive for anticlockwise rings in a y-up system. */ + public static double signedArea(double[] ring) { + int n = ring.length / 2; + double sum = 0; + for (int i = 0; i < n; i++) { + int j = (i + 1) % n; + sum += ring[2 * i] * ring[2 * j + 1] - ring[2 * j] * ring[2 * i + 1]; + } + return sum / 2; + } + + /** + * Convex pieces covering the ring: the ring itself if it is convex, else its triangles by ear + * clipping (simple polygons, concave allowed, either winding). Degenerate pieces are dropped. + */ + public static double[][] convexPieces(double[] ring) { + if (isConvex(ring)) { + return new double[][] {ring}; + } + return triangulate(ring); + } + + /** Ear clipping. A self-intersecting ring gives a best effort: whatever ears can be found. */ + public static double[][] triangulate(double[] ring) { + int n = ring.length / 2; + List left = new ArrayList<>(); + for (int i = 0; i < n; i++) { + left.add(i); + } + double orientation = Math.signum(signedArea(ring)); + List triangles = new ArrayList<>(); + int guard = 0; + while (left.size() > 3 && guard < n * n) { + guard++; + boolean clipped = false; + for (int i = 0; i < left.size(); i++) { + int a = left.get((i + left.size() - 1) % left.size()), b = left.get(i), c = left.get((i + 1) % left.size()); + double cross = cross(ring, a, b, c); + if (cross == 0) { + left.remove(i); // a straight point is no corner at all + clipped = true; + break; + } + if (Math.signum(cross) != orientation) { + continue; // reflex corner + } + if (anyInside(ring, left, a, b, c)) { + continue; + } + triangles.add(new double[] {ring[2 * a], ring[2 * a + 1], ring[2 * b], ring[2 * b + 1], ring[2 * c], + ring[2 * c + 1]}); + left.remove(i); + clipped = true; + break; + } + if (!clipped) { + break; + } + } + if (left.size() == 3) { + int a = left.get(0), b = left.get(1), c = left.get(2); + if (cross(ring, a, b, c) != 0) { + triangles.add(new double[] {ring[2 * a], ring[2 * a + 1], ring[2 * b], ring[2 * b + 1], ring[2 * c], + ring[2 * c + 1]}); + } + } + return triangles.toArray(new double[0][]); + } + + private static double cross(double[] r, int a, int b, int c) { + return (r[2 * b] - r[2 * a]) * (r[2 * c + 1] - r[2 * b + 1]) - (r[2 * b + 1] - r[2 * a + 1]) * (r[2 * c] - r[2 * b]); + } + + /** Whether another remaining point lies inside or on the triangle a, b, c. */ + private static boolean anyInside(double[] r, List left, int a, int b, int c) { + for (int p : left) { + if (p == a || p == b || p == c) { + continue; + } + double px = r[2 * p], py = r[2 * p + 1]; + if (px == r[2 * a] && py == r[2 * a + 1] || px == r[2 * b] && py == r[2 * b + 1] + || px == r[2 * c] && py == r[2 * c + 1]) { + continue; // a repeated point is not in the way + } + double d1 = side(px, py, r[2 * a], r[2 * a + 1], r[2 * b], r[2 * b + 1]); + double d2 = side(px, py, r[2 * b], r[2 * b + 1], r[2 * c], r[2 * c + 1]); + double d3 = side(px, py, r[2 * c], r[2 * c + 1], r[2 * a], r[2 * a + 1]); + boolean negative = d1 < 0 || d2 < 0 || d3 < 0, positive = d1 > 0 || d2 > 0 || d3 > 0; + if (!(negative && positive)) { + return true; + } + } + return false; + } + + private static double side(double px, double py, double ax, double ay, double bx, double by) { + return (px - bx) * (ay - by) - (ax - bx) * (py - by); + } + + /** + * Separating axes for two convex rings: they overlap unless an edge normal separates them. + * Touching counts as apart ({@code aMax <= bMin}), as in 6.x. + */ + public static boolean convexOverlap(double[] a, double[] b) { + return !separated(a, b) && !separated(b, a); + } + + private static boolean separated(double[] a, double[] b) { + int n = a.length / 2; + for (int i = 0; i < n; i++) { + int j = (i + 1) % n; + double axisX = a[2 * j + 1] - a[2 * i + 1]; + double axisY = a[2 * i] - a[2 * j]; + if (axisX == 0 && axisY == 0) { + continue; + } + double aMin = Double.POSITIVE_INFINITY, aMax = Double.NEGATIVE_INFINITY; + for (int k = 0; k < a.length; k += 2) { + double p = a[k] * axisX + a[k + 1] * axisY; + aMin = Math.min(aMin, p); + aMax = Math.max(aMax, p); + } + double bMin = Double.POSITIVE_INFINITY, bMax = Double.NEGATIVE_INFINITY; + for (int k = 0; k < b.length; k += 2) { + double p = b[k] * axisX + b[k + 1] * axisY; + bMin = Math.min(bMin, p); + bMax = Math.max(bMax, p); + } + if (aMax <= bMin || bMax <= aMin) { + return true; + } + } + return false; + } + + /** Whether any convex piece of one overlaps any of the other. */ + public static boolean overlap(double[][] piecesA, double[][] piecesB) { + for (double[] a : piecesA) { + for (double[] b : piecesB) { + if (convexOverlap(a, b)) { + return true; + } + } + } + return false; + } + + /** Point in polygon by crossing number (even-odd); deterministic on the boundary. */ + public static boolean contains(double[] ring, double x, double y) { + int n = ring.length / 2; + boolean inside = false; + for (int i = 0, j = n - 1; i < n; j = i++) { + double xi = ring[2 * i], yi = ring[2 * i + 1], xj = ring[2 * j], yj = ring[2 * j + 1]; + if ((yi > y) != (yj > y) && x < (xj - xi) * (y - yi) / (yj - yi) + xi) { + inside = !inside; + } + } + return inside; + } + + /** {minX, minY, maxX, maxY}; all zero for an empty ring. */ + public static double[] bounds(double[] ring) { + if (ring.length < 2) { + return new double[4]; + } + double minX = ring[0], minY = ring[1], maxX = ring[0], maxY = ring[1]; + for (int i = 2; i < ring.length; i += 2) { + minX = Math.min(minX, ring[i]); + maxX = Math.max(maxX, ring[i]); + minY = Math.min(minY, ring[i + 1]); + maxY = Math.max(maxY, ring[i + 1]); + } + return new double[] {minX, minY, maxX, maxY}; + } + + /** The ring through the affine map {@code x' = a·x + c·y + e}, {@code y' = b·x + d·y + f}. */ + public static double[] transform(double[] ring, double a, double b, double c, double d, double e, double f) { + double[] out = new double[ring.length]; + for (int i = 0; i < ring.length; i += 2) { + double x = ring[i], y = ring[i + 1]; + out[i] = a * x + c * y + e; + out[i + 1] = b * x + d * y + f; + } + return out; + } + + /** + * An ellipse as a polygon whose corners lie on it and whose edges stay within 0.25 of it: enough + * segments that the sagitta {@code r (1 − cos(π / n))} is at most 0.25 (between 12 and 256). + */ + public static double[] ellipse(double cx, double cy, double rx, double ry) { + double r = Math.max(Math.abs(rx), Math.abs(ry)); + int segments = r <= 0.25 ? 12 + : (int) Math.max(12, Math.min(256, Math.ceil(Math.PI / Math.acos(1 - 0.25 / r)))); + // a multiple of 4 puts corners on the four extremes, so the bounds are exact + segments = (segments + 3) / 4 * 4; + double[] ring = new double[2 * segments]; + for (int i = 0; i < segments; i++) { + double t = 2 * Math.PI * i / segments; + ring[2 * i] = cx + rx * Math.cos(t); + ring[2 * i + 1] = cy + ry * Math.sin(t); + } + return ring; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/geom/package-info.java b/core/src/main/java/org/openpatch/scratch/internal/geom/package-info.java new file mode 100644 index 00000000..ad95741f --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/geom/package-info.java @@ -0,0 +1,2 @@ +/** Polygon geometry for shapes and hitboxes: convex pieces, overlap, containment, transforms. */ +package org.openpatch.scratch.internal.geom; diff --git a/core/src/main/java/org/openpatch/scratch/internal/image/Image.java b/core/src/main/java/org/openpatch/scratch/internal/image/Image.java new file mode 100644 index 00000000..8fef966a --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/image/Image.java @@ -0,0 +1,149 @@ +package org.openpatch.scratch.internal.image; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.nio.file.Path; +import org.lwjgl.stb.STBImage; +import org.lwjgl.stb.STBImageWrite; +import org.lwjgl.system.MemoryStack; +import org.lwjgl.system.MemoryUtil; +import org.openpatch.scratch.internal.Natives; + +/** + * An image on the CPU: ARGB pixels (straight alpha, {@code 0xAARRGGBB}), row by row, top row + * first. Costumes share their images and never change them, so the renderer may cache textures by + * image identity. + */ +public final class Image { + + static { + Natives.init(); + } + + private final int width, height; + private final int[] argb; + + /** A transparent image. */ + public Image(int width, int height) { + this(width, height, new int[width * height]); + } + + /** An image of these pixels; the array is used, not copied. */ + public Image(int width, int height, int[] argb) { + if (width < 0 || height < 0 || argb.length != width * height) { + throw new IllegalArgumentException("An image of " + width + " x " + height + " needs " + width * height + + " pixels, not " + argb.length + "."); + } + this.width = width; + this.height = height; + this.argb = argb; + } + + public int getWidth() { + return this.width; + } + + public int getHeight() { + return this.height; + } + + /** The pixels themselves, not a copy. */ + public int[] getArgb() { + return this.argb; + } + + public int get(int x, int y) { + return this.argb[y * this.width + x]; + } + + public void set(int x, int y, int argb) { + this.argb[y * this.width + x] = argb; + } + + public Image copy() { + return new Image(this.width, this.height, this.argb.clone()); + } + + /** A copy of a part, e.g. one frame of a sprite sheet; parts outside the image are transparent. */ + public Image region(int x, int y, int w, int h) { + int[] out = new int[w * h]; + for (int row = 0; row < h; row++) { + int sy = y + row; + if (sy < 0 || sy >= this.height) { + continue; + } + for (int col = 0; col < w; col++) { + int sx = x + col; + if (sx >= 0 && sx < this.width) { + out[row * w + col] = this.argb[sy * this.width + sx]; + } + } + } + return new Image(w, h, out); + } + + /** A copy flipped left to right. */ + public Image mirrorX() { + int[] out = new int[this.argb.length]; + for (int y = 0; y < this.height; y++) { + for (int x = 0; x < this.width; x++) { + out[y * this.width + this.width - 1 - x] = this.argb[y * this.width + x]; + } + } + return new Image(this.width, this.height, out); + } + + /** Writes a PNG with stb_image_write. */ + public void writePng(Path file) throws IOException { + ByteBuffer rgba = MemoryUtil.memAlloc(Math.max(1, this.argb.length * 4)); + try { + for (int p : this.argb) { + rgba.put((byte) (p >> 16)).put((byte) (p >> 8)).put((byte) p).put((byte) (p >>> 24)); + } + rgba.flip(); + Path absolute = file.toAbsolutePath(); + if (absolute.getParent() != null) { + java.nio.file.Files.createDirectories(absolute.getParent()); + } + if (!STBImageWrite.stbi_write_png(absolute.toString(), this.width, this.height, 4, rgba, this.width * 4)) { + throw new IOException("Could not write " + file); + } + } finally { + MemoryUtil.memFree(rgba); + } + } + + /** + * Decodes PNG, JPEG, GIF (first frame), BMP or TGA from memory, the same way for files, the + * classpath and jars. No global stb flags: loading runs on several threads at once. + * + * @param encoded the file's bytes + * @param name for error messages + */ + public static Image decode(byte[] encoded, String name) throws IOException { + ByteBuffer in = MemoryUtil.memAlloc(Math.max(1, encoded.length)); + try (MemoryStack stack = MemoryStack.stackPush()) { + in.put(encoded).flip(); + IntBuffer w = stack.mallocInt(1), h = stack.mallocInt(1), channels = stack.mallocInt(1); + ByteBuffer rgba = STBImage.stbi_load_from_memory(in, w, h, channels, 4); + if (rgba == null) { + throw new IOException("Could not decode " + name + ": " + STBImage.stbi_failure_reason()); + } + try { + int width = w.get(0), height = h.get(0); + int[] argb = new int[width * height]; + for (int i = 0; i < argb.length; i++) { + int r = rgba.get(4 * i) & 0xff, g = rgba.get(4 * i + 1) & 0xff, b = rgba.get(4 * i + 2) & 0xff; + int a = rgba.get(4 * i + 3) & 0xff; + argb[i] = a << 24 | r << 16 | g << 8 | b; + } + return new Image(width, height, argb); + } finally { + STBImage.stbi_image_free(rgba); + } + } finally { + MemoryUtil.memFree(in); + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/image/Images.java b/core/src/main/java/org/openpatch/scratch/internal/image/Images.java new file mode 100644 index 00000000..49187fce --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/image/Images.java @@ -0,0 +1,130 @@ +package org.openpatch.scratch.internal.image; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** Loads images by path and keeps them: a costume used by many sprites is decoded once. */ +public final class Images { + + private static final Map CACHE = new ConcurrentHashMap<>(); + + private Images() {} + + /** + * The image at {@code path}: a file relative to the working directory, else a resource on the + * classpath (the library's built-in images, or a project's assets inside a jar). + * + * @throws IllegalArgumentException when there is no such image or it cannot be decoded + */ + public static Image load(String path) { + Image cached = CACHE.get(path); + if (cached != null) { + return cached; + } + // not computeIfAbsent: decoding may take a while and must not block other paths + Image image = decode(path); + Image raced = CACHE.putIfAbsent(path, image); + if (raced != null) { + return raced; + } + org.openpatch.scratch.internal.Assets.noteLoadedLate("image", path); + return image; + } + + /** A bundled sprite, turned to face right as sprites do at direction 90 (the atlas says how it is drawn). */ + private static Image builtin(String name) { + var entry = org.openpatch.scratch.internal.BuiltinAssets.get(name); + if (entry == null) { + var close = org.openpatch.scratch.internal.BuiltinAssets.suggest(name, 3); + throw new IllegalArgumentException("There is no built-in sprite called \"" + name + "\"" + + (close.isEmpty() ? "." : ". Did you mean " + String.join(", ", close) + "?") + + " An image file needs its extension, e.g. \"" + name + ".png\"."); + } + Image sheet = load(entry.sheetPath()); + Image picture = sheet.region(entry.x(), entry.y(), entry.width(), entry.height()); + return turnToFaceRight(picture, entry.direction()); + } + + /** Turns a picture drawn facing up (0), down (180) or left (270) so that it faces right. */ + static Image turnToFaceRight(Image image, double direction) { + double degrees = ((direction % 360) + 360) % 360; + if (degrees == 90) { + return image; + } + if (degrees % 90 != 0) { + throw new IllegalArgumentException("A built-in sprite can only face up, right, down or left, not " + direction); + } + int w = image.getWidth(), h = image.getHeight(); + boolean quarter = degrees != 270; + int[] in = image.getArgb(), out = new int[in.length]; + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { + int pixel = in[y * w + x]; + if (degrees == 0) { + out[x * h + (h - 1 - y)] = pixel; // up: the top edge becomes the right edge + } else if (degrees == 180) { + out[(w - 1 - x) * h + y] = pixel; // down: the bottom edge becomes the right edge + } else { + out[y * w + (w - 1 - x)] = pixel; // left: mirrored + } + } + } + return quarter ? new Image(h, w, out) : new Image(w, h, out); + } + + /** The bytes at {@code path} (file first, then classpath), or null. */ + public static byte[] read(String path) { + try { + Path file = Path.of(path); + if (Files.isRegularFile(file)) { + return Files.readAllBytes(file); + } + String resource = path.startsWith("/") ? path.substring(1) : path; + // the library's own files first: on the module path its folders (images/, sounds/) count + // as packages of the module, which only a class of the module can read; then the program's + InputStream in = Images.class.getResourceAsStream("/" + resource); + if (in == null) { + in = Images.class.getClassLoader().getResourceAsStream(resource); + } + if (in == null && Thread.currentThread().getContextClassLoader() != null) { + in = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); + } + if (in == null) { + return null; + } + try (InputStream stream = in) { + return stream.readAllBytes(); + } + } catch (IOException e) { + throw new UncheckedIOException("Could not read " + path, e); + } catch (java.nio.file.InvalidPathException e) { + return null; + } + } + + private static Image decode(String path) { + if (org.openpatch.scratch.internal.BuiltinAssets.isBuiltinName(path)) { + return builtin(path); + } + byte[] bytes = read(path); + if (bytes == null) { + throw new IllegalArgumentException("Image not found: " + path + + " (looked for a file relative to " + Path.of("").toAbsolutePath() + " and on the classpath)"); + } + try { + var format = org.openpatch.scratch.internal.ExtensionHost.imageFormat(path); + if (format != null) { + var decoded = format.decode(bytes); + return new Image(decoded.width(), decoded.height(), decoded.argb()); + } + return Image.decode(bytes, path); + } catch (IOException e) { + throw new IllegalArgumentException(e.getMessage(), e); + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/image/package-info.java b/core/src/main/java/org/openpatch/scratch/internal/image/package-info.java new file mode 100644 index 00000000..aee3aaae --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/image/package-info.java @@ -0,0 +1,2 @@ +/** CPU images: decoded with stb_image, ARGB pixels top row first, cached by path. */ +package org.openpatch.scratch.internal.image; diff --git a/core/src/main/java/org/openpatch/scratch/internal/input/InputEvent.java b/core/src/main/java/org/openpatch/scratch/internal/input/InputEvent.java new file mode 100644 index 00000000..48f6a6a3 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/input/InputEvent.java @@ -0,0 +1,34 @@ +package org.openpatch.scratch.internal.input; + +import org.openpatch.scratch.KeyCode; +import org.openpatch.scratch.MouseCode; + +/** + * An input event, queued by the window thread (or a test) and handed out on the game thread at + * the start of the next batch of ticks. Coordinates are stage coordinates (origin in the centre, + * y up), already mapped through the letterbox; the camera is applied later. + */ +public sealed interface InputEvent { + + /** A key went down or up. Auto-repeat never arrives here. */ + record Key(KeyCode key, boolean pressed) implements InputEvent {} + + /** A character was typed (umlauts and dead keys included). */ + record Typed(int codepoint) implements InputEvent {} + + /** + * A held key repeating (GLFW_REPEAT). Not a key event for learners, who get one + * {@code whenKeyPressed} per press as Processing had it; only the text box of {@code ask()} + * acts on it, so holding Backspace keeps deleting. + */ + record Repeat(KeyCode key) implements InputEvent {} + + /** A mouse button went down or up at a point. */ + record Button(MouseCode button, boolean pressed, double x, double y) implements InputEvent {} + + /** The mouse moved to a point. */ + record Move(double x, double y) implements InputEvent {} + + /** The wheel turned; positive is towards the user (down), in notches. */ + record Wheel(double steps) implements InputEvent {} +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/input/InputState.java b/core/src/main/java/org/openpatch/scratch/internal/input/InputState.java new file mode 100644 index 00000000..d456dddd --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/input/InputState.java @@ -0,0 +1,70 @@ +package org.openpatch.scratch.internal.input; + +import java.util.EnumSet; +import java.util.Set; +import org.openpatch.scratch.KeyCode; +import org.openpatch.scratch.MouseCode; + +/** + * What learner code can ask about the keyboard and the mouse: the game thread's copy, changed + * only by events at the start of a batch, so it stays the same for every statement of a tick. + */ +public final class InputState { + + private final Set keysDown = EnumSet.noneOf(KeyCode.class); + private final Set buttonsDown = EnumSet.noneOf(MouseCode.class); + private double mouseX, mouseY; + + /** Applies an event to the state. */ + public void apply(InputEvent event) { + if (event instanceof InputEvent.Key k) { + if (k.pressed()) { + this.keysDown.add(k.key()); + } else { + this.keysDown.remove(k.key()); + } + } else if (event instanceof InputEvent.Button b) { + // held while dragging: only a release ends it (6.x dropped it on every move) + if (b.pressed()) { + this.buttonsDown.add(b.button()); + } else { + this.buttonsDown.remove(b.button()); + } + this.mouseX = b.x(); + this.mouseY = b.y(); + } else if (event instanceof InputEvent.Move m) { + this.mouseX = m.x(); + this.mouseY = m.y(); + } + } + + public boolean isKeyDown(KeyCode key) { + return this.keysDown.contains(key); + } + + public boolean isAnyKeyDown() { + return !this.keysDown.isEmpty(); + } + + public boolean isMouseDown() { + return !this.buttonsDown.isEmpty(); + } + + public boolean isButtonDown(MouseCode button) { + return this.buttonsDown.contains(button); + } + + public double getMouseX() { + return this.mouseX; + } + + public double getMouseY() { + return this.mouseY; + } + + /** Forgets everything held: a window losing focus never sees the release. */ + public void clear() { + this.keysDown.clear(); + this.buttonsDown.clear(); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/loop/GameLoop.java b/core/src/main/java/org/openpatch/scratch/internal/loop/GameLoop.java new file mode 100644 index 00000000..aeed9f90 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/loop/GameLoop.java @@ -0,0 +1,174 @@ +package org.openpatch.scratch.internal.loop; + +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.LearnerError; +import org.openpatch.scratch.internal.draw.DrawList; + +/** + * The game thread and its lockstep with the window thread. The window + * thread hands over a batch of ticks with {@link #runBatch(int, Runnable)} and waits for the + * draw list, polling meanwhile, so nothing is drawn while learner code runs and the window stays + * movable and closable when learner code hangs. A watchdog names the learner's line when a batch + * takes longer than 2 s. + */ +public final class GameLoop { + + /** How long a batch may take before the watchdog speaks up. */ + static final long HANG_NANOS = 2_000_000_000L; + /** How long {@code whenExits()} may take before the program ends anyway. */ + static final long EXIT_MILLIS = 1000; + + private static final int EXIT = -1; + + private final Game game; + private final BlockingQueue batches = new LinkedBlockingQueue<>(); + private final BlockingQueue results = new LinkedBlockingQueue<>(); + private final CountDownLatch exited = new CountDownLatch(1); + private final Thread thread; + private final Thread watchdog; + private final PrintStream err; + private volatile long batchStarted; + private volatile boolean closed; + + public GameLoop(Game game) { + this(game, System.err); + } + + GameLoop(Game game, PrintStream err) { + this.game = game; + this.err = err; + this.thread = new Thread(this::loop, "scratch4j-game"); + this.thread.setDaemon(true); + this.watchdog = new Thread(this::watch, "scratch4j-watchdog"); + this.watchdog.setDaemon(true); + } + + public void start() { + this.thread.start(); + this.watchdog.start(); + } + + public Thread getThread() { + return this.thread; + } + + /** + * Runs {@code ticks} on the game thread and returns the draw list made after them. While the + * game thread works, {@code whileWaiting} runs every few milliseconds (GLFW polling) and may + * call {@link #close()}; then this returns null. + */ + public DrawList runBatch(int ticks, Runnable whileWaiting) { + this.batches.add(ticks); + try { + while (true) { + DrawList[] result = this.results.poll(5, TimeUnit.MILLISECONDS); + if (result != null) { + return result[0]; + } + whileWaiting.run(); + if (this.closed) { + return null; + } + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + return null; + } + } + + /** Makes a waiting {@link #runBatch} return; called when the window is closed. */ + public void close() { + this.closed = true; + } + + /** + * Runs {@code whenExits()} on the game thread and waits at most 1 s for it. + * + * @return whether the game thread answered in time (a hanging one is skipped) + */ + public boolean exit() { + this.batches.add(EXIT); + try { + return this.exited.await(EXIT_MILLIS, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + return false; + } + } + + private void loop() { + try { + while (true) { + int ticks = this.batches.take(); + if (ticks == EXIT) { + this.game.exit(); + this.exited.countDown(); + return; + } + this.batchStarted = System.nanoTime(); + DrawList list; + try { + if (ticks == 0) { + this.game.runInputOnly(); // paused, or a screen faster than the ticks: input still arrives + } else { + this.game.runTicks(ticks); + } + org.openpatch.scratch.internal.Preview.beforeDraw(this.game); + list = this.game.drawList(); + org.openpatch.scratch.internal.Preview.afterDraw(); + } finally { + this.batchStarted = 0; + } + this.results.add(new DrawList[] {list}); + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + + private void watch() { + long reportedFor = 0; + while (true) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + return; + } + long started = this.batchStarted; + if (started == 0 || started == reportedFor || System.nanoTime() - started < HANG_NANOS) { + continue; + } + reportedFor = started; + this.err.print(hangMessage(this.thread.getStackTrace())); + } + } + + /** "MySprite.run (MySprite.java:12) has not returned for 2 seconds. …" with the learner's frames. */ + static String hangMessage(StackTraceElement[] trace) { + List learner = new ArrayList<>(); + for (StackTraceElement e : trace) { + if (LearnerError.isLearnerFrame(e)) { + learner.add(e); + } + } + StringBuilder out = new StringBuilder(); + if (learner.isEmpty()) { + out.append("The game has not finished a tick for 2 seconds.\n"); + } else { + out.append(LearnerError.describe(learner.get(0))) + .append(" has not returned for 2 seconds. Is there a loop that never ends?\n"); + } + for (StackTraceElement e : learner) { + out.append(" at ").append(e).append('\n'); + } + out.append("The window stays open; closing it ends the program.\n"); + return out.toString(); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/loop/TickClock.java b/core/src/main/java/org/openpatch/scratch/internal/loop/TickClock.java new file mode 100644 index 00000000..712dd429 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/loop/TickClock.java @@ -0,0 +1,92 @@ +package org.openpatch.scratch.internal.loop; + +/** + * Decides how many ticks the game runs in a frame. A tick is exactly + * 1/60 s of game time; game speed changes how many ticks run per second, not their length. + * Called once per frame on the window thread; not thread-safe. + */ +public final class TickClock { + + /** The length of a tick in seconds of game time. */ + public static final double TICK = 1 / 60.0; + /** More ticks owed than this in one frame are dropped: the game slows down instead. */ + public static final int MAX_TICKS_PER_FRAME = 8; + /** A frame longer than this (a breakpoint, a dragged window, a sleeping laptop) counts as this. */ + static final double MAX_FRAME = 0.25; + + private double refreshPeriod = TICK; + private double gameSpeed = 1; + private double owed; + private boolean paused; + private int steps; + + /** + * The screen's refresh rate, for snapping frame times. A rate within 0.5 % of 60 Hz counts as + * exactly 60 Hz, so a 59.94 Hz screen runs one tick per frame instead of a double tick every + * 17 s; 0 or less means unknown (60 Hz is assumed). + */ + public void useRefreshRate(int hz) { + this.refreshPeriod = hz <= 0 || Math.abs(hz - 60) / 60.0 <= 0.005 ? TICK : 1.0 / hz; + } + + /** Game speed between 0 and 8: how many ticks run per 1/60 s of real time. */ + public void setGameSpeed(double gameSpeed) { + if (!(gameSpeed >= 0 && gameSpeed <= MAX_TICKS_PER_FRAME)) { + throw new IllegalArgumentException("The game speed has to be between 0 and 8, not " + gameSpeed + "."); + } + this.gameSpeed = gameSpeed; + } + + public double getGameSpeed() { + return this.gameSpeed; + } + + /** Pausing and resuming forget the time owed, so resuming starts without a burst of ticks. */ + public void setPaused(boolean paused) { + if (this.paused != paused) { + this.paused = paused; + this.owed = 0; + } + } + + public boolean isPaused() { + return this.paused; + } + + /** While paused: run exactly one more tick in the next frame. */ + public void step() { + this.steps++; + } + + /** + * The ticks to run for a frame that took {@code elapsed} seconds of real time since the last + * one. + */ + public int advance(double elapsed) { + if (this.paused) { + if (this.steps > 0) { + this.steps--; + return 1; + } + return 0; + } + elapsed = this.snap(Math.min(Math.max(elapsed, 0), MAX_FRAME)); + this.owed += elapsed * this.gameSpeed; + // the epsilon keeps a sum of exact 1/60ths from landing a hair below a whole tick + int ticks = (int) Math.min(Math.floor(this.owed / TICK + 1e-9), MAX_TICKS_PER_FRAME); + this.owed = Math.max(0, this.owed - ticks * TICK); + if (ticks == MAX_TICKS_PER_FRAME) { + this.owed = Math.min(this.owed, TICK); + } + return ticks; + } + + /** Near a whole number of refresh periods: exactly that many, so timer jitter changes nothing. */ + double snap(double elapsed) { + long periods = Math.round(elapsed / this.refreshPeriod); + if (periods >= 1 && Math.abs(elapsed - periods * this.refreshPeriod) < 0.1 * this.refreshPeriod) { + return periods * this.refreshPeriod; + } + return elapsed; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/render/CostumeAtlas.java b/core/src/main/java/org/openpatch/scratch/internal/render/CostumeAtlas.java new file mode 100644 index 00000000..5b1e7ba5 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/render/CostumeAtlas.java @@ -0,0 +1,140 @@ +package org.openpatch.scratch.internal.render; + +import static org.lwjgl.opengl.GL33C.*; + +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import org.openpatch.scratch.internal.image.Image; + +/** + * Costumes packed into shared textures, so sprites with different costumes are drawn in one go. + * Each costume gets a cell on an 8-pixel grid with an 8-pixel border repeating its edge pixels: + * smooth sampling and the three mip levels kept stay inside the cell, so a costume looks as it + * does in a texture of its own (clamped at its edges). Costumes larger than {@link #MAX_SIZE} + * keep a texture of their own. Window thread only. + */ +final class CostumeAtlas { + + static final int PAGE = 2048; + /** The border around a costume, also the grid cells start on: 2 to the number of mip levels. */ + static final int PAD = 8; + static final int LEVELS = 3; + static final int MAX_SIZE = 512; + + /** Where a costume lies: a page's texture and the costume's corners in its coordinates. */ + record Region(int texture, double u0, double v0, double u1, double v1) { + + double u(double u) { + return this.u0 + u * (this.u1 - this.u0); + } + + double v(double v) { + return this.v0 + v * (this.v1 - this.v0); + } + } + + private static final class Page { + final int id; + int x, y, shelfHeight; + + Page(int id) { + this.id = id; + } + } + + private final boolean smooth; + private final List pages = new ArrayList<>(); + private final Map regions = new IdentityHashMap<>(); + + CostumeAtlas(boolean smooth) { + this.smooth = smooth; + } + + /** @return where the costume lies, or null when it is not in the atlas (yet) */ + Region find(Image image) { + return this.regions.get(image); + } + + /** @return whether the costume belongs in the atlas: small enough */ + static boolean fits(Image image) { + return image.getWidth() <= MAX_SIZE && image.getHeight() <= MAX_SIZE && image.getWidth() > 0 + && image.getHeight() > 0; + } + + /** + * Puts a costume into a page. Binds that page's texture: whoever was drawing has to draw what it + * collected first. + */ + Region add(Image image, int[] premultiplied) { + int w = image.getWidth(), h = image.getHeight(); + int cellW = align(w + 2 * PAD), cellH = align(h + 2 * PAD); + Page page = this.place(cellW, cellH); + int cx = page.x, cy = page.y; + page.x += cellW; + page.shelfHeight = Math.max(page.shelfHeight, cellH); + // the cell: the costume, its edge pixels repeated into the border (clamping, as at a texture's edge) + int[] cell = new int[cellW * cellH]; + for (int y = 0; y < cellH; y++) { + int sy = Math.max(0, Math.min(h - 1, y - PAD)); + for (int x = 0; x < cellW; x++) { + int sx = Math.max(0, Math.min(w - 1, x - PAD)); + cell[y * cellW + x] = premultiplied[sy * w + sx]; + } + } + glBindTexture(GL_TEXTURE_2D, page.id); + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glTexSubImage2D(GL_TEXTURE_2D, 0, cx, cy, cellW, cellH, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, cell); + if (this.smooth) { + glGenerateMipmap(GL_TEXTURE_2D); + } + Region region = new Region(page.id, (cx + PAD) / (double) PAGE, (cy + PAD) / (double) PAGE, + (cx + PAD + w) / (double) PAGE, (cy + PAD + h) / (double) PAGE); + this.regions.put(image, region); + return region; + } + + /** The page and shelf with room for a cell, a new shelf or a new page if needed. */ + private Page place(int cellW, int cellH) { + for (Page page : this.pages) { + if (page.x + cellW > PAGE) { + page.y += page.shelfHeight; + page.x = 0; + page.shelfHeight = 0; + } + if (page.y + cellH <= PAGE) { + return page; + } + } + Page page = new Page(this.newTexture()); + this.pages.add(page); + return page; + } + + private int newTexture() { + int id = glGenTextures(); + glBindTexture(GL_TEXTURE_2D, id); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, PAGE, PAGE, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer) null); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, this.smooth ? LEVELS : 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, this.smooth ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, this.smooth ? GL_LINEAR : GL_NEAREST); + return id; + } + + private static int align(int size) { + return (size + PAD - 1) / PAD * PAD; + } + + void delete() { + for (Page page : this.pages) { + glDeleteTextures(page.id); + } + this.pages.clear(); + this.regions.clear(); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/render/GlyphAtlas.java b/core/src/main/java/org/openpatch/scratch/internal/render/GlyphAtlas.java new file mode 100644 index 00000000..df06ae30 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/render/GlyphAtlas.java @@ -0,0 +1,93 @@ +package org.openpatch.scratch.internal.render; + +import static org.lwjgl.opengl.GL33C.*; + +import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.Map; +import org.lwjgl.system.MemoryUtil; +import org.openpatch.scratch.internal.text.Font; +import org.openpatch.scratch.internal.text.GlyphRasterizer; +import org.openpatch.scratch.internal.text.GlyphRasterizer.GlyphBitmap; + +/** + * Glyph coverage rasterised at device size, packed into atlas pages on demand: no fixed + * font sizes. Shelf packing; a full page starts the next. Window thread only. + */ +final class GlyphAtlas { + + static final int PAGE = 1024; + /** Sub-pixel positions per device pixel in normal mode. */ + static final int SUBPIXELS = 4; + + /** Where a glyph is: its page, its pixels on the page, its offset from the pen position. */ + record Slot(int page, int x, int y, int width, int height, int offsetX, int offsetY) {} + + private record Key(Font font, int codepoint, int deviceSize100, int subpixel, boolean pixelArt) {} + + private final Map slots = new HashMap<>(); + private final java.util.List pages = new java.util.ArrayList<>(); + private int shelfX, shelfY, shelfHeight; + + int page(int index) { + return this.pages.get(index); + } + + /** The glyph at a device size and sub-pixel offset (0 ≤ subpixel < 1), rasterised once. */ + Slot glyph(Font font, int codepoint, double deviceSize, double subpixel, boolean pixelArt) { + int bucket = pixelArt ? 0 : (int) Math.floor(subpixel * SUBPIXELS) % SUBPIXELS; + Key key = new Key(font, codepoint, (int) Math.round(deviceSize * 100), bucket, pixelArt); + Slot slot = this.slots.get(key); + if (slot == null) { + GlyphBitmap bitmap = GlyphRasterizer.rasterize(font, codepoint, deviceSize, bucket / (double) SUBPIXELS, + pixelArt); + slot = this.place(bitmap); + this.slots.put(key, slot); + } + return slot; + } + + private Slot place(GlyphBitmap bitmap) { + int w = bitmap.width(), h = bitmap.height(); + if (w == 0 || h == 0) { + return new Slot(-1, 0, 0, 0, 0, bitmap.offsetX(), bitmap.offsetY()); + } + if (w + 2 > PAGE || h + 2 > PAGE) { + return new Slot(-1, 0, 0, 0, 0, 0, 0); // larger than a page: not drawn + } + if (this.pages.isEmpty() || this.shelfX + w + 1 > PAGE) { + this.shelfX = 1; + this.shelfY += this.shelfHeight + 1; + this.shelfHeight = 0; + } + if (this.pages.isEmpty() || this.shelfY + h + 1 > PAGE) { + this.pages.add(Gpu.coverageTexture(PAGE, PAGE)); + this.shelfX = 1; + this.shelfY = 1; + this.shelfHeight = 0; + } + int page = this.pages.size() - 1; + ByteBuffer pixels = MemoryUtil.memAlloc(w * h).put(bitmap.coverage()).flip(); + try { + glBindTexture(GL_TEXTURE_2D, this.pages.get(page)); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glTexSubImage2D(GL_TEXTURE_2D, 0, this.shelfX, this.shelfY, w, h, GL_RED, GL_UNSIGNED_BYTE, pixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + } finally { + MemoryUtil.memFree(pixels); + } + Slot slot = new Slot(page, this.shelfX, this.shelfY, w, h, bitmap.offsetX(), bitmap.offsetY()); + this.shelfX += w + 1; + this.shelfHeight = Math.max(this.shelfHeight, h); + return slot; + } + + void delete() { + for (int page : this.pages) { + glDeleteTextures(page); + } + this.pages.clear(); + this.slots.clear(); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/render/Gpu.java b/core/src/main/java/org/openpatch/scratch/internal/render/Gpu.java new file mode 100644 index 00000000..1f5ef9c9 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/render/Gpu.java @@ -0,0 +1,260 @@ +package org.openpatch.scratch.internal.render; + +import static org.lwjgl.opengl.GL33C.*; + +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import org.lwjgl.system.MemoryUtil; + +/** Textures, render targets and a vertex batch: the renderer's GPU objects. Window thread only. */ +final class Gpu { + + private Gpu() {} + + /** Straight ARGB ints → premultiplied ARGB ints, as every texture holds them. */ + static int[] premultiply(int[] argb) { + int[] out = new int[argb.length]; + for (int i = 0; i < argb.length; i++) { + int c = argb[i], a = c >>> 24; + if (a == 255) { + out[i] = c; + } else if (a != 0) { + int r = ((c >> 16) & 0xff) * a / 255, g = ((c >> 8) & 0xff) * a / 255, b = (c & 0xff) * a / 255; + out[i] = a << 24 | r << 16 | g << 8 | b; + } + } + return out; + } + + /** A texture. ARGB ints go up as GL_BGRA / GL_UNSIGNED_INT_8_8_8_8_REV: no byte shuffling. */ + static final class Texture { + final int id; + final int width, height; + boolean smooth; + + Texture(int width, int height, int[] argbPremultiplied, boolean smooth, boolean mipmaps) { + this.id = glGenTextures(); + this.width = width; + this.height = height; + glBindTexture(GL_TEXTURE_2D, this.id); + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + if (argbPremultiplied == null) { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + (IntBuffer) null); + } else { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + argbPremultiplied); + } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + this.setSmooth(smooth, mipmaps); + } + + void setSmooth(boolean smooth, boolean mipmaps) { + this.smooth = smooth; + glBindTexture(GL_TEXTURE_2D, this.id); + if (smooth && mipmaps) { + glGenerateMipmap(GL_TEXTURE_2D); + } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + smooth ? (mipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR) : GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, smooth ? GL_LINEAR : GL_NEAREST); + } + + /** Replaces a region; {@code argb} straight, premultiplied here. */ + void update(int x, int y, int w, int h, int[] argb) { + glBindTexture(GL_TEXTURE_2D, this.id); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, premultiply(argb)); + } + + void delete() { + glDeleteTextures(this.id); + } + } + + /** + * Something to draw into: a texture, optionally behind a multisampled buffer that is resolved + * into it. + */ + static final class Target { + final int width, height; + final Texture texture; + private final int fbo; + private final int msaaFbo, msaaBuffer; + + Target(int width, int height, int samples, boolean smooth) { + this.width = width; + this.height = height; + this.texture = new Texture(width, height, null, smooth, false); + this.fbo = glGenFramebuffers(); + glBindFramebuffer(GL_FRAMEBUFFER, this.fbo); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, this.texture.id, 0); + check("target"); + if (samples > 1) { + this.msaaFbo = glGenFramebuffers(); + glBindFramebuffer(GL_FRAMEBUFFER, this.msaaFbo); + this.msaaBuffer = glGenRenderbuffers(); + glBindRenderbuffer(GL_RENDERBUFFER, this.msaaBuffer); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_RGBA8, width, height); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, this.msaaBuffer); + check("multisampled target"); + } else { + this.msaaFbo = 0; + this.msaaBuffer = 0; + } + glBindFramebuffer(GL_FRAMEBUFFER, 0); + } + + /** Draw into it from now on, the whole of it. */ + void bind() { + glBindFramebuffer(GL_FRAMEBUFFER, this.msaaFbo != 0 ? this.msaaFbo : this.fbo); + glViewport(0, 0, this.width, this.height); + } + + /** Makes what was drawn readable in {@link #texture}. */ + void resolve() { + if (this.msaaFbo != 0) { + glBindFramebuffer(GL_READ_FRAMEBUFFER, this.msaaFbo); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, this.fbo); + glBlitFramebuffer(0, 0, this.width, this.height, 0, 0, this.width, this.height, GL_COLOR_BUFFER_BIT, + GL_NEAREST); + } + glBindFramebuffer(GL_FRAMEBUFFER, 0); + } + + /** + * The resolved pixels as straight ARGB, top row first. Targets are drawn with their top row + * at row 0 (the renderer flips its projection for them), so no rows are swapped here. + */ + int[] read() { + glBindFramebuffer(GL_READ_FRAMEBUFFER, this.fbo); + int[] out = new int[this.width * this.height]; + glReadPixels(0, 0, this.width, this.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, out); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + for (int i = 0; i < out.length; i++) { + int c = out[i], a = c >>> 24; + if (a != 0 && a != 255) { + int r = Math.min(255, ((c >> 16) & 0xff) * 255 / a), g = Math.min(255, ((c >> 8) & 0xff) * 255 / a); + int b = Math.min(255, (c & 0xff) * 255 / a); + out[i] = a << 24 | r << 16 | g << 8 | b; + } + } + return out; + } + + void delete() { + this.texture.delete(); + glDeleteFramebuffers(this.fbo); + if (this.msaaFbo != 0) { + glDeleteFramebuffers(this.msaaFbo); + glDeleteRenderbuffers(this.msaaBuffer); + } + } + + private static void check(String what) { + int status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + throw new IllegalStateException(what + " incomplete: 0x" + Integer.toHexString(status)); + } + } + } + + /** + * Triangles with position (pixels), texture coordinates and a premultiplied colour, sent in one + * buffer upload per flush. + */ + static final class Batch { + // position 2, texture coordinates 2, colour 4, effect tint 4, colour effect + ghost 2 + static final int FLOATS = 14; + private final int vao, vbo; + private FloatBuffer data = MemoryUtil.memAllocFloat(FLOATS * 6 * 1024); + private int vertices; + + Batch() { + this.vao = glGenVertexArrays(); + glBindVertexArray(this.vao); + this.vbo = glGenBuffers(); + glBindBuffer(GL_ARRAY_BUFFER, this.vbo); + glVertexAttribPointer(0, 2, GL_FLOAT, false, FLOATS * Float.BYTES, 0); + glEnableVertexAttribArray(0); + glVertexAttribPointer(1, 2, GL_FLOAT, false, FLOATS * Float.BYTES, 2L * Float.BYTES); + glEnableVertexAttribArray(1); + glVertexAttribPointer(2, 4, GL_FLOAT, false, FLOATS * Float.BYTES, 4L * Float.BYTES); + glEnableVertexAttribArray(2); + glVertexAttribPointer(3, 4, GL_FLOAT, false, FLOATS * Float.BYTES, 8L * Float.BYTES); + glEnableVertexAttribArray(3); + glVertexAttribPointer(4, 2, GL_FLOAT, false, FLOATS * Float.BYTES, 12L * Float.BYTES); + glEnableVertexAttribArray(4); + } + + // the effects written into every vertex from now on (programs without effects ignore them) + private float effectTurns, effectR = 1, effectG = 1, effectB = 1, effectA = 1, effectGhost = 1; + + /** The graphic effects of the quads that follow: the colour effect in turns, tint, ghost. */ + void effects(float turns, float r, float g, float b, float a, float ghost) { + this.effectTurns = turns; + this.effectR = r; + this.effectG = g; + this.effectB = b; + this.effectA = a; + this.effectGhost = ghost; + } + + void vertex(double x, double y, double u, double v, float r, float g, float b, float a) { + if (this.data.remaining() < FLOATS) { + FloatBuffer bigger = MemoryUtil.memAllocFloat(this.data.capacity() * 2); + this.data.flip(); + bigger.put(this.data); + MemoryUtil.memFree(this.data); + this.data = bigger; + } + this.data.put((float) x).put((float) y).put((float) u).put((float) v).put(r).put(g).put(b).put(a) + .put(this.effectR).put(this.effectG).put(this.effectB).put(this.effectA).put(this.effectTurns) + .put(this.effectGhost); + this.vertices++; + } + + /** A quad as two triangles: corners in order top-left, top-right, bottom-right, bottom-left. */ + void quad(double[] xy, double u0, double v0, double u1, double v1, float r, float g, float b, float a) { + this.vertex(xy[0], xy[1], u0, v0, r, g, b, a); + this.vertex(xy[2], xy[3], u1, v0, r, g, b, a); + this.vertex(xy[4], xy[5], u1, v1, r, g, b, a); + this.vertex(xy[0], xy[1], u0, v0, r, g, b, a); + this.vertex(xy[4], xy[5], u1, v1, r, g, b, a); + this.vertex(xy[6], xy[7], u0, v1, r, g, b, a); + } + + boolean isEmpty() { + return this.vertices == 0; + } + + /** Draws what was collected and starts over. */ + void flush() { + if (this.vertices == 0) { + return; + } + this.data.flip(); + glBindVertexArray(this.vao); + glBindBuffer(GL_ARRAY_BUFFER, this.vbo); + glBufferData(GL_ARRAY_BUFFER, this.data, GL_STREAM_DRAW); + glDrawArrays(GL_TRIANGLES, 0, this.vertices); + this.data.clear(); + this.vertices = 0; + } + } + + /** Bytes of one channel uploaded as GL_RED, for glyph coverage. */ + static int coverageTexture(int width, int height) { + int id = glGenTextures(); + glBindTexture(GL_TEXTURE_2D, id); + glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, (ByteBuffer) null); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + return id; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/render/Programs.java b/core/src/main/java/org/openpatch/scratch/internal/render/Programs.java new file mode 100644 index 00000000..a43fc2ae --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/render/Programs.java @@ -0,0 +1,257 @@ +package org.openpatch.scratch.internal.render; + +import static org.lwjgl.opengl.GL33C.*; + +import java.util.HashMap; +import java.util.Map; + +/** + * The GLSL programs of the renderer. Textures hold premultiplied alpha, so smooth filtering leaves + * no dark fringes; student shaders see straight alpha, as the 7.0 shader format promises: their + * {@code texture()} is wrapped, and their {@code color} is premultiplied after their body. + * Window thread only. + */ +final class Programs { + + /** Positions in pixels of the target, through a 3×3 matrix into clip space. */ + static final String VERTEX = """ + #version 330 core + layout(location = 0) in vec2 position; + layout(location = 1) in vec2 texCoord; + layout(location = 2) in vec4 vertexColor; + layout(location = 3) in vec4 vertexEffectTint; + layout(location = 4) in vec2 vertexEffects; // colour effect in turns, ghost (how much stays) + uniform mat3 transform; + out vec2 uv; + out vec4 tint; + flat out vec4 _effectTint; + flat out vec2 _effects; + void main() { + gl_Position = vec4((transform * vec3(position, 1.0)).xy, 0.0, 1.0); + uv = texCoord; + tint = vertexColor; + _effectTint = vertexEffectTint; + _effects = vertexEffects; + } + """; + + /** + * The graphic effects, the same maths as {@code Effects.apply} on the CPU: hue turned in HSV, + * then tint, then ghost. On straight colours. They come with the vertices, so sprites with + * different effects are drawn together. + */ + static final String EFFECTS = """ + flat in vec4 _effectTint; // multiplies, straight + flat in vec2 _effects; // colour effect in turns 0..1, ghost: how much stays 0..1 + vec3 _rgb2hsv(vec3 c) { + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); + vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); + } + vec3 _hsv2rgb(vec3 c) { + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); + } + vec4 effects(vec4 c) { + if (c.a <= 0.0) return c; + float colorEffect = _effects.x; + if (colorEffect != 0.0) { + vec3 hsv = _rgb2hsv(c.rgb); + if (hsv.z < 0.055) { + hsv = vec3(0.0, 1.0, 0.055); + } else if (hsv.y < 0.09) { + hsv = vec3(0.0, 0.09, hsv.z); + } + hsv.x = fract(hsv.x + colorEffect); + c.rgb = _hsv2rgb(hsv); + } + c *= _effectTint; + c.a *= _effects.y; + return c; + } + """; + + /** Textured quads: premultiplied in, effects on the straight colour, premultiplied out. */ + static final String SPRITE = """ + #version 330 core + uniform sampler2D image; + in vec2 uv; + in vec4 tint; + out vec4 fragColor; + """ + EFFECTS + """ + void main() { + vec4 p = texture(image, uv) * tint; + vec4 c = p.a > 0.0 ? vec4(p.rgb / p.a, p.a) : vec4(0.0); + c = effects(c); + fragColor = vec4(c.rgb * c.a, c.a); + } + """; + + /** Solid shapes and glyph coverage: the vertex colour (premultiplied) times the texture's red. */ + static final String COVERAGE = """ + #version 330 core + uniform sampler2D image; + uniform bool useTexture; + in vec2 uv; + in vec4 tint; + out vec4 fragColor; + void main() { + float coverage = useTexture ? texture(image, uv).r : 1.0; + fragColor = tint * coverage; + } + """; + + /** + * What every student shader gets in front of its body (decision log, Phase 2). Its + * {@code main} becomes {@code _student}; a wrapper premultiplies its {@code color} and applies + * the sprite's effects after it. + */ + static String studentFragment(String body) { + return """ + #version 330 core + uniform sampler2D costume; + uniform vec2 resolution; + uniform float time; + in vec2 uv; + in vec4 tint; + out vec4 fragColor; + vec4 color; + vec4 _straight(vec4 p) { return p.a > 0.0 ? vec4(p.rgb / p.a, p.a) : vec4(0.0); } + #define texture(s, p) _straight(texture(s, p)) + """ + EFFECTS + """ + #define main _student + #line 1 + """ + body + """ + + #undef main + void main() { + color = vec4(0.0); + _student(); + vec4 c = effects(color); + fragColor = vec4(c.rgb * c.a, c.a); + } + """; + } + + /** A transition: {@code from}, {@code to}, {@code progress}; the built-ins in the same format. */ + static String transitionFragment(String body) { + return """ + #version 330 core + uniform sampler2D from; + uniform sampler2D to; + uniform float progress; + uniform vec2 resolution; + in vec2 uv; + in vec4 tint; + out vec4 fragColor; + vec4 color; + vec4 _straight(vec4 p) { return p.a > 0.0 ? vec4(p.rgb / p.a, p.a) : vec4(0.0); } + #define texture(s, p) _straight(texture(s, p)) + #define main _transition + #line 1 + """ + body + """ + + #undef main + void main() { + color = vec4(0.0, 0.0, 0.0, 1.0); + _transition(); + fragColor = vec4(color.rgb * color.a, color.a); + } + """; + } + + static final Map BUILT_IN_TRANSITIONS = Map.of( + "fade", """ + void main() { + float p = progress * 2.0; + color = p < 1.0 ? mix(texture(from, uv), vec4(0.0, 0.0, 0.0, 1.0), p) + : mix(vec4(0.0, 0.0, 0.0, 1.0), texture(to, uv), p - 1.0); + } + """, + "crossfade", """ + void main() { + color = mix(texture(from, uv), texture(to, uv), progress); + } + """, + "slide-left", """ + void main() { + vec2 p = uv + vec2(progress, 0.0); + color = p.x < 1.0 ? texture(from, p) : texture(to, p - vec2(1.0, 0.0)); + } + """, + "slide-right", """ + void main() { + vec2 p = uv - vec2(progress, 0.0); + color = p.x >= 0.0 ? texture(from, p) : texture(to, p + vec2(1.0, 0.0)); + } + """, + "slide-up", """ + void main() { + vec2 p = uv + vec2(0.0, progress); + color = p.y < 1.0 ? texture(from, p) : texture(to, p - vec2(0.0, 1.0)); + } + """, + "slide-down", """ + void main() { + vec2 p = uv - vec2(0.0, progress); + color = p.y >= 0.0 ? texture(from, p) : texture(to, p + vec2(0.0, 1.0)); + } + """); + + /** A compiled program and its uniform locations, looked up once. */ + static final class Program { + final int id; + private final Map locations = new HashMap<>(); + + Program(int id) { + this.id = id; + } + + int uniform(String name) { + return this.locations.computeIfAbsent(name, n -> glGetUniformLocation(this.id, n)); + } + } + + /** Compiles and links; the message names the shader and keeps the student's line numbers. */ + static Program link(String name, String vertex, String fragment) { + int program = glCreateProgram(); + int v = compile(GL_VERTEX_SHADER, vertex, name); + int f = compile(GL_FRAGMENT_SHADER, fragment, name); + glAttachShader(program, v); + glAttachShader(program, f); + glLinkProgram(program); + glDeleteShader(v); + glDeleteShader(f); + if (glGetProgrami(program, GL_LINK_STATUS) == GL_FALSE) { + String log = glGetProgramInfoLog(program); + glDeleteProgram(program); + throw new ShaderException(name + " does not link:\n" + log); + } + return new Program(program); + } + + private static int compile(int type, String source, String name) { + int shader = glCreateShader(type); + glShaderSource(shader, source); + glCompileShader(shader); + if (glGetShaderi(shader, GL_COMPILE_STATUS) == GL_FALSE) { + String log = glGetShaderInfoLog(shader); + glDeleteShader(shader); + throw new ShaderException(name + " does not compile:\n" + log); + } + return shader; + } + + /** A shader a learner wrote does not compile: shown once, the sprite is drawn without it. */ + static final class ShaderException extends RuntimeException { + ShaderException(String message) { + super(message); + } + } + + private Programs() {} +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/render/Renderer.java b/core/src/main/java/org/openpatch/scratch/internal/render/Renderer.java new file mode 100644 index 00000000..4f923445 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/render/Renderer.java @@ -0,0 +1,1140 @@ +package org.openpatch.scratch.internal.render; + +import static org.lwjgl.opengl.GL33C.*; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.WeakHashMap; +import org.openpatch.scratch.internal.draw.AskDraw; +import org.openpatch.scratch.internal.draw.CameraDraw; +import org.openpatch.scratch.internal.draw.ClipDraw; +import org.openpatch.scratch.internal.draw.ImageDraw; +import org.openpatch.scratch.internal.draw.CanvasRegion; +import org.openpatch.scratch.internal.draw.DrawList; +import org.openpatch.scratch.internal.draw.Effects; +import org.openpatch.scratch.internal.draw.Item; +import org.openpatch.scratch.internal.draw.LayerDraw; +import org.openpatch.scratch.internal.draw.MonitorDraw; +import org.openpatch.scratch.internal.draw.ShaderDraw; +import org.openpatch.scratch.internal.draw.ShapeDraw; +import org.openpatch.scratch.internal.draw.SpriteDraw; +import org.openpatch.scratch.internal.draw.TextDraw; +import org.openpatch.scratch.internal.draw.TransitionDraw; +import org.openpatch.scratch.internal.image.Image; +import org.openpatch.scratch.internal.render.Gpu.Batch; +import org.openpatch.scratch.internal.render.Gpu.Target; +import org.openpatch.scratch.internal.render.Gpu.Texture; +import org.openpatch.scratch.internal.render.Programs.Program; +import org.openpatch.scratch.internal.text.Font; +import org.openpatch.scratch.internal.text.TextLayout; + +/** + * Turns a draw list into pixels. It reads nothing but the draw list, creates + * every GPU object lazily on the window thread, and never touches learner objects. + * + *

World layers (backdrop, BACKGROUND, MAIN, FOREGROUND) are drawn at stage resolution, 4× + * multisampled in normal mode; the stage's shaders work on that picture; it is scaled into the + * letterbox. Speech bubbles and world texts, the UI layer, UI texts and monitors follow at the + * window's resolution, so they stay sharp. + */ +public final class Renderer { + + /** Where stage coordinates land on the target: pixel = offset + (stage + half size) × scale. */ + private record View(double offsetX, double offsetY, double scale, CameraDraw camera, int width, int height) { + + double px(double x) { + double sx = this.camera == null ? x : (x - this.camera.x()) * this.camera.zoom() / 100; + return this.offsetX + (sx + this.width / 2.0) * this.scale; + } + + double py(double y) { + double sy = this.camera == null ? y : (y - this.camera.y()) * this.camera.zoom() / 100; + return this.offsetY + (this.height / 2.0 - sy) * this.scale; + } + + /** Stage units to target pixels, the camera's zoom included. */ + double unit() { + return this.scale * (this.camera == null ? 1 : this.camera.zoom() / 100); + } + } + + private final boolean pixelArt; + // small costumes share textures, so sprites with different costumes are drawn together + private final CostumeAtlas atlas; + /** + * Godot's "canvas items" way of showing pixel art: the world is drawn at the window's + * resolution with the camera unsnapped, so motion is continuous instead of stepping whole + * stage pixels. Sprites keep nearest-neighbour sampling ( {@code pixelArt} ), and captures + * and stages with shaders still take the crisp low-resolution path below. + */ + private final boolean smoothWorld; + /** How much of the previous frame each presented one keeps (0 = off). See {@link #smooth}. */ + private final double smoothing; + private Target smoothPicture, smoothPrevious; + private boolean smoothHasPrevious; + private int printedFbW = -1, printedFbH = -1; + private final Batch batch; + private final Program sprite, coverage; + private final Map studentPrograms = new HashMap<>(); + private final Map transitionPrograms = new HashMap<>(); + private final Set brokenShaders = new HashSet<>(); + private final Map textures = new WeakHashMap<>(); + /** Canvas textures per stage and layer; let go of when their stage has not been seen a while. */ + private final Map canvases = new HashMap<>(); + private final Map stageLastSeen = new HashMap<>(); + /** Draw lists whose canvas changes were uploaded already (a list may be drawn several times). */ + private final Map uploaded = new IdentityHashMap<>(); + private final GlyphAtlas glyphs = new GlyphAtlas(); + private final Texture white; + private Target world, worldPing, worldPong, frameA, frameB, capture, captureFrom, captureTo; + private long frames; + private double fps; + + /** Call on the window thread with the OpenGL context current. */ + public Renderer(boolean pixelArt, boolean smoothPixelArt, double frameSmoothingPercent) { + this.pixelArt = pixelArt; + this.smoothWorld = smoothPixelArt; + this.smoothing = Math.max(0, Math.min(100, frameSmoothingPercent)) / 100; + this.batch = new Batch(); + this.sprite = Programs.link("sprite", Programs.VERTEX, Programs.SPRITE); + this.coverage = Programs.link("coverage", Programs.VERTEX, Programs.COVERAGE); + this.white = new Texture(1, 1, new int[] {0xffffffff}, false, false); + this.atlas = new CostumeAtlas(!pixelArt); + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); // premultiplied alpha + } + + /** For the debug overlay: frames per second measured by the window. */ + public void setFps(double fps) { + this.fps = fps; + } + + /** + * Draws a frame into the window's framebuffer, letterboxed. + * + * @param framebufferWidth the framebuffer's width in device pixels + * @param framebufferHeight its height + */ + public void render(DrawList list, int framebufferWidth, int framebufferHeight) { + this.frames++; + double[] frame = letterbox(list.width(), list.height(), framebufferWidth, framebufferHeight, this.pixelArt, + this.smoothWorld); + if (Boolean.getBoolean("scratch4j.debugGl") + && (framebufferWidth != this.printedFbW || framebufferHeight != this.printedFbH)) { + this.printedFbW = framebufferWidth; + this.printedFbH = framebufferHeight; + System.out.printf("Scratch for Java: letterbox stage %dx%d, framebuffer %dx%d: " + + "offset (%.2f, %.2f), size %.2fx%.2f, scale %.4f%n", + list.width(), list.height(), framebufferWidth, framebufferHeight, + frame[0], frame[1], frame[2], frame[3], frame[4]); + } + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glViewport(0, 0, framebufferWidth, framebufferHeight); + glClearColor(0, 0, 0, 1); + glClear(GL_COLOR_BUFFER_BIT); + TransitionDraw transition = list.transition(); + if (transition == null || transition.from() == null) { + this.renderStage(list, null, framebufferWidth, framebufferHeight, frame); + } else { + int w = (int) Math.round(frame[2]), h = (int) Math.round(frame[3]); + this.frameA = this.sized(this.frameA, w, h, 1); + this.frameB = this.sized(this.frameB, w, h, 1); + double[] inner = {0, 0, w, h, frame[4]}; + this.renderStage(transition.from(), this.frameA, w, h, inner); + this.renderStage(list, this.frameB, w, h, inner); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glViewport(0, 0, framebufferWidth, framebufferHeight); + this.drawTransition(transition, this.frameA, this.frameB, framebufferWidth, framebufferHeight, frame, false); + // frame smoothing starts afresh on the new stage, not from the old stage's last picture + this.smoothHasPrevious = false; + } + this.forgetOldStages(list.stageId()); + } + + /** + * The stage at stage size, overlay included and scaled down: what preview and capture save. + * Straight ARGB, top row first. + */ + public int[] capture(DrawList list) { + return this.capture(list, false); + } + + /** + * @param withTransition true for the frame as the window shows it, a running transition + * included (recorders, {@code afterFrame}); false for the stage alone + */ + public int[] capture(DrawList list, boolean withTransition) { + int w = list.width(), h = list.height(); + double[] whole = {0, 0, w, h, 1}; + this.capture = this.sized(this.capture, w, h, 1); + TransitionDraw transition = withTransition ? list.transition() : null; + if (transition == null || transition.from() == null) { + this.renderStage(list, this.capture, w, h, whole); + } else { + this.captureFrom = this.sized(this.captureFrom, w, h, 1); + this.captureTo = this.sized(this.captureTo, w, h, 1); + this.renderStage(transition.from(), this.captureFrom, w, h, whole); + this.renderStage(list, this.captureTo, w, h, whole); + this.capture.bind(); + clear(0xff000000); + this.drawTransition(transition, this.captureFrom, this.captureTo, w, h, whole, true); + this.capture.resolve(); + } + return this.capture.read(); + } + + private boolean isCapture(Target out) { + return out != null && (out == this.capture || out == this.captureFrom || out == this.captureTo); + } + + /** Where the stage goes: {x, y, width, height, scale} in framebuffer pixels. */ + static double[] letterbox(int stageW, int stageH, int fbW, int fbH, boolean pixelArt, boolean smooth) { + double scale = Math.min((double) fbW / stageW, (double) fbH / stageH); + // whole numbers only in crisp pixel art; smooth pixel art scales to fit, like its camera zoom + if (pixelArt && !smooth && scale >= 1) { + scale = Math.floor(scale); // whole numbers only, the rest letterboxed + } + double w = stageW * scale, h = stageH * scale; + return new double[] {Math.floor((fbW - w) / 2), Math.floor((fbH - h) / 2), w, h, scale}; + } + + // ---- one stage ------------------------------------------------------------------------ + + /** + * One stage into {@code out} (null: the window's framebuffer, already cleared), the letterbox + * at {@code frame} = {x, y, width, height, scale}. + */ + /** + * The letterbox area only, cleared to the stage's colour, when the world is drawn straight into + * the window. The rest of the framebuffer is already black (see {@link #render}). + */ + private void clearLetterbox(double[] frame, int stageColor, int targetH) { + int x = (int) frame[0]; + int y = (int) frame[1]; + int w = (int) Math.round(frame[2]), h = (int) Math.round(frame[3]); + glEnable(GL_SCISSOR_TEST); + glScissor(x, targetH - y - h, w, h); + clear(stageColor); + glDisable(GL_SCISSOR_TEST); + } + + /** + * In pixel-art mode the camera sits on whole stage pixels as well: the tiles and canvases drawn + * through it are not snapped anywhere else, so an unrounded camera would leave the world's pixel + * grid on half-pixel offsets whenever it follows something that moves fractionally. In smooth + * pixel art nothing is snapped on purpose: continuous positions are the point. + */ + private CameraDraw snap(CameraDraw camera) { + if (!this.pixelArt || this.smoothWorld || camera == null) { + return camera; + } + return new CameraDraw(Math.round(camera.x()), Math.round(camera.y()), camera.zoom()); + } + + private void renderStage(DrawList list, Target out, int targetW, int targetH, double[] frame) { + boolean intoTarget = out != null; + this.uploadCanvases(list); + int w = list.width(), h = list.height(); + // smooth pixel art draws the world straight into the window, at its resolution: there is no + // world picture to blend or shade (a stage with shaders takes the crisp path instead) + boolean deviceWorld = !intoTarget && this.smoothWorld && list.stageShaders().isEmpty(); + Texture worldPicture = null; + if (!deviceWorld) { + // 1. the world layers at stage resolution + this.world = this.sized(this.world, w, h, this.pixelArt ? 1 : 4); + this.world.bind(); + clear(list.stageColor()); + View worldView = new View(0, 0, 1, this.snap(list.camera()), w, h); + View fixed = new View(0, 0, 1, null, w, h); + if (list.backdrop() != null) { + this.drawSprite(list.backdrop(), worldView, w, h, true, list.tick()); + this.endSpriteRun(); + } + for (LayerDraw layer : list.layers()) { + if (!layer.world()) { + continue; + } + this.drawCanvas(list.stageId(), layer.index(), fixed, w, h, true); + this.drawItems(layer.items(), worldView, w, h, true, list.tick()); + } + this.world.resolve(); + worldPicture = this.applyStageShaders(list, this.world); + if (this.smoothing > 0 && !intoTarget) { + // the window's own stage only: transitions draw two stages a frame, and captures stay + // reproducible and leave the previous picture alone + worldPicture = this.smooth(worldPicture, w, h); + } + } + + // 2. into the letterbox, then what is drawn at the target's resolution + if (intoTarget) { + out.bind(); + clear(0xff000000); + } else { + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glViewport(0, 0, targetW, targetH); + } + if (deviceWorld) { + this.clearLetterbox(frame, list.stageColor(), targetH); + View worldView = new View(frame[0], frame[1], frame[4], list.camera(), w, h); + View fixed = new View(frame[0], frame[1], frame[4], null, w, h); + if (list.backdrop() != null) { + this.drawSprite(list.backdrop(), worldView, targetW, targetH, false, list.tick()); + this.endSpriteRun(); + } + for (LayerDraw layer : list.layers()) { + if (!layer.world()) { + continue; + } + this.drawCanvas(list.stageId(), layer.index(), fixed, targetW, targetH, false); + this.drawItems(layer.items(), worldView, targetW, targetH, false, list.tick()); + } + } else { + this.blit(worldPicture, frame[0], frame[1], frame[2], frame[3], targetW, targetH, intoTarget); + } + + double scale = frame[4]; + View overlay = new View(frame[0], frame[1], scale, deviceWorld ? list.camera() : this.snap(list.camera()), w, h); + View screen = new View(frame[0], frame[1], scale, null, w, h); + for (TextDraw text : list.overlay()) { + this.drawText(text, overlay, targetW, targetH, intoTarget); + } + for (LayerDraw layer : list.layers()) { + if (layer.world()) { + continue; + } + this.drawCanvas(list.stageId(), layer.index(), screen, targetW, targetH, intoTarget); + this.drawItems(layer.items(), screen, targetW, targetH, intoTarget, list.tick()); + } + for (TextDraw text : list.ui()) { + this.drawText(text, screen, targetW, targetH, intoTarget); + } + if (list.ask() != null) { + this.drawAsk(list.ask(), screen, targetW, targetH, intoTarget); + } + for (MonitorDraw monitor : list.monitors()) { + this.drawMonitor(monitor, screen, targetW, targetH, intoTarget); + } + if (!this.isCapture(out)) { + // extensions' overlays (Studio's watch pins) stay out of captures; before the first + // capture both are null, and the window must still get them + this.drawItems(list.overlayItems(), screen, targetW, targetH, intoTarget, list.tick()); + } + if (list.debug() && !this.isCapture(out)) { + // measured, not part of the scene: captures (preview, recordings) stay reproducible + this.drawFps(screen, targetW, targetH, intoTarget); + } + if (intoTarget) { + out.resolve(); + } + } + + // ---- sprites ---------------------------------------------------------------------------- + + private void drawItems(List items, View view, int targetW, int targetH, boolean flipped, long tick) { + for (Item item : items) { + if (!(item instanceof SpriteDraw) && !(item instanceof ImageDraw)) { + this.endSpriteRun(); + } + if (item instanceof SpriteDraw s) { + this.drawSprite(s, view, targetW, targetH, flipped, tick); + } else if (item instanceof ShapeDraw shape) { + this.drawShape(shape, view, targetW, targetH, flipped); + } else if (item instanceof TextDraw text) { + this.drawText(text, view, targetW, targetH, flipped); + } else if (item instanceof ClipDraw clip) { + this.clip(clip, view, targetW, targetH, flipped); + } else if (item instanceof ImageDraw image) { + // regions of images (tiles, glyphs) join the sprites' run + CostumeAtlas.Region region = this.region(image.image()); + int texture = region != null ? region.texture() : this.texture(image.image()).id; + this.spriteRun(texture, targetW, targetH, flipped); + this.effects(this.sprite, Effects.NONE); + double iw = image.image().getWidth(), ih = image.image().getHeight(); + double[] c = image.corners(); + double[] q = new double[8]; + for (int k = 0; k < 4; k++) { + q[2 * k] = view.px(c[2 * k]); + q[2 * k + 1] = view.py(c[2 * k + 1]); + } + float a = image.opacity(); + double u0 = image.sx() / iw, v0 = image.sy() / ih; + double u1 = (image.sx() + image.sw()) / iw, v1 = (image.sy() + image.sh()) / ih; + if (region != null) { + this.batch.quad(q, region.u(u0), region.v(v0), region.u(u1), region.v(v1), a, a, a, a); + } else { + this.batch.quad(q, u0, v0, u1, v1, a, a, a, a); + } + } + } + this.endSpriteRun(); + glDisable(GL_SCISSOR_TEST); + } + + // the texture of the run of sprites being drawn with the built-in program, 0 when none + private int runTexture; + + /** + * Consecutive sprites (and image regions) drawn with the built-in program go into one batch: + * the program and projection are set once, and only a change of texture draws what was + * collected. Everything else ends the run first ({@link #endSpriteRun()}). + */ + private void spriteRun(int texture, int targetW, int targetH, boolean flipped) { + if (this.runTexture == 0) { + this.batch.flush(); + glUseProgram(this.sprite.id); + this.projection(this.sprite, targetW, targetH, flipped); + glUniform1i(this.sprite.uniform("image"), 0); + glActiveTexture(GL_TEXTURE0); + } + if (this.runTexture != texture) { + this.batch.flush(); + glBindTexture(GL_TEXTURE_2D, texture); + this.runTexture = texture; + } + } + + /** + * Where a small costume lies in the atlas, put there on first use; null for a costume too large + * for it. Uploading binds a texture: a run draws what it collected first. + */ + private CostumeAtlas.Region region(Image image) { + if (!CostumeAtlas.fits(image)) { + return null; + } + CostumeAtlas.Region region = this.atlas.find(image); + if (region == null) { + this.endSpriteRun(); + region = this.atlas.add(image, Gpu.premultiply(image.getArgb())); + } + return region; + } + + private void endSpriteRun() { + if (this.runTexture != 0) { + this.batch.flush(); + this.runTexture = 0; + } + } + + /** Scissor to a rectangle of layer coordinates; targets keep their top row at GL row 0. */ + private void clip(ClipDraw clip, View view, int targetW, int targetH, boolean flipped) { + if (!clip.active()) { + glDisable(GL_SCISSOR_TEST); + return; + } + double x0 = Math.min(view.px(clip.left()), view.px(clip.right())); + double x1 = Math.max(view.px(clip.left()), view.px(clip.right())); + double y0 = Math.min(view.py(clip.top()), view.py(clip.bottom())); + double y1 = Math.max(view.py(clip.top()), view.py(clip.bottom())); + int left = (int) Math.floor(x0), width = (int) Math.ceil(x1) - left; + int top = (int) Math.floor(y0), height = (int) Math.ceil(y1) - top; + glEnable(GL_SCISSOR_TEST); + glScissor(left, flipped ? top : targetH - top - height, Math.max(0, width), Math.max(0, height)); + } + + private void drawSprite(SpriteDraw s, View view, int targetW, int targetH, boolean flipped, long tick) { + Image image = s.costume(); + List shaders = s.shaders(); + if (shaders.isEmpty() || this.studentProgram(shaders.get(shaders.size() - 1)) == null) { + // the built-in program: part of a run of sprites + CostumeAtlas.Region region = this.region(image); + this.spriteRun(region != null ? region.texture() : this.texture(image).id, targetW, targetH, flipped); + this.effects(this.sprite, s.effects()); + this.spriteQuads(s, view, region); + return; + } + this.endSpriteRun(); + // shaders read the costume as a texture of its own (uv from 0 to 1, its resolution) + Texture texture = this.texture(image); + Program program = this.sprite; + if (!shaders.isEmpty()) { + Program student = this.studentProgram(shaders.get(shaders.size() - 1)); + if (student != null) { + if (shaders.size() > 1) { + texture = this.chain(shaders.subList(0, shaders.size() - 1), texture, tick, targetW, targetH, flipped); + } + program = student; + } + } + glUseProgram(program.id); + this.projection(program, targetW, targetH, flipped); + glUniform1i(program.uniform(program == this.sprite ? "image" : "costume"), 0); + if (program != this.sprite) { + ShaderDraw last = shaders.get(shaders.size() - 1); + glUniform2f(program.uniform("resolution"), image.getWidth(), image.getHeight()); + glUniform1f(program.uniform("time"), (float) (tick / 60.0)); + setUniforms(program, last); + } + this.effects(program, s.effects()); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, texture.id); + this.spriteQuads(s, view, null); + this.batch.flush(); + } + + /** The sprite's quads, with texture coordinates in its atlas region if it has one. */ + private void spriteQuads(SpriteDraw s, View view, CostumeAtlas.Region region) { + for (double[] piece : this.spritePieces(s, view)) { + double u0 = piece[8], v0 = piece[9], u1 = piece[10], v1 = piece[11]; + if (region != null) { + u0 = region.u(u0); + v0 = region.v(v0); + u1 = region.u(u1); + v1 = region.v(v1); + } + this.batch.quad(new double[] {piece[0], piece[1], piece[2], piece[3], piece[4], piece[5], piece[6], piece[7]}, + u0, v0, u1, v1, 1, 1, 1, 1); + } + } + + /** + * The quads of a sprite in target pixels: {x0..y3 (top-left, top-right, bottom-right, + * bottom-left), u0, v0, u1, v1}. One quad, or nine for a nine-sliced sprite at its own size. + */ + private List spritePieces(SpriteDraw s, View view) { + int iw = s.costume().getWidth(), ih = s.costume().getHeight(); + double x = s.x(), y = s.y(); + if (this.pixelArt && !this.smoothWorld) { + x = Math.round(x); // sprites sit on whole stage pixels; logic keeps its doubles + y = Math.round(y); + } + double r = Math.toRadians(s.rotation()), cos = Math.cos(r), sin = Math.sin(r); + boolean mirrored = s.scaleX() < 0; + double sx = Math.abs(s.scaleX()), sy = Math.abs(s.scaleY()); + // the drawn rectangle in "drawn pixels" (costume pixels × scale), origin at its top left + double dw = iw * sx, dh = ih * sy, ox = s.originX() * sx, oy = s.originY() * sy; + double[] xs, ys, us, vs; + int[] slice = s.nineSlice(); + if (slice != null) { + double[][] h = SpriteDraw.slices(iw, slice[0], slice[2], dw, s.sliceScale()); + double[][] v = SpriteDraw.slices(ih, slice[1], slice[3], dh, s.sliceScale()); + xs = h[0]; + us = h[1]; + ys = v[0]; + vs = v[1]; + } else { + xs = new double[] {0, dw}; + ys = new double[] {0, dh}; + us = new double[] {0, 1}; + vs = new double[] {0, 1}; + } + List pieces = new ArrayList<>(); + for (int j = 0; j + 1 < ys.length; j++) { + for (int i = 0; i + 1 < xs.length; i++) { + double[] q = new double[12]; + double[][] corners = {{xs[i], ys[j]}, {xs[i + 1], ys[j]}, {xs[i + 1], ys[j + 1]}, {xs[i], ys[j + 1]}}; + for (int k = 0; k < 4; k++) { + double lx = corners[k][0] - ox, ly = -(corners[k][1] - oy); // y up from the origin + if (mirrored) { + lx = -lx; + } + // clockwise turn in y-up coordinates + double wx = x + lx * cos + ly * sin, wy = y - lx * sin + ly * cos; + q[2 * k] = view.px(wx); + q[2 * k + 1] = view.py(wy); + } + q[8] = us[i]; + q[9] = vs[j]; + q[10] = us[i + 1]; + q[11] = vs[j + 1]; + pieces.add(q); + } + } + return pieces; + } + + /** The effects of the quads that follow (they go with the vertices). */ + private void effects(Program program, Effects e) { + double turns = (e.colorEffect() / 200) % 1; + int t = e.tint(); + this.batch.effects((float) (turns < 0 ? turns + 1 : turns), ((t >> 16) & 0xff) / 255f, ((t >> 8) & 0xff) / 255f, + (t & 0xff) / 255f, (t >>> 24) / 255f, (float) (1 - Math.max(0, Math.min(100, e.transparency())) / 100)); + } + + /** Uploads an image now rather than when it is first drawn (the loading screen). */ + public void prepare(Image image) { + if (this.region(image) == null) { + this.texture(image); + } + } + + private Texture texture(Image image) { + Texture t = this.textures.get(image); + if (t == null) { + this.endSpriteRun(); // uploading binds the new texture + t = new Texture(image.getWidth(), image.getHeight(), Gpu.premultiply(image.getArgb()), !this.pixelArt, + !this.pixelArt); + this.textures.put(image, t); + } + return t; + } + + // ---- canvases ------------------------------------------------------------------------- + + private void uploadCanvases(DrawList list) { + if (this.uploaded.containsKey(list)) { + return; + } + if (this.uploaded.size() > 8) { + this.uploaded.clear(); // only the last few lists can be drawn again + } + this.uploaded.put(list, Boolean.TRUE); + Texture[] textures = this.canvases.computeIfAbsent(list.stageId(), id -> new Texture[list.layers().size()]); + for (LayerDraw layer : list.layers()) { + if (!layer.canvas()) { + continue; + } + Texture t = textures[layer.index()]; + if (t == null) { + t = new Texture(list.width(), list.height(), null, !this.pixelArt && !layer.world(), false); + textures[layer.index()] = t; + } + for (CanvasRegion region : layer.canvasChanges()) { + t.update(region.x(), region.y(), region.width(), region.height(), region.argb()); + } + } + this.stageLastSeen.put(list.stageId(), System.nanoTime()); + } + + private void drawCanvas(int stageId, int layer, View view, int targetW, int targetH, boolean flipped) { + Texture[] textures = this.canvases.get(stageId); + if (textures == null || textures[layer] == null) { + return; + } + double x0 = view.px(-view.width() / 2.0), y0 = view.py(view.height() / 2.0); + double x1 = view.px(view.width() / 2.0), y1 = view.py(-view.height() / 2.0); + this.drawTexture(textures[layer], x0, y0, x1, y1, targetW, targetH, flipped); + } + + /** Canvas textures of stages not shown for 30 s go (the stage resends them if shown again). */ + private void forgetOldStages(int current) { + if (this.frames % 600 != 0) { + return; + } + long now = System.nanoTime(); + this.stageLastSeen.entrySet().removeIf(e -> { + if (e.getKey() != current && now - e.getValue() > 30_000_000_000L) { + Texture[] old = this.canvases.remove(e.getKey()); + if (old != null) { + for (Texture t : old) { + if (t != null) { + t.delete(); + } + } + } + return true; + } + return false; + }); + } + + // ---- shaders ---------------------------------------------------------------------------- + + private Program studentProgram(ShaderDraw shader) { + if (this.brokenShaders.contains(shader.source())) { + return null; + } + Program p = this.studentPrograms.get(shader.source()); + if (p == null) { + try { + p = Programs.link(shader.name(), Programs.VERTEX, Programs.studentFragment(shader.source())); + } catch (Programs.ShaderException e) { + // shown once; the sprite is drawn without it + System.err.println("Scratch for Java: the shader " + e.getMessage()); + this.brokenShaders.add(shader.source()); + return null; + } + this.studentPrograms.put(shader.source(), p); + } + return p; + } + + private static void setUniforms(Program program, ShaderDraw shader) { + for (var entry : shader.uniforms().entrySet()) { + String name = entry.getKey(); + Object value = entry.getValue(); + if (name.endsWith("[]")) { + float[] f = (float[]) value; + int per = (int) f[0]; + float[] values = java.util.Arrays.copyOfRange(f, 1, f.length); + int location = program.uniform(name.substring(0, name.length() - 2)); + switch (per) { + case 2 -> glUniform2fv(location, values); + case 3 -> glUniform3fv(location, values); + case 4 -> glUniform4fv(location, values); + default -> glUniform1fv(location, values); + } + } else if (value instanceof float[] f) { + int location = program.uniform(name); + switch (f.length) { + case 2 -> glUniform2f(location, f[0], f[1]); + case 3 -> glUniform3f(location, f[0], f[1], f[2]); + case 4 -> glUniform4f(location, f[0], f[1], f[2], f[3]); + default -> glUniform1f(location, f[0]); + } + } else if (value instanceof int[] i) { + glUniform1i(program.uniform(name), i[0]); + } + } + } + + /** All but the last shader of a sprite, each into a costume-sized texture of its own. */ + private Texture chain(List shaders, Texture input, long tick, int targetW, int targetH, + boolean flipped) { + int previous = glGetInteger(GL_FRAMEBUFFER_BINDING); + int[] viewport = new int[4]; + glGetIntegerv(GL_VIEWPORT, viewport); + Texture current = input; + for (ShaderDraw shader : shaders) { + Program p = this.studentProgram(shader); + if (p == null) { + continue; + } + Target pass = new Target(current.width, current.height, 1, current.smooth); + pass.bind(); + clear(0); + glUseProgram(p.id); + this.projection(p, pass.width, pass.height, true); + glUniform1i(p.uniform("costume"), 0); + glUniform2f(p.uniform("resolution"), current.width, current.height); + glUniform1f(p.uniform("time"), (float) (tick / 60.0)); + setUniforms(p, shader); + this.effects(p, Effects.NONE); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, current.id); + this.batch.quad(new double[] {0, 0, pass.width, 0, pass.width, pass.height, 0, pass.height}, 0, 0, 1, 1, + 1, 1, 1, 1); + this.batch.flush(); + pass.resolve(); + current = pass.texture; // the targets of a chain are short-lived: per frame + this.toDelete.add(pass); + } + glBindFramebuffer(GL_FRAMEBUFFER, previous); + glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); + return current; + } + + private final List toDelete = new ArrayList<>(); + + /** The stage's shaders over the world picture, alternating between two targets. */ + private Texture applyStageShaders(DrawList list, Target world) { + for (Target t : this.toDelete) { + t.delete(); + } + this.toDelete.clear(); + Texture current = world.texture; + for (ShaderDraw shader : list.stageShaders()) { + Program p = this.studentProgram(shader); + if (p == null) { + continue; + } + this.worldPing = this.sized(this.worldPing, world.width, world.height, 1); + this.worldPong = this.sized(this.worldPong, world.width, world.height, 1); + Target out = current == this.worldPing.texture ? this.worldPong : this.worldPing; + out.bind(); + clear(0); + glUseProgram(p.id); + this.projection(p, out.width, out.height, true); + glUniform1i(p.uniform("costume"), 0); + glUniform2f(p.uniform("resolution"), out.width, out.height); + glUniform1f(p.uniform("time"), (float) (list.tick() / 60.0)); + setUniforms(p, shader); + this.effects(p, Effects.NONE); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, current.id); + this.batch.quad(new double[] {0, 0, out.width, 0, out.width, out.height, 0, out.height}, 0, 0, 1, 1, 1, 1, 1, + 1); + this.batch.flush(); + out.resolve(); + current = out.texture; + } + return current; + } + + private void drawTransition(TransitionDraw t, Target from, Target to, int targetW, int targetH, double[] frame, + boolean flipped) { + String source = t.source() != null ? t.source() : Programs.BUILT_IN_TRANSITIONS.get(t.name()); + if (source == null) { + source = Programs.BUILT_IN_TRANSITIONS.get("fade"); + } + Program p = this.transitionPrograms.get(source); + if (p == null) { + try { + p = Programs.link(t.name(), Programs.VERTEX, Programs.transitionFragment(source)); + } catch (Programs.ShaderException e) { + System.err.println("Scratch for Java: the transition " + e.getMessage()); + p = Programs.link("fade", Programs.VERTEX, + Programs.transitionFragment(Programs.BUILT_IN_TRANSITIONS.get("fade"))); + } + this.transitionPrograms.put(source, p); + } + glUseProgram(p.id); + this.projection(p, targetW, targetH, flipped); + glUniform1i(p.uniform("from"), 0); + glUniform1i(p.uniform("to"), 1); + glUniform1f(p.uniform("progress"), (float) Math.max(0, Math.min(1, t.progress()))); + glUniform2f(p.uniform("resolution"), (float) frame[2], (float) frame[3]); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, to.texture.id); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, from.texture.id); + this.batch.quad(new double[] {frame[0], frame[1], frame[0] + frame[2], frame[1], frame[0] + frame[2], + frame[1] + frame[3], frame[0], frame[1] + frame[3]}, 0, 0, 1, 1, 1, 1, 1, 1); + this.batch.flush(); + } + + // ---- texts, boxes, monitors ---------------------------------------------------------------- + + private void drawText(TextDraw t, View view, int targetW, int targetH, boolean flipped) { + double unit = view.unit(); + float[] box = premultiplied(t.boxColor()), stroke = premultiplied(t.boxStroke()); + double left = view.px(t.x()), top = view.py(t.y()); + double w = t.width() * unit, h = t.height() * unit; + // a box has the corners of Scratch's ask box, bubbles the round ones of Scratch's bubbles + double radius = (t.box() == TextDraw.Box.PLAIN ? 8 : 16) * unit, border = 2 * unit; + switch (t.box()) { + case PLAIN -> { + this.roundedRect(left - border / 2, top - border / 2, w + border, h + border, radius, stroke); + this.roundedRect(left + border / 2, top + border / 2, w - border, h - border, radius, box); + } + case SPEECH -> { + // the tail leaves the bubble's corner next to the sprite: left, or right when mirrored + double tail = view.px(t.tailX()); + double dir = t.tailX() > t.x() + t.width() / 2 ? -1 : 1; + this.roundedRect(left - border / 2, top - border / 2, w + border, h + border, radius, stroke); + this.triangle(tail + dir * (10 * unit - border), top + h - border, tail + dir * (10 * unit - border), + top + h + 20 * unit + border, tail + dir * (30 * unit + border), top + h - border, stroke); + this.roundedRect(left + border / 2, top + border / 2, w - border, h - border, radius, box); + this.triangle(tail + dir * 10 * unit, top + h - 2 * border, tail + dir * 10 * unit, + top + h + 20 * unit - border, tail + dir * 26 * unit, top + h - 2 * border, box); + } + case THOUGHT -> { + double tail = view.px(t.tailX()); + double dir = t.tailX() > t.x() + t.width() / 2 ? -1 : 1; + this.roundedRect(left - border / 2, top - border / 2, w + border, h + border, radius, stroke); + this.roundedRect(left + border / 2, top + border / 2, w - border, h - border, radius, box); + double[][] dots = {{20, 0, 5}, {7, 7, 3}, {0, 10, 2}}; + for (double[] d : dots) { + this.circle(tail + dir * d[0] * unit, top + h + d[1] * unit, (d[2] + 1) * unit, stroke); + this.circle(tail + dir * d[0] * unit, top + h + d[1] * unit, d[2] * unit, box); + } + } + default -> { + } + } + this.flushShapes(targetW, targetH, flipped); + this.drawLayout(t.layout(), t, view, targetW, targetH, flipped); + } + + /** The letters of a layout inside a text's box, aligned and at the device size. */ + private void drawLayout(TextLayout layout, TextDraw t, View view, int targetW, int targetH, boolean flipped) { + double unit = view.unit(); + double deviceSize = layout.size() * unit; + double inner = t.width() - 2 * t.padding(); + float[] color = premultiplied(t.color()); + glUseProgram(this.coverage.id); + this.projection(this.coverage, targetW, targetH, flipped); + glUniform1i(this.coverage.uniform("image"), 0); + glUniform1i(this.coverage.uniform("useTexture"), 1); + glActiveTexture(GL_TEXTURE0); + int page = -1; + for (TextLayout.Line line : layout.lines()) { + double offset = switch (t.align()) { + case 1 -> (inner - line.width()) / 2; + case 2 -> inner - line.width(); + default -> 0; + }; + double baseline = view.py(t.y() - t.padding() - line.baseline()); + baseline = Math.round(baseline); + for (TextLayout.Glyph g : line.glyphs()) { + double penX = view.px(t.x() + t.padding() + offset + g.x()); + if (this.pixelArt) { + penX = Math.round(penX); + } + GlyphAtlas.Slot slot = this.glyphs.glyph(g.font(), g.codepoint(), deviceSize, penX - Math.floor(penX), + this.pixelArt); + if (slot.page() < 0 || slot.width() == 0) { + continue; + } + if (slot.page() != page) { + this.batch.flush(); + page = slot.page(); + glBindTexture(GL_TEXTURE_2D, this.glyphs.page(page)); + } + double x0 = Math.floor(penX) + slot.offsetX(), y0 = baseline + slot.offsetY(); + double p = GlyphAtlas.PAGE; + this.batch.quad(new double[] {x0, y0, x0 + slot.width(), y0, x0 + slot.width(), y0 + slot.height(), x0, + y0 + slot.height()}, slot.x() / p, slot.y() / p, (slot.x() + slot.width()) / p, + (slot.y() + slot.height()) / p, color[0], color[1], color[2], color[3]); + } + } + this.batch.flush(); + } + + private void drawMonitor(MonitorDraw m, View view, int targetW, int targetH, boolean flipped) { + double unit = view.unit(); + double labelW = m.label().width(), valueW = Math.max(30, m.value().width() + 14); + double boxW = labelW + valueW + 18; + double left = view.px(m.x()), top = view.py(m.y()); + this.roundedRect(left - unit, top - unit, (boxW + 2) * unit, (MonitorDraw.HEIGHT + 2) * unit, 5 * unit, + premultiplied(0xffc3ccd9)); + this.roundedRect(left, top, boxW * unit, MonitorDraw.HEIGHT * unit, 4 * unit, premultiplied(0xebe6f0ff)); + this.roundedRect(left + (labelW + 12) * unit, top + 3 * unit, valueW * unit, 18 * unit, 9 * unit, + premultiplied(0xffff8c1a)); + this.flushShapes(targetW, targetH, flipped); + double ascent = m.label().font().ascent(m.label().size()), lineH = m.label().height(); + // label left in the box, value centred in the pill; both vertically centred + TextDraw label = new TextDraw(m.label(), m.x() + 6, m.y() - (MonitorDraw.HEIGHT - lineH) / 2, labelW, lineH, 0, + 0xff575e75, TextDraw.Box.NONE, 0, 0, 0, 0); + TextDraw value = new TextDraw(m.value(), m.x() + labelW + 12, m.y() - (MonitorDraw.HEIGHT - lineH) / 2, valueW, + lineH, 1, 0xffffffff, TextDraw.Box.NONE, 0, 0, 0, 0); + this.drawLayout(m.label(), label, view, targetW, targetH, flipped); + this.drawLayout(m.value(), value, view, targetW, targetH, flipped); + } + + /** Scratch's ask box: a white card, the question, the answer field with its check button. */ + private void drawAsk(AskDraw a, View view, int targetW, int targetH, boolean flipped) { + double unit = view.unit(); + float[] white = premultiplied(0xffffffff), border = premultiplied(0x26000000), blue = premultiplied(0xff4c97ff); + int textColor = 0xff575e75; + double left = view.px(a.x()), top = view.py(a.y()), w = a.width() * unit, h = a.height() * unit; + this.roundedRect(left, top, w, h, 8 * unit, border); + this.roundedRect(left + 2 * unit, top + 2 * unit, w - 4 * unit, h - 4 * unit, 6 * unit, white); + double fx = view.px(a.fieldX()), fy = view.py(a.fieldY()); + double fw = a.fieldWidth() * unit, fh = AskDraw.FIELD * unit; + this.roundedRect(fx, fy, fw, fh, fh / 2, border); + this.roundedRect(fx + unit, fy + unit, fw - 2 * unit, fh - 2 * unit, fh / 2 - unit, white); + double bx = view.px(a.buttonX()), by = view.py(a.buttonY()); + this.circle(bx, by, AskDraw.BUTTON / 2 * unit, blue); + float[] tick = premultiplied(0xffffffff); + double s = unit, stroke = 2.5 * unit; + this.line(bx - 5 * s, by, bx - 1.5 * s, by + 3.5 * s, stroke, tick); + this.line(bx - 1.5 * s, by + 3.5 * s, bx + 5 * s, by - 3.5 * s, stroke, tick); + this.circle(bx - 1.5 * s, by + 3.5 * s, stroke / 2, tick); + TextLayout answer = a.answer(); + double lineH = answer.font().lineHeight(answer.size()); + double answerY = a.fieldY() - (AskDraw.FIELD - lineH) / 2; + if (a.caret()) { + double cx = view.px(a.fieldX() + AskDraw.INSET + answer.width()) + unit; + this.roundedRect(Math.round(cx), view.py(answerY), Math.max(1, Math.round(unit)), lineH * unit, 0, + premultiplied(textColor)); + } + this.flushShapes(targetW, targetH, flipped); + if (a.question() != null) { + TextLayout q = a.question(); + TextDraw label = new TextDraw(q, a.x() + AskDraw.PADDING, a.y() - AskDraw.PADDING, q.width(), q.height(), 0, + textColor, TextDraw.Box.NONE, 0, 0, 0, 0); + this.drawLayout(q, label, view, targetW, targetH, flipped); + } + TextDraw typed = new TextDraw(answer, a.fieldX() + AskDraw.INSET, answerY, answer.width(), lineH, 0, textColor, + TextDraw.Box.NONE, 0, 0, 0, 0); + this.drawLayout(answer, typed, view, targetW, targetH, flipped); + } + + private void drawFps(View view, int targetW, int targetH, boolean flipped) { + TextLayout layout = TextLayout.of(String.format(java.util.Locale.ROOT, "%.0f fps", this.fps), Font.defaultFont(), + 12, 0); + TextDraw text = new TextDraw(layout, view.width() / 2.0 - layout.width() - 6, view.height() / 2.0 - 4, + layout.width(), layout.height(), 0, 0xffff0000, TextDraw.Box.NONE, 0, 0, 0, 0); + this.drawLayout(layout, text, view, targetW, targetH, flipped); + } + + // ---- shapes, tessellated on the CPU --------------------------------------------------------- + + private void drawShape(ShapeDraw shape, View view, int targetW, int targetH, boolean flipped) { + double[] p = shape.points(); + int n = p.length / 2; + if (shape.fill() != 0 && n >= 3) { + float[] c = premultiplied(shape.fill()); + for (double[] piece : org.openpatch.scratch.internal.geom.Geometry.convexPieces(p)) { + // a fan over each convex piece + for (int i = 1; i + 1 < piece.length / 2; i++) { + this.triangle(view.px(piece[0]), view.py(piece[1]), view.px(piece[2 * i]), view.py(piece[2 * i + 1]), + view.px(piece[2 * i + 2]), view.py(piece[2 * i + 3]), c); + } + } + } + if (shape.stroke() != 0 && n >= 2) { + float[] c = premultiplied(shape.stroke()); + double half = shape.strokeWeight() * view.unit() / 2; + for (int i = 0; i < n; i++) { + int j = (i + 1) % n; + double x0 = view.px(p[2 * i]), y0 = view.py(p[2 * i + 1]), x1 = view.px(p[2 * j]), y1 = view.py(p[2 * j + 1]); + double dx = x1 - x0, dy = y1 - y0, len = Math.hypot(dx, dy); + if (len == 0) { + continue; + } + double nx = -dy / len * half, ny = dx / len * half; + this.batch.quad(new double[] {x0 + nx, y0 + ny, x1 + nx, y1 + ny, x1 - nx, y1 - ny, x0 - nx, y0 - ny}, 0, 0, + 1, 1, c[0], c[1], c[2], c[3]); + } + } + this.flushShapes(targetW, targetH, flipped); + } + + private void roundedRect(double x, double y, double w, double h, double radius, float[] c) { + if (w <= 0 || h <= 0) { + return; + } + double r = Math.min(radius, Math.min(w, h) / 2); + // the middle cross, then a fan at each corner + this.batch.quad(new double[] {x + r, y, x + w - r, y, x + w - r, y + h, x + r, y + h}, 0, 0, 1, 1, c[0], c[1], + c[2], c[3]); + this.batch.quad(new double[] {x, y + r, x + r, y + r, x + r, y + h - r, x, y + h - r}, 0, 0, 1, 1, c[0], c[1], + c[2], c[3]); + this.batch.quad(new double[] {x + w - r, y + r, x + w, y + r, x + w, y + h - r, x + w - r, y + h - r}, 0, 0, 1, 1, + c[0], c[1], c[2], c[3]); + double[][] centres = {{x + r, y + r, Math.PI, 1.5 * Math.PI}, {x + w - r, y + r, 1.5 * Math.PI, 2 * Math.PI}, + {x + w - r, y + h - r, 0, 0.5 * Math.PI}, {x + r, y + h - r, 0.5 * Math.PI, Math.PI}}; + int segments = 8; + for (double[] k : centres) { + for (int i = 0; i < segments; i++) { + double a0 = k[2] + (k[3] - k[2]) * i / segments, a1 = k[2] + (k[3] - k[2]) * (i + 1) / segments; + this.batch.vertex(k[0], k[1], 0, 0, c[0], c[1], c[2], c[3]); + this.batch.vertex(k[0] + r * Math.cos(a0), k[1] + r * Math.sin(a0), 0, 0, c[0], c[1], c[2], c[3]); + this.batch.vertex(k[0] + r * Math.cos(a1), k[1] + r * Math.sin(a1), 0, 0, c[0], c[1], c[2], c[3]); + } + } + } + + private void triangle(double x0, double y0, double x1, double y1, double x2, double y2, float[] c) { + this.batch.vertex(x0, y0, 0, 0, c[0], c[1], c[2], c[3]); + this.batch.vertex(x1, y1, 0, 0, c[0], c[1], c[2], c[3]); + this.batch.vertex(x2, y2, 0, 0, c[0], c[1], c[2], c[3]); + } + + /** A straight stroke of the given width from one point to another. */ + private void line(double x0, double y0, double x1, double y1, double width, float[] c) { + double len = Math.hypot(x1 - x0, y1 - y0); + if (len == 0) { + return; + } + double nx = -(y1 - y0) / len * width / 2, ny = (x1 - x0) / len * width / 2; + this.triangle(x0 + nx, y0 + ny, x1 + nx, y1 + ny, x1 - nx, y1 - ny, c); + this.triangle(x0 + nx, y0 + ny, x1 - nx, y1 - ny, x0 - nx, y0 - ny, c); + } + + private void circle(double cx, double cy, double r, float[] c) { + int segments = 16; + for (int i = 0; i < segments; i++) { + double a0 = 2 * Math.PI * i / segments, a1 = 2 * Math.PI * (i + 1) / segments; + this.triangle(cx, cy, cx + r * Math.cos(a0), cy + r * Math.sin(a0), cx + r * Math.cos(a1), cy + r * Math.sin(a1), + c); + } + } + + /** Draws the shapes collected so far with the solid-colour program. */ + private void flushShapes(int targetW, int targetH, boolean flipped) { + if (this.batch.isEmpty()) { + return; + } + glUseProgram(this.coverage.id); + this.projection(this.coverage, targetW, targetH, flipped); + glUniform1i(this.coverage.uniform("useTexture"), 0); + this.batch.flush(); + } + + // ---- helpers ---------------------------------------------------------------------------- + + /** Target pixels (origin top left, y down) to clip space; targets keep their top row at row 0. */ + private void projection(Program program, int w, int h, boolean flipped) { + float sy = flipped ? 2f / h : -2f / h, ty = flipped ? -1f : 1f; + float[] m = {2f / w, 0, 0, 0, sy, 0, -1f, ty, 1}; + glUniformMatrix3fv(program.uniform("transform"), false, m); + } + + private void blit(Texture texture, double x, double y, double w, double h, int targetW, int targetH, boolean flipped) { + this.drawTexture(texture, x, y, x + w, y + h, targetW, targetH, flipped); + } + + /** + * The world picture mixed with the previous frame: {@code out = (1-a)·current + a·previous}. + * Two samples per presented frame halve the time a 60 Hz screen holds one picture, which the + * eye sees as less smear while things move; the moment the picture is still again, current and + * previous are equal, so it is fully sharp at once. The raw previous frame is kept (not the + * blended one), so there are no ghost trails: exactly two frames take part. + * + * @param picture the world as it is this frame, at stage size + * @param w the stage width + * @param h the stage height + * @return the blended picture; the overlay and UI are drawn on top of it as usual + */ + private Texture smooth(Texture picture, int w, int h) { + this.smoothPicture = this.sized(this.smoothPicture, w, h, 1); + this.smoothPrevious = this.sized(this.smoothPrevious, w, h, 1); + this.smoothPicture.bind(); + this.drawTexture(picture, 0, 0, w, h, w, h, true); + if (this.smoothHasPrevious) { + this.drawTexture(this.smoothPrevious.texture, 0, 0, w, h, w, h, true, + new Effects(0, 100 - this.smoothing * 100, 0xffffffff)); + } + this.smoothPrevious.bind(); + this.drawTexture(picture, 0, 0, w, h, w, h, true); + this.smoothHasPrevious = true; + return this.smoothPicture.texture; + } + + /** A texture into a rectangle of the target, without effects. */ + private void drawTexture(Texture texture, double x0, double y0, double x1, double y1, int targetW, int targetH, + boolean flipped) { + this.drawTexture(texture, x0, y0, x1, y1, targetW, targetH, flipped, Effects.NONE); + } + + /** A texture into a rectangle of the target, with these effects. */ + private void drawTexture(Texture texture, double x0, double y0, double x1, double y1, int targetW, int targetH, + boolean flipped, Effects e) { + glUseProgram(this.sprite.id); + this.projection(this.sprite, targetW, targetH, flipped); + glUniform1i(this.sprite.uniform("image"), 0); + this.effects(this.sprite, e); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, texture.id); + this.batch.quad(new double[] {x0, y0, x1, y0, x1, y1, x0, y1}, 0, 0, 1, 1, 1, 1, 1, 1); + this.batch.flush(); + } + + private Target sized(Target t, int w, int h, int samples) { + if (t != null && t.width == w && t.height == h) { + return t; + } + if (t != null) { + t.delete(); + } + return new Target(Math.max(1, w), Math.max(1, h), samples, !this.pixelArt); + } + + private static void clear(int argb) { + glClearColor(((argb >> 16) & 0xff) / 255f, ((argb >> 8) & 0xff) / 255f, (argb & 0xff) / 255f, + (argb >>> 24) / 255f); + glClear(GL_COLOR_BUFFER_BIT); + } + + private static float[] premultiplied(int argb) { + float a = (argb >>> 24) / 255f; + return new float[] {((argb >> 16) & 0xff) / 255f * a, ((argb >> 8) & 0xff) / 255f * a, (argb & 0xff) / 255f * a, + a}; + } + + /** Frees every GPU object; on the window thread, before the context goes. */ + public void delete() { + for (Texture t : this.textures.values()) { + t.delete(); + } + for (Texture[] ts : this.canvases.values()) { + for (Texture t : ts) { + if (t != null) { + t.delete(); + } + } + } + this.glyphs.delete(); + this.white.delete(); + this.atlas.delete(); + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/text/Font.java b/core/src/main/java/org/openpatch/scratch/internal/text/Font.java new file mode 100644 index 00000000..ec17fcdc --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/text/Font.java @@ -0,0 +1,299 @@ +package org.openpatch.scratch.internal.text; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.lwjgl.stb.STBTTFontinfo; +import org.lwjgl.stb.STBTTVertex; +import org.lwjgl.stb.STBTruetype; +import org.lwjgl.system.MemoryStack; +import org.lwjgl.system.MemoryUtil; +import org.openpatch.scratch.internal.Natives; +import org.openpatch.scratch.internal.image.Images; + +/** + * A TrueType or OpenType font read by stb_truetype. Metrics come from the file, unhinted, scaled + * by size / units per em; sizes are in stage units. The font's bytes stay in a direct buffer as + * long as the font lives, since stb_truetype reads its tables straight from it. + * + *

Thread-safe: layout runs on the game thread, rasterising on the window thread. + */ +public final class Font { + + static { + Natives.init(); + } + + /** The default font in normal mode. */ + public static final String DEFAULT = "UbuntuMono-Regular.ttf"; + /** The default font in pixel-art mode. */ + public static final String PIXEL_ART = "Jersey10-Regular.ttf"; + + private static final Map CACHE = new ConcurrentHashMap<>(); + + private final String name; + private final ByteBuffer data; + final STBTTFontinfo info; + private final int unitsPerEm, ascent, descent, lineGap; + private final int pixelGrid; + private final Font base; // the font this one is a view of (other grid), or null + private final Map advances; + private final Map glyphs; + + private Font(String name, byte[] bytes) throws IOException { + this.name = name; + this.base = null; + this.data = MemoryUtil.memAlloc(bytes.length).put(bytes).flip(); + this.info = STBTTFontinfo.malloc(); + if (!STBTruetype.stbtt_InitFont(this.info, this.data, STBTruetype.stbtt_GetFontOffsetForIndex(this.data, 0))) { + this.info.free(); + MemoryUtil.memFree(this.data); + throw new IOException(name + " is not a TrueType or OpenType font."); + } + // one em mapped to 1 px: its inverse is the units per em + this.unitsPerEm = Math.round(1f / STBTruetype.stbtt_ScaleForMappingEmToPixels(this.info, 1)); + int[] m = this.verticalMetrics(); + this.ascent = m[0]; + this.descent = m[1]; + this.lineGap = m[2]; + this.pixelGrid = this.outlineGrid(); + this.advances = new ConcurrentHashMap<>(); + this.glyphs = new ConcurrentHashMap<>(); + } + + private Font(Font base, int pixelGrid) { + this.name = base.name; + this.base = base; + this.data = base.data; + this.info = base.info; + this.unitsPerEm = base.unitsPerEm; + this.ascent = base.ascent; + this.descent = base.descent; + this.lineGap = base.lineGap; + this.pixelGrid = pixelGrid; + this.advances = base.advances; + this.glyphs = base.glyphs; + } + + /** + * The font at {@code path}: a file relative to the working directory, else on the classpath. + * Loaded once. + * + * @throws IllegalArgumentException when there is no such font or it cannot be read + */ + public static Font load(String path) { + Font cached = CACHE.get(path); + if (cached != null) { + return cached; + } + byte[] bytes = Images.read(path); + if (bytes == null) { + throw new IllegalArgumentException("Font not found: " + path); + } + Font font; + try { + font = new Font(path, bytes); + } catch (IOException e) { + throw new IllegalArgumentException(e.getMessage(), e); + } + Font raced = CACHE.putIfAbsent(path, font); + if (raced != null) { + font.close(); + return raced; + } + org.openpatch.scratch.internal.Assets.noteLoadedLate("font", path); + return font; + } + + /** A font from bytes, not cached; for fonts that do not come from a file. */ + public static Font fromBytes(byte[] data, String name) throws IOException { + return new Font(name, data); + } + + /** UbuntuMono, the default font in normal mode and the fallback for missing glyphs. */ + public static Font defaultFont() { + return load(DEFAULT); + } + + /** Jersey 10, the default font in pixel-art mode. */ + public static Font pixelArtFont() { + return load(PIXEL_ART); + } + + public String getName() { + return this.name; + } + + public int getUnitsPerEm() { + return this.unitsPerEm; + } + + /** Font units above the baseline. */ + public int getAscent() { + return this.ascent; + } + + /** Font units below the baseline, negative. */ + public int getDescent() { + return this.descent; + } + + public int getLineGap() { + return this.lineGap; + } + + /** Font units per font pixel; 1 for a font that is not a pixel font. */ + public int getPixelGrid() { + return this.pixelGrid; + } + + /** The same font with another pixel grid, for a pixel font whose outlines do not show it. */ + public Font withPixelGrid(int unitsPerPixel) { + if (unitsPerPixel < 1) { + throw new IllegalArgumentException("A pixel grid needs at least 1 unit per pixel."); + } + return new Font(this.base != null ? this.base : this, unitsPerPixel); + } + + /** Whether it is a pixel font: its outlines sit on a grid coarser than the units. */ + public boolean isPixelFont() { + return this.pixelGrid > 1; + } + + /** Stage units per font unit at a size. */ + public double scaleFor(double size) { + return size / this.unitsPerEm; + } + + public boolean hasGlyph(int codepoint) { + return this.glyph(codepoint) != 0; + } + + int glyph(int codepoint) { + return this.glyphs.computeIfAbsent(codepoint, cp -> STBTruetype.stbtt_FindGlyphIndex(this.info, cp)); + } + + /** The advance of a codepoint at a size, in stage units. */ + public double advance(int codepoint, double size) { + int units = this.advances.computeIfAbsent(codepoint, cp -> { + try (MemoryStack stack = MemoryStack.stackPush()) { + IntBuffer advance = stack.mallocInt(1); + STBTruetype.stbtt_GetGlyphHMetrics(this.info, this.glyph(cp), advance, null); + return advance.get(0); + } + }); + return units * this.scaleFor(size); + } + + /** The kerning between two codepoints at a size, in stage units ({@code kern} and GPOS pairs). */ + public double kerning(int left, int right, double size) { + return STBTruetype.stbtt_GetGlyphKernAdvance(this.info, this.glyph(left), this.glyph(right)) + * this.scaleFor(size); + } + + /** Distance between baselines at a size: ascent − descent + line gap. */ + public double lineHeight(double size) { + return (this.ascent - this.descent + this.lineGap) * this.scaleFor(size); + } + + public double ascent(double size) { + return this.ascent * this.scaleFor(size); + } + + /** How far letters reach below the baseline at a size, positive (Processing's textDescent). */ + public double descent(double size) { + return -this.descent * this.scaleFor(size); + } + + /** + * The nearest size that is a whole number of font pixels (at least one), for pixel-art mode; + * unchanged for a font that is not a pixel font. Jersey 10: 18.667, 37.333, … + */ + public double roundToPixelGrid(double size) { + if (!this.isPixelFont()) { + return size; + } + double pixel = (double) this.unitsPerEm / this.pixelGrid; + return Math.max(1, Math.round(size / pixel)) * pixel; + } + + /** Frees the native memory; only for fonts made with {@link #fromBytes}. */ + public void close() { + if (this.base == null) { + this.info.free(); + MemoryUtil.memFree(this.data); + } + } + + /** hhea's metrics, or OS/2's typographic ones when the font asks for them (USE_TYPO_METRICS). */ + private int[] verticalMetrics() { + try (MemoryStack stack = MemoryStack.stackPush()) { + IntBuffer a = stack.mallocInt(1), d = stack.mallocInt(1), g = stack.mallocInt(1); + int os2 = this.table("OS/2"); + boolean useTypo = os2 >= 0 && this.data.limit() > os2 + 64 && (u16(this.data, os2 + 62) & (1 << 7)) != 0; + if (useTypo && STBTruetype.stbtt_GetFontVMetricsOS2(this.info, a, d, g)) { + return new int[] {a.get(0), d.get(0), g.get(0)}; + } + STBTruetype.stbtt_GetFontVMetrics(this.info, a, d, g); + return new int[] {a.get(0), d.get(0), g.get(0)}; + } + } + + /** The gcd of every outline coordinate of every glyph (Jersey 10: 75 of 1400 units). */ + private int outlineGrid() { + int maxp = this.table("maxp"); + int glyphCount = maxp < 0 ? 0 : u16(this.data, maxp + 4); + int grid = 0; + for (int g = 0; g < glyphCount; g++) { + STBTTVertex.Buffer shape = STBTruetype.stbtt_GetGlyphShape(this.info, g); + if (shape == null) { + continue; + } + for (STBTTVertex v : shape) { + grid = gcd(grid, Math.abs(v.x())); + grid = gcd(grid, Math.abs(v.y())); + grid = gcd(grid, Math.abs(v.cx())); + grid = gcd(grid, Math.abs(v.cy())); + } + STBTruetype.stbtt_FreeShape(this.info, shape); + if (grid == 1) { + break; // cannot get any finer + } + } + return Math.max(1, grid); + } + + private static int gcd(int a, int b) { + while (b != 0) { + int rest = a % b; + a = b; + b = rest; + } + return a; + } + + /** Offset of a table, from the directory at the start of the file; -1 if absent. */ + private int table(String tag) { + int offset = STBTruetype.stbtt_GetFontOffsetForIndex(this.data, 0); + int tables = u16(this.data, offset + 4); + for (int i = 0; i < tables; i++) { + int record = offset + 12 + i * 16; + if (this.data.get(record) == tag.charAt(0) && this.data.get(record + 1) == tag.charAt(1) + && this.data.get(record + 2) == tag.charAt(2) && this.data.get(record + 3) == tag.charAt(3)) { + return u16(this.data, record + 8) << 16 | u16(this.data, record + 10); + } + } + return -1; + } + + private static int u16(ByteBuffer b, int offset) { + return (b.get(offset) & 0xff) << 8 | b.get(offset + 1) & 0xff; + } + + @Override + public String toString() { + return this.name; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/text/GlyphRasterizer.java b/core/src/main/java/org/openpatch/scratch/internal/text/GlyphRasterizer.java new file mode 100644 index 00000000..ddc56cc4 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/text/GlyphRasterizer.java @@ -0,0 +1,61 @@ +package org.openpatch.scratch.internal.text; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import org.lwjgl.stb.STBTruetype; +import org.lwjgl.system.MemoryStack; +import org.lwjgl.system.MemoryUtil; + +/** + * Glyph bitmaps at device size (nominal size × window scale), for the renderer's glyph atlases + * and for CPU captures. Grey coverage in normal mode; in pixel-art mode on whole device pixels and + * without smoothing. + */ +public final class GlyphRasterizer { + + /** + * A glyph's coverage. + * + * @param width bitmap width in device pixels + * @param height bitmap height in device pixels + * @param offsetX left edge relative to the pen position + * @param offsetY top edge relative to the baseline (negative: above it) + * @param coverage 0–255 per pixel, row by row, top first + */ + public record GlyphBitmap(int width, int height, int offsetX, int offsetY, byte[] coverage) {} + + private GlyphRasterizer() {} + + /** + * @param deviceSize the font size in device pixels + * @param subpixelX the fractional part of the pen position (0–1), ignored in pixel-art mode + */ + public static GlyphBitmap rasterize(Font font, int codepoint, double deviceSize, double subpixelX, + boolean pixelArt) { + float scale = (float) (deviceSize / font.getUnitsPerEm()); + float shift = pixelArt ? 0 : (float) (subpixelX - Math.floor(subpixelX)); + int glyph = font.glyph(codepoint); + try (MemoryStack stack = MemoryStack.stackPush()) { + IntBuffer x0 = stack.mallocInt(1), y0 = stack.mallocInt(1), x1 = stack.mallocInt(1), y1 = stack.mallocInt(1); + STBTruetype.stbtt_GetGlyphBitmapBoxSubpixel(font.info, glyph, scale, scale, shift, 0, x0, y0, x1, y1); + int w = x1.get(0) - x0.get(0), h = y1.get(0) - y0.get(0); + if (w <= 0 || h <= 0) { + return new GlyphBitmap(0, 0, x0.get(0), y0.get(0), new byte[0]); + } + ByteBuffer out = MemoryUtil.memAlloc(w * h); + try { + STBTruetype.stbtt_MakeGlyphBitmapSubpixel(font.info, out, w, h, w, scale, scale, shift, 0, glyph); + byte[] coverage = new byte[w * h]; + out.get(coverage); + if (pixelArt) { + for (int i = 0; i < coverage.length; i++) { + coverage[i] = (coverage[i] & 0xff) >= 128 ? (byte) 255 : 0; + } + } + return new GlyphBitmap(w, h, x0.get(0), y0.get(0), coverage); + } finally { + MemoryUtil.memFree(out); + } + } + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/text/LineBreaker.java b/core/src/main/java/org/openpatch/scratch/internal/text/LineBreaker.java new file mode 100644 index 00000000..0783b75e --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/text/LineBreaker.java @@ -0,0 +1,91 @@ +package org.openpatch.scratch.internal.text; + +import java.util.ArrayList; +import java.util.List; + +/** + * Where lines break: {@code \n} always; otherwise at spaces and after + * hyphens, greedily; a word wider than the line breaks between letters, never so that a hyphen + * starts a line. Spaces at a break belong to neither line. Small and separate so that the online + * IDE can port it line by line. + */ +public final class LineBreaker { + + /** The width of codepoints {@code [from, to)} as one run on a line, kerning included. */ + @FunctionalInterface + public interface Measure { + double width(int[] codepoints, int from, int to); + } + + private LineBreaker() {} + + /** + * The lines of a text as codepoint arrays. + * + * @param maxWidth the widest a line may be; 0, negative or infinite means no wrapping + */ + public static List breakLines(String text, double maxWidth, Measure measure) { + boolean wrap = maxWidth > 0 && !Double.isInfinite(maxWidth); + List lines = new ArrayList<>(); + for (String paragraph : text.split("\n", -1)) { + int[] cps = paragraph.codePoints().toArray(); + if (!wrap) { + lines.add(cps); + continue; + } + int start = 0; + while (true) { + int end = start; + while (end < cps.length && measure.width(cps, start, end + 1) <= maxWidth) { + end++; + } + if (end == cps.length) { + lines.add(slice(cps, start, end)); + break; + } + // cps[start, end) fits, cps[end] does not: find a break at a space or after a hyphen + int at = -1; + for (int p = end; p > start; p--) { + if (cps[p] == ' ' || cps[p - 1] == '-') { + at = p; + break; + } + } + int next; + if (at > start) { + lines.add(slice(cps, start, trimEnd(cps, start, at))); + next = at; + } else { + // a word wider than the line: between letters, at least one per line + int cut = Math.max(end, start + 1); + if (cut < cps.length && cps[cut] == '-' && cut - 1 > start) { + cut--; // the hyphen goes with the letter before it, not to the start of a line + } + lines.add(slice(cps, start, cut)); + next = cut; + } + while (next < cps.length && cps[next] == ' ') { + next++; + } + if (next == cps.length) { + break; + } + start = next; + } + } + return lines; + } + + private static int trimEnd(int[] cps, int start, int end) { + while (end > start && cps[end - 1] == ' ') { + end--; + } + return end; + } + + private static int[] slice(int[] cps, int from, int to) { + int[] out = new int[to - from]; + System.arraycopy(cps, from, out, 0, out.length); + return out; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/text/TextLayout.java b/core/src/main/java/org/openpatch/scratch/internal/text/TextLayout.java new file mode 100644 index 00000000..b2a9bf64 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/text/TextLayout.java @@ -0,0 +1,134 @@ +package org.openpatch.scratch.internal.text; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A text laid out in stage units at its nominal size: lines, glyph positions, the box. It never + * depends on the window's size or scale, so bubble and box sizes are the same on every machine + * and can be tested without a window; the renderer only multiplies by the scale. Alignment is + * the renderer's business: lines start at x = 0. + */ +public final class TextLayout { + + /** + * A glyph on a line. + * + * @param codepoint what to draw + * @param font the font it is drawn with: the fallback when the text's font lacks it + * @param x its pen position from the line's left edge + */ + public record Glyph(int codepoint, Font font, double x) {} + + /** + * A line. + * + * @param text its characters + * @param width its width + * @param baseline its baseline, measured down from the top of the box + * @param glyphs its glyphs, left to right + */ + public record Line(String text, double width, double baseline, List glyphs) {} + + private record Key(String text, Font font, double size, double maxWidth) {} + + private static final Map CACHE = Collections.synchronizedMap( + new LinkedHashMap<>(64, 0.75f, true) { + @Override + protected boolean removeEldestEntry(Map.Entry eldest) { + return this.size() > 256; + } + }); + + private final List lines; + private final double width, height, size; + private final Font font; + + private TextLayout(List lines, double width, double height, double size, Font font) { + this.lines = lines; + this.width = width; + this.height = height; + this.size = size; + this.font = font; + } + + /** + * The layout of {@code text}, from a small cache. + * + * @param maxWidth where lines wrap; 0 or less for no wrapping + */ + public static TextLayout of(String text, Font font, double size, double maxWidth) { + Key key = new Key(Objects.requireNonNull(text), font, size, maxWidth); + TextLayout cached = CACHE.get(key); + if (cached == null) { + cached = layout(text, font, size, maxWidth); + CACHE.put(key, cached); + } + return cached; + } + + public List lines() { + return this.lines; + } + + /** The widest line. */ + public double width() { + return this.width; + } + + /** Lines × line height. */ + public double height() { + return this.height; + } + + public double size() { + return this.size; + } + + public Font font() { + return this.font; + } + + private static TextLayout layout(String text, Font font, double size, double maxWidth) { + Font fallback = Font.defaultFont(); + LineBreaker.Measure measure = (cps, from, to) -> place(cps, from, to, font, fallback, size, null); + double lineHeight = font.lineHeight(size); + double ascent = font.ascent(size); + List lines = new ArrayList<>(); + double widest = 0; + for (int[] cps : LineBreaker.breakLines(text, maxWidth, measure)) { + List glyphs = new ArrayList<>(); + double w = place(cps, 0, cps.length, font, fallback, size, glyphs); + lines.add(new Line(new String(cps, 0, cps.length), w, ascent + lines.size() * lineHeight, + List.copyOf(glyphs))); + widest = Math.max(widest, w); + } + return new TextLayout(List.copyOf(lines), widest, lines.size() * lineHeight, size, font); + } + + /** Lays codepoints out from x = 0; returns the width, and adds the glyphs if asked to. */ + private static double place(int[] cps, int from, int to, Font font, Font fallback, double size, + List out) { + double x = 0; + int previous = -1; + Font previousFont = null; + for (int i = from; i < to; i++) { + int cp = cps[i]; + Font f = !font.hasGlyph(cp) && font != fallback && fallback.hasGlyph(cp) ? fallback : font; + if (previous >= 0 && previousFont == f) { + x += f.kerning(previous, cp, size); + } + if (out != null) { + out.add(new Glyph(cp, f, x)); + } + x += f.advance(cp, size); + previous = cp; + previousFont = f; + } + return x; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/text/package-info.java b/core/src/main/java/org/openpatch/scratch/internal/text/package-info.java new file mode 100644 index 00000000..f85612f4 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/text/package-info.java @@ -0,0 +1,6 @@ +/** + * The text engine: fonts through stb_truetype, metrics from the font + * file, own line breaking, layout in stage units at the nominal size, glyph bitmaps at device + * size. No AWT. + */ +package org.openpatch.scratch.internal.text; diff --git a/core/src/main/java/org/openpatch/scratch/internal/window/Keys.java b/core/src/main/java/org/openpatch/scratch/internal/window/Keys.java new file mode 100644 index 00000000..c1fe171e --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/window/Keys.java @@ -0,0 +1,91 @@ +package org.openpatch.scratch.internal.window; + +import static org.lwjgl.glfw.GLFW.*; + +import org.openpatch.scratch.KeyCode; + +/** + * GLFW keys to {@link KeyCode}. GLFW names keys by where they sit on a US keyboard, so a German Z + * (where the US Y is) arrives as GLFW_KEY_Y: letters and digits therefore go by the name the + * keyboard layout gives the key ({@code glfwGetKeyName}); everything else by place. + */ +final class Keys { + + private Keys() {} + + static KeyCode map(int key, int scancode) { + if (key >= GLFW_KEY_A && key <= GLFW_KEY_Z || key >= GLFW_KEY_0 && key <= GLFW_KEY_9) { + String name = glfwGetKeyName(key, scancode); + if (name != null && name.length() == 1) { + char c = Character.toUpperCase(name.charAt(0)); + if (c >= 'A' && c <= 'Z') { + return KeyCode.valueOf(String.valueOf(c)); + } + if (c >= '0' && c <= '9') { + return KeyCode.valueOf("DIGIT_" + c); + } + } + // a layout that has no letter there (Cyrillic, …): the US place + return key <= GLFW_KEY_9 ? KeyCode.valueOf("DIGIT_" + (char) key) : KeyCode.valueOf(String.valueOf((char) key)); + } + return switch (key) { + case GLFW_KEY_SPACE -> KeyCode.SPACE; + case GLFW_KEY_ENTER, GLFW_KEY_KP_ENTER -> KeyCode.ENTER; + case GLFW_KEY_BACKSPACE -> KeyCode.BACKSPACE; + case GLFW_KEY_TAB -> KeyCode.TAB; + case GLFW_KEY_ESCAPE -> KeyCode.ESCAPE; + case GLFW_KEY_LEFT -> KeyCode.LEFT; + case GLFW_KEY_RIGHT -> KeyCode.RIGHT; + case GLFW_KEY_UP -> KeyCode.UP; + case GLFW_KEY_DOWN -> KeyCode.DOWN; + case GLFW_KEY_LEFT_SHIFT, GLFW_KEY_RIGHT_SHIFT -> KeyCode.SHIFT; + case GLFW_KEY_LEFT_CONTROL, GLFW_KEY_RIGHT_CONTROL -> KeyCode.CTRL; + case GLFW_KEY_LEFT_ALT, GLFW_KEY_RIGHT_ALT -> KeyCode.ALT; + case GLFW_KEY_LEFT_SUPER, GLFW_KEY_RIGHT_SUPER -> KeyCode.META; + case GLFW_KEY_PAUSE -> KeyCode.PAUSE; + case GLFW_KEY_CAPS_LOCK -> KeyCode.CAPS_LOCK; + case GLFW_KEY_PAGE_UP -> KeyCode.PAGE_UP; + case GLFW_KEY_PAGE_DOWN -> KeyCode.PAGE_DOWN; + case GLFW_KEY_END -> KeyCode.END; + case GLFW_KEY_HOME -> KeyCode.HOME; + case GLFW_KEY_INSERT -> KeyCode.INSERT; + case GLFW_KEY_DELETE -> KeyCode.DELETE; + case GLFW_KEY_COMMA -> KeyCode.COMMA; + case GLFW_KEY_MINUS -> KeyCode.MINUS; + case GLFW_KEY_PERIOD -> KeyCode.PERIOD; + case GLFW_KEY_SLASH -> KeyCode.SLASH; + case GLFW_KEY_SEMICOLON -> KeyCode.SEMICOLON; + case GLFW_KEY_EQUAL -> KeyCode.EQUALS; + case GLFW_KEY_LEFT_BRACKET -> KeyCode.OPEN_BRACKET; + case GLFW_KEY_BACKSLASH -> KeyCode.BACK_SLASH; + case GLFW_KEY_RIGHT_BRACKET -> KeyCode.CLOSE_BRACKET; + case GLFW_KEY_GRAVE_ACCENT -> KeyCode.BACK_QUOTE; + case GLFW_KEY_APOSTROPHE -> KeyCode.QUOTE; + case GLFW_KEY_NUM_LOCK -> KeyCode.NUM_LOCK; + case GLFW_KEY_SCROLL_LOCK -> KeyCode.SCROLL_LOCK; + case GLFW_KEY_PRINT_SCREEN -> KeyCode.PRINT_SCREEN; + case GLFW_KEY_MENU -> KeyCode.CONTEXT_MENU; + case GLFW_KEY_KP_0 -> KeyCode.NUMPAD_0; + case GLFW_KEY_KP_1 -> KeyCode.NUMPAD_1; + case GLFW_KEY_KP_2 -> KeyCode.NUMPAD_2; + case GLFW_KEY_KP_3 -> KeyCode.NUMPAD_3; + case GLFW_KEY_KP_4 -> KeyCode.NUMPAD_4; + case GLFW_KEY_KP_5 -> KeyCode.NUMPAD_5; + case GLFW_KEY_KP_6 -> KeyCode.NUMPAD_6; + case GLFW_KEY_KP_7 -> KeyCode.NUMPAD_7; + case GLFW_KEY_KP_8 -> KeyCode.NUMPAD_8; + case GLFW_KEY_KP_9 -> KeyCode.NUMPAD_9; + case GLFW_KEY_KP_MULTIPLY -> KeyCode.MULTIPLY; + case GLFW_KEY_KP_ADD -> KeyCode.ADD; + case GLFW_KEY_KP_SUBTRACT -> KeyCode.SUBTRACT; + case GLFW_KEY_KP_DECIMAL -> KeyCode.DECIMAL; + case GLFW_KEY_KP_DIVIDE -> KeyCode.DIVIDE; + default -> { + if (key >= GLFW_KEY_F1 && key <= GLFW_KEY_F12) { + yield KeyCode.valueOf("F" + (key - GLFW_KEY_F1 + 1)); + } + yield KeyCode.UNKNOWN; + } + }; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/window/LoadingScreen.java b/core/src/main/java/org/openpatch/scratch/internal/window/LoadingScreen.java new file mode 100644 index 00000000..c55960a3 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/window/LoadingScreen.java @@ -0,0 +1,124 @@ +package org.openpatch.scratch.internal.window; + +import java.util.ArrayList; +import java.util.List; +import org.openpatch.scratch.internal.Assets; +import org.openpatch.scratch.internal.draw.CameraDraw; +import org.openpatch.scratch.internal.draw.DrawList; +import org.openpatch.scratch.internal.draw.ImageDraw; +import org.openpatch.scratch.internal.draw.Item; +import org.openpatch.scratch.internal.draw.ShapeDraw; +import org.openpatch.scratch.internal.draw.TextDraw; +import org.openpatch.scratch.internal.image.Image; +import org.openpatch.scratch.internal.image.Images; +import org.openpatch.scratch.internal.text.Font; +import org.openpatch.scratch.internal.text.TextLayout; + +/** + * The built-in loading screen as 6.x drew it: the logo (or {@code Window.useSplashLogo}'s picture), + * the file being loaded and a percentage on dark grey, fading in and, once the assets are loaded + * and a stage is set, out over that stage. Made of draw-list items, so the renderer needs nothing + * of its own for it. + */ +final class LoadingScreen { + + static final double FADE_SECONDS = 0.3; + private static final int BACKGROUND = 0xff222222; + + private final Image logo; + private final double logoW, logoH; + private long started; + private long fadingOut; + + LoadingScreen(String logoPath, int stageW, int stageH) { + Image picture = null; + if (logoPath != null) { + try { + picture = Images.load(logoPath); + } catch (RuntimeException e) { + System.err.println("WARNING: Could not load the splash logo " + logoPath + ": " + e.getMessage()); + } + } + if (picture == null) { + picture = Images.load("loading.png"); + } + this.logo = picture; + // into rather over half the stage, never enlarged + double scale = Math.min(1, Math.min(stageW * 0.55 / picture.getWidth(), stageH * 0.55 / picture.getHeight())); + this.logoW = picture.getWidth() * scale; + this.logoH = picture.getHeight() * scale; + } + + /** + * Whether the screen is still shown at {@code now}; starts fading out once {@code ready}, but + * only after the fade in finished, so a project with nothing to load still shows the logo arrive + * and leave rather than blink. + */ + boolean showing(long now, boolean ready) { + if (this.started == 0) { + this.started = now; + } + if (ready && this.fadingOut == 0 && seconds(now - this.started) >= FADE_SECONDS) { + this.fadingOut = now; + } + return this.fadingOut == 0 || seconds(now - this.fadingOut) < FADE_SECONDS; + } + + /** Whether the stage shows underneath (fading out). */ + boolean fadingOut() { + return this.fadingOut != 0; + } + + /** The screen alone, for a stage of this size. */ + DrawList alone(long now, int width, int height, Assets assets) { + return new DrawList(-1, 0, width, height, BACKGROUND, null, CameraDraw.IDENTITY, List.of(), List.of(), List.of(), + null, false, List.of(), List.of(), null, this.items(now, width, height, assets), null); + } + + /** The screen on top of a stage's first draw list. */ + DrawList over(DrawList stage, long now, Assets assets) { + List items = new ArrayList<>(stage.overlayItems()); + items.addAll(this.items(now, stage.width(), stage.height(), assets)); + return new DrawList(stage.stageId(), stage.tick(), stage.width(), stage.height(), stage.stageColor(), + stage.backdrop(), stage.camera(), stage.layers(), stage.overlay(), stage.ui(), stage.ask(), stage.debug(), + stage.stageShaders(), stage.monitors(), stage.transition(), items, stage.cursor()); + } + + private List items(long now, int width, int height, Assets assets) { + double alpha = this.fadingOut != 0 ? 1 - seconds(now - this.fadingOut) / FADE_SECONDS + : seconds(now - this.started) / FADE_SECONDS; + alpha = Math.max(0, Math.min(1, alpha)); + int a = (int) Math.round(alpha * 255); + List items = new ArrayList<>(); + if (this.fadingOut != 0) { + double w = width / 2.0, h = height / 2.0; + items.add(new ShapeDraw(new double[] {-w, h, w, h, w, -h, -w, -h}, (a << 24) | (BACKGROUND & 0xffffff), 0, 0)); + } + double x = this.logoW / 2, y = this.logoH / 2; + items.add(new ImageDraw(this.logo, 0, 0, this.logo.getWidth(), this.logo.getHeight(), + new double[] {-x, y, x, y, x, -y, -x, -y}, (float) alpha)); + if (assets == null) { + return items; // a stage being made: no files, no percentage + } + String file = assets.current(); + if (file.length() > 48) { + file = "..." + file.substring(file.length() - 45); + } + int percent = (int) Math.round(assets.progress() * 100); + int color = (a << 24) | 0xffffff; + double top = -y - 8; + for (String line : new String[] {file, percent + "%"}) { + if (!line.isEmpty()) { + TextLayout layout = TextLayout.of(line, Font.defaultFont(), 14, 0); + items.add(new TextDraw(layout, -layout.width() / 2, top, layout.width(), layout.height(), 1, color, + TextDraw.Box.NONE, 0, 0, 0, 0)); + } + top -= 20; + } + return items; + } + + private static double seconds(long nanos) { + return nanos / 1e9; + } +} diff --git a/core/src/main/java/org/openpatch/scratch/internal/window/WindowHost.java b/core/src/main/java/org/openpatch/scratch/internal/window/WindowHost.java new file mode 100644 index 00000000..28a36646 --- /dev/null +++ b/core/src/main/java/org/openpatch/scratch/internal/window/WindowHost.java @@ -0,0 +1,611 @@ +package org.openpatch.scratch.internal.window; + +import static org.lwjgl.glfw.GLFW.*; +import static org.lwjgl.opengl.GL33C.*; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Locale; +import java.util.concurrent.CountDownLatch; +import org.lwjgl.glfw.GLFWErrorCallback; +import org.lwjgl.glfw.GLFWVidMode; +import org.lwjgl.opengl.GL; +import org.lwjgl.system.Configuration; +import org.lwjgl.system.MemoryStack; +import org.lwjgl.system.Platform; +import org.openpatch.scratch.KeyCode; +import org.openpatch.scratch.Launcher; +import org.openpatch.scratch.MouseCode; +import org.openpatch.scratch.Window; +import org.openpatch.scratch.extension.Extension; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.Preview; +import org.openpatch.scratch.internal.Release; +import org.openpatch.scratch.internal.draw.DrawList; +import org.openpatch.scratch.internal.image.Image; +import org.openpatch.scratch.internal.input.InputEvent; +import org.openpatch.scratch.internal.loop.GameLoop; +import org.openpatch.scratch.internal.loop.TickClock; +import org.openpatch.scratch.internal.render.Renderer; + +/** + * The window: GLFW and OpenGL on the window thread, the game loop in lockstep with the game thread, + * input turned into events for the game. The window thread is the process's + * first thread under {@link Launcher} (macOS: {@code -XstartOnFirstThread}); in a plain + * {@code java} run it is a thread of the library's, with {@code glfw_async} on macOS. + */ +public final class WindowHost { + + /** What the window needs to know before it opens. */ + public record Settings(String title, boolean fullScreen, boolean pixelArt, boolean smoothPixelArt, + double frameSmoothing, String splashLogo, String assets, List extensions) {} + + private final Game game; + private final Window window; + private final Settings settings; + private final CountDownLatch opened = new CountDownLatch(1); + private final TickClock clock = new TickClock(); + private volatile long handle; + private volatile boolean closeRequested; + private GameLoop loop; + private Renderer renderer; + private DrawList shown; + /** Loading screen at startup (null once it is gone) and the assets it waits for. */ + private LoadingScreen loadingScreen; + private org.openpatch.scratch.internal.Assets assets; + private DrawList firstStageList; + /** Loading screen while a transition's stage is being made, or null. */ + private LoadingScreen stageScreen; + private static final long UPLOAD_NANOS = 4_000_000; + private static final long MAKING_STAGE_NANOS = 200_000_000; + private double cursorX, cursorY; + private boolean fullScreen; + private int[] windowedBounds; + private boolean vsync; + /** The screen's refresh period: with working vsync, swaps come no faster than this. */ + private long refreshPeriod = 1_000_000_000L / 60; + /** False once vsync turned out not to wait, or with {@code -Dscratch4j.vsync=false}. */ + private boolean vsyncWorks; + /** On Wayland vsync only while focused: a hidden window may block the swap there. */ + private boolean wayland; + private Image cursorImage; + private long cursor; + + private WindowHost(Game game, Window window, Settings settings) { + this.game = game; + this.window = window; + this.settings = settings; + this.fullScreen = settings.fullScreen(); + } + + /** Opens the window on its thread and returns at once, as 6.x's {@code new Window} did. */ + public static WindowHost start(Game game, Window window, Settings settings) { + WindowHost host = new WindowHost(game, window, settings); + game.onExit(window::whenExits); + if (Launcher.isActive()) { + Launcher.runOnFirstThread(host::run); + } else { + if (Platform.get() == Platform.MACOSX) { + // GLFW calls are dispatched to the first thread's run loop (LWJGL's glfw_async) + Configuration.GLFW_LIBRARY_NAME.set("glfw_async"); + } + Thread thread = new Thread(host::run, "scratch4j-window"); + thread.start(); // not a daemon: it keeps the program alive after main returns + } + return host; + } + + /** Ends the program as closing the window does: {@code whenExits()} first. Any thread. */ + public void close() { + this.closeRequested = true; + long h = this.handle; + if (h != 0) { + glfwSetWindowShouldClose(h, true); + } + } + + // ---- the window thread -------------------------------------------------------------------- + + private void run() { + try { + this.open(); + } catch (Throwable t) { + System.err.println("Scratch for Java could not open its window: " + t.getMessage()); + if (String.valueOf(t.getMessage()).contains("Failed to locate library")) { + // not the graphics card: LWJGL's native libraries are missing for this platform + System.err.println("LWJGL's native libraries for " + System.getProperty("os.name") + " " + + System.getProperty("os.arch") + " are missing. Use the scratch--all.jar, or put the " + + "lwjgl-*-natives-.jar files next to the others (on the module path also add them with " + + "--add-modules org.lwjgl.natives,org.lwjgl.glfw.natives,…)."); + Release.crashed("The game could not start: files it needs for this computer are missing."); + } else { + System.err.println("It needs OpenGL 3.3 (4.1 on macOS). Update the graphics driver, or run on another " + + "computer."); + Release.crashed("The game could not open its window: it needs OpenGL 3.3 (4.1 on macOS). Updating the " + + "graphics driver may help."); + } + this.opened.countDown(); + System.exit(1); + return; + } + this.opened.countDown(); + this.loop = new GameLoop(this.game); + this.loop.start(); + try { + this.frames(); + } catch (Throwable t) { + t.printStackTrace(); + this.crashed("The game crashed: " + t); + } + boolean answered = this.loop.exit(); + if (!answered) { + System.err.println("Scratch for Java: the game did not finish whenExits() within a second; quitting anyway."); + } + if (this.renderer != null) { + this.renderer.delete(); + } + glfwDestroyWindow(this.handle); + glfwTerminate(); + System.exit(0); + } + + private void open() { + GLFWErrorCallback.createPrint(System.err).set(); + String platform = System.getProperty("scratch4j.platform"); + if ("x11".equals(platform)) { + glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11); + } else if ("wayland".equals(platform)) { + glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND); + } + if (!glfwInit()) { + throw new IllegalStateException("GLFW could not start (no display?)"); + } + glfwDefaultWindowHints(); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); + glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); + glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); + // fullscreen is meant borderless: Alt+Tab or a click on another monitor must not minimise it + glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE); + boolean hidden = System.getProperty("scratch4j.preview") != null || Boolean.getBoolean("scratch4j.hidden"); + glfwWindowHint(GLFW_VISIBLE, hidden ? GLFW_FALSE : GLFW_TRUE); + int[] size = this.initialSize(); + this.handle = glfwCreateWindow(size[0], size[1], this.settings.title(), 0, 0); + if (this.handle == 0) { + throw new IllegalStateException("no OpenGL 3.3 core context"); + } + glfwMakeContextCurrent(this.handle); + GL.createCapabilities(); + // Wayland may block glfwSwapBuffers for hidden windows: there vsync only + // while the window has the focus (a hidden window never has it), own pacing otherwise + this.wayland = glfwGetPlatform() == GLFW_PLATFORM_WAYLAND; + this.vsyncWorks = !"false".equals(System.getProperty("scratch4j.vsync")); + this.vsync = this.wantsVsync(); + glfwSwapInterval(this.vsync ? 1 : 0); + GLFWVidMode mode = glfwGetVideoMode(glfwGetPrimaryMonitor()); + if (mode != null) { + this.clock.useRefreshRate(mode.refreshRate()); + if (mode.refreshRate() > 0) { + this.refreshPeriod = 1_000_000_000L / mode.refreshRate(); + } + } + this.renderer = new Renderer(this.settings.pixelArt(), this.settings.smoothPixelArt(), + this.settings.frameSmoothing()); + this.installInput(); + this.assets = org.openpatch.scratch.internal.Assets.start(this.settings.assets()); + this.loadingScreen = new LoadingScreen(this.settings.splashLogo(), this.game.getWidth(), this.game.getHeight()); + this.game.getExtensions().setLoading(true); + Preview.startTimeout(); + if (this.fullScreen) { + this.fullScreen = false; + this.toggleFullScreen(); + } + if (Boolean.getBoolean("scratch4j.debugGl")) { + System.out.printf("Scratch for Java: GL %s, %s%n", glGetString(GL_VERSION), glGetString(GL_RENDERER)); + try (MemoryStack stack = MemoryStack.stackPush()) { + var w = stack.mallocInt(1); + var h = stack.mallocInt(1); + var cx = stack.mallocFloat(1); + var cy = stack.mallocFloat(1); + glfwGetWindowSize(this.handle, w, h); + System.out.printf("Scratch for Java: window %dx%d", w.get(0), h.get(0)); + glfwGetFramebufferSize(this.handle, w, h); + System.out.printf(", framebuffer %dx%d", w.get(0), h.get(0)); + glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), cx, cy); + System.out.printf(", monitor content scale %.2f", cx.get(0)); + var videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor()); + if (videoMode != null) { + System.out.printf(", mode %dx%d%n", videoMode.width(), videoMode.height()); + } else { + System.out.printf("%n"); + } + } + } + } + + /** The stage size, or in pixel art the largest whole multiple that fits the screen. */ + private int[] initialSize() { + int w = this.game.getWidth(), h = this.game.getHeight(); + if (this.settings.pixelArt()) { + GLFWVidMode mode = glfwGetVideoMode(glfwGetPrimaryMonitor()); + if (mode != null) { + int factor = Math.max(1, Math.min((mode.width() - 80) / w, (mode.height() - 120) / h)); + return new int[] {w * factor, h * factor}; + } + } + return new int[] {w, h}; + } + + private void frames() { + final long period = 1_000_000_000L / 60; + long last = System.nanoTime(), next = last, second = last, lastSwap = last; + int frames = 0; + int swaps = 0, fastSwaps = 0; + while (!glfwWindowShouldClose(this.handle) && !this.closeRequested) { + glfwPollEvents(); + long now = System.nanoTime(); + DrawList list; + if (this.loadingScreen != null) { + list = this.loadingFrame(now); + last = now; // no ticks owed for the time spent loading + } else { + this.clock.setPaused(this.game.isPaused()); + this.clock.setGameSpeed(this.game.getGameSpeed()); + for (int steps = this.game.takeSteps(); steps > 0; steps--) { + this.clock.step(); + } + int ticks = this.clock.advance((now - last) / 1e9); + last = now; + // extensions poll their devices; the game thread waits, so the hand-over needs no lock + this.game.getExtensions().poll(); + this.game.getExtensions().handOver(); + list = this.loop.runBatch(ticks, this::pollWhileWaiting); + this.stageScreen = null; + } + if (list == null) { + break; // closed while learner code was busy + } + if (Release.isOn() && this.game.getStopped() != null) { + // a released game has no console to read the error in: say so, then end + String first = this.game.getStopped().message().strip().lines().findFirst().orElse(""); + this.crashed("The game stopped because of an error.\n" + first); + break; + } + this.shown = list; + this.updateCursor(list.cursor()); + if (this.wantsVsync() != this.vsync) { + this.vsync = !this.vsync; + glfwSwapInterval(this.vsync ? 1 : 0); + next = System.nanoTime(); + swaps = 0; + fastSwaps = 0; + if (Boolean.getBoolean("scratch4j.debugGl")) { + System.out.println("Scratch for Java: vsync " + (this.vsync ? "on" : "off (own pacing)")); + } + } + this.draw(); + glfwSwapBuffers(this.handle); + frames++; + long swapped = System.nanoTime(); + if (this.vsync) { + // vsync that does not wait (Xvfb, some drivers): most swaps of a second come faster than + // the screen refreshes; then pace ourselves instead (slow frames are no sign either way) + if (swapped - lastSwap < this.refreshPeriod * 3 / 4) { + fastSwaps++; + } + if (++swaps == 60) { + if (fastSwaps > 45) { + this.vsyncWorks = false; + this.vsync = false; + glfwSwapInterval(0); + next = swapped; + if (Boolean.getBoolean("scratch4j.debugGl")) { + System.out.println("Scratch for Java: vsync does not wait, own pacing"); + } + } + swaps = 0; + fastSwaps = 0; + } + } + lastSwap = swapped; + now = System.nanoTime(); + if (now - second >= 1_000_000_000L) { + this.renderer.setFps(frames * 1e9 / (now - second)); + frames = 0; + second = now; + } + if (!this.vsync) { + // own pacing at 60 frames a second where vsync could block + next += period; + long wait = next - System.nanoTime(); + if (wait < -5 * period) { + next = System.nanoTime(); + } else { + while (System.nanoTime() < next - 1_500_000) { + sleep(1); + } + while (System.nanoTime() < next) { + Thread.onSpinWait(); + } + } + } + } + } + + /** + * Vsync where it works; on Wayland only while the window has the focus. Own pacing at 60 Hz is + * not locked to the screen's refresh, so it shows a frame twice or skips one now and then — a + * visible hitch in anything that scrolls. + */ + private boolean wantsVsync() { + return this.vsyncWorks && (!this.wayland || glfwGetWindowAttrib(this.handle, GLFW_FOCUSED) == GLFW_TRUE); + } + + /** The crash box of a released game, with the window out of its way (fullscreen would hide it). */ + private void crashed(String what) { + if (Release.isOn() && this.handle != 0) { + glfwHideWindow(this.handle); + glfwPollEvents(); + } + Release.crashed(what); + } + + private void pollWhileWaiting() { + glfwPollEvents(); + if (glfwWindowShouldClose(this.handle)) { + this.loop.close(); + return; + } + // a transition's stage taking long to make: the loading screen instead of a frozen picture + long since = this.game.makingStageSince(); + long now = System.nanoTime(); + if (since != 0 && now - since > MAKING_STAGE_NANOS) { + if (this.stageScreen == null) { + this.stageScreen = new LoadingScreen(this.settings.splashLogo(), this.game.getWidth(), this.game.getHeight()); + } + this.stageScreen.showing(now, false); + this.shown = this.stageScreen.alone(now, this.game.getWidth(), this.game.getHeight(), null); + this.draw(); + glfwSwapBuffers(this.handle); + } + } + + /** + * A frame of the loading screen: uploads decoded images for a few milliseconds, then the screen + * alone, or fading out over the stage's first picture once everything is loaded and a stage is + * set. Input that arrives meanwhile is dropped; no tick runs. + */ + private DrawList loadingFrame(long now) { + long until = now + UPLOAD_NANOS; + for (Image image; System.nanoTime() < until && (image = this.assets.nextUpload()) != null; ) { + this.renderer.prepare(image); + } + this.game.dropInput(); + boolean ready = this.assets.isDone() && this.game.getStage() != null; + boolean showing = !Preview.isPreview() && this.loadingScreen.showing(now, ready); + if (!showing && (ready || !Preview.isPreview())) { + this.loadingScreen = null; + this.game.getExtensions().setLoading(false); + return this.loop.runBatch(0, this::pollWhileWaiting); + } + if (this.loadingScreen.fadingOut()) { + if (this.firstStageList == null) { + this.firstStageList = this.loop.runBatch(0, this::pollWhileWaiting); + if (this.firstStageList == null) { + return null; + } + } + return this.loadingScreen.over(this.firstStageList, now, this.assets); + } + return this.loadingScreen.alone(now, this.game.getWidth(), this.game.getHeight(), this.assets); + } + + private void draw() { + if (this.shown == null) { + glClearColor(0, 0, 0, 1); + glClear(GL_COLOR_BUFFER_BIT); + return; + } + try (MemoryStack stack = MemoryStack.stackPush()) { + var w = stack.mallocInt(1); + var h = stack.mallocInt(1); + glfwGetFramebufferSize(this.handle, w, h); + this.renderer.render(this.shown, w.get(0), h.get(0)); + } + if (this.game.getExtensions().wantsFrames()) { + DrawList list = this.shown; + this.game.getExtensions().afterFrame(this.game.getStage(), new org.openpatch.scratch.extension.ExtensionContext.Frame() { + private int[] pixels; + + @Override + public int getWidth() { + return list.width(); + } + + @Override + public int getHeight() { + return list.height(); + } + + @Override + public int[] getArgb() { + if (this.pixels == null) { + this.pixels = WindowHost.this.renderer.capture(list, true); // read back only when asked for + } + return this.pixels.clone(); + } + + @Override + public void savePng(java.nio.file.Path file) throws java.io.IOException { + new Image(list.width(), list.height(), this.getArgb()).writePng(file); + } + }); + } + // Studio's preview and capture: frame.png, then stage.json + Preview.Shot shot = Preview.take(this.shown.stageId()); + if (shot != null) { + this.capture(shot.folder()); + try { + Preview.write(shot); + } catch (java.io.IOException e) { + System.err.println("Scratch for Java: could not write stage.json: " + e.getMessage()); + } + if (shot.thenExit()) { + this.close(); + } + } + } + + /** A stage's own mouse pointer: made once per image, the system's again for none. */ + private void updateCursor(org.openpatch.scratch.internal.draw.CursorDraw wanted) { + Image image = wanted == null ? null : wanted.image(); + if (image == this.cursorImage) { + return; + } + this.cursorImage = image; + long old = this.cursor; + this.cursor = 0; + if (image != null) { + try (MemoryStack stack = MemoryStack.stackPush()) { + java.nio.ByteBuffer rgba = stack.malloc(image.getWidth() * image.getHeight() * 4); + for (int p : image.getArgb()) { + rgba.put((byte) (p >> 16)).put((byte) (p >> 8)).put((byte) p).put((byte) (p >>> 24)); + } + rgba.flip(); + org.lwjgl.glfw.GLFWImage glfwImage = org.lwjgl.glfw.GLFWImage.malloc(stack); + glfwImage.set(image.getWidth(), image.getHeight(), rgba); + this.cursor = glfwCreateCursor(glfwImage, wanted.hotX(), wanted.hotY()); + } + } + glfwSetCursor(this.handle, this.cursor); + if (old != 0) { + glfwDestroyCursor(old); + } + } + + /** frame.png at stage size, as Studio's preview and capture expect. */ + private void capture(Path folder) { + try { + Files.createDirectories(folder); + int[] pixels = this.renderer.capture(this.shown); + new Image(this.shown.width(), this.shown.height(), pixels).writePng(folder.resolve("frame.png")); + } catch (Exception e) { + System.err.println("Scratch for Java: could not capture the frame: " + e.getMessage()); + } + } + + // ---- input -------------------------------------------------------------------------------- + + private void installInput() { + glfwSetKeyCallback(this.handle, (win, key, scancode, action, mods) -> { + if (action == GLFW_REPEAT) { + // one whenKeyPressed per press, as Processing had it; the ask() box still repeats + KeyCode code = Keys.map(key, scancode); + if (code != KeyCode.UNKNOWN) { + this.game.post(new InputEvent.Repeat(code)); + } + return; + } + boolean pressed = action == GLFW_PRESS; + if (pressed && key == GLFW_KEY_F12) { + this.game.setDebug(!this.game.isDebug()); + return; + } + if (pressed && (key == GLFW_KEY_F11 || key == GLFW_KEY_ENTER && (mods & GLFW_MOD_ALT) != 0)) { + this.toggleFullScreen(); + return; + } + KeyCode code = Keys.map(key, scancode); + if (code != KeyCode.UNKNOWN) { + this.game.post(new InputEvent.Key(code, pressed)); + } + }); + glfwSetCharCallback(this.handle, (win, codepoint) -> this.game.post(new InputEvent.Typed(codepoint))); + glfwSetCursorPosCallback(this.handle, (win, x, y) -> { + this.cursorX = x; + this.cursorY = y; + double[] p = this.toStage(x, y); + this.game.post(new InputEvent.Move(p[0], p[1])); + }); + glfwSetMouseButtonCallback(this.handle, (win, button, action, mods) -> { + MouseCode code = switch (button) { + case GLFW_MOUSE_BUTTON_LEFT -> MouseCode.LEFT; + case GLFW_MOUSE_BUTTON_RIGHT -> MouseCode.RIGHT; + case GLFW_MOUSE_BUTTON_MIDDLE -> MouseCode.CENTER; + default -> null; + }; + if (code != null) { + double[] p = this.toStage(this.cursorX, this.cursorY); + this.game.post(new InputEvent.Button(code, action == GLFW_PRESS, p[0], p[1])); + } + }); + // positive towards the user, as 6.x had it; GLFW counts away from the user + glfwSetScrollCallback(this.handle, (win, dx, dy) -> this.game.post(new InputEvent.Wheel(-dy))); + } + + /** Window coordinates (screen units, y down) to stage coordinates through the letterbox. */ + private double[] toStage(double x, double y) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var ww = stack.mallocInt(1); + var wh = stack.mallocInt(1); + var fw = stack.mallocInt(1); + var fh = stack.mallocInt(1); + glfwGetWindowSize(this.handle, ww, wh); + glfwGetFramebufferSize(this.handle, fw, fh); + // the letterbox is computed in framebuffer pixels; the cursor comes in window units + double toFb = ww.get(0) == 0 ? 1 : (double) fw.get(0) / ww.get(0); + int sw = this.game.getWidth(), sh = this.game.getHeight(); + double scale = Math.min((double) fw.get(0) / sw, (double) fh.get(0) / sh); + // must match Renderer.letterbox: whole numbers only in crisp pixel art + if (this.settings.pixelArt() && !this.settings.smoothPixelArt() && scale >= 1) { + scale = Math.floor(scale); + } + double left = Math.floor((fw.get(0) - sw * scale) / 2), top = Math.floor((fh.get(0) - sh * scale) / 2); + double sx = (x * toFb - left) / scale - sw / 2.0, sy = sh / 2.0 - (y * toFb - top) / scale; + return new double[] {sx, sy}; + } + } + + /** Borderless window at the screen's size, and back. */ + private void toggleFullScreen() { + long monitor = glfwGetPrimaryMonitor(); + GLFWVidMode mode = glfwGetVideoMode(monitor); + if (mode == null) { + return; + } + try (MemoryStack stack = MemoryStack.stackPush()) { + if (!this.fullScreen) { + var x = stack.mallocInt(1); + var y = stack.mallocInt(1); + var w = stack.mallocInt(1); + var h = stack.mallocInt(1); + glfwGetWindowPos(this.handle, x, y); + glfwGetWindowSize(this.handle, w, h); + this.windowedBounds = new int[] {x.get(0), y.get(0), w.get(0), h.get(0)}; + glfwSetWindowMonitor(this.handle, monitor, 0, 0, mode.width(), mode.height(), mode.refreshRate()); + } else { + int[] b = this.windowedBounds != null ? this.windowedBounds + : new int[] {100, 100, this.game.getWidth(), this.game.getHeight()}; + glfwSetWindowMonitor(this.handle, 0, b[0], b[1], b[2], b[3], GLFW_DONT_CARE); + } + } + this.fullScreen = !this.fullScreen; + glfwSwapInterval(this.vsync ? 1 : 0); + } + + private static void sleep(long millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + + @Override + public String toString() { + return String.format(Locale.ROOT, "WindowHost[%dx%d]", this.game.getWidth(), this.game.getHeight()); + } +} diff --git a/core/src/main/resources-filtered/org/openpatch/scratch/internal/version.properties b/core/src/main/resources-filtered/org/openpatch/scratch/internal/version.properties new file mode 100644 index 00000000..ec1d03b9 --- /dev/null +++ b/core/src/main/resources-filtered/org/openpatch/scratch/internal/version.properties @@ -0,0 +1,2 @@ +# filled in by Maven (core/pom.xml, resource filtering); read by Extension.coreVersion() +version=${project.version} diff --git a/core/src/main/resources/Jersey10-Regular.ttf b/core/src/main/resources/Jersey10-Regular.ttf new file mode 100644 index 00000000..42ac920f Binary files /dev/null and b/core/src/main/resources/Jersey10-Regular.ttf differ diff --git a/core/src/main/resources/OFL.txt b/core/src/main/resources/OFL.txt new file mode 100644 index 00000000..befc2e5b --- /dev/null +++ b/core/src/main/resources/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2023 The Soft Type Project Authors (https://github.com/scfried/soft-type-jersey) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/src/main/resources/UFL.txt b/core/src/main/resources/UFL.txt similarity index 100% rename from src/main/resources/UFL.txt rename to core/src/main/resources/UFL.txt diff --git a/src/main/resources/UbuntuMono-Regular.ttf b/core/src/main/resources/UbuntuMono-Regular.ttf similarity index 100% rename from src/main/resources/UbuntuMono-Regular.ttf rename to core/src/main/resources/UbuntuMono-Regular.ttf diff --git a/src/main/resources/catalogs/api.json b/core/src/main/resources/catalogs/api.json similarity index 68% rename from src/main/resources/catalogs/api.json rename to core/src/main/resources/catalogs/api.json index 0196cda3..8487f182 100644 --- a/src/main/resources/catalogs/api.json +++ b/core/src/main/resources/catalogs/api.json @@ -4,606 +4,594 @@ "browserVersion": "6.5.0-browser.1", "methods": [ { - "id": "AnimatedSprite/addAnimation(String,String,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", - "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int" - ], - "parameterNames": [ - "name", - "pattern", - "frames" - ], - "params": [ - "String name", - "String pattern", - "int frames" - ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.", - "scratchblock": null, - "paramDocs": [ - "name: the name of the animation", - "pattern: the pattern (@see String#format) of the file names. The frame\n starts from 1.", - "frames: the number of frames in the animation" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt eine Animation hinzu. %d im Muster wird durch 1..frames ersetzt, z.B. bunny1_walk%d" - } - } - }, - { - "id": "AnimatedSprite/addAnimation(String,Function,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/changeX(double)", + "memberId": "Camera/changeX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "changeX", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.util.function.Function", - "int" + "double" ], "parameterNames": [ - "name", - "builder", - "frame" + "dx" ], "params": [ - "String name", - "Function builder", - "int frame" + "double dx" ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nTo add an animation with file names \"walk_1.png\", \"walk_2.png\",\n\"walk_3.png\", you can use the following code:\n\n```java\nsprite.addAnimation(\"walk\", i -> \"walk_\" + i + \".png\", 3);\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the animation", - "builder: a function that builds the file names for the animation frames", - "frame: the number of frames in the animation. The frame starts from\n 1." + "dx: how far to move the camera along x" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/changeX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt eine Animation an; builder liefert zu 1..frames jeweils den Bildpfad" - } - } + "translations": {} }, { - "id": "AnimatedSprite/addAnimation(String,String,int,int,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/changeY(double)", + "memberId": "Camera/changeY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "changeY", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int" + "double" ], "parameterNames": [ - "name", - "path", - "frames", - "width", - "height" + "dy" ], "params": [ - "String name", - "String path", - "int frames", - "int width", - "int height" + "double dy" ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nFor an animation sprite sheet, where each frame is of equal width and height,\nyou can use this method to add an animation by specifying the path to the\nsprite sheet, the number of frames, and the dimensions of each frame.\nFor example, for a four-frame animation arranged in a single row, each frame\nbeing 64x64 pixels, you can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64);\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the animation", - "path: the path to the animation frames", - "frames: the number of frames in the animation", - "width: the width of each frame", - "height: the height of each frame" + "dy: how far to move the camera along y" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/changeY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zerlegt ein Bild in gleich große Einzelbilder und legt daraus eine Animation an" - } - } + "translations": {} }, { - "id": "AnimatedSprite/addAnimation(String,String,int,int,int,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/changeZoom(double)", + "memberId": "Camera/changeZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "changeZoom", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int", - "int" + "double" ], "parameterNames": [ - "name", - "path", - "frames", - "width", - "height", - "row" + "dz" ], "params": [ - "String name", - "String path", - "int frames", - "int width", - "int height", - "int row" + "double dz" ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nIf the animation frames are arranged in rows in a sprite sheet, you can use\nthis method to specify which row to use for the animation.\n\nFor example, for a four-frame animation arranged in a single row, you want the second, each frame\nbeing 64x64 pixels, you can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64, 2);\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the animation", - "path: the path to the animation frames", - "frames: the number of frames in the animation", - "width: the width of each frame", - "height: the height of each frame", - "row: the row of the animation frames" + "dz: percentage points to add to the zoom" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/changeZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wie addAnimation(name, imagePath, frames, width, height), beginnt aber in der angegebenen Zeile" - } - } + "translations": {} }, { - "id": "AnimatedSprite/addAnimation(String,String,int,int,int,int,boolean)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/constructor()", + "memberId": "Camera/constructor", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "constructor", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int", - "int", - "boolean" - ], - "parameterNames": [ - "name", - "path", - "frames", - "width", - "height", - "column", - "useColumns" - ], - "params": [ - "String name", - "String path", - "int frames", - "int width", - "int height", - "int column", - "boolean useColumns" - ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nIf the animation frames are arranged in either rows or columns in a sprite\nsheet, you can use this method to specify which column or row to use for the\nanimation. Take four frame animation arranged in a single column. Each frame is\n64x64 pixels. You can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64, 1, true); // use column 1\n```", + "returnType": "Camera", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A camera at (0, 0) with zoom 100. Every stage has its own: `getStage().getCamera()`.", + "description": "A camera at (0, 0) with zoom 100. Every stage has its own: `getStage().getCamera()`.", "scratchblock": null, - "paramDocs": [ - "name: the name of the animation", - "path: the path to the animation frames", - "frames: the number of frames in the animation", - "width: the width of each frame", - "height: the height of each frame", - "column: the column of the animation frames", - "useColumns: whether to use columns or rows" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt eine Animation aus einer Spalte des Bildes an" - } - } + "translations": {} }, { - "id": "AnimatedSprite/clone()", - "memberId": "AnimatedSprite/clone", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "clone", + "id": "Camera/getPosition()", + "memberId": "Camera/getPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getPosition", "static": false, - "returnType": "AnimatedSprite", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a clone of this sprite with the same animations, playing the same\none, and puts it on the stage right behind this sprite. See\n[Sprite.clone()](../Sprite/clone).", - "description": "Creates a clone of this sprite with the same animations, playing the same\none, and puts it on the stage right behind this sprite. See\n[Sprite.clone()](../Sprite/clone).", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the clone, of the same class as this sprite", + "returns": "the world position at the stage's centre", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/clone", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie dieser Figur" - } - } + "translations": {} }, { - "id": "AnimatedSprite/constructor()", - "memberId": "AnimatedSprite/constructor", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "constructor", + "id": "Camera/getX()", + "memberId": "Camera/getX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getX", "static": false, - "returnType": "AnimatedSprite", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.", - "description": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.\n\nExample usage:\n\n```java\nAnimatedSprite sprite = new AnimatedSprite();\nsprite.addCostume(\"idle\", \"assets/idle.png\");\nsprite.addAnimation(\"walk\", \"assets/walk_%d.png\", 4);\nsprite.playAnimation(\"walk\");\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the world x at the stage's centre", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine neue animierte Figur" - } - } - }, - { - "id": "AnimatedSprite/constructor(AnimatedSprite)", - "memberId": "AnimatedSprite/constructor", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "constructor", - "static": false, - "returnType": "AnimatedSprite", - "parameterTypes": [ - "org.openpatch.scratch.AnimatedSprite" - ], - "parameterNames": [ - "animatedSprite" - ], - "params": [ - "AnimatedSprite animatedSprite" - ], - "summary": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.", - "description": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.\n\nExample usage:\n\n```java\nAnimatedSprite sprite = new AnimatedSprite();\nsprite.addCostume(\"idle\", \"assets/idle.png\");\nsprite.addAnimation(\"walk\", \"assets/walk_%d.png\", 4);\nsprite.playAnimation(\"walk\");\n```", - "scratchblock": null, - "paramDocs": [ - "animatedSprite: " - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie der angegebenen animierten Figur" - } - } + "translations": {} }, { - "id": "AnimatedSprite/getAnimationFrame()", - "memberId": "AnimatedSprite/getAnimationFrame", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "getAnimationFrame", + "id": "Camera/getY()", + "memberId": "Camera/getY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getY", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the current animation frame.", - "description": "Gets the current animation frame.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the current animation frame", + "returns": "the world y at the stage's centre", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/getAnimationFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Nummer des aktuellen Einzelbildes zurück" - } - } + "translations": {} }, { - "id": "AnimatedSprite/getAnimationInterval()", - "memberId": "AnimatedSprite/getAnimationInterval", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "getAnimationInterval", + "id": "Camera/getZoom()", + "memberId": "Camera/getZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getZoom", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the interval between animation frames.", - "description": "Gets the interval between animation frames.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the interval between animation frames", + "returns": "the zoom in percent", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/getAnimationInterval", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt zurück, wie viele Millisekunden ein Einzelbild angezeigt wird" - } - } + "translations": {} }, { - "id": "AnimatedSprite/isAnimationPlayed()", - "memberId": "AnimatedSprite/isAnimationPlayed", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "isAnimationPlayed", + "id": "Camera/resetZoom()", + "memberId": "Camera/resetZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "resetZoom", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the animation is played.", - "description": "Checks if the animation is played.", + "summary": "Back to zoom 100.", + "description": "Back to zoom 100.", "scratchblock": null, "paramDocs": [], - "returns": "true if the animation is played, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/isAnimationPlayed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/resetZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn eine mit once gestartete Animation durchgelaufen ist" - } - } + "translations": {} }, { - "id": "AnimatedSprite/playAnimation(String)", - "memberId": "AnimatedSprite/playAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "playAnimation", + "id": "Camera/setPosition(double,double)", + "memberId": "Camera/setPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double" ], "parameterNames": [ - "name" + "x", + "y" ], "params": [ - "String name" + "double x", + "double y" ], - "summary": "Plays the animation with the specified name.", - "description": "Plays the animation with the specified name.", + "summary": "Centres the camera on a world position.", + "description": "Centres the camera on a world position.", "scratchblock": null, "paramDocs": [ - "name: the name of the animation to play" + "x: world x", + "y: world y" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/playAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Spielt die Animation in einer Schleife ab" - } - } + "translations": {} }, { - "id": "AnimatedSprite/playAnimation(String,boolean)", - "memberId": "AnimatedSprite/playAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "playAnimation", + "id": "Camera/setPosition(Vector2)", + "memberId": "Camera/setPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "boolean" + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "name", - "once" + "position" ], "params": [ - "String name", - "boolean once" + "Vector2 position" ], - "summary": "Plays the animation with the specified name.", - "description": "Plays the animation with the specified name.", + "summary": "Centres the camera on a world position.", + "description": "Centres the camera on a world position.", "scratchblock": null, "paramDocs": [ - "name: the name of the animation to play", - "once: whether to play the animation once" + "position: world position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/playAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Spielt die Animation ab; bei once == true nur ein einziges Mal" - } - } + "translations": {} }, { - "id": "AnimatedSprite/resetAnimation()", - "memberId": "AnimatedSprite/resetAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "resetAnimation", + "id": "Camera/setX(double)", + "memberId": "Camera/setX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setX", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Resets the animation. The animation will start from the first frame.", - "description": "Resets the animation. The animation will start from the first frame.", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "x" + ], + "params": [ + "double x" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "x: the world x to show at the stage's centre" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/resetAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Animation auf das erste Einzelbild zurück" - } - } + "translations": {} }, { - "id": "AnimatedSprite/setAnimationFrame(int)", - "memberId": "AnimatedSprite/setAnimationFrame", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "setAnimationFrame", + "id": "Camera/setY(double)", + "memberId": "Camera/setY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setY", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double" ], "parameterNames": [ - "frame" + "y" ], "params": [ - "int frame" + "double y" ], - "summary": "Sets the current animation frame.", - "description": "Sets the current animation frame.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "frame: the current animation frame" + "y: the world y to show at the stage's centre" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/setAnimationFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Springt zum Einzelbild mit der angegebenen Nummer" - } - } + "translations": {} }, { - "id": "AnimatedSprite/setAnimationInterval(int)", - "memberId": "AnimatedSprite/setAnimationInterval", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "setAnimationInterval", + "id": "Camera/setZoom(double)", + "memberId": "Camera/setZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setZoom", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double" ], "parameterNames": [ - "interval" + "zoom" ], "params": [ - "int interval" + "double zoom" ], - "summary": "Sets the interval between animation frames.", - "description": "Sets the interval between animation frames.", + "summary": "Sets the zoom in percent: 200 shows everything twice as large, 50 half as large. It stays\nwithin the zoom limits (50 to 200 unless changed).", + "description": "Sets the zoom in percent: 200 shows everything twice as large, 50 half as large. It stays\nwithin the zoom limits (50 to 200 unless changed).", "scratchblock": null, "paramDocs": [ - "interval: the interval between animation frames" + "zoom: the zoom in percent" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/setAnimationInterval", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt fest, wie viele Millisekunden ein Einzelbild angezeigt wird" - } - } + "translations": {} }, { - "id": "AnimatedSprite/toString()", - "memberId": "AnimatedSprite/toString", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "toString", + "id": "Camera/setZoomLimit(double,double)", + "memberId": "Camera/setZoomLimit", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setZoomLimit", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns which animation is playing and how far into it.", - "description": "Returns which animation is playing and how far into it.", + "returnType": "void", + "parameterTypes": [ + "double", + "double" + ], + "parameterNames": [ + "min", + "max" + ], + "params": [ + "double min", + "double max" + ], + "summary": "Limits the zoom.", + "description": "Limits the zoom.", "scratchblock": null, - "paramDocs": [], - "returns": "the sprite as a text", + "paramDocs": [ + "min: the smallest zoom in percent", + "max: the largest zoom in percent" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/toString", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setZoomLimit", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Figur als Zeichenkette zurück" - } - } + "translations": {} + }, + { + "id": "Camera/toScreenPosition(Vector2)", + "memberId": "Camera/toScreenPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toScreenPosition", + "static": false, + "returnType": "Vector2", + "parameterTypes": [ + "org.openpatch.scratch.Vector2" + ], + "parameterNames": [ + "world" + ], + "params": [ + "Vector2 world" + ], + "summary": "Where a world position shows on the stage.", + "description": "Where a world position shows on the stage.", + "scratchblock": null, + "paramDocs": [ + "world: a world position" + ], + "returns": "the screen position (origin at the stage's centre)", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toScreenPosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toScreenX(double)", + "memberId": "Camera/toScreenX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toScreenX", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "worldX" + ], + "params": [ + "double worldX" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "worldX: a world x" + ], + "returns": "where it shows on the stage", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toScreenX", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toScreenY(double)", + "memberId": "Camera/toScreenY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toScreenY", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "worldY" + ], + "params": [ + "double worldY" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "worldY: a world y" + ], + "returns": "where it shows on the stage", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toScreenY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toWorldPosition(Vector2)", + "memberId": "Camera/toWorldPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toWorldPosition", + "static": false, + "returnType": "Vector2", + "parameterTypes": [ + "org.openpatch.scratch.Vector2" + ], + "parameterNames": [ + "screen" + ], + "params": [ + "Vector2 screen" + ], + "summary": "Which world position shows at a place on the stage.", + "description": "Which world position shows at a place on the stage.", + "scratchblock": null, + "paramDocs": [ + "screen: a screen position (origin at the stage's centre)" + ], + "returns": "the world position", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toWorldPosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toWorldX(double)", + "memberId": "Camera/toWorldX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toWorldX", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "screenX" + ], + "params": [ + "double screenX" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "screenX: an x on the stage" + ], + "returns": "the world x shown there", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toWorldX", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toWorldY(double)", + "memberId": "Camera/toWorldY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toWorldY", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "screenY" + ], + "params": [ + "double screenY" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "screenY: a y on the stage" + ], + "returns": "the world y shown there", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toWorldY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} }, { "id": "Circle/constructor(double,double,double)", @@ -628,13 +616,13 @@ "double y", "double radius" ], - "summary": "Creates a circle with no specified position or size.", - "description": "Creates a circle with no specified position or size.", + "summary": "A circle.", + "description": "A circle.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate of the circle's center", - "y: the y-coordinate of the circle's center", - "radius: the radius of the circle" + "x: x of the centre", + "y: y of the centre", + "radius: the radius" ], "returns": null, "since": "", @@ -882,64 +870,88 @@ } }, { - "id": "Color/changeColor(double)", - "memberId": "Color/changeColor", + "id": "Color/constructor(double,double,double)", + "memberId": "Color/constructor", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "changeColor", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ + "double", + "double", "double" ], "parameterNames": [ - "h" + "red", + "green", + "blue" ], "params": [ - "double h" + "double red", + "double green", + "double blue" ], - "summary": "Changes the color accordining to a hue value, which is added to the current hue value. When the\nresulting value is greater than 255 it will be reset. For example: 285 => 30.", - "description": "Changes the color accordining to a hue value, which is added to the current hue value. When the\nresulting value is greater than 255 it will be reset. For example: 285 => 30.", + "summary": "A colour from red, green and blue, each from 0 to 255 (values outside are clamped). The\ncolour is opaque.", + "description": "A colour from red, green and blue, each from 0 to 255 (values outside are clamped). The\ncolour is opaque.", "scratchblock": null, "paramDocs": [ - "h: A hue value. Could be any positive or negative number." + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/changeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert den Farbton um den angegebenen Wert" + "description": "Erzeugt eine Farbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" } } }, { - "id": "Color/constructor()", + "id": "Color/constructor(double,double,double,double)", "memberId": "Color/constructor", "owner": "org.openpatch.scratch.Color", "className": "Color", "methodName": "constructor", "static": false, "returnType": "Color", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Constructs a new Color object with default values.", - "description": "Constructs a new Color object with default values.", + "parameterTypes": [ + "double", + "double", + "double", + "double" + ], + "parameterNames": [ + "red", + "green", + "blue", + "alpha" + ], + "params": [ + "double red", + "double green", + "double blue", + "double alpha" + ], + "summary": "A colour from red, green, blue and alpha, each from 0 to 255 (values outside are clamped).\nAn alpha of 0 is invisible, 255 opaque.", + "description": "A colour from red, green, blue and alpha, each from 0 to 255 (values outside are clamped).\nAn alpha of 0 is invisible, 255 opaque.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255", + "alpha: opacity from 0 to 255" + ], "returns": null, "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt die Farbe Weiß" - } - } + "translations": {} }, { "id": "Color/constructor(String)", @@ -953,16 +965,16 @@ "java.lang.String" ], "parameterNames": [ - "hexCode" + "hex" ], "params": [ - "String hexCode" + "String hex" ], - "summary": "The Color class represents a color in the Scratch environment. It supports various\nfunctionalities such as setting color values in the RGB and HSB spectrum, changing the color\nbased on a hue value, and converting between RGB and HSB color codes.", - "description": "The Color class represents a color in the Scratch environment. It supports various\nfunctionalities such as setting color values in the RGB and HSB spectrum, changing the color\nbased on a hue value, and converting between RGB and HSB color codes.", + "summary": "A colour from a hex code as in HTML and CSS: `\"#ff8000\"`, `\"ff8000\"`,\n`\"#f80\"`, or with alpha `\"#ff800080\"`.", + "description": "A colour from a hex code as in HTML and CSS: `\"#ff8000\"`, `\"ff8000\"`,\n`\"#f80\"`, or with alpha `\"#ff800080\"`.", "scratchblock": null, "paramDocs": [ - "hexCode: " + "hex: the hex code" ], "returns": null, "since": "", @@ -976,200 +988,176 @@ } }, { - "id": "Color/constructor(double)", - "memberId": "Color/constructor", + "id": "Color/equals(Object)", + "memberId": "Color/equals", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "constructor", + "methodName": "equals", "static": false, - "returnType": "Color", + "returnType": "boolean", "parameterTypes": [ - "double" + "java.lang.Object" ], "parameterNames": [ - "h" + "other" ], "params": [ - "double h" + "Object other" ], - "summary": "Constructs a new Color object with the specified hue value.", - "description": "Constructs a new Color object with the specified hue value.", + "summary": "Two colours are equal when they pack into the same ARGB number.", + "description": "Two colours are equal when they pack into the same ARGB number.", "scratchblock": null, "paramDocs": [ - "h: the hue value" + "other: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/equals", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Farbe mit dem angegebenen Farbton (0 bis 255)" + "description": "Prüft, ob es dieselbe Farbe ist" } } }, { - "id": "Color/constructor(double,double,double)", - "memberId": "Color/constructor", + "id": "Color/fromARGB(int)", + "memberId": "Color/fromARGB", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "constructor", - "static": false, + "methodName": "fromARGB", + "static": true, "returnType": "Color", "parameterTypes": [ - "double", - "double", - "double" + "int" ], "parameterNames": [ - "r", - "g", - "b" + "argb" ], "params": [ - "double r", - "double g", - "double b" + "int argb" ], - "summary": "Constructs a new Color object with the specified rgb values.", - "description": "Constructs a new Color object with the specified rgb values.", + "summary": "A colour from a packed ARGB number, as [toARGB()](toARGB) gives it.", + "description": "A colour from a packed ARGB number, as [toARGB()](toARGB) gives it.", "scratchblock": null, "paramDocs": [ - "r: the red value", - "g: the green value", - "b: the blue value" + "argb: alpha, red, green and blue in one int" ], - "returns": null, + "returns": "the colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/fromARGB", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Farbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/constructor(Color)", - "memberId": "Color/constructor", + "id": "Color/fromHSB(double,double,double)", + "memberId": "Color/fromHSB", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "constructor", - "static": false, + "methodName": "fromHSB", + "static": true, "returnType": "Color", "parameterTypes": [ - "org.openpatch.scratch.Color" + "double", + "double", + "double" ], "parameterNames": [ - "c" + "hue", + "saturation", + "brightness" ], "params": [ - "Color c" + "double hue", + "double saturation", + "double brightness" ], - "summary": "Copies the received ScratchColor object.", - "description": "Copies the received ScratchColor object.", + "summary": "A colour from Scratch's colour, saturation and brightness, each from 0 to 100. The colour\ngoes around (110 is the same as 10); saturation and brightness are clamped.", + "description": "A colour from Scratch's colour, saturation and brightness, each from 0 to 100. The colour\ngoes around (110 is the same as 10); saturation and brightness are clamped.", "scratchblock": null, "paramDocs": [ - "c: ScratchColor object to copy" + "hue: the colour from 0 to 100", + "saturation: from 0 (grey) to 100 (full colour)", + "brightness: from 0 (black) to 100 (full brightness)" ], - "returns": null, + "returns": "the colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/fromHSB", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie der übergebenen Farbe" - } - } + "translations": {} }, { - "id": "Color/equals(Object)", - "memberId": "Color/equals", + "id": "Color/getAlpha()", + "memberId": "Color/getAlpha", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "equals", + "methodName": "getAlpha", "static": false, - "returnType": "boolean", - "parameterTypes": [ - "java.lang.Object" - ], - "parameterNames": [ - "other" - ], - "params": [ - "Object other" - ], - "summary": "Two colours are the same when they are the same colour.", - "description": "Two colours are the same when they are the same colour.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "other: the object to compare with" - ], - "returns": "whether both are colours with the same red, green and blue", + "paramDocs": [], + "returns": "alpha (opacity) from 0 (invisible) to 255 (opaque)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/equals", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getAlpha", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Prüft, ob es dieselbe Farbe ist" - } - } + "translations": {} }, { - "id": "Color/get()", - "memberId": "Color/get", + "id": "Color/getBlue()", + "memberId": "Color/getBlue", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "get", + "methodName": "getBlue", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the color value as a hex code. This is useful for comparing pixels.", - "description": "Get the color value as a hex code. This is useful for comparing pixels.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "hex code", + "returns": "blue from 0 to 255", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/get", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getBlue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Farbe als ganze Zahl zurück" + "description": "Gibt den Blauanteil zurück (0 bis 255)" } } }, { - "id": "Color/getBlue()", - "memberId": "Color/getBlue", + "id": "Color/getBrightness()", + "memberId": "Color/getBrightness", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getBlue", + "methodName": "getBrightness", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the blue value.", - "description": "Get the blue value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "blue value [0...255]", + "returns": "brightness from 0 (black) to 100", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getBlue", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getBrightness", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Blauanteil zurück (0 bis 255)" - } - } + "translations": {} }, { "id": "Color/getGreen()", @@ -1182,11 +1170,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the green value.", - "description": "Get the green value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "green value [0...255]", + "returns": "green from 0 to 255", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getGreen", "availability": "implemented", @@ -1198,143 +1186,127 @@ } }, { - "id": "Color/getH()", - "memberId": "Color/getH", + "id": "Color/getHue()", + "memberId": "Color/getHue", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getH", + "methodName": "getHue", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the hue value.", - "description": "Get the hue value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "hue value [0...255]", + "returns": "Scratch's colour (hue) from 0 to 100; 0 for greys", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getH", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getHue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Farbton zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/getHSB()", - "memberId": "Color/getHSB", + "id": "Color/getRed()", + "memberId": "Color/getRed", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getHSB", + "methodName": "getRed", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the color value on the HSB spectrum.", - "description": "Get the color value on the HSB spectrum.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "hue value [0...255]", + "returns": "red from 0 to 255", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getHSB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getRed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Farbton zurück (0 bis 255)" + "description": "Gibt den Rotanteil zurück (0 bis 255)" } } }, { - "id": "Color/getL()", - "memberId": "Color/getL", + "id": "Color/getSaturation()", + "memberId": "Color/getSaturation", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getL", + "methodName": "getSaturation", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the luminosity value.", - "description": "Get the luminosity value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "luminosity value [0...255]", + "returns": "saturation from 0 (grey) to 100", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getL", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getSaturation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Helligkeit zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/getRed()", - "memberId": "Color/getRed", + "id": "Color/hashCode()", + "memberId": "Color/hashCode", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getRed", + "methodName": "hashCode", "static": false, - "returnType": "double", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the red value.", - "description": "Get the red value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "red value [0...255]", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getRed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/hashCode", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Rotanteil zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/getS()", - "memberId": "Color/getS", + "id": "Color/toARGB()", + "memberId": "Color/toARGB", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getS", + "methodName": "toARGB", "static": false, - "returnType": "double", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the saturation value.", - "description": "Get the saturation value.", + "summary": "The colour packed into one int as alpha, red, green and blue (8 bits each, rounded), the way\npixels are stored.", + "description": "The colour packed into one int as alpha, red, green and blue (8 bits each, rounded), the way\npixels are stored.", "scratchblock": null, "paramDocs": [], - "returns": "saturation value [0...255]", + "returns": "the packed colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getS", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/toARGB", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Sättigung zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/hashCode()", - "memberId": "Color/hashCode", + "id": "Color/toString()", + "memberId": "Color/toString", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "hashCode", + "methodName": "toString", "static": false, - "returnType": "int", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], @@ -1342,476 +1314,270 @@ "description": "", "scratchblock": null, "paramDocs": [], - "returns": "a hash consistent with [equals(Object)](equals)", + "returns": "`#rrggbb`, or `#rrggbbaa` when not opaque", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/hashCode", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/toString", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt die Farbe als Text aus" + } + } }, { - "id": "Color/setHSB(double)", - "memberId": "Color/setHSB", + "id": "Color/withAlpha(double)", + "memberId": "Color/withAlpha", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "setHSB", + "methodName": "withAlpha", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ "double" ], "parameterNames": [ - "h" + "alpha" ], "params": [ - "double h" + "double alpha" ], - "summary": "Setting the color value after the HSB spectrum. Saturation and Luminosity are fixed at 255.", - "description": "Setting the color value after the HSB spectrum. Saturation and Luminosity are fixed at 255.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "h: A hue value [0...255]" + "alpha: opacity from 0 to 255" ], - "returns": null, + "returns": "this colour with another alpha", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/setHSB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withAlpha", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt den Farbton (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/setHSB(double,double,double)", - "memberId": "Color/setHSB", + "id": "Color/withBlue(double)", + "memberId": "Color/withBlue", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "setHSB", + "methodName": "withBlue", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ - "double", - "double", "double" ], "parameterNames": [ - "h", - "s", - "l" + "blue" ], "params": [ - "double h", - "double s", - "double l" + "double blue" ], - "summary": "Setting the color value after the HSB spectrum.", - "description": "Setting the color value after the HSB spectrum.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "h: A hue value [0...255]", - "s: A saturation value [0...255]", - "l: A luminosity value [0...255]" + "blue: blue from 0 to 255" ], - "returns": null, + "returns": "this colour with another blue", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/setHSB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withBlue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt Farbton, Sättigung und Helligkeit (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/setRGB(double,double,double)", - "memberId": "Color/setRGB", + "id": "Color/withBrightness(double)", + "memberId": "Color/withBrightness", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "setRGB", + "methodName": "withBrightness", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ - "double", - "double", "double" ], "parameterNames": [ - "r", - "g", - "b" + "brightness" ], "params": [ - "double r", - "double g", - "double b" + "double brightness" ], - "summary": "Setting the color value after the RGB spectrum", - "description": "Setting the color value after the RGB spectrum", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "r: A red value [0...255]", - "g: A green value [0...255]", - "b: A blue value [0...255]" + "brightness: from 0 to 100" ], - "returns": null, + "returns": "this colour with another brightness", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/setRGB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withBrightness", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/toString()", - "memberId": "Color/toString", + "id": "Color/withGreen(double)", + "memberId": "Color/withGreen", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "toString", + "methodName": "withGreen", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "The colour written out, so that printing one says something.", - "description": "The colour written out, so that printing one says something.\n\nWithout this a `System.out.println(mySprite.getTint())` printed\n`org.openpatch.scratch.Color@35432107`, which tells you nothing about\nthe colour and is the first thing anyone tries when a tint looks wrong.", + "returnType": "Color", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "green" + ], + "params": [ + "double green" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], - "returns": "the colour as `Color[r=255.0, g=128.0, b=0.0]`", + "paramDocs": [ + "green: green from 0 to 255" + ], + "returns": "this colour with another green", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/toString", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withGreen", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Farbe als Text aus" - } - } + "translations": {} }, { - "id": "Ellipse/constructor(double,double,double,double)", - "memberId": "Ellipse/constructor", - "owner": "org.openpatch.scratch.Ellipse", - "className": "Ellipse", - "methodName": "constructor", + "id": "Color/withHue(double)", + "memberId": "Color/withHue", + "owner": "org.openpatch.scratch.Color", + "className": "Color", + "methodName": "withHue", "static": false, - "returnType": "Ellipse", + "returnType": "Color", "parameterTypes": [ - "double", - "double", - "double", "double" ], "parameterNames": [ - "x", - "y", - "width", - "height" + "hue" ], "params": [ - "double x", - "double y", - "double width", - "double height" + "double hue" ], - "summary": "Creates an ellipse with no specified position or size.", - "description": "Creates an ellipse with no specified position or size.", + "summary": "Another colour (hue), keeping saturation, brightness and alpha. The colour goes around, so\n`withHue(getHue() + 10)` works like Scratch's \"change color by 10\".", + "description": "Another colour (hue), keeping saturation, brightness and alpha. The colour goes around, so\n`withHue(getHue() + 10)` works like Scratch's \"change color by 10\".", "scratchblock": null, "paramDocs": [ - "x: ", - "y: ", - "width: ", - "height: " + "hue: the colour from 0 to 100" ], - "returns": null, + "returns": "this colour with another hue", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Ellipse/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withHue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Ellipse im angegebenen Rechteck" - } - } + "translations": {} }, { - "id": "Hitbox/constructor(Shape)", - "memberId": "Hitbox/constructor", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "constructor", + "id": "Color/withRed(double)", + "memberId": "Color/withRed", + "owner": "org.openpatch.scratch.Color", + "className": "Color", + "methodName": "withRed", "static": false, - "returnType": "Hitbox", + "returnType": "Color", "parameterTypes": [ - "org.openpatch.scratch.Shape" + "double" ], "parameterNames": [ - "shape" + "red" ], "params": [ - "Shape shape" + "double red" ], - "summary": "Constructs a hitbox with the specified shape.", - "description": "Constructs a hitbox with the specified shape.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "shape: The shape of the hitbox." + "red: red from 0 to 255" ], - "returns": null, + "returns": "this colour with another red", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withRed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt einen Umriss aus einer Form" - } - } + "translations": {} }, { - "id": "Hitbox/constructor(double[],double[])", - "memberId": "Hitbox/constructor", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "constructor", + "id": "Color/withSaturation(double)", + "memberId": "Color/withSaturation", + "owner": "org.openpatch.scratch.Color", + "className": "Color", + "methodName": "withSaturation", "static": false, - "returnType": "Hitbox", + "returnType": "Color", "parameterTypes": [ - "double[]", - "double[]" + "double" ], "parameterNames": [ - "xPoints", - "yPoints" + "saturation" ], "params": [ - "double[] xPoints", - "double[] yPoints" + "double saturation" ], - "summary": "Constructs a hitbox with the specified x and y points.", - "description": "Constructs a hitbox with the specified x and y points.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "xPoints: The x-coordinates of the points.", - "yPoints: The y-coordinates of the points." + "saturation: from 0 to 100" ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt einen Umriss aus x- und y-Koordinaten" - } - } - }, - { - "id": "Hitbox/contains(double,double)", - "memberId": "Hitbox/contains", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "contains", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "x", - "y" - ], - "params": [ - "double x", - "double y" - ], - "summary": "Checks if the hitbox contains a point.", - "description": "Checks if the hitbox contains a point.", - "scratchblock": null, - "paramDocs": [ - "x: The x-coordinate of the point.", - "y: The y-coordinate of the point." - ], - "returns": "`true` if the hitbox contains the point, `false`\n otherwise.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/contains", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Punkt im Umriss liegt" - } - } - }, - { - "id": "Hitbox/getBounds()", - "memberId": "Hitbox/getBounds", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "getBounds", - "static": false, - "returnType": "Bounds", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the smallest upright rectangle the hitbox fits into.", - "description": "Returns the smallest upright rectangle the hitbox fits into.", - "scratchblock": null, - "paramDocs": [], - "returns": "the bounding box of the hitbox", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/getBounds", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt das umschließende Rechteck zurück" - } - } - }, - { - "id": "Hitbox/getShape()", - "memberId": "Hitbox/getShape", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "getShape", - "static": false, - "returnType": "Shape", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shape of the hitbox.", - "description": "Returns the shape of the hitbox.", - "scratchblock": null, - "paramDocs": [], - "returns": "The shape of the hitbox.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/getShape", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Umriss als Form zurück" - } - } - }, - { - "id": "Hitbox/intersects(Hitbox)", - "memberId": "Hitbox/intersects", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "intersects", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Hitbox" - ], - "parameterNames": [ - "hitbox" - ], - "params": [ - "Hitbox hitbox" - ], - "summary": "Checks if the hitbox intersects with another hitbox.", - "description": "Checks if the hitbox intersects with another hitbox.", - "scratchblock": null, - "paramDocs": [ - "hitbox: The hitbox to check for intersection." - ], - "returns": "`true` if the hitboxes intersect, `false` otherwise.", + "returns": "this colour with another saturation", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/intersects", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withSaturation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn sich beide Umrisse überlappen" - } - } + "translations": {} }, { - "id": "Hitbox/translateAndRotateAndResize(double,double,double,double,double,double)", - "memberId": "Hitbox/translateAndRotateAndResize", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "translateAndRotateAndResize", + "id": "Ellipse/constructor(double,double,double,double)", + "memberId": "Ellipse/constructor", + "owner": "org.openpatch.scratch.Ellipse", + "className": "Ellipse", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "Ellipse", "parameterTypes": [ - "double", - "double", "double", "double", "double", "double" ], "parameterNames": [ - "degrees", - "originX", - "originY", - "translateX", - "translateY", - "size" + "x", + "y", + "width", + "height" ], "params": [ - "double degrees", - "double originX", - "double originY", - "double translateX", - "double translateY", - "double size" + "double x", + "double y", + "double width", + "double height" ], - "summary": "Transforms the shape by scaling, translating, and rotating it.", - "description": "Transforms the shape by scaling, translating, and rotating it.", + "summary": "An ellipse inside a rectangle along the axes.", + "description": "An ellipse inside a rectangle along the axes.", "scratchblock": null, "paramDocs": [ - "degrees: The angle in degrees to rotate the shape.", - "originX: The x-coordinate of the rotation origin.", - "originY: The y-coordinate of the rotation origin.", - "translateX: The x-coordinate to translate the shape.", - "translateY: The y-coordinate to translate the shape.", - "size: The size to scale the shape, where 100.0 represents the\n original size." + "x: the smallest x of the rectangle around it", + "y: the smallest y of the rectangle around it", + "width: the width", + "height: the height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/translateAndRotateAndResize", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Verschiebt, dreht und skaliert den Umriss" - } - } - }, - { - "id": "HtmlColor/constructor()", - "memberId": "HtmlColor/constructor", - "owner": "org.openpatch.scratch.HtmlColor", - "className": "HtmlColor", - "methodName": "constructor", - "static": false, - "returnType": "HtmlColor", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Provides predefined HTML colors as Color objects.", - "description": "Provides predefined HTML colors as Color objects.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/HtmlColor/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Ellipse/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt eine zufällige der benannten Farben zurück" + "description": "Erzeugt eine Ellipse im angegebenen Rechteck" } } }, @@ -2567,7 +2333,7 @@ ], "summary": "\"mod\" is an abbreviation for \"modulo\". Modulo returns what is left over when\nthe first input is divided by the second, with the sign of the second input,\nas the Scratch block does.", "description": "\"mod\" is an abbreviation for \"modulo\". Modulo returns what is left over when\nthe first input is divided by the second, with the sign of the second input,\nas the Scratch block does.", - "scratchblock": null, + "scratchblock": "((x) mod (y))", "paramDocs": [ "x: first value", "y: second value" @@ -2639,7 +2405,7 @@ ], "summary": "Rounds a number to a specified number of decimal places.", "description": "Rounds a number to a specified number of decimal places.", - "scratchblock": null, + "scratchblock": "(round (x))", "paramDocs": [ "x: a value", "precision: the number of decimal places to round to" @@ -2803,16 +2569,16 @@ "double" ], "parameterNames": [ - "c" + "by" ], "params": [ - "double c" + "double by" ], - "summary": "Change color via a hue value, which is added to the current hue value", - "description": "Change color via a hue value, which is added to the current hue value", + "summary": "", + "description": "", "scratchblock": "change pen [color v] by (c)", "paramDocs": [ - "c: a hue value [0...255]" + "by: how much to change the colour (hue, 0 to 100, going around)" ], "returns": null, "since": "", @@ -2837,16 +2603,16 @@ "double" ], "parameterNames": [ - "size" + "by" ], "params": [ - "double size" + "double by" ], - "summary": "Change the size of the pen", - "description": "Change the size of the pen", + "summary": "", + "description": "", "scratchblock": "change pen size by (size)", "paramDocs": [ - "size: size to change" + "by: how much to change the line width" ], "returns": null, "since": "", @@ -2871,16 +2637,16 @@ "double" ], "parameterNames": [ - "step" + "by" ], "params": [ - "double step" + "double by" ], - "summary": "Change the transparency by a step", - "description": "Change the transparency by a step", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "step: the step to change the transparency by" + "by: how much to change the transparency" ], "returns": null, "since": "", @@ -2904,8 +2670,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Pen object.", - "description": "Constructs a new Pen object.", + "summary": "A pen of your own, at (0, 0); add it to a stage with `stage.add(pen)`.", + "description": "A pen of your own, at (0, 0); add it to a stage with `stage.add(pen)`.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -2919,70 +2685,6 @@ } } }, - { - "id": "Pen/constructor(Sprite)", - "memberId": "Pen/constructor", - "owner": "org.openpatch.scratch.Pen", - "className": "Pen", - "methodName": "constructor", - "static": false, - "returnType": "Pen", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "s" - ], - "params": [ - "Sprite s" - ], - "summary": "Constructs a new Pen object associated with the given Sprite.", - "description": "Constructs a new Pen object associated with the given Sprite.", - "scratchblock": null, - "paramDocs": [ - "s: the Sprite object to associate with this Pen" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Senkt den Stift ab, so dass er beim Bewegen zeichnet" - } - } - }, - { - "id": "Pen/constructor(Pen)", - "memberId": "Pen/constructor", - "owner": "org.openpatch.scratch.Pen", - "className": "Pen", - "methodName": "constructor", - "static": false, - "returnType": "Pen", - "parameterTypes": [ - "org.openpatch.scratch.Pen" - ], - "parameterNames": [ - "p" - ], - "params": [ - "Pen p" - ], - "summary": "Copies a Pen object.", - "description": "Copies a Pen object.", - "scratchblock": null, - "paramDocs": [ - "p: Pen object to copy" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, { "id": "Pen/down()", "memberId": "Pen/down", @@ -2994,8 +2696,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Set the pen down.", - "description": "Set the pen down.", + "summary": "Puts the pen down: it leaves a dot, and a line wherever it moves.", + "description": "Puts the pen down: it leaves a dot, and a line wherever it moves.", "scratchblock": "pen down", "paramDocs": [], "returns": null, @@ -3016,8 +2718,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Erases all.", - "description": "Erases all.", + "summary": "Erases everything drawn on the pen's layer, by any pen or stamp.", + "description": "Erases everything drawn on the pen's layer, by any pen or stamp.", "scratchblock": "erase all", "paramDocs": [], "returns": null, @@ -3042,11 +2744,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current color of the pen.", - "description": "Retrieves the current color of the pen.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the color of the pen", + "returns": "the colour lines are drawn in", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getColor", "availability": "implemented", @@ -3058,83 +2760,97 @@ } }, { - "id": "Pen/getSize()", - "memberId": "Pen/getSize", + "id": "Pen/getLayer()", + "memberId": "Pen/getLayer", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "getSize", + "methodName": "getLayer", "static": false, - "returnType": "double", + "returnType": "Layer", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the size of the pen", - "description": "Returns the size of the pen", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the size of the pen", + "returns": "the layer whose canvas the pen draws on", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Strichstärke zurück" - } - } + "translations": {} }, { - "id": "Pen/goToBackground()", - "memberId": "Pen/goToBackground", + "id": "Pen/getPosition()", + "memberId": "Pen/getPosition", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "goToBackground", + "methodName": "getPosition", "static": false, - "returnType": "void", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Sets the pen to the background. This method changes the state of the pen to\nindicate that it is\nno longer in the foreground.", - "description": "Sets the pen to the background. This method changes the state of the pen to\nindicate that it is\nno longer in the foreground.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the pen's world position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/goToBackground", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zeichnet hinter den Figuren" - } - } + "translations": {} }, { - "id": "Pen/goToForeground()", - "memberId": "Pen/goToForeground", + "id": "Pen/getSize()", + "memberId": "Pen/getSize", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "goToForeground", + "methodName": "getSize", "static": false, - "returnType": "void", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves the pen to the foreground. This method sets the pen's state to indicate\nthat it is in the\nforeground.", - "description": "Moves the pen to the foreground. This method sets the pen's state to indicate\nthat it is in the\nforeground.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the line width in stage pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/goToForeground", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeichnet vor den Figuren" + "description": "Gibt die Strichstärke zurück" } } }, + { + "id": "Pen/getTransparency()", + "memberId": "Pen/getTransparency", + "owner": "org.openpatch.scratch.Pen", + "className": "Pen", + "methodName": "getTransparency", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the transparency in percent (0 opaque, 100 invisible)", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getTransparency", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Pen/goToMousePointer()", "memberId": "Pen/goToMousePointer", @@ -3146,8 +2862,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves the object to the current position of the mouse pointer.", - "description": "Moves the object to the current position of the mouse pointer.", + "summary": "Moves the pen to the mouse pointer, drawing if it is down.", + "description": "Moves the pen to the mouse pointer, drawing if it is down.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -3172,8 +2888,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves the object to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", - "description": "Moves the object to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", + "summary": "Moves the pen to a random position on the stage, drawing if it is down.", + "description": "Moves the pen to a random position on the stage, drawing if it is down.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -3188,30 +2904,26 @@ } }, { - "id": "Pen/isInBackground()", - "memberId": "Pen/isInBackground", + "id": "Pen/isDown()", + "memberId": "Pen/isDown", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "isInBackground", + "methodName": "isDown", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true if the pen is in the background.", - "description": "Returns true if the pen is in the background.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true if the pen is in the background", + "returns": "whether the pen is down and draws when it moves", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/isInBackground", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/isDown", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Stift hinter den Figuren zeichnet" - } - } + "translations": {} }, { "id": "Pen/setColor(Color)", @@ -3225,16 +2937,16 @@ "org.openpatch.scratch.Color" ], "parameterNames": [ - "c" + "color" ], "params": [ - "Color c" + "Color color" ], - "summary": "Set the color of the pen", - "description": "Set the color of the pen", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: color of the pen" + "color: the colour to draw lines in" ], "returns": null, "since": "", @@ -3259,16 +2971,16 @@ "double" ], "parameterNames": [ - "h" + "hue" ], "params": [ - "double h" + "double hue" ], - "summary": "Set color via hue value", - "description": "Set color via hue value", - "scratchblock": "set pen [color v] to (h)", + "summary": "Sets the colour by Scratch's colour number (hue) from 0 to 100, at full saturation and\nbrightness, like Scratch's \"set pen color to\".", + "description": "Sets the colour by Scratch's colour number (hue) from 0 to 100, at full saturation and\nbrightness, like Scratch's \"set pen color to\".", + "scratchblock": null, "paramDocs": [ - "h: a hue value [0...255]" + "hue: the colour from 0 to 100" ], "returns": null, "since": "", @@ -3295,22 +3007,22 @@ "double" ], "parameterNames": [ - "r", - "g", - "b" + "red", + "green", + "blue" ], "params": [ - "double r", - "double g", - "double b" + "double red", + "double green", + "double blue" ], - "summary": "Set color via rgb values", - "description": "Set color via rgb values", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", @@ -3323,6 +3035,36 @@ } } }, + { + "id": "Pen/setLayer(Layer)", + "memberId": "Pen/setLayer", + "owner": "org.openpatch.scratch.Pen", + "className": "Pen", + "methodName": "setLayer", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.Layer" + ], + "parameterNames": [ + "layer" + ], + "params": [ + "Layer layer" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "layer: the layer whose canvas the pen draws on" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/setLayer", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Pen/setPosition(double,double)", "memberId": "Pen/setPosition", @@ -3343,12 +3085,12 @@ "double x", "double y" ], - "summary": "Set the position if the pen is down.", - "description": "Set the position if the pen is down.", + "summary": "Moves the pen, drawing a line from where it was if it is down.", + "description": "Moves the pen, drawing a line from where it was if it is down.", "scratchblock": null, "paramDocs": [ - "x: x coordinate", - "y: y coordinate" + "x: world x", + "y: world y" ], "returns": null, "since": "", @@ -3373,16 +3115,16 @@ "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "v" + "position" ], "params": [ - "Vector2 v" + "Vector2 position" ], - "summary": "Sets the position of the pen using a Vector2 object.", - "description": "Sets the position of the pen using a Vector2 object.", + "summary": "Moves the pen, drawing a line from where it was if it is down.", + "description": "Moves the pen, drawing a line from where it was if it is down.", "scratchblock": null, "paramDocs": [ - "v: the Vector2 object containing the new x and y coordinates" + "position: world position" ], "returns": null, "since": "", @@ -3412,11 +3154,11 @@ "params": [ "double size" ], - "summary": "Set the size of the pen", - "description": "Set the size of the pen", + "summary": "", + "description": "", "scratchblock": "set pen size to (size)", "paramDocs": [ - "size: size of the pen" + "size: the line width in stage pixels (at least 1)" ], "returns": null, "since": "", @@ -3446,11 +3188,11 @@ "params": [ "double transparency" ], - "summary": "Set the transparency", - "description": "Set the transparency", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "transparency: transparency of the pen" + "transparency: in percent (0 opaque, 100 invisible)" ], "returns": null, "since": "", @@ -3474,8 +3216,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Stamps the current sprite onto the canvas. If the sprite is not null, it will\nstamp either to\nthe foreground or the background based on the value of the isForeground flag.", - "description": "Stamps the current sprite onto the canvas. If the sprite is not null, it will\nstamp either to\nthe foreground or the background based on the value of the isForeground flag.", + "summary": "Stamps the pen's sprite onto the pen's layer, like Scratch's \"stamp\" block.", + "description": "Stamps the pen's sprite onto the pen's layer, like Scratch's \"stamp\" block.", "scratchblock": "stamp", "paramDocs": [], "returns": null, @@ -3500,8 +3242,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Move the pen up.", - "description": "Move the pen up.", + "summary": "Lifts the pen: it no longer draws.", + "description": "Lifts the pen: it no longer draws.", "scratchblock": "pen up", "paramDocs": [], "returns": null, @@ -3515,6 +3257,178 @@ } } }, + { + "id": "Pixels/getArgb(int,int)", + "memberId": "Pixels/getArgb", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getArgb", + "static": false, + "returnType": "int", + "parameterTypes": [ + "int", + "int" + ], + "parameterNames": [ + "x", + "y" + ], + "params": [ + "int x", + "int y" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "x: pixels from the left edge", + "y: pixels from the top edge" + ], + "returns": "the colour there packed as alpha, red, green, blue, or 0 outside", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getArgb", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/getColor(int,int)", + "memberId": "Pixels/getColor", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getColor", + "static": false, + "returnType": "Color", + "parameterTypes": [ + "int", + "int" + ], + "parameterNames": [ + "x", + "y" + ], + "params": [ + "int x", + "int y" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "x: pixels from the left edge", + "y: pixels from the top edge" + ], + "returns": "the colour there, or transparent black outside", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getColor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/getHeight()", + "memberId": "Pixels/getHeight", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getHeight", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the height in pixels", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getHeight", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/getWidth()", + "memberId": "Pixels/getWidth", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getWidth", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the width in pixels", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getWidth", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/of(Stage)", + "memberId": "Pixels/of", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "of", + "static": true, + "returnType": "Pixels", + "parameterTypes": [ + "org.openpatch.scratch.Stage" + ], + "parameterNames": [ + "stage" + ], + "params": [ + "Stage stage" + ], + "summary": "The stage's pixels as they are now.", + "description": "The stage's pixels as they are now.", + "scratchblock": null, + "paramDocs": [ + "stage: the stage" + ], + "returns": "its pixels, at stage size", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/of", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/of(String)", + "memberId": "Pixels/of", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "of", + "static": true, + "returnType": "Pixels", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "imagePath" + ], + "params": [ + "String imagePath" + ], + "summary": "The pixels of an image file.", + "description": "The pixels of an image file.", + "scratchblock": null, + "paramDocs": [ + "imagePath: the image" + ], + "returns": "its pixels", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/of", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Polygon/addPoint(double,double)", "memberId": "Polygon/addPoint", @@ -3535,12 +3449,12 @@ "double x", "double y" ], - "summary": "Adds a point to the polygon.", - "description": "Adds a point to the polygon.", + "summary": "Adds a corner after the last one.", + "description": "Adds a corner after the last one.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate", - "y: the y-coordinate" + "x: x of the corner", + "y: y of the corner" ], "returns": null, "since": "", @@ -3564,8 +3478,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates an empty polygon.", - "description": "Creates an empty polygon.", + "summary": "A polygon without corners yet; add them with [addPoint(double, double)](addPoint).", + "description": "A polygon without corners yet; add them with [addPoint(double, double)](addPoint).", "scratchblock": null, "paramDocs": [], "returns": null, @@ -3599,12 +3513,12 @@ "double[] xPoints", "double[] yPoints" ], - "summary": "Creates a polygon with the specified vertices.", - "description": "Creates a polygon with the specified vertices.", + "summary": "A polygon given by its corners, concave ones included. The outline closes by itself.", + "description": "A polygon given by its corners, concave ones included. The outline closes by itself.", "scratchblock": null, "paramDocs": [ - "xPoints: an array of x-coordinates", - "yPoints: an array of y-coordinates" + "xPoints: x of every corner", + "yPoints: y of every corner, in the same order" ], "returns": null, "since": "", @@ -4099,14 +4013,14 @@ "double width", "double height" ], - "summary": "Creates a rectangle with the specified position and size.", - "description": "Creates a rectangle with the specified position and size.", + "summary": "A rectangle along the axes.", + "description": "A rectangle along the axes.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate of the rectangle's top-left corner", - "y: the y-coordinate of the rectangle's top-left corner", - "width: the width of the rectangle", - "height: the height of the rectangle" + "x: the smallest x", + "y: the smallest y", + "width: the width", + "height: the height" ], "returns": null, "since": "", @@ -4120,1085 +4034,1995 @@ } }, { - "id": "Shape/contains(double,double)", - "memberId": "Shape/contains", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "contains", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "x", - "y" - ], - "params": [ - "double x", - "double y" - ], - "summary": "Check if the shape contains a point defined by its x and y coordinates.", - "description": "Check if the shape contains a point defined by its x and y coordinates.", - "scratchblock": null, - "paramDocs": [ - "x: the x-coordinate of the point", - "y: the y-coordinate of the point" - ], - "returns": "true if the shape contains the point, false otherwise", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/contains", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Punkt in der Form liegt" - } - } - }, - { - "id": "Shape/getBounds()", - "memberId": "Shape/getBounds", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "getBounds", + "id": "Shader/getName()", + "memberId": "Shader/getName", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "getName", "static": false, - "returnType": "Bounds", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the bounds of the shape.", - "description": "Get the bounds of the shape.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "a Bounds object representing the bounding box of the shape", + "returns": "the shader's name", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/getBounds", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/getName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt das umschließende Rechteck zurück" - } - } + "translations": {} }, { - "id": "Shape/intersects(Shape)", - "memberId": "Shape/intersects", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "intersects", + "id": "Shader/set(String,double)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Shape" + "java.lang.String", + "double" ], "parameterNames": [ - "other" + "uniform", + "value" ], "params": [ - "Shape other" + "String uniform", + "double value" ], - "summary": "Check if the shape intersects with another shape.", - "description": "Check if the shape intersects with another shape.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "other: the other shape to check intersection with" + "uniform: the uniform's name in the shader", + "value: an `int` or `float` uniform's value" ], - "returns": "true if the shapes intersect, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/intersects", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn sich beide Formen überlappen" - } - } + "translations": {} }, { - "id": "Shape/rotate(double,double,double)", - "memberId": "Shape/rotate", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "rotate", + "id": "Shader/set(String,int)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "Shape", + "returnType": "void", "parameterTypes": [ - "double", - "double", - "double" + "java.lang.String", + "int" ], "parameterNames": [ - "theta", - "anchorX", - "anchorY" + "uniform", + "value" ], "params": [ - "double theta", - "double anchorX", - "double anchorY" + "String uniform", + "int value" ], - "summary": "Rotate the shape by the specified angle around a given anchor point.", - "description": "Rotate the shape by the specified angle around a given anchor point.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "theta: the angle in degrees to rotate", - "anchorX: the x-coordinate of the anchor point", - "anchorY: the y-coordinate of the anchor point" + "uniform: the uniform's name", + "value: an `int` uniform's value" ], - "returns": "a new Shape object that is rotated", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/rotate", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die um theta Grad gedrehte Form als neue Form zurück" - } - } + "translations": {} }, { - "id": "Shape/scale(double,double)", - "memberId": "Shape/scale", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "scale", + "id": "Shader/set(String,boolean)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "Shape", + "returnType": "void", "parameterTypes": [ - "double", - "double" + "java.lang.String", + "boolean" ], "parameterNames": [ - "scaleX", - "scaleY" + "uniform", + "value" ], "params": [ - "double scaleX", - "double scaleY" + "String uniform", + "boolean value" ], - "summary": "Check if the shape is empty.", - "description": "Check if the shape is empty.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "scaleX: ", - "scaleY: " + "uniform: the uniform's name", + "value: a `bool` uniform's value" ], - "returns": "true if the shape is empty, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/scale", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die skalierte Form als neue Form zurück" - } - } + "translations": {} }, { - "id": "Shape/translate(double,double)", - "memberId": "Shape/translate", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "translate", + "id": "Shader/set(String,double,double)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "Shape", + "returnType": "void", "parameterTypes": [ + "java.lang.String", "double", "double" ], "parameterNames": [ - "dx", - "dy" + "uniform", + "x", + "y" ], "params": [ - "double dx", - "double dy" + "String uniform", + "double x", + "double y" ], - "summary": "Translate the shape by the specified distances in the x and y directions.", - "description": "Translate the shape by the specified distances in the x and y directions.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "dx: the distance to translate in the x direction", - "dy: the distance to translate in the y direction" + "uniform: the uniform's name", + "x: a `vec2`'s x", + "y: a `vec2`'s y" ], - "returns": "a new Shape object that is translated", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/translate", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die verschobene Form als neue Form zurück" - } - } + "translations": {} }, { - "id": "Sprite/addCostume(String)", - "memberId": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostume", + "id": "Shader/set(String,Vector2)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "name" + "uniform", + "value" ], "params": [ - "String name" + "String uniform", + "Vector2 value" ], - "summary": "Add one of the costumes that ship with Scratch for Java to the sprite. The\ncostume gets the same name as the built-in sprite. If a costume with that\nname already exists do nothing.", - "description": "Add one of the costumes that ship with Scratch for Java to the sprite. The\ncostume gets the same name as the built-in sprite. If a costume with that\nname already exists do nothing.\n\nExample usage:\n\n```java\nthis.addCostume(\"bunny1_jump\");\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of a built-in sprite, for example \"bunny1_jump\". Add\n the sheet in front of the name, for example\n \"platformer/grass\", if the same name exists on several sheets." + "uniform: the uniform's name", + "value: a `vec2`" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt eines der eingebauten Kostüme hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addCostume(String,String)", - "memberId": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostume", + "id": "Shader/set(String,Color)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "name", - "imagePath" + "uniform", + "color" ], "params": [ - "String name", - "String imagePath" + "String uniform", + "Color color" ], - "summary": "Add a costume to the sprite. If a costume with the received name already\nexists do nothing.", - "description": "Add a costume to the sprite. If a costume with the received name already\nexists do nothing.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: a unique name", - "imagePath: a image path, or the name of a built-in sprite such as\n \"bunny1_jump\"" + "uniform: the uniform's name", + "color: a `vec4`: red, green, blue and alpha from 0 to 1" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt ein Kostüm unter eigenem Namen hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addCostume(String,String,int,int,int,int)", - "memberId": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostume", + "id": "Shader/set(String,double[],int)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "int", - "int", - "int", + "double[]", "int" ], "parameterNames": [ - "name", - "spriteSheetPath", - "x", - "y", - "width", - "height" + "uniform", + "values", + "perElement" ], "params": [ - "String name", - "String spriteSheetPath", - "int x", - "int y", - "int width", - "int height" + "String uniform", + "double[] values", + "int perElement" ], - "summary": "Adds a new costume to the sprite if a costume with the same name does not\nalready exist.", - "description": "Adds a new costume to the sprite if a costume with the same name does not\nalready exist.", + "summary": "An array uniform such as `uniform vec3 lights[100];`.", + "description": "An array uniform such as `uniform vec3 lights[100];`.", "scratchblock": null, "paramDocs": [ - "name: The name of the costume.", - "spriteSheetPath: The path to the sprite sheet image file.", - "x: The x-coordinate of the top-left corner of the costume\n in the sprite sheet.", - "y: The y-coordinate of the top-left corner of the costume\n in the sprite sheet.", - "width: The width of the costume in the sprite sheet.", - "height: The height of the costume in the sprite sheet." + "uniform: the uniform's name", + "values: all values, one element after the other", + "perElement: values per element: 1 for `float[]`, 3 for `vec3[]`" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schneidet ein Kostüm aus einem Bild aus" - } - } + "translations": {} }, { - "id": "Sprite/addCostumes(String,String,int,int)", - "memberId": "Sprite/addCostumes", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostumes", + "id": "Shader/setName(String)", + "memberId": "Shader/setName", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "setName", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "prefix", - "spriteSheet", - "tileWidth", - "tileHeight" + "name" ], "params": [ - "String prefix", - "String spriteSheet", - "int tileWidth", - "int tileHeight" + "String name" ], - "summary": "Adds all tiles from a spritesheet as costumes. The costumes will be name by\nthe prefix and the\nindex in the spritesheet. For example if the prefix is \"tile\" and the\nspritesheet contains 4\ntiles, the costumes will be named \"tile0\", \"tile1\", \"tile2\", and \"tile3\".", - "description": "Adds all tiles from a spritesheet as costumes. The costumes will be name by\nthe prefix and the\nindex in the spritesheet. For example if the prefix is \"tile\" and the\nspritesheet contains 4\ntiles, the costumes will be named \"tile0\", \"tile1\", \"tile2\", and \"tile3\".", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "prefix: a prefix for all generated costumes", - "spriteSheet: a path to a sprite sheet, or the name of a built-in sprite", - "tileWidth: the width of a single tile", - "tileHeight: the height of a single tile" + "name: a new name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostumes", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/setName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zerschneidet ein Bild in gleich große Kacheln und fügt sie als Kostüme hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addSound(String,String)", - "memberId": "Sprite/addSound", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addSound", + "id": "Shaders/activate(String)", + "memberId": "Shaders/activate", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "activate", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", "java.lang.String" ], "parameterNames": [ - "name", - "soundPath" + "name" ], "params": [ - "String name", - "String soundPath" + "String name" ], - "summary": "Add a sound to the sprite. If a sound with the received name already exists\ndo nothing.", - "description": "Add a sound to the sprite. If a sound with the received name already exists\ndo nothing.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: a unique name", - "soundPath: a sound path, or the name of a built-in sound such as\n \"footstep_carpet_000\"" + "name: a shader to use in addition to the active ones" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/activate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt einen Klang unter eigenem Namen hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addSound(String)", - "memberId": "Sprite/addSound", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addSound", + "id": "Shaders/add(String,String)", + "memberId": "Shaders/add", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "add", "static": false, - "returnType": "void", + "returnType": "Shader", "parameterTypes": [ + "java.lang.String", "java.lang.String" ], "parameterNames": [ - "name" + "name", + "fragmentPath" ], "params": [ - "String name" + "String name", + "String fragmentPath" ], - "summary": "Add one of the sounds that ship with Scratch for Java to the sprite. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.", - "description": "Add one of the sounds that ship with Scratch for Java to the sprite. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.\n\nExample usage:\n\n```java\nthis.addSound(\"footstep_carpet_000\");\n```", + "summary": "Adds a shader, or returns the one of that name added before.", + "description": "Adds a shader, or returns the one of that name added before.", "scratchblock": null, "paramDocs": [ - "name: the name of a built-in sound, for example \"footstep_carpet_000\"" + "name: the shader's name", + "fragmentPath: the file with the shader's body" ], - "returns": null, + "returns": "the shader, to set its uniforms", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt einen der eingebauten Klänge hinzu" - } - } + "translations": {} }, { - "id": "Sprite/ask(String)", - "memberId": "Sprite/ask", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "ask", + "id": "Shaders/deactivate(String)", + "memberId": "Shaders/deactivate", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "deactivate", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "question" + "name" ], "params": [ - "String question" + "String name" ], - "summary": "Asks a question and waits for an answer to be typed in. The question appears\nat the top of the stage.", - "description": "Asks a question and waits for an answer to be typed in. The question appears\nat the top of the stage.\n\nUnlike Scratch, this does not pause the sprite. `run()` keeps being called\nwhile the question is on screen, so check [isAsking()](isAsking) or wait for\n[getAnswer()](getAnswer) to change.", - "scratchblock": "ask [question] and wait", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "question: the question to show" + "name: a shader to stop using" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ask", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/deactivate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" - } - } + "translations": {} }, { - "id": "Sprite/broadcast(String)", - "memberId": "Sprite/broadcast", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "broadcast", + "id": "Shaders/get(String)", + "memberId": "Shaders/get", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "get", "static": false, - "returnType": "void", + "returnType": "Shader", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "message" + "name" ], "params": [ - "String message" + "String name" ], - "summary": "Broadcasts a message to every sprite on the stage, this one included, and\nto the stage itself, as in Scratch. If the sprite is not on a stage, nothing\nhappens.", - "description": "Broadcasts a message to every sprite on the stage, this one included, and\nto the stage itself, as in Scratch. If the sprite is not on a stage, nothing\nhappens.", - "scratchblock": "broadcast [message v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "message: The message to broadcast." + "name: a shader's name" ], - "returns": null, + "returns": "the shader, or null", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/broadcast", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/get", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Sendet eine Nachricht an alle Figuren und die Bühne" - } - } + "translations": {} }, { - "id": "Sprite/changePosition(Vector2)", - "memberId": "Sprite/changePosition", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changePosition", + "id": "Shaders/getActive()", + "memberId": "Shaders/getActive", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getActive", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Vector2" - ], - "parameterNames": [ - "v" - ], - "params": [ - "Vector2 v" - ], - "summary": "Changes the position of the sprite by a given vector.", - "description": "Changes the position of the sprite by a given vector.", + "returnType": "List", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "v: a vector representing the change in position" - ], - "returns": null, + "paramDocs": [], + "returns": "the shaders in use, in order", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getActive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Verschiebt die Figur um den angegebenen Vektor" - } - } + "translations": {} }, { - "id": "Sprite/changePosition(double,double)", - "memberId": "Sprite/changePosition", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changePosition", + "id": "Shaders/getCurrent()", + "memberId": "Shaders/getCurrent", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getCurrent", "static": false, - "returnType": "void", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "x", - "y" - ], - "params": [ - "double x", - "double y" - ], - "summary": "Changes the position of the sprite by the given amounts.", - "description": "Changes the position of the sprite by the given amounts.", + "returnType": "Shader", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "x: how far to move along the x-axis", - "y: how far to move along the y-axis" - ], - "returns": null, + "paramDocs": [], + "returns": "the first shader in use, or null", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getCurrent", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Verschiebt die Figur um die angegebenen Werte" - } - } + "translations": {} }, { - "id": "Sprite/changeSize(double)", - "memberId": "Sprite/changeSize", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeSize", + "id": "Shaders/getCurrentIndex()", + "memberId": "Shaders/getCurrentIndex", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getCurrentIndex", "static": false, - "returnType": "void", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the number of the first shader in use, or -1", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getCurrentIndex", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Shaders/getCurrentName()", + "memberId": "Shaders/getCurrentName", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getCurrentName", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the name of the first shader in use, or null", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getCurrentName", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Shaders/isActive(String)", + "memberId": "Shaders/isActive", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "isActive", + "static": false, + "returnType": "boolean", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "amount" + "name" ], "params": [ - "double amount" + "String name" ], - "summary": "Changes the size of the sprite by a given percentage.", - "description": "Changes the size of the sprite by a given percentage.", - "scratchblock": "change size by (amount)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "amount: a percentage [0...100]" + "name: a shader's name" ], - "returns": null, + "returns": "whether it is in use", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/isActive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Größe um den angegebenen Wert in Prozent" - } - } + "translations": {} }, { - "id": "Sprite/changeTint(double)", - "memberId": "Sprite/changeTint", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeTint", + "id": "Shaders/next()", + "memberId": "Shaders/next", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "next", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "step" - ], - "params": [ - "double step" - ], - "summary": "Changes the tint for the sprite by a step.", - "description": "Changes the tint for the sprite by a step.", - "scratchblock": "change [color v] effect by (step)", - "paramDocs": [ - "step: a step value" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Uses the next shader alone.", + "description": "Uses the next shader alone.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/next", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert den Farbton der Einfärbung um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeTransparency(double)", - "memberId": "Sprite/changeTransparency", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeTransparency", + "id": "Shaders/reset()", + "memberId": "Shaders/reset", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "reset", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "step" - ], - "params": [ - "double step" - ], - "summary": "Changes how see-through the sprite is by a step. A positive step fades it\nout, a negative one brings it back.", - "description": "Changes how see-through the sprite is by a step. A positive step fades it\nout, a negative one brings it back.", - "scratchblock": "change [ghost v] effect by (step)", - "paramDocs": [ - "step: a step value" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Uses no shader.", + "description": "Uses no shader.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/reset", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Transparenz um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeVolume(double)", - "memberId": "Sprite/changeVolume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeVolume", + "id": "Shaders/switchTo(String)", + "memberId": "Shaders/switchTo", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "switchTo", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "step" + "name" ], "params": [ - "double step" + "String name" ], - "summary": "Makes every sound of this sprite louder or quieter.", - "description": "Makes every sound of this sprite louder or quieter.", - "scratchblock": "change volume by (step)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "step: how much to add to the volume, in percent" + "name: the shader to use, alone" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/switchTo", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Lautstärke um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeX(double)", - "memberId": "Sprite/changeX", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeX", + "id": "Shaders/switchTo(double)", + "memberId": "Shaders/switchTo", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "switchTo", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "x" + "index" ], "params": [ - "double x" + "double index" ], - "summary": "Changes x by a certain amount", - "description": "Changes x by a certain amount", - "scratchblock": "change x by (x)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "x: number in pixels" + "index: the shader to use alone, counting from 0; wraps around" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/switchTo", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die x-Position um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeY(double)", - "memberId": "Sprite/changeY", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeY", + "id": "Shape/contains(double,double)", + "memberId": "Shape/contains", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "contains", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ + "double", "double" ], "parameterNames": [ + "x", "y" ], "params": [ + "double x", "double y" ], - "summary": "Changes y by a certain amount", - "description": "Changes y by a certain amount", - "scratchblock": "change y by (y)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "y: number in pixels" + "x: x of a point", + "y: y of a point" ], - "returns": null, + "returns": "whether the point lies inside the shape", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/contains", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert die y-Position um den angegebenen Wert" + "description": "Gibt genau dann true zurück, wenn der Punkt in der Form liegt" } } }, { - "id": "Sprite/clone()", - "memberId": "Sprite/clone", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "clone", + "id": "Shape/getBounds()", + "memberId": "Shape/getBounds", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "getBounds", "static": false, - "returnType": "Sprite", + "returnType": "Bounds", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a clone of this sprite, like Scratch's \"create clone of myself\": a\nnew sprite of the same class (a clone of a `Cat` is a `Cat`),\nwith the same costume, position, direction, size and pen, and a copy of\nthe variables of your class. It is put on the stage right behind this\nsprite, and its [whenStartsAsClone()](whenStartsAsClone) runs; the constructor does\nnot run again.", - "description": "Creates a clone of this sprite, like Scratch's \"create clone of myself\": a\nnew sprite of the same class (a clone of a `Cat` is a `Cat`),\nwith the same costume, position, direction, size and pen, and a copy of\nthe variables of your class. It is put on the stage right behind this\nsprite, and its [whenStartsAsClone()](whenStartsAsClone) runs; the constructor does\nnot run again.\n\nNumbers, text and booleans in your variables are the clone's own. A list\nor another object is shared with the original: give the clone its own in\n[whenStartsAsClone()](whenStartsAsClone) if it needs one.\n\n```java\nBullet bullet = (Bullet) this.clone();\n```", - "scratchblock": "create clone of [myself v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "the clone, of the same class as this sprite", + "returns": "the smallest rectangle around the shape", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/clone", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/getBounds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt das umschließende Rechteck zurück" + } + } }, { - "id": "Sprite/constructor()", - "memberId": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "constructor", + "id": "Shape/getPoints()", + "memberId": "Shape/getPoints", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "getPoints", "static": false, - "returnType": "Sprite", + "returnType": "double[]", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Sprite object with default settings.", - "description": "Constructs a new Sprite object with default settings.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the outline's points `x0, y0, x1, y1, \\u2026` (a copy)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/getPoints", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Shape/intersects(Shape)", + "memberId": "Shape/intersects", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "intersects", + "static": false, + "returnType": "boolean", + "parameterTypes": [ + "org.openpatch.scratch.Shape" + ], + "parameterNames": [ + "other" + ], + "params": [ + "Shape other" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "other: another shape" + ], + "returns": "whether the two shapes overlap with some area; shapes that only touch do not", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/intersects", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine neue Figur" + "description": "Gibt genau dann true zurück, wenn sich beide Formen überlappen" } } }, { - "id": "Sprite/constructor(String,String)", - "memberId": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "constructor", + "id": "Shape/rotate(double,double,double)", + "memberId": "Shape/rotate", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "rotate", "static": false, - "returnType": "Sprite", + "returnType": "Shape", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "double", + "double", + "double" ], "parameterNames": [ - "name", - "imagePath" + "degrees", + "anchorX", + "anchorY" ], "params": [ - "String name", - "String imagePath" + "double degrees", + "double anchorX", + "double anchorY" ], - "summary": "Constructs a new Sprite object with a specified costume.", - "description": "Constructs a new Sprite object with a specified costume.", + "summary": "Turns the shape about a point, from the x axis towards the y axis (anticlockwise when y points\nup).", + "description": "Turns the shape about a point, from the x axis towards the y axis (anticlockwise when y points\nup).", "scratchblock": null, "paramDocs": [ - "name: a unique name for the costume", - "imagePath: a path to an image file, or the name of a built-in sprite\n such as \"slimeGreen\"" + "degrees: the angle", + "anchorX: x of the point to turn about", + "anchorY: y of the point to turn about" ], - "returns": null, + "returns": "the shape turned", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/rotate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Figur mit einem ersten Kostüm" + "description": "Gibt die um theta Grad gedrehte Form als neue Form zurück" } } }, { - "id": "Sprite/constructor(Sprite)", - "memberId": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "constructor", + "id": "Shape/scale(double,double)", + "memberId": "Shape/scale", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "scale", "static": false, - "returnType": "Sprite", + "returnType": "Shape", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "double", + "double" ], "parameterNames": [ - "s" + "scaleX", + "scaleY" ], "params": [ - "Sprite s" + "double scaleX", + "double scaleY" ], - "summary": "Copies a Sprite object.", - "description": "Copies a Sprite object.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "s: a Sprite object to copy" + "scaleX: factor along x (negative mirrors)", + "scaleY: factor along y" ], - "returns": null, + "returns": "the shape scaled about the origin", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/scale", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Kopie der angegebenen Figur" + "description": "Gibt die skalierte Form als neue Form zurück" } } }, { - "id": "Sprite/debug(Object[])", - "memberId": "Sprite/debug", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "debug", + "id": "Shape/translate(double,double)", + "memberId": "Shape/translate", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "translate", "static": false, - "returnType": "void", + "returnType": "Shape", "parameterTypes": [ - "java.lang.Object[]" + "double", + "double" ], "parameterNames": [ - "values" + "dx", + "dy" ], "params": [ - "Object[] values" + "double dx", + "double dy" ], - "summary": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the sprite's class name so you can tell\nwhich sprite it came from.", - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the sprite's class name so you can tell\nwhich sprite it came from.\n\nExample:\n\n```java\nthis.debug(\"x =\", getX(), \"y =\", getY());\n// prints: [CatSprite] x = 100.0 y = 200.0\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "values: one or more values to print" + "dx: distance along x", + "dy: distance along y" ], - "returns": null, + "returns": "the shape moved", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/debug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/translate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt die verschobene Form als neue Form zurück" + } + } }, { - "id": "Sprite/deleteThisClone()", - "memberId": "Sprite/deleteThisClone", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "deleteThisClone", + "id": "SoundPlayback/isPlaying()", + "memberId": "SoundPlayback/isPlaying", + "owner": "org.openpatch.scratch.SoundPlayback", + "className": "SoundPlayback", + "methodName": "isPlaying", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes this sprite from the stage if it is a clone, like Scratch's\n\"delete this clone\". The original stays.", - "description": "Removes this sprite from the stage if it is a clone, like Scratch's\n\"delete this clone\". The original stays.", - "scratchblock": "delete this clone", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether this copy still plays", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/deleteThisClone", + "docsUrl": "https://scratch4j.openpatch.org/reference/SoundPlayback/isPlaying", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Sprite/disableHitbox()", - "memberId": "Sprite/disableHitbox", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "disableHitbox", + "id": "SoundPlayback/setVolume(double)", + "memberId": "SoundPlayback/setVolume", + "owner": "org.openpatch.scratch.SoundPlayback", + "className": "SoundPlayback", + "methodName": "setVolume", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Disables the hitbox for the sprite. Once the hitbox is disabled, the sprite\nwill no longer\ndetect collisions with other objects.", - "description": "Disables the hitbox for the sprite. Once the hitbox is disabled, the sprite\nwill no longer\ndetect collisions with other objects.", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "volume" + ], + "params": [ + "double volume" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "volume: from 0 to 100" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/disableHitbox", + "docsUrl": "https://scratch4j.openpatch.org/reference/SoundPlayback/setVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schaltet die Berührungserkennung aus" - } - } + "translations": {} }, { - "id": "Sprite/distanceToMousePointer()", - "memberId": "Sprite/distanceToMousePointer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "distanceToMousePointer", + "id": "SoundPlayback/stop()", + "memberId": "SoundPlayback/stop", + "owner": "org.openpatch.scratch.SoundPlayback", + "className": "SoundPlayback", + "methodName": "stop", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Calculates the distance from the current sprite to the mouse pointer.", - "description": "Calculates the distance from the current sprite to the mouse pointer.", - "scratchblock": "(distance to [mouse-pointer v])", + "summary": "Stops this copy.", + "description": "Stops this copy.", + "scratchblock": null, "paramDocs": [], - "returns": "the distance to the mouse pointer as a double.", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToMousePointer", + "docsUrl": "https://scratch4j.openpatch.org/reference/SoundPlayback/stop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Abstand zum Mauszeiger zurück" - } - } + "translations": {} }, { - "id": "Sprite/distanceToSprite(Sprite)", - "memberId": "Sprite/distanceToSprite", + "id": "Sprite/addAnimation(String,String,int)", + "memberId": "Sprite/addAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "distanceToSprite", + "methodName": "addAnimation", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "java.lang.String", + "java.lang.String", + "int" ], "parameterNames": [ - "sprite" + "name", + "pattern", + "frames" ], "params": [ - "Sprite sprite" + "String name", + "String pattern", + "int frames" ], - "summary": "Calculates the Euclidean distance between this sprite and another sprite.", - "description": "Calculates the Euclidean distance between this sprite and another sprite.", - "scratchblock": "(distance to [sprite v])", + "summary": "Adds an animation from numbered image files: the pattern's `%d` counts from 1.", + "description": "Adds an animation from numbered image files: the pattern's `%d` counts from 1.\n\n```java\nthis.addAnimation(\"walk\", \"assets/walk%d.png\", 4); // walk1.png \\u2026 walk4.png\n```", + "scratchblock": null, "paramDocs": [ - "sprite: the other sprite to which the distance is calculated" + "name: the animation's name", + "pattern: the file names, with `%d` for the frame number", + "frames: how many frames" ], - "returns": "the distance between this sprite and the specified sprite", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addAnimation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Abstand zu einer anderen Figur zurück" - } - } + "translations": {} }, { - "id": "Sprite/enableHitbox()", - "memberId": "Sprite/enableHitbox", + "id": "Sprite/addAnimation(String,String,int,int)", + "memberId": "Sprite/addAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "enableHitbox", + "methodName": "addAnimation", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Enables the hitbox for the sprite. This method sets the hitboxDisabled flag\nto false, allowing\nthe sprite to interact with other objects.", - "description": "Enables the hitbox for the sprite. This method sets the hitboxDisabled flag\nto false, allowing\nthe sprite to interact with other objects.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/enableHitbox", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int" + ], + "parameterNames": [ + "name", + "pattern", + "from", + "to" + ], + "params": [ + "String name", + "String pattern", + "int from", + "int to" + ], + "summary": "Adds an animation from numbered image files, from one number to another: for files that count\nfrom 0, or to use only some of them. If `to` is smaller than `from`, it counts down.", + "description": "Adds an animation from numbered image files, from one number to another: for files that count\nfrom 0, or to use only some of them. If `to` is smaller than `from`, it counts down.\n\n```java\nthis.addAnimation(\"hit\", \"assets/hit%d.png\", 0, 4); // hit0.png \\u2026 hit4.png\n```", + "scratchblock": null, + "paramDocs": [ + "name: the animation's name", + "pattern: the file names, with `%d` for the frame number", + "from: the number of the first frame", + "to: the number of the last frame" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addAnimation", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/addAnimation(String,String,int,int,int[])", + "memberId": "Sprite/addAnimation", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addAnimation", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int", + "int[]" + ], + "parameterNames": [ + "name", + "sheetPath", + "width", + "height", + "frames" + ], + "params": [ + "String name", + "String sheetPath", + "int width", + "int height", + "int[] frames" + ], + "summary": "Adds an animation from a sprite sheet: frames of equal size, numbered row by row from the\ntop left, starting at 0.", + "description": "Adds an animation from a sprite sheet: frames of equal size, numbered row by row from the\ntop left, starting at 0.\n\n```java\nthis.addAnimation(\"walk\", \"assets/walk.png\", 32, 32, 0, 1, 2, 3); // the first row\nthis.addAnimation(\"down\", \"assets/hero.png\", 32, 32, 0, 4, 8, 12); // the first column of 4\n```", + "scratchblock": null, + "paramDocs": [ + "name: the animation's name", + "sheetPath: the sprite sheet", + "width: the width of a frame", + "height: the height of a frame", + "frames: the frames to show, in order" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addAnimation", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/addCostume(String,String)", + "memberId": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "imagePath" + ], + "params": [ + "String name", + "String imagePath" + ], + "summary": "Adds a costume from an image file. The first costume added is the one the sprite wears.", + "description": "Adds a costume from an image file. The first costume added is the one the sprite wears.", + "scratchblock": null, + "paramDocs": [ + "name: the costume's name, for [switchCostume(String)](switchCostume)", + "imagePath: the image file (PNG, JPEG, GIF, BMP or TGA)" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt ein Kostüm unter eigenem Namen hinzu" + } + } + }, + { + "id": "Sprite/addCostume(String)", + "memberId": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "imagePath" + ], + "params": [ + "String imagePath" + ], + "summary": "Adds a costume from an image file, named after the file.", + "description": "Adds a costume from an image file, named after the file.", + "scratchblock": null, + "paramDocs": [ + "imagePath: the image file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt eines der eingebauten Kostüme hinzu" + } + } + }, + { + "id": "Sprite/addCostume(String,String,int,int,int,int)", + "memberId": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int", + "int", + "int" + ], + "parameterNames": [ + "name", + "imagePath", + "x", + "y", + "width", + "height" + ], + "params": [ + "String name", + "String imagePath", + "int x", + "int y", + "int width", + "int height" + ], + "summary": "Adds a costume cut out of a larger image, e.g. one frame of a sprite sheet.", + "description": "Adds a costume cut out of a larger image, e.g. one frame of a sprite sheet.", + "scratchblock": null, + "paramDocs": [ + "name: the costume's name", + "imagePath: the image file", + "x: left edge of the part, in pixels", + "y: top edge of the part, in pixels", + "width: width of the part", + "height: height of the part" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Schneidet ein Kostüm aus einem Bild aus" + } + } + }, + { + "id": "Sprite/addCostumes(String,String,int,int)", + "memberId": "Sprite/addCostumes", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostumes", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int" + ], + "parameterNames": [ + "name", + "imagePath", + "width", + "height" + ], + "params": [ + "String name", + "String imagePath", + "int width", + "int height" + ], + "summary": "Adds every frame of a sprite sheet as a costume, row by row, named `name0`,\n`name1`, \\u2026", + "description": "Adds every frame of a sprite sheet as a costume, row by row, named `name0`,\n`name1`, \\u2026", + "scratchblock": null, + "paramDocs": [ + "name: the start of the costumes' names", + "imagePath: the image file", + "width: width of one frame", + "height: height of one frame" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostumes", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Zerschneidet ein Bild in gleich große Kacheln und fügt sie als Kostüme hinzu" + } + } + }, + { + "id": "Sprite/addSound(String,String)", + "memberId": "Sprite/addSound", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addSound", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "soundPath" + ], + "params": [ + "String name", + "String soundPath" + ], + "summary": "Adds a sound (WAV or OGG).", + "description": "Adds a sound (WAV or OGG).", + "scratchblock": null, + "paramDocs": [ + "name: the sound's name, for [playSound(String)](playSound)", + "soundPath: the sound file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt einen Klang unter eigenem Namen hinzu" + } + } + }, + { + "id": "Sprite/addSound(String)", + "memberId": "Sprite/addSound", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addSound", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "soundPath" + ], + "params": [ + "String soundPath" + ], + "summary": "Adds a sound, named after its file.", + "description": "Adds a sound, named after its file.", + "scratchblock": null, + "paramDocs": [ + "soundPath: the sound file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt einen der eingebauten Klänge hinzu" + } + } + }, + { + "id": "Sprite/ask(String)", + "memberId": "Sprite/ask", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "ask", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "question" + ], + "params": [ + "String question" + ], + "summary": "Asks a question: the sprite says it in a bubble, and a box to type the answer in appears at\nthe bottom of the stage. Enter finishes it; see [Stage.ask(String)](../Stage/ask).", + "description": "Asks a question: the sprite says it in a bubble, and a box to type the answer in appears at\nthe bottom of the stage. Enter finishes it; see [Stage.ask(String)](../Stage/ask).", + "scratchblock": "ask [question] and wait", + "paramDocs": [ + "question: the question" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ask", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" + } + } + }, + { + "id": "Sprite/broadcast(String)", + "memberId": "Sprite/broadcast", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "broadcast", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "message" + ], + "params": [ + "String message" + ], + "summary": "Sends a message to the stage and every sprite on it; their [whenIReceive(String)](whenIReceive)\nruns at once, before this method returns.", + "description": "Sends a message to the stage and every sprite on it; their [whenIReceive(String)](whenIReceive)\nruns at once, before this method returns.", + "scratchblock": "broadcast [message v]", + "paramDocs": [ + "message: the message" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/broadcast", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Sendet eine Nachricht an alle Figuren und die Bühne" + } + } + }, + { + "id": "Sprite/changeColorEffect(double)", + "memberId": "Sprite/changeColorEffect", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeColorEffect", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [color v] effect by (by)", + "paramDocs": [ + "by: how much to change the colour effect" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeColorEffect", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/changeHeight(double)", + "memberId": "Sprite/changeHeight", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeHeight", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "by: how much higher to draw the sprite" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeHeight", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/changePosition(double,double)", + "memberId": "Sprite/changePosition", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changePosition", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double", + "double" + ], + "parameterNames": [ + "dx", + "dy" + ], + "params": [ + "double dx", + "double dy" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "dx: how far to move along x", + "dy: how far to move along y" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Verschiebt die Figur um die angegebenen Werte" + } + } + }, + { + "id": "Sprite/changePosition(Vector2)", + "memberId": "Sprite/changePosition", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changePosition", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.Vector2" + ], + "parameterNames": [ + "by" + ], + "params": [ + "Vector2 by" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "by: how far to move" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Verschiebt die Figur um den angegebenen Vektor" + } + } + }, + { + "id": "Sprite/changeSize(double)", + "memberId": "Sprite/changeSize", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeSize", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "percent" + ], + "params": [ + "double percent" + ], + "summary": "", + "description": "", + "scratchblock": "change size by (amount)", + "paramDocs": [ + "percent: how much to change the size, in percentage points" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeSize", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die Größe um den angegebenen Wert in Prozent" + } + } + }, + { + "id": "Sprite/changeTransparency(double)", + "memberId": "Sprite/changeTransparency", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeTransparency", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [ghost v] effect by (step)", + "paramDocs": [ + "by: how much to change the transparency" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeTransparency", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die Transparenz um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/changeVolume(double)", + "memberId": "Sprite/changeVolume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeVolume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change volume by (step)", + "paramDocs": [ + "by: how much to change the volume" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeVolume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die Lautstärke um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/changeWidth(double)", + "memberId": "Sprite/changeWidth", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeWidth", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "by: how much wider to draw the sprite" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeWidth", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/changeX(double)", + "memberId": "Sprite/changeX", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeX", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "dx" + ], + "params": [ + "double dx" + ], + "summary": "", + "description": "", + "scratchblock": "change x by (x)", + "paramDocs": [ + "dx: how far to move along x" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeX", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die x-Position um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/changeY(double)", + "memberId": "Sprite/changeY", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeY", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "dy" + ], + "params": [ + "double dy" + ], + "summary": "", + "description": "", + "scratchblock": "change y by (y)", + "paramDocs": [ + "dy: how far to move along y" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die y-Position um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/constructor()", + "memberId": "Sprite/constructor", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "constructor", + "static": false, + "returnType": "Sprite", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A sprite without costumes. Add some with [addCostume(String, String)](addCostume).", + "description": "A sprite without costumes. Add some with [addCostume(String, String)](addCostume).", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Erzeugt eine neue Figur" + } + } + }, + { + "id": "Sprite/constructor(String,String)", + "memberId": "Sprite/constructor", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "constructor", + "static": false, + "returnType": "Sprite", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "imagePath" + ], + "params": [ + "String name", + "String imagePath" + ], + "summary": "A sprite with one costume.", + "description": "A sprite with one costume.", + "scratchblock": null, + "paramDocs": [ + "name: the costume's name", + "imagePath: the image file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Erzeugt eine Figur mit einem ersten Kostüm" + } + } + }, + { + "id": "Sprite/createClone()", + "memberId": "Sprite/createClone", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "createClone", + "static": false, + "returnType": "T", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Makes a clone: a copy of this sprite with the same costumes, position, direction, effects and\nvariables, added to the stage just behind this sprite, as in Scratch. Its\n[whenStartsAsClone()](whenStartsAsClone) runs;\nits constructor does not. Numbers, texts and booleans in its variables are its own; lists and\nother objects are shared with this sprite until the clone gets its own in\n[whenStartsAsClone()](whenStartsAsClone).", + "description": "Makes a clone: a copy of this sprite with the same costumes, position, direction, effects and\nvariables, added to the stage just behind this sprite, as in Scratch. Its\n[whenStartsAsClone()](whenStartsAsClone) runs;\nits constructor does not. Numbers, texts and booleans in its variables are its own; lists and\nother objects are shared with this sprite until the clone gets its own in\n[whenStartsAsClone()](whenStartsAsClone).\n\n```java\nBullet bullet = this.createClone();\n```", + "scratchblock": null, + "paramDocs": [], + "returns": "the clone", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/createClone", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/debug(Object[])", + "memberId": "Sprite/debug", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "debug", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.Object[]" + ], + "parameterNames": [ + "values" + ], + "params": [ + "Object[] values" + ], + "summary": "Prints values for debugging, but only while debug mode is on (`window.setDebug(true)`\nor F12).", + "description": "Prints values for debugging, but only while debug mode is on (`window.setDebug(true)`\nor F12).", + "scratchblock": null, + "paramDocs": [ + "values: what to print" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/debug", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/deleteThisClone()", + "memberId": "Sprite/deleteThisClone", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "deleteThisClone", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Removes this sprite if it is a clone, stopping its sounds; does nothing for the original.", + "description": "Removes this sprite if it is a clone, stopping its sounds; does nothing for the original.", + "scratchblock": "delete this clone", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/deleteThisClone", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/disableHitbox()", + "memberId": "Sprite/disableHitbox", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "disableHitbox", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Touching ignores this sprite until [enableHitbox()](enableHitbox).", + "description": "Touching ignores this sprite until [enableHitbox()](enableHitbox).", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/disableHitbox", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Schaltet die Berührungserkennung aus" + } + } + }, + { + "id": "Sprite/disableNineSlice()", + "memberId": "Sprite/disableNineSlice", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "disableNineSlice", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Stretches the whole costume again.", + "description": "Stretches the whole costume again.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/disableNineSlice", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/distanceToMousePointer()", + "memberId": "Sprite/distanceToMousePointer", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "distanceToMousePointer", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(distance to [mouse-pointer v])", + "paramDocs": [], + "returns": "the distance to the mouse pointer", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToMousePointer", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Gibt den Abstand zum Mauszeiger zurück" + } + } + }, + { + "id": "Sprite/distanceToSprite(Sprite)", + "memberId": "Sprite/distanceToSprite", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "distanceToSprite", + "static": false, + "returnType": "double", + "parameterTypes": [ + "org.openpatch.scratch.Sprite" + ], + "parameterNames": [ + "sprite" + ], + "params": [ + "Sprite sprite" + ], + "summary": "", + "description": "", + "scratchblock": "(distance to [sprite v])", + "paramDocs": [ + "sprite: another sprite" + ], + "returns": "the distance between the two positions", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToSprite", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Gibt den Abstand zu einer anderen Figur zurück" + } + } + }, + { + "id": "Sprite/enableHitbox()", + "memberId": "Sprite/enableHitbox", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "enableHitbox", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Touching counts this sprite again.", + "description": "Touching counts this sprite again.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/enableHitbox", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { @@ -5207,6 +6031,84 @@ } } }, + { + "id": "Sprite/extension(Class,Supplier)", + "memberId": "Sprite/extension", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "extension", + "static": false, + "returnType": "T", + "parameterTypes": [ + "java.lang.Class", + "java.util.function.Supplier" + ], + "parameterNames": [ + "type", + "factory" + ], + "params": [ + "Class type", + "Supplier factory" + ], + "summary": "An extension's state for this sprite, made on first use; a clone gets its own. For\nextensions, not for learner code.", + "description": "An extension's state for this sprite, made on first use; a clone gets its own. For\nextensions, not for learner code.", + "scratchblock": null, + "paramDocs": [ + "type: the state's class", + "factory: makes it" + ], + "returns": "the sprite's one instance", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/extension", + "availability": "desktop-only", + "availabilityReason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others.", + "translations": {} + }, + { + "id": "Sprite/getAnimationFrame()", + "memberId": "Sprite/getAnimationFrame", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getAnimationFrame", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the frame of the current animation, counting from 0", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getAnimationFrame", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/getAnimationInterval()", + "memberId": "Sprite/getAnimationInterval", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getAnimationInterval", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "how long each frame shows, in seconds", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getAnimationInterval", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Sprite/getAnswer()", "memberId": "Sprite/getAnswer", @@ -5218,11 +6120,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the last answer that was typed in.", - "description": "Returns the last answer that was typed in.", + "summary": "", + "description": "", "scratchblock": "(answer)", "paramDocs": [], - "returns": "the answer, or an empty string if nothing has been answered yet", + "returns": "the answer to the last question", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getAnswer", "availability": "implemented", @@ -5233,6 +6135,28 @@ } } }, + { + "id": "Sprite/getColorEffect()", + "memberId": "Sprite/getColorEffect", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getColorEffect", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the colour effect", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getColorEffect", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Sprite/getCurrentCostumeIndex()", "memberId": "Sprite/getCurrentCostumeIndex", @@ -5244,11 +6168,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current costume index", - "description": "Returns the current costume index", + "summary": "", + "description": "", "scratchblock": "(costume [number v])", "paramDocs": [], - "returns": "a costume index", + "returns": "the current costume's number, counting from 0", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getCurrentCostumeIndex", "availability": "implemented", @@ -5270,11 +6194,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current costume name", - "description": "Returns the current costume name", + "summary": "", + "description": "", "scratchblock": "(costume [name v])", "paramDocs": [], - "returns": "a costume name", + "returns": "the current costume's name, or null without costumes", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getCurrentCostumeName", "availability": "implemented", @@ -5285,32 +6209,6 @@ } } }, - { - "id": "Sprite/getDeltaTime()", - "memberId": "Sprite/getDeltaTime", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "getDeltaTime", - "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Gets the seconds passed since the last frame.", - "description": "Gets the seconds passed since the last frame.", - "scratchblock": null, - "paramDocs": [], - "returns": "seconds since last frame", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getDeltaTime", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" - } - } - }, { "id": "Sprite/getDirection()", "memberId": "Sprite/getDirection", @@ -5322,11 +6220,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the direction of the sprite.", - "description": "Returns the direction of the sprite.", + "summary": "", + "description": "", "scratchblock": "(direction)", "paramDocs": [], - "returns": "the direction [0...360]", + "returns": "the direction, from 0 (inclusive) to 360 (exclusive); 90 is right", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getDirection", "availability": "implemented", @@ -5344,15 +6242,15 @@ "className": "Sprite", "methodName": "getHeight", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the height of the current costume or the pen size, when no costume is\navailable.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the height of the sprite", + "returns": "the height the sprite is drawn at, in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getHeight", "availability": "implemented", @@ -5370,15 +6268,15 @@ "className": "Sprite", "methodName": "getHitbox", "static": false, - "returnType": "Hitbox", + "returnType": "Shape", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the hitbox of the sprite based on its current costume, position, and\nrotation. If the\nsprite has a hitbox already defined, it updates and returns it. Otherwise, it\ncalculates a new\nhitbox based on the sprite's dimensions and rotation.", - "description": "Returns the hitbox of the sprite based on its current costume, position, and\nrotation. If the\nsprite has a hitbox already defined, it updates and returns it. Otherwise, it\ncalculates a new\nhitbox based on the sprite's dimensions and rotation.", + "summary": "The hitbox where the sprite is now, in stage coordinates: by default the rectangle around the\ncostume's painted pixels; null for a sprite without costumes.", + "description": "The hitbox where the sprite is now, in stage coordinates: by default the rectangle around the\ncostume's painted pixels; null for a sprite without costumes.", "scratchblock": null, "paramDocs": [], - "returns": "the hitbox of the sprite", + "returns": "the hitbox, or null", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getHitbox", "availability": "implemented", @@ -5389,6 +6287,28 @@ } } }, + { + "id": "Sprite/getLayer()", + "memberId": "Sprite/getLayer", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getLayer", + "static": false, + "returnType": "Layer", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the sprite's layer", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getLayer", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Sprite/getMouse()", "memberId": "Sprite/getMouse", @@ -5400,11 +6320,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current position of the mouse cursor.", - "description": "Retrieves the current position of the mouse cursor.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "a Vector2 object representing the current mouse cursor position, with\n the x-coordinate\n obtained from getMouseX() and the y-coordinate obtained from\n getMouseY().", + "returns": "the mouse pointer's position, in world coordinates (or stage coordinates for UI)", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getMouse", "availability": "implemented", @@ -5426,11 +6346,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current x-position of the mouse cursor", - "description": "Returns the current x-position of the mouse cursor", + "summary": "", + "description": "", "scratchblock": "(mouse x)", "paramDocs": [], - "returns": "x-position", + "returns": "x of the mouse pointer, in the sprite's coordinates (world, or the stage for UI)", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getMouseX", "availability": "implemented", @@ -5452,11 +6372,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current y-position of the mouse cursor", - "description": "Returns the current y-position of the mouse cursor", + "summary": "", + "description": "", "scratchblock": "(mouse y)", "paramDocs": [], - "returns": "y-position", + "returns": "y of the mouse pointer", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getMouseY", "availability": "implemented", @@ -5478,11 +6398,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pen of the sprite.", - "description": "Returns the pen of the sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the sprite's pen, which follows it", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getPen", "availability": "implemented", @@ -5504,20 +6424,42 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current position of the sprite.", - "description": "Retrieves the current position of the sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "A [Vector2](../Vector2/index) object representing the x and y coordinates of the\n sprite.", + "returns": "the sprite's position", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Position der Figur zurück" - } - } + "translations": { + "de": { + "description": "Gibt die Position der Figur zurück" + } + } + }, + { + "id": "Sprite/getRotationStyle()", + "memberId": "Sprite/getRotationStyle", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getRotationStyle", + "static": false, + "returnType": "RotationStyle", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "how the costume follows the direction", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getRotationStyle", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} }, { "id": "Sprite/getShaders()", @@ -5530,11 +6472,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the shaders of this sprite. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.", - "description": "Returns the shaders of this sprite. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.\n\nExample usage:\n\n```java\nthis.getShaders().add(\"blur\", \"blur.frag\", null);\nthis.getShaders().switchTo(\"blur\");\n```\n\nA sprite draws with one shader: with several active, the first of them.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the shaders", + "returns": "the sprite's shaders", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getShaders", "availability": "implemented", @@ -5556,11 +6498,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the size of the sprite.", - "description": "Returns the size of the sprite.", + "summary": "", + "description": "", "scratchblock": "(size)", "paramDocs": [], - "returns": "size in percentage", + "returns": "the size in percent of the costume's own size", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getSize", "availability": "implemented", @@ -5582,11 +6524,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current stage associated with this sprite.", - "description": "Retrieves the current stage associated with this sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the stage associated with this sprite", + "returns": "the stage the sprite is on, or null", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getStage", "availability": "implemented", @@ -5608,11 +6550,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the text associated with this sprite.", - "description": "Retrieves the text associated with this sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the text associated with this sprite", + "returns": "the sprite's text, which say and think show in a bubble", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getText", "availability": "implemented", @@ -5634,11 +6576,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the default timer", - "description": "Return the default timer", + "summary": "", + "description": "", "scratchblock": "(timer)", "paramDocs": [], - "returns": "the default timer", + "returns": "this object's timer, counting game time since it was made or reset", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTimer", "availability": "implemented", @@ -5649,40 +6591,6 @@ } } }, - { - "id": "Sprite/getTimer(String)", - "memberId": "Sprite/getTimer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "getTimer", - "static": false, - "returnType": "Timer", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Return a timer by name", - "description": "Return a timer by name", - "scratchblock": null, - "paramDocs": [ - "name: " - ], - "returns": "a timer", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTimer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Timer mit dem angegebenen Namen zurück und legt ihn bei Bedarf an" - } - } - }, { "id": "Sprite/getTint()", "memberId": "Sprite/getTint", @@ -5694,11 +6602,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the tint value of the current costume.", - "description": "Retrieves the tint value of the current costume.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the tint value of the current costume, or null if there are no\n costumes.", + "returns": "the tint, or null for none", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTint", "availability": "implemented", @@ -5721,18 +6629,18 @@ "java.lang.Class" ], "parameterNames": [ - "c" + "type" ], "params": [ - "Class c" + "Class type" ], - "summary": "Returns the first sprite of the specified type that is currently touching\nthis sprite.", - "description": "Returns the first sprite of the specified type that is currently touching\nthis sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: the class object of the type of sprite to check for" + "type: a class of sprites" ], - "returns": "the first sprite of the specified type that is touching this sprite,\n or null if no such\n sprite is found", + "returns": "a sprite of that class the sprite touches, or null", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTouchingSprite", "availability": "implemented", @@ -5755,18 +6663,18 @@ "java.lang.Class" ], "parameterNames": [ - "c" + "type" ], "params": [ - "Class c" + "Class type" ], - "summary": "Returns a list of sprites of the specified type that are currently touching\nthis sprite.", - "description": "Returns a list of sprites of the specified type that are currently touching\nthis sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: the class of the type of sprites to return" + "type: a class of sprites" ], - "returns": "a list of sprites of the specified type that are touching this\n sprite, or null if the\n stage is not set", + "returns": "every sprite of that class the sprite touches", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTouchingSprites", "availability": "implemented", @@ -5788,11 +6696,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the transparency of the current costume.", - "description": "Gets the transparency of the current costume.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "how see-through the sprite is, 0 solid and 100 invisible", + "returns": "the transparency in percent", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTransparency", "availability": "implemented", @@ -5814,11 +6722,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns how loud the sounds of this sprite play.", - "description": "Returns how loud the sounds of this sprite play.", + "summary": "", + "description": "", "scratchblock": "(volume)", "paramDocs": [], - "returns": "the volume, from 0 to 100", + "returns": "this object's volume from 0 to 100", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getVolume", "availability": "implemented", @@ -5836,15 +6744,15 @@ "className": "Sprite", "methodName": "getWidth", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the width of the current costume or the pen size, when no costume is\navailable.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the width of the sprite", + "returns": "the width the sprite is drawn at, in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getWidth", "availability": "implemented", @@ -5866,11 +6774,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the x coordinate of the sprite", - "description": "Returns the x coordinate of the sprite", + "summary": "", + "description": "", "scratchblock": "(x position)", "paramDocs": [], - "returns": "a x coordinate", + "returns": "x of the sprite's position", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getX", "availability": "implemented", @@ -5892,11 +6800,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the y coordinate of the sprite", - "description": "Returns the y coordinate of the sprite", + "summary": "", + "description": "", "scratchblock": "(y position)", "paramDocs": [], - "returns": "a y coordinate", + "returns": "y of the sprite's position", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getY", "availability": "implemented", @@ -5928,499 +6836,267 @@ "params": [ "double seconds", "double x", - "double y" - ], - "summary": "Slides the sprite to a place over the given time, instead of jumping there.", - "description": "Slides the sprite to a place over the given time, instead of jumping there.\n\nUnlike Scratch this does not hold up the sprite: `run()` keeps being called\nwhile the sprite is on its way. Use [isGliding()](isGliding) to tell whether it\nhas arrived.", - "scratchblock": "glide (seconds) secs to x: (x) y: (y)", - "paramDocs": [ - "seconds: how long the trip should take", - "x: where to end up", - "y: where to end up" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/glide", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gleitet in der angegebenen Zeit zur Zielposition" - } - } - }, - { - "id": "Sprite/goLayersBackwards(int)", - "memberId": "Sprite/goLayersBackwards", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goLayersBackwards", - "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the sprite backwards by a specified number of layers in the stage. If\nthe sprite is not\npart of a stage, the method does nothing.", - "description": "Moves the sprite backwards by a specified number of layers in the stage. If\nthe sprite is not\npart of a stage, the method does nothing.", - "scratchblock": "go [backward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the sprite backwards" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersBackwards", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schiebt die Figur um die angegebene Anzahl Ebenen nach hinten" - } - } - }, - { - "id": "Sprite/goLayersForwards(int)", - "memberId": "Sprite/goLayersForwards", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goLayersForwards", - "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the sprite forward by a specified number of layers within its stage.", - "description": "Moves the sprite forward by a specified number of layers within its stage.", - "scratchblock": "go [forward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the sprite forward" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersForwards", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Bringt die Figur um die angegebene Anzahl Ebenen nach vorne" - } - } - }, - { - "id": "Sprite/goToBackLayer()", - "memberId": "Sprite/goToBackLayer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToBackLayer", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves the sprite to the back layer of the stage. If the sprite is not\nassociated with any\nstage, the method returns without performing any action.", - "description": "Moves the sprite to the back layer of the stage. If the sprite is not\nassociated with any\nstage, the method returns without performing any action.", - "scratchblock": "go to [back v] layer", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToBackLayer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schiebt die Figur ganz nach hinten" - } - } - }, - { - "id": "Sprite/goToFrontLayer()", - "memberId": "Sprite/goToFrontLayer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToFrontLayer", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves this sprite to the front layer of the stage. If the sprite is not part\nof any stage, the\nmethod does nothing.", - "description": "Moves this sprite to the front layer of the stage. If the sprite is not part\nof any stage, the\nmethod does nothing.", - "scratchblock": "go to [front v] layer", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToFrontLayer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Bringt die Figur ganz nach vorne" - } - } - }, - { - "id": "Sprite/goToMousePointer()", - "memberId": "Sprite/goToMousePointer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToMousePointer", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves the sprite to the current position of the mouse pointer. This method\nupdates the sprite's\nposition to the coordinates of the mouse cursor.", - "description": "Moves the sprite to the current position of the mouse pointer. This method\nupdates the sprite's\nposition to the coordinates of the mouse cursor.", - "scratchblock": "go to [mouse-pointer v]", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToMousePointer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an die Position des Mauszeigers" - } - } - }, - { - "id": "Sprite/goToRandomPosition()", - "memberId": "Sprite/goToRandomPosition", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToRandomPosition", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves the sprite to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", - "description": "Moves the sprite to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", - "scratchblock": "go to [random position v]", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToRandomPosition", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an eine zufällige Position auf der Bühne" - } - } - }, - { - "id": "Sprite/goToSprite(Sprite)", - "memberId": "Sprite/goToSprite", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToSprite", - "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "sprite" - ], - "params": [ - "Sprite sprite" + "double y" ], - "summary": "Moves this sprite to the position of the specified sprite.", - "description": "Moves this sprite to the position of the specified sprite.", - "scratchblock": "go to [sprite v]", + "summary": "Glides to a position in a number of seconds of game time; the sprite keeps running its code\nmeanwhile. A new glide replaces one that is still going.", + "description": "Glides to a position in a number of seconds of game time; the sprite keeps running its code\nmeanwhile. A new glide replaces one that is still going.", + "scratchblock": "glide (seconds) secs to x: (x) y: (y)", "paramDocs": [ - "sprite: the sprite to move to" + "seconds: how long the glide takes", + "x: x of the target", + "y: y of the target" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/glide", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Figur auf die Position einer anderen Figur" + "description": "Gleitet in der angegebenen Zeit zur Zielposition" } } }, { - "id": "Sprite/hide()", - "memberId": "Sprite/hide", + "id": "Sprite/goLayersBackwards(int)", + "memberId": "Sprite/goLayersBackwards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "hide", + "methodName": "goLayersBackwards", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Hides the sprite. The pen is not effected.", - "description": "Hides the sprite. The pen is not effected.", - "scratchblock": "hide", - "paramDocs": [], + "parameterTypes": [ + "int" + ], + "parameterNames": [ + "number" + ], + "params": [ + "int number" + ], + "summary": "", + "description": "", + "scratchblock": "go [backward v] (number) layers", + "paramDocs": [ + "number: how many sprites of its layer to move behind" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hide", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersBackwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Macht die Figur unsichtbar" + "description": "Schiebt die Figur um die angegebene Anzahl Ebenen nach hinten" } } }, { - "id": "Sprite/hideVariable(String)", - "memberId": "Sprite/hideVariable", + "id": "Sprite/goLayersForwards(int)", + "memberId": "Sprite/goLayersForwards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "hideVariable", + "methodName": "goLayersForwards", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "number" ], "params": [ - "String name" + "int number" ], - "summary": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "description": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "scratchblock": "hide variable [name v]", + "summary": "", + "description": "", + "scratchblock": "go [forward v] (number) layers", "paramDocs": [ - "name: the name the monitor was shown with" + "number: how many sprites of its layer to move in front of" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hideVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersForwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Bringt die Figur um die angegebene Anzahl Ebenen nach vorne" + } + } }, { - "id": "Sprite/ifOnEdgeBounce()", - "memberId": "Sprite/ifOnEdgeBounce", + "id": "Sprite/goToBackLayer()", + "memberId": "Sprite/goToBackLayer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "ifOnEdgeBounce", + "methodName": "goToBackLayer", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the sprite is on the edge of the stage and bounces it back if it\nis. The sprite's\ndirection is reversed when it hits the left or right border, and it is\nreversed and rotated by\n180 degrees when it hits the top or bottom border. The method does nothing if\nthe hitbox is\ndisabled or if the sprite is a UI element. It also does nothing if the\nsprite has not been added to a stage yet.", - "description": "Checks if the sprite is on the edge of the stage and bounces it back if it\nis. The sprite's\ndirection is reversed when it hits the left or right border, and it is\nreversed and rotated by\n180 degrees when it hits the top or bottom border. The method does nothing if\nthe hitbox is\ndisabled or if the sprite is a UI element. It also does nothing if the\nsprite has not been added to a stage yet.", - "scratchblock": "if on edge, bounce", + "summary": "Moves the sprite behind every other sprite of its layer.", + "description": "Moves the sprite behind every other sprite of its layer.", + "scratchblock": "go to [back v] layer", "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ifOnEdgeBounce", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToBackLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Lässt die Figur am Bühnenrand abprallen" + "description": "Schiebt die Figur ganz nach hinten" } } }, { - "id": "Sprite/isAsking()", - "memberId": "Sprite/isAsking", + "id": "Sprite/goToFrontLayer()", + "memberId": "Sprite/goToFrontLayer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isAsking", + "methodName": "goToFrontLayer", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether a question is on screen and still waiting for an answer.", - "description": "Checks whether a question is on screen and still waiting for an answer.", - "scratchblock": null, + "summary": "Moves the sprite in front of every other sprite of its layer.", + "description": "Moves the sprite in front of every other sprite of its layer.", + "scratchblock": "go to [front v] layer", "paramDocs": [], - "returns": "true while a question is waiting", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isAsking", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToFrontLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" + "description": "Bringt die Figur ganz nach vorne" } } }, { - "id": "Sprite/isClone()", - "memberId": "Sprite/isClone", + "id": "Sprite/goToMousePointer()", + "memberId": "Sprite/goToMousePointer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isClone", + "methodName": "goToMousePointer", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Whether this sprite is a clone, made by [clone()](clone).", - "description": "Whether this sprite is a clone, made by [clone()](clone).", - "scratchblock": null, + "summary": "Goes to the mouse pointer.", + "description": "Goes to the mouse pointer.", + "scratchblock": "go to [mouse-pointer v]", "paramDocs": [], - "returns": "true for a clone, false for the original", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isClone", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie der Figur" - } - } - }, - { - "id": "Sprite/isColorTouchingColor(Color,Color)", - "memberId": "Sprite/isColorTouchingColor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "isColorTouchingColor", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "color", - "other" - ], - "params": [ - "Color color", - "Color other" - ], - "summary": "Checks whether a colour of the sprite is touching a colour on the stage:\nonly the parts of the costume painted in `color` count. A car whose\nfront bumper is red can ask whether the bumper touches the grass.", - "description": "Checks whether a colour of the sprite is touching a colour on the stage:\nonly the parts of the costume painted in `color` count. A car whose\nfront bumper is red can ask whether the bumper touches the grass.\n\n```java\nif (this.isColorTouchingColor(HtmlColor.RED, HtmlColor.GREEN)) {\n this.say(\"Off the road!\");\n}\n```", - "scratchblock": "<color [#ff0000] is touching [#00ff00]?>", - "paramDocs": [ - "color: a colour of this sprite's costume", - "other: the colour to look for under it" - ], - "returns": "true if the colour touches the other colour", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isColorTouchingColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToMousePointer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Prüft, ob die Teile der Figur in der Farbe color über der Farbe other liegen" + "description": "Setzt die Figur an die Position des Mauszeigers" } } }, { - "id": "Sprite/isGliding()", - "memberId": "Sprite/isGliding", + "id": "Sprite/goToRandomPosition()", + "memberId": "Sprite/goToRandomPosition", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isGliding", + "methodName": "goToRandomPosition", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether the sprite is still on its way to a place it was told to\nglide to.", - "description": "Checks whether the sprite is still on its way to a place it was told to\nglide to.", - "scratchblock": null, + "summary": "Goes to a random position on the stage.", + "description": "Goes to a random position on the stage.", + "scratchblock": "go to [random position v]", "paramDocs": [], - "returns": "true while it is still moving", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isGliding", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToRandomPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Figur gerade gleitet" + "description": "Setzt die Figur an eine zufällige Position auf der Bühne" } } }, { - "id": "Sprite/isKeyPressed(KeyCode)", - "memberId": "Sprite/isKeyPressed", + "id": "Sprite/goToSprite(Sprite)", + "memberId": "Sprite/goToSprite", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isKeyPressed", + "methodName": "goToSprite", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "keyCode" + "sprite" ], "params": [ - "KeyCode keyCode" + "Sprite sprite" ], - "summary": "Returns true if the key is pressed", - "description": "Returns true if the key is pressed", - "scratchblock": "<key [space v] pressed?>", + "summary": "", + "description": "", + "scratchblock": "go to [sprite v]", "paramDocs": [ - "keyCode: a key" + "sprite: the sprite whose position to go to" ], - "returns": "key pressed", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToSprite", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" + "description": "Setzt die Figur auf die Position einer anderen Figur" } } }, { - "id": "Sprite/isMouseDown()", - "memberId": "Sprite/isMouseDown", + "id": "Sprite/hide()", + "memberId": "Sprite/hide", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isMouseDown", + "methodName": "hide", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true is the mouse button is down", - "description": "Returns true is the mouse button is down", - "scratchblock": "<mouse down?>", + "summary": "Hides the sprite: it is not drawn, cannot be touched and cannot be clicked.", + "description": "Hides the sprite: it is not drawn, cannot be touched and cannot be clicked.", + "scratchblock": "hide", "paramDocs": [], - "returns": "mouse button down", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isMouseDown", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hide", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" + "description": "Macht die Figur unsichtbar" } } }, { - "id": "Sprite/isSoundPlaying(String)", - "memberId": "Sprite/isSoundPlaying", + "id": "Sprite/hideVariable(String)", + "memberId": "Sprite/hideVariable", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isSoundPlaying", + "methodName": "hideVariable", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ "java.lang.String" ], @@ -6430,1371 +7106,1177 @@ "params": [ "String name" ], - "summary": "Returns true if the sound if playing", - "description": "Returns true if the sound if playing", - "scratchblock": null, - "paramDocs": [ - "name: Name of the sound" - ], - "returns": "playing", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isSoundPlaying", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" - } - } - }, - { - "id": "Sprite/isTouchingColor(Color)", - "memberId": "Sprite/isTouchingColor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "isTouchingColor", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "color" - ], - "params": [ - "Color color" - ], - "summary": "Checks whether the sprite is touching a colour: whether anything it paints\nlies over that colour on the stage - on the backdrop, on what the pen drew,\nor on another sprite.", - "description": "Checks whether the sprite is touching a colour: whether anything it paints\nlies over that colour on the stage - on the backdrop, on what the pen drew,\nor on another sprite.\n\nAs in Scratch, colours that are nearly the same count, so anti-aliased\nedges still match. Only what is under the painted part of the costume\ncounts, not the empty space around it, and not the hitbox.\n\n```java\nif (this.isTouchingColor(HtmlColor.RED)) {\n this.say(\"Ouch!\");\n}\n```\n\nThe time it takes grows with the size of the sprite, not of the stage.", - "scratchblock": "<touching color [#ff0000]?>", + "summary": "", + "description": "", + "scratchblock": "hide variable [name v]", "paramDocs": [ - "color: the colour to look for" + "name: the label of a variable to hide again" ], - "returns": "true if the sprite is touching the colour", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hideVariable", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Prüft, ob etwas, das die Figur malt, über dieser Farbe auf der Bühne liegt — auf dem Bühnenbild, auf dem, was der Stift gezeichnet hat, oder auf einer anderen Figur. Fast gleiche Farben zählen wie in Scratch." - } - } - }, - { - "id": "Sprite/isTouchingColor(double,double,double)", - "memberId": "Sprite/isTouchingColor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "isTouchingColor", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "double", - "double", - "double" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "double r", - "double g", - "double b" - ], - "summary": "Checks whether the sprite is touching a colour given by its red, green and\nblue parts.", - "description": "Checks whether the sprite is touching a colour given by its red, green and\nblue parts.", - "scratchblock": null, - "paramDocs": [ - "r: the red part [0...255]", - "g: the green part [0...255]", - "b: the blue part [0...255]" - ], - "returns": "true if the sprite is touching the colour", + "translations": {} + }, + { + "id": "Sprite/ifOnEdgeBounce()", + "memberId": "Sprite/ifOnEdgeBounce", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "ifOnEdgeBounce", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Turns around when touching an edge of the stage and moves back inside, as in Scratch.", + "description": "Turns around when touching an edge of the stage and moves back inside, as in Scratch.", + "scratchblock": "if on edge, bounce", + "paramDocs": [], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ifOnEdgeBounce", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Prüft, ob die Figur eine Farbe berührt, angegeben durch Rot, Grün und Blau [0...255]" + "description": "Lässt die Figur am Bühnenrand abprallen" } } }, { - "id": "Sprite/isTouchingEdge()", - "memberId": "Sprite/isTouchingEdge", + "id": "Sprite/isAnimationPlayed()", + "memberId": "Sprite/isAnimationPlayed", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingEdge", + "methodName": "isAnimationPlayed", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true if the rectangle which contains the image is outside of the\nstage", - "description": "Returns true if the rectangle which contains the image is outside of the\nstage", - "scratchblock": "<touching [edge v]?>", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "true if outside", + "returns": "whether an animation played with `once` reached its last frame", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingEdge", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isAnimationPlayed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn die Figur den Bühnenrand berührt" - } - } + "translations": {} }, { - "id": "Sprite/isTouchingMousePointer()", - "memberId": "Sprite/isTouchingMousePointer", + "id": "Sprite/isAsking()", + "memberId": "Sprite/isAsking", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingMousePointer", + "methodName": "isAsking", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true is the mouse pointer is touching the hitbox of the sprite.", - "description": "Returns true is the mouse pointer is touching the hitbox of the sprite.", - "scratchblock": "<touching [mouse-pointer v]?>", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "true if touching", + "returns": "whether a question is waiting for its answer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingMousePointer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isAsking", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn der Mauszeiger auf der Figur liegt" + "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" } } }, { - "id": "Sprite/isTouchingSprite(Sprite)", - "memberId": "Sprite/isTouchingSprite", + "id": "Sprite/isClone()", + "memberId": "Sprite/isClone", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingSprite", + "methodName": "isClone", "static": false, "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "sprite" - ], - "params": [ - "Sprite sprite" - ], - "summary": "Checks if this sprite is touching another sprite.", - "description": "Checks if this sprite is touching another sprite.", - "scratchblock": "<touching [sprite v]?>", - "paramDocs": [ - "sprite: The sprite to check for collision with." - ], - "returns": "true if this sprite is touching the specified sprite, false\n otherwise. Returns false if\n the specified sprite is the same as this sprite, if the stage is\n null, if the specified\n sprite is null, not shown, or has its hitbox disabled.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether this sprite is a clone", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isClone", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn sich die Figuren berühren" + "description": "Erzeugt eine Kopie der Figur" } } }, { - "id": "Sprite/isTouchingSprite(Class)", - "memberId": "Sprite/isTouchingSprite", + "id": "Sprite/isColorTouchingColor(Color,Color)", + "memberId": "Sprite/isColorTouchingColor", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingSprite", + "methodName": "isColorTouchingColor", "static": false, "returnType": "boolean", "parameterTypes": [ - "java.lang.Class" + "org.openpatch.scratch.Color", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "c" + "mine", + "color" ], "params": [ - "Class c" + "Color mine", + "Color color" ], - "summary": "Checks if this sprite is touching any sprite of the specified class type.", - "description": "Checks if this sprite is touching any sprite of the specified class type.", - "scratchblock": null, + "summary": "Whether a colour of the sprite touches a colour on the stage, like Scratch's \"color is\ntouching color\".", + "description": "Whether a colour of the sprite touches a colour on the stage, like Scratch's \"color is\ntouching color\".", + "scratchblock": "<color [#ff0000] is touching [#00ff00]?>", "paramDocs": [ - "c: the class type of the sprite to check for collision" + "mine: a colour of the sprite", + "color: the colour to look for underneath" ], - "returns": "true if this sprite is touching any sprite of the specified class\n type, false otherwise", + "returns": "whether they touch", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isColorTouchingColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Figur eine Figur dieser Klasse berührt, z.B. isTouchingSprite(Apfel.class)" + "description": "Prüft, ob die Teile der Figur in der Farbe color über der Farbe other liegen" } } }, { - "id": "Sprite/isVisible()", - "memberId": "Sprite/isVisible", + "id": "Sprite/isGliding()", + "memberId": "Sprite/isGliding", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isVisible", + "methodName": "isGliding", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns if the sprite is visible", - "description": "Returns if the sprite is visible", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "is visible", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isVisible", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn die Figur sichtbar ist" - } - } - }, - { - "id": "Sprite/move(double)", - "memberId": "Sprite/move", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "move", - "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "steps" - ], - "params": [ - "double steps" - ], - "summary": "Moves the sprite towards the current rotation by the received steps.", - "description": "Moves the sprite towards the current rotation by the received steps.", - "scratchblock": "move (steps) steps", - "paramDocs": [ - "steps: a number of pixels" - ], - "returns": null, + "returns": "whether a glide is still going", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/move", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isGliding", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Bewegt die Figur um die angegebene Schrittzahl in ihre Blickrichtung" + "description": "Gibt genau dann true zurück, wenn die Figur gerade gleitet" } } }, { - "id": "Sprite/move(Vector2)", - "memberId": "Sprite/move", + "id": "Sprite/isKeyPressed(KeyCode)", + "memberId": "Sprite/isKeyPressed", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "move", + "methodName": "isKeyPressed", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.KeyCode" ], "parameterNames": [ - "v" + "key" ], "params": [ - "Vector2 v" + "KeyCode key" ], - "summary": "Moves the sprite in the direction of the given vector. The length of the\nvector determines how\nmove the sprite will move in this direction.", - "description": "Moves the sprite in the direction of the given vector. The length of the\nvector determines how\nmove the sprite will move in this direction.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "<key [space v] pressed?>", "paramDocs": [ - "v: a vector" + "key: a key" ], - "returns": null, + "returns": "whether the key is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/move", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Verschiebt die Figur um den Vektor" + "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" } } }, { - "id": "Sprite/nextCostume()", - "memberId": "Sprite/nextCostume", + "id": "Sprite/isMouseDown()", + "memberId": "Sprite/isMouseDown", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "nextCostume", + "methodName": "isMouseDown", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to the next costume.", - "description": "Switch to the next costume.", - "scratchblock": "next costume", + "summary": "", + "description": "", + "scratchblock": "<mouse down?>", "paramDocs": [], - "returns": null, + "returns": "whether a mouse button is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/nextCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isMouseDown", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum nächsten Kostüm" + "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" } } }, { - "id": "Sprite/pickRandom(int,int)", - "memberId": "Sprite/pickRandom", + "id": "Sprite/isSoundPlaying(String)", + "memberId": "Sprite/isSoundPlaying", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pickRandom", + "methodName": "isSoundPlaying", "static": false, - "returnType": "int", + "returnType": "boolean", "parameterTypes": [ - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "from", - "to" + "name" ], "params": [ - "int from", - "int to" + "String name" ], - "summary": "Returns a random integer between the specified range.", - "description": "Returns a random integer between the specified range.", - "scratchblock": "(pick random (from) to (to))", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "from: the lower bound of the range (inclusive)", - "to: the upper bound of the range (exclusive)" + "name: a sound's name" ], - "returns": "a random integer between the specified range", + "returns": "whether it is playing", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pickRandom", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isSoundPlaying", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" + "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" } } }, { - "id": "Sprite/playSound(String)", - "memberId": "Sprite/playSound", + "id": "Sprite/isTouchingColor(Color)", + "memberId": "Sprite/isTouchingColor", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "playSound", + "methodName": "isTouchingColor", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "name" + "color" ], "params": [ - "String name" + "Color color" ], - "summary": "Plays a sound.", - "description": "Plays a sound.\n\nEvery sprite plays its own copy, so ten sprites playing the same sound are\nheard ten times at once. One sprite only plays a sound once at a time:\nplaying it again while it is still going does nothing.", - "scratchblock": "start sound [name v]\n\nplaySoundCopy() returns an independent SoundPlayback with its own volume\nand can overlap earlier plays of the same sound.", + "summary": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "description": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "scratchblock": "<touching color [#ff0000]?>", "paramDocs": [ - "name: the sound name" + "color: the colour to look for" ], - "returns": null, + "returns": "whether the sprite touches it", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Spielt einen zuvor hinzugefügten Klang ab" + "description": "Prüft, ob etwas, das die Figur malt, über dieser Farbe auf der Bühne liegt — auf dem Bühnenbild, auf dem, was der Stift gezeichnet hat, oder auf einer anderen Figur. Fast gleiche Farben zählen wie in Scratch." } } }, { - "id": "Sprite/playSoundCopy(String,double)", - "memberId": "Sprite/playSoundCopy", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "playSoundCopy", - "static": false, - "returnType": "SoundPlayback", - "parameterTypes": [ - "java.lang.String", - "double" - ], - "parameterNames": [ - "name", - "volume" - ], - "params": [ - "String name", - "double volume" - ], - "summary": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this sprite.\nThe sprite's ordinary volume does not change a copy's explicit volume.", - "description": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this sprite.\nThe sprite's ordinary volume does not change a copy's explicit volume.", - "scratchblock": null, - "paramDocs": [ - "name: a sound already added with addSound()", - "volume: volume from 0 to 100 percent" - ], - "returns": "this individual playback, also usable in try-with-resources", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSoundCopy", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Sprite/pointInDirection(double)", - "memberId": "Sprite/pointInDirection", + "id": "Sprite/isTouchingColor(double,double,double)", + "memberId": "Sprite/isTouchingColor", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointInDirection", + "methodName": "isTouchingColor", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ + "double", + "double", "double" ], "parameterNames": [ - "degrees" + "red", + "green", + "blue" ], "params": [ - "double degrees" + "double red", + "double green", + "double blue" ], - "summary": "Points the sprite in the specified direction.", - "description": "Points the sprite in the specified direction.", - "scratchblock": null, + "summary": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "description": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "scratchblock": "<touching color [#ff0000]?>", "paramDocs": [ - "degrees: The direction in degrees to point the sprite. 0 degrees is up,\n 90 degrees is to the right, 180 degrees is down, and 270\n degrees is to the left." + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], - "returns": null, + "returns": "whether the sprite touches that colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointInDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" + "description": "Prüft, ob die Figur eine Farbe berührt, angegeben durch Rot, Grün und Blau [0...255]" } } }, { - "id": "Sprite/pointInDirection(Vector2)", - "memberId": "Sprite/pointInDirection", + "id": "Sprite/isTouchingEdge()", + "memberId": "Sprite/isTouchingEdge", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointInDirection", + "methodName": "isTouchingEdge", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Vector2" - ], - "parameterNames": [ - "v" - ], - "params": [ - "Vector2 v" - ], - "summary": "Points the sprite in the direction of the given vector.", - "description": "Points the sprite in the direction of the given vector.", - "scratchblock": null, - "paramDocs": [ - "v: the target vector to point towards" - ], - "returns": null, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "<touching [edge v]?>", + "paramDocs": [], + "returns": "whether the sprite's hitbox reaches an edge of the stage", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointInDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingEdge", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Richtet die Figur entlang des angegebenen Vektors aus" + "description": "Gibt genau dann true zurück, wenn die Figur den Bühnenrand berührt" } } }, { - "id": "Sprite/pointTowardsMousePointer()", - "memberId": "Sprite/pointTowardsMousePointer", + "id": "Sprite/isTouchingMousePointer()", + "memberId": "Sprite/isTouchingMousePointer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointTowardsMousePointer", + "methodName": "isTouchingMousePointer", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Points the sprite towards the current position of the mouse pointer. This\nmethod calculates the\nangle between the sprite's current position and the mouse pointer's position,\nthen sets the\nsprite's direction accordingly.", - "description": "Points the sprite towards the current position of the mouse pointer. This\nmethod calculates the\nangle between the sprite's current position and the mouse pointer's position,\nthen sets the\nsprite's direction accordingly.", - "scratchblock": "point towards [mouse-pointer v]", + "summary": "", + "description": "", + "scratchblock": "<touching [mouse-pointer v]?>", "paramDocs": [], - "returns": null, + "returns": "whether the mouse pointer is over the sprite's hitbox", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowardsMousePointer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingMousePointer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Richtet die Figur zum Mauszeiger aus" + "description": "Gibt genau dann true zurück, wenn der Mauszeiger auf der Figur liegt" } } }, { - "id": "Sprite/pointTowardsSprite(Sprite)", - "memberId": "Sprite/pointTowardsSprite", + "id": "Sprite/isTouchingSprite(Sprite)", + "memberId": "Sprite/isTouchingSprite", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointTowardsSprite", + "methodName": "isTouchingSprite", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "s" + "sprite" ], "params": [ - "Sprite s" + "Sprite sprite" ], - "summary": "Points the current sprite towards the specified sprite.", - "description": "Points the current sprite towards the specified sprite.", - "scratchblock": "point towards [sprite v]", + "summary": "", + "description": "", + "scratchblock": "<touching [sprite v]?>", "paramDocs": [ - "s: the sprite to point towards" + "sprite: another sprite" ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowardsSprite", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Richtet die Figur zu einer anderen Figur aus" - } - } - }, - { - "id": "Sprite/previousCostume()", - "memberId": "Sprite/previousCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "previousCostume", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Switch to the previous costume.", - "description": "Switch to the previous costume.", - "scratchblock": "switch costume to (previous costume)", - "paramDocs": [], - "returns": null, + "returns": "whether the two hitboxes overlap (touching edges do not count); a hidden sprite\n touches nothing, and the UI layer never touches the world", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/previousCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum vorherigen Kostüm" + "description": "Gibt genau dann true zurück, wenn sich die Figuren berühren" } } }, { - "id": "Sprite/remove()", - "memberId": "Sprite/remove", + "id": "Sprite/isTouchingSprite(Class)", + "memberId": "Sprite/isTouchingSprite", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "remove", + "methodName": "isTouchingSprite", "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Removes this sprite from its current stage. For \"delete this clone\", see\n[deleteThisClone()](deleteThisClone).", - "description": "Removes this sprite from its current stage. For \"delete this clone\", see\n[deleteThisClone()](deleteThisClone).", - "scratchblock": null, - "paramDocs": [], - "returns": null, + "returnType": "boolean", + "parameterTypes": [ + "java.lang.Class" + ], + "parameterNames": [ + "type" + ], + "params": [ + "Class type" + ], + "summary": "", + "description": "", + "scratchblock": "<touching [sprite v]?>", + "paramDocs": [ + "type: a class of sprites" + ], + "returns": "whether the sprite touches any sprite of that class (or a subclass)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt die Figur von der Bühne" + "description": "Gibt genau dann true zurück, wenn die Figur eine Figur dieser Klasse berührt, z.B. isTouchingSprite(Apfel.class)" } } }, { - "id": "Sprite/run()", - "memberId": "Sprite/run", + "id": "Sprite/isVisible()", + "memberId": "Sprite/isVisible", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "run", + "methodName": "isVisible", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "This method is intended to be overridden by subclasses to define the behavior\nof the sprite\nwhen it is run. By default, this method does nothing.", - "description": "This method is intended to be overridden by subclasses to define the behavior\nof the sprite\nwhen it is run. By default, this method does nothing.\n\nIt is called every frame.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether the sprite is shown", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/run", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isVisible", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird in jedem Frame aufgerufen" + "description": "Gibt genau dann true zurück, wenn die Figur sichtbar ist" } } }, { - "id": "Sprite/say(String)", - "memberId": "Sprite/say", + "id": "Sprite/move(double)", + "memberId": "Sprite/move", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "say", + "methodName": "move", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "text" + "steps" ], "params": [ - "String text" + "double steps" ], - "summary": "Makes the sprite display a speech bubble with the specified text.", - "description": "Makes the sprite display a speech bubble with the specified text.", - "scratchblock": "say [text]", + "summary": "Moves forward in the sprite's direction.", + "description": "Moves forward in the sprite's direction.", + "scratchblock": "move (steps) steps", "paramDocs": [ - "text: The text to be displayed in the speech bubble." + "steps: how far, in stage pixels (negative moves backwards)" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/move", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Sprechblase an" + "description": "Bewegt die Figur um die angegebene Schrittzahl in ihre Blickrichtung" } } }, { - "id": "Sprite/say(String,int)", - "memberId": "Sprite/say", + "id": "Sprite/nextCostume()", + "memberId": "Sprite/nextCostume", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "say", + "methodName": "nextCostume", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "int" - ], - "parameterNames": [ - "text", - "millis" - ], - "params": [ - "String text", - "int millis" - ], - "summary": "Displays a text message for a specified duration.", - "description": "Displays a text message for a specified duration.", - "scratchblock": "say [text] for (millis) seconds", - "paramDocs": [ - "text: The message to be displayed.", - "millis: The duration in milliseconds for which the message will be\n displayed." - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the next costume, after the last one to the first.", + "description": "Switches to the next costume, after the last one to the first.", + "scratchblock": "next costume", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/nextCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Sprechblase für die angegebene Zeit in Millisekunden" + "description": "Wechselt zum nächsten Kostüm" } } }, { - "id": "Sprite/setDirection(double)", - "memberId": "Sprite/setDirection", + "id": "Sprite/pickRandom(int,int)", + "memberId": "Sprite/pickRandom", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setDirection", + "methodName": "pickRandom", "static": false, - "returnType": "void", + "returnType": "int", "parameterTypes": [ - "double" + "int", + "int" ], "parameterNames": [ - "degrees" + "from", + "to" ], "params": [ - "double degrees" + "int from", + "int to" ], - "summary": "Sets the direction of the sprite to a given degrees. When this value is 0 the\nsprite moves\nup, when it is 180 it moves down.", - "description": "Sets the direction of the sprite to a given degrees. When this value is 0 the\nsprite moves\nup, when it is 180 it moves down.", - "scratchblock": "point in direction (degrees)", + "summary": "A random whole number between two numbers, both included.", + "description": "A random whole number between two numbers, both included.", + "scratchblock": "(pick random (from) to (to))", "paramDocs": [ - "degrees: between 0 and 360" + "from: the lowest", + "to: the highest" ], - "returns": null, + "returns": "the number", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pickRandom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" + "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" } } }, { - "id": "Sprite/setDirection(Vector2)", - "memberId": "Sprite/setDirection", + "id": "Sprite/playAnimation(String)", + "memberId": "Sprite/playAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setDirection", + "methodName": "playAnimation", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" ], "parameterNames": [ - "v" + "name" ], "params": [ - "Vector2 v" + "String name" ], - "summary": "Sets the direction of the sprite to the direction of a given vector.", - "description": "Sets the direction of the sprite to the direction of a given vector.", + "summary": "Plays an animation, over and over. Call it every tick (in `run()`): it shows the next\nframe each time the animation interval has passed, and starts from the first frame when\nanother animation was playing before.", + "description": "Plays an animation, over and over. Call it every tick (in `run()`): it shows the next\nframe each time the animation interval has passed, and starts from the first frame when\nanother animation was playing before.", "scratchblock": null, "paramDocs": [ - "v: a vector" + "name: the animation's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playAnimation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Blickrichtung auf die Richtung des Vektors" - } - } + "translations": {} }, { - "id": "Sprite/setHitbox(double[])", - "memberId": "Sprite/setHitbox", + "id": "Sprite/playAnimation(String,boolean)", + "memberId": "Sprite/playAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setHitbox", + "methodName": "playAnimation", "static": false, "returnType": "void", "parameterTypes": [ - "double[]" + "java.lang.String", + "boolean" ], "parameterNames": [ - "points" + "name", + "once" ], "params": [ - "double[] points" + "String name", + "boolean once" ], - "summary": "Sets the hitbox for the sprite using the provided points. The points should\nbe provided in\npairs representing the x and y coordinates.", - "description": "Sets the hitbox for the sprite using the provided points. The points should\nbe provided in\npairs representing the x and y coordinates.", + "summary": "Plays an animation; call it every tick.", + "description": "Plays an animation; call it every tick.", "scratchblock": null, "paramDocs": [ - "points: an array of integers representing the x and y coordinates of\n the hitbox vertices.\n The length of the array should be even, with each pair of\n integers representing a point (x,\n y)." + "name: the animation's name", + "once: whether to stop at the last frame instead of starting over" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHitbox", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playAnimation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Sprite/setHitbox(Shape)", - "memberId": "Sprite/setHitbox", + "id": "Sprite/playSound(String)", + "memberId": "Sprite/playSound", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setHitbox", + "methodName": "playSound", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Shape" + "java.lang.String" ], "parameterNames": [ - "shape" + "name" ], "params": [ - "Shape shape" + "String name" ], - "summary": "Sets the hitbox for the sprite using the specified shape.", - "description": "Sets the hitbox for the sprite using the specified shape.", - "scratchblock": null, + "summary": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "description": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "scratchblock": "start sound [name v]", "paramDocs": [ - "shape: the shape to be used for the hitbox" + "name: the sound's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHitbox", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Trefferfläche auf die angegebene Form; (0/0) ist die Mitte der Figur" + "description": "Spielt einen zuvor hinzugefügten Klang ab" } } }, { - "id": "Sprite/setPosition(double,double)", - "memberId": "Sprite/setPosition", + "id": "Sprite/playSoundCopy(String,double)", + "memberId": "Sprite/playSoundCopy", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setPosition", + "methodName": "playSoundCopy", "static": false, - "returnType": "void", + "returnType": "SoundPlayback", "parameterTypes": [ - "double", + "java.lang.String", "double" ], "parameterNames": [ - "x", - "y" + "name", + "volume" ], "params": [ - "double x", - "double y" + "String name", + "double volume" ], - "summary": "Sets the position of the sprite", - "description": "Sets the position of the sprite", - "scratchblock": "go to x: (x) y: (y)", + "summary": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "description": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "scratchblock": null, "paramDocs": [ - "x: a x coordinate", - "y: a y coordinate" + "name: the sound's name", + "volume: the copy's volume from 0 to 100" ], - "returns": null, + "returns": "the copy, to stop it or change its volume", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSoundCopy", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" - } - } + "translations": {} }, { - "id": "Sprite/setPosition(Vector2)", - "memberId": "Sprite/setPosition", + "id": "Sprite/pointTowards(Vector2)", + "memberId": "Sprite/pointTowards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setPosition", + "methodName": "pointTowards", "static": false, "returnType": "void", "parameterTypes": [ "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "v" + "position" ], "params": [ - "Vector2 v" + "Vector2 position" ], - "summary": "Sets the position of the sprite based on the coordinates of a given vector.", - "description": "Sets the position of the sprite based on the coordinates of a given vector.", + "summary": "Points towards a position.", + "description": "Points towards a position.", "scratchblock": null, "paramDocs": [ - "v: a vector" + "position: where to point" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" - } - } + "translations": {} }, { - "id": "Sprite/setRotationCenter(double,double)", - "memberId": "Sprite/setRotationCenter", + "id": "Sprite/pointTowards(Sprite)", + "memberId": "Sprite/pointTowards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setRotationCenter", + "methodName": "pointTowards", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "x", - "y" + "sprite" ], "params": [ - "double x", - "double y" + "Sprite sprite" ], - "summary": "Sets the point of the costume the sprite turns around - Scratch's rotation\ncenter. It is also the point that sits at the sprite's position, so it is\nwhere the pen draws from and what `goTo` puts in place.", - "description": "Sets the point of the costume the sprite turns around - Scratch's rotation\ncenter. It is also the point that sits at the sprite's position, so it is\nwhere the pen draws from and what `goTo` puts in place.\n\nThe point is given in the costume's own pixels, counted from its top left\ncorner, the same way as [setHitbox(double...)](setHitbox): a sword whose hilt\nis 12 pixels from the left and 60 from the top swings around the hilt with\n`setRotationCenter(12, 60)`. It grows and shrinks with the sprite's\nsize and holds for every costume of the sprite. Without it, a sprite turns\naround the middle of its costume.\n\n```java\nthis.addCostume(\"hand\", \"assets/clock-hand.png\");\nthis.setRotationCenter(8, 100); // the end of the hand\n```", + "summary": "Points towards a position.", + "description": "Points towards a position.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate in the costume, from its left edge", - "y: the y-coordinate in the costume, from its top edge" + "sprite: the sprite to point at" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationCenter", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt den Punkt des Kostüms, um den sich die Figur dreht (Drehpunkt). Er sitzt an der Position der Figur. Angegeben in Pixeln des Kostüms von seiner linken oberen Ecke aus, wie bei setHitbox; er wächst mit der Größe und gilt für alle Kostüme." - } - } + "translations": {} }, { - "id": "Sprite/setRotationStyle(RotationStyle)", - "memberId": "Sprite/setRotationStyle", + "id": "Sprite/pointTowardsMousePointer()", + "memberId": "Sprite/pointTowardsMousePointer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setRotationStyle", + "methodName": "pointTowardsMousePointer", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.RotationStyle" - ], - "parameterNames": [ - "style" - ], - "params": [ - "RotationStyle style" - ], - "summary": "Sets the rotation style for the sprite.", - "description": "Sets the rotation style for the sprite.", - "scratchblock": "set rotation style [left-right v]", - "paramDocs": [ - "style: the rotation style to be set" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Points towards the mouse pointer.", + "description": "Points towards the mouse pointer.", + "scratchblock": "point towards [mouse-pointer v]", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationStyle", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowardsMousePointer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, wie sich die Figur beim Drehen verhält" + "description": "Richtet die Figur zum Mauszeiger aus" } } }, { - "id": "Sprite/setSize(double)", - "memberId": "Sprite/setSize", + "id": "Sprite/previousCostume()", + "memberId": "Sprite/previousCostume", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setSize", + "methodName": "previousCostume", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "percentage" - ], - "params": [ - "double percentage" - ], - "summary": "Sets the size of the sprite.", - "description": "Sets the size of the sprite.", - "scratchblock": "set size to (percentage) %", - "paramDocs": [ - "percentage: a percentage [0...100]" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the previous costume, before the first one to the last.", + "description": "Switches to the previous costume, before the first one to the last.", + "scratchblock": "switch costume to (previous costume)", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/previousCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Größe in Prozent (100 = Originalgröße)" + "description": "Wechselt zum vorherigen Kostüm" } } }, { - "id": "Sprite/setTint(Color)", - "memberId": "Sprite/setTint", + "id": "Sprite/remove()", + "memberId": "Sprite/remove", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTint", + "methodName": "remove", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the tint for the sprite with an color object.", - "description": "Sets the tint for the sprite with an color object.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Removes the sprite from its stage.", + "description": "Removes the sprite from its stage.", "scratchblock": null, - "paramDocs": [ - "c: a color object" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt die Figur mit der angegebenen Farbe ein" + "description": "Entfernt die Figur von der Bühne" } } }, { - "id": "Sprite/setTint(double,double,double)", - "memberId": "Sprite/setTint", + "id": "Sprite/resetAnimation()", + "memberId": "Sprite/resetAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTint", + "methodName": "resetAnimation", "static": false, "returnType": "void", - "parameterTypes": [ - "double", - "double", - "double" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "double r", - "double g", - "double b" - ], - "summary": "Sets the tint for the sprite with rgb.", - "description": "Sets the tint for the sprite with rgb.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Starts the current animation from its first frame again.", + "description": "Starts the current animation from its first frame again.", "scratchblock": null, - "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/resetAnimation", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/run()", + "memberId": "Sprite/run", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "run", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Runs every tick, 60 times a second of game time. Override it with the sprite's code.", + "description": "Runs every tick, 60 times a second of game time. Override it with the sprite's code.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/run", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt die Figur mit der angegebenen Farbe ein (Anteile jeweils 0 bis 255)" + "description": "Wird in jedem Frame aufgerufen" } } }, { - "id": "Sprite/setTint(double)", - "memberId": "Sprite/setTint", + "id": "Sprite/say(String)", + "memberId": "Sprite/say", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTint", + "methodName": "say", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "h" + "text" ], "params": [ - "double h" + "String text" ], - "summary": "Sets the tint for the sprite with a hue.", - "description": "Sets the tint for the sprite with a hue.", - "scratchblock": "set [color v] effect to (h)", + "summary": "Shows a speech bubble until the sprite says something else; an empty text removes it.", + "description": "Shows a speech bubble until the sprite says something else; an empty text removes it.", + "scratchblock": "say [text]", "paramDocs": [ - "h: a hue value [0...255]" + "text: what the sprite says" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt die Figur mit dem angegebenen Farbton ein (0 bis 255)" + "description": "Zeigt eine Sprechblase an" } } }, { - "id": "Sprite/setTransparency(double)", - "memberId": "Sprite/setTransparency", + "id": "Sprite/say(String,double)", + "memberId": "Sprite/say", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTransparency", + "methodName": "say", "static": false, "returnType": "void", "parameterTypes": [ + "java.lang.String", "double" ], "parameterNames": [ - "transparency" + "text", + "seconds" ], "params": [ - "double transparency" + "String text", + "double seconds" ], - "summary": "Sets how see-through the sprite is, as Scratch's ghost effect does: 0 is the\nsolid sprite you start with and 100 is invisible. Anything outside that is\npinned to it.", - "description": "Sets how see-through the sprite is, as Scratch's ghost effect does: 0 is the\nsolid sprite you start with and 100 is invisible. Anything outside that is\npinned to it.", - "scratchblock": "set [ghost v] effect to (transparency)", + "summary": "Shows a speech bubble for a number of seconds of game time.", + "description": "Shows a speech bubble for a number of seconds of game time.", + "scratchblock": "say [text] for (seconds) seconds", "paramDocs": [ - "transparency: [0...100], 0 solid and 100 invisible" + "text: what the sprite says", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Transparenz in Prozent (0 = deckend, 100 = unsichtbar)" - } - } + "translations": {} }, { - "id": "Sprite/setVolume(double)", - "memberId": "Sprite/setVolume", + "id": "Sprite/setAnimationFrame(int)", + "memberId": "Sprite/setAnimationFrame", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setVolume", + "methodName": "setAnimationFrame", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "int" ], "parameterNames": [ - "percent" + "frame" ], "params": [ - "double percent" + "int frame" ], - "summary": "Sets how loud every sound of this sprite plays.", - "description": "Sets how loud every sound of this sprite plays.", - "scratchblock": "set volume to (percent) %", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "percent: 0 for silent, 100 for full volume" + "frame: the frame of the current animation to show next, counting from 0" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setAnimationFrame", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Lautstärke aller Klänge dieser Figur in Prozent" - } - } + "translations": {} }, { - "id": "Sprite/setX(double)", - "memberId": "Sprite/setX", + "id": "Sprite/setAnimationInterval(double)", + "memberId": "Sprite/setAnimationInterval", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setX", + "methodName": "setAnimationInterval", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "x" + "seconds" ], "params": [ - "double x" + "double seconds" ], - "summary": "Sets the x coordinate", - "description": "Sets the x coordinate", - "scratchblock": "set x to (x)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "x: a x coordinate" + "seconds: how long each frame shows" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setAnimationInterval", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die x-Position" - } - } + "translations": {} }, { - "id": "Sprite/setY(double)", - "memberId": "Sprite/setY", + "id": "Sprite/setColorEffect(double)", + "memberId": "Sprite/setColorEffect", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setY", + "methodName": "setColorEffect", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "y" + "value" ], "params": [ - "double y" + "double value" ], - "summary": "Sets the y coordinate", - "description": "Sets the y coordinate", - "scratchblock": "set y to (y)", + "summary": "Scratch's colour effect: shifts every colour of the costume around the colour wheel. 0 is no\nchange; 100 is halfway round; 200 is all the way round again. Like Scratch, it gives colours\ntoo grey or too dark to show a hue a little one, so white and black are tinted too.", + "description": "Scratch's colour effect: shifts every colour of the costume around the colour wheel. 0 is no\nchange; 100 is halfway round; 200 is all the way round again. Like Scratch, it gives colours\ntoo grey or too dark to show a hue a little one, so white and black are tinted too.", + "scratchblock": "set [color v] effect to (value)", "paramDocs": [ - "y: a y coordinate" + "value: the effect" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die y-Position" - } - } + "translations": {} }, { - "id": "Sprite/show()", - "memberId": "Sprite/show", + "id": "Sprite/setDirection(double)", + "memberId": "Sprite/setDirection", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "show", + "methodName": "setDirection", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Shows the sprite.", - "description": "Shows the sprite.", - "scratchblock": "show", - "paramDocs": [], + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "degrees" + ], + "params": [ + "double degrees" + ], + "summary": "Points in a direction: 0 up, 90 right, 180 down, 270 left; other numbers go around.", + "description": "Points in a direction: 0 up, 90 right, 180 down, 270 left; other numbers go around.", + "scratchblock": "point in direction (degrees)", + "paramDocs": [ + "degrees: the direction" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/show", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setDirection", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Macht die Figur sichtbar" + "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" } } }, { - "id": "Sprite/showVariable(String,Supplier)", - "memberId": "Sprite/showVariable", + "id": "Sprite/setHeight(double)", + "memberId": "Sprite/setHeight", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "showVariable", + "methodName": "setHeight", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.util.function.Supplier" + "double" ], "parameterNames": [ - "name", - "value" + "height" ], "params": [ - "String name", - "Supplier value" + "double height" ], - "summary": "Shows a monitor for one of this sprite's variables in the top left corner\nof the stage, like Scratch's variable monitors: \"Cat: score\" and the\ncurrent value, updated every frame. Showing the same name again replaces\nthe monitor; it goes away with the sprite.", - "description": "Shows a monitor for one of this sprite's variables in the top left corner\nof the stage, like Scratch's variable monitors: \"Cat: score\" and the\ncurrent value, updated every frame. Showing the same name again replaces\nthe monitor; it goes away with the sprite.\n\n```java\npublic Cat() {\n this.addCostume(\"cat\", \"bunny1_stand\");\n this.showVariable(\"lives\", () -> lives);\n}\n```", - "scratchblock": "show variable [name v]", + "summary": "Draws the sprite this high; see [setWidth(double)](setWidth).", + "description": "Draws the sprite this high; see [setWidth(double)](setWidth).", + "scratchblock": null, "paramDocs": [ - "name: the variable's name, shown after the sprite's", - "value: gives the value to show; asked for it every frame" + "height: the height in stage pixels; 0 to follow the costume and size again" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/showVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Sprite/stamp()", - "memberId": "Sprite/stamp", + "id": "Sprite/setHitbox(Shape)", + "memberId": "Sprite/setHitbox", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "stamp", + "methodName": "setHitbox", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stamps the current sprite to the background. A stamp is a non interactive\nversion of the sprite.", - "description": "Stamps the current sprite to the background. A stamp is a non interactive\nversion of the sprite.", - "scratchblock": "stamp", - "paramDocs": [], + "parameterTypes": [ + "org.openpatch.scratch.Shape" + ], + "parameterNames": [ + "shape" + ], + "params": [ + "Shape shape" + ], + "summary": "Sets the hitbox: the shape that counts for touching, in costume pixels (origin at the\ncostume's top left corner, y down). It turns, grows and mirrors with the sprite.", + "description": "Sets the hitbox: the shape that counts for touching, in costume pixels (origin at the\ncostume's top left corner, y down). It turns, grows and mirrors with the sprite.", + "scratchblock": null, + "paramDocs": [ + "shape: the hitbox" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHitbox", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Druckt ein unbewegliches Abbild der Figur auf die Bühne" + "description": "Setzt die Trefferfläche auf die angegebene Form; (0/0) ist die Mitte der Figur" } } }, { - "id": "Sprite/stamp(Layer)", - "memberId": "Sprite/stamp", + "id": "Sprite/setLayer(Layer)", + "memberId": "Sprite/setLayer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "stamp", + "methodName": "setLayer", "static": false, "returnType": "void", "parameterTypes": [ @@ -7806,859 +8288,919 @@ "params": [ "Layer layer" ], - "summary": "Stamps the sprite onto one of the stage's layers. A stamp is a picture of\nthe sprite that stays where it is put, and is not interactive.", - "description": "Stamps the sprite onto one of the stage's layers. A stamp is a picture of\nthe sprite that stays where it is put, and is not interactive.\n\nExample usage:\n\n```java\nthis.stamp(Layer.UI);\n```", + "summary": "Moves the sprite to another layer, in front of the sprites already there. A sprite in\n[Layer.UI](../Layer/UI) ignores the camera; its pen moves to the UI layer too.", + "description": "Moves the sprite to another layer, in front of the sprites already there. A sprite in\n[Layer.UI](../Layer/UI) ignores the camera; its pen moves to the UI layer too.", "scratchblock": null, "paramDocs": [ - "layer: which layer to stamp onto" + "layer: the layer" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Druckt ein unbewegliches Abbild der Figur auf die angegebene Ebene" - } - } - }, - { - "id": "Sprite/stopAllSounds()", - "memberId": "Sprite/stopAllSounds", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "stopAllSounds", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the playing of all sounds of the sprite.", - "description": "Stops the playing of all sounds of the sprite.", - "scratchblock": "stop all sounds", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopAllSounds", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Stoppt alle Klänge dieser Figur" - } - } + "translations": {} }, { - "id": "Sprite/stopSound(String)", - "memberId": "Sprite/stopSound", + "id": "Sprite/setNineSlice(int,int,int,int)", + "memberId": "Sprite/setNineSlice", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "stopSound", + "methodName": "setNineSlice", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int", + "int", + "int", + "int" ], "parameterNames": [ - "name" + "top", + "right", + "bottom", + "left" ], "params": [ - "String name" + "int top", + "int right", + "int bottom", + "int left" ], - "summary": "Stops the playing of the sound with the given name", - "description": "Stops the playing of the sound with the given name", + "summary": "Stretches only the middle of the costume when the sprite is drawn at its own width and\nheight: the four corners keep their size (scaled with the sprite's size), the edges stretch\nalong one side.", + "description": "Stretches only the middle of the costume when the sprite is drawn at its own width and\nheight: the four corners keep their size (scaled with the sprite's size), the edges stretch\nalong one side.", "scratchblock": null, "paramDocs": [ - "name: Name of the sound" + "top: costume pixels at the top that keep their height", + "right: costume pixels at the right that keep their width", + "bottom: costume pixels at the bottom that keep their height", + "left: costume pixels at the left that keep their width" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setNineSlice", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Stoppt den Klang mit dem angegebenen Namen" - } - } + "translations": {} }, { - "id": "Sprite/switchCostume(String)", - "memberId": "Sprite/switchCostume", + "id": "Sprite/setPosition(double,double)", + "memberId": "Sprite/setPosition", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "switchCostume", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double" ], "parameterNames": [ - "name" + "x", + "y" ], "params": [ - "String name" + "double x", + "double y" ], - "summary": "Switch to a costume by name.", - "description": "Switch to a costume by name.", - "scratchblock": "switch costume to [name v]", + "summary": "Goes to a position; with the pen down, it draws a line there.", + "description": "Goes to a position; with the pen down, it draws a line there.", + "scratchblock": "go to x: (x) y: (y)", "paramDocs": [ - "name: the name of a costume" + "x: x of the new position", + "y: y of the new position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum Kostüm mit dem Namen" + "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Sprite/switchCostume(double)", - "memberId": "Sprite/switchCostume", + "id": "Sprite/setPosition(Vector2)", + "memberId": "Sprite/setPosition", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "switchCostume", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "index" + "position" ], "params": [ - "double index" + "Vector2 position" ], - "summary": "Switches the current costume of the sprite to the costume at the specified\nindex.", - "description": "Switches the current costume of the sprite to the costume at the specified\nindex.", - "scratchblock": "switch costume to (index)", + "summary": "Goes to a position; with the pen down, it draws a line there.", + "description": "Goes to a position; with the pen down, it draws a line there.", + "scratchblock": "go to x: (x) y: (y)", "paramDocs": [ - "index: The index of the costume to switch to." + "position: the new position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum Kostüm mit der angegebenen Nummer" + "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Sprite/think(String)", - "memberId": "Sprite/think", + "id": "Sprite/setRotationCenter(double,double)", + "memberId": "Sprite/setRotationCenter", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "think", + "methodName": "setRotationCenter", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double" ], "parameterNames": [ - "text" + "x", + "y" ], "params": [ - "String text" + "double x", + "double y" ], - "summary": "Displays a thought bubble with the specified text.", - "description": "Displays a thought bubble with the specified text.", - "scratchblock": "think [text]", + "summary": "Sets the point of the costumes the sprite turns around and stands on, in costume pixels from\nthe top left corner. Without it, that is the centre of each costume.", + "description": "Sets the point of the costumes the sprite turns around and stands on, in costume pixels from\nthe top left corner. Without it, that is the centre of each costume.", + "scratchblock": null, "paramDocs": [ - "text: The text to be displayed in the thought bubble." + "x: pixels from the left edge", + "y: pixels from the top edge" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationCenter", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Denkblase an" + "description": "Setzt den Punkt des Kostüms, um den sich die Figur dreht (Drehpunkt). Er sitzt an der Position der Figur. Angegeben in Pixeln des Kostüms von seiner linken oberen Ecke aus, wie bei setHitbox; er wächst mit der Größe und gilt für alle Kostüme." } } }, { - "id": "Sprite/think(String,int)", - "memberId": "Sprite/think", + "id": "Sprite/setRotationStyle(RotationStyle)", + "memberId": "Sprite/setRotationStyle", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "think", + "methodName": "setRotationStyle", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.RotationStyle" ], "parameterNames": [ - "text", - "millis" + "style" ], "params": [ - "String text", - "int millis" + "RotationStyle style" ], - "summary": "Displays a thought bubble with the specified text for a given duration.", - "description": "Displays a thought bubble with the specified text for a given duration.", - "scratchblock": "think [text] for (millis) seconds", + "summary": "", + "description": "", + "scratchblock": "set rotation style [left-right v]", "paramDocs": [ - "text: The text to be displayed in the thought bubble.", - "millis: The duration in milliseconds for which the thought bubble will\n be displayed." + "style: how the costume follows the direction" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationStyle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Denkblase für die angegebene Zeit in Millisekunden" + "description": "Legt fest, wie sich die Figur beim Drehen verhält" } } }, { - "id": "Sprite/turnLeft(double)", - "memberId": "Sprite/turnLeft", + "id": "Sprite/setSize(double)", + "memberId": "Sprite/setSize", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "turnLeft", + "methodName": "setSize", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "degrees" + "percent" ], "params": [ - "double degrees" + "double percent" ], - "summary": "Rotates the sprite by a certain degrees to the left.", - "description": "Rotates the sprite by a certain degrees to the left.", - "scratchblock": "turn left (degrees) degrees", + "summary": "", + "description": "", + "scratchblock": "set size to (percentage) %", "paramDocs": [ - "degrees: between 0 and 360" + "percent: the size in percent of the costume's own size" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnLeft", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Dreht die Figur um die angegebene Gradzahl nach links" + "description": "Setzt die Größe in Prozent (100 = Originalgröße)" } } }, { - "id": "Sprite/turnRight(double)", - "memberId": "Sprite/turnRight", + "id": "Sprite/setTint(Color)", + "memberId": "Sprite/setTint", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "turnRight", + "methodName": "setTint", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "degrees" + "color" ], "params": [ - "double degrees" + "Color color" ], - "summary": "Rotates the sprite by a certain degrees to the right.", - "description": "Rotates the sprite by a certain degrees to the right.", - "scratchblock": "turn right (degrees) degrees", + "summary": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", + "description": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", + "scratchblock": null, "paramDocs": [ - "degrees: between 0 and 360" + "color: the tint, or null for none" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnRight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Dreht die Figur um die angegebene Gradzahl nach rechts" + "description": "Färbt die Figur mit der angegebenen Farbe ein" } } }, { - "id": "Sprite/whenAddedToStage()", - "memberId": "Sprite/whenAddedToStage", + "id": "Sprite/setTint(double,double,double)", + "memberId": "Sprite/setTint", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenAddedToStage", + "methodName": "setTint", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the sprite is added to the stage. Override this\nmethod to define\ncustom behavior when the sprite is added to the stage.", - "description": "This method is called when the sprite is added to the stage. Override this\nmethod to define\ncustom behavior when the sprite is added to the stage.", + "parameterTypes": [ + "double", + "double", + "double" + ], + "parameterNames": [ + "red", + "green", + "blue" + ], + "params": [ + "double red", + "double green", + "double blue" + ], + "summary": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", + "description": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenAddedToStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn die Figur der Bühne hinzugefügt wird" + "description": "Färbt die Figur mit der angegebenen Farbe ein (Anteile jeweils 0 bis 255)" } } }, { - "id": "Sprite/whenBackdropSwitches(String)", - "memberId": "Sprite/whenBackdropSwitches", + "id": "Sprite/setTransparency(double)", + "memberId": "Sprite/setTransparency", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenBackdropSwitches", + "methodName": "setTransparency", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "name" + "percent" ], "params": [ - "String name" + "double percent" ], - "summary": "This method is called when the backdrop switches to the specified name.\nOverride this method to\ndefine custom behavior.", - "description": "This method is called when the backdrop switches to the specified name.\nOverride this method to\ndefine custom behavior.", - "scratchblock": "when backdrop switches to [name v]", + "summary": "Scratch's ghost effect.", + "description": "Scratch's ghost effect.", + "scratchblock": "set [ghost v] effect to (transparency)", "paramDocs": [ - "name: the name of the backdrop to switch to" + "percent: 0 opaque, 100 invisible" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenBackdropSwitches", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn der Hintergrund gewechselt wird" + "description": "Setzt die Transparenz in Prozent (0 = deckend, 100 = unsichtbar)" } } }, { - "id": "Sprite/whenClicked()", - "memberId": "Sprite/whenClicked", + "id": "Sprite/setVolume(double)", + "memberId": "Sprite/setVolume", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenClicked", + "methodName": "setVolume", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the sprite is clicked. Override this method to\ndefine custom\nbehavior for the sprite when it is clicked.", - "description": "This method is called when the sprite is clicked. Override this method to\ndefine custom\nbehavior for the sprite when it is clicked.", - "scratchblock": "when this sprite clicked", - "paramDocs": [], + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "volume" + ], + "params": [ + "double volume" + ], + "summary": "", + "description": "", + "scratchblock": "set volume to (percent) %", + "paramDocs": [ + "volume: this object's volume from 0 to 100" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenClicked", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn die Figur angeklickt wird" + "description": "Setzt die Lautstärke aller Klänge dieser Figur in Prozent" } } }, { - "id": "Sprite/whenIReceive(String)", - "memberId": "Sprite/whenIReceive", + "id": "Sprite/setWidth(double)", + "memberId": "Sprite/setWidth", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenIReceive", + "methodName": "setWidth", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "message" + "width" ], "params": [ - "String message" + "double width" ], - "summary": "This method is called when a message is received. Override this method to\ndefine custom\nbehavior.", - "description": "This method is called when a message is received. Override this method to\ndefine custom\nbehavior.", - "scratchblock": "when I receive [message v]", + "summary": "Draws the sprite this wide, whatever its costume's width and size: for buttons, panels and\nplatforms. With [setNineSlice(int, int, int, int)](setNineSlice) the corners keep their size.", + "description": "Draws the sprite this wide, whatever its costume's width and size: for buttons, panels and\nplatforms. With [setNineSlice(int, int, int, int)](setNineSlice) the corners keep their size.", + "scratchblock": null, "paramDocs": [ - "message: The message that is received." + "width: the width in stage pixels; 0 to follow the costume and size again" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenIReceive", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird aufgerufen, wenn die Bühne eine Nachricht sendet" - } - } + "translations": {} }, { - "id": "Sprite/whenKeyPressed(KeyCode)", - "memberId": "Sprite/whenKeyPressed", + "id": "Sprite/setX(double)", + "memberId": "Sprite/setX", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenKeyPressed", + "methodName": "setX", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "double" ], "parameterNames": [ - "keyCode" + "x" ], "params": [ - "KeyCode keyCode" + "double x" ], - "summary": "This method is called when a key is pressed. Override this method to define\ncustom behavior.", - "description": "This method is called when a key is pressed. Override this method to define\ncustom behavior.", - "scratchblock": "when [space v] key pressed", + "summary": "", + "description": "", + "scratchblock": "set x to (x)", "paramDocs": [ - "keyCode: the key that was pressed" + "x: the new x" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Drücken einer Taste aufgerufen" + "description": "Setzt die x-Position" } } }, { - "id": "Sprite/whenKeyReleased(KeyCode)", - "memberId": "Sprite/whenKeyReleased", + "id": "Sprite/setY(double)", + "memberId": "Sprite/setY", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenKeyReleased", + "methodName": "setY", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "double" ], "parameterNames": [ - "keyCode" + "y" ], "params": [ - "KeyCode keyCode" + "double y" ], - "summary": "This method is called when a key is released. Override this method to define\ncustom behavior.", - "description": "This method is called when a key is released. Override this method to define\ncustom behavior.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "set y to (y)", "paramDocs": [ - "keyCode: the key that was released" + "y: the new y" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyReleased", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Loslassen einer Taste aufgerufen" + "description": "Setzt die y-Position" } } }, { - "id": "Sprite/whenMouseClicked(MouseCode)", - "memberId": "Sprite/whenMouseClicked", + "id": "Sprite/show()", + "memberId": "Sprite/show", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenMouseClicked", + "methodName": "show", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Shows the sprite.", + "description": "Shows the sprite.", + "scratchblock": "show", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/show", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Macht die Figur sichtbar" + } + } + }, + { + "id": "Sprite/showVariable(String,Supplier)", + "memberId": "Sprite/showVariable", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "showVariable", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.MouseCode" + "java.lang.String", + "java.util.function.Supplier" ], "parameterNames": [ - "mouseCode" + "name", + "value" ], "params": [ - "MouseCode mouseCode" + "String name", + "Supplier value" ], - "summary": "This method is called when a mouse click event occurs. Override this method\nto define custom\nbehavior.", - "description": "This method is called when a mouse click event occurs. Override this method\nto define custom\nbehavior.", - "scratchblock": null, + "summary": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.", + "description": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.\n\n```java\nthis.showVariable(\"score\", () -> this.score);\n```", + "scratchblock": "show variable [name v]", "paramDocs": [ - "mouseCode: The code representing the mouse button that was clicked." + "name: the label", + "value: gives the value to show" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseClicked", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/showVariable", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/stamp()", + "memberId": "Sprite/stamp", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "stamp", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Stamps the costume onto the canvas of the sprite's pen layer (behind the sprites unless the\npen was moved): a picture of the sprite as it looks now, effects included, that stays.", + "description": "Stamps the costume onto the canvas of the sprite's pen layer (behind the sprites unless the\npen was moved): a picture of the sprite as it looks now, effects included, that stays.", + "scratchblock": "stamp", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei einem Mausklick aufgerufen, egal wo" + "description": "Druckt ein unbewegliches Abbild der Figur auf die Bühne" } } }, { - "id": "Sprite/whenMouseMoved(double,double)", - "memberId": "Sprite/whenMouseMoved", + "id": "Sprite/stamp(Layer)", + "memberId": "Sprite/stamp", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenMouseMoved", + "methodName": "stamp", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "org.openpatch.scratch.Layer" ], "parameterNames": [ - "x", - "y" + "layer" ], "params": [ - "double x", - "double y" + "Layer layer" ], - "summary": "This method is called when the mouse is moved. Override this method to define\ncustom behavior.", - "description": "This method is called when the mouse is moved. Override this method to define\ncustom behavior.", - "scratchblock": null, + "summary": "Stamps the costume onto the canvas of a layer.", + "description": "Stamps the costume onto the canvas of a layer.", + "scratchblock": "stamp", "paramDocs": [ - "x: The x-coordinate of the mouse pointer.", - "y: The y-coordinate of the mouse pointer." + "layer: the layer" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseMoved", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei jeder Mausbewegung aufgerufen; x und y sind Bühnenkoordinaten" + "description": "Druckt ein unbewegliches Abbild der Figur auf die angegebene Ebene" } } }, { - "id": "Sprite/whenRemovedFromStage()", - "memberId": "Sprite/whenRemovedFromStage", + "id": "Sprite/stopAllSounds()", + "memberId": "Sprite/stopAllSounds", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenRemovedFromStage", + "methodName": "stopAllSounds", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "This method is called when the sprite is removed from the stage. Override\nthis method to define\ncustom behavior when the sprite is removed.", - "description": "This method is called when the sprite is removed from the stage. Override\nthis method to define\ncustom behavior when the sprite is removed.", - "scratchblock": null, + "summary": "Stops every sound this object started.", + "description": "Stops every sound this object started.", + "scratchblock": "stop all sounds", "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenRemovedFromStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopAllSounds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn die Figur von der Bühne entfernt wird" + "description": "Stoppt alle Klänge dieser Figur" } } }, { - "id": "Sprite/whenStartsAsClone()", - "memberId": "Sprite/whenStartsAsClone", + "id": "Sprite/stopSound(String)", + "memberId": "Sprite/stopSound", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenStartsAsClone", + "methodName": "stopSound", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Runs when this sprite was just made as a clone, like Scratch's \"when I\nstart as a clone\". Override it to give clones their own behaviour, for\nexample to send a bullet on its way.", - "description": "Runs when this sprite was just made as a clone, like Scratch's \"when I\nstart as a clone\". Override it to give clones their own behaviour, for\nexample to send a bullet on its way.\n\n```java\npublic void whenStartsAsClone() {\n this.show();\n this.goToRandomPosition();\n}\n```", - "scratchblock": "when I start as a clone", - "paramDocs": [], + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "name" + ], + "params": [ + "String name" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "name: the sound to stop" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenStartsAsClone", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Stoppt den Klang mit dem angegebenen Namen" + } + } }, { - "id": "Stage/add(Sprite)", - "memberId": "Stage/add", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "add", + "id": "Sprite/switchCostume(String)", + "memberId": "Sprite/switchCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "switchCostume", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "java.lang.String" ], "parameterNames": [ - "sprite" + "name" ], "params": [ - "Sprite sprite" + "String name" ], - "summary": "Adds a sprite to the stage. Sprites are drawn in the order they were added, so a sprite added\nlater is drawn on top of one added earlier.", - "description": "Adds a sprite to the stage. Sprites are drawn in the order they were added, so a sprite added\nlater is drawn on top of one added earlier.", - "scratchblock": null, + "summary": "Switches to the costume with that name; an unknown name changes nothing.", + "description": "Switches to the costume with that name; an unknown name changes nothing.", + "scratchblock": "switch costume to [name v]", "paramDocs": [ - "sprite: the sprite to add" + "name: the costume's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt der Bühne eine Figur hinzu" + "description": "Wechselt zum Kostüm mit dem Namen" } } }, { - "id": "Stage/add(Text)", - "memberId": "Stage/add", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "add", + "id": "Sprite/switchCostume(double)", + "memberId": "Sprite/switchCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "switchCostume", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Text" + "double" ], "parameterNames": [ - "text" + "index" ], "params": [ - "Text text" + "double index" ], - "summary": "Add a text object to the stage", - "description": "Add a text object to the stage", - "scratchblock": null, + "summary": "Switches to a costume by number, counting from 0; numbers wrap around like Scratch's.", + "description": "Switches to a costume by number, counting from 0; numbers wrap around like Scratch's.", + "scratchblock": "switch costume to [name v]", "paramDocs": [ - "text: a text" + "index: the costume's number" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt der Bühne einen Text hinzu" + "description": "Wechselt zum Kostüm mit der angegebenen Nummer" } } }, { - "id": "Stage/add(Pen)", - "memberId": "Stage/add", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "add", + "id": "Sprite/think(String)", + "memberId": "Sprite/think", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "think", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Pen" + "java.lang.String" ], "parameterNames": [ - "pen" + "text" ], "params": [ - "Pen pen" + "String text" ], - "summary": "Adds a Pen object to the stage.", - "description": "Adds a Pen object to the stage.", - "scratchblock": null, + "summary": "Shows a thought bubble until the sprite thinks something else; an empty text removes it.", + "description": "Shows a thought bubble until the sprite thinks something else; an empty text removes it.", + "scratchblock": "think [text]", "paramDocs": [ - "pen: the Pen object to be added to the stage" + "text: what the sprite thinks" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt der Bühne einen Stift hinzu" + "description": "Zeigt eine Denkblase an" } } }, { - "id": "Stage/addBackdrop(String,String,boolean)", - "memberId": "Stage/addBackdrop", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addBackdrop", + "id": "Sprite/think(String,double)", + "memberId": "Sprite/think", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "think", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "boolean" + "double" ], "parameterNames": [ - "name", - "imagePath", - "stretch" + "text", + "seconds" ], "params": [ - "String name", - "String imagePath", - "boolean stretch" + "String text", + "double seconds" ], - "summary": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "description": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "scratchblock": null, + "summary": "Shows a thought bubble for a number of seconds of game time.", + "description": "Shows a thought bubble for a number of seconds of game time.", + "scratchblock": "think [text] for (seconds) seconds", "paramDocs": [ - "name: a unique name", - "imagePath: a image path, or the name of a built-in sprite such as\n \"bg_castle\"", - "stretch: stretch image to window size" + "text: what the sprite thinks", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt einen Hintergrund hinzu; bei stretch == true wird er auf Bühnengröße gedehnt" - } - } + "translations": {} }, { - "id": "Stage/addBackdrop(String,String)", - "memberId": "Stage/addBackdrop", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addBackdrop", + "id": "Sprite/toString()", + "memberId": "Sprite/toString", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "toString", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "The sprite's centre of the costume on the stage, as Scratch's \"x position\"/\"y position\".", + "description": "The sprite's centre of the costume on the stage, as Scratch's \"x position\"/\"y position\".", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/toString", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/turnLeft(double)", + "memberId": "Sprite/turnLeft", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "turnLeft", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "double" ], "parameterNames": [ - "name", - "imagePath" + "degrees" ], "params": [ - "String name", - "String imagePath" + "double degrees" ], - "summary": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "description": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "turn left (degrees) degrees", "paramDocs": [ - "name: a unique name", - "imagePath: a image path, or the name of a built-in sprite such as\n \"bg_castle\"" + "degrees: how far to turn anticlockwise" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnLeft", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen Hintergrund unter eigenem Namen hinzu" + "description": "Dreht die Figur um die angegebene Gradzahl nach links" } } }, { - "id": "Stage/addBackdrop(String)", - "memberId": "Stage/addBackdrop", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addBackdrop", + "id": "Sprite/turnRight(double)", + "memberId": "Sprite/turnRight", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "turnRight", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "name" + "degrees" ], "params": [ - "String name" + "double degrees" ], - "summary": "Add one of the backdrops that ship with Scratch for Java to the stage. The\nbackdrop gets the same name as the built-in sprite. If a backdrop with that\nname already exists do nothing.", - "description": "Add one of the backdrops that ship with Scratch for Java to the stage. The\nbackdrop gets the same name as the built-in sprite. If a backdrop with that\nname already exists do nothing.\n\nExample usage:\n\n```java\nthis.addBackdrop(\"bg_castle\");\n```", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "turn right (degrees) degrees", "paramDocs": [ - "name: the name of a built-in sprite, for example \"bg_castle\". Add the\n sheet in front of the name, for example \"platformer/grass\", if\n the same name exists on several sheets." + "degrees: how far to turn clockwise" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnRight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen der eingebauten Hintergründe hinzu" + "description": "Dreht die Figur um die angegebene Gradzahl nach rechts" } } }, { - "id": "Stage/addSound(String,String)", - "memberId": "Stage/addSound", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addSound", + "id": "Sprite/whenAddedToStage()", + "memberId": "Sprite/whenAddedToStage", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenAddedToStage", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "java.lang.String" - ], - "parameterNames": [ - "name", - "soundPath" - ], - "params": [ - "String name", - "String soundPath" - ], - "summary": "Add a sound to the stage. If a sound with the received name already exists do\nnothing.", - "description": "Add a sound to the stage. If a sound with the received name already exists do\nnothing.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Called when the sprite was added to a stage. Override it to react.", + "description": "Called when the sprite was added to a stage. Override it to react.", "scratchblock": null, - "paramDocs": [ - "name: a unique name", - "soundPath: a sound path, or the name of a built-in sound such as\n \"footstep_carpet_000\"" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenAddedToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen Klang unter eigenem Namen hinzu" + "description": "Wird aufgerufen, wenn die Figur der Bühne hinzugefügt wird" } } }, { - "id": "Stage/addSound(String)", - "memberId": "Stage/addSound", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addSound", + "id": "Sprite/whenBackdropSwitches(String)", + "memberId": "Sprite/whenBackdropSwitches", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenBackdropSwitches", "static": false, "returnType": "void", "parameterTypes": [ @@ -8670,63 +9212,55 @@ "params": [ "String name" ], - "summary": "Add one of the sounds that ship with Scratch for Java to the stage. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.", - "description": "Add one of the sounds that ship with Scratch for Java to the stage. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.\n\nExample usage:\n\n```java\nthis.addSound(\"footstep_carpet_000\");\n```", - "scratchblock": null, + "summary": "Called when the stage switches its backdrop.", + "description": "Called when the stage switches its backdrop.", + "scratchblock": "when backdrop switches to [name v]", "paramDocs": [ - "name: the name of a built-in sound, for example \"footstep_carpet_000\"" + "name: the new backdrop's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenBackdropSwitches", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen der eingebauten Klänge hinzu" + "description": "Wird aufgerufen, wenn der Hintergrund gewechselt wird" } } }, { - "id": "Stage/ask(String)", - "memberId": "Stage/ask", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "ask", + "id": "Sprite/whenClicked()", + "memberId": "Sprite/whenClicked", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenClicked", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "question" - ], - "params": [ - "String question" - ], - "summary": "Asks a question and waits for an answer to be typed in. A box appears at the\nbottom of the stage; whatever is typed goes into it until Enter is pressed.", - "description": "Asks a question and waits for an answer to be typed in. A box appears at the\nbottom of the stage; whatever is typed goes into it until Enter is pressed.\n\nUnlike Scratch, this does not pause anything. Your `run()` keeps being\ncalled while the question is on screen, so check [isAsking()](isAsking) or wait\nfor [getAnswer()](getAnswer) to change:\n\n```java\npublic void run() {\n if (!this.isAsking() && this.getAnswer().isEmpty()) {\n this.ask(\"What is your name?\");\n }\n if (!this.getAnswer().isEmpty()) {\n this.display(\"Hello \" + this.getAnswer() + \"!\");\n }\n}\n```", - "scratchblock": "ask [question] and wait", - "paramDocs": [ - "question: the question to show" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Called when this sprite is clicked: a mouse button is pressed over its hitbox, and no sprite\nin front of it is under the pointer.", + "description": "Called when this sprite is clicked: a mouse button is pressed over its hitbox, and no sprite\nin front of it is under the pointer.", + "scratchblock": "when this sprite clicked", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/ask", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenClicked", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" + "description": "Wird aufgerufen, wenn die Figur angeklickt wird" } } }, { - "id": "Stage/broadcast(String)", - "memberId": "Stage/broadcast", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "broadcast", + "id": "Sprite/whenIReceive(String)", + "memberId": "Sprite/whenIReceive", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenIReceive", "static": false, "returnType": "void", "parameterTypes": [ @@ -8738,4634 +9272,4500 @@ "params": [ "String message" ], - "summary": "Broadcasts a message to every sprite on the stage and to the stage itself,\nas in Scratch. Each of them runs its `whenIReceive` method with the\nmessage.", - "description": "Broadcasts a message to every sprite on the stage and to the stage itself,\nas in Scratch. Each of them runs its `whenIReceive` method with the\nmessage.", - "scratchblock": "broadcast [message v]", + "summary": "Called when a message is broadcast.", + "description": "Called when a message is broadcast.", + "scratchblock": "when I receive [message v]", "paramDocs": [ - "message: The message to broadcast." + "message: the message" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/broadcast", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenIReceive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Sendet eine Nachricht an alle whenIReceive-Empfänger" + "description": "Wird aufgerufen, wenn die Bühne eine Nachricht sendet" } } }, { - "id": "Stage/changeColor(double)", - "memberId": "Stage/changeColor", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeColor", + "id": "Sprite/whenKeyPressed(KeyCode)", + "memberId": "Sprite/whenKeyPressed", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenKeyPressed", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.KeyCode" ], "parameterNames": [ - "h" + "key" ], "params": [ - "double h" + "KeyCode key" ], - "summary": "Changes the background color by adding a step to the hue value.", - "description": "Changes the background color by adding a step to the hue value.", - "scratchblock": null, + "summary": "Called when a key is pressed, once per press (holding a key down does not repeat it).", + "description": "Called when a key is pressed, once per press (holding a key down does not repeat it).", + "scratchblock": "when [space v] key pressed", "paramDocs": [ - "h: a step value" + "key: the key" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert den Farbton des Hintergrunds um den angegebenen Wert" + "description": "Wird beim Drücken einer Taste aufgerufen" } } }, { - "id": "Stage/changeTint(double)", - "memberId": "Stage/changeTint", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeTint", + "id": "Sprite/whenKeyReleased(KeyCode)", + "memberId": "Sprite/whenKeyReleased", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenKeyReleased", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.KeyCode" ], "parameterNames": [ - "step" + "key" ], "params": [ - "double step" + "KeyCode key" ], - "summary": "Changes the colour the backdrop is tinted with by a step.", - "description": "Changes the colour the backdrop is tinted with by a step.", - "scratchblock": "change [color v] effect by (step)", + "summary": "Called when a key is released.", + "description": "Called when a key is released.", + "scratchblock": null, "paramDocs": [ - "step: a step value" + "key: the key" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyReleased", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert den Farbton der Einfärbung um den angegebenen Wert" + "description": "Wird beim Loslassen einer Taste aufgerufen" } } }, { - "id": "Stage/changeTransparency(double)", - "memberId": "Stage/changeTransparency", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeTransparency", + "id": "Sprite/whenMouseClicked(MouseCode)", + "memberId": "Sprite/whenMouseClicked", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenMouseClicked", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.MouseCode" ], "parameterNames": [ - "step" + "button" ], "params": [ - "double step" + "MouseCode button" ], - "summary": "Changes how see-through the backdrop is by a step. A positive step fades it\nout, a negative one brings it back.", - "description": "Changes how see-through the backdrop is by a step. A positive step fades it\nout, a negative one brings it back.", - "scratchblock": "change [ghost v] effect by (step)", + "summary": "Called when a mouse button is pressed anywhere on the stage.", + "description": "Called when a mouse button is pressed anywhere on the stage.", + "scratchblock": null, "paramDocs": [ - "step: a step value" + "button: the button" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseClicked", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert die Transparenz des Hintergrunds" + "description": "Wird bei einem Mausklick aufgerufen, egal wo" } } }, { - "id": "Stage/changeVolume(double)", - "memberId": "Stage/changeVolume", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeVolume", + "id": "Sprite/whenMouseMoved(double,double)", + "memberId": "Sprite/whenMouseMoved", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenMouseMoved", "static": false, "returnType": "void", "parameterTypes": [ + "double", "double" ], "parameterNames": [ - "step" + "x", + "y" ], "params": [ - "double step" + "double x", + "double y" ], - "summary": "Makes every sound of this stage louder or quieter.", - "description": "Makes every sound of this stage louder or quieter.", - "scratchblock": "change volume by (step)", + "summary": "Called when the mouse moves.", + "description": "Called when the mouse moves.", + "scratchblock": null, "paramDocs": [ - "step: how much to add to the volume, in percent" + "x: x of the mouse pointer (world)", + "y: y of the mouse pointer (world)" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseMoved", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert die Lautstärke um den angegebenen Wert" + "description": "Wird bei jeder Mausbewegung aufgerufen; x und y sind Bühnenkoordinaten" } } }, { - "id": "Stage/constructor()", - "memberId": "Stage/constructor", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "constructor", + "id": "Sprite/whenRemovedFromStage()", + "memberId": "Sprite/whenRemovedFromStage", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenRemovedFromStage", "static": false, - "returnType": "Stage", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Stage. A stage is as big as the window it is shown in, so\nthe window has to exist first:", - "description": "Constructs a new Stage. A stage is as big as the window it is shown in, so\nthe window has to exist first:\n\n```java\nWindow myWindow = new Window(480, 360);\nmyWindow.setStage(new MyStage());\n```", + "summary": "Called when the sprite was removed from its stage. Override it to react.", + "description": "Called when the sprite was removed from its stage. Override it to react.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenRemovedFromStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Bühne. Sie ist so groß wie das Fenster, das es schon geben muss" + "description": "Wird aufgerufen, wenn die Figur von der Bühne entfernt wird" } } }, { - "id": "Stage/count(Class)", - "memberId": "Stage/count", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "count", + "id": "Sprite/whenStartsAsClone()", + "memberId": "Sprite/whenStartsAsClone", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenStartsAsClone", "static": false, - "returnType": "int", - "parameterTypes": [ - "java.lang.Class" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Class c" - ], - "summary": "Returns the number of sprites of the specified class.", - "description": "Returns the number of sprites of the specified class.", - "scratchblock": null, - "paramDocs": [ - "c: the class of the sprites to count" - ], - "returns": "the number of sprites of the specified class", + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Called in a new clone, right after it was made.", + "description": "Called in a new clone, right after it was made.", + "scratchblock": "when I start as a clone", + "paramDocs": [], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/count", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenStartsAsClone", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Anzahl der Figuren dieser Klasse zurück, z.B. count(Apfel.class)" - } - } + "translations": {} }, { - "id": "Stage/debug(Object[])", - "memberId": "Stage/debug", + "id": "Stage/add(Sprite)", + "memberId": "Stage/add", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "debug", + "methodName": "add", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.Object[]" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "values" + "sprite" ], "params": [ - "Object[] values" + "Sprite sprite" ], - "summary": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the stage's class name so you can tell\nwhich stage it came from.", - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the stage's class name so you can tell\nwhich stage it came from.\n\nExample:\n\n```java\nthis.debug(\"score =\", score, \"lives =\", lives);\n// prints: [MyStage] score = 5 lives = 3\n```", + "summary": "Adds a sprite, in front of the sprites of its layer. A sprite can only be on one stage; it\nleaves the old one.", + "description": "Adds a sprite, in front of the sprites of its layer. A sprite can only be on one stage; it\nleaves the old one.", "scratchblock": null, "paramDocs": [ - "values: one or more values to print" + "sprite: the sprite" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/debug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Fügt der Bühne eine Figur hinzu" + } + } }, { - "id": "Stage/display(String)", - "memberId": "Stage/display", + "id": "Stage/add(Pen)", + "memberId": "Stage/add", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "display", + "methodName": "add", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Pen" ], "parameterNames": [ - "text" + "pen" ], "params": [ - "String text" + "Pen pen" ], - "summary": "Displays the given text on the stage.", - "description": "Displays the given text on the stage.", + "summary": "Adds a pen of its own.", + "description": "Adds a pen of its own.", "scratchblock": null, "paramDocs": [ - "text: the text to be displayed" + "pen: the pen" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt einen Text am unteren Rand der Bühne an" + "description": "Fügt der Bühne einen Stift hinzu" } } }, { - "id": "Stage/display(String,int)", - "memberId": "Stage/display", + "id": "Stage/add(Text)", + "memberId": "Stage/add", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "display", + "methodName": "add", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.Text" ], "parameterNames": [ - "text", - "millis" + "text" ], "params": [ - "String text", - "int millis" + "Text text" ], - "summary": "Displays the given text on the screen for a specified duration.", - "description": "Displays the given text on the screen for a specified duration.", + "summary": "Adds a text of its own.", + "description": "Adds a text of its own.", "scratchblock": null, "paramDocs": [ - "text: The text to be displayed.", - "millis: The duration in milliseconds for which the text will be\n displayed." + "text: the text" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zeigt einen Text für die angegebene Zeit in Millisekunden an" - } - } - }, - { - "id": "Stage/eraseAll()", - "memberId": "Stage/eraseAll", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "eraseAll", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Erases all lines on the pen layer.", - "description": "Erases all lines on the pen layer.", - "scratchblock": "erase all", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/eraseAll", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Löscht alles, was mit Stiften gezeichnet wurde" + "description": "Fügt der Bühne einen Text hinzu" } } }, { - "id": "Stage/exit()", - "memberId": "Stage/exit", + "id": "Stage/addBackdrop(String,String)", + "memberId": "Stage/addBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "exit", + "methodName": "addBackdrop", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Close the window and therefore the whole application.", - "description": "Close the window and therefore the whole application.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/exit", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Beendet das Programm" - } - } - }, - { - "id": "Stage/find(Class)", - "memberId": "Stage/find", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "find", - "static": false, - "returnType": "List", "parameterTypes": [ - "java.lang.Class" + "java.lang.String", + "java.lang.String" ], "parameterNames": [ - "c" + "name", + "imagePath" ], "params": [ - "Class c" + "String name", + "String imagePath" ], - "summary": "Find sprites of a given class.", - "description": "Find sprites of a given class.", + "summary": "Adds a backdrop. The first one added is shown.", + "description": "Adds a backdrop. The first one added is shown.", "scratchblock": null, "paramDocs": [ - "c: Class" + "name: the backdrop's name", + "imagePath: the image file" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/find", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt alle Figuren dieser Klasse zurück, z.B. find(Apfel.class)" - } - } - }, - { - "id": "Stage/getAll()", - "memberId": "Stage/getAll", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "getAll", - "static": false, - "returnType": "List", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves a list of all sprites in the current stage.", - "description": "Retrieves a list of all sprites in the current stage.", - "scratchblock": null, - "paramDocs": [], - "returns": "a list containing all sp", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAll", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt alle Figuren auf der Bühne zurück" + "description": "Fügt einen Hintergrund unter eigenem Namen hinzu" } } }, { - "id": "Stage/getAnswer()", - "memberId": "Stage/getAnswer", + "id": "Stage/addBackdrop(String)", + "memberId": "Stage/addBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getAnswer", + "methodName": "addBackdrop", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the last answer that was typed in.", - "description": "Returns the last answer that was typed in.", - "scratchblock": "(answer)", - "paramDocs": [], - "returns": "the answer, or an empty string if nothing has been answered yet", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "imagePath" + ], + "params": [ + "String imagePath" + ], + "summary": "Adds a backdrop, named after its file.", + "description": "Adds a backdrop, named after its file.", + "scratchblock": null, + "paramDocs": [ + "imagePath: the image file, or a built-in sprite's name" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAnswer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die zuletzt eingegebene Antwort zurück, sonst eine leere Zeichenkette" + "description": "Fügt einen der eingebauten Hintergründe hinzu" } } }, { - "id": "Stage/getCamera()", - "memberId": "Stage/getCamera", + "id": "Stage/addBackdrop(String,String,boolean)", + "memberId": "Stage/addBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getCamera", + "methodName": "addBackdrop", "static": false, - "returnType": "Camera", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the current camera instance associated with this stage.", - "description": "Retrieves the current camera instance associated with this stage.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "boolean" + ], + "parameterNames": [ + "name", + "imagePath", + "stretch" + ], + "params": [ + "String name", + "String imagePath", + "boolean stretch" + ], + "summary": "Adds a backdrop, optionally stretched to the stage's size.", + "description": "Adds a backdrop, optionally stretched to the stage's size.", "scratchblock": null, - "paramDocs": [], - "returns": "the current Camera object.", + "paramDocs": [ + "name: the backdrop's name", + "imagePath: the image file, or a built-in sprite's name", + "stretch: whether to stretch it to the stage's size" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCamera", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Kamera der Bühne zurück" + "description": "Fügt einen Hintergrund hinzu; bei stretch == true wird er auf Bühnengröße gedehnt" } } }, { - "id": "Stage/getColor()", - "memberId": "Stage/getColor", + "id": "Stage/addSound(String,String)", + "memberId": "Stage/addSound", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getColor", + "methodName": "addSound", "static": false, - "returnType": "Color", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current color of the stage.", - "description": "Returns the current color of the stage.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "soundPath" + ], + "params": [ + "String name", + "String soundPath" + ], + "summary": "Adds a sound (WAV or OGG).", + "description": "Adds a sound (WAV or OGG).", "scratchblock": null, - "paramDocs": [], - "returns": "the current color", + "paramDocs": [ + "name: the sound's name, for [playSound(String)](playSound)", + "soundPath: the sound file" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Hintergrundfarbe zurück" + "description": "Fügt einen Klang unter eigenem Namen hinzu" } } }, { - "id": "Stage/getCurrentBackdropIndex()", - "memberId": "Stage/getCurrentBackdropIndex", + "id": "Stage/addSound(String)", + "memberId": "Stage/addSound", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getCurrentBackdropIndex", + "methodName": "addSound", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current backdrop index", - "description": "Returns the current backdrop index", - "scratchblock": "(backdrop [number v])", - "paramDocs": [], - "returns": "a backdrop index", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "soundPath" + ], + "params": [ + "String soundPath" + ], + "summary": "Adds a sound, named after its file.", + "description": "Adds a sound, named after its file.", + "scratchblock": null, + "paramDocs": [ + "soundPath: the sound file" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropIndex", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Nummer des aktuellen Hintergrunds zurück" + "description": "Fügt einen der eingebauten Klänge hinzu" } } }, { - "id": "Stage/getCurrentBackdropName()", - "memberId": "Stage/getCurrentBackdropName", + "id": "Stage/ask(String)", + "memberId": "Stage/ask", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getCurrentBackdropName", + "methodName": "ask", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current backdrop name", - "description": "Returns the current backdrop name", - "scratchblock": "(backdrop [name v])", - "paramDocs": [], - "returns": "a backdrop name", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "question" + ], + "params": [ + "String question" + ], + "summary": "Asks a question in a box along the bottom of the stage, as Scratch does, with a field to type\nthe answer in. Enter or the check button finishes it: then [isAsking()](isAsking) is false and [getAnswer()](getAnswer) has the answer.\nWhile a question is open, keys go to the answer box, not to the stage and its sprites.", + "description": "Asks a question in a box along the bottom of the stage, as Scratch does, with a field to type\nthe answer in. Enter or the check button finishes it: then [isAsking()](isAsking) is false and [getAnswer()](getAnswer) has the answer.\nWhile a question is open, keys go to the answer box, not to the stage and its sprites.", + "scratchblock": "ask [question] and wait", + "paramDocs": [ + "question: the question" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropName", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/ask", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Namen des aktuellen Hintergrunds zurück" + "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" } } }, { - "id": "Stage/getDeltaTime()", - "memberId": "Stage/getDeltaTime", + "id": "Stage/broadcast(String)", + "memberId": "Stage/broadcast", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getDeltaTime", + "methodName": "broadcast", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Gets the seconds passed since the last frame.", - "description": "Gets the seconds passed since the last frame.", - "scratchblock": null, - "paramDocs": [], - "returns": "secons since last frame", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "message" + ], + "params": [ + "String message" + ], + "summary": "Sends a message to every sprite and then the stage; their `whenIReceive` runs at once.", + "description": "Sends a message to every sprite and then the stage; their `whenIReceive` runs at once.", + "scratchblock": "broadcast [message v]", + "paramDocs": [ + "message: the message" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getDeltaTime", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/broadcast", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" + "description": "Sendet eine Nachricht an alle whenIReceive-Empfänger" } } }, { - "id": "Stage/getFrameRate()", - "memberId": "Stage/getFrameRate", + "id": "Stage/changeColorEffect(double)", + "memberId": "Stage/changeColorEffect", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getFrameRate", + "methodName": "changeColorEffect", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Get the frame rate of the application.", - "description": "Get the frame rate of the application.", - "scratchblock": null, - "paramDocs": [], - "returns": "the frame rate", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [color v] effect by (by)", + "paramDocs": [ + "by: how much to change the backdrop's colour effect" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getFrameRate", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die aktuelle Bildrate zurück" - } - } + "translations": {} }, { - "id": "Stage/getHeight()", - "memberId": "Stage/getHeight", + "id": "Stage/changeTransparency(double)", + "memberId": "Stage/changeTransparency", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getHeight", + "methodName": "changeTransparency", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "scratchblock": null, - "paramDocs": [], - "returns": "the height of the sprite", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [ghost v] effect by (step)", + "paramDocs": [ + "by: how much to change the backdrop's transparency" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Höhe der Bühne in Pixeln zurück" + "description": "Ändert die Transparenz des Hintergrunds" } } }, { - "id": "Stage/getMouse()", - "memberId": "Stage/getMouse", + "id": "Stage/changeVolume(double)", + "memberId": "Stage/changeVolume", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getMouse", + "methodName": "changeVolume", "static": false, - "returnType": "Vector2", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current position of the mouse cursor as a Vector2", - "description": "Returns the current position of the mouse cursor as a Vector2", - "scratchblock": null, - "paramDocs": [], - "returns": "mouse position", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change volume by (step)", + "paramDocs": [ + "by: how much to change the volume" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouse", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Position des Mauszeigers zurück" + "description": "Ändert die Lautstärke um den angegebenen Wert" } } }, { - "id": "Stage/getMouseX()", - "memberId": "Stage/getMouseX", + "id": "Stage/constructor()", + "memberId": "Stage/constructor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getMouseX", + "methodName": "constructor", "static": false, - "returnType": "double", + "returnType": "Stage", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current x-position of the mouse cursor", - "description": "Returns the current x-position of the mouse cursor", - "scratchblock": "(mouse x)", + "summary": "A stage the size of the window.", + "description": "A stage the size of the window.", + "scratchblock": null, "paramDocs": [], - "returns": "x-position", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die x-Position des Mauszeigers zurück" + "description": "Erzeugt eine Bühne. Sie ist so groß wie das Fenster, das es schon geben muss" } } }, { - "id": "Stage/getMouseY()", - "memberId": "Stage/getMouseY", + "id": "Stage/count(Class)", + "memberId": "Stage/count", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getMouseY", + "methodName": "count", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current y-position of the mouse cursor", - "description": "Returns the current y-position of the mouse cursor", - "scratchblock": "(mouse y)", - "paramDocs": [], - "returns": "y-position", + "returnType": "int", + "parameterTypes": [ + "java.lang.Class" + ], + "parameterNames": [ + "type" + ], + "params": [ + "Class type" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "type: a class of sprites" + ], + "returns": "how many sprites of that class are on the stage", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/count", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die y-Position des Mauszeigers zurück" + "description": "Gibt die Anzahl der Figuren dieser Klasse zurück, z.B. count(Apfel.class)" } } }, { - "id": "Stage/getPixels()", - "memberId": "Stage/getPixels", + "id": "Stage/debug(Object[])", + "memberId": "Stage/debug", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getPixels", + "methodName": "debug", "static": false, - "returnType": "Pixels", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the colours of everything this stage has drawn.", - "description": "Returns the colours of everything this stage has drawn.\n\nExample usage:\n\n```java\nint[] colours = this.getPixels().main();\n```", + "returnType": "void", + "parameterTypes": [ + "java.lang.Object[]" + ], + "parameterNames": [ + "values" + ], + "params": [ + "Object[] values" + ], + "summary": "Prints values for debugging, but only while debug mode is on.", + "description": "Prints values for debugging, but only while debug mode is on.", "scratchblock": null, - "paramDocs": [], - "returns": "the pixels", + "paramDocs": [ + "values: what to print" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getPixels", - "availability": "desktop-only", - "availabilityReason": "The desktop pixel buffer is not exposed by the browser renderer.", - "translations": { - "de": { - "description": "Nur in der Desktop-Version: Zugriff auf einzelne Bildpunkte" - } - } + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/debug", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} }, { - "id": "Stage/getShaders()", - "memberId": "Stage/getShaders", + "id": "Stage/display(String)", + "memberId": "Stage/display", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getShaders", + "methodName": "display", "static": false, - "returnType": "Shaders", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shaders of this stage. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.", - "description": "Returns the shaders of this stage. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.\n\nExample usage:\n\n```java\nthis.getShaders().add(\"blur\", \"blur.frag\", null);\nthis.getShaders().switchTo(\"blur\");\n```\n\nSeveral shaders can be active at once with `activate`: the stage\ndraws with each in turn, in the order they were added.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "text" + ], + "params": [ + "String text" + ], + "summary": "Shows a text in a band along the bottom of the stage until something else is displayed; an\nempty text removes the band.", + "description": "Shows a text in a band along the bottom of the stage until something else is displayed; an\nempty text removes the band.", "scratchblock": null, - "paramDocs": [], - "returns": "the shaders", + "paramDocs": [ + "text: what to show" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getShaders", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Shader der Bühne zurück; sie verändern das ganze Bild ohne die UI" + "description": "Zeigt einen Text am unteren Rand der Bühne an" } } }, { - "id": "Stage/getSorting()", - "memberId": "Stage/getSorting", + "id": "Stage/display(String,double)", + "memberId": "Stage/display", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getSorting", + "methodName": "display", "static": false, - "returnType": "Sorting", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the order in which the sprites of this stage are drawn.", - "description": "Returns the order in which the sprites of this stage are drawn.\n\nExample usage:\n\n```java\nthis.getSorting().byY();\n```", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "double" + ], + "parameterNames": [ + "text", + "seconds" + ], + "params": [ + "String text", + "double seconds" + ], + "summary": "Shows a text in a band along the bottom of the stage for a number of seconds of game time.", + "description": "Shows a text in a band along the bottom of the stage for a number of seconds of game time.", "scratchblock": null, - "paramDocs": [], - "returns": "the sorting", + "paramDocs": [ + "text: what to show", + "seconds: how long" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getSorting", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Sortierung der Bühne zurück. Mit getSorting().byY() werden Figuren weiter unten vor denen weiter oben gezeichnet." - } - } + "translations": {} }, { - "id": "Stage/getTimer()", - "memberId": "Stage/getTimer", + "id": "Stage/eraseAll()", + "memberId": "Stage/eraseAll", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getTimer", + "methodName": "eraseAll", "static": false, - "returnType": "Timer", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the timer", - "description": "Returns the timer", - "scratchblock": "(timer)", + "summary": "Erases everything every pen drew and everything stamped, on every layer.", + "description": "Erases everything every pen drew and everything stamped, on every layer.", + "scratchblock": "erase all", "paramDocs": [], - "returns": "the timer", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTimer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/eraseAll", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Standard-Timer der Bühne zurück" + "description": "Löscht alles, was mit Stiften gezeichnet wurde" } } }, { - "id": "Stage/getTimer(String)", - "memberId": "Stage/getTimer", + "id": "Stage/extension(Class,Supplier)", + "memberId": "Stage/extension", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getTimer", + "methodName": "extension", "static": false, - "returnType": "Timer", + "returnType": "T", "parameterTypes": [ - "java.lang.String" + "java.lang.Class", + "java.util.function.Supplier" ], "parameterNames": [ - "name" + "type", + "factory" ], "params": [ - "String name" + "Class type", + "Supplier factory" ], - "summary": "Returns a timer by name", - "description": "Returns a timer by name", + "summary": "An extension's state for this stage, made on first use. For extensions, not for learner code.", + "description": "An extension's state for this stage, made on first use. For extensions, not for learner code.", "scratchblock": null, "paramDocs": [ - "name: a name" + "type: the state's class", + "factory: makes it" ], - "returns": "the timer", + "returns": "the stage's one instance", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTimer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/extension", + "availability": "desktop-only", + "availabilityReason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others.", + "translations": {} + }, + { + "id": "Stage/find(Class)", + "memberId": "Stage/find", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "find", + "static": false, + "returnType": "List", + "parameterTypes": [ + "java.lang.Class" + ], + "parameterNames": [ + "type" + ], + "params": [ + "Class type" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "type: a class of sprites" + ], + "returns": "every sprite of that class (subclasses included), back to front", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/find", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Timer mit dem angegebenen Namen zurück und legt ihn bei Bedarf an" + "description": "Gibt alle Figuren dieser Klasse zurück, z.B. find(Apfel.class)" } } }, { - "id": "Stage/getVolume()", - "memberId": "Stage/getVolume", + "id": "Stage/getAll()", + "memberId": "Stage/getAll", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getVolume", + "methodName": "getAll", "static": false, - "returnType": "double", + "returnType": "List", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns how loud the sounds of this stage play.", - "description": "Returns how loud the sounds of this stage play.", - "scratchblock": "(volume)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "the volume, from 0 to 100", + "returns": "every sprite on the stage, back to front, layer by layer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAll", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Lautstärke in Prozent zurück" + "description": "Gibt alle Figuren auf der Bühne zurück" } } }, { - "id": "Stage/getWidth()", - "memberId": "Stage/getWidth", + "id": "Stage/getAnswer()", + "memberId": "Stage/getAnswer", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getWidth", + "methodName": "getAnswer", "static": false, - "returnType": "int", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "(answer)", "paramDocs": [], - "returns": "the width of the sprite", + "returns": "the answer to the last question, \"\" before the first", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAnswer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Breite der Bühne in Pixeln zurück" + "description": "Gibt die zuletzt eingegebene Antwort zurück, sonst eine leere Zeichenkette" } } }, { - "id": "Stage/hideVariable(String)", - "memberId": "Stage/hideVariable", + "id": "Stage/getCamera()", + "memberId": "Stage/getCamera", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "hideVariable", + "methodName": "getCamera", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "description": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "scratchblock": "hide variable [name v]", - "paramDocs": [ - "name: the name the monitor was shown with" - ], - "returns": null, + "returnType": "Camera", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the stage's camera", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/hideVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCamera", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt die Kamera der Bühne zurück" + } + } }, { - "id": "Stage/isAsking()", - "memberId": "Stage/isAsking", + "id": "Stage/getColor()", + "memberId": "Stage/getColor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isAsking", + "methodName": "getColor", "static": false, - "returnType": "boolean", + "returnType": "Color", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether a question is on screen and still waiting for an answer.", - "description": "Checks whether a question is on screen and still waiting for an answer.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true while a question is waiting", + "returns": "the colour behind the backdrop", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isAsking", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" + "description": "Gibt die Hintergrundfarbe zurück" } } }, { - "id": "Stage/isDebug()", - "memberId": "Stage/isDebug", + "id": "Stage/getColorEffect()", + "memberId": "Stage/getColorEffect", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isDebug", + "methodName": "getColorEffect", "static": false, - "returnType": "boolean", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the application is in debug mode.", - "description": "Checks if the application is in debug mode.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true if the application is in debug mode, false otherwise.", + "returns": "the backdrop's colour effect", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isDebug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn die Fehlersuche eingeschaltet ist" - } - } + "translations": {} }, { - "id": "Stage/isKeyPressed(KeyCode)", - "memberId": "Stage/isKeyPressed", + "id": "Stage/getCurrentBackdropIndex()", + "memberId": "Stage/getCurrentBackdropIndex", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isKeyPressed", + "methodName": "getCurrentBackdropIndex", "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.KeyCode" - ], - "parameterNames": [ - "keyCode" - ], - "params": [ - "KeyCode keyCode" - ], - "summary": "Returns true if the key is pressed", - "description": "Returns true if the key is pressed", - "scratchblock": "<key [space v] pressed?>", - "paramDocs": [ - "keyCode: a key" - ], - "returns": "key pressed", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(backdrop [number v])", + "paramDocs": [], + "returns": "the current backdrop's number, counting from 0", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropIndex", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" + "description": "Gibt die Nummer des aktuellen Hintergrunds zurück" } } }, { - "id": "Stage/isMouseDown()", - "memberId": "Stage/isMouseDown", + "id": "Stage/getCurrentBackdropName()", + "memberId": "Stage/getCurrentBackdropName", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isMouseDown", + "methodName": "getCurrentBackdropName", "static": false, - "returnType": "boolean", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true is the mouse button is down", - "description": "Returns true is the mouse button is down", - "scratchblock": "<mouse down?>", + "summary": "", + "description": "", + "scratchblock": "(backdrop [name v])", "paramDocs": [], - "returns": "mouse button down", + "returns": "the current backdrop's name, or null without backdrops", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isMouseDown", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" + "description": "Gibt den Namen des aktuellen Hintergrunds zurück" } } }, { - "id": "Stage/isSoundPlaying(String)", - "memberId": "Stage/isSoundPlaying", + "id": "Stage/getHeight()", + "memberId": "Stage/getHeight", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isSoundPlaying", + "methodName": "getHeight", "static": false, - "returnType": "boolean", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Returns true if the sound if playing", - "description": "Returns true if the sound if playing", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "name: " - ], - "returns": "playing", + "paramDocs": [], + "returns": "the stage's height in stage pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isSoundPlaying", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" + "description": "Gibt die Höhe der Bühne in Pixeln zurück" } } }, { - "id": "Stage/nextBackdrop()", - "memberId": "Stage/nextBackdrop", + "id": "Stage/getMouse()", + "memberId": "Stage/getMouse", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "nextBackdrop", + "methodName": "getMouse", "static": false, - "returnType": "void", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to the next backdrop.", - "description": "Switch to the next backdrop.", - "scratchblock": "next backdrop", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the mouse pointer in world coordinates", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/nextBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouse", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum nächsten Hintergrund" + "description": "Gibt die Position des Mauszeigers zurück" } } }, { - "id": "Stage/pickRandom(int,int)", - "memberId": "Stage/pickRandom", + "id": "Stage/getMouseX()", + "memberId": "Stage/getMouseX", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "pickRandom", + "methodName": "getMouseX", "static": false, - "returnType": "int", - "parameterTypes": [ - "int", - "int" - ], - "parameterNames": [ - "from", - "to" - ], - "params": [ - "int from", - "int to" - ], - "summary": "Returns a random integer between the specified range (inclusive).", - "description": "Returns a random integer between the specified range (inclusive).", - "scratchblock": "(pick random (from) to (to))", - "paramDocs": [ - "from: the lower bound of the range (inclusive)", - "to: the upper bound of the range (inclusive)" - ], - "returns": "a random integer between `from` and `to` (inclusive)", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(mouse x)", + "paramDocs": [], + "returns": "x of the mouse pointer in world coordinates", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/pickRandom", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" + "description": "Gibt die x-Position des Mauszeigers zurück" } } }, { - "id": "Stage/playSound(String)", - "memberId": "Stage/playSound", + "id": "Stage/getMouseY()", + "memberId": "Stage/getMouseY", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "playSound", + "methodName": "getMouseY", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Plays a sound.", - "description": "Plays a sound.\n\nplaySoundCopy() returns an independent SoundPlayback with its own volume\nand can overlap earlier plays of the same sound.", - "scratchblock": "start sound [name v]", - "paramDocs": [ - "name: the sound name" - ], - "returns": null, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(mouse y)", + "paramDocs": [], + "returns": "y of the mouse pointer in world coordinates", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Spielt einen zuvor hinzugefügten Klang ab" + "description": "Gibt die y-Position des Mauszeigers zurück" } } }, { - "id": "Stage/playSoundCopy(String,double)", - "memberId": "Stage/playSoundCopy", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "playSoundCopy", - "static": false, - "returnType": "SoundPlayback", - "parameterTypes": [ - "java.lang.String", - "double" - ], - "parameterNames": [ - "name", - "volume" - ], - "params": [ - "String name", - "double volume" - ], - "summary": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this stage.\nThe stage's ordinary volume does not change a copy's explicit volume.", - "description": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this stage.\nThe stage's ordinary volume does not change a copy's explicit volume.", - "scratchblock": null, - "paramDocs": [ - "name: a sound already added with addSound()", - "volume: volume from 0 to 100 percent" - ], - "returns": "this individual playback, also usable in try-with-resources", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSoundCopy", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Stage/previousBackdrop()", - "memberId": "Stage/previousBackdrop", + "id": "Stage/getShaders()", + "memberId": "Stage/getShaders", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "previousBackdrop", + "methodName": "getShaders", "static": false, - "returnType": "void", + "returnType": "Shaders", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to the previous backdrop.", - "description": "Switch to the previous backdrop.", - "scratchblock": "switch backdrop to [previous backdrop v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the stage's shaders, applied to the picture of its world layers", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/previousBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getShaders", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum vorherigen Hintergrund" + "description": "Gibt die Shader der Bühne zurück; sie verändern das ganze Bild ohne die UI" } } }, { - "id": "Stage/randomBackdrop()", - "memberId": "Stage/randomBackdrop", + "id": "Stage/getTimer()", + "memberId": "Stage/getTimer", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "randomBackdrop", + "methodName": "getTimer", "static": false, - "returnType": "void", + "returnType": "Timer", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to a random backdrop.", - "description": "Switch to a random backdrop.", - "scratchblock": "switch backdrop to [random backdrop v]", + "summary": "", + "description": "", + "scratchblock": "(timer)", "paramDocs": [], - "returns": null, + "returns": "this object's timer, counting game time since it was made or reset", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/randomBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTimer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zu einem zufälligen Hintergrund" + "description": "Gibt den Standard-Timer der Bühne zurück" } } }, { - "id": "Stage/remove(Sprite)", - "memberId": "Stage/remove", + "id": "Stage/getTransparency()", + "memberId": "Stage/getTransparency", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "getTransparency", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "sprite" - ], - "params": [ - "Sprite sprite" - ], - "summary": "Removes the specified sprite from the stage.", - "description": "Removes the specified sprite from the stage.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "sprite: the sprite to be removed" - ], - "returns": null, + "paramDocs": [], + "returns": "the backdrop's transparency in percent", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Entfernt die Figur von der Bühne" - } - } + "translations": {} }, { - "id": "Stage/remove(Pen)", - "memberId": "Stage/remove", + "id": "Stage/getVolume()", + "memberId": "Stage/getVolume", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "getVolume", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Pen" - ], - "parameterNames": [ - "pen" - ], - "params": [ - "Pen pen" - ], - "summary": "Removes the specified pen from the stage.", - "description": "Removes the specified pen from the stage.", - "scratchblock": null, - "paramDocs": [ - "pen: the pen to be removed" - ], - "returns": null, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(volume)", + "paramDocs": [], + "returns": "this object's volume from 0 to 100", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt den Stift von der Bühne" + "description": "Gibt die Lautstärke in Prozent zurück" } } }, { - "id": "Stage/remove(Text)", - "memberId": "Stage/remove", + "id": "Stage/getWidth()", + "memberId": "Stage/getWidth", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "getWidth", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Text" - ], - "parameterNames": [ - "text" - ], - "params": [ - "Text text" - ], - "summary": "Removes the specified text from the stage.", - "description": "Removes the specified text from the stage.", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "text: the text to be removed" - ], - "returns": null, + "paramDocs": [], + "returns": "the stage's width in stage pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt den Text von der Bühne" + "description": "Gibt die Breite der Bühne in Pixeln zurück" } } }, { - "id": "Stage/remove(Class)", - "memberId": "Stage/remove", + "id": "Stage/hideVariable(String)", + "memberId": "Stage/hideVariable", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "hideVariable", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.Class" + "java.lang.String" ], "parameterNames": [ - "c" + "name" ], "params": [ - "Class c" + "String name" ], - "summary": "Removes all sprites of the specified class from the stage.", - "description": "Removes all sprites of the specified class from the stage.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "hide variable [name v]", "paramDocs": [ - "c: the class of the sprites to remove" + "name: the label of a variable to hide again" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/hideVariable", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Entfernt alle Figuren dieser Klasse von der Bühne, z.B. remove(Apfel.class)" - } - } + "translations": {} }, { - "id": "Stage/removeAll()", - "memberId": "Stage/removeAll", + "id": "Stage/isAsking()", + "memberId": "Stage/isAsking", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "removeAll", + "methodName": "isAsking", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes all elements from the stage.", - "description": "Removes all elements from the stage.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether a question is waiting for its answer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/removeAll", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isAsking", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt alle Figuren von der Bühne" + "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" } } }, { - "id": "Stage/run()", - "memberId": "Stage/run", + "id": "Stage/isKeyPressed(KeyCode)", + "memberId": "Stage/isKeyPressed", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "run", + "methodName": "isKeyPressed", "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Executes the main logic of the stage. This method should be overridden by\nsubclasses to define\nthe specific behavior of the stage.", - "description": "Executes the main logic of the stage. This method should be overridden by\nsubclasses to define\nthe specific behavior of the stage.", - "scratchblock": null, - "paramDocs": [], - "returns": null, + "returnType": "boolean", + "parameterTypes": [ + "org.openpatch.scratch.KeyCode" + ], + "parameterNames": [ + "key" + ], + "params": [ + "KeyCode key" + ], + "summary": "", + "description": "", + "scratchblock": "<key [space v] pressed?>", + "paramDocs": [ + "key: a key" + ], + "returns": "whether the key is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/run", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird in jedem Frame aufgerufen" + "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" } } }, { - "id": "Stage/setColor(double)", - "memberId": "Stage/setColor", + "id": "Stage/isMouseDown()", + "memberId": "Stage/isMouseDown", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setColor", + "methodName": "isMouseDown", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "h" - ], - "params": [ - "double h" - ], - "summary": "Sets the background color via a hue value", - "description": "Sets the background color via a hue value", - "scratchblock": null, - "paramDocs": [ - "h: a hue value [0...255]" - ], - "returns": null, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "<mouse down?>", + "paramDocs": [], + "returns": "whether a mouse button is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isMouseDown", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe über den Farbton (0 bis 255)" + "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" } } }, { - "id": "Stage/setColor(double,double,double)", - "memberId": "Stage/setColor", + "id": "Stage/isSoundPlaying(String)", + "memberId": "Stage/isSoundPlaying", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setColor", + "methodName": "isSoundPlaying", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ - "double", - "double", - "double" + "java.lang.String" ], "parameterNames": [ - "r", - "g", - "b" + "name" ], "params": [ - "double r", - "double g", - "double b" + "String name" ], - "summary": "Sets the background color via a rgb value", - "description": "Sets the background color via a rgb value", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" + "name: a sound's name" ], - "returns": null, + "returns": "whether it is playing", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isSoundPlaying", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" + "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" } } }, { - "id": "Stage/setColor(Color)", - "memberId": "Stage/setColor", + "id": "Stage/nextBackdrop()", + "memberId": "Stage/nextBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setColor", + "methodName": "nextBackdrop", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the color of the stage.", - "description": "Sets the color of the stage.", - "scratchblock": null, - "paramDocs": [ - "c: the new color to be set" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the next backdrop, after the last to the first.", + "description": "Switches to the next backdrop, after the last to the first.", + "scratchblock": "next backdrop", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/nextBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe" + "description": "Wechselt zum nächsten Hintergrund" } } }, { - "id": "Stage/setCursor(String)", - "memberId": "Stage/setCursor", + "id": "Stage/pickRandom(int,int)", + "memberId": "Stage/pickRandom", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setCursor", + "methodName": "pickRandom", "static": false, - "returnType": "void", + "returnType": "int", "parameterTypes": [ - "java.lang.String" + "int", + "int" ], "parameterNames": [ - "path" + "from", + "to" ], "params": [ - "String path" + "int from", + "int to" ], - "summary": "Sets the cursor image for the stage.", - "description": "Sets the cursor image for the stage.", - "scratchblock": null, + "summary": "A random whole number between two numbers, both included.", + "description": "A random whole number between two numbers, both included.", + "scratchblock": "(pick random (from) to (to))", "paramDocs": [ - "path: a path to an image file, or the name of a built-in sprite" + "from: the lowest", + "to: the highest" ], - "returns": null, + "returns": "the number", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/pickRandom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt das Mauszeigerbild" + "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" } } }, { - "id": "Stage/setCursor(String,int,int)", - "memberId": "Stage/setCursor", + "id": "Stage/playSound(String)", + "memberId": "Stage/playSound", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setCursor", + "methodName": "playSound", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "path", - "x", - "y" + "name" ], "params": [ - "String path", - "int x", - "int y" + "String name" ], - "summary": "Sets the cursor image and its active spot coordinates.", - "description": "Sets the cursor image and its active spot coordinates.", - "scratchblock": null, + "summary": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "description": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "scratchblock": "start sound [name v]", "paramDocs": [ - "path: a path to an image file, or the name of a built-in sprite", - "x: the x-coordinate of the cursor's active spot", - "y: the y-coordinate of the cursor's active spot" + "name: the sound's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt das Mauszeigerbild mit eigenem Aktivpunkt" + "description": "Spielt einen zuvor hinzugefügten Klang ab" } } }, { - "id": "Stage/setDebug(boolean)", - "memberId": "Stage/setDebug", + "id": "Stage/playSoundCopy(String,double)", + "memberId": "Stage/playSoundCopy", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setDebug", + "methodName": "playSoundCopy", "static": false, - "returnType": "void", + "returnType": "SoundPlayback", "parameterTypes": [ - "boolean" + "java.lang.String", + "double" ], "parameterNames": [ - "debug" + "name", + "volume" ], "params": [ - "boolean debug" + "String name", + "double volume" ], - "summary": "Enables or disables the debug mode for the application.", - "description": "Enables or disables the debug mode for the application.", + "summary": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "description": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", "scratchblock": null, "paramDocs": [ - "debug: a boolean value where `true` enables debug mode and\n `false` disables\n it." + "name: the sound's name", + "volume: the copy's volume from 0 to 100" ], + "returns": "the copy, to stop it or change its volume", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSoundCopy", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/previousBackdrop()", + "memberId": "Stage/previousBackdrop", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "previousBackdrop", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the previous backdrop, before the first to the last.", + "description": "Switches to the previous backdrop, before the first to the last.", + "scratchblock": "switch backdrop to [previous backdrop v]", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setDebug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/previousBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Schaltet die Ausgabe von debug() ein oder aus" + "description": "Wechselt zum vorherigen Hintergrund" } } }, { - "id": "Stage/setTint(double,double,double)", - "memberId": "Stage/setTint", + "id": "Stage/randomBackdrop()", + "memberId": "Stage/randomBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setTint", + "methodName": "randomBackdrop", "static": false, "returnType": "void", - "parameterTypes": [ - "double", - "double", - "double" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "double r", - "double g", - "double b" - ], - "summary": "Sets the colour the backdrop is tinted with.", - "description": "Sets the colour the backdrop is tinted with.", - "scratchblock": null, - "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to a random backdrop other than the current one (if there is another).", + "description": "Switches to a random backdrop other than the current one (if there is another).", + "scratchblock": "switch backdrop to [random backdrop v]", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/randomBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt den Hintergrund ein (Anteile jeweils 0 bis 255)" + "description": "Wechselt zu einem zufälligen Hintergrund" } } }, { - "id": "Stage/setTint(double)", - "memberId": "Stage/setTint", + "id": "Stage/remove(Text)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setTint", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Text" ], "parameterNames": [ - "h" + "text" ], "params": [ - "double h" + "Text text" ], - "summary": "Sets the colour the backdrop is tinted with, as a hue.", - "description": "Sets the colour the backdrop is tinted with, as a hue.", - "scratchblock": "set [color v] effect to (h)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "h: " + "text: a text of its own to remove" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt den Hintergrund mit dem angegebenen Farbton ein (0 bis 255)" + "description": "Entfernt den Text von der Bühne" } } }, { - "id": "Stage/setTransparency(double)", - "memberId": "Stage/setTransparency", + "id": "Stage/remove(Sprite)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setTransparency", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "transparency" + "sprite" ], "params": [ - "double transparency" + "Sprite sprite" ], - "summary": "Sets how see-through the backdrop is, as Scratch's ghost effect does: 0 is\nthe solid backdrop you start with and 100 is invisible.", - "description": "Sets how see-through the backdrop is, as Scratch's ghost effect does: 0 is\nthe solid backdrop you start with and 100 is invisible.", - "scratchblock": "set [ghost v] effect to (transparency)", + "summary": "Removes a sprite.", + "description": "Removes a sprite.", + "scratchblock": null, "paramDocs": [ - "transparency: [0...100], 0 solid and 100 invisible" + "sprite: the sprite" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Transparenz des Hintergrunds in Prozent" + "description": "Entfernt die Figur von der Bühne" } } }, { - "id": "Stage/setVolume(double)", - "memberId": "Stage/setVolume", + "id": "Stage/remove(Pen)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setVolume", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Pen" ], "parameterNames": [ - "percent" + "pen" ], "params": [ - "double percent" + "Pen pen" ], - "summary": "Sets how loud every sound of this stage plays.", - "description": "Sets how loud every sound of this stage plays.", - "scratchblock": "set volume to (percent) %", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "percent: 0 for silent, 100 for full volume" + "pen: a pen of its own to remove" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Lautstärke in Prozent" + "description": "Entfernt den Stift von der Bühne" } } }, { - "id": "Stage/showVariable(String,Supplier)", - "memberId": "Stage/showVariable", + "id": "Stage/remove(Class)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "showVariable", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.util.function.Supplier" + "java.lang.Class" ], "parameterNames": [ - "name", - "value" + "type" ], "params": [ - "String name", - "Supplier value" + "Class type" ], - "summary": "Shows a monitor for a variable in the top left corner of the stage, like\nScratch's variable monitors: the name and the current value, updated every\nframe. Showing the same name again replaces the monitor.", - "description": "Shows a monitor for a variable in the top left corner of the stage, like\nScratch's variable monitors: the name and the current value, updated every\nframe. Showing the same name again replaces the monitor.\n\n```java\nthis.showVariable(\"score\", () -> score);\n```", - "scratchblock": "show variable [name v]", + "summary": "Removes every sprite of a class (subclasses included).", + "description": "Removes every sprite of a class (subclasses included).", + "scratchblock": null, "paramDocs": [ - "name: what the monitor says", - "value: gives the value to show; asked for it every frame" + "type: the class" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/showVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt den Wert einer Variablen auf der Bühne an" + "description": "Entfernt alle Figuren dieser Klasse von der Bühne, z.B. remove(Apfel.class)" } } }, { - "id": "Stage/stopAllSounds()", - "memberId": "Stage/stopAllSounds", + "id": "Stage/removeAll()", + "memberId": "Stage/removeAll", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "stopAllSounds", + "methodName": "removeAll", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Stops the playing of all sounds of the stage.", - "description": "Stops the playing of all sounds of the stage.", - "scratchblock": "stop all sounds", + "summary": "Removes every sprite, text and pen: an empty stage (backdrops and what was drawn stay).", + "description": "Removes every sprite, text and pen: an empty stage (backdrops and what was drawn stay).", + "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopAllSounds", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/removeAll", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Stoppt alle Klänge der Bühne" + "description": "Entfernt alle Figuren von der Bühne" } } }, { - "id": "Stage/stopSound(String)", - "memberId": "Stage/stopSound", + "id": "Stage/run()", + "memberId": "Stage/run", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "stopSound", + "methodName": "run", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Stops the playing of the sound with the given name", - "description": "Stops the playing of the sound with the given name", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Runs every tick before the sprites' `run()`. Override it with the stage's code.", + "description": "Runs every tick before the sprites' `run()`. Override it with the stage's code.", "scratchblock": null, - "paramDocs": [ - "name: Name of the sound" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/run", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Stoppt den Klang mit dem angegebenen Namen" + "description": "Wird in jedem Frame aufgerufen" } } }, { - "id": "Stage/switchBackdrop(String)", - "memberId": "Stage/switchBackdrop", + "id": "Stage/setColor(Color)", + "memberId": "Stage/setColor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "switchBackdrop", + "methodName": "setColor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "name" + "color" ], "params": [ - "String name" + "Color color" ], - "summary": "Switch to a backdrop by name.", - "description": "Switch to a backdrop by name.", - "scratchblock": "switch backdrop to [name v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "name: the name of a backdrop" + "color: the colour behind the backdrop" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/switchBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum Hintergrund mit dem angegebenen Namen" + "description": "Setzt die Hintergrundfarbe" } } }, { - "id": "Stage/wait(int)", - "memberId": "Stage/wait", + "id": "Stage/setColor(double,double,double)", + "memberId": "Stage/setColor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "wait", + "methodName": "setColor", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double", + "double", + "double" ], "parameterNames": [ - "millis" + "red", + "green", + "blue" ], "params": [ - "int millis" + "double red", + "double green", + "double blue" ], - "summary": "Stop the execution of the whole applications for the given milliseconds.", - "description": "Stop the execution of the whole applications for the given milliseconds.", - "scratchblock": "wait (millis) seconds", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "millis: Milliseconds" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/wait", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Pausiert das Programm für die angegebene Zeit in Millisekunden" + "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" } } }, { - "id": "Stage/waitUntil(BooleanSupplier)", - "memberId": "Stage/waitUntil", + "id": "Stage/setColorEffect(double)", + "memberId": "Stage/setColorEffect", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "waitUntil", + "methodName": "setColorEffect", "static": false, "returnType": "void", "parameterTypes": [ - "java.util.function.BooleanSupplier" + "double" ], "parameterNames": [ - "condition" + "value" ], "params": [ - "BooleanSupplier condition" + "double value" ], - "summary": "Waits until something becomes true, then carries on.", - "description": "Waits until something becomes true, then carries on.\n\nLike [wait(int)](wait) this holds up the code that calls it, not the whole\nprogram: sprites keep running and the stage keeps drawing while it waits.\nThat makes it useful for setting a scene up in a constructor, and a bad idea\ninside `run()`, which is called once per frame and should return quickly.\n\n```java\nthis.ask(\"What is your name?\");\nthis.waitUntil(() -> !this.isAsking());\nthis.display(\"Hello \" + this.getAnswer() + \"!\");\n```", - "scratchblock": "wait until <condition>", + "summary": "Scratch's colour effect on the backdrop: shifts its colours around the colour wheel (200 is\nall the way round). Like Scratch, it gives colours too grey or too dark to show a hue a\nlittle one, so white and black are tinted too.", + "description": "Scratch's colour effect on the backdrop: shifts its colours around the colour wheel (200 is\nall the way round). Like Scratch, it gives colours too grey or too dark to show a hue a\nlittle one, so white and black are tinted too.", + "scratchblock": "set [color v] effect to (value)", "paramDocs": [ - "condition: checked over and over until it is true" + "value: the effect" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/waitUntil", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wartet, bis die Bedingung erfüllt ist" - } - } + "translations": {} }, { - "id": "Stage/whenBackdropSwitches(String)", - "memberId": "Stage/whenBackdropSwitches", + "id": "Stage/setCursor(String)", + "memberId": "Stage/setCursor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenBackdropSwitches", + "methodName": "setCursor", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "name" + "path" ], "params": [ - "String name" + "String path" ], - "summary": "This method is called when the backdrop switches to the specified name.\nOverride this method to\nadd custom behavior.", - "description": "This method is called when the backdrop switches to the specified name.\nOverride this method to\nadd custom behavior.", + "summary": "Shows an image instead of the mouse pointer while the mouse is over the stage.", + "description": "Shows an image instead of the mouse pointer while the mouse is over the stage.", "scratchblock": null, "paramDocs": [ - "name: the name of the backdrop to switch to" + "path: an image file, or a built-in sprite's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenBackdropSwitches", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Wechsel des Hintergrunds aufgerufen" + "description": "Setzt das Mauszeigerbild" } } }, { - "id": "Stage/whenIReceive(String)", - "memberId": "Stage/whenIReceive", + "id": "Stage/setCursor(String,int,int)", + "memberId": "Stage/setCursor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenIReceive", + "methodName": "setCursor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "int", + "int" ], "parameterNames": [ - "message" + "path", + "x", + "y" ], "params": [ - "String message" + "String path", + "int x", + "int y" ], - "summary": "This method is called when a specific message is received. Override this\nmethod to add custom\nbehavior.", - "description": "This method is called when a specific message is received. Override this\nmethod to add custom\nbehavior.", - "scratchblock": "when I receive [message v]", + "summary": "Shows an image instead of the mouse pointer.", + "description": "Shows an image instead of the mouse pointer.", + "scratchblock": null, "paramDocs": [ - "message: The message that triggers this method." + "path: an image file, or a built-in sprite's name", + "x: pixels from the image's left edge to the point that clicks", + "y: pixels from the image's top edge to the point that clicks" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenIReceive", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei broadcast(message) aufgerufen" + "description": "Setzt das Mauszeigerbild mit eigenem Aktivpunkt" } } }, { - "id": "Stage/whenKeyPressed(KeyCode)", - "memberId": "Stage/whenKeyPressed", + "id": "Stage/setTint(Color)", + "memberId": "Stage/setTint", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenKeyPressed", + "methodName": "setTint", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "keyCode" + "color" ], "params": [ - "KeyCode keyCode" + "Color color" ], - "summary": "This method is called when a key is pressed. Override this method to add\ncustom behavior.", - "description": "This method is called when a key is pressed. Override this method to add\ncustom behavior.", - "scratchblock": "when [space v] key pressed", + "summary": "Multiplies the backdrop by a colour. Not a Scratch block: Scratch's colour effect is\n[setColorEffect(double)](setColorEffect).", + "description": "Multiplies the backdrop by a colour. Not a Scratch block: Scratch's colour effect is\n[setColorEffect(double)](setColorEffect).", + "scratchblock": null, "paramDocs": [ - "keyCode: the key that was pressed" + "color: the tint, or null for none" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTint", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird beim Drücken der Taste aufgerufen" - } - } + "translations": {} }, { - "id": "Stage/whenKeyReleased(KeyCode)", - "memberId": "Stage/whenKeyReleased", + "id": "Stage/setTransparency(double)", + "memberId": "Stage/setTransparency", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenKeyReleased", + "methodName": "setTransparency", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "double" ], "parameterNames": [ - "keyCode" + "percent" ], "params": [ - "KeyCode keyCode" + "double percent" ], - "summary": "This method is called when a key is released. Override this method to add\ncustom behavior.", - "description": "This method is called when a key is released. Override this method to add\ncustom behavior.", - "scratchblock": null, + "summary": "Scratch's ghost effect on the backdrop: the stage colour shows through.", + "description": "Scratch's ghost effect on the backdrop: the stage colour shows through.", + "scratchblock": "set [ghost v] effect to (transparency)", "paramDocs": [ - "keyCode: the key that was released" + "percent: 0 opaque, 100 invisible" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyReleased", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Loslassen der Taste aufgerufen" + "description": "Setzt die Transparenz des Hintergrunds in Prozent" } } }, { - "id": "Stage/whenMouseClicked(MouseCode)", - "memberId": "Stage/whenMouseClicked", + "id": "Stage/setVolume(double)", + "memberId": "Stage/setVolume", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenMouseClicked", + "methodName": "setVolume", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.MouseCode" + "double" ], "parameterNames": [ - "mouseEvent" + "volume" ], "params": [ - "MouseCode mouseEvent" + "double volume" ], - "summary": "This method is called when a mouse click event occurs. Overwrite this method\nto add custom\nbehavior.", - "description": "This method is called when a mouse click event occurs. Overwrite this method\nto add custom\nbehavior.", - "scratchblock": "when stage clicked", + "summary": "", + "description": "", + "scratchblock": "set volume to (percent) %", "paramDocs": [ - "mouseEvent: The mouse event that triggered this method." + "volume: this object's volume from 0 to 100" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseClicked", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei einem Mausklick aufgerufen" + "description": "Setzt die Lautstärke in Prozent" } } }, { - "id": "Stage/whenMouseWheelMoved(int)", - "memberId": "Stage/whenMouseWheelMoved", + "id": "Stage/showVariable(String,Supplier)", + "memberId": "Stage/showVariable", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenMouseWheelMoved", + "methodName": "showVariable", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "java.lang.String", + "java.util.function.Supplier" ], "parameterNames": [ - "steps" + "name", + "value" ], "params": [ - "int steps" + "String name", + "Supplier value" ], - "summary": "This method is called when the mouse wheel is moved. Overwrite this method to\nadd custom\nbehavior.", - "description": "This method is called when the mouse wheel is moved. Overwrite this method to\nadd custom\nbehavior.", - "scratchblock": null, + "summary": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.", + "description": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.\n\n```java\nthis.showVariable(\"score\", () -> this.score);\n```", + "scratchblock": "show variable [name v]", "paramDocs": [ - "steps: the number of steps the mouse wheel has moved. Positive values\n indicate movement\n away from the user, while negative values indicate movement\n towards the user." + "name: the label", + "value: gives the value to show" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseWheelMoved", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/showVariable", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Drehen des Mausrads aufgerufen" + "description": "Zeigt den Wert einer Variablen auf der Bühne an" } } }, { - "id": "Text/addFont(String,String)", - "memberId": "Text/addFont", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "addFont", + "id": "Stage/sortBy(Comparator)", + "memberId": "Stage/sortBy", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "sortBy", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "java.util.Comparator" ], "parameterNames": [ - "name", - "path" + "comparator" ], "params": [ - "String name", - "String path" + "Comparator comparator" ], - "summary": "Adds a new font to the list of fonts if it does not already exist.", - "description": "Adds a new font to the list of fonts if it does not already exist.", + "summary": "Draws and runs the sprites of each layer in the order a comparator gives, back to front.", + "description": "Draws and runs the sprites of each layer in the order a comparator gives, back to front.", "scratchblock": null, "paramDocs": [ - "name: the name of the font to be added", - "path: the path to the font file" + "comparator: the order" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/addFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/sortBy", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/sortByY()", + "memberId": "Stage/sortByY", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "sortByY", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Draws and runs the sprites of each layer sorted by their y position: lower sprites in front,\nas in a top-down game. Applies from the next tick on, until [stopSorting()](stopSorting).", + "description": "Draws and runs the sprites of each layer sorted by their y position: lower sprites in front,\nas in a top-down game. Applies from the next tick on, until [stopSorting()](stopSorting).", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/sortByY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/stopAllSounds()", + "memberId": "Stage/stopAllSounds", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "stopAllSounds", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Stops every sound this object started.", + "description": "Stops every sound this object started.", + "scratchblock": "stop all sounds", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopAllSounds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt eine Schriftart hinzu" + "description": "Stoppt alle Klänge der Bühne" } } }, { - "id": "Text/constructor()", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/stopSorting()", + "memberId": "Stage/stopSorting", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "stopSorting", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Text object with default values. The text is initialized to an empty string,\npositioned at (0, 0), with a default size of 0. The text style is set to plain and the text\nis centred on its position, as every text is. Call [setAlign(TextAlign)](setAlign) for anything\nelse.", - "description": "Constructs a new Text object with default values. The text is initialized to an empty string,\npositioned at (0, 0), with a default size of 0. The text style is set to plain and the text\nis centred on its position, as every text is. Call [setAlign(TextAlign)](setAlign) for anything\nelse.", + "summary": "Keeps the order the sprites have now and stops sorting them.", + "description": "Keeps the order the sprites have now and stops sorting them.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopSorting", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/stopSound(String)", + "memberId": "Stage/stopSound", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "stopSound", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "name" + ], + "params": [ + "String name" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "name: the sound to stop" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt einen leeren Text in der Mitte der Bühne" + "description": "Stoppt den Klang mit dem angegebenen Namen" } } }, { - "id": "Text/constructor(Sprite)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/switchBackdrop(String)", + "memberId": "Stage/switchBackdrop", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "switchBackdrop", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "java.lang.String" ], "parameterNames": [ - "s" + "name" ], "params": [ - "Sprite s" + "String name" ], - "summary": "Constructs a new Text object associated with a given Sprite.", - "description": "Constructs a new Text object associated with a given Sprite.", - "scratchblock": null, + "summary": "Switches to the backdrop with that name and tells the stage and every sprite\n(`whenBackdropSwitches`); an unknown name changes nothing.", + "description": "Switches to the backdrop with that name and tells the stage and every sprite\n(`whenBackdropSwitches`); an unknown name changes nothing.", + "scratchblock": "switch backdrop to [name v]", "paramDocs": [ - "s: the Sprite to associate with this Text object" + "name: the backdrop's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/switchBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt einen Text an der angegebenen Position mit der angegebenen Breite" + "description": "Wechselt zum Hintergrund mit dem angegebenen Namen" } } }, { - "id": "Text/constructor(String,double,double,double)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/waitSeconds(double)", + "memberId": "Stage/waitSeconds", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "waitSeconds", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double", - "double", "double" ], "parameterNames": [ - "text", - "x", - "y", - "width" + "seconds" ], "params": [ - "String text", - "double x", - "double y", - "double width" + "double seconds" ], - "summary": "Constructs a new Text object with the specified text, position, and width.", - "description": "Constructs a new Text object with the specified text, position, and width.", + "summary": "Holds up the code that calls it for a number of seconds. Called in `main` (a program\nwritten straight down the page), the game keeps running meanwhile and the seconds are game\ntime. Called in `run()` or an event, the whole game waits, as it does for any slow\ncode; the window stays responsive.", + "description": "Holds up the code that calls it for a number of seconds. Called in `main` (a program\nwritten straight down the page), the game keeps running meanwhile and the seconds are game\ntime. Called in `run()` or an event, the whole game waits, as it does for any slow\ncode; the window stays responsive.", "scratchblock": null, "paramDocs": [ - "text: the text to be displayed", - "x: the x-coordinate of the text's position", - "y: the y-coordinate of the text's position", - "width: the width of the text" + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/waitSeconds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Text/constructor(String,double,double,double,TextStyle)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/waitUntil(BooleanSupplier)", + "memberId": "Stage/waitUntil", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "waitUntil", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double", - "double", - "double", - "org.openpatch.scratch.TextStyle" + "java.util.function.BooleanSupplier" ], "parameterNames": [ - "text", - "x", - "y", - "width", - "style" + "condition" ], "params": [ - "String text", - "double x", - "double y", - "double width", - "TextStyle style" + "BooleanSupplier condition" ], - "summary": "Constructs a new Text object with the specified text, position, width, and style.", - "description": "Constructs a new Text object with the specified text, position, width, and style.", - "scratchblock": null, + "summary": "Holds up the code that calls it until a condition is true; see [waitSeconds(double)](waitSeconds).", + "description": "Holds up the code that calls it until a condition is true; see [waitSeconds(double)](waitSeconds).", + "scratchblock": "wait until <condition>", "paramDocs": [ - "text: the text content to be displayed", - "x: the x-coordinate of the text's position", - "y: the y-coordinate of the text's position", - "width: the width of the text area", - "style: the style to be applied to the text" + "condition: checked about every millisecond" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/waitUntil", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt einen Text an der angegebenen Position, mit der angegebenen Breite und im angegebenen Stil" + "description": "Wartet, bis die Bedingung erfüllt ist" } } }, { - "id": "Text/constructor(Text)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/whenBackdropSwitches(String)", + "memberId": "Stage/whenBackdropSwitches", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenBackdropSwitches", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Text" + "java.lang.String" ], "parameterNames": [ - "t" + "name" ], "params": [ - "Text t" + "String name" ], - "summary": "Copy constructor for the Text class. Creates a new Text object by copying the properties of the\ngiven Text object.", - "description": "Copy constructor for the Text class. Creates a new Text object by copying the properties of the\ngiven Text object.", + "summary": "Called when the backdrop switches.", + "description": "Called when the backdrop switches.", "scratchblock": null, "paramDocs": [ - "t: the Text object to copy" + "name: the new backdrop's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Text/getAlign()", - "memberId": "Text/getAlign", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getAlign", - "static": false, - "returnType": "TextAlign", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns where the text sits relative to its position.", - "description": "Returns where the text sits relative to its position.", - "scratchblock": null, - "paramDocs": [], - "returns": "the alignment", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getAlign", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenBackdropSwitches", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Ausrichtung des Texts zurück" + "description": "Wird beim Wechsel des Hintergrunds aufgerufen" } } }, { - "id": "Text/getCurrentFontIndex()", - "memberId": "Text/getCurrentFontIndex", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getCurrentFontIndex", + "id": "Stage/whenIReceive(String)", + "memberId": "Stage/whenIReceive", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenIReceive", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the index of the current font.", - "description": "Returns the index of the current font.", - "scratchblock": null, - "paramDocs": [], - "returns": "the index of the current font", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "message" + ], + "params": [ + "String message" + ], + "summary": "Called when a message is broadcast.", + "description": "Called when a message is broadcast.", + "scratchblock": "when I receive [message v]", + "paramDocs": [ + "message: the message" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontIndex", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenIReceive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Nummer der aktuellen Schriftart zurück" + "description": "Wird bei broadcast(message) aufgerufen" } } }, { - "id": "Text/getCurrentFontName()", - "memberId": "Text/getCurrentFontName", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getCurrentFontName", + "id": "Stage/whenKeyPressed(KeyCode)", + "memberId": "Stage/whenKeyPressed", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenKeyPressed", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the name of the current font.", - "description": "Retrieves the name of the current font.", - "scratchblock": null, - "paramDocs": [], - "returns": "the name of the current font, or `null` if no fonts are available.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Namen der aktuellen Schriftart zurück" - } - } - }, - { - "id": "Text/getDefaultFont()", - "memberId": "Text/getDefaultFont", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getDefaultFont", - "static": true, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the font that text is written in by default.", - "description": "Returns the font that text is written in by default.", - "scratchblock": null, - "paramDocs": [], - "returns": "the path to the font file", + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.KeyCode" + ], + "parameterNames": [ + "key" + ], + "params": [ + "KeyCode key" + ], + "summary": "Called when a key is pressed, once per press.", + "description": "Called when a key is pressed, once per press.", + "scratchblock": "when [space v] key pressed", + "paramDocs": [ + "key: the key" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Standardschriftart zurück" + "description": "Wird beim Drücken der Taste aufgerufen" } } }, { - "id": "Text/getDefaultFontSize()", - "memberId": "Text/getDefaultFontSize", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getDefaultFontSize", - "static": true, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the size text is written in by default.", - "description": "Returns the size text is written in by default.", + "id": "Stage/whenKeyReleased(KeyCode)", + "memberId": "Stage/whenKeyReleased", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenKeyReleased", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.KeyCode" + ], + "parameterNames": [ + "key" + ], + "params": [ + "KeyCode key" + ], + "summary": "Called when a key is released.", + "description": "Called when a key is released.", "scratchblock": null, - "paramDocs": [], - "returns": "the font size", + "paramDocs": [ + "key: the key" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFontSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyReleased", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Standardschriftgröße zurück" + "description": "Wird beim Loslassen der Taste aufgerufen" } } }, { - "id": "Text/getFont()", - "memberId": "Text/getFont", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getFont", + "id": "Stage/whenMouseClicked(MouseCode)", + "memberId": "Stage/whenMouseClicked", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenMouseClicked", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the name of the font.", - "description": "Retrieves the name of the font.", - "scratchblock": null, - "paramDocs": [], - "returns": "the name of the font as a String.", + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.MouseCode" + ], + "parameterNames": [ + "button" + ], + "params": [ + "MouseCode button" + ], + "summary": "Called when a mouse button is pressed anywhere on the stage.", + "description": "Called when a mouse button is pressed anywhere on the stage.", + "scratchblock": "when stage clicked", + "paramDocs": [ + "button: the button" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseClicked", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Namen der aktuellen Schriftart zurück" + "description": "Wird bei einem Mausklick aufgerufen" } } }, { - "id": "Text/getPosition()", - "memberId": "Text/getPosition", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getPosition", + "id": "Stage/whenMouseWheelMoved(double)", + "memberId": "Stage/whenMouseWheelMoved", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenMouseWheelMoved", "static": false, - "returnType": "Vector2", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the current position as a Vector2 object.", - "description": "Retrieves the current position as a Vector2 object.", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "steps" + ], + "params": [ + "double steps" + ], + "summary": "Called when the mouse wheel turns.", + "description": "Called when the mouse wheel turns.", "scratchblock": null, - "paramDocs": [], - "returns": "a Vector2 object representing the current x and y coordinates.", + "paramDocs": [ + "steps: notches; positive is towards the user" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseWheelMoved", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Position des Texts zurück" - } - } + "translations": {} }, { - "id": "Text/getStage()", - "memberId": "Text/getStage", + "id": "Text/addFont(String,String)", + "memberId": "Text/addFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getStage", + "methodName": "addFont", "static": false, - "returnType": "Stage", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the current stage associated with this object.", - "description": "Retrieves the current stage associated with this object.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "path" + ], + "params": [ + "String name", + "String path" + ], + "summary": "Adds a font this text can switch to; the first one added is used.", + "description": "Adds a font this text can switch to; the first one added is used.", "scratchblock": null, - "paramDocs": [], - "returns": "the current stage", + "paramDocs": [ + "name: the font's name", + "path: the TTF or OTF file" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/addFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Bühne zurück, auf der der Text liegt" + "description": "Fügt eine Schriftart hinzu" } } }, { - "id": "Text/getStyle()", - "memberId": "Text/getStyle", + "id": "Text/constructor()", + "memberId": "Text/constructor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getStyle", + "methodName": "constructor", "static": false, - "returnType": "TextStyle", + "returnType": "Text", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the style the text is drawn in.", - "description": "Returns the style the text is drawn in.", + "summary": "An empty plain text at (0, 0).", + "description": "An empty plain text at (0, 0).", "scratchblock": null, "paramDocs": [], - "returns": "the style, never null", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStyle", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Stil zurück, in dem der Text gezeichnet wird" + "description": "Erzeugt einen leeren Text in der Mitte der Bühne" } } }, { - "id": "Text/getTextSize()", - "memberId": "Text/getTextSize", + "id": "Text/constructor(String,double,double,double)", + "memberId": "Text/constructor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getTextSize", + "methodName": "constructor", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the size of the text.", - "description": "Returns the size of the text.", + "returnType": "Text", + "parameterTypes": [ + "java.lang.String", + "double", + "double", + "double" + ], + "parameterNames": [ + "text", + "x", + "y", + "width" + ], + "params": [ + "String text", + "double x", + "double y", + "double width" + ], + "summary": "A plain text.", + "description": "A plain text.", "scratchblock": null, - "paramDocs": [], - "returns": "the size of the text as an integer", + "paramDocs": [ + "text: what it says", + "x: x of its position", + "y: y of its position (the first line's baseline)", + "width: where lines wrap; 0 for no wrapping" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getTextSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Schriftgröße zurück" - } - } + "translations": {} }, { - "id": "Text/getWidth()", - "memberId": "Text/getWidth", + "id": "Text/constructor(String,double,double,double,TextStyle)", + "memberId": "Text/constructor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getWidth", + "methodName": "constructor", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the width of the text.", - "description": "Returns the width of the text.", + "returnType": "Text", + "parameterTypes": [ + "java.lang.String", + "double", + "double", + "double", + "org.openpatch.scratch.TextStyle" + ], + "parameterNames": [ + "text", + "x", + "y", + "width", + "style" + ], + "params": [ + "String text", + "double x", + "double y", + "double width", + "TextStyle style" + ], + "summary": "A text in a style.", + "description": "A text in a style.", "scratchblock": null, - "paramDocs": [], - "returns": "the width of the text as a double", + "paramDocs": [ + "text: what it says", + "x: x of its position", + "y: y of its position: the first baseline for plain text, the bottom edge of a box", + "width: where lines wrap; 0 for no wrapping", + "style: plain, box, speech or thought bubble" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Breite des Textfelds zurück" + "description": "Erzeugt einen Text an der angegebenen Position, mit der angegebenen Breite und im angegebenen Stil" } } }, { - "id": "Text/getX()", - "memberId": "Text/getX", + "id": "Text/getAlign()", + "memberId": "Text/getAlign", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getX", + "methodName": "getAlign", "static": false, - "returnType": "double", + "returnType": "TextAlign", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the x-coordinate of this object.", - "description": "Returns the x-coordinate of this object.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the x-coordinate as a double", + "returns": "the alignment", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getAlign", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die x-Position zurück" + "description": "Gibt die Ausrichtung des Texts zurück" } } }, { - "id": "Text/getY()", - "memberId": "Text/getY", + "id": "Text/getCurrentFontIndex()", + "memberId": "Text/getCurrentFontIndex", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getY", + "methodName": "getCurrentFontIndex", "static": false, - "returnType": "double", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the y-coordinate of this object.", - "description": "Returns the y-coordinate of this object.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the y-coordinate as a double", + "returns": "the number of the font in use, counting from 0; -1 for the default font", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontIndex", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die y-Position zurück" + "description": "Gibt die Nummer der aktuellen Schriftart zurück" } } }, { - "id": "Text/goLayersBackwards(int)", - "memberId": "Text/goLayersBackwards", + "id": "Text/getCurrentFontName()", + "memberId": "Text/getCurrentFontName", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goLayersBackwards", + "methodName": "getCurrentFontName", "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the text backwards by a specified number of layers in the stage. If\nthe text is not on a stage, the method does nothing.", - "description": "Moves the text backwards by a specified number of layers in the stage. If\nthe text is not on a stage, the method does nothing.", - "scratchblock": "go [backward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the text backwards" - ], - "returns": null, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the name of the font in use, or null for the default font", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersBackwards", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Schiebt den Text um die angegebene Anzahl Ebenen nach hinten" + "description": "Gibt den Namen der aktuellen Schriftart zurück" } } }, { - "id": "Text/goLayersForwards(int)", - "memberId": "Text/goLayersForwards", + "id": "Text/getDefaultFont()", + "memberId": "Text/getDefaultFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goLayersForwards", - "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the text forward by a specified number of layers within its stage. If\nthe text is not on a stage, the method does nothing.", - "description": "Moves the text forward by a specified number of layers within its stage. If\nthe text is not on a stage, the method does nothing.", - "scratchblock": "go [forward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the text forward" - ], - "returns": null, + "methodName": "getDefaultFont", + "static": true, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the default font file", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersForwards", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Bringt den Text um die angegebene Anzahl Ebenen nach vorne" + "description": "Gibt die Standardschriftart zurück" } } }, { - "id": "Text/goToBackLayer()", - "memberId": "Text/goToBackLayer", + "id": "Text/getDefaultFontSize()", + "memberId": "Text/getDefaultFontSize", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goToBackLayer", - "static": false, - "returnType": "void", + "methodName": "getDefaultFontSize", + "static": true, + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves this text to the back layer of the stage, behind every other text on\nit. If the text is not on a stage, the method does nothing.", - "description": "Moves this text to the back layer of the stage, behind every other text on\nit. If the text is not on a stage, the method does nothing.\n\nTexts are drawn on top of the sprites, so this orders a text against the\nother texts rather than against the sprites.", - "scratchblock": "go to [back v] layer", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the default font size", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToBackLayer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFontSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Schiebt den Text hinter die anderen Texte" + "description": "Gibt die Standardschriftgröße zurück" } } }, { - "id": "Text/goToFrontLayer()", - "memberId": "Text/goToFrontLayer", + "id": "Text/getFont()", + "memberId": "Text/getFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goToFrontLayer", + "methodName": "getFont", "static": false, - "returnType": "void", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves this text to the front layer of the stage, in front of every other\ntext on it. If the text is not on a stage, the method does nothing.", - "description": "Moves this text to the front layer of the stage, in front of every other\ntext on it. If the text is not on a stage, the method does nothing.\n\nTexts are drawn on top of the sprites, so this orders a text against the\nother texts rather than against the sprites.", - "scratchblock": "go to [front v] layer", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the font file, or null for the default font", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToFrontLayer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Bringt den Text vor die anderen Texte" + "description": "Gibt den Namen der aktuellen Schriftart zurück" } } }, { - "id": "Text/isUI()", - "memberId": "Text/isUI", + "id": "Text/getLayer()", + "memberId": "Text/getLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "isUI", + "methodName": "getLayer", "static": false, - "returnType": "boolean", + "returnType": "Layer", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the current instance is a UI element.", - "description": "Checks if the current instance is a UI element.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "`true` if this instance is a UI element, `false` otherwise.", + "returns": "the layer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/isUI", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Text zur Benutzeroberfläche gehört" - } - } + "translations": {} }, { - "id": "Text/nextFont()", - "memberId": "Text/nextFont", + "id": "Text/getPosition()", + "memberId": "Text/getPosition", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "nextFont", + "methodName": "getPosition", "static": false, - "returnType": "void", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Advances to the next font in the list of available fonts. The current font index is incremented\nby one and wraps around to the beginning of the list if it exceeds the number of available\nfonts.", - "description": "Advances to the next font in the list of available fonts. The current font index is incremented\nby one and wraps around to the beginning of the list if it exceeds the number of available\nfonts.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/nextFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zur nächsten Schriftart" + "description": "Gibt die Position des Texts zurück" } } }, { - "id": "Text/remove()", - "memberId": "Text/remove", + "id": "Text/getStage()", + "memberId": "Text/getStage", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "remove", + "methodName": "getStage", "static": false, - "returnType": "void", + "returnType": "Stage", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes this object from its current stage if it is associated with one. If the object is not\nassociated with any stage, this method does nothing.", - "description": "Removes this object from its current stage if it is associated with one. If the object is not\nassociated with any stage, this method does nothing.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the stage the text is on (a sprite's text: the sprite's stage), or null", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt den Text von der Bühne" + "description": "Gibt die Bühne zurück, auf der der Text liegt" } } }, { - "id": "Text/setAlign(TextAlign)", - "memberId": "Text/setAlign", + "id": "Text/getStyle()", + "memberId": "Text/getStyle", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setAlign", + "methodName": "getStyle", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.TextAlign" - ], - "parameterNames": [ - "align" - ], - "params": [ - "TextAlign align" - ], - "summary": "Sets the alignment of the text.", - "description": "Sets the alignment of the text.", + "returnType": "TextStyle", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "align: where the text should sit relative to its position" - ], - "returns": null, + "paramDocs": [], + "returns": "the style", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setAlign", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStyle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, wie der Text zu seiner Position ausgerichtet wird" + "description": "Gibt den Stil zurück, in dem der Text gezeichnet wird" } } }, { - "id": "Text/setBackgroundColor(int,int,int)", - "memberId": "Text/setBackgroundColor", + "id": "Text/getText()", + "memberId": "Text/getText", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setBackgroundColor", + "methodName": "getText", "static": false, - "returnType": "void", - "parameterTypes": [ - "int", - "int", - "int" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "int r", - "int g", - "int b" - ], - "summary": "Sets the background color using the specified RGB values.", - "description": "Sets the background color using the specified RGB values.", + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "r: the red component of the color (0-255)", - "g: the green component of the color (0-255)", - "b: the blue component of the color (0-255)" - ], - "returns": null, + "paramDocs": [], + "returns": "what the text says", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Text/setBackgroundColor(double)", - "memberId": "Text/setBackgroundColor", + "id": "Text/getTextSize()", + "memberId": "Text/getTextSize", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setBackgroundColor", + "methodName": "getTextSize", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "h" - ], - "params": [ - "double h" - ], - "summary": "Sets the background color using the specified hue value.", - "description": "Sets the background color using the specified hue value.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "h: the hue value for the background color" - ], - "returns": null, + "paramDocs": [], + "returns": "the font size, or the default", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getTextSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe über den Farbton (0 bis 255)" + "description": "Gibt die Schriftgröße zurück" } } }, { - "id": "Text/setBackgroundColor(Color)", - "memberId": "Text/setBackgroundColor", + "id": "Text/getWidth()", + "memberId": "Text/getWidth", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setBackgroundColor", + "methodName": "getWidth", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the background color of the text.", - "description": "Sets the background color of the text.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "c: the new background color to be set" - ], - "returns": null, + "paramDocs": [], + "returns": "where lines wrap; 0 for no wrapping", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe" + "description": "Gibt die Breite des Textfelds zurück" } } }, { - "id": "Text/setFont(String)", - "memberId": "Text/setFont", + "id": "Text/getX()", + "memberId": "Text/getX", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setFont", + "methodName": "getX", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Sets the font name for the text.", - "description": "Sets the font name for the text.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "name: the name of the font to be set" - ], - "returns": null, + "paramDocs": [], + "returns": "x of the position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zur Schriftart mit dem angegebenen Namen" + "description": "Gibt die x-Position zurück" } } }, { - "id": "Text/setIsUI(boolean)", - "memberId": "Text/setIsUI", + "id": "Text/getY()", + "memberId": "Text/getY", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setIsUI", + "methodName": "getY", "static": false, - "returnType": "void", - "parameterTypes": [ - "boolean" - ], - "parameterNames": [ - "isUI" - ], - "params": [ - "boolean isUI" - ], - "summary": "Sets the UI status of this object.", - "description": "Sets the UI status of this object.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "isUI: a boolean indicating whether this object is part of the UI" - ], - "returns": null, + "paramDocs": [], + "returns": "y of the position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setIsUI", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, ob der Text zur Benutzeroberfläche gehört und sich nicht mit der Kamera bewegt" + "description": "Gibt die y-Position zurück" } } }, { - "id": "Text/setPosition(double,double)", - "memberId": "Text/setPosition", + "id": "Text/goLayersBackwards(int)", + "memberId": "Text/goLayersBackwards", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setPosition", + "methodName": "goLayersBackwards", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "int" ], "parameterNames": [ - "x", - "y" + "number" ], "params": [ - "double x", - "double y" + "int number" ], - "summary": "Sets the position of the text", - "description": "Sets the position of the text", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "go [backward v] (number) layers", "paramDocs": [ - "x: a x coordinate", - "y: a y coordinate" + "number: how many texts to move behind" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersBackwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" + "description": "Schiebt den Text um die angegebene Anzahl Ebenen nach hinten" } } }, { - "id": "Text/setPosition(Vector2)", - "memberId": "Text/setPosition", + "id": "Text/goLayersForwards(int)", + "memberId": "Text/goLayersForwards", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setPosition", + "methodName": "goLayersForwards", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "int" ], "parameterNames": [ - "v" + "number" ], "params": [ - "Vector2 v" + "int number" ], - "summary": "Sets the position of the text object using a Vector2 object.", - "description": "Sets the position of the text object using a Vector2 object.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "go [forward v] (number) layers", "paramDocs": [ - "v: the Vector2 object containing the x and y coordinates" + "number: how many texts to move in front of" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersForwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" + "description": "Bringt den Text um die angegebene Anzahl Ebenen nach vorne" } } }, { - "id": "Text/setStrokeColor(int,int,int)", - "memberId": "Text/setStrokeColor", + "id": "Text/goToBackLayer()", + "memberId": "Text/goToBackLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStrokeColor", + "methodName": "goToBackLayer", "static": false, "returnType": "void", - "parameterTypes": [ - "int", - "int", - "int" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "int r", - "int g", - "int b" - ], - "summary": "Sets the stroke color using the specified RGB values.", - "description": "Sets the stroke color using the specified RGB values.", - "scratchblock": null, - "paramDocs": [ - "r: the red component of the color (0-255)", - "g: the green component of the color (0-255)", - "b: the blue component of the color (0-255)" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Draws this text behind the other texts.", + "description": "Draws this text behind the other texts.", + "scratchblock": "go to [back v] layer", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToBackLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Rahmenfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" + "description": "Schiebt den Text hinter die anderen Texte" } } }, { - "id": "Text/setStrokeColor(double)", - "memberId": "Text/setStrokeColor", + "id": "Text/goToFrontLayer()", + "memberId": "Text/goToFrontLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStrokeColor", + "methodName": "goToFrontLayer", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "h" - ], - "params": [ - "double h" - ], - "summary": "Sets the stroke color using the specified hue value.", - "description": "Sets the stroke color using the specified hue value.", - "scratchblock": null, - "paramDocs": [ - "h: the hue value for the stroke color" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Draws this text in front of the other texts.", + "description": "Draws this text in front of the other texts.", + "scratchblock": "go to [front v] layer", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToFrontLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Rahmenfarbe über den Farbton (0 bis 255)" + "description": "Bringt den Text vor die anderen Texte" } } }, { - "id": "Text/setStrokeColor(Color)", - "memberId": "Text/setStrokeColor", + "id": "Text/hide()", + "memberId": "Text/hide", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStrokeColor", + "methodName": "hide", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the stroke color for the text.", - "description": "Sets the stroke color for the text.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Hides the text.", + "description": "Hides the text.", "scratchblock": null, - "paramDocs": [ - "c: the color to set as the stroke color" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/hide", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Rahmenfarbe" - } - } + "translations": {} }, { - "id": "Text/setStyle(TextStyle)", - "memberId": "Text/setStyle", + "id": "Text/isVisible()", + "memberId": "Text/isVisible", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStyle", + "methodName": "isVisible", + "static": false, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether the text is shown", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/isVisible", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Text/nextFont()", + "memberId": "Text/nextFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "nextFont", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.TextStyle" - ], - "parameterNames": [ - "style" - ], - "params": [ - "TextStyle style" - ], - "summary": "Sets the style of the text.", - "description": "Sets the style of the text.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the next font added, after the last to the first.", + "description": "Switches to the next font added, after the last to the first.", "scratchblock": null, - "paramDocs": [ - "style: the TextStyle to be applied to the text" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStyle", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/nextFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, ob der Text als Kasten, Sprech- oder Denkblase dargestellt wird" + "description": "Wechselt zur nächsten Schriftart" } } }, { - "id": "Text/setTextColor(int,int,int)", - "memberId": "Text/setTextColor", + "id": "Text/remove()", + "memberId": "Text/remove", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextColor", + "methodName": "remove", "static": false, "returnType": "void", - "parameterTypes": [ - "int", - "int", - "int" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "int r", - "int g", - "int b" - ], - "summary": "Sets the text color using RGB values.", - "description": "Sets the text color using RGB values.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Removes the text from its stage.", + "description": "Removes the text from its stage.", "scratchblock": null, - "paramDocs": [ - "r: the red component of the color (0-255)", - "g: the green component of the color (0-255)", - "b: the blue component of the color (0-255)" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Schriftfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" + "description": "Entfernt den Text von der Bühne" } } }, { - "id": "Text/setTextColor(double)", - "memberId": "Text/setTextColor", + "id": "Text/setAlign(TextAlign)", + "memberId": "Text/setAlign", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextColor", + "methodName": "setAlign", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.TextAlign" ], "parameterNames": [ - "h" + "align" ], "params": [ - "double h" + "TextAlign align" ], - "summary": "Sets the text color using the specified hue value.", - "description": "Sets the text color using the specified hue value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "h: the hue value for the text color" + "align: how lines sit relative to the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setAlign", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Schriftfarbe über den Farbton (0 bis 255)" + "description": "Legt fest, wie der Text zu seiner Position ausgerichtet wird" } } }, { - "id": "Text/setTextColor(Color)", - "memberId": "Text/setTextColor", + "id": "Text/setBackgroundColor(Color)", + "memberId": "Text/setBackgroundColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextColor", + "methodName": "setBackgroundColor", "static": false, "returnType": "void", "parameterTypes": [ "org.openpatch.scratch.Color" ], "parameterNames": [ - "c" + "color" ], "params": [ - "Color c" + "Color color" ], - "summary": "Sets the color of the text.", - "description": "Sets the color of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: the new color to be set for the text" + "color: the fill of a box or bubble" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Schriftfarbe" + "description": "Setzt die Hintergrundfarbe" } } }, { - "id": "Text/setTextSize(int)", - "memberId": "Text/setTextSize", + "id": "Text/setBackgroundColor(double,double,double)", + "memberId": "Text/setBackgroundColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextSize", + "methodName": "setBackgroundColor", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double", + "double", + "double" ], "parameterNames": [ - "size" + "red", + "green", + "blue" ], "params": [ - "int size" + "double red", + "double green", + "double blue" ], - "summary": "Sets the size of the text.", - "description": "Sets the size of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "size: the new size of the text" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Schriftgröße" - } - } + "translations": {} }, { - "id": "Text/setWidth(double)", - "memberId": "Text/setWidth", + "id": "Text/setFont(String)", + "memberId": "Text/setFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setWidth", + "methodName": "setFont", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "width" + "path" ], "params": [ - "double width" + "String path" ], - "summary": "Sets the width of the text.", - "description": "Sets the width of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "width: the new width to set" + "path: the font file for this text, or null for the default font" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Breite des Textfelds; längere Texte werden umgebrochen" + "description": "Wechselt zur Schriftart mit dem angegebenen Namen" } } }, { - "id": "Text/setX(double)", - "memberId": "Text/setX", + "id": "Text/setLayer(Layer)", + "memberId": "Text/setLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setX", + "methodName": "setLayer", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Layer" ], "parameterNames": [ - "x" + "layer" ], "params": [ - "double x" + "Layer layer" ], - "summary": "Sets the x-coordinate for this object.", - "description": "Sets the x-coordinate for this object.", + "summary": "Moves the text to another layer: [Layer.UI](../Layer/UI) keeps it in place when the camera moves;\nany other layer puts it into the world, in front of the foreground.", + "description": "Moves the text to another layer: [Layer.UI](../Layer/UI) keeps it in place when the camera moves;\nany other layer puts it into the world, in front of the foreground.", "scratchblock": null, "paramDocs": [ - "x: the new x-coordinate value" + "layer: the layer" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die x-Position" - } - } + "translations": {} }, { - "id": "Text/setY(double)", - "memberId": "Text/setY", + "id": "Text/setPosition(double,double)", + "memberId": "Text/setPosition", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setY", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ + "double", "double" ], "parameterNames": [ + "x", "y" ], "params": [ + "double x", "double y" ], - "summary": "Sets the Y coordinate of the text.", - "description": "Sets the Y coordinate of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "y: the new Y coordinate value" + "x: x of the position", + "y: y of the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die y-Position" + "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Text/showText(String)", - "memberId": "Text/showText", + "id": "Text/setPosition(Vector2)", + "memberId": "Text/setPosition", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "showText", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "text" + "position" ], "params": [ - "String text" + "Vector2 position" ], - "summary": "Displays the specified text.", - "description": "Displays the specified text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "text: The text to be displayed. If the text is null or empty, the text will be set to\n null." + "position: the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt den Text an" + "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Text/showText(String,int)", - "memberId": "Text/showText", + "id": "Text/setStrokeColor(Color)", + "memberId": "Text/setStrokeColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "showText", + "methodName": "setStrokeColor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "text", - "millis" + "color" ], "params": [ - "String text", - "int millis" + "Color color" ], - "summary": "Displays the specified text for a given duration.", - "description": "Displays the specified text for a given duration.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "text: The text to be displayed.", - "millis: The duration in milliseconds for which the text should be displayed." + "color: the outline of a box or bubble" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt den Text für die angegebene Zeit in Millisekunden an" + "description": "Setzt die Rahmenfarbe" } } }, { - "id": "Text/switchFont(String)", - "memberId": "Text/switchFont", + "id": "Text/setStrokeColor(double,double,double)", + "memberId": "Text/setStrokeColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "switchFont", + "methodName": "setStrokeColor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double", + "double" ], "parameterNames": [ - "name" + "red", + "green", + "blue" ], "params": [ - "String name" + "double red", + "double green", + "double blue" ], - "summary": "Switches the current font to the font with the specified name.", - "description": "Switches the current font to the font with the specified name.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the font to switch to" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/switchFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wechselt zur Schriftart mit dem angegebenen Namen" - } - } + "translations": {} }, { - "id": "Text/useFont(String,int)", - "memberId": "Text/useFont", + "id": "Text/setStyle(TextStyle)", + "memberId": "Text/setStyle", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useFont", - "static": true, + "methodName": "setStyle", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.TextStyle" ], "parameterNames": [ - "path", - "size" + "style" ], "params": [ - "String path", - "int size" + "TextStyle style" ], - "summary": "Chooses the font all text is written in, and how big it is.", - "description": "Chooses the font all text is written in, and how big it is.\n\nCall it before the first stage is created. The font is loaded while the\nwindow starts up, so choosing one later is not reliable.\n\n```java\npublic static void main(String[] args) {\n Text.useFont(\"assets/Retro Gaming.ttf\", 11);\n new MyStage();\n}\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "path: the path to a .ttf or .otf file", - "size: the size to write in" + "style: plain, box, speech or thought bubble" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStyle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt Schriftart und -größe für alle Texte fest" + "description": "Legt fest, ob der Text als Kasten, Sprech- oder Denkblase dargestellt wird" } } }, { - "id": "Text/useFont(String)", - "memberId": "Text/useFont", + "id": "Text/setTextColor(Color)", + "memberId": "Text/setTextColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useFont", - "static": true, + "methodName": "setTextColor", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "path" + "color" ], "params": [ - "String path" + "Color color" ], - "summary": "Chooses the font all text is written in, keeping the current size.", - "description": "Chooses the font all text is written in, keeping the current size.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "path: the path to a .ttf or .otf file" + "color: the colour of the letters" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt die Schriftart für alle Texte fest" + "description": "Setzt die Schriftfarbe" } } }, { - "id": "Text/useFontSizes(int[])", - "memberId": "Text/useFontSizes", + "id": "Text/setTextColor(double,double,double)", + "memberId": "Text/setTextColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useFontSizes", - "static": true, + "methodName": "setTextColor", + "static": false, "returnType": "void", "parameterTypes": [ - "int[]" + "double", + "double", + "double" ], "parameterNames": [ - "sizes" + "red", + "green", + "blue" ], "params": [ - "int[] sizes" + "double red", + "double green", + "double blue" ], - "summary": "Prepares several sizes of the font in advance. Only needed when text is\nshown at more than one size, so that every size looks sharp.", - "description": "Prepares several sizes of the font in advance. Only needed when text is\nshown at more than one size, so that every size looks sharp.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "sizes: the sizes to prepare" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFontSizes", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Text/useSmoothing(boolean)", - "memberId": "Text/useSmoothing", + "id": "Text/setTextSize(double)", + "memberId": "Text/setTextSize", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useSmoothing", - "static": true, + "methodName": "setTextSize", + "static": false, "returnType": "void", "parameterTypes": [ - "boolean" + "double" ], "parameterNames": [ - "smooth" + "size" ], "params": [ - "boolean smooth" + "double size" ], - "summary": "Chooses whether letters are smoothed. Turn it off for pixel fonts.", - "description": "Chooses whether letters are smoothed. Turn it off for pixel fonts.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "smooth: true to smooth the letters" + "size: the font size in stage units (in pixel-art mode rounded to whole font pixels when\n drawn)" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useSmoothing", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt fest, ob Schrift geglättet wird" - } - } - }, - { - "id": "Text/whenAddedToStage()", - "memberId": "Text/whenAddedToStage", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "whenAddedToStage", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the object is added to the stage. Override this method to define\ncustom behavior when the object is added to the stage.", - "description": "This method is called when the object is added to the stage. Override this method to define\ncustom behavior when the object is added to the stage.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenAddedToStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" - } - } + "translations": {} }, { - "id": "Text/whenAddedToStage(Stage)", - "memberId": "Text/whenAddedToStage", + "id": "Text/setWidth(double)", + "memberId": "Text/setWidth", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "whenAddedToStage", + "methodName": "setWidth", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Stage" + "double" ], "parameterNames": [ - "stage" + "width" ], "params": [ - "Stage stage" + "double width" ], - "summary": "This method is called when the text is added to the stage. Override this method to define\ncustom behavior when the text.", - "description": "This method is called when the text is added to the stage. Override this method to define\ncustom behavior when the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "stage: The stage to which the text is added." + "width: where lines wrap, in stage units; 0 for no wrapping" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenAddedToStage", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" - } - } - }, - { - "id": "Text/whenRemovedFromStage()", - "memberId": "Text/whenRemovedFromStage", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "whenRemovedFromStage", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the object is removed from the stage. Override this method to define\ncustom behavior that should occur when the object is no longer part of the stage.", - "description": "This method is called when the object is removed from the stage. Override this method to define\ncustom behavior that should occur when the object is no longer part of the stage.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenRemovedFromStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" + "description": "Setzt die Breite des Textfelds; längere Texte werden umgebrochen" } } }, { - "id": "Text/whenRemovedFromStage(Stage)", - "memberId": "Text/whenRemovedFromStage", + "id": "Text/setX(double)", + "memberId": "Text/setX", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "whenRemovedFromStage", + "methodName": "setX", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Stage" + "double" ], "parameterNames": [ - "stage" + "x" ], "params": [ - "Stage stage" + "double x" ], - "summary": "This method is called when the text is removed from the stage. Override this method to define\ncustom behavior that should occur.", - "description": "This method is called when the text is removed from the stage. Override this method to define\ncustom behavior that should occur.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "stage: The stage from which the text is removed." + "x: x of the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenRemovedFromStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" + "description": "Setzt die x-Position" } } }, { - "id": "Timer/afterMillis(int)", - "memberId": "Timer/afterMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "afterMillis", + "id": "Text/setY(double)", + "memberId": "Text/setY", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "setY", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int" + "double" ], "parameterNames": [ - "millis" + "y" ], "params": [ - "int millis" + "double y" ], - "summary": "Checks if the specified number of milliseconds has passed since the method was first called.", - "description": "Checks if the specified number of milliseconds has passed since the method was first called.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "millis: the number of milliseconds to check against" + "y: y of the position" ], - "returns": "true if the specified number of milliseconds has passed since the method was first\n called, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/afterMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt true zurück, sobald seit dem Zurücksetzen millis Millisekunden vergangen sind" + "description": "Setzt die y-Position" } } }, { - "id": "Timer/constructor()", - "memberId": "Timer/constructor", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "constructor", + "id": "Text/show()", + "memberId": "Text/show", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "show", "static": false, - "returnType": "Timer", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Timer object.", - "description": "Constructs a new Timer object.", + "summary": "Shows the text.", + "description": "Shows the text.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt einen neuen Timer" - } - } - }, - { - "id": "Timer/everyMillis(int)", - "memberId": "Timer/everyMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "everyMillis", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "millis" - ], - "params": [ - "int millis" - ], - "summary": "Checks if the specified number of milliseconds has passed since the last time this method\nreturned true.", - "description": "Checks if the specified number of milliseconds has passed since the last time this method\nreturned true.", - "scratchblock": null, - "paramDocs": [ - "millis: The number of milliseconds to wait before returning true." - ], - "returns": "true if the specified number of milliseconds has passed since the last call that\n returned true, false otherwise.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/everyMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/show", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt alle millis Millisekunden einmal true zurück" - } - } + "translations": {} }, { - "id": "Timer/forMillis(int)", - "memberId": "Timer/forMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "forMillis", + "id": "Text/showText(String)", + "memberId": "Text/showText", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "showText", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int" + "java.lang.String" ], "parameterNames": [ - "millis" + "text" ], "params": [ - "int millis" + "String text" ], - "summary": "Checks if the specified amount of milliseconds has passed since the method was first called. If\nthe method is called for the first time, it initializes the start time.", - "description": "Checks if the specified amount of milliseconds has passed since the method was first called. If\nthe method is called for the first time, it initializes the start time.", + "summary": "Shows the text with new words until it is changed or hidden.", + "description": "Shows the text with new words until it is changed or hidden.", "scratchblock": null, "paramDocs": [ - "millis: the number of milliseconds to check against" + "text: what it says; an empty text hides a bubble" ], - "returns": "true if the current time is less than the start time plus the specified milliseconds,\n false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/forMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt für die ersten millis Millisekunden nach dem Zurücksetzen true zurück" + "description": "Zeigt den Text an" } } }, { - "id": "Timer/intervalMillis(int)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", + "id": "Text/showText(String,double)", + "memberId": "Text/showText", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "showText", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int" + "java.lang.String", + "double" ], "parameterNames": [ - "millis" + "text", + "seconds" ], "params": [ - "int millis" + "String text", + "double seconds" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "Shows the text for a number of seconds of game time, then hides it.", + "description": "Shows the text for a number of seconds of game time, then hides it.", "scratchblock": null, "paramDocs": [ - "millis: the interval in milliseconds to check" + "text: what it says", + "seconds: how long" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wechselt alle millis Millisekunden zwischen true und false" - } - } + "translations": {} }, { - "id": "Timer/intervalMillis(int,boolean)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", + "id": "Text/switchFont(String)", + "memberId": "Text/switchFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "switchFont", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int", - "boolean" + "java.lang.String" ], "parameterNames": [ - "millis", - "skipFirst" + "name" ], "params": [ - "int millis", - "boolean skipFirst" + "String name" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "millis: the interval in milliseconds to check", - "skipFirst: if true, the first interval will be skipped" + "name: the name of a font added with [addFont(String, String)](addFont)" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/switchFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt alle millis Millisekunden zwischen true und false; skipFirst überspringt das erste Intervall" + "description": "Wechselt zur Schriftart mit dem angegebenen Namen" } } }, { - "id": "Timer/intervalMillis(int,int)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", - "static": false, - "returnType": "boolean", + "id": "Text/useFont(String)", + "memberId": "Text/useFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "useFont", + "static": true, + "returnType": "void", "parameterTypes": [ - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "millis1", - "millis2" + "path" ], "params": [ - "int millis1", - "int millis2" + "String path" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "The font every text uses unless it sets its own, from now on. Without it, texts use Ubuntu\nMono, or Jersey 10 in pixel-art mode.", + "description": "The font every text uses unless it sets its own, from now on. Without it, texts use Ubuntu\nMono, or Jersey 10 in pixel-art mode.", "scratchblock": null, "paramDocs": [ - "millis1: the first interval in milliseconds to check", - "millis2: the second interval in milliseconds to check" + "path: a TTF or OTF file" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt millis1 Millisekunden lang true und danach millis2 Millisekunden lang false zurück" + "description": "Legt die Schriftart für alle Texte fest" } } }, { - "id": "Timer/intervalMillis(int,int,boolean)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", - "static": false, - "returnType": "boolean", + "id": "Text/useFont(String,double)", + "memberId": "Text/useFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "useFont", + "static": true, + "returnType": "void", "parameterTypes": [ - "int", - "int", - "boolean" + "java.lang.String", + "double" ], "parameterNames": [ - "millis1", - "millis2", - "skipFirst" + "path", + "pixelSize" ], "params": [ - "int millis1", - "int millis2", - "boolean skipFirst" + "String path", + "double pixelSize" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "A pixel font as default font, with the size at which one of its pixels is one stage pixel:\nfor a pixel font whose outlines do not show its grid (most do: then [useFont(String)](useFont)\nis enough). In pixel-art mode sizes are rounded to whole pixels of it.", + "description": "A pixel font as default font, with the size at which one of its pixels is one stage pixel:\nfor a pixel font whose outlines do not show its grid (most do: then [useFont(String)](useFont)\nis enough). In pixel-art mode sizes are rounded to whole pixels of it.", "scratchblock": null, "paramDocs": [ - "millis1: the first interval in milliseconds to check", - "millis2: the second interval in milliseconds to check", - "skipFirst: if true, the first interval will be skipped" + "path: a TTF or OTF file", + "pixelSize: the size at which one font pixel is one stage pixel" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt millis1 Millisekunden lang true und danach millis2 Millisekunden lang false zurück; skipFirst überspringt das erste Intervall" - } - } + "translations": {} }, { - "id": "Timer/millis()", - "memberId": "Timer/millis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "millis", - "static": true, - "returnType": "int", + "id": "Text/whenAddedToStage()", + "memberId": "Text/whenAddedToStage", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "whenAddedToStage", + "static": false, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the number of milliseconds of game time since the program started.\nGame time stands still while the game is paused and runs slower or faster\nwith the game speed (see [Window.pause()](../Window/pause) and\n[Window.setGameSpeed(double)](../Window/setGameSpeed)); without either, it is the real time.", - "description": "Returns the number of milliseconds of game time since the program started.\nGame time stands still while the game is paused and runs slower or faster\nwith the game speed (see [Window.pause()](../Window/pause) and\n[Window.setGameSpeed(double)](../Window/setGameSpeed)); without either, it is the real time.", - "scratchblock": "(timer)", + "summary": "Called when the text was added to a stage.", + "description": "Called when the text was added to a stage.", + "scratchblock": null, "paramDocs": [], - "returns": "the milliseconds of game time since the program started", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/millis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenAddedToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die seit dem Programmstart vergangenen Millisekunden zurück" + "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" } } }, { - "id": "Timer/reset()", - "memberId": "Timer/reset", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "reset", + "id": "Text/whenRemovedFromStage()", + "memberId": "Text/whenRemovedFromStage", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "whenRemovedFromStage", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Resets the timer.", - "description": "Resets the timer.", - "scratchblock": "reset timer", + "summary": "Called when the text was removed from its stage.", + "description": "Called when the text was removed from its stage.", + "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/reset", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenRemovedFromStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt den Timer auf 0 zurück" + "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" } } }, { - "id": "Triangle/constructor(double,double,double,double,double,double)", - "memberId": "Triangle/constructor", - "owner": "org.openpatch.scratch.Triangle", - "className": "Triangle", - "methodName": "constructor", + "id": "Timer/after(double)", + "memberId": "Timer/after", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "after", "static": false, - "returnType": "Triangle", + "returnType": "boolean", "parameterTypes": [ - "double", - "double", - "double", - "double", - "double", "double" ], "parameterNames": [ - "x1", - "y1", - "x2", - "y2", - "x3", - "y3" + "seconds" ], "params": [ - "double x1", - "double y1", - "double x2", - "double y2", - "double x3", - "double y3" + "double seconds" ], - "summary": "Creates a triangle with the specified vertices.", - "description": "Creates a triangle with the specified vertices.", + "summary": "False for a number of seconds from the first call on, true afterwards.", + "description": "False for a number of seconds from the first call on, true afterwards.", "scratchblock": null, "paramDocs": [ - "x1: the x-coordinate of the first vertex", - "y1: the y-coordinate of the first vertex", - "x2: the x-coordinate of the second vertex", - "y2: the y-coordinate of the second vertex", - "x3: the x-coordinate of the third vertex", - "y3: the y-coordinate of the third vertex" + "seconds: how long to wait" ], + "returns": "whether that time is over", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/after", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Timer/constructor()", + "memberId": "Timer/constructor", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "constructor", + "static": false, + "returnType": "Timer", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A timer starting now.", + "description": "A timer starting now.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Triangle/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt ein Dreieck aus den drei Eckpunkten" + "description": "Erzeugt einen neuen Timer" } } }, { - "id": "UISprite/changeHeight(double)", - "memberId": "UISprite/changeHeight", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "changeHeight", + "id": "Timer/during(double)", + "memberId": "Timer/during", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "during", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ "double" ], "parameterNames": [ - "amount" + "seconds" ], "params": [ - "double amount" + "double seconds" ], - "summary": "Changes the height of the sprite by the given number of pixels.", - "description": "Changes the height of the sprite by the given number of pixels.", + "summary": "True for a number of seconds from the first call on, false afterwards.", + "description": "True for a number of seconds from the first call on, false afterwards.", "scratchblock": null, "paramDocs": [ - "amount: how many pixels to add to the height" + "seconds: how long" ], - "returns": null, + "returns": "whether that time is still running", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/changeHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/during", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Höhe um die angegebene Anzahl Pixel" - } - } + "translations": {} }, { - "id": "UISprite/changeWidth(double)", - "memberId": "UISprite/changeWidth", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "changeWidth", + "id": "Timer/every(double)", + "memberId": "Timer/every", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "every", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ "double" ], "parameterNames": [ - "amount" + "seconds" ], "params": [ - "double amount" + "double seconds" ], - "summary": "Changes the width of the sprite by the given number of pixels.", - "description": "Changes the width of the sprite by the given number of pixels.", + "summary": "True once every number of seconds: the first time that many seconds after the first call,\nthen again each time as many seconds have passed.", + "description": "True once every number of seconds: the first time that many seconds after the first call,\nthen again each time as many seconds have passed.", "scratchblock": null, "paramDocs": [ - "amount: how many pixels to add to the width" + "seconds: the period" ], - "returns": null, + "returns": "whether the period is over", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/changeWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/every", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Breite um die angegebene Anzahl Pixel" - } - } + "translations": {} }, { - "id": "UISprite/constructor()", - "memberId": "UISprite/constructor", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "constructor", + "id": "Timer/getSeconds()", + "memberId": "Timer/getSeconds", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "getSeconds", "static": false, - "returnType": "UISprite", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a sprite that is drawn as part of the user interface.", - "description": "Creates a sprite that is drawn as part of the user interface.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the seconds of game time since the timer started or was reset", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/getSeconds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine neue UI-Figur" - } - } + "translations": {} }, { - "id": "UISprite/disableNineSlice()", - "memberId": "UISprite/disableNineSlice", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "disableNineSlice", + "id": "Timer/interval(double)", + "memberId": "Timer/interval", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "interval", "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Lets the whole costume stretch again.", - "description": "Lets the whole costume stretch again.", + "returnType": "boolean", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "seconds" + ], + "params": [ + "double seconds" + ], + "summary": "Alternates: true for a number of seconds, then false for as long, and so on.", + "description": "Alternates: true for a number of seconds, then false for as long, and so on.", "scratchblock": null, - "paramDocs": [], - "returns": null, + "paramDocs": [ + "seconds: how long each phase lasts" + ], + "returns": "whether it is in an \"on\" phase", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/disableNineSlice", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/interval", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Lässt das ganze Kostüm wieder mitskalieren" - } - } + "translations": {} }, { - "id": "UISprite/setHeight(double)", - "memberId": "UISprite/setHeight", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "setHeight", + "id": "Timer/interval(double,double)", + "memberId": "Timer/interval", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "interval", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ + "double", "double" ], "parameterNames": [ - "height" + "on", + "off" ], "params": [ - "double height" + "double on", + "double off" ], - "summary": "Sets the height of the sprite in pixels.", - "description": "Sets the height of the sprite in pixels.", + "summary": "Alternates: true for `on` seconds, then false for `off` seconds, and so on.", + "description": "Alternates: true for `on` seconds, then false for `off` seconds, and so on.", "scratchblock": null, "paramDocs": [ - "height: the height in pixels" + "on: how long it is true", + "off: how long it is false" ], + "returns": "whether it is in an \"on\" phase", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/interval", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Timer/reset()", + "memberId": "Timer/reset", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "reset", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Starts the timer again from 0, and every method below with it.", + "description": "Starts the timer again from 0, and every method below with it.", + "scratchblock": "reset timer", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/setHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/reset", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Höhe in Pixeln" + "description": "Setzt den Timer auf 0 zurück" } } }, { - "id": "UISprite/setNineSlice(int,int,int,int)", - "memberId": "UISprite/setNineSlice", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "setNineSlice", - "static": false, - "returnType": "void", + "id": "Transition/fromShader(String)", + "memberId": "Transition/fromShader", + "owner": "org.openpatch.scratch.Transition", + "className": "Transition", + "methodName": "fromShader", + "static": true, + "returnType": "Transition", "parameterTypes": [ - "int", - "int", - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "top", - "right", - "bottom", - "left" + "path" ], "params": [ - "int top", - "int right", - "int bottom", - "int left" + "String path" ], - "summary": "Keeps the corners and edges of the costume from stretching when the sprite\nis resized, so that a button costume can be made any size.", - "description": "Keeps the corners and edges of the costume from stretching when the sprite\nis resized, so that a button costume can be made any size.", + "summary": "A transition of your own: a shader body with `from`, `to` (the two pictures),\n`progress` (0 to 1), `uv` and `color`.", + "description": "A transition of your own: a shader body with `from`, `to` (the two pictures),\n`progress` (0 to 1), `uv` and `color`.", "scratchblock": null, "paramDocs": [ - "top: how many pixels of the costume belong to the top edge", - "right: how many pixels of the costume belong to the right edge", - "bottom: how many pixels of the costume belong to the bottom edge", - "left: how many pixels of the costume belong to the left edge" + "path: the file with the body" ], + "returns": "the transition", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Transition/fromShader", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Transition/getName()", + "memberId": "Transition/getName", + "owner": "org.openpatch.scratch.Transition", + "className": "Transition", + "methodName": "getName", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the built-in name or the shader file", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Transition/getName", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Transition/toString()", + "memberId": "Transition/toString", + "owner": "org.openpatch.scratch.Transition", + "className": "Transition", + "methodName": "toString", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/setNineSlice", + "docsUrl": "https://scratch4j.openpatch.org/reference/Transition/toString", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Hält die Ecken und Ränder des Kostüms beim Skalieren fest (Nine-Slice)" - } - } + "translations": {} }, { - "id": "UISprite/setWidth(double)", - "memberId": "UISprite/setWidth", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "setWidth", + "id": "Triangle/constructor(double,double,double,double,double,double)", + "memberId": "Triangle/constructor", + "owner": "org.openpatch.scratch.Triangle", + "className": "Triangle", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "Triangle", "parameterTypes": [ + "double", + "double", + "double", + "double", + "double", "double" ], "parameterNames": [ - "width" + "x1", + "y1", + "x2", + "y2", + "x3", + "y3" ], "params": [ - "double width" + "double x1", + "double y1", + "double x2", + "double y2", + "double x3", + "double y3" ], - "summary": "Sets the width of the sprite in pixels.", - "description": "Sets the width of the sprite in pixels.", + "summary": "A triangle.", + "description": "A triangle.", "scratchblock": null, "paramDocs": [ - "width: the width in pixels" + "x1: x of the first corner", + "y1: y of the first corner", + "x2: x of the second corner", + "y2: y of the second corner", + "x3: x of the third corner", + "y3: y of the third corner" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/setWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Triangle/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Breite in Pixeln" + "description": "Erzeugt ein Dreieck aus den drei Eckpunkten" } } }, @@ -13553,6 +13953,28 @@ } } }, + { + "id": "Vector2/direction()", + "memberId": "Vector2/direction", + "owner": "org.openpatch.scratch.Vector2", + "className": "Vector2", + "methodName": "direction", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Returns the direction of the vector in Scratch's degrees: 0 points up, 90 to the right, 180\ndown and 270 to the left, the way `setDirection` on a sprite counts. [angle()](angle)\ncounts the mathematical way instead (0 to the right, anticlockwise).", + "description": "Returns the direction of the vector in Scratch's degrees: 0 points up, 90 to the right, 180\ndown and 270 to the left, the way `setDirection` on a sprite counts. [angle()](angle)\ncounts the mathematical way instead (0 to the right, anticlockwise).", + "scratchblock": null, + "paramDocs": [], + "returns": "the direction in degrees between 0 (inclusive) and 360 (exclusive)", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Vector2/direction", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Vector2/distance(Vector2)", "memberId": "Vector2/distance", @@ -14108,8 +14530,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Window with default dimensions. The default width is 480\npixels and the\ndefault height is 360 pixels.", - "description": "Constructs a new Window with default dimensions. The default width is 480\npixels and the\ndefault height is 360 pixels.\n\nA folder named `assets` is loaded while the loading screen shows, if\nthe project has one.", + "summary": "A window of 480 × 360, Scratch's stage size.", + "description": "A window of 480 × 360, Scratch's stage size.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14140,11 +14562,11 @@ "params": [ "String assets" ], - "summary": "Constructs a new Window with the specified assets. The window will have a\ndefault width of 480\npixels and a height of 360 pixels.", - "description": "Constructs a new Window with the specified assets. The window will have a\ndefault width of 480\npixels and a height of 360 pixels.\n\nThe images, sounds and fonts in that folder are loaded while the loading\nscreen shows, so they are ready when a sprite first uses them. Without\nit, a folder named `assets` is loaded, if there is one.", + "summary": "A window of 480 × 360 that loads every image, sound and font in a folder before the first\nframe, showing a loading screen.", + "description": "A window of 480 × 360 that loads every image, sound and font in a folder before the first\nframe, showing a loading screen.", "scratchblock": null, "paramDocs": [ - "assets: the path to the assets to be used in the window" + "assets: the folder, e.g. `\"assets\"`" ], "returns": null, "since": "", @@ -14177,12 +14599,12 @@ "int width", "int height" ], - "summary": "Constructs a new Window with the specified width and height.", - "description": "Constructs a new Window with the specified width and height.\n\nA folder named `assets` is loaded while the loading screen shows, if\nthe project has one.", + "summary": "A window whose stage has this size in stage pixels. The window opens at that size (in pixel\nart at the largest whole multiple that fits the screen) and scales the stage to fit when it\nis resized.", + "description": "A window whose stage has this size in stage pixels. The window opens at that size (in pixel\nart at the largest whole multiple that fits the screen) and scales the stage to fit when it\nis resized.", "scratchblock": null, "paramDocs": [ - "width: the width of the window", - "height: the height of the window" + "width: the stage width", + "height: the stage height" ], "returns": null, "since": "", @@ -14218,13 +14640,13 @@ "int height", "String assets" ], - "summary": "Constructs a new Window with the specified width, height, and assets path.\nEnsures that only\none instance of Window can be created.", - "description": "Constructs a new Window with the specified width, height, and assets path.\nEnsures that only\none instance of Window can be created.\n\nThe single exception is the window Java builds by itself: a class that\nextends Window and has a `main` method which is not static is\ninstantiated by the JVM before `main` is called, so the\n`new MyWindow()` in that `main` would be the second window. That\none reuses the first instead of failing.", + "summary": "A window of a size that loads a folder of assets first.", + "description": "A window of a size that loads a folder of assets first.", "scratchblock": null, "paramDocs": [ - "width: the width of the window", - "height: the height of the window\n\nThe images, sounds and fonts in the assets folder are loaded while the\nloading screen shows, so they are ready when a sprite first uses them.\nWithout it, a folder named `assets` is loaded, if there is one.", - "assets: the path to the assets" + "width: the stage width", + "height: the stage height", + "assets: the folder, or null" ], "returns": null, "since": "", @@ -14254,11 +14676,11 @@ "params": [ "Object[] values" ], - "summary": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the window's class name.", - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the window's class name.\n\nExample:\n\n```java\nthis.debug(\"fps =\", getFps());\n// prints: [MyWindow] fps = 60\n```", + "summary": "Prints values, but only in debug mode.", + "description": "Prints values, but only in debug mode.", "scratchblock": null, "paramDocs": [ - "values: one or more values to print" + "values: what to print" ], "returns": null, "since": "", @@ -14278,8 +14700,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Exits the application by invoking the `whenExits` method and then calling the\n`exit` method on\nthe `Applet` instance.", - "description": "Exits the application by invoking the `whenExits` method and then calling the\n`exit` method on\nthe `Applet` instance.", + "summary": "Ends the program: [whenExits()](whenExits) runs first.", + "description": "Ends the program: [whenExits()](whenExits) runs first.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14294,30 +14716,26 @@ } }, { - "id": "Window/getDeltaTime()", - "memberId": "Window/getDeltaTime", + "id": "Window/getFrameSmoothing()", + "memberId": "Window/getFrameSmoothing", "owner": "org.openpatch.scratch.Window", "className": "Window", - "methodName": "getDeltaTime", - "static": false, + "methodName": "getFrameSmoothing", + "static": true, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the seconds of game time passed since the last frame. While the game\nis paused this is 0, and at half speed half the real time.", - "description": "Gets the seconds of game time passed since the last frame. While the game\nis paused this is 0, and at half speed half the real time.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "seconds since last frame", + "returns": "the frame smoothing in percent, 0 when off", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getDeltaTime", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getFrameSmoothing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" - } - } + "translations": {} }, { "id": "Window/getGameSpeed()", @@ -14330,11 +14748,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "The game speed set with [setGameSpeed(double)](setGameSpeed).", - "description": "The game speed set with [setGameSpeed(double)](setGameSpeed).", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "1 for normal speed", + "returns": "the game speed", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getGameSpeed", "availability": "implemented", @@ -14352,11 +14770,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the height of the current window.", - "description": "Retrieves the height of the current window.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the height of the window in pixels", + "returns": "the stage height in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getHeight", "availability": "implemented", @@ -14378,11 +14796,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the singleton instance of the Window class.", - "description": "Returns the singleton instance of the Window class.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the singleton instance of Window", + "returns": "the window, or null before it was created", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getInstance", "availability": "implemented", @@ -14404,11 +14822,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the title of the library.", - "description": "Returns the title of the library.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the title of the library as a String", + "returns": "\"Scratch for Java\"", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getLibraryTitle", "availability": "implemented", @@ -14430,11 +14848,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the version of the library.", - "description": "Returns the version of the library.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the version of the library as a String", + "returns": "the version of Scratch for Java, e.g. \"7.0.0\"", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getLibraryVersion", "availability": "implemented", @@ -14456,43 +14874,17 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current stage from the Applet instance.", - "description": "Retrieves the current stage from the Applet instance.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the current Stage object", + "returns": "the stage shown", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, - { - "id": "Window/getTextureSampling()", - "memberId": "Window/getTextureSampling", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "getTextureSampling", - "static": true, - "returnType": "TextureSampling", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns how pictures are being smoothed.", - "description": "Returns how pictures are being smoothed.", - "scratchblock": null, - "paramDocs": [], - "returns": "the current setting", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getTextureSampling", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt das eingestellte Glättungsverfahren zurück" - } - } - }, { "id": "Window/getWidth()", "memberId": "Window/getWidth", @@ -14504,11 +14896,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the width of the current window.", - "description": "Retrieves the width of the current window.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the width of the window in pixels", + "returns": "the stage width in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getWidth", "availability": "implemented", @@ -14530,11 +14922,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the application is in debug mode.", - "description": "Checks if the application is in debug mode.\n\nDebug mode can be toggled at runtime by pressing F12.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true if the application is in debug mode, false otherwise.", + "returns": "whether debug mode is on", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isDebug", "availability": "implemented", @@ -14556,33 +14948,77 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Whether the game is paused.", - "description": "Whether the game is paused.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true while paused", + "returns": "whether the game is paused", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isPaused", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, + { + "id": "Window/isPixelArt()", + "memberId": "Window/isPixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "isPixelArt", + "static": true, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether pixel-art mode is on", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isPixelArt", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Window/isSmoothPixelArt()", + "memberId": "Window/isSmoothPixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "isSmoothPixelArt", + "static": true, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether the pixel art scrolls smoothly (see [useSmoothPixelArt()](useSmoothPixelArt))", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isSmoothPixelArt", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Window/isTransitioning()", "memberId": "Window/isTransitioning", "owner": "org.openpatch.scratch.Window", "className": "Window", "methodName": "isTransitioning", - "static": true, + "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns whether a stage transition is in progress, including creation of\nthe destination stage.", - "description": "Returns whether a stage transition is in progress, including creation of\nthe destination stage.\n\nWhile a transition is running, calls to\n[transitionToStage(Stage, int)](transitionToStage) are ignored. A program that moves\nthe player or builds a new stage in the same breath as a warp should\nuse [transitionToStage(Supplier, int)](transitionToStage) so those changes are deferred\nuntil the screen is black and skipped when a transition is already running.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "`true` while a transition is in progress, `false` otherwise", + "returns": "whether a transition is in progress", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isTransitioning", "availability": "implemented", @@ -14600,8 +15036,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Pauses the game: `run()` is no longer called, and timers, gliding\nand animations stand still. The window keeps drawing, so the paused\npicture stays visible, and keys and clicks still reach methods like\n`whenKeyPressed`, so a key can [resume()](resume) the game.", - "description": "Pauses the game: `run()` is no longer called, and timers, gliding\nand animations stand still. The window keeps drawing, so the paused\npicture stays visible, and keys and clicks still reach methods like\n`whenKeyPressed`, so a key can [resume()](resume) the game.", + "summary": "Pauses the game: no ticks run; keys and the mouse still reach the stage and sprites.", + "description": "Pauses the game: no ticks run; keys and the mouse still reach the stage and sprites.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14626,8 +15062,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Lets a paused game go on where it stopped.", - "description": "Lets a paused game go on where it stopped.", + "summary": "Goes on after [pause()](pause).", + "description": "Goes on after [pause()](pause).", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14654,11 +15090,11 @@ "params": [ "boolean debug" ], - "summary": "Enables or disables the debug mode for the application.", - "description": "Enables or disables the debug mode for the application.\n\nDebug mode shows sprite positions, hitboxes, and other debug information.\nIt can also be toggled at runtime by pressing F12.", + "summary": "Debug mode shows what its panel in the bottom right corner has ticked: hitboxes, positions,\nthe mouse and camera, touching pairs, hidden sprites, the clones and the frame rate, and it\nlets `debug(\\u2026)` print. F12 switches it too, and `-Dscratch4j.debug=\\u2026` presets\nwhich options are on.", + "description": "Debug mode shows what its panel in the bottom right corner has ticked: hitboxes, positions,\nthe mouse and camera, touching pairs, hidden sprites, the clones and the frame rate, and it\nlets `debug(\\u2026)` print. F12 switches it too, and `-Dscratch4j.debug=\\u2026` presets\nwhich options are on.", "scratchblock": null, "paramDocs": [ - "debug: a boolean value where `true` enables debug mode and\n `false` disables\n it." + "debug: on or off" ], "returns": null, "since": "", @@ -14688,11 +15124,11 @@ "params": [ "double speed" ], - "summary": "Makes the game run slower or faster: 1 is normal, 0.5 half as fast, 2\ntwice as fast. `run()`, timers, gliding and animations all follow,\nso the whole game looks like slow motion; the window keeps drawing\nsmoothly.", - "description": "Makes the game run slower or faster: 1 is normal, 0.5 half as fast, 2\ntwice as fast. `run()`, timers, gliding and animations all follow,\nso the whole game looks like slow motion; the window keeps drawing\nsmoothly.", + "summary": "How fast the game runs: 1 is normal, 2 twice as fast, 0.5 half as fast; up to 8. Each tick\nstill is 1/60 s of game time; there are more or fewer of them per second.", + "description": "How fast the game runs: 1 is normal, 2 twice as fast, 0.5 half as fast; up to 8. Each tick\nstill is 1/60 s of game time; there are more or fewer of them per second.", "scratchblock": null, "paramDocs": [ - "speed: 1 for normal speed, smaller for slower, larger for faster" + "speed: the game speed" ], "returns": null, "since": "", @@ -14718,11 +15154,11 @@ "params": [ "Stage stage" ], - "summary": "Sets the current stage of the application.", - "description": "Sets the current stage of the application.", + "summary": "Shows a stage from the next tick on.", + "description": "Shows a stage from the next tick on.", "scratchblock": null, "paramDocs": [ - "stage: the new stage to be set" + "stage: the stage" ], "returns": null, "since": "", @@ -14746,8 +15182,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "While the game is paused: runs it for exactly one frame (every\n`run()` once) and pauses again. Useful to watch closely what\nhappens, for example when two sprites touch.", - "description": "While the game is paused: runs it for exactly one frame (every\n`run()` once) and pauses again. Useful to watch closely what\nhappens, for example when two sprites touch.", + "summary": "While paused: runs exactly one tick.", + "description": "While paused: runs exactly one tick.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14758,7 +15194,7 @@ "translations": {} }, { - "id": "Window/transitionToStage(Stage,int)", + "id": "Window/transitionToStage(Stage,double)", "memberId": "Window/transitionToStage", "owner": "org.openpatch.scratch.Window", "className": "Window", @@ -14767,782 +15203,636 @@ "returnType": "void", "parameterTypes": [ "org.openpatch.scratch.Stage", - "int" + "double" ], "parameterNames": [ "stage", - "duration" + "seconds" ], "params": [ "Stage stage", - "int duration" + "double seconds" ], - "summary": "Transitions to a new stage with a specified duration.", - "description": "Transitions to a new stage with a specified duration.", + "summary": "Fades to a stage through black.", + "description": "Fades to a stage through black.", "scratchblock": null, "paramDocs": [ - "stage: the new stage to transition to", - "duration: the duration of the transition in milliseconds" + "stage: the stage", + "seconds: how long" ], "returns": null, "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Blendet über Schwarz zur angegebenen Bühne über" - } - } - }, - { - "id": "Window/transitionToStage(Supplier,int)", - "memberId": "Window/transitionToStage", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "transitionToStage", - "static": false, - "returnType": "void", - "parameterTypes": [ - "java.util.function.Supplier", - "int" - ], - "parameterNames": [ - "stage", - "duration" - ], - "params": [ - "Supplier stage", - "int duration" - ], - "summary": "Fades to black, creates the destination stage, then fades it in.", - "description": "Fades to black, creates the destination stage, then fades it in.\n\nThe supplier is called exactly once, when the screen is black. It is\nnever called when another transition is already running. Move shared\nsprites and update game state inside the supplier so those changes happen\nonly when the transition is accepted, while the old stage is hidden.\nThe call returns immediately; the supplier runs later on the animation thread.", - "scratchblock": null, - "paramDocs": [ - "stage: creates the destination stage; must return a non-null stage", - "duration: the duration, using the same timing as the Stage overload" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Window/useFullScreen()", - "memberId": "Window/useFullScreen", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "useFullScreen", - "static": true, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Makes the window fill the whole screen.", - "description": "Makes the window fill the whole screen.\n\nCall it before the first stage is created, because the size of the window is\nsettled the moment it opens:\n\n```java\npublic static void main(String[] args) {\n Window.useFullScreen();\n new MyStage();\n}\n```", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useFullScreen", - "availability": "desktop-only", - "availabilityReason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation.", - "translations": { - "de": { - "description": "Nur in der Desktop-Version: startet im Vollbild" - } - } - }, - { - "id": "Window/useSplashLogo(String)", - "memberId": "Window/useSplashLogo", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "useSplashLogo", - "static": true, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "path" - ], - "params": [ - "String path" - ], - "summary": "Puts your own picture on the loading screen in place of the Scratch for Java\nlogo. The picture fades in while your project starts and fades out again\nonce it is ready.", - "description": "Puts your own picture on the loading screen in place of the Scratch for Java\nlogo. The picture fades in while your project starts and fades out again\nonce it is ready.\n\nIt is shrunk to fit if it is large, and never enlarged, so a picture of\nroughly 300 by 300 looks right in a window of the usual size.\n\nCall it before the first stage is created, because the loading screen is the\nfirst thing the window draws:\n\n```java\npublic static void main(String[] args) {\n Window.useSplashLogo(\"assets/logo.png\");\n new MyStage();\n}\n```", - "scratchblock": null, - "paramDocs": [ - "path: a path to an image file or the name of a built-in sprite, or\n `null` for the Scratch for Java logo" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useSplashLogo", - "availability": "desktop-only", - "availabilityReason": "The browser has no desktop splash window. This option only reports a limitation.", - "translations": { - "de": { - "description": "Nur in der Desktop-Version: zeigt beim Start ein Logo" - } - } - }, - { - "id": "Window/useTextureSampling(TextureSampling)", - "memberId": "Window/useTextureSampling", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "useTextureSampling", - "static": true, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.TextureSampling" - ], - "parameterNames": [ - "sampling" - ], - "params": [ - "TextureSampling sampling" - ], - "summary": "Chooses how pictures are smoothed when they are drawn larger or smaller than\nthey really are. Pixel art usually wants [TextureSampling.POINT](../TextureSampling/POINT).", - "description": "Chooses how pictures are smoothed when they are drawn larger or smaller than\nthey really are. Pixel art usually wants [TextureSampling.POINT](../TextureSampling/POINT).\n\nCall it before the first stage is created.\n\n```java\nWindow.useTextureSampling(TextureSampling.POINT);\nnew MyStage();\n```", - "scratchblock": null, - "paramDocs": [ - "sampling: how to smooth pictures" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useTextureSampling", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt fest, wie Bilder beim Vergrößern und Verkleinern geglättet werden. TextureSampling.POINT hält Pixelgrafik scharf, LINEAR (Standard) glättet. BILINEAR und TRILINEAR wirken im Browser wie LINEAR." - } - } - }, - { - "id": "Window/whenExits()", - "memberId": "Window/whenExits", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "whenExits", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the window exits. Override this method to define\ncustom behavior\nwhen the window is closed.", - "description": "This method is called when the window exits. Override this method to define\ncustom behavior\nwhen the window is closed.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/whenExits", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird beim Beenden des Programms aufgerufen" - } - } + "translations": {} }, { - "id": "extensions/camera/Camera/changeX(double)", - "memberId": "extensions/camera/Camera/changeX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "changeX", + "id": "Window/transitionToStage(Supplier,double)", + "memberId": "Window/transitionToStage", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "transitionToStage", "static": false, "returnType": "void", "parameterTypes": [ + "java.util.function.Supplier", "double" ], "parameterNames": [ - "x" + "stage", + "seconds" ], "params": [ - "double x" + "Supplier stage", + "double seconds" ], - "summary": "Changes x by a certain amount", - "description": "Changes x by a certain amount", + "summary": "Fades to a stage made now, on the game thread: a slow constructor shows the loading screen\ninstead of freezing the window.", + "description": "Fades to a stage made now, on the game thread: a slow constructor shows the loading screen\ninstead of freezing the window.", "scratchblock": null, "paramDocs": [ - "x: number in pixels" + "stage: makes the stage, e.g. `() -> new Level2()`", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/changeX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/changeY(double)", - "memberId": "extensions/camera/Camera/changeY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "changeY", + "id": "Window/transitionToStage(Supplier,Transition,double)", + "memberId": "Window/transitionToStage", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "transitionToStage", "static": false, "returnType": "void", "parameterTypes": [ + "java.util.function.Supplier", + "org.openpatch.scratch.Transition", "double" ], "parameterNames": [ - "y" + "stage", + "transition", + "seconds" ], "params": [ - "double y" + "Supplier stage", + "Transition transition", + "double seconds" ], - "summary": "Changes y by a certain amount", - "description": "Changes y by a certain amount", + "summary": "Shows a stage made now through a transition.", + "description": "Shows a stage made now through a transition.\n\n```java\nwindow.transitionToStage(() -> new Level2(), Transition.SLIDE_LEFT, 0.5);\n```", "scratchblock": null, "paramDocs": [ - "y: number in pixels" + "stage: makes the stage", + "transition: how", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/changeY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/changeZoom(double)", - "memberId": "extensions/camera/Camera/changeZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "changeZoom", - "static": false, + "id": "Window/use(Extension)", + "memberId": "Window/use", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "use", + "static": true, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.extension.Extension" ], "parameterNames": [ - "dz" + "extension" ], "params": [ - "double dz" + "Extension extension" ], - "summary": "Changes the zoom level by a certain amount", - "description": "Changes the zoom level by a certain amount", + "summary": "Uses an extension that does not register itself through `META-INF/services` (one in\nyour own project). Call it before `new Window`.", + "description": "Uses an extension that does not register itself through `META-INF/services` (one in\nyour own project). Call it before `new Window`.", "scratchblock": null, "paramDocs": [ - "dz: the amount to change the zoom level by" + "extension: the extension" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/changeZoom", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/use", + "availability": "desktop-only", + "availabilityReason": "Extensions load through the desktop's ServiceLoader and run against its window and render threads. The browser ships its extensions natively; it does not load external or custom extensions.", "translations": {} }, { - "id": "extensions/camera/Camera/constructor()", - "memberId": "extensions/camera/Camera/constructor", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "constructor", - "static": false, - "returnType": "Camera", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Constructs a new Camera with default values. The default position is (0, 0) and the default\nzoom level is 100.", - "description": "Constructs a new Camera with default values. The default position is (0, 0) and the default\nzoom level is 100.", + "id": "Window/useFrameSmoothing(double)", + "memberId": "Window/useFrameSmoothing", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useFrameSmoothing", + "static": true, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "percent" + ], + "params": [ + "double percent" + ], + "summary": "Frame smoothing: each frame is presented mixed with the one before it, this much in percent.\nA screen that holds each frame until the next (every 60 Hz LCD) smears whatever moves,\nbecause the eye gets one picture per 16.7 ms; two pictures per frame (50 is a good value)\nlook like one picture per 8.3 ms and smear about half as much. The world keeps its pixels:\nthe moment nothing moves, current and previous frame are the same and the picture is fully\nsharp. While things move, edges are softer \\u2014 that is the trade. Call it before\n`new Window`; 0 (the default) turns it off.", + "description": "Frame smoothing: each frame is presented mixed with the one before it, this much in percent.\nA screen that holds each frame until the next (every 60 Hz LCD) smears whatever moves,\nbecause the eye gets one picture per 16.7 ms; two pictures per frame (50 is a good value)\nlook like one picture per 8.3 ms and smear about half as much. The world keeps its pixels:\nthe moment nothing moves, current and previous frame are the same and the picture is fully\nsharp. While things move, edges are softer \\u2014 that is the trade. Call it before\n`new Window`; 0 (the default) turns it off.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "percent: how much of the previous frame each presented one keeps, 0 to 100" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useFrameSmoothing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/getPosition()", - "memberId": "extensions/camera/Camera/getPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getPosition", - "static": false, - "returnType": "Vector2", + "id": "Window/useFullScreen()", + "memberId": "Window/useFullScreen", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useFullScreen", + "static": true, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the position of the sprite", - "description": "Returns the position of the sprite", + "summary": "Opens the window full screen (a borderless window at the screen's size). Call it before `new Window`.", + "description": "Opens the window full screen (a borderless window at the screen's size). Call it before `new Window`.", "scratchblock": null, "paramDocs": [], - "returns": "a vector", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getPosition", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useFullScreen", + "availability": "desktop-only", + "availabilityReason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation.", + "translations": { + "de": { + "description": "Nur in der Desktop-Version: startet im Vollbild" + } + } }, { - "id": "extensions/camera/Camera/getX()", - "memberId": "extensions/camera/Camera/getX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getX", - "static": false, - "returnType": "double", + "id": "Window/usePixelArt()", + "memberId": "Window/usePixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "usePixelArt", + "static": true, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the x coordinate of the sprite", - "description": "Returns the x coordinate of the sprite", + "summary": "Pixel-art mode: images are not smoothed, the stage scales by whole numbers only, the default\nfont is Jersey 10 and font sizes are rounded to its pixels. Call it before `new Window`.", + "description": "Pixel-art mode: images are not smoothed, the stage scales by whole numbers only, the default\nfont is Jersey 10 and font sizes are rounded to its pixels. Call it before `new Window`.", "scratchblock": null, "paramDocs": [], - "returns": "a x coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/usePixelArt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/getY()", - "memberId": "extensions/camera/Camera/getY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getY", - "static": false, - "returnType": "double", + "id": "Window/useSmoothPixelArt()", + "memberId": "Window/useSmoothPixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useSmoothPixelArt", + "static": true, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the y coordinate of the sprite", - "description": "Returns the y coordinate of the sprite", + "summary": "Smooth pixel art (Godot's \"canvas items\" way of showing pixel art): as [usePixelArt()](usePixelArt),\nbut the camera moves without snapping and zoom works at any factor. The world is drawn at the\nwindow's resolution with the sprites still sampled by nearest neighbour, so every pixel stays\na sharp square while things move \\u2014 the grid wobbles by a screen pixel instead of the picture\nstepping whole stage pixels (the look of Hyper Light Drifter, as Godot's guide puts it). With\nit, scrolling does not need [useFrameSmoothing(double)](useFrameSmoothing). Call it before\n`new Window`.", + "description": "Smooth pixel art (Godot's \"canvas items\" way of showing pixel art): as [usePixelArt()](usePixelArt),\nbut the camera moves without snapping and zoom works at any factor. The world is drawn at the\nwindow's resolution with the sprites still sampled by nearest neighbour, so every pixel stays\na sharp square while things move \\u2014 the grid wobbles by a screen pixel instead of the picture\nstepping whole stage pixels (the look of Hyper Light Drifter, as Godot's guide puts it). With\nit, scrolling does not need [useFrameSmoothing(double)](useFrameSmoothing). Call it before\n`new Window`.", "scratchblock": null, "paramDocs": [], - "returns": "a y coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useSmoothPixelArt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/getZoom()", - "memberId": "extensions/camera/Camera/getZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getZoom", - "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the zoom level", - "description": "Returns the zoom level", + "id": "Window/useSplashLogo(String)", + "memberId": "Window/useSplashLogo", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useSplashLogo", + "static": true, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "path" + ], + "params": [ + "String path" + ], + "summary": "The logo on the loading screen. Call it before `new Window`.", + "description": "The logo on the loading screen. Call it before `new Window`.", "scratchblock": null, - "paramDocs": [], - "returns": "the zoom level", + "paramDocs": [ + "path: an image" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getZoom", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useSplashLogo", + "availability": "desktop-only", + "availabilityReason": "The browser has no desktop splash window. This option only reports a limitation.", + "translations": { + "de": { + "description": "Nur in der Desktop-Version: zeigt beim Start ein Logo" + } + } }, { - "id": "extensions/camera/Camera/resetZoom()", - "memberId": "extensions/camera/Camera/resetZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "resetZoom", + "id": "Window/whenExits()", + "memberId": "Window/whenExits", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "whenExits", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Resets the zoom level to 100", - "description": "Resets the zoom level to 100", + "summary": "Called when the program ends, on the game thread. Override it to save, say.", + "description": "Called when the program ends, on the game thread. Override it to save, say.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/resetZoom", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/whenExits", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Wird beim Beenden des Programms aufgerufen" + } + } }, { - "id": "extensions/camera/Camera/setPosition(double,double)", - "memberId": "extensions/camera/Camera/setPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setPosition", + "id": "drawing/BitmapText/addGlyph(char,String)", + "memberId": "drawing/BitmapText/addGlyph", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "addGlyph", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "char", + "java.lang.String" ], "parameterNames": [ - "x", - "y" + "character", + "path" ], "params": [ - "double x", - "double y" + "char character", + "String path" ], - "summary": "Sets the position of the sprite", - "description": "Sets the position of the sprite", + "summary": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", + "description": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", "scratchblock": null, "paramDocs": [ - "x: a x coordinate", - "y: a y coordinate" + "character: the character to replace", + "path: its image or built-in costume name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/addGlyph", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setPosition(Vector2)", - "memberId": "extensions/camera/Camera/setPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setPosition", + "id": "drawing/BitmapText/constructor(String)", + "memberId": "drawing/BitmapText/constructor", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "BitmapText", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" ], "parameterNames": [ - "v" + "pattern" ], "params": [ - "Vector2 v" + "String pattern" ], - "summary": "Sets the position of the sprite based on the coordinates of a given vector.", - "description": "Sets the position of the sprite based on the coordinates of a given vector.", + "summary": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", + "description": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", "scratchblock": null, "paramDocs": [ - "v: a vector" + "pattern: image path with an integer format, e.g. \"assets/font%03d.png\"" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setX(double)", - "memberId": "extensions/camera/Camera/setX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setX", + "id": "drawing/BitmapText/draw(Drawing)", + "memberId": "drawing/BitmapText/draw", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "draw", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.drawing.Drawing" ], "parameterNames": [ - "x" + "drawing" ], "params": [ - "double x" + "Drawing drawing" ], - "summary": "Sets the x coordinate", - "description": "Sets the x coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "x: a x coordinate" + "drawing: the current frame's canvas" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setX", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/draw", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setY(double)", - "memberId": "extensions/camera/Camera/setY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setY", + "id": "drawing/BitmapText/getContent()", + "memberId": "drawing/BitmapText/getContent", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "getContent", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "y" - ], - "params": [ - "double y" - ], - "summary": "Sets the y coordinate", - "description": "Sets the y coordinate", + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "y: a y coordinate" - ], - "returns": null, + "paramDocs": [], + "returns": "the text being shown", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setY", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/getContent", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setZoom(double)", - "memberId": "extensions/camera/Camera/setZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setZoom", + "id": "drawing/BitmapText/getHeight()", + "memberId": "drawing/BitmapText/getHeight", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "getHeight", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "zoom" - ], - "params": [ - "double zoom" - ], - "summary": "Sets the zoom", - "description": "Sets the zoom", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "zoom: the zoom level" - ], - "returns": null, + "paramDocs": [], + "returns": "the displayed text's height, including line spacing and sprite size", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setZoom", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/getHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setZoomLimit(double,double)", - "memberId": "extensions/camera/Camera/setZoomLimit", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setZoomLimit", + "id": "drawing/BitmapText/getWidth()", + "memberId": "drawing/BitmapText/getWidth", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "getWidth", "static": false, - "returnType": "void", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "low", - "high" - ], - "params": [ - "double low", - "double high" - ], - "summary": "Sets the zoom limits", - "description": "Sets the zoom limits", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "low: the lower limit", - "high: the upper limit" - ], - "returns": null, + "paramDocs": [], + "returns": "the displayed text's width, including the sprite's size", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setZoomLimit", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toGlobalPosition(Vector2)", - "memberId": "extensions/camera/Camera/toGlobalPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toGlobalPosition", + "id": "drawing/BitmapText/setAlign(TextAlign)", + "memberId": "drawing/BitmapText/setAlign", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setAlign", "static": false, - "returnType": "Vector2", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.TextAlign" ], "parameterNames": [ - "v" + "align" ], "params": [ - "Vector2 v" + "TextAlign align" ], - "summary": "Converts local camera coordinates to screen coordinates", - "description": "Converts local camera coordinates to screen coordinates", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "v: local camera coordinates" + "align: LEFT, CENTER or RIGHT (DEFAULT means LEFT)" ], - "returns": "screen coordinates", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toGlobalPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setAlign", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toGlobalX(double)", - "memberId": "extensions/camera/Camera/toGlobalX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toGlobalX", + "id": "drawing/BitmapText/setFont(String)", + "memberId": "drawing/BitmapText/setFont", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setFont", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "x" + "pattern" ], "params": [ - "double x" + "String pattern" ], - "summary": "Converts local camera x coordinate to screen x coordinate", - "description": "Converts local camera x coordinate to screen x coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "x: local camera x coordinate" + "pattern: glyph path with one integer format for the Unicode code point" ], - "returns": "screen x coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toGlobalX", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toGlobalY(double)", - "memberId": "extensions/camera/Camera/toGlobalY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toGlobalY", + "id": "drawing/BitmapText/setLetterSpacing(double)", + "memberId": "drawing/BitmapText/setLetterSpacing", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setLetterSpacing", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "y" + "spacing" ], "params": [ - "double y" + "double spacing" ], - "summary": "Converts local camera y coordinate to screen y coordinate", - "description": "Converts local camera y coordinate to screen y coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "y: local camera y coordinate" + "spacing: gap between characters; negative values allow italic glyphs to overlap" ], - "returns": "screen y coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toGlobalY", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setLetterSpacing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toLocalPosition(Vector2)", - "memberId": "extensions/camera/Camera/toLocalPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toLocalPosition", + "id": "drawing/BitmapText/setLineSpacing(double)", + "memberId": "drawing/BitmapText/setLineSpacing", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setLineSpacing", "static": false, - "returnType": "Vector2", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "double" ], "parameterNames": [ - "v" + "spacing" ], "params": [ - "Vector2 v" + "double spacing" ], - "summary": "Converts screen coordinates to local camera coordinates", - "description": "Converts screen coordinates to local camera coordinates", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "v: screen coordinates" + "spacing: extra pixels between lines" ], - "returns": "local coordinates", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toLocalPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setLineSpacing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toLocalX(double)", - "memberId": "extensions/camera/Camera/toLocalX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toLocalX", + "id": "drawing/BitmapText/setSpaceWidth(double)", + "memberId": "drawing/BitmapText/setSpaceWidth", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setSpaceWidth", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "x" + "width" ], "params": [ - "double x" + "double width" ], - "summary": "Converts screen x coordinate to local camera x coordinate", - "description": "Converts screen x coordinate to local camera x coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "x: screen x coordinate" + "width: width of a space, in unscaled pixels" ], - "returns": "local x coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toLocalX", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setSpaceWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toLocalY(double)", - "memberId": "extensions/camera/Camera/toLocalY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toLocalY", + "id": "drawing/BitmapText/showText(String)", + "memberId": "drawing/BitmapText/showText", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "showText", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "y" + "text" ], "params": [ - "double y" + "String text" ], - "summary": "Converts screen y coordinate to local camera y coordinate", - "description": "Converts screen y coordinate to local camera y coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "y: screen y coordinate" + "text: text to show, including spaces and newlines" ], - "returns": "local y coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toLocalY", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/showText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/clip(double,double,double,double)", - "memberId": "extensions/drawing/Drawing/clip", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/clip(double,double,double,double)", + "memberId": "drawing/Drawing/clip", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "clip", "static": false, @@ -15565,26 +15855,26 @@ "double width", "double height" ], - "summary": "Limits subsequent drawing to a centred rectangle. This replaces the previous\nclip; it is always cleared when the sprite finishes drawing. For a rotated\nsprite, the clip is the screen-aligned bounding box of this rectangle.", - "description": "Limits subsequent drawing to a centred rectangle. This replaces the previous\nclip; it is always cleared when the sprite finishes drawing. For a rotated\nsprite, the clip is the screen-aligned bounding box of this rectangle.", + "summary": "Draws only inside a rectangle until [noClip()](noClip); a turned sprite clips to the rectangle\naround the turned one.", + "description": "Draws only inside a rectangle until [noClip()](noClip); a turned sprite clips to the rectangle\naround the turned one.", "scratchblock": null, "paramDocs": [ - "x: centre x", - "y: centre y", - "width: clip width", - "height: clip height" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/clip", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/clip", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/image(String,double,double)", - "memberId": "extensions/drawing/Drawing/image", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/image(String,double,double)", + "memberId": "drawing/Drawing/image", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "image", "static": false, @@ -15604,25 +15894,25 @@ "double x", "double y" ], - "summary": "Draws an image at its original size. A built-in costume name also works.", - "description": "Draws an image at its original size. A built-in costume name also works.", + "summary": "An image at its own size, centred on a point.", + "description": "An image at its own size, centred on a point.", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume", - "x: centre x", - "y: centre y" + "path: an image file or a built-in sprite name", + "x: x of its centre", + "y: y of its centre" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/image", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/image", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/image(String,double,double,double,double)", - "memberId": "extensions/drawing/Drawing/image", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/image(String,double,double,double,double)", + "memberId": "drawing/Drawing/image", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "image", "static": false, @@ -15648,27 +15938,27 @@ "double width", "double height" ], - "summary": "Draws an image at the requested size, preserving its source in the cache.", - "description": "Draws an image at the requested size, preserving its source in the cache.", + "summary": "An image stretched to a size, centred on a point.", + "description": "An image stretched to a size, centred on a point.", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume", - "x: centre x", - "y: centre y", - "width: drawn width in pixels", - "height: drawn height in pixels" + "path: an image file or a built-in sprite name", + "x: x of its centre", + "y: y of its centre", + "width: the width", + "height: the height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/image", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/image", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/imageHeight(String)", - "memberId": "extensions/drawing/Drawing/imageHeight", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/imageHeight(String)", + "memberId": "drawing/Drawing/imageHeight", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "imageHeight", "static": false, @@ -15686,19 +15976,19 @@ "description": "", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume" + "path: an image file or a built-in sprite name" ], - "returns": "its original height in pixels", + "returns": "its height in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/imageHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/imageHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/imageWidth(String)", - "memberId": "extensions/drawing/Drawing/imageWidth", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/imageWidth(String)", + "memberId": "drawing/Drawing/imageWidth", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "imageWidth", "static": false, @@ -15716,19 +16006,19 @@ "description": "", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume" + "path: an image file or a built-in sprite name" ], - "returns": "its original width in pixels", + "returns": "its width in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/imageWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/imageWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/noClip()", - "memberId": "extensions/drawing/Drawing/noClip", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/noClip()", + "memberId": "drawing/Drawing/noClip", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "noClip", "static": false, @@ -15736,21 +16026,21 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes this sprite's clip.", - "description": "Removes this sprite's clip.", + "summary": "Draws everywhere again.", + "description": "Draws everywhere again.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/noClip", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/noClip", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/polygon(double[],double[],Color)", - "memberId": "extensions/drawing/Drawing/polygon", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/polygon(double[],double[],Color)", + "memberId": "drawing/Drawing/polygon", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "polygon", "static": false, @@ -15770,25 +16060,25 @@ "double[] y", "Color color" ], - "summary": "Draws a filled polygon with at least three points. Concave polygons are\nsupported; crossing outlines are not.", - "description": "Draws a filled polygon with at least three points. Concave polygons are\nsupported; crossing outlines are not.", + "summary": "A filled polygon.", + "description": "A filled polygon.", "scratchblock": null, "paramDocs": [ - "x: x coordinates", - "y: y coordinates (same length as x)", - "color: fill colour" + "x: x of every corner", + "y: y of every corner", + "color: the fill" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/polygon", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/polygon", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/rectangle(double,double,double,double,Color)", - "memberId": "extensions/drawing/Drawing/rectangle", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/rectangle(double,double,double,double,Color)", + "memberId": "drawing/Drawing/rectangle", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "rectangle", "static": false, @@ -15814,113 +16104,149 @@ "double height", "Color color" ], - "summary": "Draws a filled rectangle centred on (x,y).", - "description": "Draws a filled rectangle centred on (x,y).", + "summary": "A filled rectangle centred on a point.", + "description": "A filled rectangle centred on a point.", "scratchblock": null, "paramDocs": [ - "x: centre x", - "y: centre y", - "width: width in pixels", - "height: height in pixels", - "color: fill colour" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height", + "color: the fill" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/rectangle", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/rectangle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/changeTransparency(double)", - "memberId": "extensions/drawing/DrawingSprite/changeTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "changeTransparency", + "id": "drawing/DrawingExtension/constructor()", + "memberId": "drawing/DrawingExtension/constructor", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "constructor", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "step" - ], - "params": [ - "double step" - ], - "summary": "", - "description": "", + "returnType": "DrawingExtension", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Registers the drawing extension; found through ServiceLoader, learners never see it.", + "description": "Registers the drawing extension; found through ServiceLoader, learners never see it.", "scratchblock": null, - "paramDocs": [ - "step: change in percentage points" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/changeTransparency", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/constructor()", - "memberId": "extensions/drawing/DrawingSprite/constructor", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "constructor", + "id": "drawing/DrawingExtension/id()", + "memberId": "drawing/DrawingExtension/id", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "id", "static": false, - "returnType": "DrawingSprite", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a custom drawing sprite.", - "description": "Creates a custom drawing sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/draw(Drawing)", - "memberId": "extensions/drawing/DrawingSprite/draw", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "draw", + "id": "drawing/DrawingExtension/install(ExtensionContext)", + "memberId": "drawing/DrawingExtension/install", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "install", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "org.openpatch.scratch.extension.ExtensionContext" ], "parameterNames": [ - "drawing" + "ctx" ], "params": [ - "Drawing drawing" + "ExtensionContext ctx" ], - "summary": "Draws this frame's appearance. Override this method; use run() for changes\nto game state, since a paused game can still be redrawn.", - "description": "Draws this frame's appearance. Override this method; use run() for changes\nto game state, since a paused game can still be redrawn.", + "summary": "Every layer gets a drawer that lets the stage's visible drawing sprites of that layer draw,\nback to front.", + "description": "Every layer gets a drawer that lets the stage's visible drawing sprites of that layer draw,\nback to front.", "scratchblock": null, "paramDocs": [ - "drawing: this frame's canvas in local Scratch coordinates" + "ctx: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/draw", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/install", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/getTransparency()", - "memberId": "extensions/drawing/DrawingSprite/getTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "getTransparency", + "id": "drawing/DrawingExtension/name()", + "memberId": "drawing/DrawingExtension/name", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "name", "static": false, - "returnType": "double", + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "drawing/DrawingExtension/requires()", + "memberId": "drawing/DrawingExtension/requires", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "requires", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "drawing/DrawingExtension/version()", + "memberId": "drawing/DrawingExtension/version", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "version", + "static": false, + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], @@ -15928,2045 +16254,2383 @@ "description": "", "scratchblock": null, "paramDocs": [], - "returns": "transparency in percent", + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "drawing/DrawingSprite/constructor()", + "memberId": "drawing/DrawingSprite/constructor", + "owner": "org.openpatch.scratch.drawing.DrawingSprite", + "className": "DrawingSprite", + "methodName": "constructor", + "static": false, + "returnType": "DrawingSprite", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A drawing sprite; it has no hitbox unless given one.", + "description": "A drawing sprite; it has no hitbox unless given one.", + "scratchblock": null, + "paramDocs": [], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/getTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingSprite/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/setIsUI(boolean)", - "memberId": "extensions/drawing/DrawingSprite/setIsUI", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "id": "drawing/DrawingSprite/draw(Drawing)", + "memberId": "drawing/DrawingSprite/draw", + "owner": "org.openpatch.scratch.drawing.DrawingSprite", "className": "DrawingSprite", - "methodName": "setIsUI", + "methodName": "draw", "static": false, "returnType": "void", "parameterTypes": [ - "boolean" + "org.openpatch.scratch.drawing.Drawing" ], "parameterNames": [ - "isUI" + "drawing" ], "params": [ - "boolean isUI" + "Drawing drawing" ], - "summary": "Chooses whether the drawing stays fixed on screen as UI.", - "description": "Chooses whether the drawing stays fixed on screen as UI.", + "summary": "Draws the sprite; called every frame on the game thread.", + "description": "Draws the sprite; called every frame on the game thread.", "scratchblock": null, "paramDocs": [ - "isUI: true for UI, false for the game world" + "drawing: what to draw with, in the sprite's own coordinates" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/setIsUI", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingSprite/draw", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/setTransparency(double)", - "memberId": "extensions/drawing/DrawingSprite/setTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "setTransparency", + "id": "extension/Canvas/clip(double,double,double,double)", + "memberId": "extension/Canvas/clip", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "clip", "static": false, "returnType": "void", "parameterTypes": [ + "double", + "double", + "double", "double" ], "parameterNames": [ - "percent" + "x", + "y", + "width", + "height" ], "params": [ - "double percent" + "double x", + "double y", + "double width", + "double height" ], - "summary": "", - "description": "", + "summary": "Draws only inside a rectangle (axis-aligned on the screen) until [noClip()](noClip).", + "description": "Draws only inside a rectangle (axis-aligned on the screen) until [noClip()](noClip).", "scratchblock": null, "paramDocs": [ - "percent: 0 solid, 100 invisible" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/setTransparency", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/fs/File/constructor()", - "memberId": "extensions/fs/File/constructor", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "constructor", - "static": false, - "returnType": "File", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.", - "description": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.\n\nUsage examples:\n\n```java\n// Save an object as JSON\nFile.save(\"/path/to/file.json\", myObject);\n\n// Save an object as XML\nFile.saveXML(\"/path/to/file.xml\", myObject);\n\n// Load an object from JSON\nMyClass obj = File.load(\"/path/to/file.json\", MyClass.class);\n\n// Load an object from XML\nMyClass obj = File.loadXML(\"/path/to/file.xml\", MyClass.class);\n```\n\nNote: The file paths can be absolute or relative. If a relative path is\nprovided, the class\nwill attempt to load the file from the classpath.\n\nSupported file types:\n\n

    \n
  • JSON\n
  • XML\n
", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/clip", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/load(String,Class)", - "memberId": "extensions/fs/File/load", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "load", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawImage(String,double,double,double,double)", + "memberId": "extension/Canvas/drawImage", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawImage", + "static": false, + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.Class" + "double", + "double", + "double", + "double" ], "parameterNames": [ "path", - "cls" + "x", + "y", + "width", + "height" ], "params": [ "String path", - "Class cls" + "double x", + "double y", + "double width", + "double height" ], - "summary": "Loads an object of the specified class from a file at the given path.", - "description": "Loads an object of the specified class from a file at the given path.", + "summary": "An image (a file or a built-in sprite name), centred on a point.", + "description": "An image (a file or a built-in sprite name), centred on a point.", "scratchblock": null, "paramDocs": [ - "path: the path to the file from which the object is to be loaded", - "cls: the class of the object to be loaded" + "path: the image", + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height" ], - "returns": "the loaded object of the specified class", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/load", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawImage", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/loadOrCreate(String,Class)", - "memberId": "extensions/fs/File/loadOrCreate", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "loadOrCreate", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawImageQuad(String,int,int,int,int,double[])", + "memberId": "extension/Canvas/drawImageQuad", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawImageQuad", + "static": false, + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.Class" + "int", + "int", + "int", + "int", + "double[]" ], "parameterNames": [ "path", - "cls" + "sx", + "sy", + "sw", + "sh", + "corners" ], "params": [ "String path", - "Class cls" + "int sx", + "int sy", + "int sw", + "int sh", + "double[] corners" ], - "summary": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", - "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", + "summary": "A region of an image on any quad: turned, mirrored, sheared.", + "description": "A region of an image on any quad: turned, mirrored, sheared.", "scratchblock": null, "paramDocs": [ - "path: the path to the file from which the object is to be loaded", - "cls: the class of the object to be loaded" + "path: the image", + "sx: the region's left edge in image pixels", + "sy: its top edge", + "sw: its width", + "sh: its height", + "corners: where the region's top-left, top-right, bottom-right and bottom-left corners go:\n `x0, y0, \\u2026, x3, y3`" ], - "returns": "the loaded object of the specified class, or a new instance if the\n file does not exist", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/loadOrCreate", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawImageQuad", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/loadXML(String,Class)", - "memberId": "extensions/fs/File/loadXML", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "loadXML", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawImageRegion(String,int,int,int,int,double,double,double,double)", + "memberId": "extension/Canvas/drawImageRegion", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawImageRegion", + "static": false, + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.Class" + "int", + "int", + "int", + "int", + "double", + "double", + "double", + "double" ], "parameterNames": [ "path", - "cls" + "sx", + "sy", + "sw", + "sh", + "x", + "y", + "width", + "height" ], "params": [ "String path", - "Class cls" + "int sx", + "int sy", + "int sw", + "int sh", + "double x", + "double y", + "double width", + "double height" ], - "summary": "Loads an object of the specified class from an XML file at the given path.", - "description": "Loads an object of the specified class from an XML file at the given path.", + "summary": "A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font.", + "description": "A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font.", "scratchblock": null, "paramDocs": [ - "path: the path to the XML file", - "cls: the class of the object to be loaded" + "path: the image", + "sx: the region's left edge in image pixels", + "sy: its top edge", + "sw: its width", + "sh: its height", + "x: x of the centre", + "y: y of the centre", + "width: the width to draw it at", + "height: the height to draw it at" ], - "returns": "the object loaded from the XML file", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/loadXML", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawImageRegion", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/loadXMLOrCreate(String,Class)", - "memberId": "extensions/fs/File/loadXMLOrCreate", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "loadXMLOrCreate", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawOutline(double[],double[],Color,double)", + "memberId": "extension/Canvas/drawOutline", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawOutline", + "static": false, + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.Class" + "double[]", + "double[]", + "org.openpatch.scratch.Color", + "double" ], "parameterNames": [ - "path", - "cls" + "xs", + "ys", + "stroke", + "weight" ], "params": [ - "String path", - "Class cls" + "double[] xs", + "double[] ys", + "Color stroke", + "double weight" ], - "summary": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", - "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", + "summary": "The outline of a polygon.", + "description": "The outline of a polygon.", "scratchblock": null, "paramDocs": [ - "path: the path to the XML file", - "cls: the class of the object to be loaded" + "xs: x of every corner", + "ys: y of every corner", + "stroke: the outline's colour", + "weight: the outline's width" ], - "returns": "the object loaded from the XML file, or a new instance if the file\n does not exist", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/loadXMLOrCreate", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawOutline", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/save(String,T)", - "memberId": "extensions/fs/File/save", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "save", - "static": true, + "id": "extension/Canvas/drawPolygon(double[],double[],Color)", + "memberId": "extension/Canvas/drawPolygon", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawPolygon", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "T" + "double[]", + "double[]", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "path", - "obj" + "xs", + "ys", + "fill" ], "params": [ - "String path", - "T obj" + "double[] xs", + "double[] ys", + "Color fill" ], - "summary": "Saves the given object to the specified path in the default file type (JSON).", - "description": "Saves the given object to the specified path in the default file type (JSON).", + "summary": "A filled polygon, concave ones included.", + "description": "A filled polygon, concave ones included.", "scratchblock": null, "paramDocs": [ - "path: the path where the object should be saved", - "obj: the object to be saved" + "xs: x of every corner", + "ys: y of every corner, in the same order", + "fill: its colour" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/save", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawPolygon", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/saveXML(String,T)", - "memberId": "extensions/fs/File/saveXML", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "saveXML", - "static": true, + "id": "extension/Canvas/drawRectangle(double,double,double,double,Color)", + "memberId": "extension/Canvas/drawRectangle", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawRectangle", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "T" + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "path", - "obj" + "x", + "y", + "width", + "height", + "fill" ], "params": [ - "String path", - "T obj" + "double x", + "double y", + "double width", + "double height", + "Color fill" ], - "summary": "Saves the given object as an XML file at the specified path.", - "description": "Saves the given object as an XML file at the specified path.", + "summary": "A filled rectangle centred on a point.", + "description": "A filled rectangle centred on a point.", "scratchblock": null, "paramDocs": [ - "path: the path where the XML file will be saved", - "obj: the object to be saved as XML" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height", + "fill: its colour" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/saveXML", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawRectangle", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/constructor(String,String,Class)", - "memberId": "extensions/fs/SaveData/constructor", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "constructor", + "id": "extension/Canvas/drawText(String,double,double,double,Color)", + "memberId": "extension/Canvas/drawText", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawText", "static": false, - "returnType": "SaveData", + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "java.lang.Class" + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "gameId", - "slot", - "type" + "text", + "x", + "y", + "size", + "color" ], "params": [ - "String gameId", - "String slot", - "Class type" + "String text", + "double x", + "double y", + "double size", + "Color color" ], - "summary": "Selects a game's save slot without creating a file or opening a database.", - "description": "Selects a game's save slot without creating a file or opening a database.", + "summary": "A line of text whose first baseline starts at a point, in the default font.", + "description": "A line of text whose first baseline starts at a point, in the default font.", "scratchblock": null, "paramDocs": [ - "gameId: a stable identifier, for example org.openpatch.coincatcher", - "slot: a slot name, for example slot1, slot2 or slot3", - "type: the data class to load" + "text: the text", + "x: where it starts", + "y: its baseline", + "size: the font size", + "color: the colour of the letters" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawText", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/getLocation()", - "memberId": "extensions/fs/SaveData/getLocation", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "getLocation", + "id": "extension/Canvas/imageHeight(String)", + "memberId": "extension/Canvas/imageHeight", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "imageHeight", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", - "description": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", + "returnType": "int", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "path" + ], + "params": [ + "String path" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], - "returns": "a description of the save location", + "paramDocs": [ + "path: an image or a built-in sprite name" + ], + "returns": "its height in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/getLocation", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/imageHeight", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/loadOrDefault(Supplier)", - "memberId": "extensions/fs/SaveData/loadOrDefault", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "loadOrDefault", + "id": "extension/Canvas/imageWidth(String)", + "memberId": "extension/Canvas/imageWidth", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "imageWidth", "static": false, - "returnType": "T", + "returnType": "int", "parameterTypes": [ - "java.util.function.Supplier" + "java.lang.String" ], "parameterNames": [ - "defaults" + "path" ], "params": [ - "Supplier defaults" + "String path" ], - "summary": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", - "description": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "defaults: creates initial progress for a missing slot; called only when missing" + "path: an image or a built-in sprite name" ], - "returns": "loaded progress, or the supplied defaults for a missing slot", + "returns": "its width in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/loadOrDefault", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/imageWidth", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/path()", - "memberId": "extensions/fs/SaveData/path", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "path", + "id": "extension/Canvas/noClip()", + "memberId": "extension/Canvas/noClip", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "noClip", "static": false, - "returnType": "Path", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", - "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "summary": "Draws everywhere again.", + "description": "Draws everywhere again.", "scratchblock": null, "paramDocs": [], - "returns": "the desktop file path", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/path", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/noClip", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/save(T)", - "memberId": "extensions/fs/SaveData/save", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "save", + "id": "extension/Canvas/setOpacity(double)", + "memberId": "extension/Canvas/setOpacity", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "setOpacity", "static": false, "returnType": "void", "parameterTypes": [ - "T" + "double" ], "parameterNames": [ - "data" + "opacity" ], "params": [ - "T data" + "double opacity" ], - "summary": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", - "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "data: the progress to save; must not be null" + "opacity: how opaque what follows is drawn, 0 to 1" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/save", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/setOpacity", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/background()", - "memberId": "extensions/pixels/Pixels/background", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "background", + "id": "extension/Extension/coreVersion()", + "memberId": "extension/Extension/coreVersion", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "coreVersion", + "static": true, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "The version of the core library, e.g. `\"7.0.0\"`.", + "description": "The version of the core library, e.g. `\"7.0.0\"`.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/coreVersion", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/Extension/id()", + "memberId": "extension/Extension/id", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "id", "static": false, - "returnType": "int[]", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pixels of the background layer, where the pen and stamps draw.", - "description": "Returns the pixels of the background layer, where the pen and stamps draw.", + "summary": "A short unique id such as `\"tiled\"`, used in messages.", + "description": "A short unique id such as `\"tiled\"`, used in messages.", "scratchblock": null, "paramDocs": [], - "returns": "one colour per pixel", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/background", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/id", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/constructor(PGraphics,PGraphics,PGraphics)", - "memberId": "extensions/pixels/Pixels/constructor", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "constructor", + "id": "extension/Extension/install(ExtensionContext)", + "memberId": "extension/Extension/install", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "install", "static": false, - "returnType": "Pixels", + "returnType": "void", "parameterTypes": [ - "processing.core.PGraphics", - "processing.core.PGraphics", - "processing.core.PGraphics" + "org.openpatch.scratch.extension.ExtensionContext" ], "parameterNames": [ - "mainBuffer", - "backgroundBuffer", - "foregroundBuffer" + "ctx" ], "params": [ - "PGraphics mainBuffer", - "PGraphics backgroundBuffer", - "PGraphics foregroundBuffer" + "ExtensionContext ctx" ], - "summary": "Creates the pixel access for a stage.", - "description": "Creates the pixel access for a stage.", + "summary": "Adds the extension's hooks. Called once, on the window thread, before the first stage.", + "description": "Adds the extension's hooks. Called once, on the window thread, before the first stage.", "scratchblock": null, "paramDocs": [ - "mainBuffer: where the sprites are drawn", - "backgroundBuffer: where the background is drawn", - "foregroundBuffer: where the foreground is drawn" + "ctx: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/install", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/foreground()", - "memberId": "extensions/pixels/Pixels/foreground", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "foreground", + "id": "extension/Extension/name()", + "memberId": "extension/Extension/name", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "name", "static": false, - "returnType": "int[]", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pixels of the foreground layer.", - "description": "Returns the pixels of the foreground layer.", + "summary": "A name for people, such as `\"Tiled maps\"`.", + "description": "A name for people, such as `\"Tiled maps\"`.", "scratchblock": null, "paramDocs": [], - "returns": "one colour per pixel", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/foreground", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/name", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/main()", - "memberId": "extensions/pixels/Pixels/main", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "main", + "id": "extension/Extension/requires()", + "memberId": "extension/Extension/requires", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "requires", "static": false, - "returnType": "int[]", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pixels of the layer the sprites are drawn on.", - "description": "Returns the pixels of the layer the sprites are drawn on.", + "summary": "The core versions this extension works with: `\"7\"` means any 7.x, `\"7.1\"` 7.1\nor newer, `\"7.1.2\"` 7.1.2 or newer, always below the next major version.", + "description": "The core versions this extension works with: `\"7\"` means any 7.x, `\"7.1\"` 7.1\nor newer, `\"7.1.2\"` 7.1.2 or newer, always below the next major version.", "scratchblock": null, "paramDocs": [], - "returns": "one colour per pixel", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/main", - "availability": "desktop-only", - "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "translations": {} - }, - { - "id": "extensions/recorder/FFmpegRecorder/constructor(String)", - "memberId": "extensions/recorder/FFmpegRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "className": "FFmpegRecorder", - "methodName": "constructor", - "static": false, - "returnType": "FFmpegRecorder", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "path" - ], - "params": [ - "String path" - ], - "summary": "Constructs an FFmpegRecorder object with the specified path.", - "description": "Constructs an FFmpegRecorder object with the specified path.", - "scratchblock": null, - "paramDocs": [ - "path: the path where the recording will be saved\n \n\nThis constructor initializes the FFmpegRecorder by creating a temporary directory and\n setting up a pattern for temporary PNG files. If the temporary directory cannot be created,\n an error message is printed to the console." - ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FFmpegRecorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/requires", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FFmpegRecorder/saveFrame()", - "memberId": "extensions/recorder/FFmpegRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "className": "FFmpegRecorder", - "methodName": "saveFrame", + "id": "extension/Extension/version()", + "memberId": "extension/Extension/version", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "version", "static": false, - "returnType": "void", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Saves the current frame using the specified pattern.", - "description": "Saves the current frame using the specified pattern.", + "summary": "The extension's own version.", + "description": "The extension's own version.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FFmpegRecorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/version", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FFmpegRecorder/stop()", - "memberId": "extensions/recorder/FFmpegRecorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "className": "FFmpegRecorder", - "methodName": "stop", + "id": "extension/ExtensionContext/addLayerDrawer(Layer,LayerDrawer)", + "memberId": "extension/ExtensionContext/addLayerDrawer", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "addLayerDrawer", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the recording process and converts the recorded frames into a video file using FFmpeg.", - "description": "Stops the recording process and converts the recorded frames into a video file using FFmpeg.\n\nThis method overrides the `stop` method from the superclass. It first calls the superclass's\n`stop` method, then checks if the temporary directory (`tmpDir`) is not null. If it is not\nnull, it constructs a command to run FFmpeg, which converts the recorded frames (stored as PNG\nfiles) into a video file with the specified frame rate and codec.\n\nThe FFmpeg command is executed, and a message is printed to the console indicating that the\nvideo conversion is in progress. If there is an error during the execution of the command, the\nerror message is printed to the console.", + "parameterTypes": [ + "org.openpatch.scratch.Layer", + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" + ], + "parameterNames": [ + "layer", + "drawer" + ], + "params": [ + "Layer layer", + "LayerDrawer drawer" + ], + "summary": "Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles,\ndrawings. Game thread, when the draw list is made.", + "description": "Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles,\ndrawings. Game thread, when the draw list is made.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "layer: ", + "drawer: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FFmpegRecorder/stop", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/addLayerDrawer", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FrameRecorder/constructor(String)", - "memberId": "extensions/recorder/FrameRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "className": "FrameRecorder", - "methodName": "constructor", + "id": "extension/ExtensionContext/addOverlayDrawer(LayerDrawer)", + "memberId": "extension/ExtensionContext/addOverlayDrawer", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "addOverlayDrawer", "static": false, - "returnType": "FrameRecorder", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], "parameterNames": [ - "outputFolder" + "drawer" ], "params": [ - "String outputFolder" + "LayerDrawer drawer" ], - "summary": "Constructs a new FrameRecorder with the specified output folder.", - "description": "Constructs a new FrameRecorder with the specified output folder.", + "summary": "Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave\nit out (Studio's watch pins). Game thread.", + "description": "Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave\nit out (Studio's watch pins). Game thread.", "scratchblock": null, "paramDocs": [ - "outputFolder: the folder where the recorded frames will be saved" + "drawer: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FrameRecorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/addOverlayDrawer", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FrameRecorder/saveFrame()", - "memberId": "extensions/recorder/FrameRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "className": "FrameRecorder", - "methodName": "saveFrame", + "id": "extension/ExtensionContext/afterFrame(BiConsumer)", + "memberId": "extension/ExtensionContext/afterFrame", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "afterFrame", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Saves the current frame of the stage to the specified output folder. The frame is saved as a\nPNG file with a filename pattern \"#######.png\". The exact filename will be generated based on\nthe current frame number. The picture is the stage at its own size, also when the window is\nbigger.", - "description": "Saves the current frame of the stage to the specified output folder. The frame is saved as a\nPNG file with a filename pattern \"#######.png\". The exact filename will be generated based on\nthe current frame number. The picture is the stage at its own size, also when the window is\nbigger.", + "parameterTypes": [ + "java.util.function.BiConsumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "BiConsumer hook" + ], + "summary": "After a frame was drawn, on the window thread.", + "description": "After a frame was drawn, on the window thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FrameRecorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/afterFrame", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FrameRecorder/snapshot(String)", - "memberId": "extensions/recorder/FrameRecorder/snapshot", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "className": "FrameRecorder", - "methodName": "snapshot", + "id": "extension/ExtensionContext/beforeTick(Consumer)", + "memberId": "extension/ExtensionContext/beforeTick", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "beforeTick", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.util.function.Consumer" ], "parameterNames": [ - "filename" + "hook" ], "params": [ - "String filename" + "Consumer hook" ], - "summary": "Takes a snapshot of the current frame and saves it to the specified filename.", - "description": "Takes a snapshot of the current frame and saves it to the specified filename.", + "summary": "Every tick, after the tick's input and before timers and `run()`. Game thread.", + "description": "Every tick, after the tick's input and before timers and `run()`. Game thread.", "scratchblock": null, "paramDocs": [ - "filename: the name of the file to save the snapshot to" + "hook: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FrameRecorder/snapshot", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/beforeTick", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/constructor(String)", - "memberId": "extensions/recorder/GifRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "constructor", + "id": "extension/ExtensionContext/dispatch(Stage,Class,Consumer)", + "memberId": "extension/ExtensionContext/dispatch", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "dispatch", "static": false, - "returnType": "GifRecorder", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Stage", + "java.lang.Class", + "java.util.function.Consumer" ], "parameterNames": [ - "filePath" + "stage", + "listener", + "call" ], "params": [ - "String filePath" + "Stage stage", + "Class listener", + "Consumer call" ], - "summary": "Constructs a new GifRecorder object.", - "description": "Constructs a new GifRecorder object.", + "summary": "Calls a listener interface on the stage and every sprite of it that implements it, at the\npoint of the tick where key events arrive. Learner exceptions thrown there stop the game like\nany learner exception. Game thread.", + "description": "Calls a listener interface on the stage and every sprite of it that implements it, at the\npoint of the tick where key events arrive. Learner exceptions thrown there stop the game like\nany learner exception. Game thread.", "scratchblock": null, "paramDocs": [ - "filePath: the path where the GIF file will be saved" + "stage: ", + "listener: ", + "call: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/dispatch", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/saveFrame()", - "memberId": "extensions/recorder/GifRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "saveFrame", + "id": "extension/ExtensionContext/getTickCount()", + "memberId": "extension/ExtensionContext/getTickCount", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "getTickCount", "static": false, - "returnType": "void", + "returnType": "long", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Saves the current frame of the stage as a GIF image.", - "description": "Saves the current frame of the stage as a GIF image.\n\nThis method captures the stage at its own size, sets the frame rate, and adds the frame to\nthe GIF encoder. A window that is bigger than the stage (maximized, say) records the stage\nwithout the bars around it, and the frames keep their size when the window changes during the\nrecording.\n\nNote: This method catches and ignores any NullPointerException that may occur.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], + "returns": "ticks run so far", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/getTickCount", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/ExtensionContext/input(InputKey)", + "memberId": "extension/ExtensionContext/input", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "input", + "static": false, + "returnType": "T", + "parameterTypes": [ + "org.openpatch.scratch.extension.ExtensionContext.InputKey" + ], + "parameterNames": [ + "key" + ], + "params": [ + "InputKey key" + ], + "summary": "This batch's copy of a slot of the input snapshot. Game thread.", + "description": "This batch's copy of a slot of the input snapshot. Game thread.", + "scratchblock": null, + "paramDocs": [ + "key: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/input", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/snapshot()", - "memberId": "extensions/recorder/GifRecorder/snapshot", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "snapshot", + "id": "extension/ExtensionContext/isLoading()", + "memberId": "extension/ExtensionContext/isLoading", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "isLoading", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the\ncurrent frame, and then finishes the encoding process.", - "description": "Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the\ncurrent frame, and then finishes the encoding process.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether the loading screen is up", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/snapshot", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/isLoading", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/start()", - "memberId": "extensions/recorder/GifRecorder/start", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "start", + "id": "extension/ExtensionContext/onExit(Runnable)", + "memberId": "extension/ExtensionContext/onExit", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onExit", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Starts the GIF recording process.", - "description": "Starts the GIF recording process.", + "parameterTypes": [ + "java.lang.Runnable" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Runnable hook" + ], + "summary": "At the end of the program, after `whenExits()`. Game thread.", + "description": "At the end of the program, after `whenExits()`. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/start", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onExit", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/stop()", - "memberId": "extensions/recorder/GifRecorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "stop", + "id": "extension/ExtensionContext/onInputPoll(Consumer)", + "memberId": "extension/ExtensionContext/onInputPoll", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onInputPoll", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the GIF recording process and finalizes the GIF file.", - "description": "Stops the GIF recording process and finalizes the GIF file.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into\nthe snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed.", + "description": "Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into\nthe snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/stop", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onInputPoll", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/constructor(String,String)", - "memberId": "extensions/recorder/Recorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "constructor", + "id": "extension/ExtensionContext/onKey(Consumer)", + "memberId": "extension/ExtensionContext/onKey", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onKey", "static": false, - "returnType": "Recorder", + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "java.util.function.Consumer" ], "parameterNames": [ - "path", - "ext" + "hook" ], "params": [ - "String path", - "String ext" + "Consumer hook" ], - "summary": "Constructs a new Recorder object with the specified file path and extension. If the provided\npath does not end with the specified extension, the extension is appended to the path.", - "description": "Constructs a new Recorder object with the specified file path and extension. If the provided\npath does not end with the specified extension, the extension is appended to the path.", + "summary": "Every key press and release, before learner code sees it; observe only. Game thread.", + "description": "Every key press and release, before learner code sees it; observe only. Game thread.", "scratchblock": null, "paramDocs": [ - "path: the file path where the recording will be saved", - "ext: the file extension to be used for the recording" + "hook: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onKey", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/post()", - "memberId": "extensions/recorder/Recorder/post", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "post", + "id": "extension/ExtensionContext/onLearnerError(Consumer)", + "memberId": "extension/ExtensionContext/onLearnerError", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onLearnerError", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Called after each frame is drawn. This method is registered with the Applet class to ensure\nthat frames are saved at the appropriate time during the recording process.", - "description": "Called after each frame is drawn. This method is registered with the Applet class to ensure\nthat frames are saved at the appropriate time during the recording process.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "A learner exception stopped the game. Game thread.", + "description": "A learner exception stopped the game. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/post", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onLearnerError", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/saveFrame()", - "memberId": "extensions/recorder/Recorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "saveFrame", + "id": "extension/ExtensionContext/onMouse(Consumer)", + "memberId": "extension/ExtensionContext/onMouse", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onMouse", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Saves the current frame. This method should be implemented by subclasses to define the specific\nbehavior for saving a frame.", - "description": "Saves the current frame. This method should be implemented by subclasses to define the specific\nbehavior for saving a frame.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "Every mouse event, before learner code sees it; observe only. Game thread.", + "description": "Every mouse event, before learner code sees it; observe only. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onMouse", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/start()", - "memberId": "extensions/recorder/Recorder/start", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "start", + "id": "extension/ExtensionContext/onStageCreated(Consumer)", + "memberId": "extension/ExtensionContext/onStageCreated", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onStageCreated", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Starts the recording process.", - "description": "Starts the recording process.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "A stage was made (on the thread that made it, usually the game thread or main).", + "description": "A stage was made (on the thread that made it, usually the game thread or main).", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/start", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onStageCreated", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/stop()", - "memberId": "extensions/recorder/Recorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "stop", + "id": "extension/ExtensionContext/onStageDisposed(Consumer)", + "memberId": "extension/ExtensionContext/onStageDisposed", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onStageDisposed", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the recording process.", - "description": "Stops the recording process.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "A stage stopped being shown. Game thread.", + "description": "A stage stopped being shown. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/stop", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onStageDisposed", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/constructor(String,String,String)", - "memberId": "extensions/shader/Shader/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "constructor", + "id": "extension/ExtensionContext/registerImageFormat(String,ImageDecoder)", + "memberId": "extension/ExtensionContext/registerImageFormat", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "registerImageFormat", "static": false, - "returnType": "Shader", + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder" ], "parameterNames": [ - "name", - "fragmentShaderPath", - "vertexShaderPath" + "suffix", + "decoder" ], "params": [ - "String name", - "String fragmentShaderPath", - "String vertexShaderPath" + "String suffix", + "ImageDecoder decoder" ], - "summary": "Constructor", - "description": "Constructor", + "summary": "Images whose name ends in `suffix` (e.g. `\".ase\"`) are decoded by\n`decoder`.", + "description": "Images whose name ends in `suffix` (e.g. `\".ase\"`) are decoded by\n`decoder`.", "scratchblock": null, "paramDocs": [ - "name: unique name", - "fragmentShaderPath: path to the fragment shader file", - "vertexShaderPath: path to the vertex shader file, or null for Processing's default one" + "suffix: ", + "decoder: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/registerImageFormat", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/constructor(Shader)", - "memberId": "extensions/shader/Shader/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "constructor", + "id": "extension/ExtensionContext/runOnGameThread(Runnable)", + "memberId": "extension/ExtensionContext/runOnGameThread", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "runOnGameThread", "static": false, - "returnType": "Shader", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.shader.Shader" + "java.lang.Runnable" ], "parameterNames": [ - "shader" + "task" ], "params": [ - "Shader shader" + "Runnable task" ], - "summary": "Copy constructor", - "description": "Copy constructor", + "summary": "Runs a task at the start of the next tick, before input.", + "description": "Runs a task at the start of the next tick, before input.", "scratchblock": null, "paramDocs": [ - "shader: shader" + "task: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/runOnGameThread", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/getName()", - "memberId": "extensions/shader/Shader/getName", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "getName", + "id": "extension/Frame/getArgb()", + "memberId": "extension/Frame/getArgb", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "getArgb", "static": false, - "returnType": "String", + "returnType": "int[]", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the name", - "description": "Returns the name", + "summary": "Straight ARGB, top row first.", + "description": "Straight ARGB, top row first.", "scratchblock": null, "paramDocs": [], - "returns": "the name", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/getName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/getArgb", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/getPShader()", - "memberId": "extensions/shader/Shader/getPShader", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "getPShader", + "id": "extension/Frame/getHeight()", + "memberId": "extension/Frame/getHeight", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "getHeight", "static": false, - "returnType": "PShader", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the shader", - "description": "Returns the shader", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the shader", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/getPShader", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/getHeight", "availability": "desktop-only", - "availabilityReason": "Processing's PShader object belongs to the desktop renderer. The browser uses WebGL filters.", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/Frame/getWidth()", + "memberId": "extension/Frame/getWidth", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "getWidth", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/getWidth", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/Frame/savePng(Path)", + "memberId": "extension/Frame/savePng", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "savePng", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "java.nio.file.Path" ], "parameterNames": [ - "name", - "x" + "file" ], "params": [ - "String name", - "int x" + "Path file" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the uniform in the shader file", - "x: the value" + "file: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/savePng", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,boolean)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/ImageDecoder/decode(byte[])", + "memberId": "extension/ImageDecoder/decode", + "owner": "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder", + "className": "ImageDecoder", + "methodName": "decode", "static": false, - "returnType": "void", + "returnType": "DecodedImage", "parameterTypes": [ - "java.lang.String", - "boolean" + "byte[]" ], "parameterNames": [ - "name", - "x" + "file" ], "params": [ - "String name", - "boolean x" + "byte[] file" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: " + "file: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ImageDecoder/decode", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,double)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/InputKey/copy(T,T)", + "memberId": "extension/InputKey/copy", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "copy", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double" + "T", + "T" ], "parameterNames": [ - "name", - "x" + "from", + "into" ], "params": [ - "String name", - "double x" + "T from", + "T into" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "For the core: copies one state into another.", + "description": "For the core: copies one state into another.", "scratchblock": null, "paramDocs": [ - "name: ", - "x: " + "from: ", + "into: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/copy", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,int,int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/InputKey/create()", + "memberId": "extension/InputKey/create", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "create", "static": false, - "returnType": "void", + "returnType": "T", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "For the core: makes a state for this key.", + "description": "For the core: makes a state for this key.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/create", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/InputKey/of(String,Supplier,BiConsumer)", + "memberId": "extension/InputKey/of", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "of", + "static": true, + "returnType": "InputKey", "parameterTypes": [ "java.lang.String", - "int", - "int" + "java.util.function.Supplier", + "java.util.function.BiConsumer" ], "parameterNames": [ "name", - "x", - "y" + "factory", + "copy" ], "params": [ "String name", - "int x", - "int y" + "Supplier factory", + "BiConsumer copy" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: ", - "y: " + "name: for messages", + "factory: makes an empty state (twice: one per thread)", + "copy: copies the window thread's state into the game thread's: (from, into)" ], + "returns": "the key", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/of", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/InputKey/toString()", + "memberId": "extension/InputKey/toString", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "toString", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/toString", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,boolean,boolean)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/InputSnapshot/get(InputKey)", + "memberId": "extension/InputSnapshot/get", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputSnapshot", + "className": "InputSnapshot", + "methodName": "get", "static": false, - "returnType": "void", + "returnType": "T", "parameterTypes": [ - "java.lang.String", - "boolean", - "boolean" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], "parameterNames": [ - "name", - "x", - "y" + "key" ], "params": [ - "String name", - "boolean x", - "boolean y" + "InputKey key" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: ", - "y: " + "key: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputSnapshot/get", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,double,double)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/LayerDrawer/draw(Stage,Canvas)", + "memberId": "extension/LayerDrawer/draw", + "owner": "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer", + "className": "LayerDrawer", + "methodName": "draw", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double", - "double" + "org.openpatch.scratch.Stage", + "org.openpatch.scratch.extension.Canvas" ], "parameterNames": [ - "name", - "x", - "y" + "stage", + "canvas" ], "params": [ - "String name", - "double x", - "double y" + "Stage stage", + "Canvas canvas" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: ", - "y: " + "stage: ", + "canvas: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/LayerDrawer/draw", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,Vector2)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getStick(GamepadStick)", + "memberId": "gamepad/Gamepad/getStick", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getStick", + "static": true, + "returnType": "Vector2", "parameterTypes": [ - "java.lang.String", - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.gamepad.GamepadStick" ], "parameterNames": [ - "name", - "vec" + "stick" ], "params": [ - "String name", - "Vector2 vec" + "GamepadStick stick" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "Where the first connected controller's stick points, (0, 0) if there is none.", + "description": "Where the first connected controller's stick points, (0, 0) if there is none.", "scratchblock": null, "paramDocs": [ - "name: ", - "vec: " + "stick: the stick to ask about" ], - "returns": null, + "returns": "its position, x \\u22121 to 1 and y \\u22121 to 1 (up is positive)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getStick", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,int[],int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getStick(int,GamepadStick)", + "memberId": "gamepad/Gamepad/getStick", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getStick", + "static": true, + "returnType": "Vector2", "parameterTypes": [ - "java.lang.String", - "int[]", - "int" + "int", + "org.openpatch.scratch.gamepad.GamepadStick" ], "parameterNames": [ - "name", - "values", - "ncoords" + "player", + "stick" ], "params": [ - "String name", - "int[] values", - "int ncoords" + "int player", + "GamepadStick stick" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "Where the player's controller's stick points, (0, 0) if it is not connected.", + "description": "Where the player's controller's stick points, (0, 0) if it is not connected.", "scratchblock": null, "paramDocs": [ - "name: ", - "values: ", - "ncoords: " + "player: the player, 1 to 4", + "stick: the stick to ask about" ], - "returns": null, + "returns": "its position, x \\u22121 to 1 and y \\u22121 to 1 (up is positive)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getStick", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,double[],int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getTrigger(GamepadTrigger)", + "memberId": "gamepad/Gamepad/getTrigger", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getTrigger", + "static": true, + "returnType": "double", "parameterTypes": [ - "java.lang.String", - "double[]", - "int" + "org.openpatch.scratch.gamepad.GamepadTrigger" ], "parameterNames": [ - "name", - "values", - "ncoords" + "trigger" ], "params": [ - "String name", - "double[] values", - "int ncoords" + "GamepadTrigger trigger" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "How far down the first connected controller's trigger is, 0 if there is none.", + "description": "How far down the first connected controller's trigger is, 0 if there is none.", "scratchblock": null, "paramDocs": [ - "name: ", - "values: ", - "ncoords: " + "trigger: the trigger to ask about" ], - "returns": null, + "returns": "how far it is pressed, 0 (not at all) to 1 (fully)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getTrigger", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,Color)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getTrigger(int,GamepadTrigger)", + "memberId": "gamepad/Gamepad/getTrigger", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getTrigger", + "static": true, + "returnType": "double", "parameterTypes": [ - "java.lang.String", - "org.openpatch.scratch.Color" + "int", + "org.openpatch.scratch.gamepad.GamepadTrigger" ], "parameterNames": [ - "name", - "c" + "player", + "trigger" ], "params": [ - "String name", - "Color c" + "int player", + "GamepadTrigger trigger" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "How far down the player's controller's trigger is, 0 if it is not connected.", + "description": "How far down the player's controller's trigger is, 0 if it is not connected.", "scratchblock": null, "paramDocs": [ - "name: ", - "c: " + "player: the player, 1 to 4", + "trigger: the trigger to ask about" ], - "returns": null, + "returns": "how far it is pressed, 0 (not at all) to 1 (fully)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getTrigger", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/setName(String)", - "memberId": "extensions/shader/Shader/setName", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "setName", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/isButtonPressed(GamepadButton)", + "memberId": "gamepad/Gamepad/isButtonPressed", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isButtonPressed", + "static": true, + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "name" + "button" ], "params": [ - "String name" + "GamepadButton button" ], - "summary": "Sets the name", - "description": "Sets the name", + "summary": "Whether any controller has the button down.", + "description": "Whether any controller has the button down.", "scratchblock": null, "paramDocs": [ - "name: unique name" + "button: the button to ask about" ], - "returns": null, + "returns": "whether it is down on any connected controller", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/setName", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isButtonPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/activate(String)", - "memberId": "extensions/shader/Shaders/activate", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "activate", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/isButtonPressed(int,GamepadButton)", + "memberId": "gamepad/Gamepad/isButtonPressed", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isButtonPressed", + "static": true, + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "int", + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "name" + "player", + "button" ], "params": [ - "String name" + "int player", + "GamepadButton button" ], - "summary": "Draws with the shader of the given name as well, without stopping the\nothers. Active shaders take turns in the order they were added, each\nworking on what the one before it drew, so a stage can be tinted and\nwobble at the same time. A sprite draws with the first of its active\nshaders only.", - "description": "Draws with the shader of the given name as well, without stopping the\nothers. Active shaders take turns in the order they were added, each\nworking on what the one before it drew, so a stage can be tinted and\nwobble at the same time. A sprite draws with the first of its active\nshaders only.", + "summary": "Whether the player's controller has the button down.", + "description": "Whether the player's controller has the button down.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "player: the player, 1 to 4", + "button: the button to ask about" ], + "returns": "whether it is down on that player's controller", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isButtonPressed", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "gamepad/Gamepad/isConnected()", + "memberId": "gamepad/Gamepad/isConnected", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isConnected", + "static": true, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Whether any controller is connected.", + "description": "Whether any controller is connected.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/activate", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isConnected", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/add(String,String,String)", - "memberId": "extensions/shader/Shaders/add", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "add", - "static": false, - "returnType": "Shader", + "id": "gamepad/Gamepad/isConnected(int)", + "memberId": "gamepad/Gamepad/isConnected", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isConnected", + "static": true, + "returnType": "boolean", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "java.lang.String" + "int" ], "parameterNames": [ - "name", - "fragmentShaderPath", - "vertexShaderPath" + "player" ], "params": [ - "String name", - "String fragmentShaderPath", - "String vertexShaderPath" + "int player" ], - "summary": "Adds a shader. If a shader with the given name already exists, that one is\nreturned instead.", - "description": "Adds a shader. If a shader with the given name already exists, that one is\nreturned instead.\n\nThe first shader added is drawn with right away; the ones after it wait\nuntil [switchTo(String)](switchTo), [next()](next) or\n[activate(String)](activate) picks them.\n\nThe vertex shader is usually `null`, which uses Processing's default\none. In the browser any other vertex shader is ignored.", + "summary": "Whether a controller sits in the player's slot.", + "description": "Whether a controller sits in the player's slot.", "scratchblock": null, "paramDocs": [ - "name: a unique name", - "fragmentShaderPath: the path to the fragment shader", - "vertexShaderPath: the path to the vertex shader, may be null" + "player: the player, 1 to 4" ], - "returns": "the shader", + "returns": "whether that slot has a controller", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isConnected", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/constructor(String)", - "memberId": "extensions/shader/Shaders/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "constructor", + "id": "gamepad/GamepadListener/whenGamepadButtonPressed(GamepadButton)", + "memberId": "gamepad/GamepadListener/whenGamepadButtonPressed", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "className": "GamepadListener", + "methodName": "whenGamepadButtonPressed", "static": false, - "returnType": "Shaders", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "owner" + "button" ], "params": [ - "String owner" + "GamepadButton button" ], - "summary": "Creates an empty set of shaders.", - "description": "Creates an empty set of shaders.", + "summary": "A button went down on one of the controllers.", + "description": "A button went down on one of the controllers.", "scratchblock": null, "paramDocs": [ - "owner: what the shaders belong to, used in error messages: \"sprite\" or\n \"stage\"" + "button: the button that was pressed" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/GamepadListener/whenGamepadButtonPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/constructor(Shaders)", - "memberId": "extensions/shader/Shaders/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "constructor", + "id": "gamepad/GamepadListener/whenGamepadButtonReleased(GamepadButton)", + "memberId": "gamepad/GamepadListener/whenGamepadButtonReleased", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "className": "GamepadListener", + "methodName": "whenGamepadButtonReleased", "static": false, - "returnType": "Shaders", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.shader.Shaders" + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "s" + "button" ], "params": [ - "Shaders s" + "GamepadButton button" ], - "summary": "Copies a set of shaders.", - "description": "Copies a set of shaders.", + "summary": "A button came up on one of the controllers.", + "description": "A button came up on one of the controllers.", "scratchblock": null, "paramDocs": [ - "s: the shaders to copy" + "button: the button that was released" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/GamepadListener/whenGamepadButtonReleased", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/deactivate(String)", - "memberId": "extensions/shader/Shaders/deactivate", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "deactivate", + "id": "gamepad/GamepadListener/whenGamepadConnected(int)", + "memberId": "gamepad/GamepadListener/whenGamepadConnected", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "className": "GamepadListener", + "methodName": "whenGamepadConnected", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "player" ], "params": [ - "String name" + "int player" ], - "summary": "Stops drawing with the shader of the given name. The other active shaders\nstay.", - "description": "Stops drawing with the shader of the given name. The other active shaders\nstay.", + "summary": "A controller appeared in a player's slot.", + "description": "A controller appeared in a player's slot.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "player: the player whose slot got a controller, 1 to 4" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/deactivate", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/GamepadListener/whenGamepadConnected", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/get(String)", - "memberId": "extensions/shader/Shaders/get", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "get", + "id": "recorder/GifEncoder/addFrame(int[],int,int)", + "memberId": "recorder/GifEncoder/addFrame", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "addFrame", "static": false, - "returnType": "Shader", + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "int[]", + "int", + "int" ], "parameterNames": [ - "name" + "argb", + "width", + "height" ], "params": [ - "String name" + "int[] argb", + "int width", + "int height" ], - "summary": "Returns a shader by name.", - "description": "Returns a shader by name.", + "summary": "Adds next GIF frame as an ARGB pixel array, top row first (0xAARRGGBB). The alpha channel is\nignored. The frame is not written immediately, but is actually deferred until the next frame\nis received so that timing data can be inserted. Invoking finish() flushes all\nframes. The size of the first frame is used for all subsequent frames; frames of another size\nare scaled with nearest-neighbour sampling.", + "description": "Adds next GIF frame as an ARGB pixel array, top row first (0xAARRGGBB). The alpha channel is\nignored. The frame is not written immediately, but is actually deferred until the next frame\nis received so that timing data can be inserted. Invoking finish() flushes all\nframes. The size of the first frame is used for all subsequent frames; frames of another size\nare scaled with nearest-neighbour sampling.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "argb: int array containing the frame's pixels, top row first.", + "width: int frame width.", + "height: int frame height." ], - "returns": "the shader, or null if there is none with that name", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/get", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/shader/Shaders/getActive()", - "memberId": "extensions/shader/Shaders/getActive", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getActive", - "static": false, - "returnType": "List", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shaders drawn with, in the order they take turns: the order in\nwhich they were added.", - "description": "Returns the shaders drawn with, in the order they take turns: the order in\nwhich they were added.", - "scratchblock": null, - "paramDocs": [], - "returns": "a new list of the active shaders, empty if there are none", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getActive", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/shader/Shaders/getCurrent()", - "memberId": "extensions/shader/Shaders/getCurrent", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getCurrent", - "static": false, - "returnType": "Shader", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shader currently drawn with. With several active, this is the\nfirst of them.", - "description": "Returns the shader currently drawn with. With several active, this is the\nfirst of them.", - "scratchblock": null, - "paramDocs": [], - "returns": "the current shader, or null if there is none", + "returns": "true if successful.", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getCurrent", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/addFrame", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/getCurrentIndex()", - "memberId": "extensions/shader/Shaders/getCurrentIndex", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getCurrentIndex", + "id": "recorder/GifEncoder/constructor()", + "memberId": "recorder/GifEncoder/constructor", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "constructor", "static": false, - "returnType": "int", + "returnType": "GifEncoder", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the position of the current shader.", - "description": "Returns the position of the current shader.", + "summary": "Encodes a GIF file consisting of one or more frames.", + "description": "Encodes a GIF file consisting of one or more frames.\n\n
\n Example:\n    GifEncoder e = new GifEncoder();\n    e.start(outputFileName);\n    e.setDelay(1000);   // 1 frame per sec\n    e.addFrame(argbPixels, width, height);\n    e.finish();\n
\n\nPorted from AnimatedGifEncoder (Kevin Weiner, FM Software, November 2003), with the LZW encoder\nadapted from Jef Poskanzer's Java port by way of J. M. G. Elliott, and the NeuQuant neural-net\nquantizer by Anthony Dekker, 1994. Uses only java.base: frames arrive as ARGB int arrays\ninstead of BufferedImages.", "scratchblock": null, "paramDocs": [], - "returns": "the position, or -1 if no shader is in use", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getCurrentIndex", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/constructor", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/getCurrentName()", - "memberId": "extensions/shader/Shaders/getCurrentName", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getCurrentName", + "id": "recorder/GifEncoder/finish()", + "memberId": "recorder/GifEncoder/finish", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "finish", "static": false, - "returnType": "String", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the name of the current shader.", - "description": "Returns the name of the current shader.", + "summary": "Flushes any pending data and closes output file. If writing to an OutputStream, the stream is\nnot closed.", + "description": "Flushes any pending data and closes output file. If writing to an OutputStream, the stream is\nnot closed.", "scratchblock": null, "paramDocs": [], - "returns": "the name, or null if no shader is in use", + "returns": "true if finished", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getCurrentName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/finish", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/isActive(String)", - "memberId": "extensions/shader/Shaders/isActive", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "isActive", + "id": "recorder/GifEncoder/setDelay(int)", + "memberId": "recorder/GifEncoder/setDelay", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setDelay", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "ms" ], "params": [ - "String name" + "int ms" ], - "summary": "Returns whether the shader of the given name is drawn with.", - "description": "Returns whether the shader of the given name is drawn with.", + "summary": "Sets the delay time between each frame, or changes it for subsequent frames (applies to last\nframe added).", + "description": "Sets the delay time between each frame, or changes it for subsequent frames (applies to last\nframe added).", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "ms: int delay time in milliseconds" ], - "returns": "true if the shader is active", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/isActive", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setDelay", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/next()", - "memberId": "extensions/shader/Shaders/next", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "next", + "id": "recorder/GifEncoder/setDispose(int)", + "memberId": "recorder/GifEncoder/setDispose", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setDispose", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Switches to the next shader, in the order they were added. After the last\none comes the first one again. It is then the only one drawn with.", - "description": "Switches to the next shader, in the order they were added. After the last\none comes the first one again. It is then the only one drawn with.", + "parameterTypes": [ + "int" + ], + "parameterNames": [ + "code" + ], + "params": [ + "int code" + ], + "summary": "Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default\nis 0 if no transparent color has been set, otherwise 2.", + "description": "Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default\nis 0 if no transparent color has been set, otherwise 2.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "code: int disposal code." + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/next", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setDispose", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/reset()", - "memberId": "extensions/shader/Shaders/reset", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "reset", + "id": "recorder/GifEncoder/setFrameRate(float)", + "memberId": "recorder/GifEncoder/setFrameRate", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setFrameRate", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops drawing with shaders, so the sprite or stage looks as it does\nwithout one. The shaders are kept: [switchTo(String)](switchTo),\n[next()](next) or [activate(String)](activate) brings one back.", - "description": "Stops drawing with shaders, so the sprite or stage looks as it does\nwithout one. The shaders are kept: [switchTo(String)](switchTo),\n[next()](next) or [activate(String)](activate) brings one back.", + "parameterTypes": [ + "float" + ], + "parameterNames": [ + "fps" + ], + "params": [ + "float fps" + ], + "summary": "Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).", + "description": "Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "fps: float frame rate (frames per second)" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/reset", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setFrameRate", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/switchTo(String)", - "memberId": "extensions/shader/Shaders/switchTo", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "switchTo", + "id": "recorder/GifEncoder/setQuality(int)", + "memberId": "recorder/GifEncoder/setQuality", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setQuality", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "quality" ], "params": [ - "String name" + "int quality" ], - "summary": "Switches to the shader with the given name, or with the given position in\nthe order the shaders were added. It is then the only one drawn with. A\nname that is not there leaves the shaders as they are and prints which ones\nthere are.", - "description": "Switches to the shader with the given name, or with the given position in\nthe order the shaders were added. It is then the only one drawn with. A\nname that is not there leaves the shaders as they are and prints which ones\nthere are.", + "summary": "Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by\nthe GIF specification). Lower values (minimum = 1) produce better colors, but slow processing\nsignificantly. 10 is the default, and produces good color mapping at reasonable speeds. Values\ngreater than 20 do not yield significant improvements in speed.", + "description": "Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by\nthe GIF specification). Lower values (minimum = 1) produce better colors, but slow processing\nsignificantly. 10 is the default, and produces good color mapping at reasonable speeds. Values\ngreater than 20 do not yield significant improvements in speed.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "quality: int greater than 0." ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/switchTo", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setQuality", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/switchTo(double)", - "memberId": "extensions/shader/Shaders/switchTo", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "switchTo", + "id": "recorder/GifEncoder/setRepeat(int)", + "memberId": "recorder/GifEncoder/setRepeat", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setRepeat", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "int" ], "parameterNames": [ - "index" + "iter" ], "params": [ - "double index" + "int iter" ], - "summary": "Switches to the shader at the given position. It is then the only one drawn\nwith.", - "description": "Switches to the shader at the given position. It is then the only one drawn\nwith.", + "summary": "Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play\nindefinitely. Must be invoked before the first image is added.", + "description": "Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play\nindefinitely. Must be invoked before the first image is added.", "scratchblock": null, "paramDocs": [ - "index: the position of the shader" + "iter: int number of iterations." ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/switchTo", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setRepeat", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/sorting/Sorting/by(Comparator)", - "memberId": "extensions/sorting/Sorting/by", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "by", + "id": "recorder/GifEncoder/setTransparent(int)", + "memberId": "recorder/GifEncoder/setTransparent", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setTransparent", "static": false, "returnType": "void", "parameterTypes": [ - "java.util.Comparator" + "int" ], "parameterNames": [ - "comparator" + "rgb" ], "params": [ - "Comparator comparator" + "int rgb" ], - "summary": "Draws sprites in an order of your own.", - "description": "Draws sprites in an order of your own.", + "summary": "Sets the transparent color for the last added frame and any subsequent frames. Since all\ncolors are subject to modification in the quantization process, the color in the final palette\nfor each frame closest to the given color becomes the transparent color for that frame. May be\nset to -1 to indicate no transparent color.", + "description": "Sets the transparent color for the last added frame and any subsequent frames. Since all\ncolors are subject to modification in the quantization process, the color in the final palette\nfor each frame closest to the given color becomes the transparent color for that frame. May be\nset to -1 to indicate no transparent color.", "scratchblock": null, "paramDocs": [ - "comparator: decides which of two sprites is drawn first" + "rgb: int color (0xRRGGBB) to be treated as transparent on display, or -1 for none." ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/by", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setTransparent", "availability": "desktop-only", - "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "translations": {} + }, + { + "id": "recorder/GifEncoder/start(OutputStream)", + "memberId": "recorder/GifEncoder/start", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "start", + "static": false, + "returnType": "boolean", + "parameterTypes": [ + "java.io.OutputStream" + ], + "parameterNames": [ + "os" + ], + "params": [ + "OutputStream os" + ], + "summary": "Initiates GIF file creation on the given stream. The stream is not closed automatically.", + "description": "Initiates GIF file creation on the given stream. The stream is not closed automatically.", + "scratchblock": null, + "paramDocs": [ + "os: OutputStream on which GIF images are written." + ], + "returns": "false if initial write failed.", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/start", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "translations": {} + }, + { + "id": "recorder/GifEncoder/start(String)", + "memberId": "recorder/GifEncoder/start", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "start", + "static": false, + "returnType": "boolean", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "file" + ], + "params": [ + "String file" + ], + "summary": "Initiates writing of a GIF file with the specified name.", + "description": "Initiates writing of a GIF file with the specified name.", + "scratchblock": null, + "paramDocs": [ + "file: String containing output file name." + ], + "returns": "false if open or initial write failed.", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/start", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "translations": {} + }, + { + "id": "recorder/GifRecorder/constructor(String)", + "memberId": "recorder/GifRecorder/constructor", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "constructor", + "static": false, + "returnType": "GifRecorder", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "path" + ], + "params": [ + "String path" + ], + "summary": "Records the stage as an animated GIF: every second frame of game time (30 a second), at stage\nsize, texts and the UI included.", + "description": "Records the stage as an animated GIF: every second frame of game time (30 a second), at stage\nsize, texts and the UI included.\n\n```java\nGifRecorder recorder = new GifRecorder(\"recording.gif\");\nrecorder.start();\n// \\u2026 later\nrecorder.stop();\n```", + "scratchblock": null, + "paramDocs": [ + "path: the GIF file to write; `.gif` is added when missing" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/byY()", - "memberId": "extensions/sorting/Sorting/byY", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "byY", + "id": "recorder/GifRecorder/snapshot()", + "memberId": "recorder/GifRecorder/snapshot", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "snapshot", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Draws sprites that are further down the stage in front of sprites that are\nfurther up, which is what a view from above usually wants.", - "description": "Draws sprites that are further down the stage in front of sprites that are\nfurther up, which is what a view from above usually wants.", + "summary": "Saves the next frame as a GIF of one frame.", + "description": "Saves the next frame as a GIF of one frame.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/byY", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/snapshot", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/constructor()", - "memberId": "extensions/sorting/Sorting/constructor", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "constructor", + "id": "recorder/GifRecorder/start()", + "memberId": "recorder/GifRecorder/start", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "start", "static": false, - "returnType": "Sorting", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Decides the order in which the sprites of a stage are drawn.", - "description": "Decides the order in which the sprites of a stage are drawn.\n\nReached through `stage.getSorting()`:\n\n```java\nthis.getSorting().byY();\n```", + "summary": "Starts recording from the next frame on.", + "description": "Starts recording from the next frame on.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/start", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/getComparator()", - "memberId": "extensions/sorting/Sorting/getComparator", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "getComparator", + "id": "recorder/GifRecorder/stop()", + "memberId": "recorder/GifRecorder/stop", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "stop", "static": false, - "returnType": "Comparator", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the order currently used.", - "description": "Returns the order currently used.", + "summary": "Stops recording and finishes the file.", + "description": "Stops recording and finishes the file.", "scratchblock": null, "paramDocs": [], - "returns": "the comparator, or null if the sprites are not sorted", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/getComparator", - "availability": "desktop-only", - "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/stop", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/isOn()", - "memberId": "extensions/sorting/Sorting/isOn", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "isOn", + "id": "recorder/RecorderExtension/constructor()", + "memberId": "recorder/RecorderExtension/constructor", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "constructor", "static": false, - "returnType": "boolean", + "returnType": "RecorderExtension", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether the sprites are being sorted.", - "description": "Checks whether the sprites are being sorted.", + "summary": "Registers the recorder extension; found through ServiceLoader, learners never see it.", + "description": "Registers the recorder extension; found through ServiceLoader, learners never see it.", "scratchblock": null, "paramDocs": [], - "returns": "true if an order is set", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/isOn", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sorting/Sorting/off()", - "memberId": "extensions/sorting/Sorting/off", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "off", + "id": "recorder/RecorderExtension/id()", + "memberId": "recorder/RecorderExtension/id", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "id", "static": false, - "returnType": "void", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Draws sprites in the order they were added, which is the default.", - "description": "Draws sprites in the order they were added, which is the default.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/off", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/close()", - "memberId": "extensions/sound/SoundPlayback/close", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "close", + "id": "recorder/RecorderExtension/install(ExtensionContext)", + "memberId": "recorder/RecorderExtension/install", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "install", "static": false, "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.extension.ExtensionContext" + ], + "parameterNames": [ + "ctx" + ], + "params": [ + "ExtensionContext ctx" + ], + "summary": "Hands every drawn frame to the recorders that are recording; frames are read back only then.", + "description": "Hands every drawn frame to the recorders that are recording; frames are read back only then.", + "scratchblock": null, + "paramDocs": [ + "ctx: " + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/install", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "recorder/RecorderExtension/name()", + "memberId": "recorder/RecorderExtension/name", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "name", + "static": false, + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Stops this playback.", - "description": "Stops this playback.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/close", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/getName()", - "memberId": "extensions/sound/SoundPlayback/getName", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "getName", + "id": "recorder/RecorderExtension/requires()", + "memberId": "recorder/RecorderExtension/requires", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "requires", "static": false, "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "", - "description": "", + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", "scratchblock": null, "paramDocs": [], - "returns": "the name of the sound", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/getName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/getVolume()", - "memberId": "extensions/sound/SoundPlayback/getVolume", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "getVolume", + "id": "recorder/RecorderExtension/version()", + "memberId": "recorder/RecorderExtension/version", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "version", "static": false, - "returnType": "double", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], @@ -17974,431 +18638,495 @@ "description": "", "scratchblock": null, "paramDocs": [], - "returns": "this playback's volume in percent", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/getVolume", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/isPlaying()", - "memberId": "extensions/sound/SoundPlayback/isPlaying", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "isPlaying", + "id": "save/File/constructor()", + "memberId": "save/File/constructor", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "constructor", "static": false, - "returnType": "boolean", + "returnType": "File", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "", - "description": "", + "summary": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.", + "description": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.\n\nUsage examples:\n\n```java\n// Save an object as JSON\nFile.save(\"/path/to/file.json\", myObject);\n\n// Save an object as XML\nFile.saveXML(\"/path/to/file.xml\", myObject);\n\n// Load an object from JSON\nMyClass obj = File.load(\"/path/to/file.json\", MyClass.class);\n\n// Load an object from XML\nMyClass obj = File.loadXML(\"/path/to/file.xml\", MyClass.class);\n```\n\nNote: The file paths can be absolute or relative. If a relative path is\nprovided, the class\nwill attempt to load the file from the classpath.\n\nSupported file types:\n\n
    \n
  • JSON\n
  • XML\n
", "scratchblock": null, "paramDocs": [], - "returns": "whether this playback is queued or playing", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/isPlaying", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/constructor", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "save/File/load(String,Class)", + "memberId": "save/File/load", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "load", + "static": true, + "returnType": "T", + "parameterTypes": [ + "java.lang.String", + "java.lang.Class" + ], + "parameterNames": [ + "path", + "cls" + ], + "params": [ + "String path", + "Class cls" + ], + "summary": "Loads an object of the specified class from a file at the given path.", + "description": "Loads an object of the specified class from a file at the given path.", + "scratchblock": null, + "paramDocs": [ + "path: the path to the file from which the object is to be loaded", + "cls: the class of the object to be loaded" + ], + "returns": "the loaded object of the specified class", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/load", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/setVolume(double)", - "memberId": "extensions/sound/SoundPlayback/setVolume", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "setVolume", - "static": false, - "returnType": "void", + "id": "save/File/loadOrCreate(String,Class)", + "memberId": "save/File/loadOrCreate", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "loadOrCreate", + "static": true, + "returnType": "T", "parameterTypes": [ - "double" + "java.lang.String", + "java.lang.Class" ], "parameterNames": [ - "percent" + "path", + "cls" ], "params": [ - "double percent" + "String path", + "Class cls" ], - "summary": "Changes only this playback's volume. Values outside 0..100 are clamped.", - "description": "Changes only this playback's volume. Values outside 0..100 are clamped.", + "summary": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", + "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", "scratchblock": null, "paramDocs": [ - "percent: volume in percent" + "path: the path to the file from which the object is to be loaded", + "cls: the class of the object to be loaded" ], - "returns": null, + "returns": "the loaded object of the specified class, or a new instance if the\n file does not exist", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/setVolume", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/loadOrCreate", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/stop()", - "memberId": "extensions/sound/SoundPlayback/stop", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "stop", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops this playback, leaving other copies alone.", - "description": "Stops this playback, leaving other copies alone.", + "id": "save/File/loadXML(String,Class)", + "memberId": "save/File/loadXML", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "loadXML", + "static": true, + "returnType": "T", + "parameterTypes": [ + "java.lang.String", + "java.lang.Class" + ], + "parameterNames": [ + "path", + "cls" + ], + "params": [ + "String path", + "Class cls" + ], + "summary": "Loads an object of the specified class from an XML file at the given path.", + "description": "Loads an object of the specified class from an XML file at the given path.", "scratchblock": null, - "paramDocs": [], - "returns": null, + "paramDocs": [ + "path: the path to the XML file", + "cls: the class of the object to be loaded" + ], + "returns": "the object loaded from the XML file", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/stop", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/loadXML", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/addGlyph(char,String)", - "memberId": "extensions/text/BitmapText/addGlyph", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "addGlyph", - "static": false, - "returnType": "void", + "id": "save/File/loadXMLOrCreate(String,Class)", + "memberId": "save/File/loadXMLOrCreate", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "loadXMLOrCreate", + "static": true, + "returnType": "T", "parameterTypes": [ - "char", - "java.lang.String" + "java.lang.String", + "java.lang.Class" ], "parameterNames": [ - "character", - "path" + "path", + "cls" ], "params": [ - "char character", - "String path" + "String path", + "Class cls" ], - "summary": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", - "description": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", + "summary": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", + "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", "scratchblock": null, "paramDocs": [ - "character: the character to replace", - "path: its image or built-in costume name" + "path: the path to the XML file", + "cls: the class of the object to be loaded" ], - "returns": null, + "returns": "the object loaded from the XML file, or a new instance if the file\n does not exist", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/addGlyph", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/loadXMLOrCreate", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/constructor(String)", - "memberId": "extensions/text/BitmapText/constructor", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "constructor", - "static": false, - "returnType": "BitmapText", + "id": "save/File/save(String,T)", + "memberId": "save/File/save", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "save", + "static": true, + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "T" ], "parameterNames": [ - "pattern" + "path", + "obj" ], "params": [ - "String pattern" + "String path", + "T obj" ], - "summary": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", - "description": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", + "summary": "Saves the given object to the specified path in the default file type (JSON).", + "description": "Saves the given object to the specified path in the default file type (JSON).", "scratchblock": null, "paramDocs": [ - "pattern: image path with an integer format, e.g. \"assets/font%03d.png\"" + "path: the path where the object should be saved", + "obj: the object to be saved" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/save", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/draw(Drawing)", - "memberId": "extensions/text/BitmapText/draw", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "draw", - "static": false, + "id": "save/File/saveXML(String,T)", + "memberId": "save/File/saveXML", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "saveXML", + "static": true, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "java.lang.String", + "T" ], "parameterNames": [ - "drawing" + "path", + "obj" ], "params": [ - "Drawing drawing" + "String path", + "T obj" ], - "summary": "", - "description": "", + "summary": "Saves the given object as an XML file at the specified path.", + "description": "Saves the given object as an XML file at the specified path.", "scratchblock": null, "paramDocs": [ - "drawing: the current frame's canvas" + "path: the path where the XML file will be saved", + "obj: the object to be saved as XML" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/draw", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/text/BitmapText/getContent()", - "memberId": "extensions/text/BitmapText/getContent", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "getContent", - "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "", - "description": "", - "scratchblock": null, - "paramDocs": [], - "returns": "the text being shown", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/getContent", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/saveXML", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/getHeight()", - "memberId": "extensions/text/BitmapText/getHeight", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "getHeight", + "id": "save/SaveData/constructor(String,String,Class)", + "memberId": "save/SaveData/constructor", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "constructor", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "", - "description": "", + "returnType": "SaveData", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "java.lang.Class" + ], + "parameterNames": [ + "gameId", + "slot", + "type" + ], + "params": [ + "String gameId", + "String slot", + "Class type" + ], + "summary": "Selects a game's save slot without creating a file or opening a database.", + "description": "Selects a game's save slot without creating a file or opening a database.", "scratchblock": null, - "paramDocs": [], - "returns": "the displayed text's height, including line spacing and sprite size", + "paramDocs": [ + "gameId: a stable identifier, for example org.openpatch.coincatcher", + "slot: a slot name, for example slot1, slot2 or slot3", + "type: the data class to load" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/getHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/getWidth()", - "memberId": "extensions/text/BitmapText/getWidth", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "getWidth", + "id": "save/SaveData/getLocation()", + "memberId": "save/SaveData/getLocation", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "getLocation", "static": false, - "returnType": "int", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "", - "description": "", + "summary": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", + "description": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", "scratchblock": null, "paramDocs": [], - "returns": "the displayed text's width, including the sprite's size", + "returns": "a description of the save location", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/getLocation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/setAlign(TextAlign)", - "memberId": "extensions/text/BitmapText/setAlign", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setAlign", + "id": "save/SaveData/loadOrDefault(Supplier)", + "memberId": "save/SaveData/loadOrDefault", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "loadOrDefault", "static": false, - "returnType": "void", + "returnType": "T", "parameterTypes": [ - "org.openpatch.scratch.TextAlign" + "java.util.function.Supplier" ], "parameterNames": [ - "align" + "defaults" ], "params": [ - "TextAlign align" + "Supplier defaults" ], - "summary": "", - "description": "", + "summary": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", + "description": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", "scratchblock": null, "paramDocs": [ - "align: LEFT, CENTER or RIGHT (DEFAULT means LEFT)" + "defaults: creates initial progress for a missing slot; called only when missing" ], - "returns": null, + "returns": "loaded progress, or the supplied defaults for a missing slot", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setAlign", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/loadOrDefault", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/setFont(String)", - "memberId": "extensions/text/BitmapText/setFont", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setFont", + "id": "save/SaveData/path()", + "memberId": "save/SaveData/path", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "path", + "static": false, + "returnType": "Path", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "scratchblock": null, + "paramDocs": [], + "returns": "the desktop file path", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/path", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "save/SaveData/save(T)", + "memberId": "save/SaveData/save", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "save", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "T" ], "parameterNames": [ - "pattern" + "data" ], "params": [ - "String pattern" + "T data" ], - "summary": "", - "description": "", + "summary": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", + "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", "scratchblock": null, "paramDocs": [ - "pattern: glyph path with one integer format for the Unicode code point" + "data: the progress to save; must not be null" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/save", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/setLetterSpacing(double)", - "memberId": "extensions/text/BitmapText/setLetterSpacing", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setLetterSpacing", + "id": "save/SaveExtension/constructor()", + "memberId": "save/SaveExtension/constructor", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "constructor", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "spacing" - ], - "params": [ - "double spacing" - ], - "summary": "", - "description": "", + "returnType": "SaveExtension", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Registers the save extension; found through ServiceLoader, learners never see it.", + "description": "Registers the save extension; found through ServiceLoader, learners never see it.", "scratchblock": null, - "paramDocs": [ - "spacing: gap between characters; negative values allow italic glyphs to overlap" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setLetterSpacing", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/text/BitmapText/setLineSpacing(double)", - "memberId": "extensions/text/BitmapText/setLineSpacing", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setLineSpacing", + "id": "save/SaveExtension/id()", + "memberId": "save/SaveExtension/id", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "id", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "spacing" - ], - "params": [ - "double spacing" - ], + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], "summary": "", "description": "", "scratchblock": null, - "paramDocs": [ - "spacing: extra pixels between lines" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setLineSpacing", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/text/BitmapText/setSpaceWidth(double)", - "memberId": "extensions/text/BitmapText/setSpaceWidth", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setSpaceWidth", + "id": "save/SaveExtension/name()", + "memberId": "save/SaveExtension/name", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "name", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "width" - ], - "params": [ - "double width" - ], + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], "summary": "", "description": "", "scratchblock": null, - "paramDocs": [ - "width: width of a space, in unscaled pixels" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setSpaceWidth", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/text/BitmapText/showText(String)", - "memberId": "extensions/text/BitmapText/showText", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "showText", + "id": "save/SaveExtension/requires()", + "memberId": "save/SaveExtension/requires", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "requires", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "text" - ], - "params": [ - "String text" - ], + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "save/SaveExtension/version()", + "memberId": "save/SaveExtension/version", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "version", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], "summary": "", "description": "", "scratchblock": null, - "paramDocs": [ - "text: text to show, including spaces and newlines" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/showText", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/tiled/MapObject/constructor()", - "memberId": "extensions/tiled/MapObject/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/constructor()", + "memberId": "tiled/MapObject/constructor", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "constructor", "static": false, @@ -18412,15 +19140,15 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/constructor", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getProperty(String)", - "memberId": "extensions/tiled/MapObject/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getProperty(String)", + "memberId": "tiled/MapObject/getProperty", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getProperty", "static": false, @@ -18442,15 +19170,15 @@ ], "returns": "the value of the property with the specified name", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getProperty", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getProperty", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getPropertyBoolean(String)", - "memberId": "extensions/tiled/MapObject/getPropertyBoolean", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyBoolean(String)", + "memberId": "tiled/MapObject/getPropertyBoolean", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getPropertyBoolean", "static": false, @@ -18472,15 +19200,15 @@ ], "returns": "the boolean value of the property, or false if the property is not\n found or cannot be\n parsed as a boolean", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getPropertyBoolean", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getPropertyBoolean", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getPropertyFloat(String)", - "memberId": "extensions/tiled/MapObject/getPropertyFloat", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyFloat(String)", + "memberId": "tiled/MapObject/getPropertyFloat", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getPropertyFloat", "static": false, @@ -18502,15 +19230,15 @@ ], "returns": "the float value of the specified property", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getPropertyFloat", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getPropertyFloat", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getPropertyInt(String)", - "memberId": "extensions/tiled/MapObject/getPropertyInt", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyInt(String)", + "memberId": "tiled/MapObject/getPropertyInt", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getPropertyInt", "static": false, @@ -18532,15 +19260,15 @@ ], "returns": "the integer value of the property", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getPropertyInt", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getPropertyInt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getShape()", - "memberId": "extensions/tiled/MapObject/getShape", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getShape()", + "memberId": "tiled/MapObject/getShape", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getShape", "static": false, @@ -18554,15 +19282,15 @@ "paramDocs": [], "returns": "a Shape object representing the current map object.", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getShape", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getShape", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/setClassName(String)", - "memberId": "extensions/tiled/MapObject/setClassName", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/setClassName(String)", + "memberId": "tiled/MapObject/setClassName", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "setClassName", "static": false, @@ -18584,15 +19312,15 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/setClassName", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/setClassName", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/Property/constructor()", - "memberId": "extensions/tiled/Property/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.Property", + "id": "tiled/Property/constructor()", + "memberId": "tiled/Property/constructor", + "owner": "org.openpatch.scratch.tiled.Property", "className": "Property", "methodName": "constructor", "static": false, @@ -18606,15 +19334,15 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/Property/constructor", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/Property/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/Property/setText(String)", - "memberId": "extensions/tiled/Property/setText", - "owner": "org.openpatch.scratch.extensions.tiled.Property", + "id": "tiled/Property/setText(String)", + "memberId": "tiled/Property/setText", + "owner": "org.openpatch.scratch.tiled.Property", "className": "Property", "methodName": "setText", "static": false, @@ -18636,15 +19364,155 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/Property/setText", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/Property/setText", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/constructor()", + "memberId": "tiled/TiledExtension/constructor", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "constructor", + "static": false, + "returnType": "TiledExtension", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Registers the tiled extension; found through ServiceLoader, learners never see it.", + "description": "Registers the tiled extension; found through ServiceLoader, learners never see it.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/id()", + "memberId": "tiled/TiledExtension/id", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "id", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/install(ExtensionContext)", + "memberId": "tiled/TiledExtension/install", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "install", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.extension.ExtensionContext" + ], + "parameterNames": [ + "ctx" + ], + "params": [ + "ExtensionContext ctx" + ], + "summary": "Every layer of a stage draws its shown map layers, only the part the camera shows.", + "description": "Every layer of a stage draws its shown map layers, only the part the camera shows.", + "scratchblock": null, + "paramDocs": [ + "ctx: " + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/install", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/name()", + "memberId": "tiled/TiledExtension/name", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "name", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/requires()", + "memberId": "tiled/TiledExtension/requires", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "requires", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/version()", + "memberId": "tiled/TiledExtension/version", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "version", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/constructor(String)", - "memberId": "extensions/tiled/TiledMap/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/constructor(String)", + "memberId": "tiled/TiledMap/constructor", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "constructor", "static": false, @@ -18666,15 +19534,15 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/constructor(String,Stage)", - "memberId": "extensions/tiled/TiledMap/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/constructor(String,Stage)", + "memberId": "tiled/TiledMap/constructor", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "constructor", "static": false, @@ -18700,15 +19568,15 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getHeight()", - "memberId": "extensions/tiled/TiledMap/getHeight", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getHeight()", + "memberId": "tiled/TiledMap/getHeight", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getHeight", "static": false, @@ -18722,15 +19590,15 @@ "paramDocs": [], "returns": "the number of map rows", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getObjectsFromLayer(String)", - "memberId": "extensions/tiled/TiledMap/getObjectsFromLayer", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getObjectsFromLayer(String)", + "memberId": "tiled/TiledMap/getObjectsFromLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getObjectsFromLayer", "static": false, @@ -18752,15 +19620,15 @@ ], "returns": "an array of MapObject from the specified layer, or null if the layer\n does not exist", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getObjectsFromLayer", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getObjectsFromLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getProperty(String)", - "memberId": "extensions/tiled/TiledMap/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getProperty(String)", + "memberId": "tiled/TiledMap/getProperty", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getProperty", "static": false, @@ -18782,15 +19650,15 @@ ], "returns": "its string value, including multiline strings", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getProperty", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getProperty", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getProperty(String,String)", - "memberId": "extensions/tiled/TiledMap/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getProperty(String,String)", + "memberId": "tiled/TiledMap/getProperty", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getProperty", "static": false, @@ -18816,15 +19684,15 @@ ], "returns": "the stored value or the default", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getProperty", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getProperty", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getPropertyBoolean(String)", - "memberId": "extensions/tiled/TiledMap/getPropertyBoolean", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyBoolean(String)", + "memberId": "tiled/TiledMap/getPropertyBoolean", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getPropertyBoolean", "static": false, @@ -18846,15 +19714,15 @@ ], "returns": "its boolean value", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getPropertyBoolean", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getPropertyBoolean", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getPropertyFloat(String)", - "memberId": "extensions/tiled/TiledMap/getPropertyFloat", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyFloat(String)", + "memberId": "tiled/TiledMap/getPropertyFloat", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getPropertyFloat", "static": false, @@ -18876,15 +19744,15 @@ ], "returns": "its floating-point value", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getPropertyFloat", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getPropertyFloat", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getPropertyInt(String)", - "memberId": "extensions/tiled/TiledMap/getPropertyInt", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyInt(String)", + "memberId": "tiled/TiledMap/getPropertyInt", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getPropertyInt", "static": false, @@ -18906,15 +19774,15 @@ ], "returns": "its integer value", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getPropertyInt", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getPropertyInt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileCollisionShapes(int)", - "memberId": "extensions/tiled/TiledMap/getTileCollisionShapes", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileCollisionShapes(int)", + "memberId": "tiled/TiledMap/getTileCollisionShapes", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileCollisionShapes", "static": false, @@ -18936,15 +19804,15 @@ ], "returns": "rectangles, ellipses or polygons for this tile", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileCollisionShapes", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileCollisionShapes", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileCollisionShapes(String,int,int)", - "memberId": "extensions/tiled/TiledMap/getTileCollisionShapes", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileCollisionShapes(String,int,int)", + "memberId": "tiled/TiledMap/getTileCollisionShapes", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileCollisionShapes", "static": false, @@ -18974,15 +19842,15 @@ ], "returns": "positioned outlines, or an empty array outside/without collision", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileCollisionShapes", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileCollisionShapes", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileHeight()", - "memberId": "extensions/tiled/TiledMap/getTileHeight", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileHeight()", + "memberId": "tiled/TiledMap/getTileHeight", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileHeight", "static": false, @@ -18996,15 +19864,15 @@ "paramDocs": [], "returns": "the height of a map cell in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileId(String,int,int)", - "memberId": "extensions/tiled/TiledMap/getTileId", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileId(String,int,int)", + "memberId": "tiled/TiledMap/getTileId", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileId", "static": false, @@ -19034,15 +19902,15 @@ ], "returns": "global ID, or zero for an empty/outside cell", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileId", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileId", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileWidth()", - "memberId": "extensions/tiled/TiledMap/getTileWidth", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileWidth()", + "memberId": "tiled/TiledMap/getTileWidth", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileWidth", "static": false, @@ -19056,15 +19924,15 @@ "paramDocs": [], "returns": "the width of a map cell in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getWidth()", - "memberId": "extensions/tiled/TiledMap/getWidth", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getWidth()", + "memberId": "tiled/TiledMap/getWidth", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getWidth", "static": false, @@ -19078,105 +19946,109 @@ "paramDocs": [], "returns": "the number of map columns", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/spawn(String)", - "memberId": "extensions/tiled/TiledMap/spawn", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/hideLayer(String)", + "memberId": "tiled/TiledMap/hideLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", - "methodName": "spawn", + "methodName": "hideLayer", "static": false, - "returnType": "List", + "returnType": "void", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "layerName" + "name" ], "params": [ - "String layerName" + "String name" ], - "summary": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.", - "description": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.\n\nThe sprite's class needs one of these constructors, tried in this order:\none that takes the [MapObject](../MapObject/index) (to read its name and properties), one\nthat takes `(double x, double y)`, or one without parameters. Either\nway the sprite is put where the object is. An object drawn as an area\n(a rectangle, an ellipse or a polygon) also gives the sprite that area as\nits hitbox, which is how walls and water work without a costume.\n\nObjects whose type is not a sprite class, or that have no type, are left\nalone, so a layer can hold markers the program reads itself.\n\n```java\nTiledMap map = new TiledMap(\"level.tmx\", this);\nmap.spawn(\"Objects\");\n```", + "summary": "Stops drawing a tile layer shown with [showLayer(String, Layer)](showLayer).", + "description": "Stops drawing a tile layer shown with [showLayer(String, Layer)](showLayer).", "scratchblock": null, "paramDocs": [ - "layerName: the object layer" + "name: the tile layer's name in Tiled" ], - "returns": "the sprites that were made, in the order of the layer", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/spawn", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/hideLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/stampLayerToBackground(String)", - "memberId": "extensions/tiled/TiledMap/stampLayerToBackground", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/showLayer(String,Layer)", + "memberId": "tiled/TiledMap/showLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", - "methodName": "stampLayerToBackground", + "methodName": "showLayer", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "org.openpatch.scratch.Layer" ], "parameterNames": [ - "name" + "name", + "layer" ], "params": [ - "String name" + "String name", + "Layer layer" ], - "summary": "Stamps a specified layer onto the background.", - "description": "Stamps a specified layer onto the background.", + "summary": "Shows a tile layer of the map in a layer of the stage, drawn every frame from now on (only\nthe tiles the camera shows). The map's top left corner is at (0, 0) of the world; the map\nextends right and down.", + "description": "Shows a tile layer of the map in a layer of the stage, drawn every frame from now on (only\nthe tiles the camera shows). The map's top left corner is at (0, 0) of the world; the map\nextends right and down.\n\n```java\nmap.showLayer(\"ground\", Layer.BACKGROUND);\nmap.showLayer(\"trees\", Layer.FOREGROUND);\n```", "scratchblock": null, "paramDocs": [ - "name: the name of the layer to be stamped onto the background" + "name: the tile layer's name in Tiled", + "layer: the stage's layer to draw it in" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/stampLayerToBackground", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/showLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/stampLayerToForeground(String)", - "memberId": "extensions/tiled/TiledMap/stampLayerToForeground", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/spawn(String)", + "memberId": "tiled/TiledMap/spawn", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", - "methodName": "stampLayerToForeground", + "methodName": "spawn", "static": false, - "returnType": "void", + "returnType": "List", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "name" + "layerName" ], "params": [ - "String name" + "String layerName" ], - "summary": "Stamps the specified layer to the foreground.", - "description": "Stamps the specified layer to the foreground.", + "summary": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.", + "description": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.\n\nThe sprite's class needs one of these constructors, tried in this order:\none that takes the [MapObject](../MapObject/index) (to read its name and properties), one\nthat takes `(double x, double y)`, or one without parameters. Either\nway the sprite is put where the object is. An object drawn as an area\n(a rectangle, an ellipse or a polygon) also gives the sprite that area as\nits hitbox, which is how walls and water work without a costume.\n\nObjects whose type is not a sprite class, or that have no type, are left\nalone, so a layer can hold markers the program reads itself.\n\n```java\nTiledMap map = new TiledMap(\"level.tmx\", this);\nmap.spawn(\"Objects\");\n```", "scratchblock": null, "paramDocs": [ - "name: the name of the layer to be stamped to the foreground" + "layerName: the object layer" ], - "returns": null, + "returns": "the sprites that were made, in the order of the layer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/stampLayerToForeground", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/spawn", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/toString()", - "memberId": "extensions/tiled/TiledMap/toString", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/toString()", + "memberId": "tiled/TiledMap/toString", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "toString", "static": false, @@ -19190,15 +20062,15 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/toString", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/toString", + "availability": "desktop-only", + "availabilityReason": "Prints the desktop's parsed TMX tree as JSON; the browser reads maps without it.", "translations": {} }, { - "id": "extensions/tiled/TilesetImage/constructor()", - "memberId": "extensions/tiled/TilesetImage/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TilesetImage", + "id": "tiled/TilesetImage/constructor()", + "memberId": "tiled/TilesetImage/constructor", + "owner": "org.openpatch.scratch.tiled.TilesetImage", "className": "TilesetImage", "methodName": "constructor", "static": false, @@ -19212,9 +20084,9 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TilesetImage/constructor", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TilesetImage/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} } ] diff --git a/src/main/resources/catalogs/assets.json b/core/src/main/resources/catalogs/assets.json similarity index 100% rename from src/main/resources/catalogs/assets.json rename to core/src/main/resources/catalogs/assets.json diff --git a/src/main/resources/catalogs/examples.json b/core/src/main/resources/catalogs/examples.json similarity index 83% rename from src/main/resources/catalogs/examples.json rename to core/src/main/resources/catalogs/examples.json index 8afc476e..c8f69f23 100644 --- a/src/main/resources/catalogs/examples.json +++ b/core/src/main/resources/catalogs/examples.json @@ -6,7 +6,7 @@ { "id": "demo/cat", "kind": "demo", - "source": "src/examples/java/demos/cat", + "source": "examples/src/main/java/demos/cat", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -24,7 +24,7 @@ { "id": "demo/catPlatformer", "kind": "demo", - "source": "src/examples/java/demos/catPlatformer", + "source": "examples/src/main/java/demos/catPlatformer", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -35,15 +35,15 @@ "files": [ { "path": "Bean.java", - "sha256": "e711aead57857c6d25ff96f5e0de6a969ffd9c1b33f359e3f2bb8a36428f5a10" + "sha256": "2a29b5b353cf5408a9b0926e4a834733e45d06504eca0f778b49e475fcb27d8c" }, { "path": "Bug.java", - "sha256": "6a6e39b0925985b93f9e5e1c509fe898a9cd13a5dc2cba3f46b3c58eae58677a" + "sha256": "a3e060ff2c19606f94e26161d37e500acc67ace1708d5de059bd01189407789b" }, { "path": "Cat.java", - "sha256": "40752d42d41e75295bbea5463ae5f574b58ddc4a888cde56b319cf57a4484c40" + "sha256": "fb1e51731c37b0db917ec274a9fb9a5b9964ad132eae73ffbf462e71a629eebb" }, { "path": "CatPlatformer.java", @@ -51,7 +51,7 @@ }, { "path": "Goal.java", - "sha256": "a0ab034b3dbf2835a1b85dd1edbb32b67a7774dd8e41b3a493194ba778b97572" + "sha256": "c828b86c1b09f039f3b46bcf9d7424244df474a2b08aa7ac42d0316f6ca49ab6" }, { "path": "Ground.java", @@ -74,7 +74,7 @@ { "id": "demo/clock", "kind": "demo", - "source": "src/examples/java/demos/clock", + "source": "examples/src/main/java/demos/clock", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -124,7 +124,7 @@ { "id": "demo/coinCollector", "kind": "demo", - "source": "src/examples/java/demos/coinCollector", + "source": "examples/src/main/java/demos/coinCollector", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -138,7 +138,7 @@ }, { "path": "CoinCollector.java", - "sha256": "7ea50c78169a962f75a35e72d36b355b52af9f4b1b1233218d98e040318503b7" + "sha256": "82d0f645d9adbec7f06ff4b4eb7db38dafc5e0643c94d26b61a6de4030ad447e" }, { "path": "Ground.java", @@ -146,25 +146,25 @@ }, { "path": "Player.java", - "sha256": "0693a09310284af5d2fd58693ac1430d34ea9b09f210e91422d63449bb25497d" + "sha256": "0143c301cd7395ba82be98af8b56ed283b122411846e7b0dde203eaaa6eb5d8b" } ] }, { "id": "demo/donutIO", "kind": "demo", - "source": "src/examples/java/demos/donutIO", + "source": "examples/src/main/java/demos/donutIO", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "Background.java", - "sha256": "240f3eee3a70b9a9ffcd23d731400300ad1dccb2b9402d820ee9ec7fe250b258" + "sha256": "240686fd74eac29bea2de07abb9fdf7eb2d68f07b25e936eb151d00e2093b717" }, { "path": "Donut.java", - "sha256": "72e4ed699fc1de18ee2a48644d3c5425b762c667a7a7fdfa82aab7038a65a362" + "sha256": "12909d89ff89c8ab093150d102cd355ffd7c96644d741e2978a9ff35a29dfcbb" }, { "path": "FollowDonut.java", @@ -172,11 +172,11 @@ }, { "path": "Game.java", - "sha256": "dd47d147b288eb68780451f6f6c3a1234ff162d63039ec925a455092ccc3bddb" + "sha256": "01645a6b03f037958b4037f78ebdbe0174c7690314f77b2e7e292893cd9f75af" }, { "path": "GameOverStage.java", - "sha256": "8b03b31cb932b6972803e49a58501e5c7b04f0e7b2c4bc0473b7cfa2cf20089c" + "sha256": "7dec2067ba6e4edf4642670f838ee983a639307117b10a309ff36f94c9ee5557" }, { "path": "PlayerDonut.java", @@ -184,15 +184,15 @@ }, { "path": "StartStage.java", - "sha256": "9d4a0085c2377ad6e9fcba5fbd05936c1f344b6b12aeb6ec36c3579325b28821" + "sha256": "d511595cb10651f75e3a895550b041db4a1a2d7867d309e55ff6e47723095b6e" }, { "path": "WinStage.java", - "sha256": "691b5d745227a569d9e96fcee082c0ca022cb166702e5f70402f7f1d2573e6d1" + "sha256": "699a0026ff67d1079df2cb811283f0743ffb1cb0ccd849852169e05c1a9c0ca5" }, { "path": "WorldStage.java", - "sha256": "2c1e97bce4d27074b278d77f339c50eda6ad2632c2c324cc7bc50d2fb119566c" + "sha256": "d520f4b57fb2f7d2161ea407881cde464a7078dabd2cc7d7a8932d64ee21d3c8" }, { "path": "assets/donut.png", @@ -211,7 +211,7 @@ { "id": "demo/glide", "kind": "demo", - "source": "src/examples/java/demos/glide", + "source": "examples/src/main/java/demos/glide", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -228,18 +228,18 @@ { "id": "demo/pipes", "kind": "demo", - "source": "src/examples/java/demos/pipes", + "source": "examples/src/main/java/demos/pipes", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "PenSprite.java", - "sha256": "94b9fb824ef95dfbbd5c0f757aef771be165c1f7917fb5954b5f14651d516283" + "sha256": "9cc2544d691f9d771b868f0a644b8ea5eb74e89534a42aeeb7f88b87f064acf3" }, { "path": "Pipes.java", - "sha256": "3b516c93456ef4a74b149abb52844d877f6db846dd384f9156701fcacee81e28" + "sha256": "72540a41ffe2102900cf21da2a2430e95bcac6a93c61644e0b919343f0cc7ba5" }, { "path": "backdrops/chalk_board.jpg", @@ -258,7 +258,7 @@ { "id": "demo/quiz", "kind": "demo", - "source": "src/examples/java/demos/quiz", + "source": "examples/src/main/java/demos/quiz", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -275,35 +275,35 @@ { "id": "demo/rainbowVine", "kind": "demo", - "source": "src/examples/java/demos/rainbowVine", + "source": "examples/src/main/java/demos/rainbowVine", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "RainbowVine.java", - "sha256": "ab9f946430b98be3988e4b29606ecf135abc6b9f59002a04406bb9380e0df0c7" + "sha256": "138c92e3ec360946511bdaa3fbfcbf7680d7e0794bd0afd88940463328ba70ef" } ] }, { "id": "demo/randomDot", "kind": "demo", - "source": "src/examples/java/demos/randomDot", + "source": "examples/src/main/java/demos/randomDot", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "RandomDot.java", - "sha256": "29adafc8e89e37efb43cd41226bb557668f94345b8fd19ae9cdceaa7cf64b246" + "sha256": "85fca39a0f737838886790b33e3a78c0bf761fa22038f16d1647d49573b0f641" } ] }, { "id": "demo/robot", "kind": "demo", - "source": "src/examples/java/demos/robot", + "source": "examples/src/main/java/demos/robot", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -314,7 +314,7 @@ }, { "path": "RobotStage.java", - "sha256": "d3e5db133393de331fa3f9be1774ff8c74df9ce0437ddcc9cb6c726938a2abc6" + "sha256": "f4a13c806280372dd994a2b5c7c378622a7c56ab2cdcbca40a524da3dbcfe33e" }, { "path": "sprites/robot.png", @@ -325,7 +325,7 @@ { "id": "demo/saveSlots", "kind": "demo", - "source": "src/examples/java/demos/saveSlots", + "source": "examples/src/main/java/demos/saveSlots", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -347,14 +347,14 @@ }, { "path": "SaveSlotStage.java", - "sha256": "137d38a4b232e7c477d1d9b82143c986073221a9890a72783f8580818fd279e4" + "sha256": "952710f6d48438e6d4b504bd24d9d68da4164eeab8a98446d724e1de21d75c9e" } ] }, { "id": "demo/saving", "kind": "demo", - "source": "src/examples/java/demos/saving", + "source": "examples/src/main/java/demos/saving", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -365,21 +365,21 @@ }, { "path": "Saving.java", - "sha256": "083c69f9950f753e83a21bc722b4d91bdf476d6bb5d73f41d939c27d4ff60ac6" + "sha256": "07c5a1fa8f1205e86ad5770579f31f84c81583b72f43eaf7c38c1992b4a06479" } ] }, { "id": "demo/sensing", "kind": "demo", - "source": "src/examples/java/demos/sensing", + "source": "examples/src/main/java/demos/sensing", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "Sensing.java", - "sha256": "7a329ba9f3b5eed86c48eec6b963b22516a90267a4ee871bbf62775fc96b692d" + "sha256": "2ff78751e708d51ffb8b0afdcfab91c1fdd4f2a7de6c04beaf18a1b39dcba8bc" }, { "path": "sprites/hero.png", @@ -394,7 +394,7 @@ { "id": "demo/shader", "kind": "demo", - "source": "src/examples/java/demos/shader", + "source": "examples/src/main/java/demos/shader", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -405,11 +405,11 @@ }, { "path": "MySprite.java", - "sha256": "c1d6ef06a68dbcd7d77ea07f6fb7b50fc3d167c18075140db11b15b708affe6a" + "sha256": "0c1d54d65528f25b9b27c80e4e9aa8de6fd406b719ab27c0bc4aeb29cb01b311" }, { "path": "MyStage.java", - "sha256": "084c5cec165caab57efc5bc29a35858e369e13cee645ac1af38fe63d56cd3e90" + "sha256": "09ba7034c03535decd6f48b0db410d244fa41dad548e60cf5a31ab7007ea0680" }, { "path": "NormalSprite.java", @@ -421,27 +421,23 @@ }, { "path": "blobby.frag", - "sha256": "384933079eec3bb08beb0b141bec7cd59ff7ef17c4a8fa706e3c4f1640dba55b" + "sha256": "b4ee43f9290e7181eaf73cfa0d61951916655f284a390a74417bcded8572df6a" }, { "path": "cat.png", "sha256": "0423f61671a086906d972b266241d557934f86bdb8ec5ad6f50b08f3474efa0f" }, - { - "path": "default.vert", - "sha256": "74b864ff74fb681af02ede001826b988ec94edcbb2c3b3377cd08975edca7cbf" - }, { "path": "glitch.frag", - "sha256": "cc97afe4a6df211c95abf0dead361f05d32cf4e42d042d78ad47f22a3c1fdb5d" + "sha256": "c087dead430cf77c6b126a699533711597f0531a84b7ea599828e5157590bd62" }, { "path": "halftone.frag", - "sha256": "64e2eb806ed07b091fa5d9c15329cf776d2950832021fb985172edebd0c0df71" + "sha256": "feeeac1d83e851624d0bd1edfb83a037d42a2c72766bff67d3c73cf702d47c9e" }, { "path": "light.frag", - "sha256": "cbb7e7c862a6944b620919c8643b40f8986a6dcc389e2308966fa5f50694e551" + "sha256": "406c07398ade3a3bec38b7fe124bf900520d1372fcafff3ca43dbd272ac29578" }, { "path": "light.png", @@ -449,22 +445,22 @@ }, { "path": "neon.frag", - "sha256": "8e875c5eb0cc2884d3470ae96797bf3708e01eb1725a98ad560414d5c9493f75" + "sha256": "03e834af81c80587b7c1de2ee89fd9c0facd15aab9e2a38dfdbafe7045bb22ac" }, { "path": "pixel.frag", - "sha256": "3b3d471cd76f42313008ffaa3019fd382e80916ddc990c48b748786a54f5796f" + "sha256": "2642359211f3008c8e57b47ef97463a6727de042ccc6822cc67def9cdd0f41e2" }, { "path": "pixelate.frag", - "sha256": "7d0842e4fc000f92a2ac9cf113fce083b7c2c5e5bb43c2cb2edfbf0bc045075b" + "sha256": "b97cea96d4fe2ce65b00354f7096c69b1027e8cfd0685fb4c22e3c3636b4947c" } ] }, { "id": "demo/shakespeare", "kind": "demo", - "source": "src/examples/java/demos/shakespeare", + "source": "examples/src/main/java/demos/shakespeare", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -479,7 +475,7 @@ }, { "path": "Shakespeare.java", - "sha256": "de45a061414fb16ca748abd3fe0327df154257a76933fd41bcda446aa8965484" + "sha256": "28dd04fd2825a2ee6e3770dde8699881d9b1e6b7c13f7de2202b4bf0c4c6dd55" }, { "path": "assets/Singkong.ttf", @@ -490,7 +486,7 @@ { "id": "demo/smartRocket", "kind": "demo", - "source": "src/examples/java/demos/smartRocket", + "source": "examples/src/main/java/demos/smartRocket", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -509,7 +505,7 @@ }, { "path": "Rocket.java", - "sha256": "aacd80bf036fff40872615776c41049fb9e06d199a87f4c10a990bb1d9249415" + "sha256": "dc981311b03f78c6b88fbcb9f09f204e99253bb8a39c261f6654d8c9b107d407" }, { "path": "SmartRocket.java", @@ -517,7 +513,7 @@ }, { "path": "Ziel.java", - "sha256": "656a913936da7e1c41811fff6ca80d5ef0fa047b72534bb92a15d5163d72d511" + "sha256": "61fafe0d70651623b85039e3f4f68544e5a39fdb2ededd52b4476d540bfa24c0" }, { "path": "assets/rocket.png", @@ -532,7 +528,7 @@ { "id": "demo/stressTest", "kind": "demo", - "source": "src/examples/java/demos/stressTest", + "source": "examples/src/main/java/demos/stressTest", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -543,7 +539,7 @@ }, { "path": "Figure.java", - "sha256": "722315ba5fc50b965d100e10b4605325470909342561a3e7bf01a9b2df1c82c6" + "sha256": "40d78a80d3528fc9ab97aa6f621d66fdbd18c6de8865d7863885c6199f6665d2" }, { "path": "FigureState.java", @@ -930,26 +926,26 @@ { "id": "demo/tiled", "kind": "demo", - "source": "src/examples/java/demos/tiled", + "source": "examples/src/main/java/demos/tiled", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "Bamboo.java", - "sha256": "ef45cb82baf7adc0afe4bce3cd3d9c682140e565c7458648bd819621569ed0a4" + "sha256": "e34a0f3974c9fd718b5dc64e18de87f4678c7d094419f99e9fde16784c5775b0" }, { "path": "Enemy.java", - "sha256": "79e55b3bd2b799280fc3bb997700e8aa43fb410acab00b1546dacaefe465d61b" + "sha256": "290723fdc9747e0288e113a83f612f1a114528e38d0141c4e7cdbffdb21ce2ed" }, { "path": "Fireball.java", - "sha256": "48cd4c98729716490c2393eeeceae156381a1d4fa5a6b2bf37b25b37f1f55415" + "sha256": "d4ad9b4da3834994033969c1fd3003e06313d384054a58b2906122c35b15e58b" }, { "path": "GameState.java", - "sha256": "b7f6a5c03215e169f06986cf7856ec3873b432180d2a20665ae04801af93edaa" + "sha256": "92bb156764a03a3a6109ff4514e5d7f71a1556662b9d8a6e5def64f26f7ac1ad" }, { "path": "I18n.java", @@ -957,11 +953,11 @@ }, { "path": "Item.java", - "sha256": "e47faeb22edf46c14d082af212addbb7153d12db0e92ea55ee0d93efad9677d7" + "sha256": "5e09c2f6a37de88ac4938e3cf5d99b6c5975d120395810624bf9558289be5323" }, { "path": "Level.java", - "sha256": "836ae4f3e812081fb38ef0f6be6277cea64a190d9b676ce7401d8e0f493924c0" + "sha256": "cc23dac470d5f1c6368546d84281a5d28cef6727c90ed2041879fbc516fcd0bf" }, { "path": "Level1.tmx", @@ -973,15 +969,15 @@ }, { "path": "Player.java", - "sha256": "57e756ac071860864b23b94f94544acd434762b609e1269c2269697e757ed597" + "sha256": "ea4b1ae4977cec0863375b8513c79bff66b7f0c47992fe06496f54ff245f4aff" }, { "path": "Tiled.java", - "sha256": "960b45e33762de56bb58d730ac04f804b4caa89034754581ed37f23aebfa9080" + "sha256": "5d36d108981a89c7623489946d592bd11f910e023a8103eef1fca67b290bcec6" }, { "path": "UIItem.java", - "sha256": "7cf11e83c718558802931c182c4d5db58679dea3cc9f7fad21a37da0dad77349" + "sha256": "a6910a0d8669272a46e6734062bef5baa6cee95c583d426e9aa2a9c468be1c7c" }, { "path": "Wall.java", @@ -989,7 +985,7 @@ }, { "path": "Warp.java", - "sha256": "c203e54de7d36e77750eb06ca40de9911aa4b42f7ffe9b5dea868b2ded1a3eb8" + "sha256": "4e2f9addd0b0fc37f214e986e1331d479b6f4365b9e4e09040d9ed41185e02e6" }, { "path": "Water.java", @@ -1036,42 +1032,42 @@ { "id": "demo/timedDot", "kind": "demo", - "source": "src/examples/java/demos/timedDot", + "source": "examples/src/main/java/demos/timedDot", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "TimedDot.java", - "sha256": "122349586071c44793565603f0dc6a470c0665fe1655fa671dbc519dc21011ac" + "sha256": "4ffd93113ccce1ebe8461c3178a5155b6b6ce94e8f4067d34dd1e0bad081617d" } ] }, { "id": "demo/timer", "kind": "demo", - "source": "src/examples/java/demos/timer", + "source": "examples/src/main/java/demos/timer", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "TimerStage.java", - "sha256": "7d2e0fac9344fbf4d43c09a57ac4430cb8961613394ac0faf322e3852e2cfac2" + "sha256": "a9e9bf9cb594f18cf50898f1755bacd08708f2ac29b5d2286047eb9648e36626" } ] }, { "id": "demo/ui", "kind": "demo", - "source": "src/examples/java/demos/ui", + "source": "examples/src/main/java/demos/ui", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "UI.java", - "sha256": "145ecc97c900d75c57b48be50c979466e0d50566ef91a50163ec243c4b04942b" + "sha256": "70abb18e4bb6b1ddf58b8b87407723871abe00b69c3e0066fa0d65818f8edb93" }, { "path": "bar_round_gloss_large.png", @@ -1094,7 +1090,7 @@ { "id": "demo/volume", "kind": "demo", - "source": "src/examples/java/demos/volume", + "source": "examples/src/main/java/demos/volume", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -1104,7 +1100,7 @@ "files": [ { "path": "Volume.java", - "sha256": "bb2fab55b3f111fd33ff7beb654b9c1eed23323089b6117840790f3cfaa91948" + "sha256": "0cc43883cd844833e4e69b7a069a995feae6e0ad01dbe60a4da4f2f146fdc959" } ] }, @@ -1118,11 +1114,11 @@ "files": [ { "path": "GhostSprite.java", - "sha256": "0384d2d29fd627071a580ffdb91b3ebec648f6a210ba6bce3ffb7959941c3652" + "sha256": "cfd42ab8644f073f4a43ba8ee81c2b5138847cac785a4a6e54e71956d3bba6c8" }, { "path": "HalloweenStage.java", - "sha256": "74f1d0b11088cd27882e7fd07630ee581b40392781b2ba2542dc03b54bcc8dbb" + "sha256": "d5a3528a091191268c21d58784cb83edb8a8007be30f02b12c12cae088bb9956" }, { "path": "HouseSprite.java", @@ -1130,11 +1126,7 @@ }, { "path": "PumpkinSprite.java", - "sha256": "2437b012ead25f8fdcb8297c0e94b1bbc4ec37037226f5aa8b5113d669e8b27b" - }, - { - "path": "package.bluej", - "sha256": "a9623d91bd998d884124ed3815a659d2195e71377b797edba9b97a0afc15e558" + "sha256": "867d2776e5bfedd90195ff524d1c948863cdedc25174fac4564a06b8c64438d9" }, { "path": "sounds/background.wav", @@ -1210,40 +1202,6 @@ } ] }, - { - "id": "tutorial/bluej-starter", - "kind": "tutorial", - "source": "docs/archives/bluej-starter", - "libraryVersion": "6.5.0", - "flavour": "standard", - "requiredSheets": [], - "files": [ - { - "path": "Cat.java", - "sha256": "f5e71d1da4812c7810701eeaf23bc2d8bb455b8c8d607fa0ab04fcebd8df9f2b" - }, - { - "path": "MyStage.java", - "sha256": "5de0b930fc63f2aef2d4d7f7e3ce6a8d8ec82ee5a28898347799c48bbdc5e781" - }, - { - "path": "MyWindow.java", - "sha256": "8056b03a70774938863b829c750300549323c4287eb9f9e6350cd77ccb101005" - }, - { - "path": "assets/.gitkeep", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, - { - "path": "assets/cat.png", - "sha256": "0423f61671a086906d972b266241d557934f86bdb8ec5ad6f50b08f3474efa0f" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - ] - }, { "id": "tutorial/bouncy-hedgehog", "kind": "tutorial", @@ -1280,10 +1238,6 @@ "path": "hedgehog.png", "sha256": "731e677d38912bf339a16cda8c61035db1db52489c462181e9be4874bd310db7" }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, { "path": "playground.jpg", "sha256": "c68f76ab3c5ac54be427706d571cd5b268141c4448b88e7277ebae45c347f0dd" @@ -1330,10 +1284,6 @@ "path": "hedgehog.png", "sha256": "731e677d38912bf339a16cda8c61035db1db52489c462181e9be4874bd310db7" }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, { "path": "playground.jpg", "sha256": "c68f76ab3c5ac54be427706d571cd5b268141c4448b88e7277ebae45c347f0dd" @@ -1358,15 +1308,11 @@ }, { "path": "CatStage.java", - "sha256": "2e8b06a4b21eff0fd15b3c70eb1a9cfe25477942c7e1fe0365af0a9bb1bb889b" + "sha256": "8fe655126ec3bedcf3024c5842ad826125e2a80d06dd4a24111440ce2df4f013" }, { "path": "cat.png", "sha256": "0423f61671a086906d972b266241d557934f86bdb8ec5ad6f50b08f3474efa0f" - }, - { - "path": "package.bluej", - "sha256": "d18f1b5e976159b105ce08a72f95f98dffc64cec82f0d618460e73d710040604" } ] }, @@ -1400,10 +1346,6 @@ { "path": "README.md", "sha256": "7867d20f01bf95412d4b307e34210e9a62e0850b2db0eb7453a82c011deab634" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1424,7 +1366,7 @@ }, { "path": "Alien.java", - "sha256": "37fb2e8f845c81076e592f8b831d6406d8051b8f01b07c4e9a2eb68e6a8ed4b1" + "sha256": "e603e05427f46b8f19be76c0c10094864f91a8db63718218714ab03e4e0f306a" }, { "path": "DodgeWindow.java", @@ -1445,10 +1387,6 @@ { "path": "TitleStage.java", "sha256": "ed6dc9b799881aab876e0ee5a9413c02fade47cfd003ccd3935b68b8e6c04a69" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1478,10 +1416,6 @@ { "path": "README.md", "sha256": "1cf7971612162c7486cd95894fa740ec9f3e8f8268e01790ef5cb48ed37a0507" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1507,10 +1441,6 @@ { "path": "README.md", "sha256": "2e83410662b1d66e3b506bc668ecb59ee2651b9fe5344a1b16e0c43b6e0c6d27" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1539,11 +1469,7 @@ }, { "path": "Walker.java", - "sha256": "828b0d93d40e8a85ad0734028d86b867f4a36b401a283755cef5a25132a50c20" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "sha256": "8d9480e92d0c6e39ef1e63cf88d7c37b0e22881c667193758d9608e972694917" } ] }, @@ -1572,15 +1498,11 @@ }, { "path": "Racer.java", - "sha256": "e0b1d2de350f0a5db7ed66e13332a878d32aa18c47db4db1a88cc2a4ebbb88b9" + "sha256": "9e704919283ba0ae1dbe01a37b110e610f00fe030dca6d7d43722834942516fc" }, { "path": "Referee.java", - "sha256": "1586c6e111c8b3351d76b2940ee45c287797a457545681a6e61a141f65c55e3b" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "sha256": "1d979941352ba316da7065711957d988424821569e512e6e131f4cadcac2d992" } ] }, @@ -1602,15 +1524,11 @@ }, { "path": "Cat.java", - "sha256": "f5e71d1da4812c7810701eeaf23bc2d8bb455b8c8d607fa0ab04fcebd8df9f2b" + "sha256": "237a182186dc30651ce89a9c50f1a1e957119e69d4c7292405f06028d60ed35c" }, { "path": "MyStage.java", - "sha256": "5de0b930fc63f2aef2d4d7f7e3ce6a8d8ec82ee5a28898347799c48bbdc5e781" - }, - { - "path": "MyWindow.java", - "sha256": "8056b03a70774938863b829c750300549323c4287eb9f9e6350cd77ccb101005" + "sha256": "08e71423d91cb006266462d83d15142b9f9c695e0d7e8b259499aeb327c8b005" }, { "path": "assets/.gitkeep", diff --git a/src/main/resources/images/License-cat.txt b/core/src/main/resources/images/License-cat.txt similarity index 100% rename from src/main/resources/images/License-cat.txt rename to core/src/main/resources/images/License-cat.txt diff --git a/src/main/resources/images/License.txt b/core/src/main/resources/images/License.txt similarity index 100% rename from src/main/resources/images/License.txt rename to core/src/main/resources/images/License.txt diff --git a/src/main/resources/images/cat.png b/core/src/main/resources/images/cat.png similarity index 100% rename from src/main/resources/images/cat.png rename to core/src/main/resources/images/cat.png diff --git a/src/main/resources/images/cat.xml b/core/src/main/resources/images/cat.xml similarity index 100% rename from src/main/resources/images/cat.xml rename to core/src/main/resources/images/cat.xml diff --git a/src/main/resources/images/jumper.png b/core/src/main/resources/images/jumper.png similarity index 100% rename from src/main/resources/images/jumper.png rename to core/src/main/resources/images/jumper.png diff --git a/src/main/resources/images/jumper.xml b/core/src/main/resources/images/jumper.xml similarity index 100% rename from src/main/resources/images/jumper.xml rename to core/src/main/resources/images/jumper.xml diff --git a/src/main/resources/images/platformer.png b/core/src/main/resources/images/platformer.png similarity index 100% rename from src/main/resources/images/platformer.png rename to core/src/main/resources/images/platformer.png diff --git a/src/main/resources/images/platformer.xml b/core/src/main/resources/images/platformer.xml similarity index 100% rename from src/main/resources/images/platformer.xml rename to core/src/main/resources/images/platformer.xml diff --git a/src/main/resources/images/space_shooter.png b/core/src/main/resources/images/space_shooter.png similarity index 100% rename from src/main/resources/images/space_shooter.png rename to core/src/main/resources/images/space_shooter.png diff --git a/src/main/resources/images/space_shooter.xml b/core/src/main/resources/images/space_shooter.xml similarity index 100% rename from src/main/resources/images/space_shooter.xml rename to core/src/main/resources/images/space_shooter.xml diff --git a/src/main/resources/images/tappy_plane.png b/core/src/main/resources/images/tappy_plane.png similarity index 100% rename from src/main/resources/images/tappy_plane.png rename to core/src/main/resources/images/tappy_plane.png diff --git a/src/main/resources/images/tappy_plane.xml b/core/src/main/resources/images/tappy_plane.xml similarity index 100% rename from src/main/resources/images/tappy_plane.xml rename to core/src/main/resources/images/tappy_plane.xml diff --git a/src/main/resources/loading.png b/core/src/main/resources/loading.png similarity index 100% rename from src/main/resources/loading.png rename to core/src/main/resources/loading.png diff --git a/src/main/resources/sounds/License.txt b/core/src/main/resources/sounds/License.txt similarity index 100% rename from src/main/resources/sounds/License.txt rename to core/src/main/resources/sounds/License.txt diff --git a/src/main/resources/sounds/impact/footstep_carpet_000.ogg b/core/src/main/resources/sounds/impact/footstep_carpet_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_carpet_000.ogg rename to core/src/main/resources/sounds/impact/footstep_carpet_000.ogg diff --git a/src/main/resources/sounds/impact/footstep_carpet_001.ogg b/core/src/main/resources/sounds/impact/footstep_carpet_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_carpet_001.ogg rename to core/src/main/resources/sounds/impact/footstep_carpet_001.ogg diff --git a/src/main/resources/sounds/impact/footstep_carpet_002.ogg b/core/src/main/resources/sounds/impact/footstep_carpet_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_carpet_002.ogg rename to core/src/main/resources/sounds/impact/footstep_carpet_002.ogg diff --git a/src/main/resources/sounds/impact/footstep_carpet_003.ogg b/core/src/main/resources/sounds/impact/footstep_carpet_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_carpet_003.ogg rename to core/src/main/resources/sounds/impact/footstep_carpet_003.ogg diff --git a/src/main/resources/sounds/impact/footstep_carpet_004.ogg b/core/src/main/resources/sounds/impact/footstep_carpet_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_carpet_004.ogg rename to core/src/main/resources/sounds/impact/footstep_carpet_004.ogg diff --git a/src/main/resources/sounds/impact/footstep_concrete_000.ogg b/core/src/main/resources/sounds/impact/footstep_concrete_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_concrete_000.ogg rename to core/src/main/resources/sounds/impact/footstep_concrete_000.ogg diff --git a/src/main/resources/sounds/impact/footstep_concrete_001.ogg b/core/src/main/resources/sounds/impact/footstep_concrete_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_concrete_001.ogg rename to core/src/main/resources/sounds/impact/footstep_concrete_001.ogg diff --git a/src/main/resources/sounds/impact/footstep_concrete_002.ogg b/core/src/main/resources/sounds/impact/footstep_concrete_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_concrete_002.ogg rename to core/src/main/resources/sounds/impact/footstep_concrete_002.ogg diff --git a/src/main/resources/sounds/impact/footstep_concrete_003.ogg b/core/src/main/resources/sounds/impact/footstep_concrete_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_concrete_003.ogg rename to core/src/main/resources/sounds/impact/footstep_concrete_003.ogg diff --git a/src/main/resources/sounds/impact/footstep_concrete_004.ogg b/core/src/main/resources/sounds/impact/footstep_concrete_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_concrete_004.ogg rename to core/src/main/resources/sounds/impact/footstep_concrete_004.ogg diff --git a/src/main/resources/sounds/impact/footstep_grass_000.ogg b/core/src/main/resources/sounds/impact/footstep_grass_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_grass_000.ogg rename to core/src/main/resources/sounds/impact/footstep_grass_000.ogg diff --git a/src/main/resources/sounds/impact/footstep_grass_001.ogg b/core/src/main/resources/sounds/impact/footstep_grass_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_grass_001.ogg rename to core/src/main/resources/sounds/impact/footstep_grass_001.ogg diff --git a/src/main/resources/sounds/impact/footstep_grass_002.ogg b/core/src/main/resources/sounds/impact/footstep_grass_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_grass_002.ogg rename to core/src/main/resources/sounds/impact/footstep_grass_002.ogg diff --git a/src/main/resources/sounds/impact/footstep_grass_003.ogg b/core/src/main/resources/sounds/impact/footstep_grass_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_grass_003.ogg rename to core/src/main/resources/sounds/impact/footstep_grass_003.ogg diff --git a/src/main/resources/sounds/impact/footstep_grass_004.ogg b/core/src/main/resources/sounds/impact/footstep_grass_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_grass_004.ogg rename to core/src/main/resources/sounds/impact/footstep_grass_004.ogg diff --git a/src/main/resources/sounds/impact/footstep_snow_000.ogg b/core/src/main/resources/sounds/impact/footstep_snow_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_snow_000.ogg rename to core/src/main/resources/sounds/impact/footstep_snow_000.ogg diff --git a/src/main/resources/sounds/impact/footstep_snow_001.ogg b/core/src/main/resources/sounds/impact/footstep_snow_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_snow_001.ogg rename to core/src/main/resources/sounds/impact/footstep_snow_001.ogg diff --git a/src/main/resources/sounds/impact/footstep_snow_002.ogg b/core/src/main/resources/sounds/impact/footstep_snow_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_snow_002.ogg rename to core/src/main/resources/sounds/impact/footstep_snow_002.ogg diff --git a/src/main/resources/sounds/impact/footstep_snow_003.ogg b/core/src/main/resources/sounds/impact/footstep_snow_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_snow_003.ogg rename to core/src/main/resources/sounds/impact/footstep_snow_003.ogg diff --git a/src/main/resources/sounds/impact/footstep_snow_004.ogg b/core/src/main/resources/sounds/impact/footstep_snow_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_snow_004.ogg rename to core/src/main/resources/sounds/impact/footstep_snow_004.ogg diff --git a/src/main/resources/sounds/impact/footstep_wood_000.ogg b/core/src/main/resources/sounds/impact/footstep_wood_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_wood_000.ogg rename to core/src/main/resources/sounds/impact/footstep_wood_000.ogg diff --git a/src/main/resources/sounds/impact/footstep_wood_001.ogg b/core/src/main/resources/sounds/impact/footstep_wood_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_wood_001.ogg rename to core/src/main/resources/sounds/impact/footstep_wood_001.ogg diff --git a/src/main/resources/sounds/impact/footstep_wood_002.ogg b/core/src/main/resources/sounds/impact/footstep_wood_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_wood_002.ogg rename to core/src/main/resources/sounds/impact/footstep_wood_002.ogg diff --git a/src/main/resources/sounds/impact/footstep_wood_003.ogg b/core/src/main/resources/sounds/impact/footstep_wood_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_wood_003.ogg rename to core/src/main/resources/sounds/impact/footstep_wood_003.ogg diff --git a/src/main/resources/sounds/impact/footstep_wood_004.ogg b/core/src/main/resources/sounds/impact/footstep_wood_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/footstep_wood_004.ogg rename to core/src/main/resources/sounds/impact/footstep_wood_004.ogg diff --git a/src/main/resources/sounds/impact/impactBell_heavy_000.ogg b/core/src/main/resources/sounds/impact/impactBell_heavy_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactBell_heavy_000.ogg rename to core/src/main/resources/sounds/impact/impactBell_heavy_000.ogg diff --git a/src/main/resources/sounds/impact/impactBell_heavy_001.ogg b/core/src/main/resources/sounds/impact/impactBell_heavy_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactBell_heavy_001.ogg rename to core/src/main/resources/sounds/impact/impactBell_heavy_001.ogg diff --git a/src/main/resources/sounds/impact/impactBell_heavy_002.ogg b/core/src/main/resources/sounds/impact/impactBell_heavy_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactBell_heavy_002.ogg rename to core/src/main/resources/sounds/impact/impactBell_heavy_002.ogg diff --git a/src/main/resources/sounds/impact/impactBell_heavy_003.ogg b/core/src/main/resources/sounds/impact/impactBell_heavy_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactBell_heavy_003.ogg rename to core/src/main/resources/sounds/impact/impactBell_heavy_003.ogg diff --git a/src/main/resources/sounds/impact/impactBell_heavy_004.ogg b/core/src/main/resources/sounds/impact/impactBell_heavy_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactBell_heavy_004.ogg rename to core/src/main/resources/sounds/impact/impactBell_heavy_004.ogg diff --git a/src/main/resources/sounds/impact/impactGeneric_light_000.ogg b/core/src/main/resources/sounds/impact/impactGeneric_light_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGeneric_light_000.ogg rename to core/src/main/resources/sounds/impact/impactGeneric_light_000.ogg diff --git a/src/main/resources/sounds/impact/impactGeneric_light_001.ogg b/core/src/main/resources/sounds/impact/impactGeneric_light_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGeneric_light_001.ogg rename to core/src/main/resources/sounds/impact/impactGeneric_light_001.ogg diff --git a/src/main/resources/sounds/impact/impactGeneric_light_002.ogg b/core/src/main/resources/sounds/impact/impactGeneric_light_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGeneric_light_002.ogg rename to core/src/main/resources/sounds/impact/impactGeneric_light_002.ogg diff --git a/src/main/resources/sounds/impact/impactGeneric_light_003.ogg b/core/src/main/resources/sounds/impact/impactGeneric_light_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGeneric_light_003.ogg rename to core/src/main/resources/sounds/impact/impactGeneric_light_003.ogg diff --git a/src/main/resources/sounds/impact/impactGeneric_light_004.ogg b/core/src/main/resources/sounds/impact/impactGeneric_light_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGeneric_light_004.ogg rename to core/src/main/resources/sounds/impact/impactGeneric_light_004.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_heavy_000.ogg b/core/src/main/resources/sounds/impact/impactGlass_heavy_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_heavy_000.ogg rename to core/src/main/resources/sounds/impact/impactGlass_heavy_000.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_heavy_001.ogg b/core/src/main/resources/sounds/impact/impactGlass_heavy_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_heavy_001.ogg rename to core/src/main/resources/sounds/impact/impactGlass_heavy_001.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_heavy_002.ogg b/core/src/main/resources/sounds/impact/impactGlass_heavy_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_heavy_002.ogg rename to core/src/main/resources/sounds/impact/impactGlass_heavy_002.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_heavy_003.ogg b/core/src/main/resources/sounds/impact/impactGlass_heavy_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_heavy_003.ogg rename to core/src/main/resources/sounds/impact/impactGlass_heavy_003.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_heavy_004.ogg b/core/src/main/resources/sounds/impact/impactGlass_heavy_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_heavy_004.ogg rename to core/src/main/resources/sounds/impact/impactGlass_heavy_004.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_light_000.ogg b/core/src/main/resources/sounds/impact/impactGlass_light_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_light_000.ogg rename to core/src/main/resources/sounds/impact/impactGlass_light_000.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_light_001.ogg b/core/src/main/resources/sounds/impact/impactGlass_light_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_light_001.ogg rename to core/src/main/resources/sounds/impact/impactGlass_light_001.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_light_002.ogg b/core/src/main/resources/sounds/impact/impactGlass_light_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_light_002.ogg rename to core/src/main/resources/sounds/impact/impactGlass_light_002.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_light_003.ogg b/core/src/main/resources/sounds/impact/impactGlass_light_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_light_003.ogg rename to core/src/main/resources/sounds/impact/impactGlass_light_003.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_light_004.ogg b/core/src/main/resources/sounds/impact/impactGlass_light_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_light_004.ogg rename to core/src/main/resources/sounds/impact/impactGlass_light_004.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_medium_000.ogg b/core/src/main/resources/sounds/impact/impactGlass_medium_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_medium_000.ogg rename to core/src/main/resources/sounds/impact/impactGlass_medium_000.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_medium_001.ogg b/core/src/main/resources/sounds/impact/impactGlass_medium_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_medium_001.ogg rename to core/src/main/resources/sounds/impact/impactGlass_medium_001.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_medium_002.ogg b/core/src/main/resources/sounds/impact/impactGlass_medium_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_medium_002.ogg rename to core/src/main/resources/sounds/impact/impactGlass_medium_002.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_medium_003.ogg b/core/src/main/resources/sounds/impact/impactGlass_medium_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_medium_003.ogg rename to core/src/main/resources/sounds/impact/impactGlass_medium_003.ogg diff --git a/src/main/resources/sounds/impact/impactGlass_medium_004.ogg b/core/src/main/resources/sounds/impact/impactGlass_medium_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactGlass_medium_004.ogg rename to core/src/main/resources/sounds/impact/impactGlass_medium_004.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_heavy_000.ogg b/core/src/main/resources/sounds/impact/impactMetal_heavy_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_heavy_000.ogg rename to core/src/main/resources/sounds/impact/impactMetal_heavy_000.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_heavy_001.ogg b/core/src/main/resources/sounds/impact/impactMetal_heavy_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_heavy_001.ogg rename to core/src/main/resources/sounds/impact/impactMetal_heavy_001.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_heavy_002.ogg b/core/src/main/resources/sounds/impact/impactMetal_heavy_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_heavy_002.ogg rename to core/src/main/resources/sounds/impact/impactMetal_heavy_002.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_heavy_003.ogg b/core/src/main/resources/sounds/impact/impactMetal_heavy_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_heavy_003.ogg rename to core/src/main/resources/sounds/impact/impactMetal_heavy_003.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_heavy_004.ogg b/core/src/main/resources/sounds/impact/impactMetal_heavy_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_heavy_004.ogg rename to core/src/main/resources/sounds/impact/impactMetal_heavy_004.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_light_000.ogg b/core/src/main/resources/sounds/impact/impactMetal_light_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_light_000.ogg rename to core/src/main/resources/sounds/impact/impactMetal_light_000.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_light_001.ogg b/core/src/main/resources/sounds/impact/impactMetal_light_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_light_001.ogg rename to core/src/main/resources/sounds/impact/impactMetal_light_001.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_light_002.ogg b/core/src/main/resources/sounds/impact/impactMetal_light_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_light_002.ogg rename to core/src/main/resources/sounds/impact/impactMetal_light_002.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_light_003.ogg b/core/src/main/resources/sounds/impact/impactMetal_light_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_light_003.ogg rename to core/src/main/resources/sounds/impact/impactMetal_light_003.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_light_004.ogg b/core/src/main/resources/sounds/impact/impactMetal_light_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_light_004.ogg rename to core/src/main/resources/sounds/impact/impactMetal_light_004.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_medium_000.ogg b/core/src/main/resources/sounds/impact/impactMetal_medium_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_medium_000.ogg rename to core/src/main/resources/sounds/impact/impactMetal_medium_000.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_medium_001.ogg b/core/src/main/resources/sounds/impact/impactMetal_medium_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_medium_001.ogg rename to core/src/main/resources/sounds/impact/impactMetal_medium_001.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_medium_002.ogg b/core/src/main/resources/sounds/impact/impactMetal_medium_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_medium_002.ogg rename to core/src/main/resources/sounds/impact/impactMetal_medium_002.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_medium_003.ogg b/core/src/main/resources/sounds/impact/impactMetal_medium_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_medium_003.ogg rename to core/src/main/resources/sounds/impact/impactMetal_medium_003.ogg diff --git a/src/main/resources/sounds/impact/impactMetal_medium_004.ogg b/core/src/main/resources/sounds/impact/impactMetal_medium_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMetal_medium_004.ogg rename to core/src/main/resources/sounds/impact/impactMetal_medium_004.ogg diff --git a/src/main/resources/sounds/impact/impactMining_000.ogg b/core/src/main/resources/sounds/impact/impactMining_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMining_000.ogg rename to core/src/main/resources/sounds/impact/impactMining_000.ogg diff --git a/src/main/resources/sounds/impact/impactMining_001.ogg b/core/src/main/resources/sounds/impact/impactMining_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMining_001.ogg rename to core/src/main/resources/sounds/impact/impactMining_001.ogg diff --git a/src/main/resources/sounds/impact/impactMining_002.ogg b/core/src/main/resources/sounds/impact/impactMining_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMining_002.ogg rename to core/src/main/resources/sounds/impact/impactMining_002.ogg diff --git a/src/main/resources/sounds/impact/impactMining_003.ogg b/core/src/main/resources/sounds/impact/impactMining_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMining_003.ogg rename to core/src/main/resources/sounds/impact/impactMining_003.ogg diff --git a/src/main/resources/sounds/impact/impactMining_004.ogg b/core/src/main/resources/sounds/impact/impactMining_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactMining_004.ogg rename to core/src/main/resources/sounds/impact/impactMining_004.ogg diff --git a/src/main/resources/sounds/impact/impactPlank_medium_000.ogg b/core/src/main/resources/sounds/impact/impactPlank_medium_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlank_medium_000.ogg rename to core/src/main/resources/sounds/impact/impactPlank_medium_000.ogg diff --git a/src/main/resources/sounds/impact/impactPlank_medium_001.ogg b/core/src/main/resources/sounds/impact/impactPlank_medium_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlank_medium_001.ogg rename to core/src/main/resources/sounds/impact/impactPlank_medium_001.ogg diff --git a/src/main/resources/sounds/impact/impactPlank_medium_002.ogg b/core/src/main/resources/sounds/impact/impactPlank_medium_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlank_medium_002.ogg rename to core/src/main/resources/sounds/impact/impactPlank_medium_002.ogg diff --git a/src/main/resources/sounds/impact/impactPlank_medium_003.ogg b/core/src/main/resources/sounds/impact/impactPlank_medium_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlank_medium_003.ogg rename to core/src/main/resources/sounds/impact/impactPlank_medium_003.ogg diff --git a/src/main/resources/sounds/impact/impactPlank_medium_004.ogg b/core/src/main/resources/sounds/impact/impactPlank_medium_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlank_medium_004.ogg rename to core/src/main/resources/sounds/impact/impactPlank_medium_004.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_heavy_000.ogg b/core/src/main/resources/sounds/impact/impactPlate_heavy_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_heavy_000.ogg rename to core/src/main/resources/sounds/impact/impactPlate_heavy_000.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_heavy_001.ogg b/core/src/main/resources/sounds/impact/impactPlate_heavy_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_heavy_001.ogg rename to core/src/main/resources/sounds/impact/impactPlate_heavy_001.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_heavy_002.ogg b/core/src/main/resources/sounds/impact/impactPlate_heavy_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_heavy_002.ogg rename to core/src/main/resources/sounds/impact/impactPlate_heavy_002.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_heavy_003.ogg b/core/src/main/resources/sounds/impact/impactPlate_heavy_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_heavy_003.ogg rename to core/src/main/resources/sounds/impact/impactPlate_heavy_003.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_heavy_004.ogg b/core/src/main/resources/sounds/impact/impactPlate_heavy_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_heavy_004.ogg rename to core/src/main/resources/sounds/impact/impactPlate_heavy_004.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_light_000.ogg b/core/src/main/resources/sounds/impact/impactPlate_light_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_light_000.ogg rename to core/src/main/resources/sounds/impact/impactPlate_light_000.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_light_001.ogg b/core/src/main/resources/sounds/impact/impactPlate_light_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_light_001.ogg rename to core/src/main/resources/sounds/impact/impactPlate_light_001.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_light_002.ogg b/core/src/main/resources/sounds/impact/impactPlate_light_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_light_002.ogg rename to core/src/main/resources/sounds/impact/impactPlate_light_002.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_light_003.ogg b/core/src/main/resources/sounds/impact/impactPlate_light_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_light_003.ogg rename to core/src/main/resources/sounds/impact/impactPlate_light_003.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_light_004.ogg b/core/src/main/resources/sounds/impact/impactPlate_light_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_light_004.ogg rename to core/src/main/resources/sounds/impact/impactPlate_light_004.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_medium_000.ogg b/core/src/main/resources/sounds/impact/impactPlate_medium_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_medium_000.ogg rename to core/src/main/resources/sounds/impact/impactPlate_medium_000.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_medium_001.ogg b/core/src/main/resources/sounds/impact/impactPlate_medium_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_medium_001.ogg rename to core/src/main/resources/sounds/impact/impactPlate_medium_001.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_medium_002.ogg b/core/src/main/resources/sounds/impact/impactPlate_medium_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_medium_002.ogg rename to core/src/main/resources/sounds/impact/impactPlate_medium_002.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_medium_003.ogg b/core/src/main/resources/sounds/impact/impactPlate_medium_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_medium_003.ogg rename to core/src/main/resources/sounds/impact/impactPlate_medium_003.ogg diff --git a/src/main/resources/sounds/impact/impactPlate_medium_004.ogg b/core/src/main/resources/sounds/impact/impactPlate_medium_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPlate_medium_004.ogg rename to core/src/main/resources/sounds/impact/impactPlate_medium_004.ogg diff --git a/src/main/resources/sounds/impact/impactPunch_heavy_000.ogg b/core/src/main/resources/sounds/impact/impactPunch_heavy_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPunch_heavy_000.ogg rename to core/src/main/resources/sounds/impact/impactPunch_heavy_000.ogg diff --git a/src/main/resources/sounds/impact/impactPunch_heavy_001.ogg b/core/src/main/resources/sounds/impact/impactPunch_heavy_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPunch_heavy_001.ogg rename to core/src/main/resources/sounds/impact/impactPunch_heavy_001.ogg diff --git a/src/main/resources/sounds/impact/impactPunch_heavy_002.ogg b/core/src/main/resources/sounds/impact/impactPunch_heavy_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPunch_heavy_002.ogg rename to core/src/main/resources/sounds/impact/impactPunch_heavy_002.ogg diff --git a/src/main/resources/sounds/impact/impactPunch_heavy_003.ogg b/core/src/main/resources/sounds/impact/impactPunch_heavy_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPunch_heavy_003.ogg rename to core/src/main/resources/sounds/impact/impactPunch_heavy_003.ogg diff --git a/src/main/resources/sounds/impact/impactPunch_heavy_004.ogg b/core/src/main/resources/sounds/impact/impactPunch_heavy_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPunch_heavy_004.ogg rename to core/src/main/resources/sounds/impact/impactPunch_heavy_004.ogg diff --git a/src/main/resources/sounds/impact/impactPunch_medium_000.ogg b/core/src/main/resources/sounds/impact/impactPunch_medium_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPunch_medium_000.ogg rename to core/src/main/resources/sounds/impact/impactPunch_medium_000.ogg diff --git a/src/main/resources/sounds/impact/impactPunch_medium_001.ogg b/core/src/main/resources/sounds/impact/impactPunch_medium_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPunch_medium_001.ogg rename to core/src/main/resources/sounds/impact/impactPunch_medium_001.ogg diff --git a/src/main/resources/sounds/impact/impactPunch_medium_002.ogg b/core/src/main/resources/sounds/impact/impactPunch_medium_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPunch_medium_002.ogg rename to core/src/main/resources/sounds/impact/impactPunch_medium_002.ogg diff --git a/src/main/resources/sounds/impact/impactPunch_medium_003.ogg b/core/src/main/resources/sounds/impact/impactPunch_medium_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPunch_medium_003.ogg rename to core/src/main/resources/sounds/impact/impactPunch_medium_003.ogg diff --git a/src/main/resources/sounds/impact/impactPunch_medium_004.ogg b/core/src/main/resources/sounds/impact/impactPunch_medium_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactPunch_medium_004.ogg rename to core/src/main/resources/sounds/impact/impactPunch_medium_004.ogg diff --git a/src/main/resources/sounds/impact/impactSoft_heavy_000.ogg b/core/src/main/resources/sounds/impact/impactSoft_heavy_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactSoft_heavy_000.ogg rename to core/src/main/resources/sounds/impact/impactSoft_heavy_000.ogg diff --git a/src/main/resources/sounds/impact/impactSoft_heavy_001.ogg b/core/src/main/resources/sounds/impact/impactSoft_heavy_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactSoft_heavy_001.ogg rename to core/src/main/resources/sounds/impact/impactSoft_heavy_001.ogg diff --git a/src/main/resources/sounds/impact/impactSoft_heavy_002.ogg b/core/src/main/resources/sounds/impact/impactSoft_heavy_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactSoft_heavy_002.ogg rename to core/src/main/resources/sounds/impact/impactSoft_heavy_002.ogg diff --git a/src/main/resources/sounds/impact/impactSoft_heavy_003.ogg b/core/src/main/resources/sounds/impact/impactSoft_heavy_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactSoft_heavy_003.ogg rename to core/src/main/resources/sounds/impact/impactSoft_heavy_003.ogg diff --git a/src/main/resources/sounds/impact/impactSoft_heavy_004.ogg b/core/src/main/resources/sounds/impact/impactSoft_heavy_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactSoft_heavy_004.ogg rename to core/src/main/resources/sounds/impact/impactSoft_heavy_004.ogg diff --git a/src/main/resources/sounds/impact/impactSoft_medium_000.ogg b/core/src/main/resources/sounds/impact/impactSoft_medium_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactSoft_medium_000.ogg rename to core/src/main/resources/sounds/impact/impactSoft_medium_000.ogg diff --git a/src/main/resources/sounds/impact/impactSoft_medium_001.ogg b/core/src/main/resources/sounds/impact/impactSoft_medium_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactSoft_medium_001.ogg rename to core/src/main/resources/sounds/impact/impactSoft_medium_001.ogg diff --git a/src/main/resources/sounds/impact/impactSoft_medium_002.ogg b/core/src/main/resources/sounds/impact/impactSoft_medium_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactSoft_medium_002.ogg rename to core/src/main/resources/sounds/impact/impactSoft_medium_002.ogg diff --git a/src/main/resources/sounds/impact/impactSoft_medium_003.ogg b/core/src/main/resources/sounds/impact/impactSoft_medium_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactSoft_medium_003.ogg rename to core/src/main/resources/sounds/impact/impactSoft_medium_003.ogg diff --git a/src/main/resources/sounds/impact/impactSoft_medium_004.ogg b/core/src/main/resources/sounds/impact/impactSoft_medium_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactSoft_medium_004.ogg rename to core/src/main/resources/sounds/impact/impactSoft_medium_004.ogg diff --git a/src/main/resources/sounds/impact/impactTin_medium_000.ogg b/core/src/main/resources/sounds/impact/impactTin_medium_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactTin_medium_000.ogg rename to core/src/main/resources/sounds/impact/impactTin_medium_000.ogg diff --git a/src/main/resources/sounds/impact/impactTin_medium_001.ogg b/core/src/main/resources/sounds/impact/impactTin_medium_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactTin_medium_001.ogg rename to core/src/main/resources/sounds/impact/impactTin_medium_001.ogg diff --git a/src/main/resources/sounds/impact/impactTin_medium_002.ogg b/core/src/main/resources/sounds/impact/impactTin_medium_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactTin_medium_002.ogg rename to core/src/main/resources/sounds/impact/impactTin_medium_002.ogg diff --git a/src/main/resources/sounds/impact/impactTin_medium_003.ogg b/core/src/main/resources/sounds/impact/impactTin_medium_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactTin_medium_003.ogg rename to core/src/main/resources/sounds/impact/impactTin_medium_003.ogg diff --git a/src/main/resources/sounds/impact/impactTin_medium_004.ogg b/core/src/main/resources/sounds/impact/impactTin_medium_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactTin_medium_004.ogg rename to core/src/main/resources/sounds/impact/impactTin_medium_004.ogg diff --git a/src/main/resources/sounds/impact/impactWood_heavy_000.ogg b/core/src/main/resources/sounds/impact/impactWood_heavy_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_heavy_000.ogg rename to core/src/main/resources/sounds/impact/impactWood_heavy_000.ogg diff --git a/src/main/resources/sounds/impact/impactWood_heavy_001.ogg b/core/src/main/resources/sounds/impact/impactWood_heavy_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_heavy_001.ogg rename to core/src/main/resources/sounds/impact/impactWood_heavy_001.ogg diff --git a/src/main/resources/sounds/impact/impactWood_heavy_002.ogg b/core/src/main/resources/sounds/impact/impactWood_heavy_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_heavy_002.ogg rename to core/src/main/resources/sounds/impact/impactWood_heavy_002.ogg diff --git a/src/main/resources/sounds/impact/impactWood_heavy_003.ogg b/core/src/main/resources/sounds/impact/impactWood_heavy_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_heavy_003.ogg rename to core/src/main/resources/sounds/impact/impactWood_heavy_003.ogg diff --git a/src/main/resources/sounds/impact/impactWood_heavy_004.ogg b/core/src/main/resources/sounds/impact/impactWood_heavy_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_heavy_004.ogg rename to core/src/main/resources/sounds/impact/impactWood_heavy_004.ogg diff --git a/src/main/resources/sounds/impact/impactWood_light_000.ogg b/core/src/main/resources/sounds/impact/impactWood_light_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_light_000.ogg rename to core/src/main/resources/sounds/impact/impactWood_light_000.ogg diff --git a/src/main/resources/sounds/impact/impactWood_light_001.ogg b/core/src/main/resources/sounds/impact/impactWood_light_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_light_001.ogg rename to core/src/main/resources/sounds/impact/impactWood_light_001.ogg diff --git a/src/main/resources/sounds/impact/impactWood_light_002.ogg b/core/src/main/resources/sounds/impact/impactWood_light_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_light_002.ogg rename to core/src/main/resources/sounds/impact/impactWood_light_002.ogg diff --git a/src/main/resources/sounds/impact/impactWood_light_003.ogg b/core/src/main/resources/sounds/impact/impactWood_light_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_light_003.ogg rename to core/src/main/resources/sounds/impact/impactWood_light_003.ogg diff --git a/src/main/resources/sounds/impact/impactWood_light_004.ogg b/core/src/main/resources/sounds/impact/impactWood_light_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_light_004.ogg rename to core/src/main/resources/sounds/impact/impactWood_light_004.ogg diff --git a/src/main/resources/sounds/impact/impactWood_medium_000.ogg b/core/src/main/resources/sounds/impact/impactWood_medium_000.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_medium_000.ogg rename to core/src/main/resources/sounds/impact/impactWood_medium_000.ogg diff --git a/src/main/resources/sounds/impact/impactWood_medium_001.ogg b/core/src/main/resources/sounds/impact/impactWood_medium_001.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_medium_001.ogg rename to core/src/main/resources/sounds/impact/impactWood_medium_001.ogg diff --git a/src/main/resources/sounds/impact/impactWood_medium_002.ogg b/core/src/main/resources/sounds/impact/impactWood_medium_002.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_medium_002.ogg rename to core/src/main/resources/sounds/impact/impactWood_medium_002.ogg diff --git a/src/main/resources/sounds/impact/impactWood_medium_003.ogg b/core/src/main/resources/sounds/impact/impactWood_medium_003.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_medium_003.ogg rename to core/src/main/resources/sounds/impact/impactWood_medium_003.ogg diff --git a/src/main/resources/sounds/impact/impactWood_medium_004.ogg b/core/src/main/resources/sounds/impact/impactWood_medium_004.ogg similarity index 100% rename from src/main/resources/sounds/impact/impactWood_medium_004.ogg rename to core/src/main/resources/sounds/impact/impactWood_medium_004.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES00.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES00.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES00.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES00.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES01.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES01.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES01.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES01.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES02.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES02.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES02.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES02.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES03.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES03.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES03.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES03.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES04.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES04.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES04.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES04.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES05.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES05.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES05.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES05.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES06.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES06.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES06.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES06.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES07.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES07.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES07.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES07.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES08.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES08.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES08.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES08.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES09.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES09.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES09.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES09.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES10.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES10.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES10.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES10.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES11.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES11.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES11.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES11.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES12.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES12.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES12.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES12.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES13.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES13.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES13.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES13.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES14.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES14.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES14.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES14.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES15.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES15.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES15.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES15.ogg diff --git a/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES16.ogg b/core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES16.ogg similarity index 100% rename from src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES16.ogg rename to core/src/main/resources/sounds/jingles/8-Bit jingles/jingles_NES16.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT00.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT00.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT00.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT00.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT01.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT01.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT01.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT01.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT02.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT02.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT02.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT02.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT03.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT03.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT03.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT03.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT04.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT04.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT04.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT04.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT05.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT05.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT05.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT05.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT06.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT06.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT06.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT06.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT07.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT07.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT07.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT07.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT08.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT08.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT08.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT08.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT09.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT09.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT09.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT09.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT10.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT10.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT10.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT10.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT11.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT11.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT11.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT11.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT12.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT12.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT12.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT12.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT13.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT13.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT13.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT13.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT14.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT14.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT14.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT14.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT15.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT15.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT15.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT15.ogg diff --git a/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT16.ogg b/core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT16.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Hit jingles/jingles_HIT16.ogg rename to core/src/main/resources/sounds/jingles/Hit jingles/jingles_HIT16.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI00.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI00.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI00.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI00.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI01.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI01.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI01.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI01.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI02.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI02.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI02.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI02.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI03.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI03.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI03.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI03.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI04.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI04.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI04.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI04.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI05.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI05.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI05.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI05.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI06.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI06.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI06.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI06.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI07.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI07.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI07.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI07.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI08.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI08.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI08.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI08.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI09.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI09.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI09.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI09.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI10.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI10.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI10.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI10.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI11.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI11.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI11.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI11.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI12.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI12.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI12.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI12.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI13.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI13.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI13.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI13.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI14.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI14.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI14.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI14.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI15.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI15.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI15.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI15.ogg diff --git a/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI16.ogg b/core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI16.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI16.ogg rename to core/src/main/resources/sounds/jingles/Pizzicato jingles/jingles_PIZZI16.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX00.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX00.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX00.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX00.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX01.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX01.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX01.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX01.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX02.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX02.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX02.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX02.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX03.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX03.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX03.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX03.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX04.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX04.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX04.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX04.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX05.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX05.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX05.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX05.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX06.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX06.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX06.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX06.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX07.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX07.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX07.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX07.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX08.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX08.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX08.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX08.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX09.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX09.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX09.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX09.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX10.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX10.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX10.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX10.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX11.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX11.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX11.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX11.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX12.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX12.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX12.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX12.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX13.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX13.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX13.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX13.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX14.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX14.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX14.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX14.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX15.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX15.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX15.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX15.ogg diff --git a/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX16.ogg b/core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX16.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Sax jingles/jingles_SAX16.ogg rename to core/src/main/resources/sounds/jingles/Sax jingles/jingles_SAX16.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL00.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL00.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL00.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL00.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL01.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL01.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL01.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL01.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL02.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL02.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL02.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL02.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL03.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL03.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL03.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL03.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL04.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL04.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL04.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL04.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL05.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL05.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL05.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL05.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL06.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL06.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL06.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL06.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL07.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL07.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL07.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL07.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL08.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL08.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL08.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL08.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL09.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL09.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL09.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL09.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL10.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL10.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL10.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL10.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL11.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL11.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL11.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL11.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL12.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL12.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL12.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL12.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL13.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL13.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL13.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL13.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL14.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL14.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL14.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL14.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL15.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL15.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL15.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL15.ogg diff --git a/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL16.ogg b/core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL16.ogg similarity index 100% rename from src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL16.ogg rename to core/src/main/resources/sounds/jingles/Steel jingles/jingles_STEEL16.ogg diff --git a/src/main/resources/sounds/rpg/beltHandle1.ogg b/core/src/main/resources/sounds/rpg/beltHandle1.ogg similarity index 100% rename from src/main/resources/sounds/rpg/beltHandle1.ogg rename to core/src/main/resources/sounds/rpg/beltHandle1.ogg diff --git a/src/main/resources/sounds/rpg/beltHandle2.ogg b/core/src/main/resources/sounds/rpg/beltHandle2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/beltHandle2.ogg rename to core/src/main/resources/sounds/rpg/beltHandle2.ogg diff --git a/src/main/resources/sounds/rpg/bookClose.ogg b/core/src/main/resources/sounds/rpg/bookClose.ogg similarity index 100% rename from src/main/resources/sounds/rpg/bookClose.ogg rename to core/src/main/resources/sounds/rpg/bookClose.ogg diff --git a/src/main/resources/sounds/rpg/bookFlip1.ogg b/core/src/main/resources/sounds/rpg/bookFlip1.ogg similarity index 100% rename from src/main/resources/sounds/rpg/bookFlip1.ogg rename to core/src/main/resources/sounds/rpg/bookFlip1.ogg diff --git a/src/main/resources/sounds/rpg/bookFlip2.ogg b/core/src/main/resources/sounds/rpg/bookFlip2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/bookFlip2.ogg rename to core/src/main/resources/sounds/rpg/bookFlip2.ogg diff --git a/src/main/resources/sounds/rpg/bookFlip3.ogg b/core/src/main/resources/sounds/rpg/bookFlip3.ogg similarity index 100% rename from src/main/resources/sounds/rpg/bookFlip3.ogg rename to core/src/main/resources/sounds/rpg/bookFlip3.ogg diff --git a/src/main/resources/sounds/rpg/bookOpen.ogg b/core/src/main/resources/sounds/rpg/bookOpen.ogg similarity index 100% rename from src/main/resources/sounds/rpg/bookOpen.ogg rename to core/src/main/resources/sounds/rpg/bookOpen.ogg diff --git a/src/main/resources/sounds/rpg/bookPlace1.ogg b/core/src/main/resources/sounds/rpg/bookPlace1.ogg similarity index 100% rename from src/main/resources/sounds/rpg/bookPlace1.ogg rename to core/src/main/resources/sounds/rpg/bookPlace1.ogg diff --git a/src/main/resources/sounds/rpg/bookPlace2.ogg b/core/src/main/resources/sounds/rpg/bookPlace2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/bookPlace2.ogg rename to core/src/main/resources/sounds/rpg/bookPlace2.ogg diff --git a/src/main/resources/sounds/rpg/bookPlace3.ogg b/core/src/main/resources/sounds/rpg/bookPlace3.ogg similarity index 100% rename from src/main/resources/sounds/rpg/bookPlace3.ogg rename to core/src/main/resources/sounds/rpg/bookPlace3.ogg diff --git a/src/main/resources/sounds/rpg/chop.ogg b/core/src/main/resources/sounds/rpg/chop.ogg similarity index 100% rename from src/main/resources/sounds/rpg/chop.ogg rename to core/src/main/resources/sounds/rpg/chop.ogg diff --git a/src/main/resources/sounds/rpg/cloth1.ogg b/core/src/main/resources/sounds/rpg/cloth1.ogg similarity index 100% rename from src/main/resources/sounds/rpg/cloth1.ogg rename to core/src/main/resources/sounds/rpg/cloth1.ogg diff --git a/src/main/resources/sounds/rpg/cloth2.ogg b/core/src/main/resources/sounds/rpg/cloth2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/cloth2.ogg rename to core/src/main/resources/sounds/rpg/cloth2.ogg diff --git a/src/main/resources/sounds/rpg/cloth3.ogg b/core/src/main/resources/sounds/rpg/cloth3.ogg similarity index 100% rename from src/main/resources/sounds/rpg/cloth3.ogg rename to core/src/main/resources/sounds/rpg/cloth3.ogg diff --git a/src/main/resources/sounds/rpg/cloth4.ogg b/core/src/main/resources/sounds/rpg/cloth4.ogg similarity index 100% rename from src/main/resources/sounds/rpg/cloth4.ogg rename to core/src/main/resources/sounds/rpg/cloth4.ogg diff --git a/src/main/resources/sounds/rpg/clothBelt.ogg b/core/src/main/resources/sounds/rpg/clothBelt.ogg similarity index 100% rename from src/main/resources/sounds/rpg/clothBelt.ogg rename to core/src/main/resources/sounds/rpg/clothBelt.ogg diff --git a/src/main/resources/sounds/rpg/clothBelt2.ogg b/core/src/main/resources/sounds/rpg/clothBelt2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/clothBelt2.ogg rename to core/src/main/resources/sounds/rpg/clothBelt2.ogg diff --git a/src/main/resources/sounds/rpg/creak1.ogg b/core/src/main/resources/sounds/rpg/creak1.ogg similarity index 100% rename from src/main/resources/sounds/rpg/creak1.ogg rename to core/src/main/resources/sounds/rpg/creak1.ogg diff --git a/src/main/resources/sounds/rpg/creak2.ogg b/core/src/main/resources/sounds/rpg/creak2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/creak2.ogg rename to core/src/main/resources/sounds/rpg/creak2.ogg diff --git a/src/main/resources/sounds/rpg/creak3.ogg b/core/src/main/resources/sounds/rpg/creak3.ogg similarity index 100% rename from src/main/resources/sounds/rpg/creak3.ogg rename to core/src/main/resources/sounds/rpg/creak3.ogg diff --git a/src/main/resources/sounds/rpg/doorClose_1.ogg b/core/src/main/resources/sounds/rpg/doorClose_1.ogg similarity index 100% rename from src/main/resources/sounds/rpg/doorClose_1.ogg rename to core/src/main/resources/sounds/rpg/doorClose_1.ogg diff --git a/src/main/resources/sounds/rpg/doorClose_2.ogg b/core/src/main/resources/sounds/rpg/doorClose_2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/doorClose_2.ogg rename to core/src/main/resources/sounds/rpg/doorClose_2.ogg diff --git a/src/main/resources/sounds/rpg/doorClose_3.ogg b/core/src/main/resources/sounds/rpg/doorClose_3.ogg similarity index 100% rename from src/main/resources/sounds/rpg/doorClose_3.ogg rename to core/src/main/resources/sounds/rpg/doorClose_3.ogg diff --git a/src/main/resources/sounds/rpg/doorClose_4.ogg b/core/src/main/resources/sounds/rpg/doorClose_4.ogg similarity index 100% rename from src/main/resources/sounds/rpg/doorClose_4.ogg rename to core/src/main/resources/sounds/rpg/doorClose_4.ogg diff --git a/src/main/resources/sounds/rpg/doorOpen_1.ogg b/core/src/main/resources/sounds/rpg/doorOpen_1.ogg similarity index 100% rename from src/main/resources/sounds/rpg/doorOpen_1.ogg rename to core/src/main/resources/sounds/rpg/doorOpen_1.ogg diff --git a/src/main/resources/sounds/rpg/doorOpen_2.ogg b/core/src/main/resources/sounds/rpg/doorOpen_2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/doorOpen_2.ogg rename to core/src/main/resources/sounds/rpg/doorOpen_2.ogg diff --git a/src/main/resources/sounds/rpg/drawKnife1.ogg b/core/src/main/resources/sounds/rpg/drawKnife1.ogg similarity index 100% rename from src/main/resources/sounds/rpg/drawKnife1.ogg rename to core/src/main/resources/sounds/rpg/drawKnife1.ogg diff --git a/src/main/resources/sounds/rpg/drawKnife2.ogg b/core/src/main/resources/sounds/rpg/drawKnife2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/drawKnife2.ogg rename to core/src/main/resources/sounds/rpg/drawKnife2.ogg diff --git a/src/main/resources/sounds/rpg/drawKnife3.ogg b/core/src/main/resources/sounds/rpg/drawKnife3.ogg similarity index 100% rename from src/main/resources/sounds/rpg/drawKnife3.ogg rename to core/src/main/resources/sounds/rpg/drawKnife3.ogg diff --git a/src/main/resources/sounds/rpg/dropLeather.ogg b/core/src/main/resources/sounds/rpg/dropLeather.ogg similarity index 100% rename from src/main/resources/sounds/rpg/dropLeather.ogg rename to core/src/main/resources/sounds/rpg/dropLeather.ogg diff --git a/src/main/resources/sounds/rpg/footstep00.ogg b/core/src/main/resources/sounds/rpg/footstep00.ogg similarity index 100% rename from src/main/resources/sounds/rpg/footstep00.ogg rename to core/src/main/resources/sounds/rpg/footstep00.ogg diff --git a/src/main/resources/sounds/rpg/footstep01.ogg b/core/src/main/resources/sounds/rpg/footstep01.ogg similarity index 100% rename from src/main/resources/sounds/rpg/footstep01.ogg rename to core/src/main/resources/sounds/rpg/footstep01.ogg diff --git a/src/main/resources/sounds/rpg/footstep02.ogg b/core/src/main/resources/sounds/rpg/footstep02.ogg similarity index 100% rename from src/main/resources/sounds/rpg/footstep02.ogg rename to core/src/main/resources/sounds/rpg/footstep02.ogg diff --git a/src/main/resources/sounds/rpg/footstep03.ogg b/core/src/main/resources/sounds/rpg/footstep03.ogg similarity index 100% rename from src/main/resources/sounds/rpg/footstep03.ogg rename to core/src/main/resources/sounds/rpg/footstep03.ogg diff --git a/src/main/resources/sounds/rpg/footstep04.ogg b/core/src/main/resources/sounds/rpg/footstep04.ogg similarity index 100% rename from src/main/resources/sounds/rpg/footstep04.ogg rename to core/src/main/resources/sounds/rpg/footstep04.ogg diff --git a/src/main/resources/sounds/rpg/footstep05.ogg b/core/src/main/resources/sounds/rpg/footstep05.ogg similarity index 100% rename from src/main/resources/sounds/rpg/footstep05.ogg rename to core/src/main/resources/sounds/rpg/footstep05.ogg diff --git a/src/main/resources/sounds/rpg/footstep06.ogg b/core/src/main/resources/sounds/rpg/footstep06.ogg similarity index 100% rename from src/main/resources/sounds/rpg/footstep06.ogg rename to core/src/main/resources/sounds/rpg/footstep06.ogg diff --git a/src/main/resources/sounds/rpg/footstep07.ogg b/core/src/main/resources/sounds/rpg/footstep07.ogg similarity index 100% rename from src/main/resources/sounds/rpg/footstep07.ogg rename to core/src/main/resources/sounds/rpg/footstep07.ogg diff --git a/src/main/resources/sounds/rpg/footstep08.ogg b/core/src/main/resources/sounds/rpg/footstep08.ogg similarity index 100% rename from src/main/resources/sounds/rpg/footstep08.ogg rename to core/src/main/resources/sounds/rpg/footstep08.ogg diff --git a/src/main/resources/sounds/rpg/footstep09.ogg b/core/src/main/resources/sounds/rpg/footstep09.ogg similarity index 100% rename from src/main/resources/sounds/rpg/footstep09.ogg rename to core/src/main/resources/sounds/rpg/footstep09.ogg diff --git a/src/main/resources/sounds/rpg/handleCoins.ogg b/core/src/main/resources/sounds/rpg/handleCoins.ogg similarity index 100% rename from src/main/resources/sounds/rpg/handleCoins.ogg rename to core/src/main/resources/sounds/rpg/handleCoins.ogg diff --git a/src/main/resources/sounds/rpg/handleCoins2.ogg b/core/src/main/resources/sounds/rpg/handleCoins2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/handleCoins2.ogg rename to core/src/main/resources/sounds/rpg/handleCoins2.ogg diff --git a/src/main/resources/sounds/rpg/handleSmallLeather.ogg b/core/src/main/resources/sounds/rpg/handleSmallLeather.ogg similarity index 100% rename from src/main/resources/sounds/rpg/handleSmallLeather.ogg rename to core/src/main/resources/sounds/rpg/handleSmallLeather.ogg diff --git a/src/main/resources/sounds/rpg/handleSmallLeather2.ogg b/core/src/main/resources/sounds/rpg/handleSmallLeather2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/handleSmallLeather2.ogg rename to core/src/main/resources/sounds/rpg/handleSmallLeather2.ogg diff --git a/src/main/resources/sounds/rpg/knifeSlice.ogg b/core/src/main/resources/sounds/rpg/knifeSlice.ogg similarity index 100% rename from src/main/resources/sounds/rpg/knifeSlice.ogg rename to core/src/main/resources/sounds/rpg/knifeSlice.ogg diff --git a/src/main/resources/sounds/rpg/knifeSlice2.ogg b/core/src/main/resources/sounds/rpg/knifeSlice2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/knifeSlice2.ogg rename to core/src/main/resources/sounds/rpg/knifeSlice2.ogg diff --git a/src/main/resources/sounds/rpg/metalClick.ogg b/core/src/main/resources/sounds/rpg/metalClick.ogg similarity index 100% rename from src/main/resources/sounds/rpg/metalClick.ogg rename to core/src/main/resources/sounds/rpg/metalClick.ogg diff --git a/src/main/resources/sounds/rpg/metalLatch.ogg b/core/src/main/resources/sounds/rpg/metalLatch.ogg similarity index 100% rename from src/main/resources/sounds/rpg/metalLatch.ogg rename to core/src/main/resources/sounds/rpg/metalLatch.ogg diff --git a/src/main/resources/sounds/rpg/metalPot1.ogg b/core/src/main/resources/sounds/rpg/metalPot1.ogg similarity index 100% rename from src/main/resources/sounds/rpg/metalPot1.ogg rename to core/src/main/resources/sounds/rpg/metalPot1.ogg diff --git a/src/main/resources/sounds/rpg/metalPot2.ogg b/core/src/main/resources/sounds/rpg/metalPot2.ogg similarity index 100% rename from src/main/resources/sounds/rpg/metalPot2.ogg rename to core/src/main/resources/sounds/rpg/metalPot2.ogg diff --git a/src/main/resources/sounds/rpg/metalPot3.ogg b/core/src/main/resources/sounds/rpg/metalPot3.ogg similarity index 100% rename from src/main/resources/sounds/rpg/metalPot3.ogg rename to core/src/main/resources/sounds/rpg/metalPot3.ogg diff --git a/core/src/test/java/org/openpatch/scratch/AnimationTest.java b/core/src/test/java/org/openpatch/scratch/AnimationTest.java new file mode 100644 index 00000000..273a4cec --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/AnimationTest.java @@ -0,0 +1,157 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.draw.SpriteDraw; + +/** Animations and a size of its own, now on every sprite. */ +class AnimationTest { + + Game game; + Stage stage; + + @BeforeEach + void setUp() { + this.game = Game.headless(480, 360); + this.stage = new Stage(); + this.game.setStage(this.stage); + } + + /** Red of the costume's top-left pixel, which tells the frame apart. */ + static int red(Sprite s) { + SpriteDraw d = s.toDraw(); + return (d.costume().get(0, 0) >> 16) & 0xff; + } + + @Test + void aSheetAnimationShowsItsFramesInOrderEveryInterval() { + List seen = new ArrayList<>(); + Sprite s = new Sprite() { + @Override + public void run() { + this.playAnimation("column", false); + seen.add(red(this)); + } + }; + s.addAnimation("column", "costumes/sheet.png", 10, 10, 0, 4); // frames 0 and 4: red 0 and 80 + s.setAnimationInterval(2 / 60.0); + this.stage.add(s); + this.game.runTicks(6); + assertEquals(List.of(0, 0, 80, 80, 0, 0), seen); + } + + @Test + void numberedFilesFromOneNumberToAnotherAlsoCountDown() { + List seen = new ArrayList<>(); + Sprite s = new Sprite() { + @Override + public void run() { + this.playAnimation("up", false); + seen.add(red(this)); + } + }; + s.addAnimation("up", "costumes/walk%d.png", 2, 3); // red 100, 150 + s.addAnimation("down", "costumes/walk%d.png", 3, 1); + s.setAnimationInterval(1 / 60.0); + this.stage.add(s); + this.game.runTicks(2); + assertEquals(List.of(100, 150), seen); + s.switchCostume("down#0"); + assertEquals(150, red(s)); + s.switchCostume("down#2"); + assertEquals(50, red(s)); + } + + @Test + void anAnimationPlayedOnceStopsAtItsLastFrame() { + Sprite s = new Sprite() { + @Override + public void run() { + this.playAnimation("walk", true); + } + }; + s.addAnimation("walk", "costumes/walk%d.png", 3); + s.setAnimationInterval(1 / 60.0); + this.stage.add(s); + this.game.runTicks(10); + assertEquals(150, red(s)); + assertTrue(s.isAnimationPlayed()); + assertEquals(2, s.getAnimationFrame()); + } + + @Test + void aSizeOfItsOwnStretchesTheCostumeAndTheHitbox() { + Sprite s = new Sprite("red", SceneTest.RED); + this.stage.add(s); + s.setWidth(100); + s.setHeight(30); + s.setNineSlice(2, 2, 2, 2); + assertEquals(100, s.getHitbox().getBounds().width(), 1e-9); + assertEquals(30, s.getHitbox().getBounds().height(), 1e-9); + SpriteDraw d = s.toDraw(); + assertNotNull(d.nineSlice()); + assertEquals(100, d.width(), 1e-9); + assertEquals(10, d.scaleX(), 1e-9); + s.setWidth(0); + s.setHeight(0); + assertEquals(10, s.getWidth(), 1e-9); + } + + @Test + void aNineSlicedBarAsHighAsItsCapsStretchesItsEmptyMiddle() { + // the ui demo's bar: 24 px high, 12 + 12 at the top and bottom, drawn 40 high + double[][] v = SpriteDraw.slices(24, 12, 12, 40, 1); + assertArrayEquals(new double[] {0, 12, 28, 40}, v[0], 1e-9); + assertArrayEquals(new double[] {0, 0.5, 0.5, 1}, v[1], 1e-9); + } + + @Test + void nineSliceInsetsGrowWithTheSpritesSize() { + double[][] h = SpriteDraw.slices(96, 24, 24, 100, 0.7); + assertArrayEquals(new double[] {0, 24 * 0.7, 100 - 24 * 0.7, 100}, h[0], 1e-9); + assertArrayEquals(new double[] {0, 0.25, 0.75, 1}, h[1], 1e-9); + Sprite s = new Sprite("red", SceneTest.RED); + s.setSize(70); + s.setWidth(100); + s.setNineSlice(2, 2, 2, 2); + assertEquals(0.7, s.toDraw().sliceScale(), 1e-9); + } + + @Test + void nineSliceInsetsShrinkTogetherBelowTheirSize() { + double[][] h = SpriteDraw.slices(96, 24, 24, 30, 1); + assertArrayEquals(new double[] {0, 15, 15, 30}, h[0], 1e-9); + } + + @Test + void colourSensingSeesTheNineSliceAsTheScreenDoes() { + // left4: 20 × 10, its four left columns blue; drawn 200 wide with a left inset of 4 + Sprite s = new Sprite("left", SceneTest.LEFT4); + this.stage.add(s); + s.setWidth(200); + s.setNineSlice(0, 0, 0, 4); + Pixels pixels = Pixels.of(this.stage); + int blue = 0xff0000ff; + for (int x = 140; x < 144; x++) { + assertEquals(blue, pixels.getArgb(x, 180), "inset column " + x); + } + assertNotEquals(blue, pixels.getArgb(144, 180), "stretched whole, the blue would reach 179"); + assertNotEquals(blue, pixels.getArgb(170, 180)); + } + + @Test + void insetsThatDoNotFitTheCostumeStretchItWhole() { + double[][] h = SpriteDraw.slices(10, 6, 6, 50, 1); + assertArrayEquals(new double[] {0, 50}, h[0], 1e-9); + assertArrayEquals(new double[] {0, 1}, h[1], 1e-9); + } +} diff --git a/src/test/java/org/openpatch/scratch/BoundsTest.java b/core/src/test/java/org/openpatch/scratch/BoundsTest.java similarity index 100% rename from src/test/java/org/openpatch/scratch/BoundsTest.java rename to core/src/test/java/org/openpatch/scratch/BoundsTest.java diff --git a/core/src/test/java/org/openpatch/scratch/ColorTest.java b/core/src/test/java/org/openpatch/scratch/ColorTest.java new file mode 100644 index 00000000..2c66edcd --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/ColorTest.java @@ -0,0 +1,66 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +class ColorTest { + + @Test + void rgbIsClamped() { + Color c = new Color(300, -5, 128); + assertEquals(255, c.getRed()); + assertEquals(0, c.getGreen()); + assertEquals(128, c.getBlue()); + assertEquals(255, c.getAlpha()); + } + + @Test + void hexCodesInEveryForm() { + assertEquals(new Color(255, 128, 0), new Color("#ff8000")); + assertEquals(new Color(255, 136, 0), new Color("f80")); + assertEquals(new Color(255, 128, 0, 128), new Color("#ff800080")); + assertThrows(IllegalArgumentException.class, () -> new Color("orange")); + } + + @Test + void scratchHueGoesAround() { + assertEquals(new Color(255, 0, 0), Color.fromHSB(0, 100, 100)); + assertEquals(new Color(0, 0, 255), Color.fromHSB(66.6667, 100, 100)); + assertEquals(Color.fromHSB(10, 100, 100), Color.fromHSB(110, 100, 100)); + assertEquals(Color.fromHSB(90, 100, 100), Color.fromHSB(-10, 100, 100)); + } + + @Test + void hsbRoundTrips() { + Color c = Color.fromHSB(42, 70, 80); + assertEquals(42, c.getHue(), 0.5); + assertEquals(70, c.getSaturation(), 0.5); + assertEquals(80, c.getBrightness(), 0.5); + } + + @Test + void withMethodsLeaveTheOriginalAlone() { + Color red = HtmlColor.RED; + Color shifted = red.withHue(red.getHue() + 33.3333); + assertEquals(new Color(255, 0, 0), HtmlColor.RED); + assertNotEquals(red, shifted); + assertEquals(new Color(0, 255, 0), shifted); + } + + @Test + void argbPacksAndUnpacks() { + Color c = new Color(1, 2, 3, 4); + assertEquals(0x04010203, c.toARGB()); + assertEquals(c, Color.fromARGB(0x04010203)); + assertEquals("#010203" + "04", c.toString()); + } + + @Test + void greyHasNoHue() { + assertEquals(0, new Color(128, 128, 128).getHue()); + assertEquals(0, new Color(128, 128, 128).getSaturation()); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/CostumeAndCloneTest.java b/core/src/test/java/org/openpatch/scratch/CostumeAndCloneTest.java new file mode 100644 index 00000000..1aa93f68 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/CostumeAndCloneTest.java @@ -0,0 +1,193 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Test; + +/** + * Costumes, animations and clones, without a window: costumes load straight + * from the built-in sheets and sprites can be cloned headlessly, so sizes, + * costume switching, collision, animation state and clone semantics can be + * checked in plain unit tests. + */ +class CostumeAndCloneTest { + + // ---- from HeadlessCostumeTest ---- + + @Test + void aBuiltinCostumeLoadsWithoutAWindow() { + Sprite slime = new Sprite("slime", "slimeGreen"); + assertTrue(slime.getWidth() > 0, "the costume has its real size"); + assertTrue(slime.getHeight() > 0); + assertEquals("slime", slime.getCurrentCostumeName()); + } + + @Test + void costumesSwitchAndSizeScalesTheCostume() { + Sprite sprite = new Sprite(); + sprite.addCostume("small", "slimeGreen"); + sprite.addCostume("big", "bunny1_stand"); + assertEquals("small", sprite.getCurrentCostumeName()); + double width = sprite.getWidth(); + sprite.nextCostume(); + assertEquals("big", sprite.getCurrentCostumeName()); + assertNotEquals(width, sprite.getWidth()); + double full = sprite.getWidth(); + sprite.setSize(50); + assertEquals(full / 2.0, sprite.getWidth(), 1); + } + + @Test + void hitboxesFollowTheCostumes() { + // isTouchingSprite() also wants both on a stage; their hitboxes need none + Sprite a = new Sprite("slime", "slimeGreen"); + Sprite b = new Sprite("slime", "slimeGreen"); + assertTrue(a.getHitbox().intersects(b.getHitbox()), "both in the middle"); + b.setX(a.getWidth() * 3); + assertFalse(a.getHitbox().intersects(b.getHitbox()), "far apart"); + } + + @Test + void aCloneHasTheCostumes() { + Sprite slime = new Sprite("slime", "slimeGreen"); + slime.addCostume("bunny", "bunny1_stand"); + Sprite clone = slime.createClone(); + assertEquals(slime.getWidth(), clone.getWidth()); + clone.switchCostume("bunny"); + assertEquals("slime", slime.getCurrentCostumeName(), "the original keeps its costume"); + } + + @Test + void animationsLoadTheirFrames() { + Sprite bunny = new Sprite(); + bunny.addAnimation("walk", "bunny1_walk%d", 2); + bunny.playAnimation("walk"); + assertTrue(bunny.getWidth() > 0); + } + + // ---- from SpriteCloneTest ---- + + static class Cat extends Sprite { + int lives = 3; + String name = "Tom"; + List toys = new ArrayList<>(); + int starts = 0; + static int constructed = 0; + + Cat() { + constructed++; + } + + @Override + public void whenStartsAsClone() { + starts++; + } + } + + @Test + void aCloneIsOfTheSameClassWithACopyOfItsVariables() { + Cat cat = new Cat(); + cat.lives = 7; + cat.setPosition(30, -20); + cat.setDirection(45); + int constructed = Cat.constructed; + + Cat clone = cat.createClone(); + + assertEquals(Cat.class, clone.getClass(), "a clone of a Cat is a Cat"); + assertEquals(7, clone.lives); + assertEquals("Tom", clone.name); + assertEquals(30, clone.getX(), 1e-9); + assertEquals(-20, clone.getY(), 1e-9); + assertEquals(45, clone.getDirection(), 1e-9); + assertEquals(constructed, Cat.constructed, "the constructor does not run again"); + clone.lives = 1; + assertEquals(7, cat.lives, "numbers are the clone's own"); + assertSame(cat.toys, clone.toys, "objects are shared, as documented"); + } + + @Test + void theCloneStartsAsAClone() { + Cat cat = new Cat(); + Cat clone = cat.createClone(); + assertEquals(1, clone.starts); + assertEquals(0, cat.starts); + assertTrue(clone.isClone()); + assertFalse(cat.isClone()); + assertTrue(clone.createClone().isClone(), "a clone of a clone is a clone"); + } + + @Test + void aCloneHasItsOwnPenAndTimers() { + Cat cat = new Cat(); + cat.getPen().setSize(5); + Cat clone = cat.createClone(); + assertNotSame(cat.getPen(), clone.getPen()); + assertEquals(5, clone.getPen().getSize(), 1e-9); + assertNotSame(cat.getTimer(), clone.getTimer()); + // changing the clone's pen leaves the original's alone + clone.getPen().setSize(9); + assertEquals(5, cat.getPen().getSize(), 1e-9); + } + + @Test + void anOriginalIsNotDeletedAsAClone() { + Cat cat = new Cat(); + cat.deleteThisClone(); + assertFalse(cat.isClone()); + } + + @Test + void aCloneOfASpriteWithAnimationsIsAClone() { + Sprite sprite = new Sprite(); + Sprite clone = sprite.createClone(); + assertTrue(clone.isClone()); + assertNotSame(sprite, clone); + } + + // ---- from AnimatedSpriteTest ---- + + @Test + void constructingASpriteWithoutAWindowHasNoAnimationPlayed() { + Sprite sprite = new Sprite(); + + assertEquals(0, sprite.getAnimationFrame()); + assertFalse(sprite.isAnimationPlayed()); + } + + @Test + void animationIntervalDefaultsAndCanBeChanged() { + Sprite sprite = new Sprite(); + + assertEquals(0.12, sprite.getAnimationInterval(), 1e-9); + + sprite.setAnimationInterval(0.2); + assertEquals(0.2, sprite.getAnimationInterval(), 1e-9); + } + + @Test + void setAnimationFrameUpdatesTheCurrentFrame() { + Sprite sprite = new Sprite(); + sprite.setAnimationFrame(3); + + assertEquals(3, sprite.getAnimationFrame()); + } + + @Test + void resetAnimationRestartsFromTheFirstFrame() { + Sprite sprite = new Sprite(); + sprite.setAnimationFrame(5); + + sprite.resetAnimation(); + + assertEquals(0, sprite.getAnimationFrame()); + assertFalse(sprite.isAnimationPlayed()); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/DebugOverlayTest.java b/core/src/test/java/org/openpatch/scratch/DebugOverlayTest.java new file mode 100644 index 00000000..26ce217e --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/DebugOverlayTest.java @@ -0,0 +1,223 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; +import java.util.Set; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.DebugOption; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.draw.DrawList; +import org.openpatch.scratch.internal.draw.Item; +import org.openpatch.scratch.internal.draw.ShapeDraw; +import org.openpatch.scratch.internal.draw.TextDraw; +import org.openpatch.scratch.internal.input.InputEvent; +import org.openpatch.scratch.internal.text.Font; + +/** The debug overlay without a window: its options, the panel that switches them, its clicks. */ +class DebugOverlayTest { + + static final String RED = "costumes/red10.png"; + static final int HITBOX_COLOR = 0xffff0000; + static final int HIDDEN_COLOR = 0xff00c8ff; + + Game game; + Stage stage; + final List log = new ArrayList<>(); + + @BeforeEach + void setUp() { + this.game = Game.headless(480, 360); + this.stage = new Stage() { + @Override + public void whenMouseClicked(MouseCode button) { + DebugOverlayTest.this.log.add("clicked " + button); + } + }; + this.game.setStage(this.stage); + } + + @Test + void theOptionsComeFromTheProperty() { + assertTrue(DebugOption.parse(null).containsAll(EnumSet.of(DebugOption.HITBOXES, DebugOption.LABELS, + DebugOption.MOUSE, DebugOption.FPS))); + assertTrue(DebugOption.parse("").isEmpty()); + assertEquals(EnumSet.allOf(DebugOption.class), DebugOption.parse("all")); + assertEquals(EnumSet.of(DebugOption.HITBOXES, DebugOption.CLONES), DebugOption.parse(" hitboxes ,clones ")); + } + + @Test + void debugModeShowsTheFamiliarOverlay() { + this.stage.add(new Sprite("red", RED)); + this.game.setDebug(true); + this.game.runTicks(1); + DrawList list = this.game.drawList(); + assertTrue(list.debug()); // the frame rate + assertTrue(this.strokes(list).contains(HITBOX_COLOR)); + assertTrue(this.texts(list).contains("Direction:")); + assertTrue(this.texts(list).contains("Sprite (0.0, 0.0)")); + assertFalse(list.overlayItems().isEmpty()); // the panel's chip + } + + @Test + void switchedOffOptionsAreNotShown() { + this.stage.add(new Sprite("red", RED)); + this.game.setDebug(true); + this.game.getDebugOptions().clear(); + this.game.runTicks(1); + DrawList list = this.game.drawList(); + assertFalse(list.debug()); + assertFalse(this.strokes(list).contains(HITBOX_COLOR)); + assertFalse(this.strokes(list).contains(HIDDEN_COLOR)); + assertFalse(this.texts(list).contains("Direction:")); + assertFalse(this.texts(list).contains("Camera:")); + } + + @Test + void touchingPairsGetALineBetweenTheirCentres() { + Sprite a = new Sprite("red", RED), b = new Sprite("red", RED); + b.setX(5); + this.stage.add(a); + this.stage.add(b); + this.game.setDebug(true); + this.game.getDebugOptions().clear(); + this.game.getDebugOptions().add(DebugOption.TOUCHING); + this.game.runTicks(1); + assertTrue(a.isTouchingSprite(b)); + DrawList list = this.game.drawList(); + assertTrue(this.shapes(list).stream().anyMatch(s -> s.points().length == 4 && s.points()[0] == a.getX() + && s.points()[1] == a.getY() && s.points()[2] == b.getX() && s.points()[3] == b.getY())); + } + + @Test + void hiddenSpritesGetAnOutline() { + Sprite hidden = new Sprite("red", RED); + hidden.hide(); + this.stage.add(hidden); + this.game.setDebug(true); + this.game.getDebugOptions().clear(); + this.game.getDebugOptions().add(DebugOption.INVISIBLE); + this.game.runTicks(1); + assertTrue(this.strokes(this.game.drawList()).contains(HIDDEN_COLOR)); + } + + @Test + void theCloneCountIsShown() { + Sprite s = new Sprite("red", RED); + this.stage.add(s); + s.createClone(); + this.game.setDebug(true); + this.game.getDebugOptions().clear(); + this.game.getDebugOptions().add(DebugOption.CLONES); + this.game.runTicks(1); + assertTrue(this.texts(this.game.drawList()).contains("Clones: 1")); + } + + @Test + void thePanelTogglesOptionsAndSwallowsItsClicks() { + this.stage.add(new Sprite("red", RED)); + this.game.setDebug(true); + this.game.runTicks(1); + // the chip opens the panel; that click never reaches the learner + TextDraw chip = (TextDraw) this.game.drawList().overlayItems().get(0); + this.press(chip.x() + chip.width() / 2, chip.y() - chip.height() / 2); + assertTrue(this.log.isEmpty()); + DrawList open = this.game.drawList(); + assertTrue(open.overlayItems().size() > 10); // the open panel: box, title, seven rows + // the first checkbox belongs to the hitboxes, which are on + ShapeDraw box = (ShapeDraw) open.overlayItems().stream() + .filter(i -> i instanceof ShapeDraw s && s.fill() == 0x66ff4444).findFirst().orElseThrow(); + this.press((box.points()[0] + box.points()[2]) / 2, (box.points()[1] + box.points()[5]) / 2); + assertFalse(this.game.getDebugOptions().contains(DebugOption.HITBOXES)); + assertTrue(this.log.isEmpty()); + // ticking it again switches them back on + this.press((box.points()[0] + box.points()[2]) / 2, (box.points()[1] + box.points()[5]) / 2); + assertTrue(this.game.getDebugOptions().contains(DebugOption.HITBOXES)); + // a click next to the panel reaches the learner + this.press(0, 0); + assertEquals(List.of("clicked LEFT"), this.log); + } + + @Test + void clickingALabelSwitchesItsOwnOption() { + this.game.setDebug(true); + this.game.runTicks(1); + TextDraw chip = (TextDraw) this.game.drawList().overlayItems().get(0); + this.press(chip.x() + chip.width() / 2, chip.y() - chip.height() / 2); + DrawList open = this.game.drawList(); + // the eye clicks the middle of the letters, which hang down from the box's top edge + Font font = Font.defaultFont(); + double inkHeight = font.ascent(12) + font.descent(12); + TextDraw label = this.label(open, "Mouse & camera"); + Set before = EnumSet.copyOf(this.game.getDebugOptions()); + this.press(label.x() + label.width() / 2, label.y() - inkHeight / 2); + Set after = this.game.getDebugOptions(); + Set expected = EnumSet.copyOf(before); + expected.remove(DebugOption.MOUSE); + assertEquals(expected, after); + } + + private TextDraw label(DrawList list, String text) { + for (Item item : list.overlayItems()) { + if (item instanceof TextDraw t && this.text(t).strip().equals(text)) { + return t; + } + } + throw new AssertionError("no label '" + text + "' in the panel"); + } + + private void press(double x, double y) { + this.game.post(new InputEvent.Button(MouseCode.LEFT, true, x, y)); + this.game.runTicks(1); + } + + private List shapes(DrawList list) { + List out = new ArrayList<>(); + for (Item item : list.overlayItems()) { + if (item instanceof ShapeDraw s) { + out.add(s); + } + } + for (var layer : list.layers()) { + for (Item item : layer.items()) { + if (item instanceof ShapeDraw s) { + out.add(s); + } + } + } + return out; + } + + private List strokes(DrawList list) { + return this.shapes(list).stream().map(ShapeDraw::stroke).toList(); + } + + private String texts(DrawList list) { + StringBuilder out = new StringBuilder(); + for (TextDraw t : list.overlay()) { + out.append(this.text(t)); + } + for (TextDraw t : list.ui()) { + out.append(this.text(t)); + } + for (Item item : list.overlayItems()) { + if (item instanceof TextDraw t) { + out.append(this.text(t)); + } + } + return out.toString(); + } + + private String text(TextDraw t) { + StringBuilder out = new StringBuilder(); + for (var line : t.layout().lines()) { + out.append(line.text()).append('\n'); + } + return out.toString(); + } +} diff --git a/src/test/java/org/openpatch/scratch/HitboxMirrorTest.java b/core/src/test/java/org/openpatch/scratch/HitboxMirrorTest.java similarity index 84% rename from src/test/java/org/openpatch/scratch/HitboxMirrorTest.java rename to core/src/test/java/org/openpatch/scratch/HitboxMirrorTest.java index 37edc878..2d02e5bd 100644 --- a/src/test/java/org/openpatch/scratch/HitboxMirrorTest.java +++ b/core/src/test/java/org/openpatch/scratch/HitboxMirrorTest.java @@ -6,10 +6,8 @@ import java.util.List; import org.junit.jupiter.api.Test; -import org.openpatch.scratch.internal.Image; - -import processing.core.PConstants; -import processing.core.PImage; +import org.openpatch.scratch.internal.Costume; +import org.openpatch.scratch.internal.image.Image; /** * A sprite with rotation style LEFT_RIGHT is drawn mirrored when it faces left, @@ -25,20 +23,19 @@ class HitboxMirrorTest { * painted, standing at the origin. */ private static Sprite spritePaintedOnTheLeft() throws Exception { - PImage picture = new PImage(10, 4, PConstants.ARGB); - picture.loadPixels(); + int[] pixels = new int[40]; for (int y = 0; y < 4; y++) { - picture.pixels[y * 10] = 0xff000000; - picture.pixels[y * 10 + 1] = 0xff000000; + pixels[y * 10] = 0xff000000; + pixels[y * 10 + 1] = 0xff000000; } - picture.updatePixels(); + Image picture = new Image(10, 4, pixels); Sprite sprite = new Sprite(); Field costumes = Sprite.class.getDeclaredField("costumes"); costumes.setAccessible(true); @SuppressWarnings("unchecked") - List list = (List) costumes.get(sprite); - list.add(new Image("left", picture)); + List list = (List) costumes.get(sprite); + list.add(new Costume("left", picture)); sprite.setRotationStyle(RotationStyle.LEFT_RIGHT); return sprite; } @@ -75,7 +72,7 @@ void turningLeftAfterTheHitboxWasAskedForMirrorsIt() throws Exception { void aHitboxOfYourOwnIsMirroredAsWell() throws Exception { Sprite sprite = spritePaintedOnTheLeft(); // just the painted columns, in the costume's own pixels - sprite.setHitbox(0, 0, 2, 0, 2, 4, 0, 4); + sprite.setHitbox(new Polygon(new double[] {0, 2, 2, 0}, new double[] {0, 0, 4, 4})); sprite.setDirection(-90); Bounds bounds = sprite.getHitbox().getBounds(); @@ -94,6 +91,8 @@ void turningAllAroundIsLeftToTheRotation() throws Exception { } // ---- rotation center ---- + // Hitboxes are in Scratch's coordinates, y up (6.x had Processing's, y down): a costume + // hanging down from its rotation center lies below the sprite's y. @Test void theRotationCenterIsThePointAtTheSpritesPosition() throws Exception { @@ -102,7 +101,7 @@ void theRotationCenterIsThePointAtTheSpritesPosition() throws Exception { Bounds bounds = sprite.getHitbox().getBounds(); assertEquals(0, bounds.x(), DELTA); - assertEquals(0, bounds.y(), DELTA); + assertEquals(-4, bounds.y(), DELTA); assertEquals(2, bounds.width(), DELTA); } @@ -114,7 +113,7 @@ void theRotationCenterGrowsWithTheSprite() throws Exception { Bounds bounds = sprite.getHitbox().getBounds(); assertEquals(-20, bounds.x(), DELTA); - assertEquals(-8, bounds.y(), DELTA); + assertEquals(0, bounds.y(), DELTA); assertEquals(4, bounds.width(), DELTA); } @@ -132,12 +131,12 @@ void aSpriteFacingLeftIsMirroredAboutItsRotationCenter() throws Exception { @Test void aHitboxOfYourOwnFollowsTheRotationCenter() throws Exception { Sprite sprite = spritePaintedOnTheLeft(); - sprite.setHitbox(0, 0, 2, 0, 2, 4, 0, 4); + sprite.setHitbox(new Polygon(new double[] {0, 2, 2, 0}, new double[] {0, 0, 4, 4})); sprite.setRotationCenter(0, 0); Bounds bounds = sprite.getHitbox().getBounds(); assertEquals(0, bounds.x(), DELTA); - assertEquals(0, bounds.y(), DELTA); + assertEquals(-4, bounds.y(), DELTA); } @Test @@ -150,7 +149,7 @@ void aSpriteTurnsAboutItsRotationCenter() throws Exception { // the 2 x 4 painted columns hang down from the corner, now lying to its left Bounds bounds = sprite.getHitbox().getBounds(); assertEquals(-4, bounds.x(), DELTA); - assertEquals(0, bounds.y(), DELTA); + assertEquals(-2, bounds.y(), DELTA); assertEquals(4, bounds.width(), DELTA); assertEquals(2, bounds.height(), DELTA); } diff --git a/core/src/test/java/org/openpatch/scratch/LifecycleParityTest.java b/core/src/test/java/org/openpatch/scratch/LifecycleParityTest.java new file mode 100644 index 00000000..ebb68809 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/LifecycleParityTest.java @@ -0,0 +1,175 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.Game; + +/** + * Clone lifecycle, removal, broadcasts and monitors (6.x {@code compatibility/probes/LifecycleProbe}, + * now headless). The online IDE runs the same probe; the keys and expected values are 6.x's + * {@code lifecycle-expected.txt}. Its last checks went through copy constructors 6.x used for + * cloning (Pen, Text, Shaders) and a Sorting class; 7.0 has none of them, so those keys check what + * they guarded through the public API instead: a clone's own pen and shaders, equal colours with + * equal hashes, sorting off by default. + */ +class LifecycleParityTest { + + static final List EXPECTED = List.of( + "clone.constructor=1", "clone.score=8", "original.score=7", "clone.starts=1", "clone.shared=2", + "clone.timer=true", "clone.pen=true", "clone.x=true", "clone.width=true", "broadcast.original=1", + "broadcast.clone=1", "removed.messages=1", "removed.hook=1", "original.messages=2", "readded.messages=2", + "removed.again=2", "pen.color=true", "text.copy=true", "shaders.copy=true", "color.hash=true", "sorting=true", + "ready"); + + Game game; + final List lines = new ArrayList<>(); + + @BeforeEach + void setUp() { + this.game = Game.headless(600, 240); + ProbeSprite.constructions = 0; + } + + @AfterEach + void tearDown() { + this.game.setStage(null); + } + + void p(String key, Object value) { + this.lines.add(key + "=" + value); + } + + static class ProbeSprite extends Sprite { + static int constructions; + int score = 7; + int[] shared = {1}; + int starts; + int messages; + int removals; + + ProbeSprite() { + constructions++; + this.addCostume("slimeGreen"); + this.setPosition(30, -20); + this.getPen().setSize(5); + } + + @Override + public void whenStartsAsClone() { + if (!this.isClone() || this.getStage() == null) { + throw new RuntimeException("clone hook ordering"); + } + this.starts++; + this.score++; + } + + @Override + public void whenIReceive(String message) { + this.messages++; + } + + @Override + public void whenRemovedFromStage() { + if (this.getStage() != null) { + throw new RuntimeException("removal hook ordering"); + } + this.removals++; + } + + @Override + public void run() { + this.changeX(1); + } + } + + @Test + void clonesRemovalBroadcastsAndMonitorsBehaveAsRecorded() { + int[] frames = {0}; + Stage stage = new Stage() { + @Override + public void run() { + frames[0]++; + } + }; + this.game.setStage(stage); + + ProbeSprite original = new ProbeSprite(); + stage.add(original); + ProbeSprite copy = original.createClone(); + copy.getPen().setSize(9); + copy.shared[0] = 2; + p("clone.constructor", ProbeSprite.constructions); // a clone is copied, not constructed + p("clone.score", copy.score); + p("original.score", original.score); + p("clone.starts", copy.starts); + p("clone.shared", original.shared[0]); // fields are copied shallowly, as in Scratch's clones + p("clone.timer", copy.getTimer() != original.getTimer()); + p("clone.pen", original.getPen().getSize() == 5); + p("clone.x", copy.getX() == 30); + p("clone.width", copy.getWidth() == original.getWidth()); + + stage.broadcast("first"); + p("broadcast.original", original.messages); + p("broadcast.clone", copy.messages); + copy.deleteThisClone(); + copy.deleteThisClone(); // twice: nothing more happens + original.deleteThisClone(); // not a clone: stays + stage.broadcast("second"); + p("removed.messages", copy.messages); + p("removed.hook", copy.removals); + p("original.messages", original.messages); + stage.add(copy); + stage.broadcast("third"); + p("readded.messages", copy.messages); + stage.remove(copy); + p("removed.again", copy.removals); + + // 6.x: new Pen(pen) copied a pen; 7.0: a clone's pen is its own + original.getPen().setColor(255, 0, 0); + ProbeSprite second = original.createClone(); + second.getPen().changeColor(30); + p("pen.color", original.getPen().getColor().getRed() == 255); + // 6.x: new Text(text) copied a text; 7.0: a clone's bubble is its own + original.say("hello"); + ProbeSprite third = original.createClone(); + third.say("bye"); + p("text.copy", original.getText().getText().equals("hello")); + // 6.x: new Shaders(shaders) copied; 7.0: a clone's shaders are its own list + p("shaders.copy", second.getShaders() != original.getShaders() + && second.getShaders().getCurrentIndex() == original.getShaders().getCurrentIndex()); + // 6.x checked the exact hash; what learners rely on is that equal colours hash equally + p("color.hash", new Color(255, 128, 0).hashCode() == new Color(255, 128, 0).hashCode()); + // no sorting unless asked for: the order is the order of adding, and a clone goes just behind + // its original (as in Scratch) + p("sorting", stage.getAll().equals(List.of(second, third, original))); + + // monitors, a failing one included, must not stop the game + stage.showVariable("frames", () -> frames[0]); + stage.showVariable("decimal", () -> 1.234); + stage.showVariable("array", () -> original.shared); + stage.showVariable("broken", () -> { + throw new RuntimeException("supplier failure"); + }); + original.showVariable("score", () -> original.score); + stage.showVariable("timer", () -> original.getTimer().after(0.1)); + stage.showVariable("unused", () -> 99); + stage.hideVariable("unused"); + original.say("timed", 0.1); + original.glide(0.1, 90, -20); + this.game.runTicks(30); + this.game.drawList(); + assertNull(this.game.getStopped(), "a failing monitor stopped the game"); + assertEquals(-20, original.getY(), 1e-9, "the glide arrived (x moves on: run() adds 1 a tick)"); + assertTrue(this.game.drawList().overlay().stream().noneMatch(t -> t.layout().lines().stream() + .anyMatch(l -> l.text().contains("timed"))), "a bubble said for 0.1 s is gone after 0.5 s"); + this.lines.add("ready"); + assertEquals(String.join("\n", EXPECTED), String.join("\n", this.lines)); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/MapHitboxTest.java b/core/src/test/java/org/openpatch/scratch/MapHitboxTest.java new file mode 100644 index 00000000..7eaaaeaa --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/MapHitboxTest.java @@ -0,0 +1,105 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.Game; + +/** + * A hitbox without a costume, as a map makes one: the sprite sits where its object is, and the + * object's area is its hitbox (the tiled demo's walls, water and warps work this way). + */ +class MapHitboxTest { + + Game game; + Stage stage; + + @BeforeEach + void setUp() { + this.game = Game.headless(640, 360); + this.stage = new Stage(); + this.game.setStage(this.stage); + } + + static class Wall extends Sprite { + Wall(double x, double y, double width, double height) { + this.setX(x); + this.setY(y); + this.setHitbox(new Rectangle(0, 0, width, height)); + } + } + + @Test + void hitboxWithoutCostumeCoversTheObjectArea() { + // a Tiled rectangle at (2, -4) with size 56 x 280: the object's y is the top edge, + // so the stage position is (2, 4) and the area runs 280 units down from there + var wall = new Wall(2, 4, 56, 280); + this.stage.add(wall); + + Bounds bounds = wall.getHitbox().getBounds(); + + assertEquals(2, bounds.x(), 1e-9); + assertEquals(4 - 280, bounds.y(), 1e-9); + assertEquals(56, bounds.width(), 1e-9); + assertEquals(280, bounds.height(), 1e-9); + } + + @Test + void nothingWithoutCostumeAndHitbox() { + var bare = new Sprite(); + this.stage.add(bare); + + assertNull(bare.getHitbox()); + assertNull(bare.touchHitbox()); + } + + @Test + void spriteTouchesACostumelessWall() { + var wall = new Wall(2, 4, 56, 280); + this.stage.add(wall); + + var player = new Sprite("player", "costumes/red10.png"); + player.setPosition(20, -100); // inside the wall's area + this.stage.add(player); + + assertTrue(player.isTouchingSprite(wall)); + assertTrue(player.isTouchingSprite(Wall.class)); + assertEquals(wall, player.getTouchingSprite(Wall.class)); + } + + @Test + void spriteDoesNotTouchACostumelessWallItLeft() { + var wall = new Wall(2, 4, 56, 280); + this.stage.add(wall); + + var player = new Sprite("player", "costumes/red10.png"); + player.setPosition(200, 100); // outside the wall's area + this.stage.add(player); + + assertFalse(player.isTouchingSprite(wall)); + assertFalse(player.isTouchingSprite(Wall.class)); + assertNull(player.getTouchingSprite(Wall.class)); + } + + @Test + void framelessHitboxMovesWithTheSprite() { + var wall = new Wall(2, 4, 56, 280); + this.stage.add(wall); + + var player = new Sprite("player", "costumes/red10.png"); + player.setPosition(20, -100); + this.stage.add(player); + assertTrue(player.isTouchingSprite(wall)); + + wall.setPosition(400, 300); + + assertFalse(player.isTouchingSprite(wall)); + assertEquals(400, wall.getHitbox().getBounds().x(), 1e-9); + assertEquals(300 - 280, wall.getHitbox().getBounds().y(), 1e-9); + } +} diff --git a/src/test/java/org/openpatch/scratch/OperatorsTest.java b/core/src/test/java/org/openpatch/scratch/OperatorsTest.java similarity index 100% rename from src/test/java/org/openpatch/scratch/OperatorsTest.java rename to core/src/test/java/org/openpatch/scratch/OperatorsTest.java diff --git a/src/examples/java/parity/ParityProbe.java b/core/src/test/java/org/openpatch/scratch/ParityTest.java similarity index 61% rename from src/examples/java/parity/ParityProbe.java rename to core/src/test/java/org/openpatch/scratch/ParityTest.java index 03770b6d..b20f38fc 100644 --- a/src/examples/java/parity/ParityProbe.java +++ b/core/src/test/java/org/openpatch/scratch/ParityTest.java @@ -1,46 +1,74 @@ -package parity; +package org.openpatch.scratch; -import org.openpatch.scratch.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.Game; /** - * Every value that has to read the same on the desktop and in the browser. - * - *

- * The two implementations of this library have drifted apart more than once, and - * always in a way no signature could catch: a transparency that counted the - * other way round, a getWidth() that measured the rotated bounding box instead - * of the costume, a hitbox reported in screen pixels rather than around the - * middle of the stage. Every one of those was found by hand, by running the same - * program twice and reading the two outputs side by side. This is that program, - * written down. + * Every value that has to read the same on the desktop and in the browser (6.x + * {@code parity/ParityProbe}, now headless). * - *

- * Nothing here may depend on timing, randomness or the frame rate - the browser - * runs it in a different loop and would disagree for reasons that are not drift. + *

The two implementations have drifted apart more than once, always in a way no signature could + * catch: a transparency counting the other way round, a getWidth() measuring the rotated bounding + * box, a hitbox in screen pixels. The values are recorded in + * {@code src/test/resources/parity/expected.txt}; the online IDE runs the same probe against the + * same file. Nothing here may depend on timing or randomness. * - *

- * The expected output lives in {@code src/test/resources/parity/expected.txt}. - * {@code ./scripts/parity.sh} checks the desktop against it, and - * {@code scripts/parity-fixture.py} generates the copy the online IDE runs as - * {@code ScratchParityTest.java} in its own test suite. + *

Re-record after a deliberate change: {@code mvn test -pl core -Dtest=ParityTest + * -Dparity.record=true}, then read the diff of the file. */ -public class ParityProbe { +class ParityTest { + + static final Path EXPECTED = Path.of("src/test/resources/parity/expected.txt"); + + Game game; + final List lines = new ArrayList<>(); + + @BeforeEach + void setUp() { + this.game = Game.headless(600, 240); + } - static void p(String key, Object value) { - System.out.println(key + "=" + value); + @AfterEach + void tearDown() { + this.game.setStage(null); } - public static void main(String[] args) { - Window myWindow = new Window(600, 240); + void p(String key, Object value) { + this.lines.add(key + "=" + value); + } + + @Test + void valuesAreTheRecordedOnes() throws IOException { + this.probe(); + if (Boolean.getBoolean("parity.record")) { + Files.createDirectories(EXPECTED.getParent()); + Files.write(EXPECTED, this.lines, StandardCharsets.UTF_8); + } + assertEquals(String.join("\n", Files.readAllLines(EXPECTED, StandardCharsets.UTF_8)), + String.join("\n", this.lines), + "a parity value changed; if on purpose, re-record with -Dparity.record=true and read the diff"); + } + + void probe() { Stage myStage = new Stage(); - myWindow.setStage(myStage); + this.game.setStage(myStage); Sprite s = new Sprite("zeta", "slimeGreen"); myStage.add(s); p("stage.width", myStage.getWidth()); p("stage.height", myStage.getHeight()); - // A new sprite: the defaults everything else is measured against. + // a new sprite: the defaults everything else is measured against p("sprite.x", s.getX()); p("sprite.y", s.getY()); p("sprite.direction", s.getDirection()); @@ -49,7 +77,7 @@ public static void main(String[] args) { p("sprite.width", s.getWidth()); p("sprite.height", s.getHeight()); - // The costume's own pixels, scaled - never the rotated bounding box. + // the costume's own pixels, scaled - never the rotated bounding box s.setSize(50); p("half.width", s.getWidth()); p("half.height", s.getHeight()); @@ -60,7 +88,7 @@ public static void main(String[] args) { p("turned.height", s.getHeight()); s.setDirection(90); - // Transparency is the Scratch ghost effect: 0 solid, 100 invisible. + // transparency is Scratch's ghost effect: 0 solid, 100 invisible s.setTransparency(30); p("ghost30", s.getTransparency()); s.changeTransparency(50); @@ -71,7 +99,7 @@ public static void main(String[] args) { p("ghost.clamped.low", s.getTransparency()); s.setTransparency(0); - // Movement and turning. + // movement and turning s.setPosition(10, 20); p("moved.x", s.getX()); p("moved.y", s.getY()); @@ -95,8 +123,7 @@ public static void main(String[] args) { p("move10.y", s.getY()); s.setPosition(0, 0); - // The hitbox is around the middle of the stage, y pointing down, and hugs - // the painted pixels rather than the whole costume canvas. + // the hitbox hugs the painted pixels rather than the whole costume canvas Bounds b = s.getHitbox().getBounds(); p("hitbox", b); p("hitbox.x", b.x()); @@ -104,7 +131,7 @@ public static void main(String[] args) { p("hitbox.width", b.width()); p("hitbox.height", b.height()); - // Costumes. + // costumes p("costume.index", s.getCurrentCostumeIndex()); p("costume.name", s.getCurrentCostumeName()); s.addCostume("second", "slimeBlue"); @@ -125,37 +152,18 @@ public static void main(String[] args) { p("text.size", t.getTextSize()); p("text.width", t.getWidth()); p("text.align", t.getAlign()); - // a text built this way once had no style at all, and drawing one threw a - // NullPointerException on every frame from inside the loading screen p("text.style", t.getStyle()); p("text.defaultSize", Text.getDefaultFontSize()); p("count", myStage.count(Sprite.class)); p("find", myStage.find(Sprite.class).size()); - valuesWithoutAStage(); - - myStage.wait(100); - Window.getInstance().exit(); + this.valuesWithoutAStage(); } - /** - * The part of the probe that needs no window. - * - *

- * The browser's test suite runs in node, where there is no WebGL, so a Stage - * cannot be built there at all - only what is below this line can be checked - * automatically on both sides. Everything above it is held to the recorded - * values on the desktop by {@code scripts/parity.sh}, and to the same - * signatures in the browser by {@code ScratchTest.java}; the values themselves - * still have to be read by eye there. - * - *

- * Anything that can live down here should, because down here it is checked by - * a machine. - */ - static void valuesWithoutAStage() { - // Operators are the Scratch blocks, not Java's arithmetic. + /** What the browser's node tests can check too: no stage needed. */ + void valuesWithoutAStage() { + // operators are the Scratch blocks, not Java's arithmetic p("round", Operators.round(2.5)); p("roundTo2", Operators.round(2.345, 2)); p("mod", Operators.mod(-7, 3)); @@ -189,7 +197,8 @@ static void valuesWithoutAStage() { p("color.green", c.getGreen()); p("color.blue", c.getBlue()); p("color.equals", c.equals(new Color(255, 128, 0))); - Color hue = new Color(128); + // 6.x new Color(128) was hue 128 of 255; 7.0 counts hue 0-100 as Scratch does + Color hue = Color.fromHSB(128 / 2.55, 100, 100); p("hue.red", hue.getRed()); p("hue.green", hue.getGreen()); p("hue.blue", hue.getBlue()); diff --git a/core/src/test/java/org/openpatch/scratch/SceneTest.java b/core/src/test/java/org/openpatch/scratch/SceneTest.java new file mode 100644 index 00000000..0f1214f2 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/SceneTest.java @@ -0,0 +1,482 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.draw.DrawList; +import org.openpatch.scratch.internal.draw.SpriteDraw; +import org.openpatch.scratch.internal.input.InputEvent; + +/** The scene without a window: ticks, clones, layers, touching, pens, input, learner errors. */ +class SceneTest { + + static final String RED = "costumes/red10.png"; + static final String LEFT4 = "costumes/left4.png"; + + Game game; + Stage stage; + final List log = new ArrayList<>(); + + @BeforeEach + void setUp() { + this.game = Game.headless(480, 360); + this.stage = new Stage() { + @Override + public void run() { + SceneTest.this.log.add("stage"); + } + }; + this.game.setStage(this.stage); + } + + class Logged extends Sprite { + final String name; + + Logged(String name) { + super("red", RED); + this.name = name; + } + + @Override + public void run() { + SceneTest.this.log.add(this.name); + } + } + + @Test + void theStageRunsFirstThenTheSpritesBackToFront() { + Logged main = new Logged("main"), back = new Logged("back"), ui = new Logged("ui"); + this.stage.add(main); + this.stage.add(ui); + this.stage.add(back); + ui.setLayer(Layer.UI); + back.setLayer(Layer.BACKGROUND); + this.game.runTicks(1); + assertEquals(List.of("stage", "back", "main", "ui"), this.log); + } + + @Test + void aSpriteRemovedDuringATickDoesNotRunAnyMore() { + Logged second = new Logged("second"); + Sprite first = new Sprite() { + @Override + public void run() { + second.remove(); + } + }; + this.stage.add(first); + this.stage.add(second); + this.game.runTicks(1); + assertEquals(List.of("stage"), this.log); + } + + static class Bullet extends Sprite { + int speed = 3; + int constructed; + boolean startedAsClone; + + Bullet() { + super("red", RED); + this.constructed++; + } + + @Override + public void whenStartsAsClone() { + this.startedAsClone = true; + } + } + + @Test + void aCloneCopiesTheVariablesWithoutRunningTheConstructor() { + Bullet original = new Bullet(); + original.speed = 7; + original.setPosition(30, 40); + this.stage.add(original); + Bullet clone = original.createClone(); + assertEquals(7, clone.speed); + assertEquals(1, clone.constructed); + assertTrue(clone.startedAsClone); + assertTrue(clone.isClone()); + assertFalse(original.isClone()); + assertEquals(30, clone.getX()); + assertSame(this.stage, clone.getStage()); + // behind the original, as in Scratch + assertEquals(List.of(clone, original), this.stage.getAll()); + clone.deleteThisClone(); + original.deleteThisClone(); + assertEquals(List.of(original), this.stage.getAll()); + } + + @Test + void goToFrontLayerMeansTheFrontOfTheSpritesOwnLayer() { + Sprite a = new Sprite("red", RED), b = new Sprite("red", RED), c = new Sprite("red", RED); + this.stage.add(a); + this.stage.add(b); + this.stage.add(c); + c.setLayer(Layer.FOREGROUND); + a.goToFrontLayer(); + assertEquals(List.of(b, a, c), this.stage.getAll()); + a.goLayersBackwards(1); + assertEquals(List.of(a, b, c), this.stage.getAll()); + } + + @Test + void theHitboxFollowsEveryChangeOfTheSprite() { + Sprite a = new Sprite("red", RED), b = new Sprite("red", RED); + b.addCostume("wide", "costumes/left4.png"); // 20 x 10 + this.stage.add(a); + this.stage.add(b); + b.setX(12); // 2 pixels apart + assertFalse(a.isTouchingSprite(b)); + assertSame(b.getHitbox(), b.getHitbox(), "unchanged: the same hitbox"); + b.switchCostume("wide"); + assertTrue(a.isTouchingSprite(b), "a wider costume"); + b.switchCostume("red"); + assertFalse(a.isTouchingSprite(b)); + b.setSize(200); + assertTrue(a.isTouchingSprite(b), "grown"); + b.setSize(100); + b.setDirection(45); + assertTrue(a.isTouchingSprite(b), "turned: the corner reaches over"); + b.setDirection(90); + assertFalse(a.isTouchingSprite(b)); + b.setHitbox(new Polygon(new double[] {-5, 10, 10, -5}, new double[] {0, 0, 10, 10})); + assertTrue(a.isTouchingSprite(b), "a hitbox of its own"); + b.setHitbox(null); + b.changeX(-2.5); + assertTrue(a.isTouchingSprite(b), "moved"); + } + + @Test + void touchingEdgesIsNotTouching() { + Sprite a = new Sprite("red", RED), b = new Sprite("red", RED); + this.stage.add(a); + this.stage.add(b); + b.setX(10); + assertFalse(a.isTouchingSprite(b)); + b.setX(9); + assertTrue(a.isTouchingSprite(b)); + b.hide(); + assertFalse(a.isTouchingSprite(b)); + b.show(); + b.setLayer(Layer.UI); + assertFalse(a.isTouchingSprite(b), "the UI never touches the world"); + } + + @Test + void theHitboxWrapsThePaintedPixels() { + Sprite s = new Sprite("left", LEFT4); + this.stage.add(s); + Bounds b = s.getHitbox().getBounds(); + // 20 wide, centred on 0: painted columns 0..3 are x = -10..-6 + assertEquals(-10, b.x(), 1e-9); + assertEquals(4, b.width(), 1e-9); + assertEquals(-5, b.y(), 1e-9); + assertEquals(10, b.height(), 1e-9); + } + + @Test + void facingLeftWithTheLeftRightStyleMirrorsTheHitbox() { + Sprite s = new Sprite("left", LEFT4); + this.stage.add(s); + s.setRotationStyle(RotationStyle.LEFT_RIGHT); + s.setDirection(270); + Bounds b = s.getHitbox().getBounds(); + assertEquals(6, b.x(), 1e-9); + assertEquals(4, b.width(), 1e-9); + } + + @Test + void turningAllAroundTurnsTheHitboxClockwise() { + Sprite s = new Sprite("left", LEFT4); + this.stage.add(s); + s.setDirection(180); // a quarter turn clockwise from 90: the left columns end up on top + Bounds b = s.getHitbox().getBounds(); + assertEquals(-5, b.x(), 1e-9); + assertEquals(10, b.width(), 1e-9); + assertEquals(6, b.y(), 1e-9); + assertEquals(4, b.height(), 1e-9); + } + + @Test + void aSpritesSizeScalesItsHitbox() { + Sprite s = new Sprite("red", RED); + this.stage.add(s); + s.setSize(200); + assertEquals(20, s.getHitbox().getBounds().width(), 1e-9); + assertEquals(20, s.getWidth(), 1e-9); + } + + @Test + void moveFollowsScratchsDirections() { + Sprite s = new Sprite(); + this.stage.add(s); + s.move(10); + assertEquals(10, s.getX(), 1e-9); + s.setDirection(0); + s.move(10); + assertEquals(10, s.getY(), 1e-9); + s.pointTowards(new Vector2(10, -100)); + assertEquals(180, s.getDirection(), 1e-9); + } + + @Test + void aGlideOfOneSecondTakesSixtyTicks() { + Sprite s = new Sprite(); + this.stage.add(s); + s.glide(1, 60, 0); + this.game.runTicks(30); + assertEquals(30, s.getX(), 1e-9); + assertTrue(s.isGliding()); + this.game.runTicks(30); + assertEquals(60, s.getX(), 1e-9); + assertFalse(s.isGliding()); + } + + @Test + void penAndStampsChangeTheCanvasAtOnceInProgramOrder() { + Sprite s = new Sprite("red", RED); + this.stage.add(s); + s.stamp(); + assertEquals(0xffff0000, this.stage.canvas(Layer.BACKGROUND).at(0.5, 0.5)); + this.stage.eraseAll(); + assertEquals(0, this.stage.canvas(Layer.BACKGROUND).at(0.5, 0.5)); + s.setX(100); + s.stamp(); + // an erase removes exactly what came before it + assertEquals(0xffff0000, this.stage.canvas(Layer.BACKGROUND).at(100.5, 0.5)); + s.getPen().setColor(new Color(0, 255, 0)); + s.getPen().setSize(3); + s.getPen().down(); + s.setX(150); + assertEquals(0xff00ff00, this.stage.canvas(Layer.BACKGROUND).at(130, 0)); + } + + @Test + void aKeyPressReachesTheStageAndEverySpriteOnce() { + List seen = new ArrayList<>(); + Sprite s = new Sprite() { + @Override + public void whenKeyPressed(KeyCode key) { + seen.add(key); + } + }; + this.stage.add(s); + this.game.post(new InputEvent.Key(KeyCode.SPACE, true)); + this.game.runTicks(3); + assertEquals(List.of(KeyCode.SPACE), seen); + assertTrue(s.isKeyPressed(KeyCode.SPACE)); + } + + @Test + void aNewStageGetsNoReleaseForAPressOnTheOldOne() { + List seen = new ArrayList<>(); + this.game.post(new InputEvent.Key(KeyCode.A, true)); + this.game.runTicks(1); + Stage next = new Stage() { + @Override + public void whenKeyReleased(KeyCode key) { + seen.add("released " + key); + } + }; + this.game.setStage(next); + this.game.post(new InputEvent.Key(KeyCode.A, false)); + this.game.runTicks(1); + assertEquals(List.of(), seen); + assertFalse(next.isKeyPressed(KeyCode.A)); + } + + @Test + void aKeyReleasedDuringATransitionIsNotHeldAfterIt() { + List seen = new ArrayList<>(); + this.game.post(new InputEvent.Key(KeyCode.RIGHT, true)); + this.game.runTicks(1); + Stage next = new Stage() { + @Override + public void whenKeyReleased(KeyCode key) { + seen.add("released " + key); + } + }; + this.game.transition(() -> next, "fade", null, 0.5); + this.game.runTicks(2); + this.game.post(new InputEvent.Key(KeyCode.RIGHT, false)); + this.game.runTicks(1); + assertTrue(this.game.isTransitioning()); + this.game.runTicks(40); + assertFalse(this.game.isTransitioning()); + assertFalse(next.isKeyPressed(KeyCode.RIGHT)); + assertEquals(List.of(), seen); + } + + @Test + void aTransitionShowsTheOldStageAsItWasBeforeTheSupplierRan() { + Logged hero = new Logged("hero"); + this.stage.add(hero); + this.game.runTicks(1); + Stage next = new Stage(); + // the supplier takes the sprite along to the new stage, as a warp does + this.game.transition(() -> { + next.add(hero); + return next; + }, "fade", null, 0.5); + this.game.runTicks(1); + DrawList from = this.game.drawList().transition().from(); + long sprites = from.layers().stream().flatMap(l -> l.items().stream()).filter(i -> i instanceof SpriteDraw).count(); + assertEquals(1, sprites, "the old stage's picture still shows the sprite"); + } + + @Test + void onlyTheFrontmostSpriteUnderThePointerIsClicked() { + List clicked = new ArrayList<>(); + class Clickable extends Sprite { + final String name; + + Clickable(String name) { + super("red", RED); + this.name = name; + } + + @Override + public void whenClicked() { + clicked.add(this.name); + } + } + this.stage.add(new Clickable("back")); + this.stage.add(new Clickable("front")); + this.game.post(new InputEvent.Button(MouseCode.LEFT, true, 1, 1)); + this.game.runTicks(1); + assertEquals(List.of("front"), clicked); + } + + @Test + void theMouseStaysDownWhileDragging() { + this.game.post(new InputEvent.Button(MouseCode.LEFT, true, 0, 0)); + this.game.post(new InputEvent.Move(30, 30)); + this.game.runTicks(1); + assertTrue(this.stage.isMouseDown()); + this.game.post(new InputEvent.Button(MouseCode.LEFT, false, 30, 30)); + this.game.runTicks(1); + assertFalse(this.stage.isMouseDown()); + } + + @Test + void aLearnerExceptionStopsTheGameAndNamesTheLearnersLine() { + int[] runs = {0}; + Sprite s = new Sprite() { + @Override + public void run() { + runs[0]++; + if (runs[0] == 2) { + throw new IllegalStateException("boom"); + } + } + }; + this.stage.add(s); + this.game.runTicks(10); + assertEquals(2, runs[0]); + assertNotNull(this.game.getStopped()); + assertTrue(this.game.getStopped().learnerFrame().getClassName().startsWith(SceneTest.class.getName())); + assertTrue(this.game.getStopped().message().contains("boom")); + } + + @Test + void theDrawListHasTheSpritesLayerByLayerAndCopiesTheirState() { + Sprite a = new Sprite("red", RED), b = new Sprite("red", RED); + this.stage.add(a); + this.stage.add(b); + b.setLayer(Layer.BACKGROUND); + a.setPosition(5, 6); + a.setSize(50); + this.game.runTicks(1); + DrawList list = this.game.drawList(); + assertEquals(1, list.tick()); + SpriteDraw drawnA = (SpriteDraw) list.layers().get(Layer.MAIN.ordinal()).items().get(0); + assertEquals(5, drawnA.x()); + assertEquals(0.5, drawnA.scaleX()); + assertEquals(1, list.layers().get(Layer.BACKGROUND.ordinal()).items().size()); + a.setPosition(100, 100); + assertEquals(5, drawnA.x(), "the draw list does not change with the sprite"); + a.hide(); + assertTrue(this.game.drawList().layers().get(Layer.MAIN.ordinal()).items().isEmpty()); + } + + @Test + void colourSensingSeesTheStageColourAndOtherSprites() { + Sprite me = new Sprite("red", RED), other = new Sprite("left", LEFT4); + this.stage.add(me); + this.stage.add(other); + assertTrue(me.isTouchingColor(new Color(255, 255, 255)), "the white stage around nothing else"); + other.setX(100); + assertFalse(me.isTouchingColor(new Color(0, 0, 255))); + other.setX(12); // its blue columns now cover x = 2..6, under me + assertTrue(me.isTouchingColor(new Color(0, 0, 255))); + assertTrue(me.isColorTouchingColor(new Color(255, 0, 0), new Color(0, 0, 255))); + assertFalse(me.isColorTouchingColor(new Color(0, 255, 0), new Color(0, 0, 255))); + // hitboxes of their own, far from where the costumes meet, do not narrow what colours see + me.setHitbox(new Polygon(new double[] {0, 1, 1, 0}, new double[] {0, 0, 1, 1})); + other.setHitbox(new Polygon(new double[] {19, 20, 20, 19}, new double[] {9, 9, 10, 10})); + assertTrue(me.isTouchingColor(new Color(0, 0, 255))); + other.hide(); + assertFalse(me.isTouchingColor(new Color(0, 0, 255))); + } + + @Test + void colourSensingSeesPenStrokesInStatementOrder() { + Sprite me = new Sprite("red", RED); + Sprite painter = new Sprite(); + this.stage.add(me); + this.stage.add(painter); + Color green = new Color(0, 255, 0); + painter.getPen().setColor(green); + painter.getPen().setSize(4); + painter.setPosition(-20, 0); + painter.getPen().down(); + painter.setPosition(20, 0); + assertTrue(me.isTouchingColor(green), "the line drawn by the statement before"); + this.stage.eraseAll(); + assertFalse(me.isTouchingColor(green), "erased by the statement before"); + } + + @Test + void theGhostEffectHidesOthersButNotTheSensingSprite() { + Sprite me = new Sprite("red", RED), other = new Sprite("red", RED); + this.stage.add(me); + this.stage.add(other); + other.setColorEffect(133.3333); // two thirds of the way round: red becomes blue + assertTrue(me.isTouchingColor(new Color(0, 0, 255))); + other.setTransparency(100); + assertFalse(me.isTouchingColor(new Color(0, 0, 255))); + me.setTransparency(100); + other.setTransparency(0); + assertTrue(me.isTouchingColor(new Color(0, 0, 255))); + } + + @Test + void pixelsOfTheStageShowWhatColourSensingSees() { + Sprite s = new Sprite("red", RED); + this.stage.add(s); + s.setColorEffect(66.6667); // a third of the way round: red becomes green + Pixels p = Pixels.of(this.stage); + assertEquals(480, p.getWidth()); + assertEquals(new Color(255, 255, 255), p.getColor(0, 0)); + assertEquals(new Color(0, 255, 0), p.getColor(240, 180)); + } + + @Test + void theColourEffectTintsWhiteLikeScratch() { + // Scratch forces white to 9% saturation before the turn: a quarter round gives (244, 255, 232) + Sprite s = new Sprite("white", "costumes/white8.png"); + this.stage.add(s); + s.setColorEffect(50); + Pixels p = Pixels.of(this.stage); + assertEquals(new Color(244, 255, 232), p.getColor(240, 180)); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/ShaderTest.java b/core/src/test/java/org/openpatch/scratch/ShaderTest.java new file mode 100644 index 00000000..5df00d3d --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/ShaderTest.java @@ -0,0 +1,56 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.draw.ShaderDraw; + +class ShaderTest { + + Stage stage; + + @BeforeEach + void setUp() { + Game game = Game.headless(480, 360); + this.stage = new Stage(); + game.setStage(this.stage); + } + + @Test + void theFirstShaderIsActiveAndItsValuesTravelInTheDrawList() { + Sprite s = new Sprite("red", SceneTest.RED); + this.stage.add(s); + Shader pixelate = s.getShaders().add("pixelate", "shaders/pixelate.frag"); + pixelate.set("blocks", 8.0); + ShaderDraw drawn = s.toDraw().shaders().get(0); + assertTrue(drawn.source().contains("floor(uv * blocks)")); + assertArrayEquals(new float[] {8f}, (float[]) drawn.uniforms().get("blocks")); + pixelate.set("blocks", 16.0); + assertArrayEquals(new float[] {8f}, (float[]) drawn.uniforms().get("blocks"), "a copy"); + s.getShaders().reset(); + assertTrue(s.toDraw().shaders().isEmpty()); + } + + @Test + void headerUniformsCannotBeSet() { + Shader shader = this.stage.getShaders().add("p", "shaders/pixelate.frag"); + IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> shader.set("time", 1.0)); + assertTrue(e.getMessage().contains("\"time\" is filled in by Scratch for Java"), e.getMessage()); + } + + @Test + void aCloneGetsItsOwnShaders() { + Sprite s = new Sprite("red", SceneTest.RED); + this.stage.add(s); + s.getShaders().add("pixelate", "shaders/pixelate.frag").set("blocks", 4.0); + Sprite clone = s.createClone(); + clone.getShaders().get("pixelate").set("blocks", 2.0); + assertArrayEquals(new float[] {4f}, (float[]) s.toDraw().shaders().get(0).uniforms().get("blocks")); + assertEquals(1, clone.toDraw().shaders().size()); + } +} diff --git a/src/test/java/org/openpatch/scratch/extensions/shader/ShadersTest.java b/core/src/test/java/org/openpatch/scratch/ShadersTest.java similarity index 87% rename from src/test/java/org/openpatch/scratch/extensions/shader/ShadersTest.java rename to core/src/test/java/org/openpatch/scratch/ShadersTest.java index 85299932..ef90feee 100644 --- a/src/test/java/org/openpatch/scratch/extensions/shader/ShadersTest.java +++ b/core/src/test/java/org/openpatch/scratch/ShadersTest.java @@ -1,4 +1,4 @@ -package org.openpatch.scratch.extensions.shader; +package org.openpatch.scratch; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -9,16 +9,18 @@ import org.junit.jupiter.api.Test; /** - * Which shaders are drawn with. The programs themselves need a window, so the - * shaders here have none; only the choosing is checked. + * Which shaders are drawn with: only the choosing. All three use the same file, the programs + * are the renderer's business (ShaderTest). */ class ShadersTest { + private static final String FILE = "shaders/pixelate.frag"; + private static Shaders three() { - Shaders shaders = new Shaders("stage"); - shaders.add(new Shader("tint", null)); - shaders.add(new Shader("waves", null)); - shaders.add(new Shader("blur", null)); + Shaders shaders = new Shaders(); + shaders.add("tint", FILE); + shaders.add("waves", FILE); + shaders.add("blur", FILE); return shaders; } @@ -36,9 +38,9 @@ void theFirstShaderAddedIsActiveAtOnce() { @Test void afterResetANewFirstShaderWaits() { - Shaders shaders = new Shaders("sprite"); + Shaders shaders = new Shaders(); shaders.reset(); - shaders.add(new Shader("tint", null)); + shaders.add("tint", FILE); assertNull(shaders.getCurrent()); assertEquals(-1, shaders.getCurrentIndex()); } diff --git a/src/test/java/org/openpatch/scratch/ShapeTest.java b/core/src/test/java/org/openpatch/scratch/ShapeTest.java similarity index 92% rename from src/test/java/org/openpatch/scratch/ShapeTest.java rename to core/src/test/java/org/openpatch/scratch/ShapeTest.java index 3aa0136d..0bb3c359 100644 --- a/src/test/java/org/openpatch/scratch/ShapeTest.java +++ b/core/src/test/java/org/openpatch/scratch/ShapeTest.java @@ -160,11 +160,23 @@ private static Polygon randomRotatedRectangle(java.util.Random random) { /** The straightforward answer, used as the reference for the fast path. */ private static boolean intersectsViaArea(Shape a, Shape b) { - java.awt.geom.Area area = new java.awt.geom.Area(a.awtShape); - area.intersect(new java.awt.geom.Area(b.awtShape)); + java.awt.geom.Area area = new java.awt.geom.Area(awt(a)); + area.intersect(new java.awt.geom.Area(awt(b))); return !area.isEmpty(); } + /** The 6.x implementation's shape: tests may use java.desktop, the library may not. */ + private static java.awt.geom.Path2D awt(Shape shape) { + double[] p = shape.getPoints(); + java.awt.geom.Path2D.Double path = new java.awt.geom.Path2D.Double(); + path.moveTo(p[0], p[1]); + for (int i = 2; i < p.length; i += 2) { + path.lineTo(p[i], p[i + 1]); + } + path.closePath(); + return path; + } + @Test void scaleGrowsBoundsAroundTheOrigin() { Rectangle rectangle = new Rectangle(0, 0, 10, 10); diff --git a/src/test/java/org/openpatch/scratch/SpriteTest.java b/core/src/test/java/org/openpatch/scratch/SpriteTest.java similarity index 78% rename from src/test/java/org/openpatch/scratch/SpriteTest.java rename to core/src/test/java/org/openpatch/scratch/SpriteTest.java index 21244c5e..565ba61f 100644 --- a/src/test/java/org/openpatch/scratch/SpriteTest.java +++ b/core/src/test/java/org/openpatch/scratch/SpriteTest.java @@ -6,8 +6,34 @@ class SpriteTest { + // Regression guard: these constants used to be swapped (DIRECTION_RIGHT=0, + // DIRECTION_UP=90, DIRECTION_LEFT=180, DIRECTION_DOWN=270), contradicting + // both real Scratch's direction convention and Sprite.move()'s own trig, + // which treats direction 90 (the default, "facing right") as movement + // along +x. The correct mapping is 0=up, 90=right, 180=down, 270=left. + private static final double DELTA = 1e-9; + @Test + void directionUpIsZeroDegrees() { + assertEquals(0.0, Sprite.DIRECTION_UP); + } + + @Test + void directionRightIsNinetyDegrees() { + assertEquals(90.0, Sprite.DIRECTION_RIGHT); + } + + @Test + void directionDownIsOneEightyDegrees() { + assertEquals(180.0, Sprite.DIRECTION_DOWN); + } + + @Test + void directionLeftIsTwoSeventyDegrees() { + assertEquals(270.0, Sprite.DIRECTION_LEFT); + } + @Test void newSpriteStartsAtOriginFacingRight() { Sprite sprite = new Sprite(); @@ -144,10 +170,11 @@ void ifOnEdgeBounceIsANoOpWhenNotAddedToAStage() { @Test void hitboxFollowsTheSpriteAfterItMoves() { - // getHitbox() reuses the last hitbox while the sprite stands still, so that - // collision checks do not rebuild it once per pair. Anything that changes - // the shape has to be noticed, or sprites collide where they used to be. + // The hitbox must follow the sprite when it moves, or sprites collide + // where they used to be. A new Sprite has no costume, so give it an + // explicit hitbox before moving. Sprite sprite = new Sprite(); + sprite.setHitbox(new Rectangle(0, 0, 40, 20)); sprite.setPosition(0, 0); double startX = sprite.getHitbox().getBounds().x(); @@ -159,7 +186,7 @@ void hitboxFollowsTheSpriteAfterItMoves() { @Test void customHitboxFollowsTheSpriteAfterItIsResized() { Sprite sprite = new Sprite(); - sprite.setHitbox(0, 0, 40, 0, 40, 20, 0, 20); + sprite.setHitbox(new Polygon(new double[] {0, 40, 40, 0}, new double[] {0, 0, 20, 20})); double startWidth = sprite.getHitbox().getBounds().width(); sprite.setSize(200); @@ -170,7 +197,7 @@ void customHitboxFollowsTheSpriteAfterItIsResized() { @Test void customHitboxFollowsTheSpriteAfterItTurns() { Sprite sprite = new Sprite(); - sprite.setHitbox(0, 0, 40, 0, 40, 20, 0, 20); + sprite.setHitbox(new Polygon(new double[] {0, 40, 40, 0}, new double[] {0, 0, 20, 20})); double startWidth = sprite.getHitbox().getBounds().width(); sprite.setDirection(180); diff --git a/core/src/test/java/org/openpatch/scratch/StageLifetimeTest.java b/core/src/test/java/org/openpatch/scratch/StageLifetimeTest.java new file mode 100644 index 00000000..c70f5735 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/StageLifetimeTest.java @@ -0,0 +1,145 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.Game; + +/** + * Switching stages, plain and through a transition, headless. Ports 6.x's WindowTransitionTest + * and WindowStageLifetimeTest, which needed a window and a child process. + */ +class StageLifetimeTest { + + Game game; + final List log = new ArrayList<>(); + + class Logged extends Stage { + final String name; + + Logged(String name) { + this.name = name; + } + + @Override + public void run() { + StageLifetimeTest.this.log.add(this.name); + } + } + + @BeforeEach + void setUp() { + this.game = Game.headless(480, 360); + } + + // ---- transitions (6.x WindowTransitionTest) ---- + + @Test + void theSupplierRunsOnceOnTheNextTickNotWhenTheTransitionIsAsked() { + Logged from = new Logged("from"); + this.game.setStage(from); + this.game.runTicks(1); + int[] made = {0}; + Logged to = new Logged("to"); + this.game.transition(() -> { + made[0]++; + return to; + }, "fade", null, 0.5); + assertEquals(0, made[0], "not made eagerly"); + this.game.runTicks(1); + assertEquals(1, made[0]); + assertSame(to, this.game.getStage()); + assertTrue(this.game.isTransitioning()); + } + + @Test + void neitherStageRunsDuringTheTransitionAndTheNewOneRunsAfterIt() { + Logged from = new Logged("from"); + this.game.setStage(from); + this.game.runTicks(1); + this.log.clear(); + this.game.transition(() -> new Logged("to"), "fade", null, 0.5); + this.game.runTicks(30); + assertEquals(List.of(), this.log, "both stand still for 0.5 s"); + this.game.runTicks(1); + assertFalse(this.game.isTransitioning()); + assertEquals(List.of("to"), this.log); + } + + @Test + void aTransitionAskedDuringATransitionDoesNotMakeItsStage() { + this.game.setStage(new Logged("from")); + this.game.runTicks(1); + Logged to = new Logged("to"); + List made = new ArrayList<>(); + this.game.transition(() -> { + made.add("to"); + // asked from inside the supplier + this.game.transition(() -> { + made.add("reentrant"); + return new Logged("reentrant"); + }, "fade", null, 0.5); + return to; + }, "fade", null, 0.5); + this.game.runTicks(2); + // asked while busy + this.game.transition(() -> { + made.add("busy"); + return new Logged("busy"); + }, "fade", null, 0.5); + this.game.runTicks(60); + assertEquals(List.of("to"), made); + assertSame(to, this.game.getStage()); + } + + // ---- stage lifetime (6.x WindowStageLifetimeTest) ---- + + @Test + void aDiscardedStageIsCollected() throws Exception { + Stage saved = new Logged("saved"); + this.game.setStage(saved); + this.game.runTicks(1); + WeakReference discarded = this.showAndLeave(saved); + long start = System.nanoTime(); + while (discarded.get() != null && System.nanoTime() - start < TimeUnit.SECONDS.toNanos(8)) { + System.gc(); + Thread.sleep(10); + } + assertNull(discarded.get(), "nothing holds on to a stage that is no longer shown"); + } + + /** Shows a stage with a sprite, a pen and a text, then goes back to {@code back}. */ + private WeakReference showAndLeave(Stage back) { + Stage temporary = new Logged("temporary"); + temporary.add(new Sprite()); + temporary.add(new Pen()); + temporary.add(new Text("temporary", 0, 0, 100)); + this.game.setStage(temporary); + this.game.runTicks(2); + this.game.transition(() -> back, "fade", null, 0.1); + this.game.runTicks(10); + return new WeakReference<>(temporary); + } + + @Test + void aKeptStageRunsAgainWhenShownAgain() { + Logged saved = new Logged("saved"); + Logged other = new Logged("other"); + this.game.setStage(saved); + this.game.runTicks(1); + this.game.setStage(other); + this.game.runTicks(1); + this.game.setStage(saved); + this.game.runTicks(1); + assertEquals(List.of("saved", "other", "saved"), this.log); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/TextTest.java b/core/src/test/java/org/openpatch/scratch/TextTest.java new file mode 100644 index 00000000..08b9cf28 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/TextTest.java @@ -0,0 +1,119 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.draw.DrawList; +import org.openpatch.scratch.internal.draw.TextDraw; + +/** Texts and bubbles, laid out without a window. */ +class TextTest { + + Game game; + Stage stage; + + @BeforeEach + void setUp() { + this.game = Game.headless(480, 360); + this.stage = new Stage(); + this.game.setStage(this.stage); + } + + DrawList frame() { + return this.game.drawList(); + } + + @Test + void aBubbleHangsOffTheTopRightCornerOfThePaintedPixels() { + Sprite s = new Sprite("left", SceneTest.LEFT4); + this.stage.add(s); + s.say("Hello!"); + TextDraw bubble = this.frame().overlay().get(0); + // painted columns of left4 are x = -10..-6, rows y = -5..5 + assertEquals(-6, bubble.x(), 1e-9); + assertEquals(TextDraw.Box.SPEECH, bubble.box()); + assertTrue(bubble.width() >= 80, "a bubble is at least 80 wide"); + assertEquals(5 + bubble.height(), bubble.y(), 1e-9, "the bubble stands on the sprite's top edge"); + } + + @Test + void sayForSecondsCountsGameTime() { + Sprite s = new Sprite("red", SceneTest.RED); + this.stage.add(s); + s.say("Hi", 2); + this.game.runTicks(119); + assertEquals(1, this.frame().overlay().size()); + this.game.runTicks(1); + assertTrue(this.frame().overlay().isEmpty()); + } + + @Test + void anEmptyTextRemovesTheBubble() { + Sprite s = new Sprite("red", SceneTest.RED); + this.stage.add(s); + s.think("Hmm"); + assertEquals(TextDraw.Box.THOUGHT, this.frame().overlay().get(0).box()); + s.think(""); + assertTrue(this.frame().overlay().isEmpty()); + } + + @Test + void longBubblesWrapAt330() { + Sprite s = new Sprite("red", SceneTest.RED); + this.stage.add(s); + s.say("word ".repeat(60)); + TextDraw bubble = this.frame().overlay().get(0); + assertTrue(bubble.layout().lines().size() > 1); + assertTrue(bubble.width() <= 330 + 1e-9, "width " + bubble.width()); + } + + @Test + void uiTextsGoInFrontOfTheUiLayerAndWorldTextsIntoTheOverlay() { + Text world = new Text("world", 0, 0, 0), ui = new Text("ui", 0, 0, 0); + ui.setLayer(Layer.UI); + this.stage.add(world); + this.stage.add(ui); + DrawList list = this.frame(); + assertEquals(1, list.overlay().size()); + assertEquals(1, list.ui().size()); + assertEquals("ui", list.ui().get(0).layout().lines().get(0).text()); + } + + @Test + void plainTextIsCentredOnItsPositionAndBoxesStandOnTheirBottomEdge() { + Text plain = new Text("Hello", 10, 20, 0); + Text box = new Text("Hello", 10, 20, 0, TextStyle.BOX); + Text left = new Text("Hello", 10, 20, 0); + left.setAlign(TextAlign.LEFT); + this.stage.add(plain); + this.stage.add(box); + this.stage.add(left); + TextDraw p = this.frame().overlay().get(0), b = this.frame().overlay().get(1), l = this.frame().overlay().get(2); + // as in 6.x: a label put at a point is centred on it, its first line's letters on its y + var font = p.layout().font(); + double size = p.layout().size(); + double firstLineMiddle = p.y() - font.ascent(size) + (font.ascent(size) - font.descent(size)) / 2; + assertEquals(10 - p.width() / 2, p.x(), 1e-9, "plain text is centred on its x"); + assertEquals(20, firstLineMiddle, 1e-9, "and its first line on its y"); + assertEquals(10, l.x(), 1e-9, "left-aligned text starts at its x"); + assertEquals(p.y(), l.y(), 1e-9, "at the same height"); + assertEquals(20 + b.height(), b.y(), 1e-9); + assertEquals(10 - b.width() / 2, b.x(), 1e-9, "a box is centred on its x"); + } + + @Test + void aTextOfItsOwnWrapsAtItsWidth() { + Text t = new Text("one two three four", 0, 0, 60); + this.stage.add(t); + for (var line : this.frame().overlay().get(0).layout().lines()) { + assertTrue(line.width() <= 60, line.text()); + } + t.hide(); + assertFalse(t.isVisible()); + assertTrue(this.frame().overlay().isEmpty()); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/TimerAndAskTest.java b/core/src/test/java/org/openpatch/scratch/TimerAndAskTest.java new file mode 100644 index 00000000..332c4db3 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/TimerAndAskTest.java @@ -0,0 +1,150 @@ +package org.openpatch.scratch; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.draw.AskDraw; +import org.openpatch.scratch.internal.input.InputEvent; + +/** Timers in game time; ask and display. */ +class TimerAndAskTest { + + Game game; + Stage stage; + + @BeforeEach + void setUp() { + this.game = Game.headless(480, 360); + this.stage = new Stage(); + this.game.setStage(this.stage); + } + + @Test + void aTimerCountsGameTime() { + Timer t = new Timer(); + this.game.runTicks(90); + assertEquals(1.5, t.getSeconds(), 1e-9); + t.reset(); + assertEquals(0, t.getSeconds(), 1e-9); + } + + @Test + void everyIsTrueOncePerPeriod() { + Timer t = new Timer(); + List ticks = new ArrayList<>(); + for (int i = 0; i < 130; i++) { + if (t.every(1)) { + ticks.add(this.game.getTickCount()); + } + this.game.runTicks(1); + } + assertEquals(List.of(60L, 120L), ticks); + } + + @Test + void duringAndAfterSplitTimeInTwo() { + Timer t = new Timer(); + assertTrue(t.during(0.5)); + assertFalse(t.after(0.5)); + this.game.runTicks(30); + assertFalse(t.during(0.5)); + assertTrue(t.after(0.5)); + } + + @Test + void intervalAlternates() { + Timer t = new Timer(); + StringBuilder pattern = new StringBuilder(); + for (int i = 0; i < 6; i++) { + pattern.append(t.interval(0.5, 1) ? 'X' : '.'); + this.game.runTicks(15); + } + // on for 30 ticks, off for 60: on at ticks 0, 15; off at 30..75 + assertEquals("XX....", pattern.toString()); + } + + @Test + void anAnswerIsTypedAndFinishedWithEnter() { + List spriteKeys = new ArrayList<>(); + Sprite s = new Sprite("red", SceneTest.RED) { + @Override + public void whenKeyPressed(KeyCode key) { + spriteKeys.add(key); + } + }; + this.stage.add(s); + s.ask("Name?"); + assertTrue(s.isAsking()); + for (int cp : "Jörg".codePoints().toArray()) { + this.game.post(new InputEvent.Typed(cp)); + } + this.game.post(new InputEvent.Typed('x')); + this.game.post(new InputEvent.Typed('y')); + this.game.post(new InputEvent.Typed('z')); + // Backspace held: one press, then the key repeats + this.game.post(new InputEvent.Key(KeyCode.BACKSPACE, true)); + this.game.post(new InputEvent.Repeat(KeyCode.BACKSPACE)); + this.game.post(new InputEvent.Repeat(KeyCode.BACKSPACE)); + this.game.post(new InputEvent.Key(KeyCode.BACKSPACE, false)); + this.game.post(new InputEvent.Repeat(KeyCode.ENTER)); // a held Enter does not answer twice + this.game.runTicks(1); + assertEquals("Jörg", this.game.drawList().ask().answer().lines().get(0).text()); + assertNull(this.game.drawList().ask().question(), "a sprite's question is in its bubble"); + this.game.post(new InputEvent.Key(KeyCode.ENTER, true)); + this.game.runTicks(1); + assertFalse(s.isAsking()); + assertEquals("Jörg", s.getAnswer()); + assertTrue(spriteKeys.isEmpty(), "keys went to the answer box"); + assertTrue(this.game.drawList().overlay().isEmpty(), "the question's bubble is gone"); + } + + @Test + void theStageAsksInACardWhoseCheckButtonFinishesTheAnswer() { + this.stage.ask("Name?"); + this.game.post(new InputEvent.Typed('A')); + this.game.runTicks(1); + AskDraw box = this.game.drawList().ask(); + assertEquals("Name?", box.question().lines().get(0).text()); + assertEquals(480 - 16, box.width(), 1e-9); + assertEquals(-180 + 8, box.y() - box.height(), 1e-9); // standing on the stage's bottom margin + this.game.post(new InputEvent.Button(MouseCode.LEFT, true, box.buttonX(), box.buttonY())); + this.game.runTicks(1); + assertFalse(this.stage.isAsking()); + assertEquals("A", this.stage.getAnswer()); + assertNull(this.game.drawList().ask()); + } + + @Test + void repeatsReachNoLearnerCode() { + List pressed = new ArrayList<>(); + Sprite s = new Sprite() { + @Override + public void whenKeyPressed(KeyCode key) { + pressed.add(key); + } + }; + this.stage.add(s); + this.game.post(new InputEvent.Key(KeyCode.A, true)); + this.game.post(new InputEvent.Repeat(KeyCode.A)); + this.game.post(new InputEvent.Repeat(KeyCode.A)); + this.game.runTicks(1); + assertEquals(List.of(KeyCode.A), pressed); + assertTrue(this.stage.isKeyPressed(KeyCode.A)); + } + + @Test + void displayShowsABandForSomeSeconds() { + this.stage.display("Level 2", 1); + assertEquals(1, this.game.drawList().ui().size()); + assertEquals(480 - 16, this.game.drawList().ui().get(0).width(), 1e-9); + this.game.runTicks(60); + assertTrue(this.game.drawList().ui().isEmpty()); + } +} diff --git a/src/test/java/org/openpatch/scratch/Vector2Test.java b/core/src/test/java/org/openpatch/scratch/Vector2Test.java similarity index 92% rename from src/test/java/org/openpatch/scratch/Vector2Test.java rename to core/src/test/java/org/openpatch/scratch/Vector2Test.java index 8367fa2e..37849532 100644 --- a/src/test/java/org/openpatch/scratch/Vector2Test.java +++ b/core/src/test/java/org/openpatch/scratch/Vector2Test.java @@ -162,4 +162,13 @@ void equalVectorsHaveEqualHashCodes() { assertEquals(a.hashCode(), b.hashCode()); } + + @Test + void directionCountsLikeScratch() { + assertEquals(0, new Vector2(0, 1).direction(), 1e-9); + assertEquals(90, new Vector2(1, 0).direction(), 1e-9); + assertEquals(180, new Vector2(0, -1).direction(), 1e-9); + assertEquals(270, new Vector2(-1, 0).direction(), 1e-9); + assertEquals(45, new Vector2(1, 1).direction(), 1e-9); + } } diff --git a/core/src/test/java/org/openpatch/scratch/extension/CoreVersionTest.java b/core/src/test/java/org/openpatch/scratch/extension/CoreVersionTest.java new file mode 100644 index 00000000..25e40bda --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/extension/CoreVersionTest.java @@ -0,0 +1,27 @@ +package org.openpatch.scratch.extension; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +/** A branch build carrying the last release's number still is the version 7 extension API. */ +class CoreVersionTest { + + @Test + void anOlderNumberIsReportedAsTheApiItImplements() { + assertEquals("7.0.0", CoreVersion.effective("6.5.0")); + assertEquals("7.0.0", CoreVersion.effective("6.5.0-SNAPSHOT")); + } + + @Test + void aReleasedVersionIsReportedAsItIs() { + assertEquals("7.0.0", CoreVersion.effective("7.0.0")); + assertEquals("7.2.1", CoreVersion.effective("7.2.1")); + assertEquals("8.0.0", CoreVersion.effective("8.0.0")); + } + + @Test + void theCoreReportsSevenOrLater() { + assertEquals(true, Integer.parseInt(Extension.coreVersion().split("[.-]")[0]) >= 7); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/extension/ExtensionApiTest.java b/core/src/test/java/org/openpatch/scratch/extension/ExtensionApiTest.java new file mode 100644 index 00000000..399a8533 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/extension/ExtensionApiTest.java @@ -0,0 +1,240 @@ +package org.openpatch.scratch.extension; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.Color; +import org.openpatch.scratch.KeyCode; +import org.openpatch.scratch.Layer; +import org.openpatch.scratch.Sprite; +import org.openpatch.scratch.Stage; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.draw.ImageDraw; +import org.openpatch.scratch.internal.draw.Item; +import org.openpatch.scratch.internal.draw.ShapeDraw; +import org.openpatch.scratch.internal.input.InputEvent; + +/** The public extension API, as a third-party extension would use it, without a window. */ +class ExtensionApiTest { + + /** An extension made of hooks the test fills in. */ + static final class TestExtension implements Extension { + final Consumer install; + + TestExtension(Consumer install) { + this.install = install; + } + + @Override + public String id() { + return "test"; + } + + @Override + public String name() { + return "Test"; + } + + @Override + public String version() { + return "1"; + } + + @Override + public void install(ExtensionContext ctx) { + this.install.accept(ctx); + } + } + + /** What a gamepad extension would offer learners. */ + interface BeepListener { + default void whenBeep(int n) {} + } + + Game game; + + @BeforeEach + void setUp() { + this.game = Game.headless(480, 360); + } + + Stage show() { + Stage stage = new Stage(); + this.game.setStage(stage); + return stage; + } + + @Test + void hooksRunAtTheirPointsOfTheTick() { + List log = new ArrayList<>(); + this.game.getExtensions().install(List.of(new TestExtension(ctx -> { + ctx.onStageCreated(s -> log.add("created")); + ctx.beforeTick(s -> log.add("before " + ctx.getTickCount())); + ctx.onKey(e -> log.add("key " + e.key())); + }))); + Stage stage = new Stage() { + @Override + public void run() { + log.add("run"); + } + + @Override + public void whenKeyPressed(KeyCode key) { + log.add("learner key"); + } + }; + this.game.setStage(stage); + this.game.post(new InputEvent.Key(KeyCode.A, true)); + this.game.runTicks(2); + assertEquals(List.of("created", "key A", "learner key", "before 0", "run", "before 1", "run"), log); + } + + @Test + void layerDrawersDrawAfterTheCanvasAndBeforeTheSprites() { + this.game.getExtensions().install(List.of(new TestExtension(ctx -> ctx.addLayerDrawer(Layer.BACKGROUND, + (stage, canvas) -> { + canvas.drawImageRegion("costumes/sheet.png", 10, 0, 10, 10, 5, 5, 10, 10); + canvas.drawRectangle(0, 0, 20, 20, new Color(255, 0, 0)); + })))); + Stage stage = this.show(); + Sprite s = new Sprite("red", "costumes/red10.png"); + stage.add(s); + s.setLayer(Layer.BACKGROUND); + List items = this.game.drawList().layers().get(Layer.BACKGROUND.ordinal()).items(); + assertEquals(3, items.size()); + ImageDraw tile = assertInstanceOf(ImageDraw.class, items.get(0)); + assertEquals(10, tile.sx()); + assertInstanceOf(ShapeDraw.class, items.get(1)); + } + + @Test + void dispatchCallsTheStageAndEverySpriteThatListens() { + List heard = new ArrayList<>(); + class Listener extends Sprite implements BeepListener { + @Override + public void whenBeep(int n) { + heard.add("sprite " + n); + } + } + ExtensionContext[] context = new ExtensionContext[1]; + this.game.getExtensions().install(List.of(new TestExtension(ctx -> { + context[0] = ctx; + ctx.beforeTick(stage -> ctx.dispatch(stage, BeepListener.class, l -> l.whenBeep(7))); + }))); + Stage stage = this.show(); + stage.add(new Listener()); + stage.add(new Sprite()); + this.game.runTicks(1); + assertEquals(List.of("sprite 7"), heard); + // game-thread methods from another thread fail at once + Thread other = new Thread(() -> assertThrows(IllegalStateException.class, + () -> context[0].dispatch(stage, BeepListener.class, l -> l.whenBeep(1)))); + other.start(); + assertTrue(joined(other)); + } + + @Test + void aHookThatThrowsIsSwitchedOffAndTheGameGoesOn() { + int[] calls = {0}; + this.game.getExtensions().install(List.of(new TestExtension(ctx -> ctx.beforeTick(s -> { + calls[0]++; + throw new IllegalStateException("broken"); + })))); + this.show(); + this.game.runTicks(5); + assertEquals(1, calls[0]); + assertEquals(null, this.game.getStopped()); + assertEquals(5, this.game.getTickCount()); + } + + @Test + void attachmentsAreOnePerStageAndSprite() { + Stage stage = this.show(); + Sprite s = new Sprite("red", "costumes/red10.png"); + stage.add(s); + StringBuilder a = stage.extension(StringBuilder.class, StringBuilder::new); + assertSame(a, stage.extension(StringBuilder.class, StringBuilder::new)); + StringBuilder mine = s.extension(StringBuilder.class, StringBuilder::new); + Sprite clone = s.createClone(); + assertFalse(mine == clone.extension(StringBuilder.class, StringBuilder::new), "a clone gets its own"); + } + + @Test + void theInputSnapshotIsHandedOverWithTheBatch() { + ExtensionContext.InputKey buttons = ExtensionContext.InputKey.of("buttons", () -> new int[1], + (from, into) -> into[0] = from[0]); + int[] seen = {-1}; + int[] device = {0}; + this.game.getExtensions().install(List.of(new TestExtension(ctx -> { + ctx.onInputPoll(snapshot -> snapshot.get(buttons)[0] = device[0]); + ctx.beforeTick(stage -> seen[0] = ctx.input(buttons)[0]); + }))); + this.show(); + device[0] = 3; + // what the window thread does each frame + this.game.getExtensions().poll(); + this.game.getExtensions().handOver(); + this.game.runTicks(1); + assertEquals(3, seen[0]); + device[0] = 4; // polled but not handed over yet: the game still sees 3 + this.game.getExtensions().poll(); + this.game.runTicks(1); + assertEquals(3, seen[0]); + } + + @Test + void anOverlayDrawerIsInTheDrawList() { + this.game.getExtensions().install(List.of(new TestExtension( + ctx -> ctx.addOverlayDrawer((stage, canvas) -> canvas.drawText("pin", 0, 0, 12, new Color(0, 0, 0)))))); + this.show(); + assertEquals(1, this.game.drawList().overlayItems().size()); + } + + @Test + void aCanvasCannotBeKeptForLater() { + Canvas[] kept = new Canvas[1]; + this.game.getExtensions().install(List.of(new TestExtension( + ctx -> ctx.addLayerDrawer(Layer.MAIN, (stage, canvas) -> kept[0] = canvas)))); + this.show(); + this.game.drawList(); + assertThrows(IllegalStateException.class, () -> kept[0].drawRectangle(0, 0, 1, 1, new Color(0, 0, 0))); + } + + @Test + void aLearnerExceptionInADispatchedListenerStopsTheGameButNotTheExtension() { + class Listener extends Sprite implements BeepListener { + @Override + public void whenBeep(int n) { + throw new IllegalStateException("learner bug"); + } + } + int[] beforeTicks = {0}; + this.game.getExtensions().install(List.of(new TestExtension(ctx -> ctx.beforeTick(stage -> { + beforeTicks[0]++; + ctx.dispatch(stage, BeepListener.class, l -> l.whenBeep(1)); + })))); + Stage stage = this.show(); + stage.add(new Listener()); + this.game.runTicks(3); + assertEquals(1, beforeTicks[0]); + assertTrue(this.game.getStopped().message().contains("learner bug")); + } + + private static boolean joined(Thread t) { + try { + t.join(2000); + return !t.isAlive(); + } catch (InterruptedException e) { + return false; + } + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/AssetsTest.java b/core/src/test/java/org/openpatch/scratch/internal/AssetsTest.java new file mode 100644 index 00000000..6b5d2dbb --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/AssetsTest.java @@ -0,0 +1,148 @@ +package org.openpatch.scratch.internal; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import org.openpatch.scratch.internal.image.Image; +import org.openpatch.scratch.internal.image.Images; + +class AssetsTest { + + @Test + void findsAFolderOnTheClasspath() throws Exception { + // test-classes/costumes: not a folder relative to the working directory + Path root = Assets.findFolder("costumes"); + assertNotNull(root); + assertTrue(Files.isDirectory(root)); + } + + @Test + void findsAFolderOnDiskAndListsFilesByTheirSpritePaths(@TempDir Path dir) throws Exception { + Files.createDirectories(dir.resolve("sub")); + Files.write(dir.resolve("b.png"), new byte[0]); + Files.write(dir.resolve("sub/a.wav"), new byte[0]); + String written = dir.toString() + "/"; + assertEquals(dir, Assets.findFolder(dir.toString())); + assertEquals(List.of(dir + "/b.png", dir + "/sub/a.wav"), + Assets.list(written, Assets.findFolder(dir.toString()))); + } + + @Test + void noFolderIsNull() { + assertNull(Assets.findFolder("no-such-folder-anywhere")); + } + + @Test + void decodesIntoTheCacheThenWaitsForTheUploads() throws Exception { + Assets assets = Assets.start("costumes"); + // decoding finishes on its own; the images then wait for the window thread + long until = System.nanoTime() + 10_000_000_000L; + while (assets.progress() < 0.5 && System.nanoTime() < until) { + Thread.sleep(10); + } + Thread.sleep(50); + assertFalse(assets.isDone(), "uploads outstanding"); + assertEquals(0.5, assets.progress(), 1e-9, "seven images decoded, none uploaded"); + int uploads = 0; + for (Image image; (image = assets.nextUpload()) != null; uploads++) { + // what a sprite's addCostume("costumes/red10.png") finds: the very same image + if (image.getWidth() == 10 && image.getHeight() == 10) { + assertSame(image, Images.load("costumes/red10.png")); + } + } + assertEquals(7, uploads); + assertTrue(assets.isDone()); + assertEquals(1, assets.progress(), 1e-9); + } + + @Test + void aMissingFolderIsDoneAtOnce() throws Exception { + Assets assets = Assets.start("no-such-folder-anywhere"); + long until = System.nanoTime() + 5_000_000_000L; + while (!assets.isDone() && System.nanoTime() < until) { + Thread.sleep(5); + } + assertTrue(assets.isDone()); + assertEquals(1, assets.progress(), 1e-9); + } + + @Test + void findsNoFolderWhereThereIsAFile(@TempDir Path dir) throws Exception { + var file = Files.createFile(dir.resolve("assets")); + assertNull(Assets.findFolder(file.toString())); + } + + @Test + void findsAFolderInsideAJar(@TempDir Path dir) throws Exception { + // a project that was packaged and shared keeps its assets in the jar + var jar = dir.resolve("game.jar"); + try (var out = new JarOutputStream(Files.newOutputStream(jar))) { + out.putNextEntry(new JarEntry("jarAssets/")); + out.closeEntry(); + out.putNextEntry(new JarEntry("jarAssets/sprites/")); + out.closeEntry(); + out.putNextEntry(new JarEntry("jarAssets/sprites/cat.png")); + out.closeEntry(); + } + + var thread = Thread.currentThread(); + var before = thread.getContextClassLoader(); + try (var loader = new URLClassLoader(new URL[] { jar.toUri().toURL() }, before)) { + thread.setContextClassLoader(loader); + var root = Assets.findFolder("jarAssets"); + assertNotNull(root); + assertEquals(List.of("jarAssets/sprites/cat.png"), Assets.list("jarAssets", root)); + } finally { + thread.setContextClassLoader(before); + } + } + + @Test + void findsAFolderInsideAJarWithoutEntriesForFolders(@TempDir Path dir) throws Exception { + // not every tool writes an entry for each folder, the runnable jar of Studio does not + var jar = dir.resolve("game.jar"); + try (var out = new JarOutputStream(Files.newOutputStream(jar))) { + out.putNextEntry(new JarEntry("META-INF/MANIFEST.MF")); + out.write("Manifest-Version: 1.0\r\n".getBytes()); + out.closeEntry(); + out.putNextEntry(new JarEntry("flatAssets/sprites/cat.png")); + out.closeEntry(); + } + + var thread = Thread.currentThread(); + var before = thread.getContextClassLoader(); + try (var loader = new URLClassLoader(new URL[] { jar.toUri().toURL() }, before)) { + thread.setContextClassLoader(loader); + var root = Assets.findFolder("flatAssets"); + assertNotNull(root); + assertEquals(List.of("flatAssets/sprites/cat.png"), Assets.list("flatAssets", root)); + } finally { + thread.setContextClassLoader(before); + } + } + + @Test + void knowsTheFilesOfTheBuiltins() { + assertTrue(BuiltinAssets.getSheets().contains("platformer")); + assertTrue(BuiltinAssets.getEntries().stream() + .anyMatch(e -> e.sheet().equals("platformer") + && e.sheetPath().equals("images/platformer.png"))); + assertFalse(BuiltinAssets.getEntries().stream() + .anyMatch(e -> e.sheetPath().equals("assets/platformer.png"))); + assertTrue(BuiltinSounds.isResource(BuiltinSounds.get(BuiltinSounds.getNames().get(0)))); + assertFalse(BuiltinSounds.isResource("assets/meow.wav")); + } +} diff --git a/src/test/java/org/openpatch/scratch/internal/BuiltinSoundsTest.java b/core/src/test/java/org/openpatch/scratch/internal/BuiltinSoundsTest.java similarity index 82% rename from src/test/java/org/openpatch/scratch/internal/BuiltinSoundsTest.java rename to core/src/test/java/org/openpatch/scratch/internal/BuiltinSoundsTest.java index d5638ce9..6113698e 100644 --- a/src/test/java/org/openpatch/scratch/internal/BuiltinSoundsTest.java +++ b/core/src/test/java/org/openpatch/scratch/internal/BuiltinSoundsTest.java @@ -6,8 +6,6 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.HashSet; import java.util.List; @@ -33,7 +31,8 @@ void resolvesToAResourcePathThatExists() { assertNotNull(path); assertTrue(path.startsWith("sounds/"), "unexpected path " + path); - assertTrue(Files.exists(Path.of(Applet.getPath(path))), "resource missing at " + path); + // 7.0: Applet is gone; BuiltinSounds already returns a classloader path + assertTrue(BuiltinSoundsTest.class.getClassLoader().getResource(path) != null, "resource missing at " + path); } @Test @@ -46,7 +45,8 @@ void resolvesSoundsInNestedFoldersWithSpaces() { .orElse(null); assertNotNull(nested, "expected at least one jingle"); - assertTrue(Files.exists(Path.of(Applet.getPath(nested))), "resource missing at " + nested); + // 7.0: Applet is gone; BuiltinSounds already returns a classloader path + assertTrue(BuiltinSoundsTest.class.getClassLoader().getResource(nested) != null, "resource missing at " + nested); } @Test diff --git a/core/src/test/java/org/openpatch/scratch/internal/ExtensionsTest.java b/core/src/test/java/org/openpatch/scratch/internal/ExtensionsTest.java new file mode 100644 index 00000000..208c6eaf --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/ExtensionsTest.java @@ -0,0 +1,64 @@ +package org.openpatch.scratch.internal; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.List; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.extension.Extension; + +class ExtensionsTest { + + record Fake(String id, String requires) implements Extension { + public String name() { + return "Fake " + this.id; + } + + public String version() { + return "1.0"; + } + } + + @Test + void majorOnlyAcceptsEveryMinorOfThatMajor() { + assertTrue(Extensions.satisfies("7", "7.0.0")); + assertTrue(Extensions.satisfies("7", "7.9.3")); + assertFalse(Extensions.satisfies("7", "8.0.0")); + assertFalse(Extensions.satisfies("7", "6.5.0")); + } + + @Test + void minorAndPatchAreLowerBounds() { + assertTrue(Extensions.satisfies("7.1", "7.1.0")); + assertTrue(Extensions.satisfies("7.1", "7.2.0")); + assertFalse(Extensions.satisfies("7.1", "7.0.9")); + assertTrue(Extensions.satisfies("7.1.2", "7.1.2")); + assertFalse(Extensions.satisfies("7.1.2", "7.1.1")); + assertTrue(Extensions.satisfies("7.1.2", "7.2.0")); + } + + @Test + void suffixesAreIgnored() { + assertTrue(Extensions.satisfies("7.0.0", "7.0.0-SNAPSHOT")); + } + + @Test + void garbageIsReported() { + assertThrows(IllegalArgumentException.class, () -> Extensions.satisfies("seven", "7.0.0")); + } + + @Test + void firstOfTwoWithTheSameIdWinsAndUnmetRequirementsAreLeftOut() { + Fake a = new Fake("a", "7"), b = new Fake("b", "7.2"), a2 = new Fake("a", "7"); + List chosen = Extensions.select(List.of(a, b, a2), "7.1.0"); + assertEquals(List.of(a), chosen); + } + + @Test + void theCoreKnowsItsVersion() { + assertFalse(Extension.coreVersion().isBlank()); + assertFalse(Extension.coreVersion().contains("${"), "the version file was not filtered"); + } +} diff --git a/src/test/java/org/openpatch/scratch/internal/NrwListTest.java b/core/src/test/java/org/openpatch/scratch/internal/NrwListTest.java similarity index 100% rename from src/test/java/org/openpatch/scratch/internal/NrwListTest.java rename to core/src/test/java/org/openpatch/scratch/internal/NrwListTest.java diff --git a/src/test/java/variants/NrwVariantTest.java b/core/src/test/java/org/openpatch/scratch/internal/NrwVariantTest.java similarity index 66% rename from src/test/java/variants/NrwVariantTest.java rename to core/src/test/java/org/openpatch/scratch/internal/NrwVariantTest.java index deb4139b..5a0714d5 100644 --- a/src/test/java/variants/NrwVariantTest.java +++ b/core/src/test/java/org/openpatch/scratch/internal/NrwVariantTest.java @@ -1,4 +1,4 @@ -package variants; +package org.openpatch.scratch.internal; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -6,6 +6,9 @@ import java.io.File; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URLClassLoader; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; @@ -21,11 +24,39 @@ import javax.tools.StandardJavaFileManager; import javax.tools.ToolProvider; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +/** + * The rewriter behind {@code mvn package -Pnrw} ({@code src/build/NrwVariant.java}). It is a + * build script in the default package, run by the java launcher, so the test compiles and loads + * it itself. + */ class NrwVariantTest { + private static Method rewrite; + private static Method write; + + @BeforeAll + static void compileTheTool(@TempDir Path dir) throws Exception { + assertEquals("", compile(List.of(Path.of("src", "build", "NrwVariant.java")), dir, "")); + ClassLoader loader = new URLClassLoader(new java.net.URL[] {dir.toUri().toURL()}); + Class tool = Class.forName("NrwVariant", true, loader); + rewrite = tool.getMethod("rewrite", String.class, String.class); + write = tool.getMethod("write", Path.class, Path.class); + } + + private static String rewrite(String source, String name) { + try { + return (String) rewrite.invoke(null, source, name); + } catch (InvocationTargetException e) { + throw e.getCause() instanceof RuntimeException r ? r : new IllegalStateException(e.getCause()); + } catch (IllegalAccessException e) { + throw new IllegalStateException(e); + } + } + @Test void swapsTheStandardVersionForTheNrwOne() { String source = String.join("\n", @@ -47,41 +78,45 @@ void swapsTheStandardVersionForTheNrwOne() { " return NrwList.of(sprites);", "", " }", - "}"), NrwVariant.rewrite(source, "A.java")); + "}"), rewrite(source, "A.java")); } @Test void leavesFilesWithoutMarkersAlone() { String source = "class A {\n // a comment\n void a() {}\n}\n"; - assertEquals(source, NrwVariant.rewrite(source, "A.java")); + assertEquals(source, rewrite(source, "A.java")); } @Test void refusesAnUnclosedStandardBlock() { assertThrows(IllegalStateException.class, - () -> NrwVariant.rewrite("// nrw-standard-begin\nclass A {}\n", "A.java")); + () -> rewrite("// nrw-standard-begin\nclass A {}\n", "A.java")); } @Test void refusesAnEndWithoutABeginning() { assertThrows(IllegalStateException.class, - () -> NrwVariant.rewrite("class A {}\n// nrw-standard-end\n", "A.java")); + () -> rewrite("class A {}\n// nrw-standard-end\n", "A.java")); } /** - * Builds the NRW library from the real sources and compiles a student's - * program against it, with the Abitur's List in the default package. This is - * what a teacher gets from the nrw jar, so it is what has to keep working. + * Builds the NRW library from the real sources and compiles a student's program against it, + * with the Abitur's List in the default package. This is what a teacher gets from the nrw jar, + * so it is what has to keep working. */ @Test - void studentsGetTheAbiturListFromTheNrwBuild(@TempDir Path dir) throws IOException { + void studentsGetTheAbiturListFromTheNrwBuild(@TempDir Path dir) throws Exception { Path sources = dir.resolve("nrw-sources"); - NrwVariant.write(Path.of("src", "main", "java"), sources); + write.invoke(null, Path.of("src", "main", "java"), sources); Path library = dir.resolve("library"); List libraryFiles; try (Stream walk = Files.walk(sources)) { - libraryFiles = walk.filter(p -> p.toString().endsWith(".java")).collect(Collectors.toList()); + // compiled on the classpath, as the tests run: module-info would ask for a module path + libraryFiles = walk + .filter(p -> p.toString().endsWith(".java")) + .filter(p -> !p.getFileName().toString().equals("module-info.java")) + .collect(Collectors.toList()); } assertEquals("", compile(libraryFiles, library, System.getProperty("java.class.path"))); @@ -131,7 +166,7 @@ private static String compile(List files, Path out, String classpath) thro } return diagnostics.getDiagnostics().stream() .filter(d -> d.getKind() == Diagnostic.Kind.ERROR) - .map(d -> d.getSource().getName().replaceAll(".*/", "") + .map(d -> (d.getSource() == null ? "" : d.getSource().getName().replaceAll(".*/", "")) + ":" + d.getLineNumber() + " " + d.getMessage(Locale.ENGLISH)) .limit(6) .collect(Collectors.joining("\n")); diff --git a/core/src/test/java/org/openpatch/scratch/internal/ReleaseTest.java b/core/src/test/java/org/openpatch/scratch/internal/ReleaseTest.java new file mode 100644 index 00000000..0e0676c2 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/ReleaseTest.java @@ -0,0 +1,44 @@ +package org.openpatch.scratch.internal; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import java.nio.file.Path; +import org.junit.jupiter.api.Test; + +class ReleaseTest { + + @Test + void boxTextHasNothingTinyfdOrZenityRefuses() { + String text = Release.boxText("Error in Outer$Inner.run: Cannot invoke \"String.length()\" because \"\" " + + "is null; it's `x` & y"); + for (char refused : new char[] {'"', '\'', '`', '<', '>', '&', '$'}) { + assertFalse(text.indexOf(refused) >= 0, "contains " + refused + ": " + text); + } + } + + @Test + void boxTextIsWrappedAtSpacesAndSlashes() { + assertEquals("one two\nthree", Release.wrap("one two three", 8)); + assertEquals("/home/ada/\n.local/\nlatest.log", Release.wrap("/home/ada/.local/latest.log", 11)); + assertEquals("abcdef\nghij", Release.wrap("abcdefghij", 6)); + assertEquals("a\n\nb", Release.wrap("a\n\nb", 6)); + } + + @Test + void logsLiveWhereSavesLive() { + Path home = Path.of("/home/ada"); + assertEquals(Path.of("/data"), Release.dataFolder("Linux", home, null, "/data")); + assertEquals(home.resolve(".local/share"), Release.dataFolder("Linux", home, null, "relative")); + assertEquals(home.resolve("Library/Application Support"), Release.dataFolder("Mac OS X", home, null, null)); + assertEquals(Path.of("/C/Users/ada/AppData/Local"), + Release.dataFolder("Windows 11", home, "/C/Users/ada/AppData/Local", null)); + } + + @Test + void aGameNameBecomesAFolderName() { + assertEquals("My_Game", Release.safe("My Game")); + assertEquals("__x", Release.safe("../x")); // no way out of the logs folder + assertEquals("game", Release.safe(" ")); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/audio/AudioEngineTest.java b/core/src/test/java/org/openpatch/scratch/internal/audio/AudioEngineTest.java new file mode 100644 index 00000000..a66fa5b6 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/audio/AudioEngineTest.java @@ -0,0 +1,37 @@ +package org.openpatch.scratch.internal.audio; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +/** + * Plays for real where there is a device (a developer's machine) and checks the silent mode where + * there is none (CI); never fails for lack of a device. + */ +class AudioEngineTest { + + @Test + void playsOverlappingCopiesOrStaysSilent() throws Exception { + AudioEngine engine = AudioEngine.get(); + SoundData data = SoundData.load("sounds/impact/impactMining_002.ogg"); + int buffer = engine.buffer(data); + if (engine.isSilent()) { + assertEquals(0, buffer); + assertEquals(0, engine.play(buffer, 1, false)); + assertFalse(engine.isPlaying(0)); + return; + } + assertEquals(buffer, engine.buffer(data), "uploaded once"); + engine.setMasterVolume(0.05); // quiet: this runs on developers' machines + int a = engine.play(buffer, 1, false), b = engine.play(buffer, 1, false); + assertTrue(engine.isPlaying(a) && engine.isPlaying(b), "two copies at once"); + engine.stop(a); + assertFalse(engine.isPlaying(a)); + assertTrue(engine.isPlaying(b)); + engine.stopAll(); + assertFalse(engine.isPlaying(b)); + engine.setMasterVolume(1); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/audio/SoundDataTest.java b/core/src/test/java/org/openpatch/scratch/internal/audio/SoundDataTest.java new file mode 100644 index 00000000..c0b59ca2 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/audio/SoundDataTest.java @@ -0,0 +1,150 @@ +package org.openpatch.scratch.internal.audio; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; +import org.junit.jupiter.api.Test; + +/** Decoding only, no audio device needed. */ +class SoundDataTest { + + @Test + void decodes16BitStereo() throws IOException { + byte[] samples = new byte[4800]; // 1200 frames, 2 channels, 2 bytes each + for (int i = 0; i < samples.length; i++) { + samples[i] = (byte) (i * 31); + } + SoundData data = SoundData.decode(wav(1, 2, 48000, 16, samples), "stereo.wav"); + assertEquals(2, data.channels()); + assertEquals(16, data.bits()); + assertEquals(48000, data.sampleRate()); + assertEquals(samples.length / (2 * 2 * 48000.0), data.seconds(), 1e-9); + assertArrayEquals(samples, data.pcm()); + } + + @Test + void decodes8BitMono() throws IOException { + byte[] samples = new byte[2205]; // a tenth of a second + SoundData data = SoundData.decode(wav(1, 1, 22050, 8, samples), "mono.wav"); + assertEquals(1, data.channels()); + assertEquals(8, data.bits()); + assertEquals(22050, data.sampleRate()); + assertEquals(samples.length / (1 * 22050 * 1.0), data.seconds(), 1e-9); + assertArrayEquals(samples, data.pcm()); + } + + @Test + void skipsUnknownChunks() throws IOException { + byte[] samples = new byte[16]; + ByteArrayOutputStream body = new ByteArrayOutputStream(); + // odd body: the parser must skip the 3 bytes and the pad byte behind them + writeChunk(body, "LIST", new byte[3]); + writeChunk(body, "fmt ", fmt(1, 1, 44100, 16)); + writeChunk(body, "data", samples); + SoundData data = SoundData.decode(riff(body.toByteArray()), "with-list.wav"); + assertEquals(1, data.channels()); + assertEquals(16, data.bits()); + assertEquals(44100, data.sampleRate()); + assertArrayEquals(samples, data.pcm()); + } + + @Test + void rejectsFloatWav() { + byte[] samples = new byte[8]; + IOException e = assertThrows(IOException.class, + () -> SoundData.decode(wav(3, 2, 48000, 16, samples), "float.wav")); + assertTrue(e.getMessage().contains("float.wav"), e.getMessage()); + } + + @Test + void rejectsUnknownFormat() { + IOException e = assertThrows(IOException.class, + () -> SoundData.decode(new byte[] {1, 2, 3, 4, 5}, "bogus.txt")); + assertTrue(e.getMessage().contains("bogus.txt"), e.getMessage()); + assertTrue(e.getMessage().contains("only WAV (PCM) and OGG sounds are supported"), e.getMessage()); + } + + @Test + void decodesEveryShippedOgg() throws IOException { + List oggs = new ArrayList<>(); + try (Stream paths = Files.walk(Path.of("src/main/resources/sounds"))) { + paths.filter(path -> path.toString().endsWith(".ogg")).forEach(oggs::add); + } + assertTrue(oggs.size() >= 100, "expected at least 100 built-in sounds, found " + oggs.size()); + for (Path ogg : oggs) { + SoundData data = SoundData.decode(Files.readAllBytes(ogg), ogg.toString()); + assertTrue(data.channels() == 1 || data.channels() == 2, ogg + ": channels " + data.channels()); + assertTrue(data.sampleRate() > 0, ogg + ": sample rate " + data.sampleRate()); + assertTrue(data.seconds() > 0, ogg + ": seconds " + data.seconds()); + } + } + + @Test + void decodesBumpWav() throws IOException { + Path bump = Path.of("../examples/src/main/java/reference/assets/bump.wav"); + SoundData data = SoundData.decode(Files.readAllBytes(bump), bump.toString()); + assertEquals(16, data.bits()); + assertEquals(2, data.channels()); + assertEquals(48000, data.sampleRate()); + } + + // ---- WAV builders ----------------------------------------------------------- + + /** A minimal RIFF/WAVE file: a fmt chunk and a data chunk around {@code samples}. */ + private static byte[] wav(int formatTag, int channels, int rate, int bits, byte[] samples) { + ByteArrayOutputStream body = new ByteArrayOutputStream(); + writeChunk(body, "fmt ", fmt(formatTag, channels, rate, bits)); + writeChunk(body, "data", samples); + return riff(body.toByteArray()); + } + + private static byte[] riff(byte[] body) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + out.writeBytes("RIFF".getBytes(StandardCharsets.US_ASCII)); + le32(out, 4 + body.length); // "WAVE" plus every chunk + out.writeBytes("WAVE".getBytes(StandardCharsets.US_ASCII)); + out.writeBytes(body); + return out.toByteArray(); + } + + private static void writeChunk(ByteArrayOutputStream out, String id, byte[] chunkBody) { + out.writeBytes(id.getBytes(StandardCharsets.US_ASCII)); + le32(out, chunkBody.length); + out.writeBytes(chunkBody); + if (chunkBody.length % 2 == 1) { + out.write(0); // chunks are word aligned, as the parser expects + } + } + + private static byte[] fmt(int formatTag, int channels, int rate, int bits) { + ByteArrayOutputStream fmt = new ByteArrayOutputStream(); + le16(fmt, formatTag); + le16(fmt, channels); + le32(fmt, rate); + le32(fmt, rate * channels * bits / 8); // byte rate + le16(fmt, channels * bits / 8); // block align + le16(fmt, bits); + return fmt.toByteArray(); + } + + private static void le16(ByteArrayOutputStream out, int value) { + out.write(value & 0xFF); + out.write((value >> 8) & 0xFF); + } + + private static void le32(ByteArrayOutputStream out, int value) { + for (int i = 0; i < 4; i++) { + out.write((value >> (8 * i)) & 0xFF); + } + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/draw/EffectsTest.java b/core/src/test/java/org/openpatch/scratch/internal/draw/EffectsTest.java new file mode 100644 index 00000000..af1d113f --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/draw/EffectsTest.java @@ -0,0 +1,59 @@ +package org.openpatch.scratch.internal.draw; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +/** + * The colour effect on the CPU, which must match Scratch's own shader (sprite.frag in + * scratch-render): too dark or too grey to carry a hue gets a little forced onto it, so the + * shift is visible on white and black too. + */ +class EffectsTest { + + private static final int WHITE = 0xffffffff; + private static final int BLACK = 0xff000000; + private static final int GREY = 0xff808080; + private static final int RED = 0xffff0000; + + @Test + void noEffectLeavesEveryColourAlone() { + Effects none = new Effects(0, 0, 0xffffffff); + assertEquals(WHITE, none.apply(WHITE)); + assertEquals(BLACK, none.apply(BLACK)); + assertEquals(GREY, none.apply(GREY)); + assertEquals(RED, none.apply(RED)); + } + + @Test + void aThirdOfTheWheelTurnsRedIntoGreen() { + Effects e = new Effects(200.0 / 3, 0, 0xffffffff); + assertEquals(0xff00ff00, e.apply(RED)); + } + + @Test + void whitePicksUpAFaintColourLikeScratch() { + // Scratch forces white to 9% saturation before the turn: a quarter round gives (244, 255, 232) + Effects e = new Effects(50, 0, 0xffffffff); + assertEquals(0xfff4ffe8, e.apply(WHITE)); + } + + @Test + void greyPicksUpAFaintColourLikeScratch() { + Effects e = new Effects(50, 0, 0xffffffff); + int out = e.apply(GREY); + assertEquals(122, (out >> 16) & 0xff, "grey keeps its brightness in red"); + assertEquals(128, (out >> 8) & 0xff, "grey keeps its brightness in green"); + assertEquals(116, out & 0xff, "grey keeps its brightness in blue"); + } + + @Test + void blackPicksUpAFaintColourLikeScratch() { + // Scratch lifts black to (hue 0, full saturation, 5.5% brightness) before the turn + Effects e = new Effects(50, 0, 0xffffffff); + int out = e.apply(BLACK); + assertEquals(7, (out >> 16) & 0xff, "a quarter round from red is green sector"); + assertEquals(14, (out >> 8) & 0xff); + assertEquals(0, out & 0xff); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/geom/GeometryTest.java b/core/src/test/java/org/openpatch/scratch/internal/geom/GeometryTest.java new file mode 100644 index 00000000..0fae2b42 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/geom/GeometryTest.java @@ -0,0 +1,125 @@ +package org.openpatch.scratch.internal.geom; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.Circle; +import org.openpatch.scratch.Polygon; +import org.openpatch.scratch.Rectangle; +import org.openpatch.scratch.Shape; + +class GeometryTest { + + /** An L: the 10×10 square from (0, 0) without its top-right 5×5 quarter. */ + static Polygon ell() { + return new Polygon(new double[] {0, 10, 10, 5, 5, 0}, new double[] {0, 0, 5, 5, 10, 10}); + } + + @Test + void squaresSharingAnEdgeDoNotIntersect() { + assertFalse(new Rectangle(0, 0, 10, 10).intersects(new Rectangle(10, 0, 10, 10))); + } + + @Test + void squaresSharingACornerDoNotIntersect() { + assertFalse(new Rectangle(0, 0, 10, 10).intersects(new Rectangle(10, 10, 10, 10))); + } + + @Test + void overlappingAndIdenticalSquaresIntersect() { + assertTrue(new Rectangle(0, 0, 10, 10).intersects(new Rectangle(9.5, 9.5, 10, 10))); + assertTrue(new Rectangle(0, 0, 10, 10).intersects(new Rectangle(0, 0, 10, 10))); + } + + @Test + void aSquareInTheNotchOfAnLDoesNotIntersectIt() { + assertFalse(ell().intersects(new Rectangle(6, 6, 3, 3))); + assertFalse(new Rectangle(6, 6, 3, 3).intersects(ell())); + } + + @Test + void aSquarePushedIntoTheArmOfAnLIntersectsIt() { + assertTrue(ell().intersects(new Rectangle(6, 4.5, 3, 3))); + } + + @Test + void aSquareLyingOnTheEdgeOfTheNotchDoesNotIntersect() { + assertFalse(ell().intersects(new Rectangle(6, 5, 3, 3))); + assertFalse(ell().intersects(new Rectangle(5, 6, 3, 3))); + } + + @Test + void aCircleTouchingASquareAtOnePointDoesNotIntersect() { + // the flattened circle has a corner at (15, 5) + assertFalse(new Circle(20, 5, 5).intersects(new Rectangle(5, 0, 10, 10))); + assertTrue(new Circle(19, 5, 5).intersects(new Rectangle(5, 0, 10, 10))); + } + + @Test + void trianglesCoverAConcavePolygonInEitherWinding() { + double[] ring = ell().getPoints(); + double[] reversed = new double[ring.length]; + for (int i = 0; i < ring.length; i += 2) { + reversed[ring.length - 2 - i] = ring[i]; + reversed[ring.length - 1 - i] = ring[i + 1]; + } + for (double[] r : new double[][] {ring, reversed}) { + double area = 0; + for (double[] t : Geometry.triangulate(r)) { + area += Math.abs(Geometry.signedArea(t)); + } + assertEquals(75, area, 1e-9); + } + } + + @Test + void ellipsesStayWithinAQuarterPixel() { + for (double r : new double[] {5, 100, 1000}) { + double[] ring = Geometry.ellipse(0, 0, r, r); + int n = ring.length / 2; + // the worst point of a chord is its middle + double mx = (ring[0] + ring[2]) / 2, my = (ring[1] + ring[3]) / 2; + assertTrue(r - Math.hypot(mx, my) <= 0.25 + 1e-9, "radius " + r + " with " + n + " segments"); + } + } + + @Test + void rotatingAQuarterTurnAboutAPoint() { + Shape s = new Rectangle(10, 0, 2, 1).rotate(90, 0, 0); + assertEquals(-1, s.getBounds().x(), 1e-9); + assertEquals(10, s.getBounds().y(), 1e-9); + assertEquals(1, s.getBounds().width(), 1e-9); + assertEquals(2, s.getBounds().height(), 1e-9); + } + + @Test + void mirroringFlipsTheBounds() { + Shape s = new Rectangle(2, 0, 3, 1).scale(-1, 1); + assertEquals(-5, s.getBounds().x(), 1e-9); + assertEquals(3, s.getBounds().width(), 1e-9); + } + + @Test + void theNotchOfAnLIsOutside() { + assertFalse(ell().contains(7, 7)); + assertTrue(ell().contains(2, 8)); + assertTrue(ell().contains(8, 2)); + } + + @Test + void convexityIgnoresStraightPoints() { + assertTrue(Geometry.isConvex(new double[] {0, 0, 5, 0, 10, 0, 10, 10, 0, 10})); + assertFalse(Geometry.isConvex(ell().getPoints())); + } + + @Test + void ellipseBoundsAreExact() { + var b = new org.openpatch.scratch.Ellipse(0, 0, 10, 20).getBounds(); + assertEquals(0, b.x(), 1e-9); + assertEquals(0, b.y(), 1e-9); + assertEquals(10, b.width(), 1e-9); + assertEquals(20, b.height(), 1e-9); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/image/BuiltinAssetsTest.java b/core/src/test/java/org/openpatch/scratch/internal/image/BuiltinAssetsTest.java new file mode 100644 index 00000000..4327427d --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/image/BuiltinAssetsTest.java @@ -0,0 +1,51 @@ +package org.openpatch.scratch.internal.image; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.BuiltinAssets; +import org.openpatch.scratch.internal.audio.SoundData; + +/** Built-in sprites and sounds by name, without Jackson. */ +class BuiltinAssetsTest { + + @Test + void theAtlasesAreRead() { + assertTrue(BuiltinAssets.getNames().size() > 300, "names: " + BuiltinAssets.getNames().size()); + BuiltinAssets.Entry slime = BuiltinAssets.get("slimeGreen"); + assertNotNull(slime); + assertEquals(slime, BuiltinAssets.get(slime.sheet() + "/slimeGreen")); + } + + @Test + void aBuiltinNameLoadsItsRegionOfTheSheet() { + BuiltinAssets.Entry e = BuiltinAssets.get("slimeGreen"); + Image image = Images.load("slimeGreen"); + boolean turned = ((e.direction() % 180) + 180) % 180 == 0; + assertEquals(turned ? e.height() : e.width(), image.getWidth()); + } + + @Test + void aMistypedNameGetsSuggestions() { + IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, () -> Images.load("slimeGren")); + assertTrue(ex.getMessage().contains("Did you mean"), ex.getMessage()); + } + + @Test + void turningToFaceRight() { + Image up = new Image(1, 2, new int[] {1, 2}); // drawn facing up: top pixel 1 + Image right = Images.turnToFaceRight(up, 0); + assertEquals(2, right.getWidth()); + assertEquals(1, right.get(1, 0), "the top edge becomes the right edge"); + } + + @Test + void builtinSoundsLoadByName() { + String name = org.openpatch.scratch.internal.BuiltinSounds.getNames().get(0); + SoundData data = SoundData.load(name); + assertTrue(data.seconds() > 0, name); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/image/ImageTest.java b/core/src/test/java/org/openpatch/scratch/internal/image/ImageTest.java new file mode 100644 index 00000000..d25cae15 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/image/ImageTest.java @@ -0,0 +1,109 @@ +package org.openpatch.scratch.internal.image; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; +import javax.imageio.ImageIO; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +class ImageTest { + + @Test + void aPngWrittenAndReadKeepsEveryPixelIncludingAlpha(@TempDir Path dir) throws IOException { + Image image = new Image(3, 2, new int[] {0xff112233, 0x80445566, 0x00000000, 0xffffffff, 0x01020304, 0xff000000}); + Path file = dir.resolve("out/test.png"); + image.writePng(file); + Image back = Image.decode(Files.readAllBytes(file), "test.png"); + assertEquals(3, back.getWidth()); + assertArrayEquals(image.getArgb(), back.getArgb()); + } + + @Test + void regionsAndMirrors() { + Image image = new Image(2, 2, new int[] {1, 2, 3, 4}); + assertArrayEquals(new int[] {2, 4}, image.region(1, 0, 1, 2).getArgb()); + assertArrayEquals(new int[] {2, 1, 4, 3}, image.mirrorX().getArgb()); + assertArrayEquals(new int[] {4, 0}, image.region(1, 1, 2, 1).getArgb(), "outside is transparent"); + } + + @Test + void garbageIsReportedWithAReason() { + IOException e = assertThrows(IOException.class, () -> Image.decode(new byte[] {1, 2, 3}, "garbage.png")); + assertTrue(e.getMessage().startsWith("Could not decode garbage.png: "), e.getMessage()); + } + + @Test + void imagesAreLoadedOnceAndMissingOnesNamed() { + assertSame(Images.load("costumes/red10.png"), Images.load("costumes/red10.png")); + IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> Images.load("nope.png")); + assertTrue(e.getMessage().contains("nope.png")); + } + + /** + * Every bundled image and demo asset decodes the same with stb_image as with + * ImageIO (PNG exactly, JPEG within a small tolerance), so the switch changes no costume. + */ + @Test + void everyBundledImageDecodesAsImageIoDecodesIt() throws IOException { + List problems = new ArrayList<>(); + int checked = 0, skipped = 0; + for (Path root : new Path[] {Path.of("src/main/resources"), Path.of("../examples/src/main/java")}) { + if (!Files.isDirectory(root)) { + continue; + } + List files; + try (Stream walk = Files.walk(root)) { + files = walk.filter(f -> f.toString().matches("(?i).*\\.(png|jpe?g|gif|bmp)")).sorted().toList(); + } + for (Path f : files) { + BufferedImage reference = ImageIO.read(f.toFile()); + if (reference == null) { + skipped++; + continue; + } + Image mine = Image.decode(Files.readAllBytes(f), f.toString()); + checked++; + if (mine.getWidth() != reference.getWidth() || mine.getHeight() != reference.getHeight()) { + problems.add(f + ": size " + mine.getWidth() + "x" + mine.getHeight()); + continue; + } + boolean jpeg = f.toString().toLowerCase().matches(".*\\.jpe?g"); + int[] theirs = reference.getRGB(0, 0, reference.getWidth(), reference.getHeight(), null, 0, + reference.getWidth()); + int worst = 0, at = -1; + for (int i = 0; i < theirs.length; i++) { + int a = mine.getArgb()[i], b = theirs[i]; + if ((a >>> 24) == 0 && (b >>> 24) == 0) { + continue; // invisible: the colour does not matter + } + int diff = 0; + for (int shift = 0; shift < 32; shift += 8) { + diff = Math.max(diff, Math.abs(((a >>> shift) & 0xff) - ((b >>> shift) & 0xff))); + } + if (diff > worst) { + worst = diff; + at = i; + } + } + if (worst > (jpeg ? 3 : 0)) { + problems.add(String.format("%s: pixel %d differs by %d (stb %08x, ImageIO %08x)", f, at, worst, + mine.getArgb()[at], theirs[at])); + } + } + } + System.out.printf("image parity: %d files compared, %d ImageIO could not read%n", checked, skipped); + assertTrue(checked > 100, "found only " + checked + " images"); + assertTrue(problems.isEmpty(), String.join("\n", problems)); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/image/ImageTurnTest.java b/core/src/test/java/org/openpatch/scratch/internal/image/ImageTurnTest.java new file mode 100644 index 00000000..ee984aa3 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/image/ImageTurnTest.java @@ -0,0 +1,86 @@ +package org.openpatch.scratch.internal.image; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.util.Arrays; + +import org.junit.jupiter.api.Test; + +class ImageTurnTest { + + private static final int NOSE = 0xffff0000; + private static final int BODY = 0xff0000ff; + + /** + * A 3 wide, 2 high arrow: the nose pixel sits in the middle of the given edge, everything else is + * body. + */ + private static Image arrow(String nose) { + int[] pixels = new int[3 * 2]; + Arrays.fill(pixels, BODY); + switch (nose) { + case "up" -> pixels[1] = NOSE; + case "down" -> pixels[3 + 1] = NOSE; + case "left" -> pixels[0] = NOSE; + default -> throw new IllegalArgumentException(nose); + } + return new Image(3, 2, pixels); + } + + private static int at(Image image, int x, int y) { + return image.get(x, y); + } + + @Test + void aPictureFacingRightIsLeftAlone() { + Image image = arrow("left"); + assertSame(image, Images.turnToFaceRight(image, 90)); + } + + @Test + void aPictureFacingUpIsTurnedClockwise() { + Image turned = Images.turnToFaceRight(arrow("up"), 0); + + assertEquals(2, turned.getWidth()); + assertEquals(3, turned.getHeight()); + // the nose was in the middle of the top edge, now of the right one + assertEquals(NOSE, at(turned, 1, 1)); + assertEquals(BODY, at(turned, 0, 1)); + } + + @Test + void aPictureFacingDownIsTurnedAnticlockwise() { + Image turned = Images.turnToFaceRight(arrow("down"), 180); + + assertEquals(2, turned.getWidth()); + assertEquals(3, turned.getHeight()); + assertEquals(NOSE, at(turned, 1, 1)); + assertEquals(BODY, at(turned, 0, 1)); + } + + @Test + void aPictureFacingLeftIsMirroredNotTurned() { + Image turned = Images.turnToFaceRight(arrow("left"), -90); + + assertEquals(3, turned.getWidth()); + assertEquals(2, turned.getHeight()); + assertEquals(NOSE, at(turned, 2, 0)); + assertEquals(BODY, at(turned, 0, 0)); + // still upright: the bottom row did not move up + assertEquals(BODY, at(turned, 2, 1)); + } + + @Test + void directionsWrapAroundLikeScratchDirections() { + assertEquals(NOSE, at(Images.turnToFaceRight(arrow("left"), 270), 2, 0)); + assertEquals(NOSE, at(Images.turnToFaceRight(arrow("down"), -180), 1, 1)); + assertEquals(NOSE, at(Images.turnToFaceRight(arrow("up"), 360), 1, 1)); + } + + @Test + void aSlantedDirectionIsRefused() { + assertThrows(IllegalArgumentException.class, () -> Images.turnToFaceRight(arrow("up"), 45)); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/loop/GameLoopTest.java b/core/src/test/java/org/openpatch/scratch/internal/loop/GameLoopTest.java new file mode 100644 index 00000000..4390a629 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/loop/GameLoopTest.java @@ -0,0 +1,99 @@ +package org.openpatch.scratch.internal.loop; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.atomic.AtomicReference; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.Sprite; +import org.openpatch.scratch.Stage; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.draw.DrawList; + +/** The threads of the game loop, without a window: the window thread is the test thread here. */ +class GameLoopTest { + + /** Learner code whose run() never returns once told to. */ + static class Hanger extends Sprite { + static volatile boolean hang; + volatile long spins; + + @Override + public void run() { + while (hang) { + this.spins++; // a loop that never ends + } + } + } + + @Test + void aBatchRunsOnTheGameThreadAndHandsBackTheDrawList() { + Game game = Game.headless(480, 360); + AtomicReference thread = new AtomicReference<>(); + Stage stage = new Stage() { + @Override + public void run() { + thread.set(Thread.currentThread().getName()); + } + }; + game.setStage(stage); + GameLoop loop = new GameLoop(game); + loop.start(); + DrawList list = loop.runBatch(3, () -> {}); + assertNotNull(list); + assertEquals(3, list.tick()); + assertEquals("scratch4j-game", thread.get()); + } + + @Test + void aHangingRunIsNamedAndTheWindowThreadKeepsPollingAndCanClose() throws Exception { + Game game = Game.headless(480, 360); + Stage stage = new Stage(); + stage.add(new Hanger()); + game.setStage(stage); + ByteArrayOutputStream err = new ByteArrayOutputStream(); + GameLoop loop = new GameLoop(game, new PrintStream(err, true, StandardCharsets.UTF_8)); + loop.start(); + Hanger.hang = true; + try { + long start = System.nanoTime(); + int[] polls = {0}; + DrawList list = loop.runBatch(1, () -> { + polls[0]++; + String said = err.toString(StandardCharsets.UTF_8); + if (said.contains("has not returned") || System.nanoTime() - start > 5_000_000_000L) { + loop.close(); + } + }); + assertNull(list, "closed while learner code hung"); + assertTrue(polls[0] > 100, "the window thread kept polling: " + polls[0]); + String said = err.toString(StandardCharsets.UTF_8); + assertTrue(said.startsWith("GameLoopTest$Hanger.run (GameLoopTest.java:"), said); + assertTrue(said.contains("Is there a loop that never ends?"), said); + long exitStart = System.nanoTime(); + assertFalse(loop.exit(), "a hanging game thread does not run whenExits"); + long waited = (System.nanoTime() - exitStart) / 1_000_000; + assertTrue(waited >= 900 && waited < 2000, "waited " + waited + " ms"); + } finally { + Hanger.hang = false; + } + } + + @Test + void anIdleGameThreadAnswersTheExitAtOnce() { + Game game = Game.headless(480, 360); + game.setStage(new Stage()); + GameLoop loop = new GameLoop(game); + loop.start(); + loop.runBatch(1, () -> {}); + long start = System.nanoTime(); + assertTrue(loop.exit()); + assertTrue(System.nanoTime() - start < 500_000_000L); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/loop/TickClockTest.java b/core/src/test/java/org/openpatch/scratch/internal/loop/TickClockTest.java new file mode 100644 index 00000000..b5d06844 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/loop/TickClockTest.java @@ -0,0 +1,126 @@ +package org.openpatch.scratch.internal.loop; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Random; +import java.util.function.IntToDoubleFunction; +import org.junit.jupiter.api.Test; + +/** Synthetic frame times through the clock; ported from the spike's TickClockCheck. */ +class TickClockTest { + + /** Ticks per frame (index 0..8) over 10 s of frames. */ + record Run(int frames, int ticks, double seconds, int[] histogram) { + double perSecond() { + return this.ticks / this.seconds; + } + } + + static Run run(TickClock clock, IntToDoubleFunction frameSeconds) { + int[] histogram = new int[TickClock.MAX_TICKS_PER_FRAME + 1]; + int frames = 0, ticks = 0; + double seconds = 0; + while (seconds < 10) { + double elapsed = frameSeconds.applyAsDouble(frames); + int t = clock.advance(elapsed); + histogram[t]++; + ticks += t; + frames++; + seconds += elapsed; + } + return new Run(frames, ticks, seconds, histogram); + } + + static TickClock clock(int hz, double speed) { + TickClock clock = new TickClock(); + clock.useRefreshRate(hz); + clock.setGameSpeed(speed); + return clock; + } + + @Test + void aSixtyHertzScreenRunsOneTickPerFrame() { + Run r = run(clock(60, 1), i -> 1 / 60.0); + assertEquals(r.frames(), r.histogram()[1]); + } + + @Test + void jitterDoesNotGiveDoubleOrEmptyFrames() { + Random random = new Random(1); + Run r = run(clock(60, 1), i -> 1 / 60.0 + (random.nextDouble() - 0.5) * 0.003); + assertEquals(r.frames(), r.histogram()[1]); + } + + @Test + void aScreenReportingSixtyHertzButRunningAt5994GetsOneTickPerFrame() { + Run r = run(clock(60, 1), i -> 1 / 59.94); + assertEquals(r.frames(), r.histogram()[1]); + } + + @Test + void fastScreensStillRunSixtyTicksPerSecond() { + assertEquals(60, run(clock(144, 1), i -> 1 / 144.0).perSecond(), 1); + assertEquals(60, run(clock(120, 1), i -> 1 / 120.0).perSecond(), 1); + } + + @Test + void slowMachinesCatchUp() { + Run r = run(clock(60, 1), i -> 1 / 20.0); + assertEquals(r.frames(), r.histogram()[3]); + assertEquals(60, r.perSecond(), 1); + } + + @Test + void beyondEightTicksPerFrameTheGameSlowsDown() { + Run r = run(clock(60, 1), i -> 1 / 5.0); + assertEquals(r.frames(), r.histogram()[8]); + assertTrue(r.perSecond() < 60); + } + + @Test + void gameSpeedChangesTheNumberOfTicksNotTheirLength() { + assertEquals(120, run(clock(60, 2), i -> 1 / 60.0).perSecond(), 1); + assertEquals(30, run(clock(60, 0.5), i -> 1 / 60.0).perSecond(), 1); + assertEquals(0, run(clock(60, 0), i -> 1 / 60.0).ticks()); + } + + @Test + void aLongFrameCountsAsAQuarterSecondAtMost() { + TickClock clock = clock(60, 1); + assertEquals(8, clock.advance(5.0)); + // the rest of the 0.25 s is dropped, apart from at most one tick + assertTrue(clock.advance(1 / 60.0) <= 2); + } + + @Test + void pausedRunsNothingButStepRunsOneTick() { + TickClock clock = clock(60, 1); + clock.setPaused(true); + assertEquals(0, clock.advance(1 / 60.0)); + clock.step(); + assertEquals(1, clock.advance(1 / 60.0)); + assertEquals(0, clock.advance(1 / 60.0)); + clock.setPaused(false); + assertEquals(1, clock.advance(1 / 60.0)); + } + + @Test + void settingTheSamePauseStateEveryFrameKeepsTheOwedTime() { + // the window passes the game's pause flag every frame; tiny frames must still add up + TickClock clock = clock(60, 1); + int ticks = 0; + for (int i = 0; i < 1000; i++) { + clock.setPaused(false); + ticks += clock.advance(0.001); + } + assertEquals(60, ticks); + } + + @Test + void gameSpeedIsLimited() { + assertThrows(IllegalArgumentException.class, () -> new TickClock().setGameSpeed(9)); + assertThrows(IllegalArgumentException.class, () -> new TickClock().setGameSpeed(-1)); + } +} diff --git a/core/src/test/java/org/openpatch/scratch/internal/text/TextEngineTest.java b/core/src/test/java/org/openpatch/scratch/internal/text/TextEngineTest.java new file mode 100644 index 00000000..f5cf0f84 --- /dev/null +++ b/core/src/test/java/org/openpatch/scratch/internal/text/TextEngineTest.java @@ -0,0 +1,122 @@ +package org.openpatch.scratch.internal.text; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.List; +import org.junit.jupiter.api.Test; + +/** Fonts, line breaking and layout without a window. */ +class TextEngineTest { + + static final String SAMPLE = "Jörg fährt größere Straßen – „Hallo“ … 12,50 € 90° ÄÖÜ ß. " + + "Supercalifragilisticexpialidocious-wordthatistoolong"; + + /** Monospace: every codepoint 1 wide, no kerning. */ + static List lines(String text, double maxWidth) { + return LineBreaker.breakLines(text, maxWidth, (cps, from, to) -> to - from).stream() + .map(cps -> new String(cps, 0, cps.length)).toList(); + } + + @Test + void fontMetricsComeFromTheFile() { + Font ubuntu = Font.defaultFont(), jersey = Font.pixelArtFont(); + assertEquals(1000, ubuntu.getUnitsPerEm()); + assertEquals(1, ubuntu.getPixelGrid()); + assertFalse(ubuntu.isPixelFont()); + assertEquals(1400, jersey.getUnitsPerEm()); + assertEquals(75, jersey.getPixelGrid()); + assertEquals(7.0, ubuntu.advance('a', 14), 1e-9, "monospace: 500 of 1000 units"); + assertEquals(ubuntu.lineHeight(14), (ubuntu.getAscent() - ubuntu.getDescent() + ubuntu.getLineGap()) * 0.014, 1e-9); + } + + @Test + void pixelFontSizesRoundToWholeFontPixels() { + Font jersey = Font.pixelArtFont(); + assertEquals(18.6667, jersey.roundToPixelGrid(20), 1e-3); + assertEquals(37.3333, jersey.roundToPixelGrid(30), 1e-3); + assertEquals(18.6667, jersey.roundToPixelGrid(1), 1e-3, "at least one font pixel"); + assertEquals(14, Font.defaultFont().roundToPixelGrid(14), 1e-9, "not a pixel font"); + assertEquals(20, jersey.withPixelGrid(140).roundToPixelGrid(15), 1e-9, "1400 / 140 = a font pixel of 10"); + } + + @Test + void aMissingFontIsReported() { + assertThrows(IllegalArgumentException.class, () -> Font.load("no/such/font.ttf")); + } + + @Test + void linesBreakAtSpacesWhichBelongToNoLine() { + assertEquals(List.of("aaa bbb", "ccc"), lines("aaa bbb ccc", 8)); + assertEquals(List.of("aaa", "bbb"), lines("aaa bbb", 4)); + assertEquals(List.of("aaa bbb ccc"), lines("aaa bbb ccc", 0), "no wrapping"); + } + + @Test + void newlinesAlwaysBreak() { + assertEquals(List.of("a", "", "b"), lines("a\n\nb", 100)); + assertEquals(List.of(""), lines("", 10)); + } + + @Test + void linesBreakAfterHyphens() { + assertEquals(List.of("well-", "known"), lines("well-known", 7)); + } + + @Test + void aLongWordBreaksBetweenLettersButAHyphenNeverStartsALine() { + assertEquals(List.of("abcd", "efgh", "ij"), lines("abcdefghij", 4)); + // "abcd" fits, but "-" would start the next line: break one letter earlier + assertEquals(List.of("abc", "d-ef"), lines("abcd-ef", 4)); + assertEquals(List.of("abc", "d-", "efgh"), lines("abcd-efgh", 4)); + assertEquals(List.of("a", "b"), lines("ab", 0.5), "at least one character per line"); + } + + @Test + void layoutDoesNotDependOnAnythingButTextFontSizeAndWidth() { + Font ubuntu = Font.defaultFont(); + TextLayout a = TextLayout.of(SAMPLE, ubuntu, 14, 220); + assertSame(a, TextLayout.of(SAMPLE, ubuntu, 14, 220), "cached"); + assertEquals(4, a.lines().size()); + assertEquals("Supercalifragilisticexpialidoci", a.lines().get(2).text()); + assertEquals(a.lines().size() * ubuntu.lineHeight(14), a.height(), 1e-9); + for (TextLayout.Line line : a.lines()) { + assertTrue(line.width() <= 220, line.text()); + } + TextLayout jersey = TextLayout.of(SAMPLE, Font.pixelArtFont(), 18.6667, 220); + assertTrue(jersey.lines().stream().noneMatch(l -> l.text().startsWith("-")), "no line starts with a hyphen"); + } + + @Test + void aGlyphMissingInTheFontComesFromTheFallback() { + Font jersey = Font.pixelArtFont(), ubuntu = Font.defaultFont(); + int missing = -1; + for (int cp = 0x100; cp < 0x2000; cp++) { + if (!jersey.hasGlyph(cp) && ubuntu.hasGlyph(cp)) { + missing = cp; + break; + } + } + assertTrue(missing > 0, "UbuntuMono covers something Jersey 10 does not"); + TextLayout layout = TextLayout.of("a" + Character.toString(missing), jersey, 18.6667, 0); + assertSame(jersey, layout.lines().get(0).glyphs().get(0).font()); + assertSame(ubuntu, layout.lines().get(0).glyphs().get(1).font()); + } + + @Test + void glyphsAreRasterisedAtDeviceSize() { + Font ubuntu = Font.defaultFont(); + var small = GlyphRasterizer.rasterize(ubuntu, 'A', 14, 0, false); + var large = GlyphRasterizer.rasterize(ubuntu, 'A', 28, 0, false); + assertTrue(Math.abs(large.width() - 2 * small.width()) <= 2, small.width() + " vs " + large.width()); + assertTrue(small.offsetY() < 0, "above the baseline"); + var pixel = GlyphRasterizer.rasterize(Font.pixelArtFont(), 'A', 37.3333, 0.4, true); + for (byte b : pixel.coverage()) { + assertTrue(b == 0 || b == (byte) 255, "pixel art is not smoothed"); + } + assertEquals(0, GlyphRasterizer.rasterize(ubuntu, ' ', 14, 0, false).width()); + } +} diff --git a/core/src/test/resources/costumes/left4.png b/core/src/test/resources/costumes/left4.png new file mode 100644 index 00000000..eea67b4a Binary files /dev/null and b/core/src/test/resources/costumes/left4.png differ diff --git a/core/src/test/resources/costumes/red10.png b/core/src/test/resources/costumes/red10.png new file mode 100644 index 00000000..f36400fe Binary files /dev/null and b/core/src/test/resources/costumes/red10.png differ diff --git a/core/src/test/resources/costumes/sheet.png b/core/src/test/resources/costumes/sheet.png new file mode 100644 index 00000000..05758063 Binary files /dev/null and b/core/src/test/resources/costumes/sheet.png differ diff --git a/core/src/test/resources/costumes/walk1.png b/core/src/test/resources/costumes/walk1.png new file mode 100644 index 00000000..c68cfe14 Binary files /dev/null and b/core/src/test/resources/costumes/walk1.png differ diff --git a/core/src/test/resources/costumes/walk2.png b/core/src/test/resources/costumes/walk2.png new file mode 100644 index 00000000..90ae72df Binary files /dev/null and b/core/src/test/resources/costumes/walk2.png differ diff --git a/core/src/test/resources/costumes/walk3.png b/core/src/test/resources/costumes/walk3.png new file mode 100644 index 00000000..2410a3ac Binary files /dev/null and b/core/src/test/resources/costumes/walk3.png differ diff --git a/core/src/test/resources/costumes/white8.png b/core/src/test/resources/costumes/white8.png new file mode 100644 index 00000000..4f5920c4 Binary files /dev/null and b/core/src/test/resources/costumes/white8.png differ diff --git a/src/test/resources/parity/expected.txt b/core/src/test/resources/parity/expected.txt similarity index 81% rename from src/test/resources/parity/expected.txt rename to core/src/test/resources/parity/expected.txt index a99afd78..7fa6db1d 100644 --- a/src/test/resources/parity/expected.txt +++ b/core/src/test/resources/parity/expected.txt @@ -5,13 +5,13 @@ sprite.y=0.0 sprite.direction=90.0 sprite.size=100.0 sprite.transparency=0.0 -sprite.width=128 -sprite.height=128 -half.width=64 -half.height=64 +sprite.width=128.0 +sprite.height=128.0 +half.width=64.0 +half.height=64.0 half.size=50.0 -turned.width=128 -turned.height=128 +turned.width=128.0 +turned.height=128.0 ghost30=30.0 ghost30plus50=80.0 ghost.clamped.high=100.0 @@ -27,9 +27,9 @@ turnRight60=30.0 directionMinus90=270.0 move10.x=10.0 move10.y=0.0 -hitbox=Bounds[x=-44.0, y=2.0, width=88.0, height=62.0] +hitbox=Bounds[x=-44.0, y=-64.0, width=88.0, height=62.0] hitbox.x=-44.0 -hitbox.y=2.0 +hitbox.y=-64.0 hitbox.width=88.0 hitbox.height=62.0 costume.index=0 @@ -41,11 +41,11 @@ previous.index=1 pen.size=1.0 volume=100.0 stage.volume=100.0 -text.size=14 +text.size=14.0 text.width=200.0 text.align=CENTER text.style=PLAIN -text.defaultSize=14 +text.defaultSize=14.0 count=1 find=1 round=3 @@ -72,7 +72,7 @@ vector.angle=53.13010235415598 vector.unit=Vector2[0.6, 0.8] vector.add=Vector2[4.0, 6.0] vector.dot=11.0 -color=Color[r=255.0, g=128.0, b=0.0] +color=#ff8000 color.red=255.0 color.green=128.0 color.blue=0.0 diff --git a/core/src/test/resources/shaders/pixelate.frag b/core/src/test/resources/shaders/pixelate.frag new file mode 100644 index 00000000..bd29a682 --- /dev/null +++ b/core/src/test/resources/shaders/pixelate.frag @@ -0,0 +1,6 @@ +uniform float blocks; + +void main() { + vec2 p = floor(uv * blocks) / blocks; + color = texture(costume, p); +} diff --git a/docs/archives/Halloween/GhostSprite.java b/docs/archives/Halloween/GhostSprite.java index 02310c8b..1a813a1d 100644 --- a/docs/archives/Halloween/GhostSprite.java +++ b/docs/archives/Halloween/GhostSprite.java @@ -1,7 +1,7 @@ import org.openpatch.scratch.KeyCode; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; -public class GhostSprite extends AnimatedSprite { +public class GhostSprite extends Sprite { private int speed = 8; diff --git a/docs/archives/Halloween/HalloweenStage.java b/docs/archives/Halloween/HalloweenStage.java index 321a2cb9..57723456 100644 --- a/docs/archives/Halloween/HalloweenStage.java +++ b/docs/archives/Halloween/HalloweenStage.java @@ -20,6 +20,7 @@ public HalloweenStage() { } this.ghost = new GhostSprite(); this.add(this.ghost); + this.addSound("bg", "sounds/background.wav"); } public void run() { diff --git a/docs/archives/Halloween/PumpkinSprite.java b/docs/archives/Halloween/PumpkinSprite.java index eaa40363..d425a20b 100644 --- a/docs/archives/Halloween/PumpkinSprite.java +++ b/docs/archives/Halloween/PumpkinSprite.java @@ -1,12 +1,12 @@ -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; -public class PumpkinSprite extends AnimatedSprite { +public class PumpkinSprite extends Sprite { public PumpkinSprite() { this.addAnimation("idle", "sprites/pumpkin/pumpkin_%02d.png", 2); - this.setAnimationInterval(this.pickRandom(300, 380)); + this.setAnimationInterval((this.pickRandom(300, 380)) / 1000.0); this.setSize(this.pickRandom(5, 15)); - this.setTint(this.pickRandom(0, 255)); + this.setColorEffect(this.pickRandom(0, 200)); this.setX(this.pickRandom(-200, 200)); this.setY(this.pickRandom(-200, 200)); } diff --git a/docs/archives/Halloween/package.bluej b/docs/archives/Halloween/package.bluej deleted file mode 100644 index e4ff3d02..00000000 --- a/docs/archives/Halloween/package.bluej +++ /dev/null @@ -1,62 +0,0 @@ -#BlueJ package file -dependency1.from=HalloweenStage -dependency1.to=HouseSprite -dependency1.type=UsesDependency -dependency2.from=HalloweenStage -dependency2.to=GhostSprite -dependency2.type=UsesDependency -dependency3.from=HalloweenStage -dependency3.to=PumpkinSprite -dependency3.type=UsesDependency -editor.fx.0.height=0 -editor.fx.0.width=0 -editor.fx.0.x=0 -editor.fx.0.y=0 -objectbench.height=98 -objectbench.width=487 -package.divider.horizontal=0.5995145631067961 -package.divider.vertical=0.8892405063291139 -package.editor.height=836 -package.editor.width=693 -package.editor.x=994 -package.editor.y=32 -package.frame.height=1048 -package.frame.width=844 -package.numDependencies=3 -package.numTargets=4 -package.showExtends=true -package.showUses=true -project.charset=UTF-8 -readme.height=60 -readme.name=@README -readme.width=49 -readme.x=10 -readme.y=10 -target1.height=50 -target1.name=HalloweenStage -target1.showInterface=false -target1.type=ClassTarget -target1.width=150 -target1.x=190 -target1.y=160 -target2.height=50 -target2.name=PumpkinSprite -target2.showInterface=false -target2.type=ClassTarget -target2.width=140 -target2.x=340 -target2.y=440 -target3.height=50 -target3.name=HouseSprite -target3.showInterface=false -target3.type=ClassTarget -target3.width=120 -target3.x=340 -target3.y=310 -target4.height=50 -target4.name=GhostSprite -target4.showInterface=false -target4.type=ClassTarget -target4.width=110 -target4.x=340 -target4.y=380 diff --git a/docs/archives/bluej-starter/+libs/.gitkeep b/docs/archives/bluej-starter/+libs/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/bluej-starter/Cat.java b/docs/archives/bluej-starter/Cat.java deleted file mode 100644 index a780af1a..00000000 --- a/docs/archives/bluej-starter/Cat.java +++ /dev/null @@ -1,12 +0,0 @@ -import org.openpatch.scratch.Sprite; - -public class Cat extends Sprite { - public Cat() { - this.addCostume("sit", "assets/cat.png"); - } - - public void run() { - this.ifOnEdgeBounce(); - this.move(1); - } -} diff --git a/docs/archives/bluej-starter/MyStage.java b/docs/archives/bluej-starter/MyStage.java deleted file mode 100644 index 47dcacb2..00000000 --- a/docs/archives/bluej-starter/MyStage.java +++ /dev/null @@ -1,13 +0,0 @@ -import org.openpatch.scratch.Stage; - -public class MyStage extends Stage { - - // begin stage designer - // end stage designer - public MyStage() { - this.add(new Cat()); - - // begin stage designer - // end stage designer - } -} diff --git a/docs/archives/bluej-starter/MyWindow.java b/docs/archives/bluej-starter/MyWindow.java deleted file mode 100644 index 3ad71a5e..00000000 --- a/docs/archives/bluej-starter/MyWindow.java +++ /dev/null @@ -1,13 +0,0 @@ -import org.openpatch.scratch.Window; - -public class MyWindow extends Window { - public MyWindow() { - super(800, 600, "assets"); - - this.setStage(new MyStage()); - } - - public static void main(String[] args) { - new MyWindow(); - } -} diff --git a/docs/archives/bluej-starter/assets/.gitkeep b/docs/archives/bluej-starter/assets/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/bluej-starter/package.bluej b/docs/archives/bluej-starter/package.bluej deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/bouncy-hedgehog-100/package.bluej b/docs/archives/bouncy-hedgehog-100/package.bluej deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/bouncy-hedgehog/package.bluej b/docs/archives/bouncy-hedgehog/package.bluej deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/cat/CatStage.java b/docs/archives/cat/CatStage.java index 3016b27d..ab60a13e 100644 --- a/docs/archives/cat/CatStage.java +++ b/docs/archives/cat/CatStage.java @@ -1,5 +1,4 @@ -import org.openpatch.scratch.Sprite; -import org.openpatch.scratch.Stage; +import org.openpatch.scratch.*; public class CatStage extends Stage { @@ -12,4 +11,9 @@ public CatStage() { // begin stage designer // end stage designer } + + public static void main(String[] args) { + Window myWindow = new Window(480, 360); + myWindow.setStage(new CatStage()); + } } diff --git a/docs/archives/cat/package.bluej b/docs/archives/cat/package.bluej deleted file mode 100644 index 6115af19..00000000 --- a/docs/archives/cat/package.bluej +++ /dev/null @@ -1,27 +0,0 @@ -#BlueJ package file -objectbench.height=93 -objectbench.width=461 -package.divider.horizontal=0.6 -package.divider.vertical=0.8 -package.editor.height=393 -package.editor.width=649 -package.editor.x=287 -package.editor.y=345 -package.frame.height=600 -package.frame.width=800 -package.numDependencies=0 -package.numTargets=1 -package.showExtends=true -package.showUses=true -readme.height=60 -readme.name=@README -readme.width=49 -readme.x=10 -readme.y=10 -target1.height=70 -target1.name=CatSketch -target1.showInterface=false -target1.type=ClassTarget -target1.width=120 -target1.x=10 -target1.y=110 diff --git a/docs/archives/catch-the-coins-100/package.bluej b/docs/archives/catch-the-coins-100/package.bluej deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/dodge-the-rocks-100/Alien.java b/docs/archives/dodge-the-rocks-100/Alien.java index edf181b5..f5b79f4c 100644 --- a/docs/archives/dodge-the-rocks-100/Alien.java +++ b/docs/archives/dodge-the-rocks-100/Alien.java @@ -1,11 +1,11 @@ import org.openpatch.scratch.*; -public class Alien extends AnimatedSprite { +public class Alien extends Sprite { public Alien() { // begin sprite editor this.addCostume("alienGreen_stand"); this.addAnimation("walk", "alienGreen_walk%d", 2); - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); // end sprite editor this.setSize(45); this.setRotationStyle(RotationStyle.LEFT_RIGHT); diff --git a/docs/archives/dodge-the-rocks-100/package.bluej b/docs/archives/dodge-the-rocks-100/package.bluej deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/getting-started-100/package.bluej b/docs/archives/getting-started-100/package.bluej deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/guess-the-number-100/package.bluej b/docs/archives/guess-the-number-100/package.bluej deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/make-it-walk-100/Walker.java b/docs/archives/make-it-walk-100/Walker.java index 8f725faa..1c9e0c3f 100644 --- a/docs/archives/make-it-walk-100/Walker.java +++ b/docs/archives/make-it-walk-100/Walker.java @@ -1,11 +1,11 @@ import org.openpatch.scratch.*; -public class Walker extends AnimatedSprite { +public class Walker extends Sprite { public Walker() { // begin sprite editor this.addCostume("alienGreen_stand"); this.addAnimation("walk", "alienGreen_walk%d", 2); - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); // end sprite editor this.setSize(60); this.setRotationStyle(RotationStyle.LEFT_RIGHT); diff --git a/docs/archives/make-it-walk-100/package.bluej b/docs/archives/make-it-walk-100/package.bluej deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/red-light-green-light-100/Racer.java b/docs/archives/red-light-green-light-100/Racer.java index 08d1b387..b68f6bab 100644 --- a/docs/archives/red-light-green-light-100/Racer.java +++ b/docs/archives/red-light-green-light-100/Racer.java @@ -32,7 +32,7 @@ public void run() { return; } this.changeX(this.speed); - if (this.getTimer().everyMillis(150)) { + if (this.getTimer().every(0.15)) { this.nextCostume(); } if (this.getX() > 170) { diff --git a/docs/archives/red-light-green-light-100/Referee.java b/docs/archives/red-light-green-light-100/Referee.java index e7768129..1ec5bebb 100644 --- a/docs/archives/red-light-green-light-100/Referee.java +++ b/docs/archives/red-light-green-light-100/Referee.java @@ -12,7 +12,7 @@ public Referee() { } public void run() { - if (this.getTimer().everyMillis(2200)) { + if (this.getTimer().every(2.2)) { this.green = !this.green; if (this.green) { this.say("Go!"); diff --git a/docs/archives/red-light-green-light-100/package.bluej b/docs/archives/red-light-green-light-100/package.bluej deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/archives/vs-code-starter/Cat.java b/docs/archives/vs-code-starter/Cat.java index a780af1a..2944c14b 100644 --- a/docs/archives/vs-code-starter/Cat.java +++ b/docs/archives/vs-code-starter/Cat.java @@ -1,4 +1,4 @@ -import org.openpatch.scratch.Sprite; +import org.openpatch.scratch.*; public class Cat extends Sprite { public Cat() { diff --git a/docs/archives/vs-code-starter/MyStage.java b/docs/archives/vs-code-starter/MyStage.java index 47dcacb2..d3cda3e9 100644 --- a/docs/archives/vs-code-starter/MyStage.java +++ b/docs/archives/vs-code-starter/MyStage.java @@ -1,4 +1,4 @@ -import org.openpatch.scratch.Stage; +import org.openpatch.scratch.*; public class MyStage extends Stage { @@ -10,4 +10,9 @@ public MyStage() { // begin stage designer // end stage designer } + + public static void main(String[] args) { + Window myWindow = new Window(480, 360); + myWindow.setStage(new MyStage()); + } } diff --git a/docs/archives/vs-code-starter/MyWindow.java b/docs/archives/vs-code-starter/MyWindow.java deleted file mode 100644 index 3ad71a5e..00000000 --- a/docs/archives/vs-code-starter/MyWindow.java +++ /dev/null @@ -1,13 +0,0 @@ -import org.openpatch.scratch.Window; - -public class MyWindow extends Window { - public MyWindow() { - super(800, 600, "assets"); - - this.setStage(new MyStage()); - } - - public static void main(String[] args) { - new MyWindow(); - } -} diff --git a/docs/book/abitur-nrw.md b/docs/book/abitur-nrw.md index 5cfba2bd..bc8f01e2 100644 --- a/docs/book/abitur-nrw.md +++ b/docs/book/abitur-nrw.md @@ -30,8 +30,8 @@ the NRW version from the [Download](/download) page. ## Setting up a project 1. Download `scratch--nrw-all.jar` from the [Download](/download) page - and add it to your project, the same way as described in [Setup](/setup). In - BlueJ, for example, put it into the `+libs` folder of your project. + and put it into the `+libs` folder of your project, as described in + [Setup](/setup). 2. Get the Abiturklassen. QUA-LiS NRW publishes them on the Lehrplannavigator as [Implementationen von Klassen für das Zentralabitur ab 2018](https://lehrplannavigator.nrw.de/system/files/media/document/file/2020-03-11_implementationen_von_klassen_fuer_das_zentralabitur_ab_2018.zip) (ZIP). Your teacher may also hand them out. @@ -40,7 +40,7 @@ the NRW version from the [Download](/download) page. uses them. `Graph.java` needs `List.java`, and `DatabaseConnector.java` needs `Queue.java` and `QueryResult.java`. -A BlueJ project then looks like this: +A project then looks like this: ```text MeinSpiel/ diff --git a/docs/book/classroom.md b/docs/book/classroom.md index f3943f34..464406cb 100644 --- a/docs/book/classroom.md +++ b/docs/book/classroom.md @@ -19,9 +19,9 @@ This page helps you plan a unit with it. | --- | --- | --- | | **Browser** | The first lessons, homework, computers you cannot install anything on | Nothing. The editor is built into every tutorial. | | **Studio** | A whole unit on school computers, working offline | Install [Studio](/download). Java and the library are included. | -| **BlueJ / VS Code** | Courses that already use one of them | Add the library as described in [Setup](/setup). | +| **VS Code** | Courses that already use it, or another Java editor | Add the library as described in [Setup](/setup). | -Starting in the browser and moving to Studio or BlueJ later works well. The +Starting in the browser and moving to Studio later works well. The code stays the same. Only the `void main()` at the top becomes a class of its own. :::alert{warn} @@ -39,7 +39,7 @@ last chapter take longer. | | Tutorial | Builds on (Scratch) | New in Java | Typical stumbling blocks | | --- | --- | --- | --- | --- | | 1 | [Your first program](/tutorials/getting-started) | Sprites, costumes, `forever` | A class for the stage, `new`, `run()` | Forgetting `this.add(...)`; typos in costume names | -| 2 | [Make it Walk](/tutorials/make-it-walk) | `next costume`, `wait` | Timers instead of `wait`, `AnimatedSprite`, a `boolean` | Wanting a `wait` inside `run()` | +| 2 | [Make it Walk](/tutorials/make-it-walk) | `next costume`, `wait` | Timers instead of `wait`, animations, a `boolean` | Wanting a `wait` inside `run()` | | 3 | [Catch the Coins](/tutorials/catch-the-coins) | Variables, `pick random`, `touching?` | Fields, a `for` loop, one class for many coins | Where the score lives, and how a coin reaches it | | 4 | [Red Light, Green Light](/tutorials/red-light-green-light) | `broadcast`, `when I receive` | Constructor parameters, `String.equals` | Comparing strings with `==` | | 5 | [Guess the Number](/tutorials/guess-the-number) | `ask and wait`, `answer` | `if`/`else if`, turning text into a number | `ask` does not wait: the answer arrives in a later frame | diff --git a/docs/book/differences-scratch.md b/docs/book/differences-scratch.md index 2c8156cf..69198a0b 100644 --- a/docs/book/differences-scratch.md +++ b/docs/book/differences-scratch.md @@ -61,16 +61,16 @@ public class Blinker extends Sprite { } public void run() { - if (this.getTimer().everyMillis(1000)) { + if (this.getTimer().every(1)) { this.nextCostume(); } } } ``` -`everyMillis(1000)` is true once every second and false in all the frames in -between. Times in Scratch for Java are usually in **milliseconds**: 1000 is one -second. [Make it Walk](/tutorials/make-it-walk) builds on this. +`every(1)` is true once every second and false in all the frames in +between. Times in Scratch for Java are in **seconds**, as in Scratch: 0.5 is half +a second. [Make it Walk](/tutorials/make-it-walk) builds on this. ## Things that do not hold up the script @@ -170,8 +170,8 @@ public class Star extends Sprite { } public void run() { - if (!this.isClone() && this.getTimer().everyMillis(1000)) { - this.clone(); + if (!this.isClone() && this.getTimer().every(1)) { + this.createClone(); } } } diff --git a/docs/book/download.md b/docs/book/download.md index 4b13f5ab..0d73d1a8 100644 --- a/docs/book/download.md +++ b/docs/book/download.md @@ -20,9 +20,7 @@ Choose the download for your operating system: ## Starter projects -Ready-made projects for BlueJ and VS Code, with the library already inside. - -::archive[BlueJ Starter]{name="bluej-starter"} +A ready-made project for VS Code. Put the library into its `+libs` folder. ::archive[VS Code Starter]{name="vs-code-starter"} diff --git a/docs/book/examples/cat-platformer.md b/docs/book/examples/cat-platformer.md index 9f9c4228..6edc80e5 100644 --- a/docs/book/examples/cat-platformer.md +++ b/docs/book/examples/cat-platformer.md @@ -314,7 +314,7 @@ class Ladder extends Sprite { } /** A bug walking to and fro. Jump on it or punch it - but do not walk into it. */ -class Bug extends AnimatedSprite { +class Bug extends Sprite { /** The costume is 32 pixels high, the legs end 3 pixels above its bottom. */ private static final double FEET = 13; @@ -327,7 +327,7 @@ class Bug extends AnimatedSprite { public Bug(double minX, double maxX, double floor) { this.addAnimation("walk", "bug_walk_%d", 4); this.addAnimation("squished", "bug_squished_%d", 2); - this.setAnimationInterval(120); + this.setAnimationInterval(0.12); this.setRotationStyle(RotationStyle.LEFT_RIGHT); this.minX = minX; this.maxX = maxX; @@ -364,11 +364,11 @@ class Bug extends AnimatedSprite { } /** The steaming mug at the end of the level. */ -class Goal extends AnimatedSprite { +class Goal extends Sprite { public Goal(double x, double floor) { this.addAnimation("steam", "goal_mug_%d", 4); - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); this.setX(x); // the mug stands on the bottom two rows of its 32 pixel costume this.setY(floor + 14); @@ -380,7 +380,7 @@ class Goal extends AnimatedSprite { } /** The Scratch for Java cat. Every one of its animations is on the built-in cat sheet. */ -class Cat extends AnimatedSprite { +class Cat extends Sprite { /** The costumes are 64 pixels high with the feet on the bottom row. */ private static final double FEET = 32; @@ -415,7 +415,7 @@ class Cat extends AnimatedSprite { this.addAnimation("ko", "cat_ko_%d", 5); this.addAnimation("cheer", "cat_cheer_%d", 4); this.addAnimation("climb", "cat_climb_%d", 4); - this.setAnimationInterval(100); + this.setAnimationInterval(0.1); this.addSound("footstep_grass_000"); this.addSound("impactPunch_medium_004"); this.addSound("impactSoft_heavy_000"); @@ -632,11 +632,11 @@ class Cat extends AnimatedSprite { } /** A spinning coffee bean to collect. */ -class Bean extends AnimatedSprite { +class Bean extends Sprite { public Bean(double x, double y) { this.addAnimation("spin", "coffee_bean_%d", 4); - this.setAnimationInterval(120); + this.setAnimationInterval(0.12); this.setX(x); this.setY(y); } diff --git a/docs/book/examples/coin-collector.md b/docs/book/examples/coin-collector.md index c5f73596..184853ef 100644 --- a/docs/book/examples/coin-collector.md +++ b/docs/book/examples/coin-collector.md @@ -96,7 +96,8 @@ class CoinCollector extends Stage { // end stage designer this.score = new Text(); - this.score.setPosition(-330, 200); + this.score.setPosition(-380, 200); + this.score.setAlign(TextAlign.LEFT); this.score.setTextSize(28); this.score.showText("Coins: 0 / " + COINS); this.add(this.score); @@ -120,7 +121,7 @@ class CoinCollector extends Stage { } /** The alien you steer with the arrow keys. */ -class Player extends AnimatedSprite { +class Player extends Sprite { private static final int SIZE = 45; @@ -140,7 +141,7 @@ class Player extends AnimatedSprite { this.addCostume("alienGreen_stand"); this.addCostume("alienGreen_jump"); this.addAnimation("walk", "alienGreen_walk%d", 2); - this.setAnimationInterval(120); + this.setAnimationInterval(0.12); this.addSound("handleCoins"); this.addSound("footstep_grass_000"); // end sprite editor diff --git a/docs/book/examples/custom-drawing.md b/docs/book/examples/custom-drawing.md index b65ff928..bd9fc675 100644 --- a/docs/book/examples/custom-drawing.md +++ b/docs/book/examples/custom-drawing.md @@ -16,8 +16,8 @@ Put game updates in `run()`; drawing can happen while the game is paused. ```java import org.openpatch.scratch.Color; -import org.openpatch.scratch.extensions.drawing.Drawing; -import org.openpatch.scratch.extensions.drawing.DrawingSprite; +import org.openpatch.scratch.drawing.Drawing; +import org.openpatch.scratch.drawing.DrawingSprite; public class Road extends DrawingSprite { @Override diff --git a/docs/book/examples/donut-io.md b/docs/book/examples/donut-io.md index 1f917a4f..6592a80b 100644 --- a/docs/book/examples/donut-io.md +++ b/docs/book/examples/donut-io.md @@ -24,7 +24,6 @@ resets the zoom. ```java Game.java void main() { - Text.useFontSizes(32, 48); // begin project settings // end project settings new Game(); @@ -82,7 +81,7 @@ class StartStage extends Stage { public void whenKeyPressed(KeyCode keyCode) { if (keyCode == KeyCode.SPACE) { Game.LEVEL = 0; - Window.getInstance().transitionToStage(new WorldStage(), 500); + Window.getInstance().transitionToStage(new WorldStage(), 0.5); } } } @@ -122,7 +121,7 @@ class WorldStage extends Stage { } public void run() { - if (this.getTimer().everyMillis(1000)) { + if (this.getTimer().every(1)) { var food = new Donut(); food.setStrength(Random.randomInt(2, 5)); this.add(food); @@ -138,12 +137,12 @@ class WorldStage extends Stage { } if (this.count(FollowDonut.class) == 0) { - Window.getInstance().transitionToStage(new WinStage(), 500); + Window.getInstance().transitionToStage(new WinStage(), 0.5); return; } if (this.count(PlayerDonut.class) == 0) { - Window.getInstance().transitionToStage(new GameOverStage(), 500); + Window.getInstance().transitionToStage(new GameOverStage(), 0.5); return; } @@ -200,7 +199,7 @@ class WinStage extends Stage { public void whenKeyPressed(KeyCode keyCode) { if (keyCode == KeyCode.SPACE) { Game.LEVEL += 1; - Window.getInstance().transitionToStage(new WorldStage(), 500); + Window.getInstance().transitionToStage(new WorldStage(), 0.5); } } } @@ -234,10 +233,9 @@ class GameOverStage extends Stage { } public void whenKeyPressed(KeyCode keyCode) { - System.out.println(keyCode); if (keyCode == KeyCode.SPACE) { Game.LEVEL = 0; - Window.getInstance().transitionToStage(new WorldStage(), 500); + Window.getInstance().transitionToStage(new WorldStage(), 0.5); } } } @@ -248,10 +246,11 @@ class Background extends Sprite { // begin sprite editor this.addCostume("grid", "assets/grid.png"); // end sprite editor + // scenery: the grid covers the stage, so it must not count as touching anything + this.disableHitbox(); } public void run() { - this.getPen().eraseAll(); this.setX(this.getStage().getCamera().getX() - this.getStage().getCamera().getX() % 40); this.setY(this.getStage().getCamera().getY() - this.getStage().getCamera().getY() % 40); } @@ -290,7 +289,6 @@ class Donut extends Sprite { public void run() { var touchingDonut = this.getTouchingSprite(Donut.class); - debug("touchingDonut: " + getX()); if (touchingDonut != null && this.strength >= touchingDonut.strength) { this.setStrength(this.strength + touchingDonut.strength); touchingDonut.remove(); diff --git a/docs/book/examples/pipes.md b/docs/book/examples/pipes.md index af563c2b..bf99a292 100644 --- a/docs/book/examples/pipes.md +++ b/docs/book/examples/pipes.md @@ -35,7 +35,7 @@ class Pipes extends Stage { // end stage designer public Pipes() { - this.setTint(60); + this.setColorEffect(60); // begin stage designer this.addBackdrop("chalkBoard", "backdrops/chalk_board.jpg"); this.addSound("bg", "sounds/bensound-enigmatic.ogg"); @@ -46,7 +46,7 @@ class Pipes extends Stage { public void whenKeyPressed(KeyCode keyCode) { if (keyCode == KeyCode.SPACE) { - PenSprite.setColor(Random.random(255)); + PenSprite.setColor(Random.random(100)); } } @@ -55,7 +55,7 @@ class Pipes extends Stage { var pens = this.find(PenSprite.class); for (var pen : pens) { if (Random.random() < 0.05 && pens.size() < 15) { - this.add(new PenSprite((PenSprite) pen)); + pen.createClone(); } if (Random.random() < 0.01 && pens.size() > 1) { this.remove(pen); @@ -73,7 +73,7 @@ class PenSprite extends Sprite { super("pen", "sprites/pen.png"); this.getPen().down(); this.getPen().setSize(2); - color = Random.random(255); + color = Random.random(100); this.getPen().setColor(color); this.hide(); @@ -85,13 +85,12 @@ class PenSprite extends Sprite { PenSprite.color = color; } - // when I start as a clone - public PenSprite(PenSprite pen) { - super(pen); - this.setDirection(pen.getDirection() + 90); + @Override + public void whenStartsAsClone() { + this.setDirection(this.getDirection() + 90); this.getPen().setColor(color); if (Math.random() < 0.05) { - color += Math.random() * 10; + color += Math.random() * 4; } } diff --git a/docs/book/examples/rainbow-vine.md b/docs/book/examples/rainbow-vine.md index 618db7bb..1e0e8c7d 100644 --- a/docs/book/examples/rainbow-vine.md +++ b/docs/book/examples/rainbow-vine.md @@ -48,7 +48,7 @@ class VineSprite extends Sprite { this.setPosition(this.getMouseX(), this.getMouseY()); this.turnRight(5); - if (this.getTimer().everyMillis(60)) { + if (this.getTimer().every(0.06)) { this.getStage().add(new LeafSprite(this)); } } @@ -71,7 +71,7 @@ class LeafSprite extends Sprite { this.turnRight(5); this.move(5); this.getPen().changeSize(1); - if (this.getTimer().afterMillis(200)) { + if (this.getTimer().after(0.2)) { this.remove(); } } diff --git a/docs/book/examples/random-dot.md b/docs/book/examples/random-dot.md index 23ac6da5..5a6e47bc 100644 --- a/docs/book/examples/random-dot.md +++ b/docs/book/examples/random-dot.md @@ -39,7 +39,7 @@ class RandomDot extends Stage { class RandomDotSprite extends Sprite { public void run() { - if (this.getTimer().everyMillis(100)) { + if (this.getTimer().every(0.1)) { this.getPen().up(); this.getPen().setSize(20); this.goToRandomPosition(); diff --git a/docs/book/examples/robot.md b/docs/book/examples/robot.md index f00d8e7f..86806939 100644 --- a/docs/book/examples/robot.md +++ b/docs/book/examples/robot.md @@ -33,7 +33,7 @@ class RobotStage extends Stage { // end stage designer public RobotStage() { - this.setDebug(true); + Window.getInstance().setDebug(true); // begin stage designer robotSprite = new RobotSprite(); this.add(robotSprite); diff --git a/docs/book/examples/sensing.md b/docs/book/examples/sensing.md index 9f20f23f..d59e2161 100644 --- a/docs/book/examples/sensing.md +++ b/docs/book/examples/sensing.md @@ -70,7 +70,7 @@ class Hero extends Sprite { this.setDirection(45); this.move(80); - this.setHitbox(0, 0, 300, 0, 300, 570, 0, 570, 150, 275); + this.setHitbox(new Polygon(new double[] {0, 300, 300, 0, 150}, new double[] {0, 0, 570, 570, 275})); } public void run() { @@ -121,7 +121,7 @@ class MovableHero extends Hero { /** A Hero pinned to the user interface layer. */ class UIHero extends Hero { public UIHero() { - this.setUI(true); + this.setLayer(Layer.UI); } } ``` diff --git a/docs/book/examples/shader.md b/docs/book/examples/shader.md index d1c5b049..f28eb897 100644 --- a/docs/book/examples/shader.md +++ b/docs/book/examples/shader.md @@ -14,7 +14,7 @@ The stage has four shaders and the bouncing cat three, each in a `.frag` file of its own. They are added with a name, and some get values to work with: ```java -var shader = this.getShaders().add("pixelate", "pixelate.frag", "default.vert"); +var shader = this.getShaders().add("pixelate", "pixelate.frag"); shader.set("pixels", 20.0, 10.0); ``` @@ -34,7 +34,6 @@ the keys. @file dest="blobby.frag" src="/examples/shader/blobby.frag" @file dest="cat.png" src="/examples/shader/cat.png" -@file dest="default.vert" src="/examples/shader/default.vert" @file dest="glitch.frag" src="/examples/shader/glitch.frag" @file dest="halftone.frag" src="/examples/shader/halftone.frag" @file dest="light.frag" src="/examples/shader/light.frag" @@ -70,13 +69,13 @@ class MyStage extends Stage { // end stage designer public MyStage() { - var shader = this.getShaders().add("blobby", "blobby.frag", "default.vert"); + var shader = this.getShaders().add("blobby", "blobby.frag"); shader.set("depth", 1.5); shader.set("rate", 1.5); - shader = this.getShaders().add("glitch", "glitch.frag", "default.vert"); + shader = this.getShaders().add("glitch", "glitch.frag"); shader.set("rate", 0.0001); - shader = this.getShaders().add("light", "light.frag", "default.vert"); - shader = this.getShaders().add("pixel", "pixel.frag", "default.vert"); + shader = this.getShaders().add("light", "light.frag"); + shader = this.getShaders().add("pixel", "pixel.frag"); this.getShaders().switchTo("pixel"); // begin stage designer mySprite = new MySprite(); @@ -108,8 +107,6 @@ class MyStage extends Stage { + " next sprite shader. Press M to remove the sprite shader."); var shader = this.getShaders().getCurrent(); if (shader != null) { - shader.set("time", Timer.millis() / 1000.0); - shader.set("resolution", (float) this.getWidth(), (float) this.getHeight()); if ("light".equals(shader.getName())) { var lights = this.find(LightSprite.class); var lightPos = new double[lights.size() * 3 + 3]; @@ -137,10 +134,10 @@ class MySprite extends Sprite { // begin sprite editor this.addCostume("cat", "cat.png"); // end sprite editor - var shader = this.getShaders().add("halftone", "halftone.frag", "default.vert"); - shader = this.getShaders().add("pixelate", "pixelate.frag", "default.vert"); + var shader = this.getShaders().add("halftone", "halftone.frag"); + shader = this.getShaders().add("pixelate", "pixelate.frag"); shader.set("pixels", 20.0, 10.0); - shader = this.getShaders().add("neon", "neon.frag", "default.vert"); + shader = this.getShaders().add("neon", "neon.frag"); shader.set("brt", 0.4); shader.set("rad", 1); this.getShaders().switchTo("halftone"); diff --git a/docs/book/examples/shakespeare.md b/docs/book/examples/shakespeare.md index 218b87a6..797803a4 100644 --- a/docs/book/examples/shakespeare.md +++ b/docs/book/examples/shakespeare.md @@ -22,7 +22,6 @@ font loaded from a file. ```java Shakespeare.java void main() { - Text.useFontSizes(14, 20); Window myWindow = new Window(800, 600); myWindow.setStage(new Shakespeare()); } diff --git a/docs/book/examples/smart-rocket.md b/docs/book/examples/smart-rocket.md index 87079862..071f43af 100644 --- a/docs/book/examples/smart-rocket.md +++ b/docs/book/examples/smart-rocket.md @@ -106,7 +106,7 @@ class Ziel extends Sprite { public Ziel() { // begin sprite editor this.addCostume("target", "assets/target.png"); - this.setHitbox(10, 38, 10, 10, 38, 10, 38, 38); + this.setHitbox(new Polygon(new double[] {10, 10, 38, 38}, new double[] {38, 10, 10, 38})); // end sprite editor } } @@ -221,7 +221,7 @@ class Rocket extends Sprite { public Rocket(Vector2 pPosition, DNA pDna, Ziel pZiel) { // begin sprite editor this.addCostume("rocket", "assets/rocket.png"); - this.setHitbox(68, 27, 68, 20, 76, 21, 76, 26); + this.setHitbox(new Polygon(new double[] {68, 68, 76, 76}, new double[] {27, 20, 21, 26})); // end sprite editor this.setPosition(pPosition); this.beschleunigung = new Vector2(); @@ -248,10 +248,10 @@ class Rocket extends Sprite { beschleunigung = beschleunigung.add(dna.gibGene()[geneZaehler]); geneZaehler = (geneZaehler + 1) % dna.gibGene().length; geschwindigkeit = geschwindigkeit.add(beschleunigung); - move(geschwindigkeit); + changePosition(geschwindigkeit); beschleunigung = beschleunigung.multiply(0); } else { - this.setTint(200); + this.setColorEffect(100); } } } diff --git a/docs/book/examples/stress-test.md b/docs/book/examples/stress-test.md index 5a0559a3..67a7d57c 100644 --- a/docs/book/examples/stress-test.md +++ b/docs/book/examples/stress-test.md @@ -150,7 +150,7 @@ class StressTest extends Stage { } } -class Figure extends AnimatedSprite { +class Figure extends Sprite { public FigureState state; int tintColor; boolean hasTouchedEdge = false; @@ -162,7 +162,7 @@ class Figure extends AnimatedSprite { this.addAnimation("run", pathBase + "Run (%d).png", runAnimations); this.addAnimation("walk", pathBase + "Walk (%d).png", walkAnimations); - this.tintColor = (int) this.pickRandom(0, 256); + this.tintColor = this.pickRandom(0, 200); this.setPosition(this.pickRandom(-200, 200), this.pickRandom(-200, 200)); this.setDirection(this.pickRandom(0, 360)); @@ -172,7 +172,7 @@ class Figure extends AnimatedSprite { public void run() { this.ifOnEdgeBounce(); - this.setTint(this.tintColor); + this.setColorEffect(this.tintColor); if (isTouchingMousePointer()) { state = FigureState.WALK; @@ -188,16 +188,16 @@ class Figure extends AnimatedSprite { switch (state) { case IDLE: - this.setAnimationInterval(100); + this.setAnimationInterval(0.1); this.playAnimation("idle"); break; case RUN: - this.setAnimationInterval(50); + this.setAnimationInterval(0.05); this.playAnimation("run"); move(4); break; case WALK: - this.setAnimationInterval(100); + this.setAnimationInterval(0.1); this.playAnimation("walk"); move(2); break; diff --git a/docs/book/examples/tiled.md b/docs/book/examples/tiled.md index 2b47f5fb..2b971fd1 100644 --- a/docs/book/examples/tiled.md +++ b/docs/book/examples/tiled.md @@ -30,12 +30,11 @@ This example show the handling of the tiled extension. void main() { // These global settings must be set before starting the game. - Text.useFont("assets/Retro Gaming.ttf", 11); - Text.useSmoothing(false); + Text.useFont("assets/Retro Gaming.ttf"); // Start the Game // begin project settings - Window.useTextureSampling(TextureSampling.POINT); + Window.usePixelArt(); Window.useFullScreen(); // end project settings new Tiled(); @@ -86,9 +85,15 @@ class Level extends Stage { GameState.get().playerY = start.y; } player = new Player(GameState.get().playerX, GameState.get().playerY); - this.getCamera().setPosition(player.getX(), player.getY()); } this.add(player); + // run() starts after the transition: until then the camera has to be on the player already + this.getCamera().setPosition(player.getX(), player.getY()); + this.setColor(0, 0, 0); + // the map's layers are drawn every frame from now on, under the sprites + this.map.showLayer("Floor", Layer.BACKGROUND); + this.map.showLayer("FloorObjects", Layer.BACKGROUND); + this.map.showLayer("Walls", Layer.BACKGROUND); GameState.get().map = mapFile; // begin stage designer @@ -101,23 +106,16 @@ class Level extends Stage { public void whenKeyPressed(KeyCode keyCode) { if (keyCode == KeyCode.F1) { - this.setDebug(!this.isDebug()); + Window.getInstance().setDebug(!Window.getInstance().isDebug()); } else if (keyCode == KeyCode.F5) { GameState.save(); - this.display("Game saved", 2000); + this.display("Game saved", 2); } } public void run() { - this.eraseAll(); - this.setColor(0, 0, 0); - this.getCamera().setPosition(player.getPosition()); - this.map.stampLayerToBackground("Floor"); - this.map.stampLayerToBackground("FloorObjects"); - this.map.stampLayerToBackground("Walls"); - if (this.isKeyPressed(KeyCode.DIGIT_1)) { this.getCamera().changeZoom(1); } @@ -270,10 +268,10 @@ class Item extends Sprite { // auto-save when an item is collected GameState.save(); this.hide(); - this.getStage().display(I18n.get("item-found", I18n.get(name)), 2000); + this.getStage().display(I18n.get("item-found", I18n.get(name)), 2); if (name.equals("scroll-fire")) { - this.getStage().display(I18n.get("tutorial-scroll-fire"), 2000); + this.getStage().display(I18n.get("tutorial-scroll-fire"), 2); } } @@ -285,17 +283,17 @@ class Item extends Sprite { /** An Item pinned to the user interface layer, used for the inventory. */ class UIItem extends Item { public UIItem() { - this.setUI(true); + this.setLayer(Layer.UI); // begin sprite editor // end sprite editor } } -class Player extends AnimatedSprite { +class Player extends Sprite { private String state = "idle"; - private double speed = 2.5; + private double speed = 2; private String dir = "down"; public Player(double x, double y) { @@ -303,12 +301,12 @@ class Player extends AnimatedSprite { this.setY(y); // begin sprite editor - this.addAnimation("walk-down", "assets/Skeleton.png", 4, 32, 32, 0, true); - this.addAnimation("walk-up", "assets/Skeleton.png", 4, 32, 32, 1, true); - this.addAnimation("walk-left", "assets/Skeleton.png", 4, 32, 32, 2, true); - this.addAnimation("walk-right", "assets/Skeleton.png", 4, 32, 32, 3, true); + this.addAnimation("walk-down", "assets/Skeleton.png", 32, 32, 0, 4, 8, 12); // column 0 + this.addAnimation("walk-up", "assets/Skeleton.png", 32, 32, 1, 5, 9, 13); // column 1 + this.addAnimation("walk-left", "assets/Skeleton.png", 32, 32, 2, 6, 10, 14); // column 2 + this.addAnimation("walk-right", "assets/Skeleton.png", 32, 32, 3, 7, 11, 15); // column 3 - this.setHitbox(1, 31, 1, 10, 30, 10, 30, 31); + this.setHitbox(new Polygon(new double[] {1, 1, 30, 30}, new double[] {31, 10, 10, 31})); // end sprite editor } @@ -320,7 +318,7 @@ class Player extends AnimatedSprite { this.changeX(dx); this.changeY(dy); if (!hasItem("scroll-water") && this.isTouchingSprite(Water.class)) { - this.think(I18n.get("need-scroll-water"), 5000); + this.think(I18n.get("need-scroll-water"), 5); this.changeX(-dx); this.changeY(-dy); } @@ -371,7 +369,7 @@ class Player extends AnimatedSprite { if (item != null && this.isKeyPressed(KeyCode.E)) { item.collect(); } else if (item != null) { - this.getStage().display(I18n.get("tutorial-item-pickup"), 1000); + this.getStage().display(I18n.get("tutorial-item-pickup"), 1); } if (state.equals("idle")) { @@ -404,7 +402,7 @@ class Wall extends Sprite { } } -class Fireball extends AnimatedSprite { +class Fireball extends Sprite { private String dir; private double speed = 3; @@ -414,12 +412,12 @@ class Fireball extends AnimatedSprite { this.dir = dir; // begin sprite editor - this.addAnimation("default", "assets/Fireball.png", 4, 32, 32); + this.addAnimation("default", "assets/Fireball.png", 32, 32, 0, 1, 2, 3); // end sprite editor } public void run() { - if (this.getTimer().afterMillis(1000)) { + if (this.getTimer().after(1)) { this.remove(); } @@ -441,7 +439,7 @@ class Fireball extends AnimatedSprite { } } -class Enemy extends AnimatedSprite { +class Enemy extends Sprite { protected String state = "idle"; protected String dir = "down"; @@ -457,16 +455,16 @@ class Enemy extends AnimatedSprite { class Bamboo extends Enemy { - protected double speed = 2.5; + protected double speed = 2; public Bamboo(double x, double y) { super(x, y); // begin sprite editor - this.addAnimation("walk-down", "assets/Bamboo.png", 4, 32, 32, 0, true); - this.addAnimation("walk-up", "assets/Bamboo.png", 4, 32, 32, 1, true); - this.addAnimation("walk-left", "assets/Bamboo.png", 4, 32, 32, 2, true); - this.addAnimation("walk-right", "assets/Bamboo.png", 4, 32, 32, 3, true); + this.addAnimation("walk-down", "assets/Bamboo.png", 32, 32, 0, 4, 8, 12); // column 0 + this.addAnimation("walk-up", "assets/Bamboo.png", 32, 32, 1, 5, 9, 13); // column 1 + this.addAnimation("walk-left", "assets/Bamboo.png", 32, 32, 2, 6, 10, 14); // column 2 + this.addAnimation("walk-right", "assets/Bamboo.png", 32, 32, 3, 7, 11, 15); // column 3 // end sprite editor } @@ -526,7 +524,7 @@ class Warp extends Sprite { player.setX(toX); player.setY(toY); return new Level(toMap, player); - }, 500); + }, 0.5); } } } diff --git a/docs/book/examples/timed-dot.md b/docs/book/examples/timed-dot.md index 3db44406..c03d5233 100644 --- a/docs/book/examples/timed-dot.md +++ b/docs/book/examples/timed-dot.md @@ -37,13 +37,15 @@ class TimedDot extends Stage { } public void run() { - if (this.getTimer().everyMillis(2400)) { + if (this.getTimer().every(2.4)) { this.eraseAll(); } } } class DotSprite extends Sprite { + private final Timer timerTimer1 = new Timer(); + private final Timer timerTimer2 = new Timer(); public DotSprite() { super(); this.getPen().setSize(40); @@ -52,14 +54,14 @@ class DotSprite extends Sprite { public void run() { this.ifOnEdgeBounce(); - if (this.getTimer("timer2").everyMillis(600)) { - this.getPen().setColor(200); + if (this.timerTimer2.every(0.6)) { + this.getPen().setColor(78); this.move(20); this.getPen().down(); this.getPen().up(); } - if (this.getTimer("timer1").everyMillis(1200)) { - this.getPen().setColor(100); + if (this.timerTimer1.every(1.2)) { + this.getPen().setColor(39); this.move(20); this.getPen().down(); this.getPen().up(); diff --git a/docs/book/examples/timer.md b/docs/book/examples/timer.md index 3fc14244..610ecab4 100644 --- a/docs/book/examples/timer.md +++ b/docs/book/examples/timer.md @@ -39,6 +39,13 @@ class TimerStage extends Stage { } class TimerSprite extends Sprite { + private final Timer timerAfter = new Timer(); + private final Timer timerEvery = new Timer(); + private final Timer timerFor = new Timer(); + private final Timer timerInterval1 = new Timer(); + private final Timer timerInterval2 = new Timer(); + private final Timer timerInterval3 = new Timer(); + private final Timer timerInterval4 = new Timer(); int x = -900; public TimerSprite() { @@ -49,50 +56,50 @@ class TimerSprite extends Sprite { public void run() { int y = -140; this.x += 20; - if (this.getTimer("every").everyMillis(600)) { - this.getPen().setColor(20); // Orange + if (this.timerEvery.every(0.6)) { + this.getPen().setColor(8); // Orange this.setPosition(this.x, y); this.getPen().down(); this.getPen().up(); } y += 40; - if (this.getTimer("for").forMillis(600)) { - this.getPen().setColor(60); // Hellgrün + if (this.timerFor.during(0.6)) { + this.getPen().setColor(24); // Hellgrün this.setPosition(this.x, y); this.getPen().down(); this.getPen().up(); } y += 40; - if (this.getTimer("after").afterMillis(600)) { - this.getPen().setColor(100); // Grün + if (this.timerAfter.after(0.6)) { + this.getPen().setColor(39); // Grün this.setPosition(this.x, y); this.getPen().down(); this.getPen().up(); } y += 40; - if (this.getTimer("interval1").intervalMillis(600)) { - this.getPen().setColor(140); // Hellblau + if (this.timerInterval1.interval(0.6)) { + this.getPen().setColor(55); // Hellblau this.setPosition(this.x, y); this.getPen().down(); this.getPen().up(); } y += 40; - if (this.getTimer("interval2").intervalMillis(600, true)) { - this.getPen().setColor(180); // Blau + if (!this.timerInterval2.interval(0.6)) { + this.getPen().setColor(71); // Blau this.setPosition(this.x, y); this.getPen().down(); this.getPen().up(); } y += 40; - if (this.getTimer("interval3").intervalMillis(600, 300)) { - this.getPen().setColor(220); // Pink + if (this.timerInterval3.interval(0.6, 0.3)) { + this.getPen().setColor(86); // Pink this.setPosition(this.x, y); this.getPen().down(); this.getPen().up(); } y += 40; - if (this.getTimer("interval4").intervalMillis(600, 300, true)) { - this.getPen().setColor(255); // Rot + if (!this.timerInterval4.interval(0.3, 0.6)) { + this.getPen().setColor(100); // Rot this.setPosition(this.x, y); this.getPen().down(); this.getPen().up(); diff --git a/docs/book/examples/ui.md b/docs/book/examples/ui.md index e031f664..00feefd8 100644 --- a/docs/book/examples/ui.md +++ b/docs/book/examples/ui.md @@ -68,9 +68,10 @@ class UI extends Stage { } } -class Panel extends UISprite { +class Panel extends Sprite { public Panel() { super(); + this.setLayer(Layer.UI); this.addCostume("metal-panel-green-corner", "metalPanel_greenCorner.png"); this.setNineSlice(30, 25, 30, 70); } @@ -81,9 +82,10 @@ class Panel extends UISprite { } } -class Bar extends UISprite { +class Bar extends Sprite { public Bar() { super(); + this.setLayer(Layer.UI); this.addCostume("bar", "bar_round_gloss_large.png"); this.addCostume("bar-gray", "bar_round_gloss_large_gray.png"); this.setNineSlice(12, 24, 12, 24); diff --git a/docs/book/examples/volume.md b/docs/book/examples/volume.md index 913c4cb3..fa523688 100644 --- a/docs/book/examples/volume.md +++ b/docs/book/examples/volume.md @@ -74,7 +74,7 @@ class Volume extends Stage { private void showVolume() { this.label.showText("Volume: " + Math.round(this.getVolume()) - + "% (space = play, up/down = louder/quieter)"); + + "%\nspace = play, up/down = louder/quieter"); } public void whenKeyPressed(KeyCode keyCode) { diff --git a/docs/book/index.md b/docs/book/index.md index 54bfe171..4be697ce 100644 --- a/docs/book/index.md +++ b/docs/book/index.md @@ -52,10 +52,10 @@ class MyStage extends Stage { } } -class Walker extends AnimatedSprite { +class Walker extends Sprite { public Walker() { this.addAnimation("walk", "alienGreen_walk%d", 2); - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); this.setSize(60); this.setRotationStyle(RotationStyle.LEFT_RIGHT); this.setY(-50); @@ -92,7 +92,7 @@ and an example you can run. - **[For teachers](/classroom)**: planning a unit, what each tutorial covers, assessment and working offline. -- **[Setup](/setup)**: browser, Studio, BlueJ or VS Code. +- **[Setup](/setup)**: browser, Studio or VS Code. - **[Multiple Approach Design](/multiple-approach-design)**: classes first or classes later. - **[Abiturklassen NRW](/abitur-nrw)**: the version for the NRW Zentralabitur. @@ -107,7 +107,7 @@ in der du über ein ganzes Schuljahr dein eigenes Spiel entwickelst. ## Seeing it side by side -The following video shows a Scratch project and a similar BlueJ project using +The following video shows a Scratch project and a similar Java project using the Scratch for Java library. ::youtube[Comparison of Scratch and Scratch for Java]{#3wKw2WWQcXk} @@ -115,10 +115,17 @@ the Scratch for Java library. If you want to compare it yourself, you can take a look inside both projects: - Scratch: https://scratch.mit.edu/projects/338613208 -- BlueJ: [Source Code on GitHub](https://github.com/openpatch/scratch-for-java/tree/main/docs/archives/Halloween) or [Project Halloween.zip](/archives/Halloween.zip) +- Java: [Source Code on GitHub](https://github.com/openpatch/scratch-for-java/tree/main/docs/archives/Halloween) or [Project Halloween.zip](/archives/Halloween.zip) ## Special Thanks The Scratch for Java library is profiled using [Java Profiler](https://www.ej-technologies.com/products/jprofiler/overview.html) [![Java Profiler](https://www.ej-technologies.com/images/product_banners/jprofiler_large.png)](https://www.ej-technologies.com/products/jprofiler/overview.html) + +--- + +Scratch for Java is an independent project by +[OpenPatch](https://openpatch.org). It is not affiliated with or endorsed by +the [Scratch Foundation](https://www.scratchfoundation.org) or the Scratch +Team. diff --git a/docs/book/migrate-to-7.md b/docs/book/migrate-to-7.md new file mode 100644 index 00000000..3e4470ea --- /dev/null +++ b/docs/book/migrate-to-7.md @@ -0,0 +1,226 @@ +--- +name: Moving from 6.x to 7.0 +index: 14 +--- + +# Moving from 6.x to 7.0 + +Scratch for Java 7.0 no longer runs on Processing. It has its own renderer on +[LWJGL](https://www.lwjgl.org) (OpenGL, OpenAL, GLFW), and the extensions became +jars of their own. Most programs only need new imports and seconds instead of +milliseconds, but 7.0 does not try to stay compatible with 6.x: where a cleaner API +for learners needed a change, the change was made. Projects that should not move +stay on 6.x. + +## Moving a project + +The repository has a script that does the mechanical part. Run it once per project +(it is not meant to run twice over the same files): + +```bash +python3 scripts/migrate-7.py src/ # dry run: shows what would change +python3 scripts/migrate-7.py --write src/ # changes the files +python3 scripts/migrate-7.py --out new/ src/ # writes changed copies to new/ +``` + +It changes packages, renames methods, divides literal millisecond arguments by +1000, turns `clone()` into `createClone()`, `extends AnimatedSprite` and +`extends UISprite` into `extends Sprite`, rewrites Processing fragment shaders into +the new format and the ```` ```java ```` blocks of Markdown pages. Everything it +cannot decide gets a comment above the line: + +``` +// TODO 7.0: setTint(hue) is now setColorEffect(…) (Scratch's colour effect, 0–200); setTint(Color) multiplies. +``` + +Then compile, work through the `TODO 7.0` comments and run the program. + +## What a computer needs + +- **OpenGL 3.3** (4.1 on macOS). 6.x needed OpenGL 2. Computers from the last ten + years have it; very old school PCs and some virtual machines do not, and the + program then says so when it starts. +- **Java 17** or newer, as before. +- **macOS:** the window has to run on the first thread. Studio starts every program + that way. Started by hand, use the launcher: + `java -XstartOnFirstThread -cp game.jar org.openpatch.scratch.Launcher MyGame`. + AWT and Swing windows (`JOptionPane`, `JFrame`) do not work next to the game window + on macOS. +- **BlueJ** is no longer supported. Scratch for Java Studio is the IDE. + +## Jars and imports + +Everything a learner uses is in one package, as before: `import org.openpatch.scratch.*;`. +Camera, sound, text, pixels, shaders and sorting moved into it from +`extensions.*`. The remaining extensions are jars of their own with short package +names: + +| 6.x | 7.0 | Maven artifact | +|---|---|---| +| `org.openpatch.scratch.extensions.camera.Camera` | `org.openpatch.scratch.Camera` | `scratch` | +| `…extensions.shader.Shader`, `Shaders` | `org.openpatch.scratch.Shader`, `Shaders` | `scratch` | +| `…extensions.pixels.Pixels` | `org.openpatch.scratch.Pixels` | `scratch` | +| `…extensions.sound.SoundPlayback` | `org.openpatch.scratch.SoundPlayback` | `scratch` | +| `…extensions.sorting.Sorting` | `stage.sortByY()`, `sortBy(…)`, `stopSorting()` | `scratch` | +| `…extensions.tiled.*` | `org.openpatch.scratch.tiled.*` | `scratch-tiled` | +| `…extensions.fs.*` (`SaveData`, `File`) | `org.openpatch.scratch.save.*` | `scratch-save` | +| `…extensions.recorder.GifRecorder` | `org.openpatch.scratch.recorder.GifRecorder` | `scratch-recorder` | +| `…extensions.drawing.*`, `…extensions.text.BitmapText` | `org.openpatch.scratch.drawing.*` | `scratch-drawing` | + +The jar from the download page (`scratch-{{VERSION}}-all.jar`) contains all of them, +as does the NRW jar. With Maven, add the extensions you use next to `scratch`; they +switch themselves on, there is nothing to register. + +`FrameRecorder` and `FFmpegRecorder` are gone; `GifRecorder` stays. + +## Time is in seconds + +Everything that took milliseconds now takes seconds, as Scratch does. + +| 6.x | 7.0 | +|---|---| +| `say("Hi", 2000)`, `think(…, 2000)` | `say("Hi", 2)`, `think(…, 2)` | +| `display(…, 2000)`, `showText(…, 2000)` | `display(…, 2)`, `showText(…, 2)` | +| `stage.wait(500)` | `stage.waitSeconds(0.5)` | +| `timer.everyMillis(500)` | `timer.every(0.5)` | +| `timer.forMillis(500)` | `timer.during(0.5)` | +| `timer.afterMillis(500)` | `timer.after(0.5)` | +| `timer.intervalMillis(…)` | `timer.interval(…)` | +| `setAnimationInterval(100)` | `setAnimationInterval(0.1)` | +| `transitionToStage(stage, 500)` | `transitionToStage(stage, 0.5)` | +| `Timer.millis()` | `getTimer().getSeconds()` | + +Named timers (`getTimer("name")`) are gone: keep a `Timer` in a field. `getDeltaTime()` +is gone too: `run()` is called exactly 60 times per second of game time, on every +computer, so every tick is 1/60 s. `getFrameRate()` is gone, because frames and ticks +are no longer the same; F12 shows the frame rate. + +## Sprites + +- **Animations are on every sprite.** `AnimatedSprite` is gone; `addAnimation`, + `playAnimation` and the rest are on `Sprite`. `addAnimation` takes numbered files + (`"walk%d.png"` and 4 frames, counting from 1; or the first and last number, + `"hit%d.png", 0, 4`) or a sprite sheet (frame width, height, then the frame numbers, + counted row by row from 0). The form with a function that names each file is gone. +- **`UISprite` is gone.** Extend `Sprite`, call `setLayer(Layer.UI)`; `setWidth`, + `setHeight` and `setNineSlice` are on every sprite. +- **Clones:** `createClone()` instead of `clone()`, without a cast: + `Bullet b = this.createClone();`. The clone is placed behind the original, as in + Scratch. +- **Direction:** `setDirection(degrees)`, `pointTowards(sprite)`, + `pointTowards(position)`, `pointTowardsMousePointer()`. `pointInDirection`, + `pointTowardsSprite`, `setDirection(Vector2)` and `move(Vector2)` are gone; + `Vector2.direction()` gives a vector's direction in Scratch degrees. +- **Colour effect and tint are two things:** `setColorEffect(…)` and + `changeColorEffect(…)` are Scratch's colour effect, exactly as Scratch draws it: the + hue turns, lightness and saturation stay (200 is once around). `setTint(Color)` or + `setTint(r, g, b)` multiplies the costume by a colour, for the whole sprite rather + than one costume. `setTint(hue)` and `changeTint` are gone. + + 6.x's `setTint(hue)` multiplied by a fully saturated colour, which darkens a costume + and pushes it towards that colour; the colour effect looks lighter, as in Scratch, + and its numbers mean something else (6.x went once around at 255). For the 6.x look + unchanged, use `setTint(Color.fromHSB(hue / 2.55, 100, 100))`. +- **Hitboxes:** `setHitbox(Shape)`, for example + `setHitbox(new Polygon(new double[] {0, 40, 40}, new double[] {0, 0, 30}))`. + `getHitbox()` returns the shape where it is on the stage now. The `Hitbox` class is + gone. +- `getWidth()` and `getHeight()` are `double` (35 % of 128 pixels is 44.8). +- `whenClicked()` runs when the mouse button goes **down** on the sprite, as in + Scratch, and only for the frontmost sprite under the pointer. 6.x waited for the + button to come up and called every sprite under it. + +## Stage and window + +- **Layers** replace the UI flags and the pen's background/foreground: + `setLayer(Layer.BACKGROUND | MAIN | FOREGROUND | UI)` on sprites, texts and pens. + `setUI`, `Text.setIsUI`, `Pen.goToBackground` and `goToForeground` are gone; + `goToFrontLayer` and the like order within a layer. +- **Debug mode** is on the window only: `Window.getInstance().setDebug(true)`. +- `Stage.exit()` is gone: `Window.getInstance().exit()`. +- `stage.getPixels()` is `Pixels.of(stage)`; `Pixels.of("terrain.png")` reads an + image's pixels without `ImageIO`. +- `stage.getSorting().byY()` is `stage.sortByY()`; sorting works within each layer. +- `removeAll()` removes sprites, texts and pens. +- `whenMouseWheelMoved(double)` takes a `double`. +- **Transitions:** `transitionToStage(() -> new Level2(), Transition.SLIDE_LEFT, 0.5)` or a transition + shader (`Transition.fromShader("wipe.frag")`). The new stage's `run()` starts once + the transition is over. +- **Display modes:** `Window.usePixelArt()` or `Window.useSmoothPixelArt()`, called + before `new Window(…)`, replace `useTextureSampling` and `Text.useSmoothing`. + `Window.isTransitioning()` is an instance method now. + +## Text + +The text engine is new: it reads sizes and kerning from the font file and breaks lines +itself. Spacing and line breaks differ a little from 6.x. + +- Sizes are `double`: `setTextSize(double)`, `getTextSize()`. +- Colours take a `Color` or `(red, green, blue)` from 0 to 255: + `setTextColor(new Color(0, 0, 0))`. A single number used to mean a hue, so + `setTextColor(0)` was red; that form is gone. +- `Text.useFontSizes` and `getDefaultFontSizes` are gone: sizes are made as needed. +- `Text.useFont(path, n)` now names a pixel font's grid (the size of one font pixel), + not a default size. +- Speech bubbles and texts in the world are drawn in front of the foreground pen, as + in Scratch. +- `new Text(sprite)` and the copy constructor are gone. + +## Colours + +`Color` cannot be changed any more: `color.withHue(…)`, `withRed(…)` and so on return +a new colour, and the `HtmlColor` constants are `final`. There is one colour model, +Scratch's: hue, saturation and brightness from 0 to 100 (`getHue()`, +`Color.fromHSB(…)`), next to red, green and blue from 0 to 255. `getH`, `getS`, `getL`, +`getHSB`, `setHSB`, `setRGB`, `changeColor` and `new Color(hue)` are gone. +`toString()` gives `#rrggbb`. + +A pen's hue (`pen.setColor(hue)`) goes from 0 to 100, as in Scratch; 6.x used 0 to 255. + +## Shaders + +Shaders have a new, shorter format: only the body of a fragment shader, with these +names provided: + +```glsl +// uniform sampler2D costume; the costume (or the stage) drawn by the shader +// uniform vec2 resolution; its size in pixels +// uniform float time; game time in seconds +// in vec2 uv; 0,0 top left to 1,1 bottom right +// out vec4 color; the result, straight alpha + +void main() { + vec4 c = texture(costume, uv); + color = vec4(1.0 - c.rgb, c.a); +} +``` + +`time` and `resolution` are filled in by the library; setting them with `Shader.set` +is an error. `migrate-7.py` converts Processing shaders (`texture2D(texture, …)`, +`vertTexCoord`, `gl_FragColor`). Vertex shaders and `getPShader()` are gone. + +## Sound and images + +- Sound plays through OpenAL: many copies of a sound at once, short latency, the same + on every operating system. **WAV and OGG** are supported; AIFF and AU are not any + more (MP3 never was). +- Images: PNG, JPEG, GIF (first frame), BMP and TGA. + +## Keys + +`KeyCode` is a plain enum: `getCode()` and `fromCode(int)` (AWT's key numbers) are +gone. Letters follow the keyboard layout. + +## Tiled maps + +`map.showLayer("ground", Layer.BACKGROUND)` draws a map layer every frame and +`hideLayer` removes it; `stampLayerToBackground` and `stampLayerToForeground` are +gone. Drop the code that stamped a layer again after `eraseAll()`. + +## Processing is gone + +Everything that exposed Processing (`PGraphics`, `PImage`, `PShader`) is gone: +`Pen.draw`, `Shape.draw`, `Text.draw`, `Shader.getPShader`, `new Pixels(PGraphics, …)`. +To draw by hand, use `Drawing` or `DrawingSprite` from `scratch-drawing`. Writing an +extension of your own: see the extension starter in the repository +(`templates/extension-starter`). diff --git a/docs/book/migration.md b/docs/book/migration.md index 97e9d802..99efd1ca 100644 --- a/docs/book/migration.md +++ b/docs/book/migration.md @@ -31,12 +31,13 @@ import org.openpatch.scratch.*; class Greeting extends Sprite { int phase = 0; + Timer greeting = new Timer(); public void run() { if (phase == 0) { - this.say("Hello!", 2000); - this.getTimer("greeting").reset(); + this.say("Hello!", 2); + greeting.reset(); phase = 1; - } else if (phase == 1 && this.getTimer("greeting").afterMillis(2000)) { + } else if (phase == 1 && greeting.after(2)) { this.changeX(20); phase = 2; } @@ -44,7 +45,7 @@ class Greeting extends Sprite { } ``` -The library calls `run()` about 60 times per second. Keep each call short. A +The library calls `run()` 60 times per second of game time. Keep each call short. A finite loop for an array is useful; an endless loop or sleeping in `run()` holds up the next frame. Pause/speed/step control game time in the supported revision. diff --git a/docs/book/multiple-approach-design.md b/docs/book/multiple-approach-design.md index be2b2427..85a9a351 100644 --- a/docs/book/multiple-approach-design.md +++ b/docs/book/multiple-approach-design.md @@ -139,7 +139,7 @@ public class Garden extends Stage { | The blocks are there from the start. | `extends Sprite` brings the methods along (`move`, `say`, `ifOnEdgeBounce`). | | A sprite's name is a label. | A name is how the code reaches an object: `Bunny bunny = new Bunny();` | | A custom block, or a broadcast to another sprite. | A method, called on an object: `bunny.jump()`. | -| `wait 1 seconds` pauses one script. | `run()` must not wait. A sprite counts time with a timer instead: `this.getTimer().everyMillis(1000)`. | +| `wait 1 seconds` pauses one script. | `run()` must not wait. A sprite counts time with a timer instead: `this.getTimer().every(1)`. | ## Going further: the window and animations @@ -161,7 +161,7 @@ class TitleStage extends Stage { public void whenKeyPressed(KeyCode keyCode) { if (keyCode == KeyCode.SPACE) { - Window.getInstance().transitionToStage(new Garden(), 500); + Window.getInstance().transitionToStage(new Garden(), 0.5); } } } @@ -184,13 +184,13 @@ public class GardenWindow extends Window { } ``` -**Animations.** An `AnimatedSprite` plays its costumes one after another, at its -own speed. It does the timing that a `wait` block did in Scratch: +**Animations.** A sprite with an animation plays its costumes one after another, at +its own speed. It does the timing that a `wait` block did in Scratch: ```java import org.openpatch.scratch.*; -class Bunny extends AnimatedSprite { +class Bunny extends Sprite { public Bunny() { this.addAnimation("walk", "bunny1_walk%d", 2); this.setSize(50); diff --git a/docs/book/scratch-to-java.md b/docs/book/scratch-to-java.md index 4614f699..a6c64ff8 100644 --- a/docs/book/scratch-to-java.md +++ b/docs/book/scratch-to-java.md @@ -11,8 +11,7 @@ ends with a semicolon. Look a method up in the [documentation](/reference) to se the block, an explanation and an example you can run. :::alert{info} -Times are in **milliseconds**: `1000` is one second. Only `glide` counts in -seconds, like Scratch. +Times are in **seconds**, as in Scratch: `0.5` is half a second. ::: ## Events @@ -53,7 +52,7 @@ seconds, like Scratch. | Scratch | Java | | --- | --- | -| say [Hello!] for (2) seconds | `this.say("Hello!", 2000);` | +| say [Hello!] for (2) seconds | `this.say("Hello!", 2);` | | say [Hello!] | `this.say("Hello!");` | | think [Hmm...] | `this.think("Hmm...");` | | *(adding a costume)* | in the constructor: `this.addCostume("bunny1_stand");` | @@ -64,7 +63,7 @@ seconds, like Scratch. | next backdrop | in the stage: `this.nextBackdrop();` | | change size by (10) | `this.changeSize(10);` | | set size to (50) % | `this.setSize(50);` | -| change [color] effect by (25) | `this.changeTint(25);` | +| change [color] effect by (25) | `this.changeColorEffect(25);` | | set [ghost] effect to (50) | `this.setTransparency(50);` | | show / hide | `this.show();` / `this.hide();` | | go to [front] layer | `this.goToFrontLayer();` | @@ -85,14 +84,14 @@ seconds, like Scratch. | Scratch | Java | | --- | --- | | forever | `run()` is already repeated, see [Differences to Scratch](/differences-scratch) | -| wait (1) seconds | `if (this.getTimer().everyMillis(1000)) { ... }` inside `run()` | +| wait (1) seconds | `if (this.getTimer().every(1)) { ... }` inside `run()` | | repeat (10) | `for (int i = 0; i < 10; i++) { ... }` | | if <> then | `if (...) { ... }` | | if <> then … else | `if (...) { ... } else { ... }` | -| wait until <> | `if (...) { ... }` inside `run()`: it is checked again every frame | +| wait until <> | `if (...) { ... }` inside `run()`: it is checked again every tick (60 times a second) | | repeat until <> | `while (!...) { ... }`, but never inside `run()`. Usually an `if` in `run()` is what you want. | | stop [all] | `Window.getInstance().exit();` | -| create clone of [myself] | `this.clone();` | +| create clone of [myself] | `this.createClone();` | | when I start as a clone | `public void whenStartsAsClone() { ... }` | | delete this clone | `this.deleteThisClone();` | @@ -109,8 +108,8 @@ seconds, like Scratch. | | `this.isKeyPressed(KeyCode.SPACE)` | | | `this.isMouseDown()` | | (mouse x), (mouse y) | `this.getMouseX()`, `this.getMouseY()` | -| (timer) | `Timer.millis()` | -| reset timer | `this.getTimer().reset();`, then `this.getTimer().afterMillis(30000)` is true after 30 seconds | +| (timer) | `this.getTimer().getSeconds()` | +| reset timer | `this.getTimer().reset();`, then `this.getTimer().after(30)` is true after 30 seconds | ## Operators diff --git a/docs/book/setup.md b/docs/book/setup.md index 1514cd0b..f7053ad8 100644 --- a/docs/book/setup.md +++ b/docs/book/setup.md @@ -12,7 +12,7 @@ them, so you can start in one and move on to another later. | --- | --- | --- | | **Browser** | Nothing. Open [Your first program](/tutorials/getting-started) and press ▶. | Trying it out, the first lessons, homework | | **Studio** | [Download Studio](/download) and install it. Java and the library are included. | Working on your own computer or school computers, also offline | -| **BlueJ, VS Code or another Java editor** | Java 17 or newer and the library, see below. | Courses that already use one of these | +| **VS Code or another Java editor** | Java 17 or newer and the library, see below. | Courses that already use one of these | :::alert{info} Does your course use the classes of the NRW Zentralabitur (`List`, `Queue`, @@ -27,8 +27,8 @@ of Scratch for Java made for them. load it again on the other side. Studio can open these downloads too. - **In Studio** press Ctrl+S (Cmd+S on a Mac). Your project is an ordinary folder of Java files and pictures. Keep that folder together when you copy it. -- **In BlueJ or VS Code** your project is a folder as well. Copy the whole folder, - including the `+libs` folder with the library inside. +- **In VS Code or another editor** your project is a folder as well. Copy the + whole folder, including the `+libs` folder with the library inside. ## From the browser to your own computer @@ -42,9 +42,8 @@ void main() { ``` That is a complete Java program in Java 25 and newer, and Studio runs it as it -is. In BlueJ and elsewhere, put the same lines into a `main` method of your -stage, and in BlueJ run it by right-clicking `MyStage` and choosing -`void main(String[] args)`: +is. In other editors and with older Java, put the same lines into a `main` +method of your stage and run `MyStage`: ```java import org.openpatch.scratch.*; @@ -77,17 +76,12 @@ tutorial through the **Project** menu. First make sure you have the Java Extension Pack installed. You can find it in the Extensions view by searching for `redhat.java`. -Then [download](/download) the Scratch for Java JAR. +Then [download](/download) the Scratch for Java JAR, or start from the VS Code +starter project there, which is set up already. -Afterward, you need to add the jar to your project. You can do this by adding the following to your `settings.json`: - -```json -"java.project.referencedLibraries": [ - "path/to/scratch4j.jar" -] -``` - -If you want to be compatible with BlueJ you should use a "+libs" folder in your project, add the jar there and then add the following to your `settings.json`: +Create a folder called `+libs` inside your project and put the jar into it. Studio +keeps the library in the same place, so a project opens in both. Then add the +following to the `.vscode/settings.json` of your project: ```json "java.project.referencedLibraries": [ @@ -95,30 +89,6 @@ If you want to be compatible with BlueJ you should use a "+libs" folder in your ] ``` -## BlueJ - -You can install this library via three ways in BlueJ. - -First, [download](/download) the Scratch for Java JAR, or start from the BlueJ starter project there, which already has it in its `+libs` folder. - -### Project-by-project - -Create a directory called "+libs" inside your project. Copy the Scratch for Java jar into the "+libs" folder. Restart BlueJ - done. Scratch for Java will now be available for this project. - -### User Preferences - -Open the "Preferences" dialogue and select the "Libraries" tab. Then add the location where the Scratch for Java jar is located. Restart BlueJ - done. Scratch for Java will now be available in all of your projects that you open. - -### System Wide - -You need to locate the "userlib" folder, found at `/lib/userlib`. Place the Scratch for Java jar into this folder. Restart BlueJ - done. Scratch for Java will now be available in all projects for all users. - -If you have installed BlueJ via the installer you probably find the "userlib" folder here: - -- Windows: `C:\Program Files\BlueJ\lib\userlib` -- MacOS: `/Application/BlueJ/BlueJ.app/Resources/java/userlib` -- Linux: `/usr/share/bluej/userlib/` - ## Standalone Add the [JAR](/download) to the classpath. @@ -136,4 +106,14 @@ You can also use Scratch for Java via Maven. Just add the following dependency t ``` +The extensions are artifacts of their own. Add the ones you use, with the same +group and version (the `-all` jar and Studio contain all of them): + +| Artifact | Package | For | +| --- | --- | --- | +| `scratch-tiled` | `org.openpatch.scratch.tiled` | maps from the Tiled map editor | +| `scratch-save` | `org.openpatch.scratch.save` | saving progress, JSON and XML files | +| `scratch-recorder` | `org.openpatch.scratch.recorder` | recording the stage as a GIF | +| `scratch-drawing` | `org.openpatch.scratch.drawing` | sprites that draw themselves, bitmap fonts | + We have also prepared a starter for you: [Maven Starter](https://github.com/openpatch/scratch-for-java-maven-starter/tree/main) diff --git a/docs/book/troubleshooting.md b/docs/book/troubleshooting.md index 515e2149..d93f9659 100644 --- a/docs/book/troubleshooting.md +++ b/docs/book/troubleshooting.md @@ -28,8 +28,9 @@ myWindow.setStage(new MyStage()); ``` In the browser and in Studio those lines are in the `void main()` at the top. In -BlueJ, right-click `MyStage` and choose `void main(String[] args)`. Without -`setStage` the window stays empty, and the library says so in the terminal. +other editors they are in the `main` method of your stage (see +[Setup](/setup)). Without `setStage` the window stays empty, and the library says +so in the terminal. **It is off the stage or very small.** The middle of the stage is x: 0, y: 0. A stage is usually 480 wide and 360 high, so x goes from -240 to 240 and y from -180 @@ -37,7 +38,7 @@ to 180. Check `setPosition` and `setSize`. ## "Costume not found" or a picture is missing -Look at the output below the editor, or the console in BlueJ. Scratch for Java +Look at the output below the editor, or the console of your editor. Scratch for Java tells you which name it could not find and suggests the closest names it knows. - Names are case-sensitive: `bunny1_stand` works, `Bunny1_Stand` does not. diff --git a/docs/book/tutorials/bouncy-hedgehog.md b/docs/book/tutorials/bouncy-hedgehog.md index d782e73e..a52fbb00 100644 --- a/docs/book/tutorials/bouncy-hedgehog.md +++ b/docs/book/tutorials/bouncy-hedgehog.md @@ -270,7 +270,7 @@ class HedgehogSprite extends Sprite { So far every picture was built in. You can use your own just as well: a drawing of yours, a photo, or a picture from the internet that you are allowed to use. -This needs Studio, BlueJ or VS Code, because the browser editor cannot load files +This needs Studio or VS Code, because the browser editor cannot load files from your computer. Download the project with a hedgehog, a trampoline and a playground as picture files: @@ -386,5 +386,5 @@ public class HedgehogSprite extends Sprite { ::: -When you are confident, try [setTint](/reference/Sprite/setTint) to change +When you are confident, try [changeColorEffect](/reference/Sprite/changeColorEffect) to change Spike's colour every time he bounces. diff --git a/docs/book/tutorials/catch-the-coins.md b/docs/book/tutorials/catch-the-coins.md index ed7d3858..6590fe09 100644 --- a/docs/book/tutorials/catch-the-coins.md +++ b/docs/book/tutorials/catch-the-coins.md @@ -400,7 +400,7 @@ public class CatchStage extends Stage { Stop the game after 30 seconds. :::collapsible{title="Hint"} -The stage has a `run()` too, and a timer: `this.getTimer().afterMillis(30000)` is +The stage has a `run()` too, and a timer: `this.getTimer().after(30)` is true once 30 seconds have passed. `Window.getInstance().pause()` stops the game and leaves the last picture on the screen. ::: @@ -410,7 +410,7 @@ Add this method to `CatchStage`: ```java public void run() { - if (this.getTimer().afterMillis(30000)) { + if (this.getTimer().after(30)) { this.scoreText.showText("Time's up! Coins: " + this.score); Window.getInstance().pause(); } diff --git a/docs/book/tutorials/dodge-the-rocks.md b/docs/book/tutorials/dodge-the-rocks.md index 1d875eab..76ecb28a 100644 --- a/docs/book/tutorials/dodge-the-rocks.md +++ b/docs/book/tutorials/dodge-the-rocks.md @@ -108,11 +108,11 @@ smaller and a little faster: ```java import org.openpatch.scratch.*; -public class Alien extends AnimatedSprite { +public class Alien extends Sprite { public Alien() { this.addCostume("alienGreen_stand"); this.addAnimation("walk", "alienGreen_walk%d", 2); - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); this.setSize(45); this.setRotationStyle(RotationStyle.LEFT_RIGHT); this.setY(-140); @@ -291,11 +291,11 @@ class GameStage extends Stage { } } -class Alien extends AnimatedSprite { +class Alien extends Sprite { public Alien() { this.addCostume("alienGreen_stand"); this.addAnimation("walk", "alienGreen_walk%d", 2); - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); this.setSize(45); this.setRotationStyle(RotationStyle.LEFT_RIGHT); this.setY(-140); diff --git a/docs/book/tutorials/getting-started.md b/docs/book/tutorials/getting-started.md index a04f686e..9a27de4c 100644 --- a/docs/book/tutorials/getting-started.md +++ b/docs/book/tutorials/getting-started.md @@ -15,7 +15,7 @@ do not have to download a single picture. :::alert{info} You can do this whole page in the browser: every code box with a **▶** is a -real editor. Working in Studio, BlueJ or VS Code instead? Get it ready with +real editor. Working in Studio or VS Code instead? Get it ready with [Setup](/setup) first, then come back. ::: diff --git a/docs/book/tutorials/make-it-walk.md b/docs/book/tutorials/make-it-walk.md index eef12705..384e6976 100644 --- a/docs/book/tutorials/make-it-walk.md +++ b/docs/book/tutorials/make-it-walk.md @@ -46,12 +46,12 @@ next costume ::: If you called it in `run()` it would swap sixty times a second, which is far too -fast to see. So it needs a timer: `everyMillis(200)` is true once every fifth of +fast to see. So it needs a timer: `every(0.2)` is true once every fifth of a second and false the rest of the time. ```java public void run() { - if (this.getTimer().everyMillis(200)) { + if (this.getTimer().every(0.2)) { this.nextCostume(); } } @@ -75,8 +75,8 @@ job: `run()` is called constantly and the timer decides when something happens. Two costumes and one timer is fine. Six costumes, plus a jump, plus a standing pose, and your `run()` fills up with counting. -`AnimatedSprite` is a `Sprite` that already knows how to do this. You give the -animation a name and tell it which costumes belong to it: +Every sprite already knows how to do this. You give the animation a name and +tell it which costumes belong to it: ```java this.addAnimation("walk", "alienGreen_walk%d", 2); @@ -95,11 +95,11 @@ while it is actually going somewhere, and stand still otherwise. ```java import org.openpatch.scratch.*; -public class Walker extends AnimatedSprite { +public class Walker extends Sprite { public Walker() { this.addCostume("alienGreen_stand"); this.addAnimation("walk", "alienGreen_walk%d", 2); - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); this.setSize(60); this.setRotationStyle(RotationStyle.LEFT_RIGHT); this.setY(-50); @@ -167,11 +167,11 @@ class WalkStage extends Stage { } } -class Walker extends AnimatedSprite { +class Walker extends Sprite { public Walker() { this.addCostume("alienGreen_stand"); this.addAnimation("walk", "alienGreen_walk%d", 2); - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); this.setSize(60); this.setRotationStyle(RotationStyle.LEFT_RIGHT); this.setY(-50); @@ -204,15 +204,12 @@ class Walker extends AnimatedSprite { ::: -Three things are new here: +Two things are new here: -- **`extends AnimatedSprite`** instead of `extends Sprite`. It can still do - everything a sprite can — `move`, `setDirection`, `ifOnEdgeBounce` are all - there — it simply knows about animations as well. - **`boolean walking`** remembers whether either key was held this frame, so the decision about which costume to wear is made once, after both checks. -- **`setAnimationInterval(150)`** is the same idea as the `200` in step 2: how - long each picture stays on screen. +- **`setAnimationInterval(0.15)`** is the same idea as the `0.2` in step 2: how + many seconds each picture stays on screen. ## The finished project @@ -240,14 +237,14 @@ back. When it is back on the ground (y: -50), it stops. ```java import org.openpatch.scratch.*; -public class Walker extends AnimatedSprite { +public class Walker extends Sprite { private double ySpeed = 0; public Walker() { this.addCostume("alienGreen_stand"); this.addCostume("alienGreen_jump"); this.addAnimation("walk", "alienGreen_walk%d", 2); - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); this.setSize(60); this.setRotationStyle(RotationStyle.LEFT_RIGHT); this.setY(-50); @@ -323,10 +320,10 @@ The start of `run()`: public void run() { boolean walking = false; int speed = 3; - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); if (this.isKeyPressed(KeyCode.SHIFT)) { speed = 6; - this.setAnimationInterval(75); + this.setAnimationInterval(0.075); } if (this.isKeyPressed(KeyCode.RIGHT)) { diff --git a/docs/book/tutorials/red-light-green-light.md b/docs/book/tutorials/red-light-green-light.md index 2c5b54f6..5eb61508 100644 --- a/docs/book/tutorials/red-light-green-light.md +++ b/docs/book/tutorials/red-light-green-light.md @@ -52,7 +52,7 @@ public class Referee extends Sprite { } public void run() { - if (this.getTimer().everyMillis(2200)) { + if (this.getTimer().every(2.2)) { this.green = !this.green; if (this.green) { this.say("Go!"); @@ -106,7 +106,7 @@ public class Racer extends Sprite { return; } this.changeX(this.speed); - if (this.getTimer().everyMillis(150)) { + if (this.getTimer().every(0.15)) { this.nextCostume(); } if (this.getX() > 170) { @@ -192,7 +192,7 @@ class Referee extends Sprite { } public void run() { - if (this.getTimer().everyMillis(2200)) { + if (this.getTimer().every(2.2)) { this.green = !this.green; if (this.green) { this.say("Go!"); @@ -234,7 +234,7 @@ class Racer extends Sprite { return; } this.changeX(this.speed); - if (this.getTimer().everyMillis(150)) { + if (this.getTimer().every(0.15)) { this.nextCostume(); } if (this.getX() > 170) { @@ -346,7 +346,7 @@ public class Referee extends Sprite { } public void run() { - if (this.getTimer().everyMillis(this.delay)) { + if (this.getTimer().every((this.delay) / 1000.0)) { this.green = !this.green; this.delay = Random.randomInt(800, 3000); if (this.green) { diff --git a/docs/hyperbook.json b/docs/hyperbook.json index e8b12850..e2f446e2 100644 --- a/docs/hyperbook.json +++ b/docs/hyperbook.json @@ -45,7 +45,8 @@ "elements": { "bookmarks": false, "onlineide": { - "cdn": "https://cdn.openpatch.org/onlineide/v2.2.1-hyperbook.37/" + "bookmarks": false, + "cdn": false } }, "license": "CC-BY-NC-SA", diff --git a/docs/public/catalogs/api.json b/docs/public/catalogs/api.json index 0196cda3..8487f182 100644 --- a/docs/public/catalogs/api.json +++ b/docs/public/catalogs/api.json @@ -4,606 +4,594 @@ "browserVersion": "6.5.0-browser.1", "methods": [ { - "id": "AnimatedSprite/addAnimation(String,String,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", - "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int" - ], - "parameterNames": [ - "name", - "pattern", - "frames" - ], - "params": [ - "String name", - "String pattern", - "int frames" - ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.", - "scratchblock": null, - "paramDocs": [ - "name: the name of the animation", - "pattern: the pattern (@see String#format) of the file names. The frame\n starts from 1.", - "frames: the number of frames in the animation" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt eine Animation hinzu. %d im Muster wird durch 1..frames ersetzt, z.B. bunny1_walk%d" - } - } - }, - { - "id": "AnimatedSprite/addAnimation(String,Function,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/changeX(double)", + "memberId": "Camera/changeX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "changeX", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.util.function.Function", - "int" + "double" ], "parameterNames": [ - "name", - "builder", - "frame" + "dx" ], "params": [ - "String name", - "Function builder", - "int frame" + "double dx" ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nTo add an animation with file names \"walk_1.png\", \"walk_2.png\",\n\"walk_3.png\", you can use the following code:\n\n```java\nsprite.addAnimation(\"walk\", i -> \"walk_\" + i + \".png\", 3);\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the animation", - "builder: a function that builds the file names for the animation frames", - "frame: the number of frames in the animation. The frame starts from\n 1." + "dx: how far to move the camera along x" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/changeX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt eine Animation an; builder liefert zu 1..frames jeweils den Bildpfad" - } - } + "translations": {} }, { - "id": "AnimatedSprite/addAnimation(String,String,int,int,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/changeY(double)", + "memberId": "Camera/changeY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "changeY", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int" + "double" ], "parameterNames": [ - "name", - "path", - "frames", - "width", - "height" + "dy" ], "params": [ - "String name", - "String path", - "int frames", - "int width", - "int height" + "double dy" ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nFor an animation sprite sheet, where each frame is of equal width and height,\nyou can use this method to add an animation by specifying the path to the\nsprite sheet, the number of frames, and the dimensions of each frame.\nFor example, for a four-frame animation arranged in a single row, each frame\nbeing 64x64 pixels, you can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64);\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the animation", - "path: the path to the animation frames", - "frames: the number of frames in the animation", - "width: the width of each frame", - "height: the height of each frame" + "dy: how far to move the camera along y" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/changeY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zerlegt ein Bild in gleich große Einzelbilder und legt daraus eine Animation an" - } - } + "translations": {} }, { - "id": "AnimatedSprite/addAnimation(String,String,int,int,int,int)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/changeZoom(double)", + "memberId": "Camera/changeZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "changeZoom", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int", - "int" + "double" ], "parameterNames": [ - "name", - "path", - "frames", - "width", - "height", - "row" + "dz" ], "params": [ - "String name", - "String path", - "int frames", - "int width", - "int height", - "int row" + "double dz" ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nIf the animation frames are arranged in rows in a sprite sheet, you can use\nthis method to specify which row to use for the animation.\n\nFor example, for a four-frame animation arranged in a single row, you want the second, each frame\nbeing 64x64 pixels, you can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64, 2);\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the animation", - "path: the path to the animation frames", - "frames: the number of frames in the animation", - "width: the width of each frame", - "height: the height of each frame", - "row: the row of the animation frames" + "dz: percentage points to add to the zoom" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/changeZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wie addAnimation(name, imagePath, frames, width, height), beginnt aber in der angegebenen Zeile" - } - } + "translations": {} }, { - "id": "AnimatedSprite/addAnimation(String,String,int,int,int,int,boolean)", - "memberId": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "addAnimation", + "id": "Camera/constructor()", + "memberId": "Camera/constructor", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "constructor", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int", - "int", - "boolean" - ], - "parameterNames": [ - "name", - "path", - "frames", - "width", - "height", - "column", - "useColumns" - ], - "params": [ - "String name", - "String path", - "int frames", - "int width", - "int height", - "int column", - "boolean useColumns" - ], - "summary": "Adds an animation to the sprite.", - "description": "Adds an animation to the sprite.\n\nIf the animation frames are arranged in either rows or columns in a sprite\nsheet, you can use this method to specify which column or row to use for the\nanimation. Take four frame animation arranged in a single column. Each frame is\n64x64 pixels. You can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64, 1, true); // use column 1\n```", + "returnType": "Camera", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A camera at (0, 0) with zoom 100. Every stage has its own: `getStage().getCamera()`.", + "description": "A camera at (0, 0) with zoom 100. Every stage has its own: `getStage().getCamera()`.", "scratchblock": null, - "paramDocs": [ - "name: the name of the animation", - "path: the path to the animation frames", - "frames: the number of frames in the animation", - "width: the width of each frame", - "height: the height of each frame", - "column: the column of the animation frames", - "useColumns: whether to use columns or rows" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/addAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt eine Animation aus einer Spalte des Bildes an" - } - } + "translations": {} }, { - "id": "AnimatedSprite/clone()", - "memberId": "AnimatedSprite/clone", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "clone", + "id": "Camera/getPosition()", + "memberId": "Camera/getPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getPosition", "static": false, - "returnType": "AnimatedSprite", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a clone of this sprite with the same animations, playing the same\none, and puts it on the stage right behind this sprite. See\n[Sprite.clone()](../Sprite/clone).", - "description": "Creates a clone of this sprite with the same animations, playing the same\none, and puts it on the stage right behind this sprite. See\n[Sprite.clone()](../Sprite/clone).", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the clone, of the same class as this sprite", + "returns": "the world position at the stage's centre", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/clone", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie dieser Figur" - } - } + "translations": {} }, { - "id": "AnimatedSprite/constructor()", - "memberId": "AnimatedSprite/constructor", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "constructor", + "id": "Camera/getX()", + "memberId": "Camera/getX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getX", "static": false, - "returnType": "AnimatedSprite", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.", - "description": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.\n\nExample usage:\n\n```java\nAnimatedSprite sprite = new AnimatedSprite();\nsprite.addCostume(\"idle\", \"assets/idle.png\");\nsprite.addAnimation(\"walk\", \"assets/walk_%d.png\", 4);\nsprite.playAnimation(\"walk\");\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the world x at the stage's centre", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine neue animierte Figur" - } - } - }, - { - "id": "AnimatedSprite/constructor(AnimatedSprite)", - "memberId": "AnimatedSprite/constructor", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "constructor", - "static": false, - "returnType": "AnimatedSprite", - "parameterTypes": [ - "org.openpatch.scratch.AnimatedSprite" - ], - "parameterNames": [ - "animatedSprite" - ], - "params": [ - "AnimatedSprite animatedSprite" - ], - "summary": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.", - "description": "The AnimatedSprite class represents a sprite that can play animations. It\nextends the Sprite\nclass and provides methods to add animations, play animations, set the\ninterval between animation\nframes, and reset the animation.\n\nExample usage:\n\n```java\nAnimatedSprite sprite = new AnimatedSprite();\nsprite.addCostume(\"idle\", \"assets/idle.png\");\nsprite.addAnimation(\"walk\", \"assets/walk_%d.png\", 4);\nsprite.playAnimation(\"walk\");\n```", - "scratchblock": null, - "paramDocs": [ - "animatedSprite: " - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie der angegebenen animierten Figur" - } - } + "translations": {} }, { - "id": "AnimatedSprite/getAnimationFrame()", - "memberId": "AnimatedSprite/getAnimationFrame", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "getAnimationFrame", + "id": "Camera/getY()", + "memberId": "Camera/getY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getY", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the current animation frame.", - "description": "Gets the current animation frame.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the current animation frame", + "returns": "the world y at the stage's centre", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/getAnimationFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Nummer des aktuellen Einzelbildes zurück" - } - } + "translations": {} }, { - "id": "AnimatedSprite/getAnimationInterval()", - "memberId": "AnimatedSprite/getAnimationInterval", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "getAnimationInterval", + "id": "Camera/getZoom()", + "memberId": "Camera/getZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "getZoom", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the interval between animation frames.", - "description": "Gets the interval between animation frames.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the interval between animation frames", + "returns": "the zoom in percent", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/getAnimationInterval", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/getZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt zurück, wie viele Millisekunden ein Einzelbild angezeigt wird" - } - } + "translations": {} }, { - "id": "AnimatedSprite/isAnimationPlayed()", - "memberId": "AnimatedSprite/isAnimationPlayed", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "isAnimationPlayed", + "id": "Camera/resetZoom()", + "memberId": "Camera/resetZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "resetZoom", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the animation is played.", - "description": "Checks if the animation is played.", + "summary": "Back to zoom 100.", + "description": "Back to zoom 100.", "scratchblock": null, "paramDocs": [], - "returns": "true if the animation is played, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/isAnimationPlayed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/resetZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn eine mit once gestartete Animation durchgelaufen ist" - } - } + "translations": {} }, { - "id": "AnimatedSprite/playAnimation(String)", - "memberId": "AnimatedSprite/playAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "playAnimation", + "id": "Camera/setPosition(double,double)", + "memberId": "Camera/setPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double" ], "parameterNames": [ - "name" + "x", + "y" ], "params": [ - "String name" + "double x", + "double y" ], - "summary": "Plays the animation with the specified name.", - "description": "Plays the animation with the specified name.", + "summary": "Centres the camera on a world position.", + "description": "Centres the camera on a world position.", "scratchblock": null, "paramDocs": [ - "name: the name of the animation to play" + "x: world x", + "y: world y" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/playAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Spielt die Animation in einer Schleife ab" - } - } + "translations": {} }, { - "id": "AnimatedSprite/playAnimation(String,boolean)", - "memberId": "AnimatedSprite/playAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "playAnimation", + "id": "Camera/setPosition(Vector2)", + "memberId": "Camera/setPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "boolean" + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "name", - "once" + "position" ], "params": [ - "String name", - "boolean once" + "Vector2 position" ], - "summary": "Plays the animation with the specified name.", - "description": "Plays the animation with the specified name.", + "summary": "Centres the camera on a world position.", + "description": "Centres the camera on a world position.", "scratchblock": null, "paramDocs": [ - "name: the name of the animation to play", - "once: whether to play the animation once" + "position: world position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/playAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Spielt die Animation ab; bei once == true nur ein einziges Mal" - } - } + "translations": {} }, { - "id": "AnimatedSprite/resetAnimation()", - "memberId": "AnimatedSprite/resetAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "resetAnimation", + "id": "Camera/setX(double)", + "memberId": "Camera/setX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setX", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Resets the animation. The animation will start from the first frame.", - "description": "Resets the animation. The animation will start from the first frame.", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "x" + ], + "params": [ + "double x" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "x: the world x to show at the stage's centre" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/resetAnimation", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Animation auf das erste Einzelbild zurück" - } - } + "translations": {} }, { - "id": "AnimatedSprite/setAnimationFrame(int)", - "memberId": "AnimatedSprite/setAnimationFrame", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "setAnimationFrame", + "id": "Camera/setY(double)", + "memberId": "Camera/setY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setY", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double" ], "parameterNames": [ - "frame" + "y" ], "params": [ - "int frame" + "double y" ], - "summary": "Sets the current animation frame.", - "description": "Sets the current animation frame.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "frame: the current animation frame" + "y: the world y to show at the stage's centre" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/setAnimationFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Springt zum Einzelbild mit der angegebenen Nummer" - } - } + "translations": {} }, { - "id": "AnimatedSprite/setAnimationInterval(int)", - "memberId": "AnimatedSprite/setAnimationInterval", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "setAnimationInterval", + "id": "Camera/setZoom(double)", + "memberId": "Camera/setZoom", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setZoom", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double" ], "parameterNames": [ - "interval" + "zoom" ], "params": [ - "int interval" + "double zoom" ], - "summary": "Sets the interval between animation frames.", - "description": "Sets the interval between animation frames.", + "summary": "Sets the zoom in percent: 200 shows everything twice as large, 50 half as large. It stays\nwithin the zoom limits (50 to 200 unless changed).", + "description": "Sets the zoom in percent: 200 shows everything twice as large, 50 half as large. It stays\nwithin the zoom limits (50 to 200 unless changed).", "scratchblock": null, "paramDocs": [ - "interval: the interval between animation frames" + "zoom: the zoom in percent" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/setAnimationInterval", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setZoom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt fest, wie viele Millisekunden ein Einzelbild angezeigt wird" - } - } + "translations": {} }, { - "id": "AnimatedSprite/toString()", - "memberId": "AnimatedSprite/toString", - "owner": "org.openpatch.scratch.AnimatedSprite", - "className": "AnimatedSprite", - "methodName": "toString", + "id": "Camera/setZoomLimit(double,double)", + "memberId": "Camera/setZoomLimit", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "setZoomLimit", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns which animation is playing and how far into it.", - "description": "Returns which animation is playing and how far into it.", + "returnType": "void", + "parameterTypes": [ + "double", + "double" + ], + "parameterNames": [ + "min", + "max" + ], + "params": [ + "double min", + "double max" + ], + "summary": "Limits the zoom.", + "description": "Limits the zoom.", "scratchblock": null, - "paramDocs": [], - "returns": "the sprite as a text", + "paramDocs": [ + "min: the smallest zoom in percent", + "max: the largest zoom in percent" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/AnimatedSprite/toString", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/setZoomLimit", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Figur als Zeichenkette zurück" - } - } + "translations": {} + }, + { + "id": "Camera/toScreenPosition(Vector2)", + "memberId": "Camera/toScreenPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toScreenPosition", + "static": false, + "returnType": "Vector2", + "parameterTypes": [ + "org.openpatch.scratch.Vector2" + ], + "parameterNames": [ + "world" + ], + "params": [ + "Vector2 world" + ], + "summary": "Where a world position shows on the stage.", + "description": "Where a world position shows on the stage.", + "scratchblock": null, + "paramDocs": [ + "world: a world position" + ], + "returns": "the screen position (origin at the stage's centre)", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toScreenPosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toScreenX(double)", + "memberId": "Camera/toScreenX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toScreenX", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "worldX" + ], + "params": [ + "double worldX" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "worldX: a world x" + ], + "returns": "where it shows on the stage", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toScreenX", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toScreenY(double)", + "memberId": "Camera/toScreenY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toScreenY", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "worldY" + ], + "params": [ + "double worldY" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "worldY: a world y" + ], + "returns": "where it shows on the stage", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toScreenY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toWorldPosition(Vector2)", + "memberId": "Camera/toWorldPosition", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toWorldPosition", + "static": false, + "returnType": "Vector2", + "parameterTypes": [ + "org.openpatch.scratch.Vector2" + ], + "parameterNames": [ + "screen" + ], + "params": [ + "Vector2 screen" + ], + "summary": "Which world position shows at a place on the stage.", + "description": "Which world position shows at a place on the stage.", + "scratchblock": null, + "paramDocs": [ + "screen: a screen position (origin at the stage's centre)" + ], + "returns": "the world position", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toWorldPosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toWorldX(double)", + "memberId": "Camera/toWorldX", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toWorldX", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "screenX" + ], + "params": [ + "double screenX" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "screenX: an x on the stage" + ], + "returns": "the world x shown there", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toWorldX", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Camera/toWorldY(double)", + "memberId": "Camera/toWorldY", + "owner": "org.openpatch.scratch.Camera", + "className": "Camera", + "methodName": "toWorldY", + "static": false, + "returnType": "double", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "screenY" + ], + "params": [ + "double screenY" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "screenY: a y on the stage" + ], + "returns": "the world y shown there", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Camera/toWorldY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} }, { "id": "Circle/constructor(double,double,double)", @@ -628,13 +616,13 @@ "double y", "double radius" ], - "summary": "Creates a circle with no specified position or size.", - "description": "Creates a circle with no specified position or size.", + "summary": "A circle.", + "description": "A circle.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate of the circle's center", - "y: the y-coordinate of the circle's center", - "radius: the radius of the circle" + "x: x of the centre", + "y: y of the centre", + "radius: the radius" ], "returns": null, "since": "", @@ -882,64 +870,88 @@ } }, { - "id": "Color/changeColor(double)", - "memberId": "Color/changeColor", + "id": "Color/constructor(double,double,double)", + "memberId": "Color/constructor", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "changeColor", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ + "double", + "double", "double" ], "parameterNames": [ - "h" + "red", + "green", + "blue" ], "params": [ - "double h" + "double red", + "double green", + "double blue" ], - "summary": "Changes the color accordining to a hue value, which is added to the current hue value. When the\nresulting value is greater than 255 it will be reset. For example: 285 => 30.", - "description": "Changes the color accordining to a hue value, which is added to the current hue value. When the\nresulting value is greater than 255 it will be reset. For example: 285 => 30.", + "summary": "A colour from red, green and blue, each from 0 to 255 (values outside are clamped). The\ncolour is opaque.", + "description": "A colour from red, green and blue, each from 0 to 255 (values outside are clamped). The\ncolour is opaque.", "scratchblock": null, "paramDocs": [ - "h: A hue value. Could be any positive or negative number." + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/changeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert den Farbton um den angegebenen Wert" + "description": "Erzeugt eine Farbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" } } }, { - "id": "Color/constructor()", + "id": "Color/constructor(double,double,double,double)", "memberId": "Color/constructor", "owner": "org.openpatch.scratch.Color", "className": "Color", "methodName": "constructor", "static": false, "returnType": "Color", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Constructs a new Color object with default values.", - "description": "Constructs a new Color object with default values.", + "parameterTypes": [ + "double", + "double", + "double", + "double" + ], + "parameterNames": [ + "red", + "green", + "blue", + "alpha" + ], + "params": [ + "double red", + "double green", + "double blue", + "double alpha" + ], + "summary": "A colour from red, green, blue and alpha, each from 0 to 255 (values outside are clamped).\nAn alpha of 0 is invisible, 255 opaque.", + "description": "A colour from red, green, blue and alpha, each from 0 to 255 (values outside are clamped).\nAn alpha of 0 is invisible, 255 opaque.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255", + "alpha: opacity from 0 to 255" + ], "returns": null, "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt die Farbe Weiß" - } - } + "translations": {} }, { "id": "Color/constructor(String)", @@ -953,16 +965,16 @@ "java.lang.String" ], "parameterNames": [ - "hexCode" + "hex" ], "params": [ - "String hexCode" + "String hex" ], - "summary": "The Color class represents a color in the Scratch environment. It supports various\nfunctionalities such as setting color values in the RGB and HSB spectrum, changing the color\nbased on a hue value, and converting between RGB and HSB color codes.", - "description": "The Color class represents a color in the Scratch environment. It supports various\nfunctionalities such as setting color values in the RGB and HSB spectrum, changing the color\nbased on a hue value, and converting between RGB and HSB color codes.", + "summary": "A colour from a hex code as in HTML and CSS: `\"#ff8000\"`, `\"ff8000\"`,\n`\"#f80\"`, or with alpha `\"#ff800080\"`.", + "description": "A colour from a hex code as in HTML and CSS: `\"#ff8000\"`, `\"ff8000\"`,\n`\"#f80\"`, or with alpha `\"#ff800080\"`.", "scratchblock": null, "paramDocs": [ - "hexCode: " + "hex: the hex code" ], "returns": null, "since": "", @@ -976,200 +988,176 @@ } }, { - "id": "Color/constructor(double)", - "memberId": "Color/constructor", + "id": "Color/equals(Object)", + "memberId": "Color/equals", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "constructor", + "methodName": "equals", "static": false, - "returnType": "Color", + "returnType": "boolean", "parameterTypes": [ - "double" + "java.lang.Object" ], "parameterNames": [ - "h" + "other" ], "params": [ - "double h" + "Object other" ], - "summary": "Constructs a new Color object with the specified hue value.", - "description": "Constructs a new Color object with the specified hue value.", + "summary": "Two colours are equal when they pack into the same ARGB number.", + "description": "Two colours are equal when they pack into the same ARGB number.", "scratchblock": null, "paramDocs": [ - "h: the hue value" + "other: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/equals", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Farbe mit dem angegebenen Farbton (0 bis 255)" + "description": "Prüft, ob es dieselbe Farbe ist" } } }, { - "id": "Color/constructor(double,double,double)", - "memberId": "Color/constructor", + "id": "Color/fromARGB(int)", + "memberId": "Color/fromARGB", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "constructor", - "static": false, + "methodName": "fromARGB", + "static": true, "returnType": "Color", "parameterTypes": [ - "double", - "double", - "double" + "int" ], "parameterNames": [ - "r", - "g", - "b" + "argb" ], "params": [ - "double r", - "double g", - "double b" + "int argb" ], - "summary": "Constructs a new Color object with the specified rgb values.", - "description": "Constructs a new Color object with the specified rgb values.", + "summary": "A colour from a packed ARGB number, as [toARGB()](toARGB) gives it.", + "description": "A colour from a packed ARGB number, as [toARGB()](toARGB) gives it.", "scratchblock": null, "paramDocs": [ - "r: the red value", - "g: the green value", - "b: the blue value" + "argb: alpha, red, green and blue in one int" ], - "returns": null, + "returns": "the colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/fromARGB", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Farbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/constructor(Color)", - "memberId": "Color/constructor", + "id": "Color/fromHSB(double,double,double)", + "memberId": "Color/fromHSB", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "constructor", - "static": false, + "methodName": "fromHSB", + "static": true, "returnType": "Color", "parameterTypes": [ - "org.openpatch.scratch.Color" + "double", + "double", + "double" ], "parameterNames": [ - "c" + "hue", + "saturation", + "brightness" ], "params": [ - "Color c" + "double hue", + "double saturation", + "double brightness" ], - "summary": "Copies the received ScratchColor object.", - "description": "Copies the received ScratchColor object.", + "summary": "A colour from Scratch's colour, saturation and brightness, each from 0 to 100. The colour\ngoes around (110 is the same as 10); saturation and brightness are clamped.", + "description": "A colour from Scratch's colour, saturation and brightness, each from 0 to 100. The colour\ngoes around (110 is the same as 10); saturation and brightness are clamped.", "scratchblock": null, "paramDocs": [ - "c: ScratchColor object to copy" + "hue: the colour from 0 to 100", + "saturation: from 0 (grey) to 100 (full colour)", + "brightness: from 0 (black) to 100 (full brightness)" ], - "returns": null, + "returns": "the colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/fromHSB", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie der übergebenen Farbe" - } - } + "translations": {} }, { - "id": "Color/equals(Object)", - "memberId": "Color/equals", + "id": "Color/getAlpha()", + "memberId": "Color/getAlpha", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "equals", + "methodName": "getAlpha", "static": false, - "returnType": "boolean", - "parameterTypes": [ - "java.lang.Object" - ], - "parameterNames": [ - "other" - ], - "params": [ - "Object other" - ], - "summary": "Two colours are the same when they are the same colour.", - "description": "Two colours are the same when they are the same colour.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "other: the object to compare with" - ], - "returns": "whether both are colours with the same red, green and blue", + "paramDocs": [], + "returns": "alpha (opacity) from 0 (invisible) to 255 (opaque)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/equals", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getAlpha", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Prüft, ob es dieselbe Farbe ist" - } - } + "translations": {} }, { - "id": "Color/get()", - "memberId": "Color/get", + "id": "Color/getBlue()", + "memberId": "Color/getBlue", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "get", + "methodName": "getBlue", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the color value as a hex code. This is useful for comparing pixels.", - "description": "Get the color value as a hex code. This is useful for comparing pixels.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "hex code", + "returns": "blue from 0 to 255", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/get", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getBlue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Farbe als ganze Zahl zurück" + "description": "Gibt den Blauanteil zurück (0 bis 255)" } } }, { - "id": "Color/getBlue()", - "memberId": "Color/getBlue", + "id": "Color/getBrightness()", + "memberId": "Color/getBrightness", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getBlue", + "methodName": "getBrightness", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the blue value.", - "description": "Get the blue value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "blue value [0...255]", + "returns": "brightness from 0 (black) to 100", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getBlue", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getBrightness", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Blauanteil zurück (0 bis 255)" - } - } + "translations": {} }, { "id": "Color/getGreen()", @@ -1182,11 +1170,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the green value.", - "description": "Get the green value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "green value [0...255]", + "returns": "green from 0 to 255", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getGreen", "availability": "implemented", @@ -1198,143 +1186,127 @@ } }, { - "id": "Color/getH()", - "memberId": "Color/getH", + "id": "Color/getHue()", + "memberId": "Color/getHue", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getH", + "methodName": "getHue", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the hue value.", - "description": "Get the hue value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "hue value [0...255]", + "returns": "Scratch's colour (hue) from 0 to 100; 0 for greys", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getH", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getHue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Farbton zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/getHSB()", - "memberId": "Color/getHSB", + "id": "Color/getRed()", + "memberId": "Color/getRed", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getHSB", + "methodName": "getRed", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the color value on the HSB spectrum.", - "description": "Get the color value on the HSB spectrum.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "hue value [0...255]", + "returns": "red from 0 to 255", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getHSB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getRed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Farbton zurück (0 bis 255)" + "description": "Gibt den Rotanteil zurück (0 bis 255)" } } }, { - "id": "Color/getL()", - "memberId": "Color/getL", + "id": "Color/getSaturation()", + "memberId": "Color/getSaturation", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getL", + "methodName": "getSaturation", "static": false, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the luminosity value.", - "description": "Get the luminosity value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "luminosity value [0...255]", + "returns": "saturation from 0 (grey) to 100", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getL", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getSaturation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Helligkeit zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/getRed()", - "memberId": "Color/getRed", + "id": "Color/hashCode()", + "memberId": "Color/hashCode", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getRed", + "methodName": "hashCode", "static": false, - "returnType": "double", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the red value.", - "description": "Get the red value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "red value [0...255]", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getRed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/hashCode", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Rotanteil zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/getS()", - "memberId": "Color/getS", + "id": "Color/toARGB()", + "memberId": "Color/toARGB", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "getS", + "methodName": "toARGB", "static": false, - "returnType": "double", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the saturation value.", - "description": "Get the saturation value.", + "summary": "The colour packed into one int as alpha, red, green and blue (8 bits each, rounded), the way\npixels are stored.", + "description": "The colour packed into one int as alpha, red, green and blue (8 bits each, rounded), the way\npixels are stored.", "scratchblock": null, "paramDocs": [], - "returns": "saturation value [0...255]", + "returns": "the packed colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/getS", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/toARGB", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Sättigung zurück (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/hashCode()", - "memberId": "Color/hashCode", + "id": "Color/toString()", + "memberId": "Color/toString", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "hashCode", + "methodName": "toString", "static": false, - "returnType": "int", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], @@ -1342,476 +1314,270 @@ "description": "", "scratchblock": null, "paramDocs": [], - "returns": "a hash consistent with [equals(Object)](equals)", + "returns": "`#rrggbb`, or `#rrggbbaa` when not opaque", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/hashCode", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/toString", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt die Farbe als Text aus" + } + } }, { - "id": "Color/setHSB(double)", - "memberId": "Color/setHSB", + "id": "Color/withAlpha(double)", + "memberId": "Color/withAlpha", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "setHSB", + "methodName": "withAlpha", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ "double" ], "parameterNames": [ - "h" + "alpha" ], "params": [ - "double h" + "double alpha" ], - "summary": "Setting the color value after the HSB spectrum. Saturation and Luminosity are fixed at 255.", - "description": "Setting the color value after the HSB spectrum. Saturation and Luminosity are fixed at 255.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "h: A hue value [0...255]" + "alpha: opacity from 0 to 255" ], - "returns": null, + "returns": "this colour with another alpha", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/setHSB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withAlpha", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt den Farbton (0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/setHSB(double,double,double)", - "memberId": "Color/setHSB", + "id": "Color/withBlue(double)", + "memberId": "Color/withBlue", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "setHSB", + "methodName": "withBlue", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ - "double", - "double", "double" ], "parameterNames": [ - "h", - "s", - "l" + "blue" ], "params": [ - "double h", - "double s", - "double l" + "double blue" ], - "summary": "Setting the color value after the HSB spectrum.", - "description": "Setting the color value after the HSB spectrum.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "h: A hue value [0...255]", - "s: A saturation value [0...255]", - "l: A luminosity value [0...255]" + "blue: blue from 0 to 255" ], - "returns": null, + "returns": "this colour with another blue", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/setHSB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withBlue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt Farbton, Sättigung und Helligkeit (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/setRGB(double,double,double)", - "memberId": "Color/setRGB", + "id": "Color/withBrightness(double)", + "memberId": "Color/withBrightness", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "setRGB", + "methodName": "withBrightness", "static": false, - "returnType": "void", + "returnType": "Color", "parameterTypes": [ - "double", - "double", "double" ], "parameterNames": [ - "r", - "g", - "b" + "brightness" ], "params": [ - "double r", - "double g", - "double b" + "double brightness" ], - "summary": "Setting the color value after the RGB spectrum", - "description": "Setting the color value after the RGB spectrum", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "r: A red value [0...255]", - "g: A green value [0...255]", - "b: A blue value [0...255]" + "brightness: from 0 to 100" ], - "returns": null, + "returns": "this colour with another brightness", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/setRGB", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withBrightness", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Color/toString()", - "memberId": "Color/toString", + "id": "Color/withGreen(double)", + "memberId": "Color/withGreen", "owner": "org.openpatch.scratch.Color", "className": "Color", - "methodName": "toString", + "methodName": "withGreen", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "The colour written out, so that printing one says something.", - "description": "The colour written out, so that printing one says something.\n\nWithout this a `System.out.println(mySprite.getTint())` printed\n`org.openpatch.scratch.Color@35432107`, which tells you nothing about\nthe colour and is the first thing anyone tries when a tint looks wrong.", + "returnType": "Color", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "green" + ], + "params": [ + "double green" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], - "returns": "the colour as `Color[r=255.0, g=128.0, b=0.0]`", + "paramDocs": [ + "green: green from 0 to 255" + ], + "returns": "this colour with another green", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Color/toString", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withGreen", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Farbe als Text aus" - } - } + "translations": {} }, { - "id": "Ellipse/constructor(double,double,double,double)", - "memberId": "Ellipse/constructor", - "owner": "org.openpatch.scratch.Ellipse", - "className": "Ellipse", - "methodName": "constructor", + "id": "Color/withHue(double)", + "memberId": "Color/withHue", + "owner": "org.openpatch.scratch.Color", + "className": "Color", + "methodName": "withHue", "static": false, - "returnType": "Ellipse", + "returnType": "Color", "parameterTypes": [ - "double", - "double", - "double", "double" ], "parameterNames": [ - "x", - "y", - "width", - "height" + "hue" ], "params": [ - "double x", - "double y", - "double width", - "double height" + "double hue" ], - "summary": "Creates an ellipse with no specified position or size.", - "description": "Creates an ellipse with no specified position or size.", + "summary": "Another colour (hue), keeping saturation, brightness and alpha. The colour goes around, so\n`withHue(getHue() + 10)` works like Scratch's \"change color by 10\".", + "description": "Another colour (hue), keeping saturation, brightness and alpha. The colour goes around, so\n`withHue(getHue() + 10)` works like Scratch's \"change color by 10\".", "scratchblock": null, "paramDocs": [ - "x: ", - "y: ", - "width: ", - "height: " + "hue: the colour from 0 to 100" ], - "returns": null, + "returns": "this colour with another hue", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Ellipse/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withHue", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Ellipse im angegebenen Rechteck" - } - } + "translations": {} }, { - "id": "Hitbox/constructor(Shape)", - "memberId": "Hitbox/constructor", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "constructor", + "id": "Color/withRed(double)", + "memberId": "Color/withRed", + "owner": "org.openpatch.scratch.Color", + "className": "Color", + "methodName": "withRed", "static": false, - "returnType": "Hitbox", + "returnType": "Color", "parameterTypes": [ - "org.openpatch.scratch.Shape" + "double" ], "parameterNames": [ - "shape" + "red" ], "params": [ - "Shape shape" + "double red" ], - "summary": "Constructs a hitbox with the specified shape.", - "description": "Constructs a hitbox with the specified shape.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "shape: The shape of the hitbox." + "red: red from 0 to 255" ], - "returns": null, + "returns": "this colour with another red", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withRed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt einen Umriss aus einer Form" - } - } + "translations": {} }, { - "id": "Hitbox/constructor(double[],double[])", - "memberId": "Hitbox/constructor", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "constructor", + "id": "Color/withSaturation(double)", + "memberId": "Color/withSaturation", + "owner": "org.openpatch.scratch.Color", + "className": "Color", + "methodName": "withSaturation", "static": false, - "returnType": "Hitbox", + "returnType": "Color", "parameterTypes": [ - "double[]", - "double[]" + "double" ], "parameterNames": [ - "xPoints", - "yPoints" + "saturation" ], "params": [ - "double[] xPoints", - "double[] yPoints" + "double saturation" ], - "summary": "Constructs a hitbox with the specified x and y points.", - "description": "Constructs a hitbox with the specified x and y points.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "xPoints: The x-coordinates of the points.", - "yPoints: The y-coordinates of the points." + "saturation: from 0 to 100" ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt einen Umriss aus x- und y-Koordinaten" - } - } - }, - { - "id": "Hitbox/contains(double,double)", - "memberId": "Hitbox/contains", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "contains", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "x", - "y" - ], - "params": [ - "double x", - "double y" - ], - "summary": "Checks if the hitbox contains a point.", - "description": "Checks if the hitbox contains a point.", - "scratchblock": null, - "paramDocs": [ - "x: The x-coordinate of the point.", - "y: The y-coordinate of the point." - ], - "returns": "`true` if the hitbox contains the point, `false`\n otherwise.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/contains", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Punkt im Umriss liegt" - } - } - }, - { - "id": "Hitbox/getBounds()", - "memberId": "Hitbox/getBounds", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "getBounds", - "static": false, - "returnType": "Bounds", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the smallest upright rectangle the hitbox fits into.", - "description": "Returns the smallest upright rectangle the hitbox fits into.", - "scratchblock": null, - "paramDocs": [], - "returns": "the bounding box of the hitbox", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/getBounds", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt das umschließende Rechteck zurück" - } - } - }, - { - "id": "Hitbox/getShape()", - "memberId": "Hitbox/getShape", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "getShape", - "static": false, - "returnType": "Shape", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shape of the hitbox.", - "description": "Returns the shape of the hitbox.", - "scratchblock": null, - "paramDocs": [], - "returns": "The shape of the hitbox.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/getShape", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Umriss als Form zurück" - } - } - }, - { - "id": "Hitbox/intersects(Hitbox)", - "memberId": "Hitbox/intersects", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "intersects", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Hitbox" - ], - "parameterNames": [ - "hitbox" - ], - "params": [ - "Hitbox hitbox" - ], - "summary": "Checks if the hitbox intersects with another hitbox.", - "description": "Checks if the hitbox intersects with another hitbox.", - "scratchblock": null, - "paramDocs": [ - "hitbox: The hitbox to check for intersection." - ], - "returns": "`true` if the hitboxes intersect, `false` otherwise.", + "returns": "this colour with another saturation", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/intersects", + "docsUrl": "https://scratch4j.openpatch.org/reference/Color/withSaturation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn sich beide Umrisse überlappen" - } - } + "translations": {} }, { - "id": "Hitbox/translateAndRotateAndResize(double,double,double,double,double,double)", - "memberId": "Hitbox/translateAndRotateAndResize", - "owner": "org.openpatch.scratch.Hitbox", - "className": "Hitbox", - "methodName": "translateAndRotateAndResize", + "id": "Ellipse/constructor(double,double,double,double)", + "memberId": "Ellipse/constructor", + "owner": "org.openpatch.scratch.Ellipse", + "className": "Ellipse", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "Ellipse", "parameterTypes": [ - "double", - "double", "double", "double", "double", "double" ], "parameterNames": [ - "degrees", - "originX", - "originY", - "translateX", - "translateY", - "size" + "x", + "y", + "width", + "height" ], "params": [ - "double degrees", - "double originX", - "double originY", - "double translateX", - "double translateY", - "double size" + "double x", + "double y", + "double width", + "double height" ], - "summary": "Transforms the shape by scaling, translating, and rotating it.", - "description": "Transforms the shape by scaling, translating, and rotating it.", + "summary": "An ellipse inside a rectangle along the axes.", + "description": "An ellipse inside a rectangle along the axes.", "scratchblock": null, "paramDocs": [ - "degrees: The angle in degrees to rotate the shape.", - "originX: The x-coordinate of the rotation origin.", - "originY: The y-coordinate of the rotation origin.", - "translateX: The x-coordinate to translate the shape.", - "translateY: The y-coordinate to translate the shape.", - "size: The size to scale the shape, where 100.0 represents the\n original size." + "x: the smallest x of the rectangle around it", + "y: the smallest y of the rectangle around it", + "width: the width", + "height: the height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Hitbox/translateAndRotateAndResize", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Verschiebt, dreht und skaliert den Umriss" - } - } - }, - { - "id": "HtmlColor/constructor()", - "memberId": "HtmlColor/constructor", - "owner": "org.openpatch.scratch.HtmlColor", - "className": "HtmlColor", - "methodName": "constructor", - "static": false, - "returnType": "HtmlColor", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Provides predefined HTML colors as Color objects.", - "description": "Provides predefined HTML colors as Color objects.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/HtmlColor/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Ellipse/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt eine zufällige der benannten Farben zurück" + "description": "Erzeugt eine Ellipse im angegebenen Rechteck" } } }, @@ -2567,7 +2333,7 @@ ], "summary": "\"mod\" is an abbreviation for \"modulo\". Modulo returns what is left over when\nthe first input is divided by the second, with the sign of the second input,\nas the Scratch block does.", "description": "\"mod\" is an abbreviation for \"modulo\". Modulo returns what is left over when\nthe first input is divided by the second, with the sign of the second input,\nas the Scratch block does.", - "scratchblock": null, + "scratchblock": "((x) mod (y))", "paramDocs": [ "x: first value", "y: second value" @@ -2639,7 +2405,7 @@ ], "summary": "Rounds a number to a specified number of decimal places.", "description": "Rounds a number to a specified number of decimal places.", - "scratchblock": null, + "scratchblock": "(round (x))", "paramDocs": [ "x: a value", "precision: the number of decimal places to round to" @@ -2803,16 +2569,16 @@ "double" ], "parameterNames": [ - "c" + "by" ], "params": [ - "double c" + "double by" ], - "summary": "Change color via a hue value, which is added to the current hue value", - "description": "Change color via a hue value, which is added to the current hue value", + "summary": "", + "description": "", "scratchblock": "change pen [color v] by (c)", "paramDocs": [ - "c: a hue value [0...255]" + "by: how much to change the colour (hue, 0 to 100, going around)" ], "returns": null, "since": "", @@ -2837,16 +2603,16 @@ "double" ], "parameterNames": [ - "size" + "by" ], "params": [ - "double size" + "double by" ], - "summary": "Change the size of the pen", - "description": "Change the size of the pen", + "summary": "", + "description": "", "scratchblock": "change pen size by (size)", "paramDocs": [ - "size: size to change" + "by: how much to change the line width" ], "returns": null, "since": "", @@ -2871,16 +2637,16 @@ "double" ], "parameterNames": [ - "step" + "by" ], "params": [ - "double step" + "double by" ], - "summary": "Change the transparency by a step", - "description": "Change the transparency by a step", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "step: the step to change the transparency by" + "by: how much to change the transparency" ], "returns": null, "since": "", @@ -2904,8 +2670,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Pen object.", - "description": "Constructs a new Pen object.", + "summary": "A pen of your own, at (0, 0); add it to a stage with `stage.add(pen)`.", + "description": "A pen of your own, at (0, 0); add it to a stage with `stage.add(pen)`.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -2919,70 +2685,6 @@ } } }, - { - "id": "Pen/constructor(Sprite)", - "memberId": "Pen/constructor", - "owner": "org.openpatch.scratch.Pen", - "className": "Pen", - "methodName": "constructor", - "static": false, - "returnType": "Pen", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "s" - ], - "params": [ - "Sprite s" - ], - "summary": "Constructs a new Pen object associated with the given Sprite.", - "description": "Constructs a new Pen object associated with the given Sprite.", - "scratchblock": null, - "paramDocs": [ - "s: the Sprite object to associate with this Pen" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Senkt den Stift ab, so dass er beim Bewegen zeichnet" - } - } - }, - { - "id": "Pen/constructor(Pen)", - "memberId": "Pen/constructor", - "owner": "org.openpatch.scratch.Pen", - "className": "Pen", - "methodName": "constructor", - "static": false, - "returnType": "Pen", - "parameterTypes": [ - "org.openpatch.scratch.Pen" - ], - "parameterNames": [ - "p" - ], - "params": [ - "Pen p" - ], - "summary": "Copies a Pen object.", - "description": "Copies a Pen object.", - "scratchblock": null, - "paramDocs": [ - "p: Pen object to copy" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, { "id": "Pen/down()", "memberId": "Pen/down", @@ -2994,8 +2696,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Set the pen down.", - "description": "Set the pen down.", + "summary": "Puts the pen down: it leaves a dot, and a line wherever it moves.", + "description": "Puts the pen down: it leaves a dot, and a line wherever it moves.", "scratchblock": "pen down", "paramDocs": [], "returns": null, @@ -3016,8 +2718,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Erases all.", - "description": "Erases all.", + "summary": "Erases everything drawn on the pen's layer, by any pen or stamp.", + "description": "Erases everything drawn on the pen's layer, by any pen or stamp.", "scratchblock": "erase all", "paramDocs": [], "returns": null, @@ -3042,11 +2744,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current color of the pen.", - "description": "Retrieves the current color of the pen.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the color of the pen", + "returns": "the colour lines are drawn in", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getColor", "availability": "implemented", @@ -3058,83 +2760,97 @@ } }, { - "id": "Pen/getSize()", - "memberId": "Pen/getSize", + "id": "Pen/getLayer()", + "memberId": "Pen/getLayer", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "getSize", + "methodName": "getLayer", "static": false, - "returnType": "double", + "returnType": "Layer", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the size of the pen", - "description": "Returns the size of the pen", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the size of the pen", + "returns": "the layer whose canvas the pen draws on", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Strichstärke zurück" - } - } + "translations": {} }, { - "id": "Pen/goToBackground()", - "memberId": "Pen/goToBackground", + "id": "Pen/getPosition()", + "memberId": "Pen/getPosition", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "goToBackground", + "methodName": "getPosition", "static": false, - "returnType": "void", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Sets the pen to the background. This method changes the state of the pen to\nindicate that it is\nno longer in the foreground.", - "description": "Sets the pen to the background. This method changes the state of the pen to\nindicate that it is\nno longer in the foreground.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the pen's world position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/goToBackground", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zeichnet hinter den Figuren" - } - } + "translations": {} }, { - "id": "Pen/goToForeground()", - "memberId": "Pen/goToForeground", + "id": "Pen/getSize()", + "memberId": "Pen/getSize", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "goToForeground", + "methodName": "getSize", "static": false, - "returnType": "void", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves the pen to the foreground. This method sets the pen's state to indicate\nthat it is in the\nforeground.", - "description": "Moves the pen to the foreground. This method sets the pen's state to indicate\nthat it is in the\nforeground.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the line width in stage pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/goToForeground", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeichnet vor den Figuren" + "description": "Gibt die Strichstärke zurück" } } }, + { + "id": "Pen/getTransparency()", + "memberId": "Pen/getTransparency", + "owner": "org.openpatch.scratch.Pen", + "className": "Pen", + "methodName": "getTransparency", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the transparency in percent (0 opaque, 100 invisible)", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/getTransparency", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Pen/goToMousePointer()", "memberId": "Pen/goToMousePointer", @@ -3146,8 +2862,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves the object to the current position of the mouse pointer.", - "description": "Moves the object to the current position of the mouse pointer.", + "summary": "Moves the pen to the mouse pointer, drawing if it is down.", + "description": "Moves the pen to the mouse pointer, drawing if it is down.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -3172,8 +2888,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves the object to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", - "description": "Moves the object to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", + "summary": "Moves the pen to a random position on the stage, drawing if it is down.", + "description": "Moves the pen to a random position on the stage, drawing if it is down.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -3188,30 +2904,26 @@ } }, { - "id": "Pen/isInBackground()", - "memberId": "Pen/isInBackground", + "id": "Pen/isDown()", + "memberId": "Pen/isDown", "owner": "org.openpatch.scratch.Pen", "className": "Pen", - "methodName": "isInBackground", + "methodName": "isDown", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true if the pen is in the background.", - "description": "Returns true if the pen is in the background.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true if the pen is in the background", + "returns": "whether the pen is down and draws when it moves", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/isInBackground", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/isDown", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Stift hinter den Figuren zeichnet" - } - } + "translations": {} }, { "id": "Pen/setColor(Color)", @@ -3225,16 +2937,16 @@ "org.openpatch.scratch.Color" ], "parameterNames": [ - "c" + "color" ], "params": [ - "Color c" + "Color color" ], - "summary": "Set the color of the pen", - "description": "Set the color of the pen", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: color of the pen" + "color: the colour to draw lines in" ], "returns": null, "since": "", @@ -3259,16 +2971,16 @@ "double" ], "parameterNames": [ - "h" + "hue" ], "params": [ - "double h" + "double hue" ], - "summary": "Set color via hue value", - "description": "Set color via hue value", - "scratchblock": "set pen [color v] to (h)", + "summary": "Sets the colour by Scratch's colour number (hue) from 0 to 100, at full saturation and\nbrightness, like Scratch's \"set pen color to\".", + "description": "Sets the colour by Scratch's colour number (hue) from 0 to 100, at full saturation and\nbrightness, like Scratch's \"set pen color to\".", + "scratchblock": null, "paramDocs": [ - "h: a hue value [0...255]" + "hue: the colour from 0 to 100" ], "returns": null, "since": "", @@ -3295,22 +3007,22 @@ "double" ], "parameterNames": [ - "r", - "g", - "b" + "red", + "green", + "blue" ], "params": [ - "double r", - "double g", - "double b" + "double red", + "double green", + "double blue" ], - "summary": "Set color via rgb values", - "description": "Set color via rgb values", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", @@ -3323,6 +3035,36 @@ } } }, + { + "id": "Pen/setLayer(Layer)", + "memberId": "Pen/setLayer", + "owner": "org.openpatch.scratch.Pen", + "className": "Pen", + "methodName": "setLayer", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.Layer" + ], + "parameterNames": [ + "layer" + ], + "params": [ + "Layer layer" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "layer: the layer whose canvas the pen draws on" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pen/setLayer", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Pen/setPosition(double,double)", "memberId": "Pen/setPosition", @@ -3343,12 +3085,12 @@ "double x", "double y" ], - "summary": "Set the position if the pen is down.", - "description": "Set the position if the pen is down.", + "summary": "Moves the pen, drawing a line from where it was if it is down.", + "description": "Moves the pen, drawing a line from where it was if it is down.", "scratchblock": null, "paramDocs": [ - "x: x coordinate", - "y: y coordinate" + "x: world x", + "y: world y" ], "returns": null, "since": "", @@ -3373,16 +3115,16 @@ "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "v" + "position" ], "params": [ - "Vector2 v" + "Vector2 position" ], - "summary": "Sets the position of the pen using a Vector2 object.", - "description": "Sets the position of the pen using a Vector2 object.", + "summary": "Moves the pen, drawing a line from where it was if it is down.", + "description": "Moves the pen, drawing a line from where it was if it is down.", "scratchblock": null, "paramDocs": [ - "v: the Vector2 object containing the new x and y coordinates" + "position: world position" ], "returns": null, "since": "", @@ -3412,11 +3154,11 @@ "params": [ "double size" ], - "summary": "Set the size of the pen", - "description": "Set the size of the pen", + "summary": "", + "description": "", "scratchblock": "set pen size to (size)", "paramDocs": [ - "size: size of the pen" + "size: the line width in stage pixels (at least 1)" ], "returns": null, "since": "", @@ -3446,11 +3188,11 @@ "params": [ "double transparency" ], - "summary": "Set the transparency", - "description": "Set the transparency", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "transparency: transparency of the pen" + "transparency: in percent (0 opaque, 100 invisible)" ], "returns": null, "since": "", @@ -3474,8 +3216,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Stamps the current sprite onto the canvas. If the sprite is not null, it will\nstamp either to\nthe foreground or the background based on the value of the isForeground flag.", - "description": "Stamps the current sprite onto the canvas. If the sprite is not null, it will\nstamp either to\nthe foreground or the background based on the value of the isForeground flag.", + "summary": "Stamps the pen's sprite onto the pen's layer, like Scratch's \"stamp\" block.", + "description": "Stamps the pen's sprite onto the pen's layer, like Scratch's \"stamp\" block.", "scratchblock": "stamp", "paramDocs": [], "returns": null, @@ -3500,8 +3242,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Move the pen up.", - "description": "Move the pen up.", + "summary": "Lifts the pen: it no longer draws.", + "description": "Lifts the pen: it no longer draws.", "scratchblock": "pen up", "paramDocs": [], "returns": null, @@ -3515,6 +3257,178 @@ } } }, + { + "id": "Pixels/getArgb(int,int)", + "memberId": "Pixels/getArgb", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getArgb", + "static": false, + "returnType": "int", + "parameterTypes": [ + "int", + "int" + ], + "parameterNames": [ + "x", + "y" + ], + "params": [ + "int x", + "int y" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "x: pixels from the left edge", + "y: pixels from the top edge" + ], + "returns": "the colour there packed as alpha, red, green, blue, or 0 outside", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getArgb", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/getColor(int,int)", + "memberId": "Pixels/getColor", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getColor", + "static": false, + "returnType": "Color", + "parameterTypes": [ + "int", + "int" + ], + "parameterNames": [ + "x", + "y" + ], + "params": [ + "int x", + "int y" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "x: pixels from the left edge", + "y: pixels from the top edge" + ], + "returns": "the colour there, or transparent black outside", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getColor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/getHeight()", + "memberId": "Pixels/getHeight", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getHeight", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the height in pixels", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getHeight", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/getWidth()", + "memberId": "Pixels/getWidth", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "getWidth", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the width in pixels", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/getWidth", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/of(Stage)", + "memberId": "Pixels/of", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "of", + "static": true, + "returnType": "Pixels", + "parameterTypes": [ + "org.openpatch.scratch.Stage" + ], + "parameterNames": [ + "stage" + ], + "params": [ + "Stage stage" + ], + "summary": "The stage's pixels as they are now.", + "description": "The stage's pixels as they are now.", + "scratchblock": null, + "paramDocs": [ + "stage: the stage" + ], + "returns": "its pixels, at stage size", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/of", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Pixels/of(String)", + "memberId": "Pixels/of", + "owner": "org.openpatch.scratch.Pixels", + "className": "Pixels", + "methodName": "of", + "static": true, + "returnType": "Pixels", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "imagePath" + ], + "params": [ + "String imagePath" + ], + "summary": "The pixels of an image file.", + "description": "The pixels of an image file.", + "scratchblock": null, + "paramDocs": [ + "imagePath: the image" + ], + "returns": "its pixels", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Pixels/of", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Polygon/addPoint(double,double)", "memberId": "Polygon/addPoint", @@ -3535,12 +3449,12 @@ "double x", "double y" ], - "summary": "Adds a point to the polygon.", - "description": "Adds a point to the polygon.", + "summary": "Adds a corner after the last one.", + "description": "Adds a corner after the last one.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate", - "y: the y-coordinate" + "x: x of the corner", + "y: y of the corner" ], "returns": null, "since": "", @@ -3564,8 +3478,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates an empty polygon.", - "description": "Creates an empty polygon.", + "summary": "A polygon without corners yet; add them with [addPoint(double, double)](addPoint).", + "description": "A polygon without corners yet; add them with [addPoint(double, double)](addPoint).", "scratchblock": null, "paramDocs": [], "returns": null, @@ -3599,12 +3513,12 @@ "double[] xPoints", "double[] yPoints" ], - "summary": "Creates a polygon with the specified vertices.", - "description": "Creates a polygon with the specified vertices.", + "summary": "A polygon given by its corners, concave ones included. The outline closes by itself.", + "description": "A polygon given by its corners, concave ones included. The outline closes by itself.", "scratchblock": null, "paramDocs": [ - "xPoints: an array of x-coordinates", - "yPoints: an array of y-coordinates" + "xPoints: x of every corner", + "yPoints: y of every corner, in the same order" ], "returns": null, "since": "", @@ -4099,14 +4013,14 @@ "double width", "double height" ], - "summary": "Creates a rectangle with the specified position and size.", - "description": "Creates a rectangle with the specified position and size.", + "summary": "A rectangle along the axes.", + "description": "A rectangle along the axes.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate of the rectangle's top-left corner", - "y: the y-coordinate of the rectangle's top-left corner", - "width: the width of the rectangle", - "height: the height of the rectangle" + "x: the smallest x", + "y: the smallest y", + "width: the width", + "height: the height" ], "returns": null, "since": "", @@ -4120,1085 +4034,1995 @@ } }, { - "id": "Shape/contains(double,double)", - "memberId": "Shape/contains", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "contains", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "x", - "y" - ], - "params": [ - "double x", - "double y" - ], - "summary": "Check if the shape contains a point defined by its x and y coordinates.", - "description": "Check if the shape contains a point defined by its x and y coordinates.", - "scratchblock": null, - "paramDocs": [ - "x: the x-coordinate of the point", - "y: the y-coordinate of the point" - ], - "returns": "true if the shape contains the point, false otherwise", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/contains", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Punkt in der Form liegt" - } - } - }, - { - "id": "Shape/getBounds()", - "memberId": "Shape/getBounds", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "getBounds", + "id": "Shader/getName()", + "memberId": "Shader/getName", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "getName", "static": false, - "returnType": "Bounds", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Get the bounds of the shape.", - "description": "Get the bounds of the shape.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "a Bounds object representing the bounding box of the shape", + "returns": "the shader's name", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/getBounds", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/getName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt das umschließende Rechteck zurück" - } - } + "translations": {} }, { - "id": "Shape/intersects(Shape)", - "memberId": "Shape/intersects", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "intersects", + "id": "Shader/set(String,double)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Shape" + "java.lang.String", + "double" ], "parameterNames": [ - "other" + "uniform", + "value" ], "params": [ - "Shape other" + "String uniform", + "double value" ], - "summary": "Check if the shape intersects with another shape.", - "description": "Check if the shape intersects with another shape.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "other: the other shape to check intersection with" + "uniform: the uniform's name in the shader", + "value: an `int` or `float` uniform's value" ], - "returns": "true if the shapes intersect, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/intersects", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn sich beide Formen überlappen" - } - } + "translations": {} }, { - "id": "Shape/rotate(double,double,double)", - "memberId": "Shape/rotate", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "rotate", + "id": "Shader/set(String,int)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "Shape", + "returnType": "void", "parameterTypes": [ - "double", - "double", - "double" + "java.lang.String", + "int" ], "parameterNames": [ - "theta", - "anchorX", - "anchorY" + "uniform", + "value" ], "params": [ - "double theta", - "double anchorX", - "double anchorY" + "String uniform", + "int value" ], - "summary": "Rotate the shape by the specified angle around a given anchor point.", - "description": "Rotate the shape by the specified angle around a given anchor point.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "theta: the angle in degrees to rotate", - "anchorX: the x-coordinate of the anchor point", - "anchorY: the y-coordinate of the anchor point" + "uniform: the uniform's name", + "value: an `int` uniform's value" ], - "returns": "a new Shape object that is rotated", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/rotate", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die um theta Grad gedrehte Form als neue Form zurück" - } - } + "translations": {} }, { - "id": "Shape/scale(double,double)", - "memberId": "Shape/scale", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "scale", + "id": "Shader/set(String,boolean)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "Shape", + "returnType": "void", "parameterTypes": [ - "double", - "double" + "java.lang.String", + "boolean" ], "parameterNames": [ - "scaleX", - "scaleY" + "uniform", + "value" ], "params": [ - "double scaleX", - "double scaleY" + "String uniform", + "boolean value" ], - "summary": "Check if the shape is empty.", - "description": "Check if the shape is empty.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "scaleX: ", - "scaleY: " + "uniform: the uniform's name", + "value: a `bool` uniform's value" ], - "returns": "true if the shape is empty, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/scale", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die skalierte Form als neue Form zurück" - } - } + "translations": {} }, { - "id": "Shape/translate(double,double)", - "memberId": "Shape/translate", - "owner": "org.openpatch.scratch.Shape", - "className": "Shape", - "methodName": "translate", + "id": "Shader/set(String,double,double)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, - "returnType": "Shape", + "returnType": "void", "parameterTypes": [ + "java.lang.String", "double", "double" ], "parameterNames": [ - "dx", - "dy" + "uniform", + "x", + "y" ], "params": [ - "double dx", - "double dy" + "String uniform", + "double x", + "double y" ], - "summary": "Translate the shape by the specified distances in the x and y directions.", - "description": "Translate the shape by the specified distances in the x and y directions.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "dx: the distance to translate in the x direction", - "dy: the distance to translate in the y direction" + "uniform: the uniform's name", + "x: a `vec2`'s x", + "y: a `vec2`'s y" ], - "returns": "a new Shape object that is translated", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/translate", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die verschobene Form als neue Form zurück" - } - } + "translations": {} }, { - "id": "Sprite/addCostume(String)", - "memberId": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostume", + "id": "Shader/set(String,Vector2)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "name" + "uniform", + "value" ], "params": [ - "String name" + "String uniform", + "Vector2 value" ], - "summary": "Add one of the costumes that ship with Scratch for Java to the sprite. The\ncostume gets the same name as the built-in sprite. If a costume with that\nname already exists do nothing.", - "description": "Add one of the costumes that ship with Scratch for Java to the sprite. The\ncostume gets the same name as the built-in sprite. If a costume with that\nname already exists do nothing.\n\nExample usage:\n\n```java\nthis.addCostume(\"bunny1_jump\");\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of a built-in sprite, for example \"bunny1_jump\". Add\n the sheet in front of the name, for example\n \"platformer/grass\", if the same name exists on several sheets." + "uniform: the uniform's name", + "value: a `vec2`" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt eines der eingebauten Kostüme hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addCostume(String,String)", - "memberId": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostume", + "id": "Shader/set(String,Color)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "name", - "imagePath" + "uniform", + "color" ], "params": [ - "String name", - "String imagePath" + "String uniform", + "Color color" ], - "summary": "Add a costume to the sprite. If a costume with the received name already\nexists do nothing.", - "description": "Add a costume to the sprite. If a costume with the received name already\nexists do nothing.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: a unique name", - "imagePath: a image path, or the name of a built-in sprite such as\n \"bunny1_jump\"" + "uniform: the uniform's name", + "color: a `vec4`: red, green, blue and alpha from 0 to 1" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt ein Kostüm unter eigenem Namen hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addCostume(String,String,int,int,int,int)", - "memberId": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostume", + "id": "Shader/set(String,double[],int)", + "memberId": "Shader/set", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "set", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "int", - "int", - "int", + "double[]", "int" ], "parameterNames": [ - "name", - "spriteSheetPath", - "x", - "y", - "width", - "height" + "uniform", + "values", + "perElement" ], "params": [ - "String name", - "String spriteSheetPath", - "int x", - "int y", - "int width", - "int height" + "String uniform", + "double[] values", + "int perElement" ], - "summary": "Adds a new costume to the sprite if a costume with the same name does not\nalready exist.", - "description": "Adds a new costume to the sprite if a costume with the same name does not\nalready exist.", + "summary": "An array uniform such as `uniform vec3 lights[100];`.", + "description": "An array uniform such as `uniform vec3 lights[100];`.", "scratchblock": null, "paramDocs": [ - "name: The name of the costume.", - "spriteSheetPath: The path to the sprite sheet image file.", - "x: The x-coordinate of the top-left corner of the costume\n in the sprite sheet.", - "y: The y-coordinate of the top-left corner of the costume\n in the sprite sheet.", - "width: The width of the costume in the sprite sheet.", - "height: The height of the costume in the sprite sheet." + "uniform: the uniform's name", + "values: all values, one element after the other", + "perElement: values per element: 1 for `float[]`, 3 for `vec3[]`" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/set", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schneidet ein Kostüm aus einem Bild aus" - } - } + "translations": {} }, { - "id": "Sprite/addCostumes(String,String,int,int)", - "memberId": "Sprite/addCostumes", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addCostumes", + "id": "Shader/setName(String)", + "memberId": "Shader/setName", + "owner": "org.openpatch.scratch.Shader", + "className": "Shader", + "methodName": "setName", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "prefix", - "spriteSheet", - "tileWidth", - "tileHeight" + "name" ], "params": [ - "String prefix", - "String spriteSheet", - "int tileWidth", - "int tileHeight" + "String name" ], - "summary": "Adds all tiles from a spritesheet as costumes. The costumes will be name by\nthe prefix and the\nindex in the spritesheet. For example if the prefix is \"tile\" and the\nspritesheet contains 4\ntiles, the costumes will be named \"tile0\", \"tile1\", \"tile2\", and \"tile3\".", - "description": "Adds all tiles from a spritesheet as costumes. The costumes will be name by\nthe prefix and the\nindex in the spritesheet. For example if the prefix is \"tile\" and the\nspritesheet contains 4\ntiles, the costumes will be named \"tile0\", \"tile1\", \"tile2\", and \"tile3\".", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "prefix: a prefix for all generated costumes", - "spriteSheet: a path to a sprite sheet, or the name of a built-in sprite", - "tileWidth: the width of a single tile", - "tileHeight: the height of a single tile" + "name: a new name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostumes", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shader/setName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zerschneidet ein Bild in gleich große Kacheln und fügt sie als Kostüme hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addSound(String,String)", - "memberId": "Sprite/addSound", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addSound", + "id": "Shaders/activate(String)", + "memberId": "Shaders/activate", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "activate", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", "java.lang.String" ], "parameterNames": [ - "name", - "soundPath" + "name" ], "params": [ - "String name", - "String soundPath" + "String name" ], - "summary": "Add a sound to the sprite. If a sound with the received name already exists\ndo nothing.", - "description": "Add a sound to the sprite. If a sound with the received name already exists\ndo nothing.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: a unique name", - "soundPath: a sound path, or the name of a built-in sound such as\n \"footstep_carpet_000\"" + "name: a shader to use in addition to the active ones" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/activate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt einen Klang unter eigenem Namen hinzu" - } - } + "translations": {} }, { - "id": "Sprite/addSound(String)", - "memberId": "Sprite/addSound", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "addSound", + "id": "Shaders/add(String,String)", + "memberId": "Shaders/add", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "add", "static": false, - "returnType": "void", + "returnType": "Shader", "parameterTypes": [ + "java.lang.String", "java.lang.String" ], "parameterNames": [ - "name" + "name", + "fragmentPath" ], "params": [ - "String name" + "String name", + "String fragmentPath" ], - "summary": "Add one of the sounds that ship with Scratch for Java to the sprite. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.", - "description": "Add one of the sounds that ship with Scratch for Java to the sprite. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.\n\nExample usage:\n\n```java\nthis.addSound(\"footstep_carpet_000\");\n```", + "summary": "Adds a shader, or returns the one of that name added before.", + "description": "Adds a shader, or returns the one of that name added before.", "scratchblock": null, "paramDocs": [ - "name: the name of a built-in sound, for example \"footstep_carpet_000\"" + "name: the shader's name", + "fragmentPath: the file with the shader's body" ], - "returns": null, + "returns": "the shader, to set its uniforms", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt einen der eingebauten Klänge hinzu" - } - } + "translations": {} }, { - "id": "Sprite/ask(String)", - "memberId": "Sprite/ask", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "ask", + "id": "Shaders/deactivate(String)", + "memberId": "Shaders/deactivate", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "deactivate", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "question" + "name" ], "params": [ - "String question" + "String name" ], - "summary": "Asks a question and waits for an answer to be typed in. The question appears\nat the top of the stage.", - "description": "Asks a question and waits for an answer to be typed in. The question appears\nat the top of the stage.\n\nUnlike Scratch, this does not pause the sprite. `run()` keeps being called\nwhile the question is on screen, so check [isAsking()](isAsking) or wait for\n[getAnswer()](getAnswer) to change.", - "scratchblock": "ask [question] and wait", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "question: the question to show" + "name: a shader to stop using" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ask", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/deactivate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" - } - } + "translations": {} }, { - "id": "Sprite/broadcast(String)", - "memberId": "Sprite/broadcast", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "broadcast", + "id": "Shaders/get(String)", + "memberId": "Shaders/get", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "get", "static": false, - "returnType": "void", + "returnType": "Shader", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "message" + "name" ], "params": [ - "String message" + "String name" ], - "summary": "Broadcasts a message to every sprite on the stage, this one included, and\nto the stage itself, as in Scratch. If the sprite is not on a stage, nothing\nhappens.", - "description": "Broadcasts a message to every sprite on the stage, this one included, and\nto the stage itself, as in Scratch. If the sprite is not on a stage, nothing\nhappens.", - "scratchblock": "broadcast [message v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "message: The message to broadcast." + "name: a shader's name" ], - "returns": null, + "returns": "the shader, or null", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/broadcast", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/get", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Sendet eine Nachricht an alle Figuren und die Bühne" - } - } + "translations": {} }, { - "id": "Sprite/changePosition(Vector2)", - "memberId": "Sprite/changePosition", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changePosition", + "id": "Shaders/getActive()", + "memberId": "Shaders/getActive", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getActive", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Vector2" - ], - "parameterNames": [ - "v" - ], - "params": [ - "Vector2 v" - ], - "summary": "Changes the position of the sprite by a given vector.", - "description": "Changes the position of the sprite by a given vector.", + "returnType": "List", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "v: a vector representing the change in position" - ], - "returns": null, + "paramDocs": [], + "returns": "the shaders in use, in order", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getActive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Verschiebt die Figur um den angegebenen Vektor" - } - } + "translations": {} }, { - "id": "Sprite/changePosition(double,double)", - "memberId": "Sprite/changePosition", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changePosition", + "id": "Shaders/getCurrent()", + "memberId": "Shaders/getCurrent", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getCurrent", "static": false, - "returnType": "void", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "x", - "y" - ], - "params": [ - "double x", - "double y" - ], - "summary": "Changes the position of the sprite by the given amounts.", - "description": "Changes the position of the sprite by the given amounts.", + "returnType": "Shader", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "x: how far to move along the x-axis", - "y: how far to move along the y-axis" - ], - "returns": null, + "paramDocs": [], + "returns": "the first shader in use, or null", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getCurrent", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Verschiebt die Figur um die angegebenen Werte" - } - } + "translations": {} }, { - "id": "Sprite/changeSize(double)", - "memberId": "Sprite/changeSize", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeSize", + "id": "Shaders/getCurrentIndex()", + "memberId": "Shaders/getCurrentIndex", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getCurrentIndex", "static": false, - "returnType": "void", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the number of the first shader in use, or -1", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getCurrentIndex", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Shaders/getCurrentName()", + "memberId": "Shaders/getCurrentName", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "getCurrentName", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the name of the first shader in use, or null", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/getCurrentName", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Shaders/isActive(String)", + "memberId": "Shaders/isActive", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "isActive", + "static": false, + "returnType": "boolean", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "amount" + "name" ], "params": [ - "double amount" + "String name" ], - "summary": "Changes the size of the sprite by a given percentage.", - "description": "Changes the size of the sprite by a given percentage.", - "scratchblock": "change size by (amount)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "amount: a percentage [0...100]" + "name: a shader's name" ], - "returns": null, + "returns": "whether it is in use", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/isActive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Größe um den angegebenen Wert in Prozent" - } - } + "translations": {} }, { - "id": "Sprite/changeTint(double)", - "memberId": "Sprite/changeTint", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeTint", + "id": "Shaders/next()", + "memberId": "Shaders/next", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "next", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "step" - ], - "params": [ - "double step" - ], - "summary": "Changes the tint for the sprite by a step.", - "description": "Changes the tint for the sprite by a step.", - "scratchblock": "change [color v] effect by (step)", - "paramDocs": [ - "step: a step value" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Uses the next shader alone.", + "description": "Uses the next shader alone.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/next", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert den Farbton der Einfärbung um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeTransparency(double)", - "memberId": "Sprite/changeTransparency", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeTransparency", + "id": "Shaders/reset()", + "memberId": "Shaders/reset", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "reset", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "step" - ], - "params": [ - "double step" - ], - "summary": "Changes how see-through the sprite is by a step. A positive step fades it\nout, a negative one brings it back.", - "description": "Changes how see-through the sprite is by a step. A positive step fades it\nout, a negative one brings it back.", - "scratchblock": "change [ghost v] effect by (step)", - "paramDocs": [ - "step: a step value" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Uses no shader.", + "description": "Uses no shader.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/reset", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Transparenz um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeVolume(double)", - "memberId": "Sprite/changeVolume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeVolume", + "id": "Shaders/switchTo(String)", + "memberId": "Shaders/switchTo", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "switchTo", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "step" + "name" ], "params": [ - "double step" + "String name" ], - "summary": "Makes every sound of this sprite louder or quieter.", - "description": "Makes every sound of this sprite louder or quieter.", - "scratchblock": "change volume by (step)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "step: how much to add to the volume, in percent" + "name: the shader to use, alone" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/switchTo", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Lautstärke um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeX(double)", - "memberId": "Sprite/changeX", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeX", + "id": "Shaders/switchTo(double)", + "memberId": "Shaders/switchTo", + "owner": "org.openpatch.scratch.Shaders", + "className": "Shaders", + "methodName": "switchTo", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "x" + "index" ], "params": [ - "double x" + "double index" ], - "summary": "Changes x by a certain amount", - "description": "Changes x by a certain amount", - "scratchblock": "change x by (x)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "x: number in pixels" + "index: the shader to use alone, counting from 0; wraps around" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shaders/switchTo", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die x-Position um den angegebenen Wert" - } - } + "translations": {} }, { - "id": "Sprite/changeY(double)", - "memberId": "Sprite/changeY", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "changeY", + "id": "Shape/contains(double,double)", + "memberId": "Shape/contains", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "contains", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ + "double", "double" ], "parameterNames": [ + "x", "y" ], "params": [ + "double x", "double y" ], - "summary": "Changes y by a certain amount", - "description": "Changes y by a certain amount", - "scratchblock": "change y by (y)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "y: number in pixels" + "x: x of a point", + "y: y of a point" ], - "returns": null, + "returns": "whether the point lies inside the shape", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/contains", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert die y-Position um den angegebenen Wert" + "description": "Gibt genau dann true zurück, wenn der Punkt in der Form liegt" } } }, { - "id": "Sprite/clone()", - "memberId": "Sprite/clone", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "clone", + "id": "Shape/getBounds()", + "memberId": "Shape/getBounds", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "getBounds", "static": false, - "returnType": "Sprite", + "returnType": "Bounds", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a clone of this sprite, like Scratch's \"create clone of myself\": a\nnew sprite of the same class (a clone of a `Cat` is a `Cat`),\nwith the same costume, position, direction, size and pen, and a copy of\nthe variables of your class. It is put on the stage right behind this\nsprite, and its [whenStartsAsClone()](whenStartsAsClone) runs; the constructor does\nnot run again.", - "description": "Creates a clone of this sprite, like Scratch's \"create clone of myself\": a\nnew sprite of the same class (a clone of a `Cat` is a `Cat`),\nwith the same costume, position, direction, size and pen, and a copy of\nthe variables of your class. It is put on the stage right behind this\nsprite, and its [whenStartsAsClone()](whenStartsAsClone) runs; the constructor does\nnot run again.\n\nNumbers, text and booleans in your variables are the clone's own. A list\nor another object is shared with the original: give the clone its own in\n[whenStartsAsClone()](whenStartsAsClone) if it needs one.\n\n```java\nBullet bullet = (Bullet) this.clone();\n```", - "scratchblock": "create clone of [myself v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "the clone, of the same class as this sprite", + "returns": "the smallest rectangle around the shape", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/clone", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/getBounds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt das umschließende Rechteck zurück" + } + } }, { - "id": "Sprite/constructor()", - "memberId": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "constructor", + "id": "Shape/getPoints()", + "memberId": "Shape/getPoints", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "getPoints", "static": false, - "returnType": "Sprite", + "returnType": "double[]", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Sprite object with default settings.", - "description": "Constructs a new Sprite object with default settings.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the outline's points `x0, y0, x1, y1, \\u2026` (a copy)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/getPoints", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Shape/intersects(Shape)", + "memberId": "Shape/intersects", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "intersects", + "static": false, + "returnType": "boolean", + "parameterTypes": [ + "org.openpatch.scratch.Shape" + ], + "parameterNames": [ + "other" + ], + "params": [ + "Shape other" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "other: another shape" + ], + "returns": "whether the two shapes overlap with some area; shapes that only touch do not", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/intersects", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine neue Figur" + "description": "Gibt genau dann true zurück, wenn sich beide Formen überlappen" } } }, { - "id": "Sprite/constructor(String,String)", - "memberId": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "constructor", + "id": "Shape/rotate(double,double,double)", + "memberId": "Shape/rotate", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "rotate", "static": false, - "returnType": "Sprite", + "returnType": "Shape", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "double", + "double", + "double" ], "parameterNames": [ - "name", - "imagePath" + "degrees", + "anchorX", + "anchorY" ], "params": [ - "String name", - "String imagePath" + "double degrees", + "double anchorX", + "double anchorY" ], - "summary": "Constructs a new Sprite object with a specified costume.", - "description": "Constructs a new Sprite object with a specified costume.", + "summary": "Turns the shape about a point, from the x axis towards the y axis (anticlockwise when y points\nup).", + "description": "Turns the shape about a point, from the x axis towards the y axis (anticlockwise when y points\nup).", "scratchblock": null, "paramDocs": [ - "name: a unique name for the costume", - "imagePath: a path to an image file, or the name of a built-in sprite\n such as \"slimeGreen\"" + "degrees: the angle", + "anchorX: x of the point to turn about", + "anchorY: y of the point to turn about" ], - "returns": null, + "returns": "the shape turned", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/rotate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Figur mit einem ersten Kostüm" + "description": "Gibt die um theta Grad gedrehte Form als neue Form zurück" } } }, { - "id": "Sprite/constructor(Sprite)", - "memberId": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "constructor", + "id": "Shape/scale(double,double)", + "memberId": "Shape/scale", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "scale", "static": false, - "returnType": "Sprite", + "returnType": "Shape", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "double", + "double" ], "parameterNames": [ - "s" + "scaleX", + "scaleY" ], "params": [ - "Sprite s" + "double scaleX", + "double scaleY" ], - "summary": "Copies a Sprite object.", - "description": "Copies a Sprite object.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "s: a Sprite object to copy" + "scaleX: factor along x (negative mirrors)", + "scaleY: factor along y" ], - "returns": null, + "returns": "the shape scaled about the origin", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/scale", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Kopie der angegebenen Figur" + "description": "Gibt die skalierte Form als neue Form zurück" } } }, { - "id": "Sprite/debug(Object[])", - "memberId": "Sprite/debug", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "debug", + "id": "Shape/translate(double,double)", + "memberId": "Shape/translate", + "owner": "org.openpatch.scratch.Shape", + "className": "Shape", + "methodName": "translate", "static": false, - "returnType": "void", + "returnType": "Shape", "parameterTypes": [ - "java.lang.Object[]" + "double", + "double" ], "parameterNames": [ - "values" + "dx", + "dy" ], "params": [ - "Object[] values" + "double dx", + "double dy" ], - "summary": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the sprite's class name so you can tell\nwhich sprite it came from.", - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the sprite's class name so you can tell\nwhich sprite it came from.\n\nExample:\n\n```java\nthis.debug(\"x =\", getX(), \"y =\", getY());\n// prints: [CatSprite] x = 100.0 y = 200.0\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "values: one or more values to print" + "dx: distance along x", + "dy: distance along y" ], - "returns": null, + "returns": "the shape moved", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/debug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Shape/translate", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt die verschobene Form als neue Form zurück" + } + } }, { - "id": "Sprite/deleteThisClone()", - "memberId": "Sprite/deleteThisClone", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "deleteThisClone", + "id": "SoundPlayback/isPlaying()", + "memberId": "SoundPlayback/isPlaying", + "owner": "org.openpatch.scratch.SoundPlayback", + "className": "SoundPlayback", + "methodName": "isPlaying", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes this sprite from the stage if it is a clone, like Scratch's\n\"delete this clone\". The original stays.", - "description": "Removes this sprite from the stage if it is a clone, like Scratch's\n\"delete this clone\". The original stays.", - "scratchblock": "delete this clone", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether this copy still plays", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/deleteThisClone", + "docsUrl": "https://scratch4j.openpatch.org/reference/SoundPlayback/isPlaying", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Sprite/disableHitbox()", - "memberId": "Sprite/disableHitbox", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "disableHitbox", + "id": "SoundPlayback/setVolume(double)", + "memberId": "SoundPlayback/setVolume", + "owner": "org.openpatch.scratch.SoundPlayback", + "className": "SoundPlayback", + "methodName": "setVolume", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Disables the hitbox for the sprite. Once the hitbox is disabled, the sprite\nwill no longer\ndetect collisions with other objects.", - "description": "Disables the hitbox for the sprite. Once the hitbox is disabled, the sprite\nwill no longer\ndetect collisions with other objects.", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "volume" + ], + "params": [ + "double volume" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "volume: from 0 to 100" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/disableHitbox", + "docsUrl": "https://scratch4j.openpatch.org/reference/SoundPlayback/setVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schaltet die Berührungserkennung aus" - } - } + "translations": {} }, { - "id": "Sprite/distanceToMousePointer()", - "memberId": "Sprite/distanceToMousePointer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "distanceToMousePointer", + "id": "SoundPlayback/stop()", + "memberId": "SoundPlayback/stop", + "owner": "org.openpatch.scratch.SoundPlayback", + "className": "SoundPlayback", + "methodName": "stop", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Calculates the distance from the current sprite to the mouse pointer.", - "description": "Calculates the distance from the current sprite to the mouse pointer.", - "scratchblock": "(distance to [mouse-pointer v])", + "summary": "Stops this copy.", + "description": "Stops this copy.", + "scratchblock": null, "paramDocs": [], - "returns": "the distance to the mouse pointer as a double.", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToMousePointer", + "docsUrl": "https://scratch4j.openpatch.org/reference/SoundPlayback/stop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Abstand zum Mauszeiger zurück" - } - } + "translations": {} }, { - "id": "Sprite/distanceToSprite(Sprite)", - "memberId": "Sprite/distanceToSprite", + "id": "Sprite/addAnimation(String,String,int)", + "memberId": "Sprite/addAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "distanceToSprite", + "methodName": "addAnimation", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "java.lang.String", + "java.lang.String", + "int" ], "parameterNames": [ - "sprite" + "name", + "pattern", + "frames" ], "params": [ - "Sprite sprite" + "String name", + "String pattern", + "int frames" ], - "summary": "Calculates the Euclidean distance between this sprite and another sprite.", - "description": "Calculates the Euclidean distance between this sprite and another sprite.", - "scratchblock": "(distance to [sprite v])", + "summary": "Adds an animation from numbered image files: the pattern's `%d` counts from 1.", + "description": "Adds an animation from numbered image files: the pattern's `%d` counts from 1.\n\n```java\nthis.addAnimation(\"walk\", \"assets/walk%d.png\", 4); // walk1.png \\u2026 walk4.png\n```", + "scratchblock": null, "paramDocs": [ - "sprite: the other sprite to which the distance is calculated" + "name: the animation's name", + "pattern: the file names, with `%d` for the frame number", + "frames: how many frames" ], - "returns": "the distance between this sprite and the specified sprite", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addAnimation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Abstand zu einer anderen Figur zurück" - } - } + "translations": {} }, { - "id": "Sprite/enableHitbox()", - "memberId": "Sprite/enableHitbox", + "id": "Sprite/addAnimation(String,String,int,int)", + "memberId": "Sprite/addAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "enableHitbox", + "methodName": "addAnimation", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Enables the hitbox for the sprite. This method sets the hitboxDisabled flag\nto false, allowing\nthe sprite to interact with other objects.", - "description": "Enables the hitbox for the sprite. This method sets the hitboxDisabled flag\nto false, allowing\nthe sprite to interact with other objects.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/enableHitbox", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int" + ], + "parameterNames": [ + "name", + "pattern", + "from", + "to" + ], + "params": [ + "String name", + "String pattern", + "int from", + "int to" + ], + "summary": "Adds an animation from numbered image files, from one number to another: for files that count\nfrom 0, or to use only some of them. If `to` is smaller than `from`, it counts down.", + "description": "Adds an animation from numbered image files, from one number to another: for files that count\nfrom 0, or to use only some of them. If `to` is smaller than `from`, it counts down.\n\n```java\nthis.addAnimation(\"hit\", \"assets/hit%d.png\", 0, 4); // hit0.png \\u2026 hit4.png\n```", + "scratchblock": null, + "paramDocs": [ + "name: the animation's name", + "pattern: the file names, with `%d` for the frame number", + "from: the number of the first frame", + "to: the number of the last frame" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addAnimation", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/addAnimation(String,String,int,int,int[])", + "memberId": "Sprite/addAnimation", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addAnimation", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int", + "int[]" + ], + "parameterNames": [ + "name", + "sheetPath", + "width", + "height", + "frames" + ], + "params": [ + "String name", + "String sheetPath", + "int width", + "int height", + "int[] frames" + ], + "summary": "Adds an animation from a sprite sheet: frames of equal size, numbered row by row from the\ntop left, starting at 0.", + "description": "Adds an animation from a sprite sheet: frames of equal size, numbered row by row from the\ntop left, starting at 0.\n\n```java\nthis.addAnimation(\"walk\", \"assets/walk.png\", 32, 32, 0, 1, 2, 3); // the first row\nthis.addAnimation(\"down\", \"assets/hero.png\", 32, 32, 0, 4, 8, 12); // the first column of 4\n```", + "scratchblock": null, + "paramDocs": [ + "name: the animation's name", + "sheetPath: the sprite sheet", + "width: the width of a frame", + "height: the height of a frame", + "frames: the frames to show, in order" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addAnimation", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/addCostume(String,String)", + "memberId": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "imagePath" + ], + "params": [ + "String name", + "String imagePath" + ], + "summary": "Adds a costume from an image file. The first costume added is the one the sprite wears.", + "description": "Adds a costume from an image file. The first costume added is the one the sprite wears.", + "scratchblock": null, + "paramDocs": [ + "name: the costume's name, for [switchCostume(String)](switchCostume)", + "imagePath: the image file (PNG, JPEG, GIF, BMP or TGA)" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt ein Kostüm unter eigenem Namen hinzu" + } + } + }, + { + "id": "Sprite/addCostume(String)", + "memberId": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "imagePath" + ], + "params": [ + "String imagePath" + ], + "summary": "Adds a costume from an image file, named after the file.", + "description": "Adds a costume from an image file, named after the file.", + "scratchblock": null, + "paramDocs": [ + "imagePath: the image file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt eines der eingebauten Kostüme hinzu" + } + } + }, + { + "id": "Sprite/addCostume(String,String,int,int,int,int)", + "memberId": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int", + "int", + "int" + ], + "parameterNames": [ + "name", + "imagePath", + "x", + "y", + "width", + "height" + ], + "params": [ + "String name", + "String imagePath", + "int x", + "int y", + "int width", + "int height" + ], + "summary": "Adds a costume cut out of a larger image, e.g. one frame of a sprite sheet.", + "description": "Adds a costume cut out of a larger image, e.g. one frame of a sprite sheet.", + "scratchblock": null, + "paramDocs": [ + "name: the costume's name", + "imagePath: the image file", + "x: left edge of the part, in pixels", + "y: top edge of the part, in pixels", + "width: width of the part", + "height: height of the part" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Schneidet ein Kostüm aus einem Bild aus" + } + } + }, + { + "id": "Sprite/addCostumes(String,String,int,int)", + "memberId": "Sprite/addCostumes", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addCostumes", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "int", + "int" + ], + "parameterNames": [ + "name", + "imagePath", + "width", + "height" + ], + "params": [ + "String name", + "String imagePath", + "int width", + "int height" + ], + "summary": "Adds every frame of a sprite sheet as a costume, row by row, named `name0`,\n`name1`, \\u2026", + "description": "Adds every frame of a sprite sheet as a costume, row by row, named `name0`,\n`name1`, \\u2026", + "scratchblock": null, + "paramDocs": [ + "name: the start of the costumes' names", + "imagePath: the image file", + "width: width of one frame", + "height: height of one frame" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addCostumes", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Zerschneidet ein Bild in gleich große Kacheln und fügt sie als Kostüme hinzu" + } + } + }, + { + "id": "Sprite/addSound(String,String)", + "memberId": "Sprite/addSound", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addSound", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "soundPath" + ], + "params": [ + "String name", + "String soundPath" + ], + "summary": "Adds a sound (WAV or OGG).", + "description": "Adds a sound (WAV or OGG).", + "scratchblock": null, + "paramDocs": [ + "name: the sound's name, for [playSound(String)](playSound)", + "soundPath: the sound file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt einen Klang unter eigenem Namen hinzu" + } + } + }, + { + "id": "Sprite/addSound(String)", + "memberId": "Sprite/addSound", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "addSound", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "soundPath" + ], + "params": [ + "String soundPath" + ], + "summary": "Adds a sound, named after its file.", + "description": "Adds a sound, named after its file.", + "scratchblock": null, + "paramDocs": [ + "soundPath: the sound file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/addSound", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Fügt einen der eingebauten Klänge hinzu" + } + } + }, + { + "id": "Sprite/ask(String)", + "memberId": "Sprite/ask", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "ask", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "question" + ], + "params": [ + "String question" + ], + "summary": "Asks a question: the sprite says it in a bubble, and a box to type the answer in appears at\nthe bottom of the stage. Enter finishes it; see [Stage.ask(String)](../Stage/ask).", + "description": "Asks a question: the sprite says it in a bubble, and a box to type the answer in appears at\nthe bottom of the stage. Enter finishes it; see [Stage.ask(String)](../Stage/ask).", + "scratchblock": "ask [question] and wait", + "paramDocs": [ + "question: the question" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ask", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" + } + } + }, + { + "id": "Sprite/broadcast(String)", + "memberId": "Sprite/broadcast", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "broadcast", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "message" + ], + "params": [ + "String message" + ], + "summary": "Sends a message to the stage and every sprite on it; their [whenIReceive(String)](whenIReceive)\nruns at once, before this method returns.", + "description": "Sends a message to the stage and every sprite on it; their [whenIReceive(String)](whenIReceive)\nruns at once, before this method returns.", + "scratchblock": "broadcast [message v]", + "paramDocs": [ + "message: the message" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/broadcast", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Sendet eine Nachricht an alle Figuren und die Bühne" + } + } + }, + { + "id": "Sprite/changeColorEffect(double)", + "memberId": "Sprite/changeColorEffect", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeColorEffect", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [color v] effect by (by)", + "paramDocs": [ + "by: how much to change the colour effect" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeColorEffect", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/changeHeight(double)", + "memberId": "Sprite/changeHeight", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeHeight", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "by: how much higher to draw the sprite" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeHeight", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/changePosition(double,double)", + "memberId": "Sprite/changePosition", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changePosition", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double", + "double" + ], + "parameterNames": [ + "dx", + "dy" + ], + "params": [ + "double dx", + "double dy" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "dx: how far to move along x", + "dy: how far to move along y" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Verschiebt die Figur um die angegebenen Werte" + } + } + }, + { + "id": "Sprite/changePosition(Vector2)", + "memberId": "Sprite/changePosition", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changePosition", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.Vector2" + ], + "parameterNames": [ + "by" + ], + "params": [ + "Vector2 by" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "by: how far to move" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changePosition", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Verschiebt die Figur um den angegebenen Vektor" + } + } + }, + { + "id": "Sprite/changeSize(double)", + "memberId": "Sprite/changeSize", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeSize", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "percent" + ], + "params": [ + "double percent" + ], + "summary": "", + "description": "", + "scratchblock": "change size by (amount)", + "paramDocs": [ + "percent: how much to change the size, in percentage points" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeSize", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die Größe um den angegebenen Wert in Prozent" + } + } + }, + { + "id": "Sprite/changeTransparency(double)", + "memberId": "Sprite/changeTransparency", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeTransparency", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [ghost v] effect by (step)", + "paramDocs": [ + "by: how much to change the transparency" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeTransparency", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die Transparenz um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/changeVolume(double)", + "memberId": "Sprite/changeVolume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeVolume", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change volume by (step)", + "paramDocs": [ + "by: how much to change the volume" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeVolume", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die Lautstärke um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/changeWidth(double)", + "memberId": "Sprite/changeWidth", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeWidth", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "by: how much wider to draw the sprite" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeWidth", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/changeX(double)", + "memberId": "Sprite/changeX", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeX", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "dx" + ], + "params": [ + "double dx" + ], + "summary": "", + "description": "", + "scratchblock": "change x by (x)", + "paramDocs": [ + "dx: how far to move along x" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeX", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die x-Position um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/changeY(double)", + "memberId": "Sprite/changeY", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "changeY", + "static": false, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "dy" + ], + "params": [ + "double dy" + ], + "summary": "", + "description": "", + "scratchblock": "change y by (y)", + "paramDocs": [ + "dy: how far to move along y" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/changeY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Ändert die y-Position um den angegebenen Wert" + } + } + }, + { + "id": "Sprite/constructor()", + "memberId": "Sprite/constructor", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "constructor", + "static": false, + "returnType": "Sprite", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A sprite without costumes. Add some with [addCostume(String, String)](addCostume).", + "description": "A sprite without costumes. Add some with [addCostume(String, String)](addCostume).", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Erzeugt eine neue Figur" + } + } + }, + { + "id": "Sprite/constructor(String,String)", + "memberId": "Sprite/constructor", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "constructor", + "static": false, + "returnType": "Sprite", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "imagePath" + ], + "params": [ + "String name", + "String imagePath" + ], + "summary": "A sprite with one costume.", + "description": "A sprite with one costume.", + "scratchblock": null, + "paramDocs": [ + "name: the costume's name", + "imagePath: the image file" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Erzeugt eine Figur mit einem ersten Kostüm" + } + } + }, + { + "id": "Sprite/createClone()", + "memberId": "Sprite/createClone", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "createClone", + "static": false, + "returnType": "T", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Makes a clone: a copy of this sprite with the same costumes, position, direction, effects and\nvariables, added to the stage just behind this sprite, as in Scratch. Its\n[whenStartsAsClone()](whenStartsAsClone) runs;\nits constructor does not. Numbers, texts and booleans in its variables are its own; lists and\nother objects are shared with this sprite until the clone gets its own in\n[whenStartsAsClone()](whenStartsAsClone).", + "description": "Makes a clone: a copy of this sprite with the same costumes, position, direction, effects and\nvariables, added to the stage just behind this sprite, as in Scratch. Its\n[whenStartsAsClone()](whenStartsAsClone) runs;\nits constructor does not. Numbers, texts and booleans in its variables are its own; lists and\nother objects are shared with this sprite until the clone gets its own in\n[whenStartsAsClone()](whenStartsAsClone).\n\n```java\nBullet bullet = this.createClone();\n```", + "scratchblock": null, + "paramDocs": [], + "returns": "the clone", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/createClone", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/debug(Object[])", + "memberId": "Sprite/debug", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "debug", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.Object[]" + ], + "parameterNames": [ + "values" + ], + "params": [ + "Object[] values" + ], + "summary": "Prints values for debugging, but only while debug mode is on (`window.setDebug(true)`\nor F12).", + "description": "Prints values for debugging, but only while debug mode is on (`window.setDebug(true)`\nor F12).", + "scratchblock": null, + "paramDocs": [ + "values: what to print" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/debug", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/deleteThisClone()", + "memberId": "Sprite/deleteThisClone", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "deleteThisClone", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Removes this sprite if it is a clone, stopping its sounds; does nothing for the original.", + "description": "Removes this sprite if it is a clone, stopping its sounds; does nothing for the original.", + "scratchblock": "delete this clone", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/deleteThisClone", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/disableHitbox()", + "memberId": "Sprite/disableHitbox", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "disableHitbox", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Touching ignores this sprite until [enableHitbox()](enableHitbox).", + "description": "Touching ignores this sprite until [enableHitbox()](enableHitbox).", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/disableHitbox", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Schaltet die Berührungserkennung aus" + } + } + }, + { + "id": "Sprite/disableNineSlice()", + "memberId": "Sprite/disableNineSlice", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "disableNineSlice", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Stretches the whole costume again.", + "description": "Stretches the whole costume again.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/disableNineSlice", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/distanceToMousePointer()", + "memberId": "Sprite/distanceToMousePointer", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "distanceToMousePointer", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(distance to [mouse-pointer v])", + "paramDocs": [], + "returns": "the distance to the mouse pointer", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToMousePointer", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Gibt den Abstand zum Mauszeiger zurück" + } + } + }, + { + "id": "Sprite/distanceToSprite(Sprite)", + "memberId": "Sprite/distanceToSprite", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "distanceToSprite", + "static": false, + "returnType": "double", + "parameterTypes": [ + "org.openpatch.scratch.Sprite" + ], + "parameterNames": [ + "sprite" + ], + "params": [ + "Sprite sprite" + ], + "summary": "", + "description": "", + "scratchblock": "(distance to [sprite v])", + "paramDocs": [ + "sprite: another sprite" + ], + "returns": "the distance between the two positions", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/distanceToSprite", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Gibt den Abstand zu einer anderen Figur zurück" + } + } + }, + { + "id": "Sprite/enableHitbox()", + "memberId": "Sprite/enableHitbox", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "enableHitbox", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Touching counts this sprite again.", + "description": "Touching counts this sprite again.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/enableHitbox", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { @@ -5207,6 +6031,84 @@ } } }, + { + "id": "Sprite/extension(Class,Supplier)", + "memberId": "Sprite/extension", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "extension", + "static": false, + "returnType": "T", + "parameterTypes": [ + "java.lang.Class", + "java.util.function.Supplier" + ], + "parameterNames": [ + "type", + "factory" + ], + "params": [ + "Class type", + "Supplier factory" + ], + "summary": "An extension's state for this sprite, made on first use; a clone gets its own. For\nextensions, not for learner code.", + "description": "An extension's state for this sprite, made on first use; a clone gets its own. For\nextensions, not for learner code.", + "scratchblock": null, + "paramDocs": [ + "type: the state's class", + "factory: makes it" + ], + "returns": "the sprite's one instance", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/extension", + "availability": "desktop-only", + "availabilityReason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others.", + "translations": {} + }, + { + "id": "Sprite/getAnimationFrame()", + "memberId": "Sprite/getAnimationFrame", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getAnimationFrame", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the frame of the current animation, counting from 0", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getAnimationFrame", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/getAnimationInterval()", + "memberId": "Sprite/getAnimationInterval", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getAnimationInterval", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "how long each frame shows, in seconds", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getAnimationInterval", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Sprite/getAnswer()", "memberId": "Sprite/getAnswer", @@ -5218,11 +6120,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the last answer that was typed in.", - "description": "Returns the last answer that was typed in.", + "summary": "", + "description": "", "scratchblock": "(answer)", "paramDocs": [], - "returns": "the answer, or an empty string if nothing has been answered yet", + "returns": "the answer to the last question", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getAnswer", "availability": "implemented", @@ -5233,6 +6135,28 @@ } } }, + { + "id": "Sprite/getColorEffect()", + "memberId": "Sprite/getColorEffect", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getColorEffect", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the colour effect", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getColorEffect", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Sprite/getCurrentCostumeIndex()", "memberId": "Sprite/getCurrentCostumeIndex", @@ -5244,11 +6168,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current costume index", - "description": "Returns the current costume index", + "summary": "", + "description": "", "scratchblock": "(costume [number v])", "paramDocs": [], - "returns": "a costume index", + "returns": "the current costume's number, counting from 0", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getCurrentCostumeIndex", "availability": "implemented", @@ -5270,11 +6194,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current costume name", - "description": "Returns the current costume name", + "summary": "", + "description": "", "scratchblock": "(costume [name v])", "paramDocs": [], - "returns": "a costume name", + "returns": "the current costume's name, or null without costumes", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getCurrentCostumeName", "availability": "implemented", @@ -5285,32 +6209,6 @@ } } }, - { - "id": "Sprite/getDeltaTime()", - "memberId": "Sprite/getDeltaTime", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "getDeltaTime", - "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Gets the seconds passed since the last frame.", - "description": "Gets the seconds passed since the last frame.", - "scratchblock": null, - "paramDocs": [], - "returns": "seconds since last frame", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getDeltaTime", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" - } - } - }, { "id": "Sprite/getDirection()", "memberId": "Sprite/getDirection", @@ -5322,11 +6220,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the direction of the sprite.", - "description": "Returns the direction of the sprite.", + "summary": "", + "description": "", "scratchblock": "(direction)", "paramDocs": [], - "returns": "the direction [0...360]", + "returns": "the direction, from 0 (inclusive) to 360 (exclusive); 90 is right", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getDirection", "availability": "implemented", @@ -5344,15 +6242,15 @@ "className": "Sprite", "methodName": "getHeight", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the height of the current costume or the pen size, when no costume is\navailable.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the height of the sprite", + "returns": "the height the sprite is drawn at, in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getHeight", "availability": "implemented", @@ -5370,15 +6268,15 @@ "className": "Sprite", "methodName": "getHitbox", "static": false, - "returnType": "Hitbox", + "returnType": "Shape", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the hitbox of the sprite based on its current costume, position, and\nrotation. If the\nsprite has a hitbox already defined, it updates and returns it. Otherwise, it\ncalculates a new\nhitbox based on the sprite's dimensions and rotation.", - "description": "Returns the hitbox of the sprite based on its current costume, position, and\nrotation. If the\nsprite has a hitbox already defined, it updates and returns it. Otherwise, it\ncalculates a new\nhitbox based on the sprite's dimensions and rotation.", + "summary": "The hitbox where the sprite is now, in stage coordinates: by default the rectangle around the\ncostume's painted pixels; null for a sprite without costumes.", + "description": "The hitbox where the sprite is now, in stage coordinates: by default the rectangle around the\ncostume's painted pixels; null for a sprite without costumes.", "scratchblock": null, "paramDocs": [], - "returns": "the hitbox of the sprite", + "returns": "the hitbox, or null", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getHitbox", "availability": "implemented", @@ -5389,6 +6287,28 @@ } } }, + { + "id": "Sprite/getLayer()", + "memberId": "Sprite/getLayer", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getLayer", + "static": false, + "returnType": "Layer", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the sprite's layer", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getLayer", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Sprite/getMouse()", "memberId": "Sprite/getMouse", @@ -5400,11 +6320,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current position of the mouse cursor.", - "description": "Retrieves the current position of the mouse cursor.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "a Vector2 object representing the current mouse cursor position, with\n the x-coordinate\n obtained from getMouseX() and the y-coordinate obtained from\n getMouseY().", + "returns": "the mouse pointer's position, in world coordinates (or stage coordinates for UI)", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getMouse", "availability": "implemented", @@ -5426,11 +6346,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current x-position of the mouse cursor", - "description": "Returns the current x-position of the mouse cursor", + "summary": "", + "description": "", "scratchblock": "(mouse x)", "paramDocs": [], - "returns": "x-position", + "returns": "x of the mouse pointer, in the sprite's coordinates (world, or the stage for UI)", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getMouseX", "availability": "implemented", @@ -5452,11 +6372,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current y-position of the mouse cursor", - "description": "Returns the current y-position of the mouse cursor", + "summary": "", + "description": "", "scratchblock": "(mouse y)", "paramDocs": [], - "returns": "y-position", + "returns": "y of the mouse pointer", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getMouseY", "availability": "implemented", @@ -5478,11 +6398,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pen of the sprite.", - "description": "Returns the pen of the sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the sprite's pen, which follows it", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getPen", "availability": "implemented", @@ -5504,20 +6424,42 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current position of the sprite.", - "description": "Retrieves the current position of the sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "A [Vector2](../Vector2/index) object representing the x and y coordinates of the\n sprite.", + "returns": "the sprite's position", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Position der Figur zurück" - } - } + "translations": { + "de": { + "description": "Gibt die Position der Figur zurück" + } + } + }, + { + "id": "Sprite/getRotationStyle()", + "memberId": "Sprite/getRotationStyle", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "getRotationStyle", + "static": false, + "returnType": "RotationStyle", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "how the costume follows the direction", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getRotationStyle", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} }, { "id": "Sprite/getShaders()", @@ -5530,11 +6472,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the shaders of this sprite. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.", - "description": "Returns the shaders of this sprite. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.\n\nExample usage:\n\n```java\nthis.getShaders().add(\"blur\", \"blur.frag\", null);\nthis.getShaders().switchTo(\"blur\");\n```\n\nA sprite draws with one shader: with several active, the first of them.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the shaders", + "returns": "the sprite's shaders", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getShaders", "availability": "implemented", @@ -5556,11 +6498,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the size of the sprite.", - "description": "Returns the size of the sprite.", + "summary": "", + "description": "", "scratchblock": "(size)", "paramDocs": [], - "returns": "size in percentage", + "returns": "the size in percent of the costume's own size", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getSize", "availability": "implemented", @@ -5582,11 +6524,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current stage associated with this sprite.", - "description": "Retrieves the current stage associated with this sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the stage associated with this sprite", + "returns": "the stage the sprite is on, or null", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getStage", "availability": "implemented", @@ -5608,11 +6550,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the text associated with this sprite.", - "description": "Retrieves the text associated with this sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the text associated with this sprite", + "returns": "the sprite's text, which say and think show in a bubble", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getText", "availability": "implemented", @@ -5634,11 +6576,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the default timer", - "description": "Return the default timer", + "summary": "", + "description": "", "scratchblock": "(timer)", "paramDocs": [], - "returns": "the default timer", + "returns": "this object's timer, counting game time since it was made or reset", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTimer", "availability": "implemented", @@ -5649,40 +6591,6 @@ } } }, - { - "id": "Sprite/getTimer(String)", - "memberId": "Sprite/getTimer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "getTimer", - "static": false, - "returnType": "Timer", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Return a timer by name", - "description": "Return a timer by name", - "scratchblock": null, - "paramDocs": [ - "name: " - ], - "returns": "a timer", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTimer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Timer mit dem angegebenen Namen zurück und legt ihn bei Bedarf an" - } - } - }, { "id": "Sprite/getTint()", "memberId": "Sprite/getTint", @@ -5694,11 +6602,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the tint value of the current costume.", - "description": "Retrieves the tint value of the current costume.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the tint value of the current costume, or null if there are no\n costumes.", + "returns": "the tint, or null for none", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTint", "availability": "implemented", @@ -5721,18 +6629,18 @@ "java.lang.Class" ], "parameterNames": [ - "c" + "type" ], "params": [ - "Class c" + "Class type" ], - "summary": "Returns the first sprite of the specified type that is currently touching\nthis sprite.", - "description": "Returns the first sprite of the specified type that is currently touching\nthis sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: the class object of the type of sprite to check for" + "type: a class of sprites" ], - "returns": "the first sprite of the specified type that is touching this sprite,\n or null if no such\n sprite is found", + "returns": "a sprite of that class the sprite touches, or null", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTouchingSprite", "availability": "implemented", @@ -5755,18 +6663,18 @@ "java.lang.Class" ], "parameterNames": [ - "c" + "type" ], "params": [ - "Class c" + "Class type" ], - "summary": "Returns a list of sprites of the specified type that are currently touching\nthis sprite.", - "description": "Returns a list of sprites of the specified type that are currently touching\nthis sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: the class of the type of sprites to return" + "type: a class of sprites" ], - "returns": "a list of sprites of the specified type that are touching this\n sprite, or null if the\n stage is not set", + "returns": "every sprite of that class the sprite touches", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTouchingSprites", "availability": "implemented", @@ -5788,11 +6696,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the transparency of the current costume.", - "description": "Gets the transparency of the current costume.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "how see-through the sprite is, 0 solid and 100 invisible", + "returns": "the transparency in percent", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getTransparency", "availability": "implemented", @@ -5814,11 +6722,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns how loud the sounds of this sprite play.", - "description": "Returns how loud the sounds of this sprite play.", + "summary": "", + "description": "", "scratchblock": "(volume)", "paramDocs": [], - "returns": "the volume, from 0 to 100", + "returns": "this object's volume from 0 to 100", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getVolume", "availability": "implemented", @@ -5836,15 +6744,15 @@ "className": "Sprite", "methodName": "getWidth", "static": false, - "returnType": "int", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the width of the current costume or the pen size, when no costume is\navailable.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the width of the sprite", + "returns": "the width the sprite is drawn at, in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getWidth", "availability": "implemented", @@ -5866,11 +6774,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the x coordinate of the sprite", - "description": "Returns the x coordinate of the sprite", + "summary": "", + "description": "", "scratchblock": "(x position)", "paramDocs": [], - "returns": "a x coordinate", + "returns": "x of the sprite's position", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getX", "availability": "implemented", @@ -5892,11 +6800,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the y coordinate of the sprite", - "description": "Returns the y coordinate of the sprite", + "summary": "", + "description": "", "scratchblock": "(y position)", "paramDocs": [], - "returns": "a y coordinate", + "returns": "y of the sprite's position", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/getY", "availability": "implemented", @@ -5928,499 +6836,267 @@ "params": [ "double seconds", "double x", - "double y" - ], - "summary": "Slides the sprite to a place over the given time, instead of jumping there.", - "description": "Slides the sprite to a place over the given time, instead of jumping there.\n\nUnlike Scratch this does not hold up the sprite: `run()` keeps being called\nwhile the sprite is on its way. Use [isGliding()](isGliding) to tell whether it\nhas arrived.", - "scratchblock": "glide (seconds) secs to x: (x) y: (y)", - "paramDocs": [ - "seconds: how long the trip should take", - "x: where to end up", - "y: where to end up" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/glide", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gleitet in der angegebenen Zeit zur Zielposition" - } - } - }, - { - "id": "Sprite/goLayersBackwards(int)", - "memberId": "Sprite/goLayersBackwards", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goLayersBackwards", - "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the sprite backwards by a specified number of layers in the stage. If\nthe sprite is not\npart of a stage, the method does nothing.", - "description": "Moves the sprite backwards by a specified number of layers in the stage. If\nthe sprite is not\npart of a stage, the method does nothing.", - "scratchblock": "go [backward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the sprite backwards" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersBackwards", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schiebt die Figur um die angegebene Anzahl Ebenen nach hinten" - } - } - }, - { - "id": "Sprite/goLayersForwards(int)", - "memberId": "Sprite/goLayersForwards", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goLayersForwards", - "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the sprite forward by a specified number of layers within its stage.", - "description": "Moves the sprite forward by a specified number of layers within its stage.", - "scratchblock": "go [forward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the sprite forward" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersForwards", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Bringt die Figur um die angegebene Anzahl Ebenen nach vorne" - } - } - }, - { - "id": "Sprite/goToBackLayer()", - "memberId": "Sprite/goToBackLayer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToBackLayer", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves the sprite to the back layer of the stage. If the sprite is not\nassociated with any\nstage, the method returns without performing any action.", - "description": "Moves the sprite to the back layer of the stage. If the sprite is not\nassociated with any\nstage, the method returns without performing any action.", - "scratchblock": "go to [back v] layer", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToBackLayer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Schiebt die Figur ganz nach hinten" - } - } - }, - { - "id": "Sprite/goToFrontLayer()", - "memberId": "Sprite/goToFrontLayer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToFrontLayer", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves this sprite to the front layer of the stage. If the sprite is not part\nof any stage, the\nmethod does nothing.", - "description": "Moves this sprite to the front layer of the stage. If the sprite is not part\nof any stage, the\nmethod does nothing.", - "scratchblock": "go to [front v] layer", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToFrontLayer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Bringt die Figur ganz nach vorne" - } - } - }, - { - "id": "Sprite/goToMousePointer()", - "memberId": "Sprite/goToMousePointer", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToMousePointer", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves the sprite to the current position of the mouse pointer. This method\nupdates the sprite's\nposition to the coordinates of the mouse cursor.", - "description": "Moves the sprite to the current position of the mouse pointer. This method\nupdates the sprite's\nposition to the coordinates of the mouse cursor.", - "scratchblock": "go to [mouse-pointer v]", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToMousePointer", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an die Position des Mauszeigers" - } - } - }, - { - "id": "Sprite/goToRandomPosition()", - "memberId": "Sprite/goToRandomPosition", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToRandomPosition", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Moves the sprite to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", - "description": "Moves the sprite to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", - "scratchblock": "go to [random position v]", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToRandomPosition", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an eine zufällige Position auf der Bühne" - } - } - }, - { - "id": "Sprite/goToSprite(Sprite)", - "memberId": "Sprite/goToSprite", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "goToSprite", - "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "sprite" - ], - "params": [ - "Sprite sprite" + "double y" ], - "summary": "Moves this sprite to the position of the specified sprite.", - "description": "Moves this sprite to the position of the specified sprite.", - "scratchblock": "go to [sprite v]", + "summary": "Glides to a position in a number of seconds of game time; the sprite keeps running its code\nmeanwhile. A new glide replaces one that is still going.", + "description": "Glides to a position in a number of seconds of game time; the sprite keeps running its code\nmeanwhile. A new glide replaces one that is still going.", + "scratchblock": "glide (seconds) secs to x: (x) y: (y)", "paramDocs": [ - "sprite: the sprite to move to" + "seconds: how long the glide takes", + "x: x of the target", + "y: y of the target" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/glide", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Figur auf die Position einer anderen Figur" + "description": "Gleitet in der angegebenen Zeit zur Zielposition" } } }, { - "id": "Sprite/hide()", - "memberId": "Sprite/hide", + "id": "Sprite/goLayersBackwards(int)", + "memberId": "Sprite/goLayersBackwards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "hide", + "methodName": "goLayersBackwards", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Hides the sprite. The pen is not effected.", - "description": "Hides the sprite. The pen is not effected.", - "scratchblock": "hide", - "paramDocs": [], + "parameterTypes": [ + "int" + ], + "parameterNames": [ + "number" + ], + "params": [ + "int number" + ], + "summary": "", + "description": "", + "scratchblock": "go [backward v] (number) layers", + "paramDocs": [ + "number: how many sprites of its layer to move behind" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hide", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersBackwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Macht die Figur unsichtbar" + "description": "Schiebt die Figur um die angegebene Anzahl Ebenen nach hinten" } } }, { - "id": "Sprite/hideVariable(String)", - "memberId": "Sprite/hideVariable", + "id": "Sprite/goLayersForwards(int)", + "memberId": "Sprite/goLayersForwards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "hideVariable", + "methodName": "goLayersForwards", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "number" ], "params": [ - "String name" + "int number" ], - "summary": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "description": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "scratchblock": "hide variable [name v]", + "summary": "", + "description": "", + "scratchblock": "go [forward v] (number) layers", "paramDocs": [ - "name: the name the monitor was shown with" + "number: how many sprites of its layer to move in front of" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hideVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goLayersForwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Bringt die Figur um die angegebene Anzahl Ebenen nach vorne" + } + } }, { - "id": "Sprite/ifOnEdgeBounce()", - "memberId": "Sprite/ifOnEdgeBounce", + "id": "Sprite/goToBackLayer()", + "memberId": "Sprite/goToBackLayer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "ifOnEdgeBounce", + "methodName": "goToBackLayer", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the sprite is on the edge of the stage and bounces it back if it\nis. The sprite's\ndirection is reversed when it hits the left or right border, and it is\nreversed and rotated by\n180 degrees when it hits the top or bottom border. The method does nothing if\nthe hitbox is\ndisabled or if the sprite is a UI element. It also does nothing if the\nsprite has not been added to a stage yet.", - "description": "Checks if the sprite is on the edge of the stage and bounces it back if it\nis. The sprite's\ndirection is reversed when it hits the left or right border, and it is\nreversed and rotated by\n180 degrees when it hits the top or bottom border. The method does nothing if\nthe hitbox is\ndisabled or if the sprite is a UI element. It also does nothing if the\nsprite has not been added to a stage yet.", - "scratchblock": "if on edge, bounce", + "summary": "Moves the sprite behind every other sprite of its layer.", + "description": "Moves the sprite behind every other sprite of its layer.", + "scratchblock": "go to [back v] layer", "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ifOnEdgeBounce", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToBackLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Lässt die Figur am Bühnenrand abprallen" + "description": "Schiebt die Figur ganz nach hinten" } } }, { - "id": "Sprite/isAsking()", - "memberId": "Sprite/isAsking", + "id": "Sprite/goToFrontLayer()", + "memberId": "Sprite/goToFrontLayer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isAsking", + "methodName": "goToFrontLayer", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether a question is on screen and still waiting for an answer.", - "description": "Checks whether a question is on screen and still waiting for an answer.", - "scratchblock": null, + "summary": "Moves the sprite in front of every other sprite of its layer.", + "description": "Moves the sprite in front of every other sprite of its layer.", + "scratchblock": "go to [front v] layer", "paramDocs": [], - "returns": "true while a question is waiting", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isAsking", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToFrontLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" + "description": "Bringt die Figur ganz nach vorne" } } }, { - "id": "Sprite/isClone()", - "memberId": "Sprite/isClone", + "id": "Sprite/goToMousePointer()", + "memberId": "Sprite/goToMousePointer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isClone", + "methodName": "goToMousePointer", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Whether this sprite is a clone, made by [clone()](clone).", - "description": "Whether this sprite is a clone, made by [clone()](clone).", - "scratchblock": null, + "summary": "Goes to the mouse pointer.", + "description": "Goes to the mouse pointer.", + "scratchblock": "go to [mouse-pointer v]", "paramDocs": [], - "returns": "true for a clone, false for the original", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isClone", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine Kopie der Figur" - } - } - }, - { - "id": "Sprite/isColorTouchingColor(Color,Color)", - "memberId": "Sprite/isColorTouchingColor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "isColorTouchingColor", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "color", - "other" - ], - "params": [ - "Color color", - "Color other" - ], - "summary": "Checks whether a colour of the sprite is touching a colour on the stage:\nonly the parts of the costume painted in `color` count. A car whose\nfront bumper is red can ask whether the bumper touches the grass.", - "description": "Checks whether a colour of the sprite is touching a colour on the stage:\nonly the parts of the costume painted in `color` count. A car whose\nfront bumper is red can ask whether the bumper touches the grass.\n\n```java\nif (this.isColorTouchingColor(HtmlColor.RED, HtmlColor.GREEN)) {\n this.say(\"Off the road!\");\n}\n```", - "scratchblock": "<color [#ff0000] is touching [#00ff00]?>", - "paramDocs": [ - "color: a colour of this sprite's costume", - "other: the colour to look for under it" - ], - "returns": "true if the colour touches the other colour", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isColorTouchingColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToMousePointer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Prüft, ob die Teile der Figur in der Farbe color über der Farbe other liegen" + "description": "Setzt die Figur an die Position des Mauszeigers" } } }, { - "id": "Sprite/isGliding()", - "memberId": "Sprite/isGliding", + "id": "Sprite/goToRandomPosition()", + "memberId": "Sprite/goToRandomPosition", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isGliding", + "methodName": "goToRandomPosition", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether the sprite is still on its way to a place it was told to\nglide to.", - "description": "Checks whether the sprite is still on its way to a place it was told to\nglide to.", - "scratchblock": null, + "summary": "Goes to a random position on the stage.", + "description": "Goes to a random position on the stage.", + "scratchblock": "go to [random position v]", "paramDocs": [], - "returns": "true while it is still moving", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isGliding", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToRandomPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Figur gerade gleitet" + "description": "Setzt die Figur an eine zufällige Position auf der Bühne" } } }, { - "id": "Sprite/isKeyPressed(KeyCode)", - "memberId": "Sprite/isKeyPressed", + "id": "Sprite/goToSprite(Sprite)", + "memberId": "Sprite/goToSprite", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isKeyPressed", + "methodName": "goToSprite", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "keyCode" + "sprite" ], "params": [ - "KeyCode keyCode" + "Sprite sprite" ], - "summary": "Returns true if the key is pressed", - "description": "Returns true if the key is pressed", - "scratchblock": "<key [space v] pressed?>", + "summary": "", + "description": "", + "scratchblock": "go to [sprite v]", "paramDocs": [ - "keyCode: a key" + "sprite: the sprite whose position to go to" ], - "returns": "key pressed", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/goToSprite", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" + "description": "Setzt die Figur auf die Position einer anderen Figur" } } }, { - "id": "Sprite/isMouseDown()", - "memberId": "Sprite/isMouseDown", + "id": "Sprite/hide()", + "memberId": "Sprite/hide", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isMouseDown", + "methodName": "hide", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true is the mouse button is down", - "description": "Returns true is the mouse button is down", - "scratchblock": "<mouse down?>", + "summary": "Hides the sprite: it is not drawn, cannot be touched and cannot be clicked.", + "description": "Hides the sprite: it is not drawn, cannot be touched and cannot be clicked.", + "scratchblock": "hide", "paramDocs": [], - "returns": "mouse button down", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isMouseDown", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hide", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" + "description": "Macht die Figur unsichtbar" } } }, { - "id": "Sprite/isSoundPlaying(String)", - "memberId": "Sprite/isSoundPlaying", + "id": "Sprite/hideVariable(String)", + "memberId": "Sprite/hideVariable", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isSoundPlaying", + "methodName": "hideVariable", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ "java.lang.String" ], @@ -6430,1371 +7106,1177 @@ "params": [ "String name" ], - "summary": "Returns true if the sound if playing", - "description": "Returns true if the sound if playing", - "scratchblock": null, - "paramDocs": [ - "name: Name of the sound" - ], - "returns": "playing", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isSoundPlaying", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" - } - } - }, - { - "id": "Sprite/isTouchingColor(Color)", - "memberId": "Sprite/isTouchingColor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "isTouchingColor", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "color" - ], - "params": [ - "Color color" - ], - "summary": "Checks whether the sprite is touching a colour: whether anything it paints\nlies over that colour on the stage - on the backdrop, on what the pen drew,\nor on another sprite.", - "description": "Checks whether the sprite is touching a colour: whether anything it paints\nlies over that colour on the stage - on the backdrop, on what the pen drew,\nor on another sprite.\n\nAs in Scratch, colours that are nearly the same count, so anti-aliased\nedges still match. Only what is under the painted part of the costume\ncounts, not the empty space around it, and not the hitbox.\n\n```java\nif (this.isTouchingColor(HtmlColor.RED)) {\n this.say(\"Ouch!\");\n}\n```\n\nThe time it takes grows with the size of the sprite, not of the stage.", - "scratchblock": "<touching color [#ff0000]?>", + "summary": "", + "description": "", + "scratchblock": "hide variable [name v]", "paramDocs": [ - "color: the colour to look for" + "name: the label of a variable to hide again" ], - "returns": "true if the sprite is touching the colour", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/hideVariable", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Prüft, ob etwas, das die Figur malt, über dieser Farbe auf der Bühne liegt — auf dem Bühnenbild, auf dem, was der Stift gezeichnet hat, oder auf einer anderen Figur. Fast gleiche Farben zählen wie in Scratch." - } - } - }, - { - "id": "Sprite/isTouchingColor(double,double,double)", - "memberId": "Sprite/isTouchingColor", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "isTouchingColor", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "double", - "double", - "double" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "double r", - "double g", - "double b" - ], - "summary": "Checks whether the sprite is touching a colour given by its red, green and\nblue parts.", - "description": "Checks whether the sprite is touching a colour given by its red, green and\nblue parts.", - "scratchblock": null, - "paramDocs": [ - "r: the red part [0...255]", - "g: the green part [0...255]", - "b: the blue part [0...255]" - ], - "returns": "true if the sprite is touching the colour", + "translations": {} + }, + { + "id": "Sprite/ifOnEdgeBounce()", + "memberId": "Sprite/ifOnEdgeBounce", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "ifOnEdgeBounce", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Turns around when touching an edge of the stage and moves back inside, as in Scratch.", + "description": "Turns around when touching an edge of the stage and moves back inside, as in Scratch.", + "scratchblock": "if on edge, bounce", + "paramDocs": [], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/ifOnEdgeBounce", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Prüft, ob die Figur eine Farbe berührt, angegeben durch Rot, Grün und Blau [0...255]" + "description": "Lässt die Figur am Bühnenrand abprallen" } } }, { - "id": "Sprite/isTouchingEdge()", - "memberId": "Sprite/isTouchingEdge", + "id": "Sprite/isAnimationPlayed()", + "memberId": "Sprite/isAnimationPlayed", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingEdge", + "methodName": "isAnimationPlayed", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true if the rectangle which contains the image is outside of the\nstage", - "description": "Returns true if the rectangle which contains the image is outside of the\nstage", - "scratchblock": "<touching [edge v]?>", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "true if outside", + "returns": "whether an animation played with `once` reached its last frame", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingEdge", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isAnimationPlayed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn die Figur den Bühnenrand berührt" - } - } + "translations": {} }, { - "id": "Sprite/isTouchingMousePointer()", - "memberId": "Sprite/isTouchingMousePointer", + "id": "Sprite/isAsking()", + "memberId": "Sprite/isAsking", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingMousePointer", + "methodName": "isAsking", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true is the mouse pointer is touching the hitbox of the sprite.", - "description": "Returns true is the mouse pointer is touching the hitbox of the sprite.", - "scratchblock": "<touching [mouse-pointer v]?>", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "true if touching", + "returns": "whether a question is waiting for its answer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingMousePointer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isAsking", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn der Mauszeiger auf der Figur liegt" + "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" } } }, { - "id": "Sprite/isTouchingSprite(Sprite)", - "memberId": "Sprite/isTouchingSprite", + "id": "Sprite/isClone()", + "memberId": "Sprite/isClone", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingSprite", + "methodName": "isClone", "static": false, "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "sprite" - ], - "params": [ - "Sprite sprite" - ], - "summary": "Checks if this sprite is touching another sprite.", - "description": "Checks if this sprite is touching another sprite.", - "scratchblock": "<touching [sprite v]?>", - "paramDocs": [ - "sprite: The sprite to check for collision with." - ], - "returns": "true if this sprite is touching the specified sprite, false\n otherwise. Returns false if\n the specified sprite is the same as this sprite, if the stage is\n null, if the specified\n sprite is null, not shown, or has its hitbox disabled.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether this sprite is a clone", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isClone", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn sich die Figuren berühren" + "description": "Erzeugt eine Kopie der Figur" } } }, { - "id": "Sprite/isTouchingSprite(Class)", - "memberId": "Sprite/isTouchingSprite", + "id": "Sprite/isColorTouchingColor(Color,Color)", + "memberId": "Sprite/isColorTouchingColor", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isTouchingSprite", + "methodName": "isColorTouchingColor", "static": false, "returnType": "boolean", "parameterTypes": [ - "java.lang.Class" + "org.openpatch.scratch.Color", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "c" + "mine", + "color" ], "params": [ - "Class c" + "Color mine", + "Color color" ], - "summary": "Checks if this sprite is touching any sprite of the specified class type.", - "description": "Checks if this sprite is touching any sprite of the specified class type.", - "scratchblock": null, + "summary": "Whether a colour of the sprite touches a colour on the stage, like Scratch's \"color is\ntouching color\".", + "description": "Whether a colour of the sprite touches a colour on the stage, like Scratch's \"color is\ntouching color\".", + "scratchblock": "<color [#ff0000] is touching [#00ff00]?>", "paramDocs": [ - "c: the class type of the sprite to check for collision" + "mine: a colour of the sprite", + "color: the colour to look for underneath" ], - "returns": "true if this sprite is touching any sprite of the specified class\n type, false otherwise", + "returns": "whether they touch", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isColorTouchingColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Figur eine Figur dieser Klasse berührt, z.B. isTouchingSprite(Apfel.class)" + "description": "Prüft, ob die Teile der Figur in der Farbe color über der Farbe other liegen" } } }, { - "id": "Sprite/isVisible()", - "memberId": "Sprite/isVisible", + "id": "Sprite/isGliding()", + "memberId": "Sprite/isGliding", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "isVisible", + "methodName": "isGliding", "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns if the sprite is visible", - "description": "Returns if the sprite is visible", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "is visible", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isVisible", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn die Figur sichtbar ist" - } - } - }, - { - "id": "Sprite/move(double)", - "memberId": "Sprite/move", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "move", - "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "steps" - ], - "params": [ - "double steps" - ], - "summary": "Moves the sprite towards the current rotation by the received steps.", - "description": "Moves the sprite towards the current rotation by the received steps.", - "scratchblock": "move (steps) steps", - "paramDocs": [ - "steps: a number of pixels" - ], - "returns": null, + "returns": "whether a glide is still going", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/move", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isGliding", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Bewegt die Figur um die angegebene Schrittzahl in ihre Blickrichtung" + "description": "Gibt genau dann true zurück, wenn die Figur gerade gleitet" } } }, { - "id": "Sprite/move(Vector2)", - "memberId": "Sprite/move", + "id": "Sprite/isKeyPressed(KeyCode)", + "memberId": "Sprite/isKeyPressed", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "move", + "methodName": "isKeyPressed", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.KeyCode" ], "parameterNames": [ - "v" + "key" ], "params": [ - "Vector2 v" + "KeyCode key" ], - "summary": "Moves the sprite in the direction of the given vector. The length of the\nvector determines how\nmove the sprite will move in this direction.", - "description": "Moves the sprite in the direction of the given vector. The length of the\nvector determines how\nmove the sprite will move in this direction.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "<key [space v] pressed?>", "paramDocs": [ - "v: a vector" + "key: a key" ], - "returns": null, + "returns": "whether the key is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/move", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Verschiebt die Figur um den Vektor" + "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" } } }, { - "id": "Sprite/nextCostume()", - "memberId": "Sprite/nextCostume", + "id": "Sprite/isMouseDown()", + "memberId": "Sprite/isMouseDown", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "nextCostume", + "methodName": "isMouseDown", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to the next costume.", - "description": "Switch to the next costume.", - "scratchblock": "next costume", + "summary": "", + "description": "", + "scratchblock": "<mouse down?>", "paramDocs": [], - "returns": null, + "returns": "whether a mouse button is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/nextCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isMouseDown", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum nächsten Kostüm" + "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" } } }, { - "id": "Sprite/pickRandom(int,int)", - "memberId": "Sprite/pickRandom", + "id": "Sprite/isSoundPlaying(String)", + "memberId": "Sprite/isSoundPlaying", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pickRandom", + "methodName": "isSoundPlaying", "static": false, - "returnType": "int", + "returnType": "boolean", "parameterTypes": [ - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "from", - "to" + "name" ], "params": [ - "int from", - "int to" + "String name" ], - "summary": "Returns a random integer between the specified range.", - "description": "Returns a random integer between the specified range.", - "scratchblock": "(pick random (from) to (to))", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "from: the lower bound of the range (inclusive)", - "to: the upper bound of the range (exclusive)" + "name: a sound's name" ], - "returns": "a random integer between the specified range", + "returns": "whether it is playing", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pickRandom", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isSoundPlaying", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" + "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" } } }, { - "id": "Sprite/playSound(String)", - "memberId": "Sprite/playSound", + "id": "Sprite/isTouchingColor(Color)", + "memberId": "Sprite/isTouchingColor", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "playSound", + "methodName": "isTouchingColor", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "name" + "color" ], "params": [ - "String name" + "Color color" ], - "summary": "Plays a sound.", - "description": "Plays a sound.\n\nEvery sprite plays its own copy, so ten sprites playing the same sound are\nheard ten times at once. One sprite only plays a sound once at a time:\nplaying it again while it is still going does nothing.", - "scratchblock": "start sound [name v]\n\nplaySoundCopy() returns an independent SoundPlayback with its own volume\nand can overlap earlier plays of the same sound.", + "summary": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "description": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "scratchblock": "<touching color [#ff0000]?>", "paramDocs": [ - "name: the sound name" + "color: the colour to look for" ], - "returns": null, + "returns": "whether the sprite touches it", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Spielt einen zuvor hinzugefügten Klang ab" + "description": "Prüft, ob etwas, das die Figur malt, über dieser Farbe auf der Bühne liegt — auf dem Bühnenbild, auf dem, was der Stift gezeichnet hat, oder auf einer anderen Figur. Fast gleiche Farben zählen wie in Scratch." } } }, { - "id": "Sprite/playSoundCopy(String,double)", - "memberId": "Sprite/playSoundCopy", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "playSoundCopy", - "static": false, - "returnType": "SoundPlayback", - "parameterTypes": [ - "java.lang.String", - "double" - ], - "parameterNames": [ - "name", - "volume" - ], - "params": [ - "String name", - "double volume" - ], - "summary": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this sprite.\nThe sprite's ordinary volume does not change a copy's explicit volume.", - "description": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this sprite.\nThe sprite's ordinary volume does not change a copy's explicit volume.", - "scratchblock": null, - "paramDocs": [ - "name: a sound already added with addSound()", - "volume: volume from 0 to 100 percent" - ], - "returns": "this individual playback, also usable in try-with-resources", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSoundCopy", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Sprite/pointInDirection(double)", - "memberId": "Sprite/pointInDirection", + "id": "Sprite/isTouchingColor(double,double,double)", + "memberId": "Sprite/isTouchingColor", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointInDirection", + "methodName": "isTouchingColor", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ + "double", + "double", "double" ], "parameterNames": [ - "degrees" + "red", + "green", + "blue" ], "params": [ - "double degrees" + "double red", + "double green", + "double blue" ], - "summary": "Points the sprite in the specified direction.", - "description": "Points the sprite in the specified direction.", - "scratchblock": null, + "summary": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "description": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "scratchblock": "<touching color [#ff0000]?>", "paramDocs": [ - "degrees: The direction in degrees to point the sprite. 0 degrees is up,\n 90 degrees is to the right, 180 degrees is down, and 270\n degrees is to the left." + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], - "returns": null, + "returns": "whether the sprite touches that colour", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointInDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" + "description": "Prüft, ob die Figur eine Farbe berührt, angegeben durch Rot, Grün und Blau [0...255]" } } }, { - "id": "Sprite/pointInDirection(Vector2)", - "memberId": "Sprite/pointInDirection", + "id": "Sprite/isTouchingEdge()", + "memberId": "Sprite/isTouchingEdge", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointInDirection", + "methodName": "isTouchingEdge", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Vector2" - ], - "parameterNames": [ - "v" - ], - "params": [ - "Vector2 v" - ], - "summary": "Points the sprite in the direction of the given vector.", - "description": "Points the sprite in the direction of the given vector.", - "scratchblock": null, - "paramDocs": [ - "v: the target vector to point towards" - ], - "returns": null, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "<touching [edge v]?>", + "paramDocs": [], + "returns": "whether the sprite's hitbox reaches an edge of the stage", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointInDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingEdge", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Richtet die Figur entlang des angegebenen Vektors aus" + "description": "Gibt genau dann true zurück, wenn die Figur den Bühnenrand berührt" } } }, { - "id": "Sprite/pointTowardsMousePointer()", - "memberId": "Sprite/pointTowardsMousePointer", + "id": "Sprite/isTouchingMousePointer()", + "memberId": "Sprite/isTouchingMousePointer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointTowardsMousePointer", + "methodName": "isTouchingMousePointer", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Points the sprite towards the current position of the mouse pointer. This\nmethod calculates the\nangle between the sprite's current position and the mouse pointer's position,\nthen sets the\nsprite's direction accordingly.", - "description": "Points the sprite towards the current position of the mouse pointer. This\nmethod calculates the\nangle between the sprite's current position and the mouse pointer's position,\nthen sets the\nsprite's direction accordingly.", - "scratchblock": "point towards [mouse-pointer v]", + "summary": "", + "description": "", + "scratchblock": "<touching [mouse-pointer v]?>", "paramDocs": [], - "returns": null, + "returns": "whether the mouse pointer is over the sprite's hitbox", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowardsMousePointer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingMousePointer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Richtet die Figur zum Mauszeiger aus" + "description": "Gibt genau dann true zurück, wenn der Mauszeiger auf der Figur liegt" } } }, { - "id": "Sprite/pointTowardsSprite(Sprite)", - "memberId": "Sprite/pointTowardsSprite", + "id": "Sprite/isTouchingSprite(Sprite)", + "memberId": "Sprite/isTouchingSprite", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "pointTowardsSprite", + "methodName": "isTouchingSprite", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "s" + "sprite" ], "params": [ - "Sprite s" + "Sprite sprite" ], - "summary": "Points the current sprite towards the specified sprite.", - "description": "Points the current sprite towards the specified sprite.", - "scratchblock": "point towards [sprite v]", + "summary": "", + "description": "", + "scratchblock": "<touching [sprite v]?>", "paramDocs": [ - "s: the sprite to point towards" + "sprite: another sprite" ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowardsSprite", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Richtet die Figur zu einer anderen Figur aus" - } - } - }, - { - "id": "Sprite/previousCostume()", - "memberId": "Sprite/previousCostume", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "previousCostume", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Switch to the previous costume.", - "description": "Switch to the previous costume.", - "scratchblock": "switch costume to (previous costume)", - "paramDocs": [], - "returns": null, + "returns": "whether the two hitboxes overlap (touching edges do not count); a hidden sprite\n touches nothing, and the UI layer never touches the world", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/previousCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum vorherigen Kostüm" + "description": "Gibt genau dann true zurück, wenn sich die Figuren berühren" } } }, { - "id": "Sprite/remove()", - "memberId": "Sprite/remove", + "id": "Sprite/isTouchingSprite(Class)", + "memberId": "Sprite/isTouchingSprite", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "remove", + "methodName": "isTouchingSprite", "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Removes this sprite from its current stage. For \"delete this clone\", see\n[deleteThisClone()](deleteThisClone).", - "description": "Removes this sprite from its current stage. For \"delete this clone\", see\n[deleteThisClone()](deleteThisClone).", - "scratchblock": null, - "paramDocs": [], - "returns": null, + "returnType": "boolean", + "parameterTypes": [ + "java.lang.Class" + ], + "parameterNames": [ + "type" + ], + "params": [ + "Class type" + ], + "summary": "", + "description": "", + "scratchblock": "<touching [sprite v]?>", + "paramDocs": [ + "type: a class of sprites" + ], + "returns": "whether the sprite touches any sprite of that class (or a subclass)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isTouchingSprite", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt die Figur von der Bühne" + "description": "Gibt genau dann true zurück, wenn die Figur eine Figur dieser Klasse berührt, z.B. isTouchingSprite(Apfel.class)" } } }, { - "id": "Sprite/run()", - "memberId": "Sprite/run", + "id": "Sprite/isVisible()", + "memberId": "Sprite/isVisible", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "run", + "methodName": "isVisible", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "This method is intended to be overridden by subclasses to define the behavior\nof the sprite\nwhen it is run. By default, this method does nothing.", - "description": "This method is intended to be overridden by subclasses to define the behavior\nof the sprite\nwhen it is run. By default, this method does nothing.\n\nIt is called every frame.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether the sprite is shown", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/run", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/isVisible", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird in jedem Frame aufgerufen" + "description": "Gibt genau dann true zurück, wenn die Figur sichtbar ist" } } }, { - "id": "Sprite/say(String)", - "memberId": "Sprite/say", + "id": "Sprite/move(double)", + "memberId": "Sprite/move", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "say", + "methodName": "move", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "text" + "steps" ], "params": [ - "String text" + "double steps" ], - "summary": "Makes the sprite display a speech bubble with the specified text.", - "description": "Makes the sprite display a speech bubble with the specified text.", - "scratchblock": "say [text]", + "summary": "Moves forward in the sprite's direction.", + "description": "Moves forward in the sprite's direction.", + "scratchblock": "move (steps) steps", "paramDocs": [ - "text: The text to be displayed in the speech bubble." + "steps: how far, in stage pixels (negative moves backwards)" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/move", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Sprechblase an" + "description": "Bewegt die Figur um die angegebene Schrittzahl in ihre Blickrichtung" } } }, { - "id": "Sprite/say(String,int)", - "memberId": "Sprite/say", + "id": "Sprite/nextCostume()", + "memberId": "Sprite/nextCostume", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "say", + "methodName": "nextCostume", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "int" - ], - "parameterNames": [ - "text", - "millis" - ], - "params": [ - "String text", - "int millis" - ], - "summary": "Displays a text message for a specified duration.", - "description": "Displays a text message for a specified duration.", - "scratchblock": "say [text] for (millis) seconds", - "paramDocs": [ - "text: The message to be displayed.", - "millis: The duration in milliseconds for which the message will be\n displayed." - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the next costume, after the last one to the first.", + "description": "Switches to the next costume, after the last one to the first.", + "scratchblock": "next costume", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/nextCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Sprechblase für die angegebene Zeit in Millisekunden" + "description": "Wechselt zum nächsten Kostüm" } } }, { - "id": "Sprite/setDirection(double)", - "memberId": "Sprite/setDirection", + "id": "Sprite/pickRandom(int,int)", + "memberId": "Sprite/pickRandom", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setDirection", + "methodName": "pickRandom", "static": false, - "returnType": "void", + "returnType": "int", "parameterTypes": [ - "double" + "int", + "int" ], "parameterNames": [ - "degrees" + "from", + "to" ], "params": [ - "double degrees" + "int from", + "int to" ], - "summary": "Sets the direction of the sprite to a given degrees. When this value is 0 the\nsprite moves\nup, when it is 180 it moves down.", - "description": "Sets the direction of the sprite to a given degrees. When this value is 0 the\nsprite moves\nup, when it is 180 it moves down.", - "scratchblock": "point in direction (degrees)", + "summary": "A random whole number between two numbers, both included.", + "description": "A random whole number between two numbers, both included.", + "scratchblock": "(pick random (from) to (to))", "paramDocs": [ - "degrees: between 0 and 360" + "from: the lowest", + "to: the highest" ], - "returns": null, + "returns": "the number", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pickRandom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" + "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" } } }, { - "id": "Sprite/setDirection(Vector2)", - "memberId": "Sprite/setDirection", + "id": "Sprite/playAnimation(String)", + "memberId": "Sprite/playAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setDirection", + "methodName": "playAnimation", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" ], "parameterNames": [ - "v" + "name" ], "params": [ - "Vector2 v" + "String name" ], - "summary": "Sets the direction of the sprite to the direction of a given vector.", - "description": "Sets the direction of the sprite to the direction of a given vector.", + "summary": "Plays an animation, over and over. Call it every tick (in `run()`): it shows the next\nframe each time the animation interval has passed, and starts from the first frame when\nanother animation was playing before.", + "description": "Plays an animation, over and over. Call it every tick (in `run()`): it shows the next\nframe each time the animation interval has passed, and starts from the first frame when\nanother animation was playing before.", "scratchblock": null, "paramDocs": [ - "v: a vector" + "name: the animation's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setDirection", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playAnimation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Blickrichtung auf die Richtung des Vektors" - } - } + "translations": {} }, { - "id": "Sprite/setHitbox(double[])", - "memberId": "Sprite/setHitbox", + "id": "Sprite/playAnimation(String,boolean)", + "memberId": "Sprite/playAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setHitbox", + "methodName": "playAnimation", "static": false, "returnType": "void", "parameterTypes": [ - "double[]" + "java.lang.String", + "boolean" ], "parameterNames": [ - "points" + "name", + "once" ], "params": [ - "double[] points" + "String name", + "boolean once" ], - "summary": "Sets the hitbox for the sprite using the provided points. The points should\nbe provided in\npairs representing the x and y coordinates.", - "description": "Sets the hitbox for the sprite using the provided points. The points should\nbe provided in\npairs representing the x and y coordinates.", + "summary": "Plays an animation; call it every tick.", + "description": "Plays an animation; call it every tick.", "scratchblock": null, "paramDocs": [ - "points: an array of integers representing the x and y coordinates of\n the hitbox vertices.\n The length of the array should be even, with each pair of\n integers representing a point (x,\n y)." + "name: the animation's name", + "once: whether to stop at the last frame instead of starting over" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHitbox", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playAnimation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Sprite/setHitbox(Shape)", - "memberId": "Sprite/setHitbox", + "id": "Sprite/playSound(String)", + "memberId": "Sprite/playSound", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setHitbox", + "methodName": "playSound", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Shape" + "java.lang.String" ], "parameterNames": [ - "shape" + "name" ], "params": [ - "Shape shape" + "String name" ], - "summary": "Sets the hitbox for the sprite using the specified shape.", - "description": "Sets the hitbox for the sprite using the specified shape.", - "scratchblock": null, + "summary": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "description": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "scratchblock": "start sound [name v]", "paramDocs": [ - "shape: the shape to be used for the hitbox" + "name: the sound's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHitbox", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Trefferfläche auf die angegebene Form; (0/0) ist die Mitte der Figur" + "description": "Spielt einen zuvor hinzugefügten Klang ab" } } }, { - "id": "Sprite/setPosition(double,double)", - "memberId": "Sprite/setPosition", + "id": "Sprite/playSoundCopy(String,double)", + "memberId": "Sprite/playSoundCopy", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setPosition", + "methodName": "playSoundCopy", "static": false, - "returnType": "void", + "returnType": "SoundPlayback", "parameterTypes": [ - "double", + "java.lang.String", "double" ], "parameterNames": [ - "x", - "y" + "name", + "volume" ], "params": [ - "double x", - "double y" + "String name", + "double volume" ], - "summary": "Sets the position of the sprite", - "description": "Sets the position of the sprite", - "scratchblock": "go to x: (x) y: (y)", + "summary": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "description": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "scratchblock": null, "paramDocs": [ - "x: a x coordinate", - "y: a y coordinate" + "name: the sound's name", + "volume: the copy's volume from 0 to 100" ], - "returns": null, + "returns": "the copy, to stop it or change its volume", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/playSoundCopy", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" - } - } + "translations": {} }, { - "id": "Sprite/setPosition(Vector2)", - "memberId": "Sprite/setPosition", + "id": "Sprite/pointTowards(Vector2)", + "memberId": "Sprite/pointTowards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setPosition", + "methodName": "pointTowards", "static": false, "returnType": "void", "parameterTypes": [ "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "v" + "position" ], "params": [ - "Vector2 v" + "Vector2 position" ], - "summary": "Sets the position of the sprite based on the coordinates of a given vector.", - "description": "Sets the position of the sprite based on the coordinates of a given vector.", + "summary": "Points towards a position.", + "description": "Points towards a position.", "scratchblock": null, "paramDocs": [ - "v: a vector" + "position: where to point" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" - } - } + "translations": {} }, { - "id": "Sprite/setRotationCenter(double,double)", - "memberId": "Sprite/setRotationCenter", + "id": "Sprite/pointTowards(Sprite)", + "memberId": "Sprite/pointTowards", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setRotationCenter", + "methodName": "pointTowards", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "x", - "y" + "sprite" ], "params": [ - "double x", - "double y" + "Sprite sprite" ], - "summary": "Sets the point of the costume the sprite turns around - Scratch's rotation\ncenter. It is also the point that sits at the sprite's position, so it is\nwhere the pen draws from and what `goTo` puts in place.", - "description": "Sets the point of the costume the sprite turns around - Scratch's rotation\ncenter. It is also the point that sits at the sprite's position, so it is\nwhere the pen draws from and what `goTo` puts in place.\n\nThe point is given in the costume's own pixels, counted from its top left\ncorner, the same way as [setHitbox(double...)](setHitbox): a sword whose hilt\nis 12 pixels from the left and 60 from the top swings around the hilt with\n`setRotationCenter(12, 60)`. It grows and shrinks with the sprite's\nsize and holds for every costume of the sprite. Without it, a sprite turns\naround the middle of its costume.\n\n```java\nthis.addCostume(\"hand\", \"assets/clock-hand.png\");\nthis.setRotationCenter(8, 100); // the end of the hand\n```", + "summary": "Points towards a position.", + "description": "Points towards a position.", "scratchblock": null, "paramDocs": [ - "x: the x-coordinate in the costume, from its left edge", - "y: the y-coordinate in the costume, from its top edge" + "sprite: the sprite to point at" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationCenter", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt den Punkt des Kostüms, um den sich die Figur dreht (Drehpunkt). Er sitzt an der Position der Figur. Angegeben in Pixeln des Kostüms von seiner linken oberen Ecke aus, wie bei setHitbox; er wächst mit der Größe und gilt für alle Kostüme." - } - } + "translations": {} }, { - "id": "Sprite/setRotationStyle(RotationStyle)", - "memberId": "Sprite/setRotationStyle", + "id": "Sprite/pointTowardsMousePointer()", + "memberId": "Sprite/pointTowardsMousePointer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setRotationStyle", + "methodName": "pointTowardsMousePointer", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.RotationStyle" - ], - "parameterNames": [ - "style" - ], - "params": [ - "RotationStyle style" - ], - "summary": "Sets the rotation style for the sprite.", - "description": "Sets the rotation style for the sprite.", - "scratchblock": "set rotation style [left-right v]", - "paramDocs": [ - "style: the rotation style to be set" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Points towards the mouse pointer.", + "description": "Points towards the mouse pointer.", + "scratchblock": "point towards [mouse-pointer v]", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationStyle", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/pointTowardsMousePointer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, wie sich die Figur beim Drehen verhält" + "description": "Richtet die Figur zum Mauszeiger aus" } } }, { - "id": "Sprite/setSize(double)", - "memberId": "Sprite/setSize", + "id": "Sprite/previousCostume()", + "memberId": "Sprite/previousCostume", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setSize", + "methodName": "previousCostume", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "percentage" - ], - "params": [ - "double percentage" - ], - "summary": "Sets the size of the sprite.", - "description": "Sets the size of the sprite.", - "scratchblock": "set size to (percentage) %", - "paramDocs": [ - "percentage: a percentage [0...100]" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the previous costume, before the first one to the last.", + "description": "Switches to the previous costume, before the first one to the last.", + "scratchblock": "switch costume to (previous costume)", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/previousCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Größe in Prozent (100 = Originalgröße)" + "description": "Wechselt zum vorherigen Kostüm" } } }, { - "id": "Sprite/setTint(Color)", - "memberId": "Sprite/setTint", + "id": "Sprite/remove()", + "memberId": "Sprite/remove", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTint", + "methodName": "remove", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the tint for the sprite with an color object.", - "description": "Sets the tint for the sprite with an color object.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Removes the sprite from its stage.", + "description": "Removes the sprite from its stage.", "scratchblock": null, - "paramDocs": [ - "c: a color object" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt die Figur mit der angegebenen Farbe ein" + "description": "Entfernt die Figur von der Bühne" } } }, { - "id": "Sprite/setTint(double,double,double)", - "memberId": "Sprite/setTint", + "id": "Sprite/resetAnimation()", + "memberId": "Sprite/resetAnimation", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTint", + "methodName": "resetAnimation", "static": false, "returnType": "void", - "parameterTypes": [ - "double", - "double", - "double" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "double r", - "double g", - "double b" - ], - "summary": "Sets the tint for the sprite with rgb.", - "description": "Sets the tint for the sprite with rgb.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Starts the current animation from its first frame again.", + "description": "Starts the current animation from its first frame again.", "scratchblock": null, - "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/resetAnimation", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/run()", + "memberId": "Sprite/run", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "run", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Runs every tick, 60 times a second of game time. Override it with the sprite's code.", + "description": "Runs every tick, 60 times a second of game time. Override it with the sprite's code.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/run", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt die Figur mit der angegebenen Farbe ein (Anteile jeweils 0 bis 255)" + "description": "Wird in jedem Frame aufgerufen" } } }, { - "id": "Sprite/setTint(double)", - "memberId": "Sprite/setTint", + "id": "Sprite/say(String)", + "memberId": "Sprite/say", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTint", + "methodName": "say", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "h" + "text" ], "params": [ - "double h" + "String text" ], - "summary": "Sets the tint for the sprite with a hue.", - "description": "Sets the tint for the sprite with a hue.", - "scratchblock": "set [color v] effect to (h)", + "summary": "Shows a speech bubble until the sprite says something else; an empty text removes it.", + "description": "Shows a speech bubble until the sprite says something else; an empty text removes it.", + "scratchblock": "say [text]", "paramDocs": [ - "h: a hue value [0...255]" + "text: what the sprite says" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt die Figur mit dem angegebenen Farbton ein (0 bis 255)" + "description": "Zeigt eine Sprechblase an" } } }, { - "id": "Sprite/setTransparency(double)", - "memberId": "Sprite/setTransparency", + "id": "Sprite/say(String,double)", + "memberId": "Sprite/say", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setTransparency", + "methodName": "say", "static": false, "returnType": "void", "parameterTypes": [ + "java.lang.String", "double" ], "parameterNames": [ - "transparency" + "text", + "seconds" ], "params": [ - "double transparency" + "String text", + "double seconds" ], - "summary": "Sets how see-through the sprite is, as Scratch's ghost effect does: 0 is the\nsolid sprite you start with and 100 is invisible. Anything outside that is\npinned to it.", - "description": "Sets how see-through the sprite is, as Scratch's ghost effect does: 0 is the\nsolid sprite you start with and 100 is invisible. Anything outside that is\npinned to it.", - "scratchblock": "set [ghost v] effect to (transparency)", + "summary": "Shows a speech bubble for a number of seconds of game time.", + "description": "Shows a speech bubble for a number of seconds of game time.", + "scratchblock": "say [text] for (seconds) seconds", "paramDocs": [ - "transparency: [0...100], 0 solid and 100 invisible" + "text: what the sprite says", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/say", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Transparenz in Prozent (0 = deckend, 100 = unsichtbar)" - } - } + "translations": {} }, { - "id": "Sprite/setVolume(double)", - "memberId": "Sprite/setVolume", + "id": "Sprite/setAnimationFrame(int)", + "memberId": "Sprite/setAnimationFrame", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setVolume", + "methodName": "setAnimationFrame", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "int" ], "parameterNames": [ - "percent" + "frame" ], "params": [ - "double percent" + "int frame" ], - "summary": "Sets how loud every sound of this sprite plays.", - "description": "Sets how loud every sound of this sprite plays.", - "scratchblock": "set volume to (percent) %", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "percent: 0 for silent, 100 for full volume" + "frame: the frame of the current animation to show next, counting from 0" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setAnimationFrame", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Lautstärke aller Klänge dieser Figur in Prozent" - } - } + "translations": {} }, { - "id": "Sprite/setX(double)", - "memberId": "Sprite/setX", + "id": "Sprite/setAnimationInterval(double)", + "memberId": "Sprite/setAnimationInterval", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setX", + "methodName": "setAnimationInterval", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "x" + "seconds" ], "params": [ - "double x" + "double seconds" ], - "summary": "Sets the x coordinate", - "description": "Sets the x coordinate", - "scratchblock": "set x to (x)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "x: a x coordinate" + "seconds: how long each frame shows" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setAnimationInterval", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die x-Position" - } - } + "translations": {} }, { - "id": "Sprite/setY(double)", - "memberId": "Sprite/setY", + "id": "Sprite/setColorEffect(double)", + "memberId": "Sprite/setColorEffect", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "setY", + "methodName": "setColorEffect", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "y" + "value" ], "params": [ - "double y" + "double value" ], - "summary": "Sets the y coordinate", - "description": "Sets the y coordinate", - "scratchblock": "set y to (y)", + "summary": "Scratch's colour effect: shifts every colour of the costume around the colour wheel. 0 is no\nchange; 100 is halfway round; 200 is all the way round again. Like Scratch, it gives colours\ntoo grey or too dark to show a hue a little one, so white and black are tinted too.", + "description": "Scratch's colour effect: shifts every colour of the costume around the colour wheel. 0 is no\nchange; 100 is halfway round; 200 is all the way round again. Like Scratch, it gives colours\ntoo grey or too dark to show a hue a little one, so white and black are tinted too.", + "scratchblock": "set [color v] effect to (value)", "paramDocs": [ - "y: a y coordinate" + "value: the effect" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die y-Position" - } - } + "translations": {} }, { - "id": "Sprite/show()", - "memberId": "Sprite/show", + "id": "Sprite/setDirection(double)", + "memberId": "Sprite/setDirection", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "show", + "methodName": "setDirection", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Shows the sprite.", - "description": "Shows the sprite.", - "scratchblock": "show", - "paramDocs": [], + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "degrees" + ], + "params": [ + "double degrees" + ], + "summary": "Points in a direction: 0 up, 90 right, 180 down, 270 left; other numbers go around.", + "description": "Points in a direction: 0 up, 90 right, 180 down, 270 left; other numbers go around.", + "scratchblock": "point in direction (degrees)", + "paramDocs": [ + "degrees: the direction" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/show", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setDirection", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Macht die Figur sichtbar" + "description": "Setzt die Blickrichtung in Grad (90 = rechts, 0 = oben)" } } }, { - "id": "Sprite/showVariable(String,Supplier)", - "memberId": "Sprite/showVariable", + "id": "Sprite/setHeight(double)", + "memberId": "Sprite/setHeight", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "showVariable", + "methodName": "setHeight", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.util.function.Supplier" + "double" ], "parameterNames": [ - "name", - "value" + "height" ], "params": [ - "String name", - "Supplier value" + "double height" ], - "summary": "Shows a monitor for one of this sprite's variables in the top left corner\nof the stage, like Scratch's variable monitors: \"Cat: score\" and the\ncurrent value, updated every frame. Showing the same name again replaces\nthe monitor; it goes away with the sprite.", - "description": "Shows a monitor for one of this sprite's variables in the top left corner\nof the stage, like Scratch's variable monitors: \"Cat: score\" and the\ncurrent value, updated every frame. Showing the same name again replaces\nthe monitor; it goes away with the sprite.\n\n```java\npublic Cat() {\n this.addCostume(\"cat\", \"bunny1_stand\");\n this.showVariable(\"lives\", () -> lives);\n}\n```", - "scratchblock": "show variable [name v]", + "summary": "Draws the sprite this high; see [setWidth(double)](setWidth).", + "description": "Draws the sprite this high; see [setWidth(double)](setWidth).", + "scratchblock": null, "paramDocs": [ - "name: the variable's name, shown after the sprite's", - "value: gives the value to show; asked for it every frame" + "height: the height in stage pixels; 0 to follow the costume and size again" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/showVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Sprite/stamp()", - "memberId": "Sprite/stamp", + "id": "Sprite/setHitbox(Shape)", + "memberId": "Sprite/setHitbox", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "stamp", + "methodName": "setHitbox", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stamps the current sprite to the background. A stamp is a non interactive\nversion of the sprite.", - "description": "Stamps the current sprite to the background. A stamp is a non interactive\nversion of the sprite.", - "scratchblock": "stamp", - "paramDocs": [], + "parameterTypes": [ + "org.openpatch.scratch.Shape" + ], + "parameterNames": [ + "shape" + ], + "params": [ + "Shape shape" + ], + "summary": "Sets the hitbox: the shape that counts for touching, in costume pixels (origin at the\ncostume's top left corner, y down). It turns, grows and mirrors with the sprite.", + "description": "Sets the hitbox: the shape that counts for touching, in costume pixels (origin at the\ncostume's top left corner, y down). It turns, grows and mirrors with the sprite.", + "scratchblock": null, + "paramDocs": [ + "shape: the hitbox" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setHitbox", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Druckt ein unbewegliches Abbild der Figur auf die Bühne" + "description": "Setzt die Trefferfläche auf die angegebene Form; (0/0) ist die Mitte der Figur" } } }, { - "id": "Sprite/stamp(Layer)", - "memberId": "Sprite/stamp", + "id": "Sprite/setLayer(Layer)", + "memberId": "Sprite/setLayer", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "stamp", + "methodName": "setLayer", "static": false, "returnType": "void", "parameterTypes": [ @@ -7806,859 +8288,919 @@ "params": [ "Layer layer" ], - "summary": "Stamps the sprite onto one of the stage's layers. A stamp is a picture of\nthe sprite that stays where it is put, and is not interactive.", - "description": "Stamps the sprite onto one of the stage's layers. A stamp is a picture of\nthe sprite that stays where it is put, and is not interactive.\n\nExample usage:\n\n```java\nthis.stamp(Layer.UI);\n```", + "summary": "Moves the sprite to another layer, in front of the sprites already there. A sprite in\n[Layer.UI](../Layer/UI) ignores the camera; its pen moves to the UI layer too.", + "description": "Moves the sprite to another layer, in front of the sprites already there. A sprite in\n[Layer.UI](../Layer/UI) ignores the camera; its pen moves to the UI layer too.", "scratchblock": null, "paramDocs": [ - "layer: which layer to stamp onto" + "layer: the layer" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Druckt ein unbewegliches Abbild der Figur auf die angegebene Ebene" - } - } - }, - { - "id": "Sprite/stopAllSounds()", - "memberId": "Sprite/stopAllSounds", - "owner": "org.openpatch.scratch.Sprite", - "className": "Sprite", - "methodName": "stopAllSounds", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the playing of all sounds of the sprite.", - "description": "Stops the playing of all sounds of the sprite.", - "scratchblock": "stop all sounds", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopAllSounds", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Stoppt alle Klänge dieser Figur" - } - } + "translations": {} }, { - "id": "Sprite/stopSound(String)", - "memberId": "Sprite/stopSound", + "id": "Sprite/setNineSlice(int,int,int,int)", + "memberId": "Sprite/setNineSlice", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "stopSound", + "methodName": "setNineSlice", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int", + "int", + "int", + "int" ], "parameterNames": [ - "name" + "top", + "right", + "bottom", + "left" ], "params": [ - "String name" + "int top", + "int right", + "int bottom", + "int left" ], - "summary": "Stops the playing of the sound with the given name", - "description": "Stops the playing of the sound with the given name", + "summary": "Stretches only the middle of the costume when the sprite is drawn at its own width and\nheight: the four corners keep their size (scaled with the sprite's size), the edges stretch\nalong one side.", + "description": "Stretches only the middle of the costume when the sprite is drawn at its own width and\nheight: the four corners keep their size (scaled with the sprite's size), the edges stretch\nalong one side.", "scratchblock": null, "paramDocs": [ - "name: Name of the sound" + "top: costume pixels at the top that keep their height", + "right: costume pixels at the right that keep their width", + "bottom: costume pixels at the bottom that keep their height", + "left: costume pixels at the left that keep their width" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setNineSlice", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Stoppt den Klang mit dem angegebenen Namen" - } - } + "translations": {} }, { - "id": "Sprite/switchCostume(String)", - "memberId": "Sprite/switchCostume", + "id": "Sprite/setPosition(double,double)", + "memberId": "Sprite/setPosition", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "switchCostume", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double" ], "parameterNames": [ - "name" + "x", + "y" ], "params": [ - "String name" + "double x", + "double y" ], - "summary": "Switch to a costume by name.", - "description": "Switch to a costume by name.", - "scratchblock": "switch costume to [name v]", + "summary": "Goes to a position; with the pen down, it draws a line there.", + "description": "Goes to a position; with the pen down, it draws a line there.", + "scratchblock": "go to x: (x) y: (y)", "paramDocs": [ - "name: the name of a costume" + "x: x of the new position", + "y: y of the new position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum Kostüm mit dem Namen" + "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Sprite/switchCostume(double)", - "memberId": "Sprite/switchCostume", + "id": "Sprite/setPosition(Vector2)", + "memberId": "Sprite/setPosition", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "switchCostume", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "index" + "position" ], "params": [ - "double index" + "Vector2 position" ], - "summary": "Switches the current costume of the sprite to the costume at the specified\nindex.", - "description": "Switches the current costume of the sprite to the costume at the specified\nindex.", - "scratchblock": "switch costume to (index)", + "summary": "Goes to a position; with the pen down, it draws a line there.", + "description": "Goes to a position; with the pen down, it draws a line there.", + "scratchblock": "go to x: (x) y: (y)", "paramDocs": [ - "index: The index of the costume to switch to." + "position: the new position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum Kostüm mit der angegebenen Nummer" + "description": "Setzt die Figur an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Sprite/think(String)", - "memberId": "Sprite/think", + "id": "Sprite/setRotationCenter(double,double)", + "memberId": "Sprite/setRotationCenter", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "think", + "methodName": "setRotationCenter", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double" ], "parameterNames": [ - "text" + "x", + "y" ], "params": [ - "String text" + "double x", + "double y" ], - "summary": "Displays a thought bubble with the specified text.", - "description": "Displays a thought bubble with the specified text.", - "scratchblock": "think [text]", + "summary": "Sets the point of the costumes the sprite turns around and stands on, in costume pixels from\nthe top left corner. Without it, that is the centre of each costume.", + "description": "Sets the point of the costumes the sprite turns around and stands on, in costume pixels from\nthe top left corner. Without it, that is the centre of each costume.", + "scratchblock": null, "paramDocs": [ - "text: The text to be displayed in the thought bubble." + "x: pixels from the left edge", + "y: pixels from the top edge" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationCenter", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Denkblase an" + "description": "Setzt den Punkt des Kostüms, um den sich die Figur dreht (Drehpunkt). Er sitzt an der Position der Figur. Angegeben in Pixeln des Kostüms von seiner linken oberen Ecke aus, wie bei setHitbox; er wächst mit der Größe und gilt für alle Kostüme." } } }, { - "id": "Sprite/think(String,int)", - "memberId": "Sprite/think", + "id": "Sprite/setRotationStyle(RotationStyle)", + "memberId": "Sprite/setRotationStyle", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "think", + "methodName": "setRotationStyle", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.RotationStyle" ], "parameterNames": [ - "text", - "millis" + "style" ], "params": [ - "String text", - "int millis" + "RotationStyle style" ], - "summary": "Displays a thought bubble with the specified text for a given duration.", - "description": "Displays a thought bubble with the specified text for a given duration.", - "scratchblock": "think [text] for (millis) seconds", + "summary": "", + "description": "", + "scratchblock": "set rotation style [left-right v]", "paramDocs": [ - "text: The text to be displayed in the thought bubble.", - "millis: The duration in milliseconds for which the thought bubble will\n be displayed." + "style: how the costume follows the direction" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setRotationStyle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt eine Denkblase für die angegebene Zeit in Millisekunden" + "description": "Legt fest, wie sich die Figur beim Drehen verhält" } } }, { - "id": "Sprite/turnLeft(double)", - "memberId": "Sprite/turnLeft", + "id": "Sprite/setSize(double)", + "memberId": "Sprite/setSize", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "turnLeft", + "methodName": "setSize", "static": false, "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "degrees" + "percent" ], "params": [ - "double degrees" + "double percent" ], - "summary": "Rotates the sprite by a certain degrees to the left.", - "description": "Rotates the sprite by a certain degrees to the left.", - "scratchblock": "turn left (degrees) degrees", + "summary": "", + "description": "", + "scratchblock": "set size to (percentage) %", "paramDocs": [ - "degrees: between 0 and 360" + "percent: the size in percent of the costume's own size" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnLeft", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Dreht die Figur um die angegebene Gradzahl nach links" + "description": "Setzt die Größe in Prozent (100 = Originalgröße)" } } }, { - "id": "Sprite/turnRight(double)", - "memberId": "Sprite/turnRight", + "id": "Sprite/setTint(Color)", + "memberId": "Sprite/setTint", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "turnRight", + "methodName": "setTint", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "degrees" + "color" ], "params": [ - "double degrees" + "Color color" ], - "summary": "Rotates the sprite by a certain degrees to the right.", - "description": "Rotates the sprite by a certain degrees to the right.", - "scratchblock": "turn right (degrees) degrees", + "summary": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", + "description": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", + "scratchblock": null, "paramDocs": [ - "degrees: between 0 and 360" + "color: the tint, or null for none" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnRight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Dreht die Figur um die angegebene Gradzahl nach rechts" + "description": "Färbt die Figur mit der angegebenen Farbe ein" } } }, { - "id": "Sprite/whenAddedToStage()", - "memberId": "Sprite/whenAddedToStage", + "id": "Sprite/setTint(double,double,double)", + "memberId": "Sprite/setTint", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenAddedToStage", + "methodName": "setTint", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the sprite is added to the stage. Override this\nmethod to define\ncustom behavior when the sprite is added to the stage.", - "description": "This method is called when the sprite is added to the stage. Override this\nmethod to define\ncustom behavior when the sprite is added to the stage.", + "parameterTypes": [ + "double", + "double", + "double" + ], + "parameterNames": [ + "red", + "green", + "blue" + ], + "params": [ + "double red", + "double green", + "double blue" + ], + "summary": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", + "description": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenAddedToStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTint", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn die Figur der Bühne hinzugefügt wird" + "description": "Färbt die Figur mit der angegebenen Farbe ein (Anteile jeweils 0 bis 255)" } } }, { - "id": "Sprite/whenBackdropSwitches(String)", - "memberId": "Sprite/whenBackdropSwitches", + "id": "Sprite/setTransparency(double)", + "memberId": "Sprite/setTransparency", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenBackdropSwitches", + "methodName": "setTransparency", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "name" + "percent" ], "params": [ - "String name" + "double percent" ], - "summary": "This method is called when the backdrop switches to the specified name.\nOverride this method to\ndefine custom behavior.", - "description": "This method is called when the backdrop switches to the specified name.\nOverride this method to\ndefine custom behavior.", - "scratchblock": "when backdrop switches to [name v]", + "summary": "Scratch's ghost effect.", + "description": "Scratch's ghost effect.", + "scratchblock": "set [ghost v] effect to (transparency)", "paramDocs": [ - "name: the name of the backdrop to switch to" + "percent: 0 opaque, 100 invisible" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenBackdropSwitches", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn der Hintergrund gewechselt wird" + "description": "Setzt die Transparenz in Prozent (0 = deckend, 100 = unsichtbar)" } } }, { - "id": "Sprite/whenClicked()", - "memberId": "Sprite/whenClicked", + "id": "Sprite/setVolume(double)", + "memberId": "Sprite/setVolume", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenClicked", + "methodName": "setVolume", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the sprite is clicked. Override this method to\ndefine custom\nbehavior for the sprite when it is clicked.", - "description": "This method is called when the sprite is clicked. Override this method to\ndefine custom\nbehavior for the sprite when it is clicked.", - "scratchblock": "when this sprite clicked", - "paramDocs": [], + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "volume" + ], + "params": [ + "double volume" + ], + "summary": "", + "description": "", + "scratchblock": "set volume to (percent) %", + "paramDocs": [ + "volume: this object's volume from 0 to 100" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenClicked", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn die Figur angeklickt wird" + "description": "Setzt die Lautstärke aller Klänge dieser Figur in Prozent" } } }, { - "id": "Sprite/whenIReceive(String)", - "memberId": "Sprite/whenIReceive", + "id": "Sprite/setWidth(double)", + "memberId": "Sprite/setWidth", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenIReceive", + "methodName": "setWidth", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "message" + "width" ], "params": [ - "String message" + "double width" ], - "summary": "This method is called when a message is received. Override this method to\ndefine custom\nbehavior.", - "description": "This method is called when a message is received. Override this method to\ndefine custom\nbehavior.", - "scratchblock": "when I receive [message v]", + "summary": "Draws the sprite this wide, whatever its costume's width and size: for buttons, panels and\nplatforms. With [setNineSlice(int, int, int, int)](setNineSlice) the corners keep their size.", + "description": "Draws the sprite this wide, whatever its costume's width and size: for buttons, panels and\nplatforms. With [setNineSlice(int, int, int, int)](setNineSlice) the corners keep their size.", + "scratchblock": null, "paramDocs": [ - "message: The message that is received." + "width: the width in stage pixels; 0 to follow the costume and size again" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenIReceive", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird aufgerufen, wenn die Bühne eine Nachricht sendet" - } - } + "translations": {} }, { - "id": "Sprite/whenKeyPressed(KeyCode)", - "memberId": "Sprite/whenKeyPressed", + "id": "Sprite/setX(double)", + "memberId": "Sprite/setX", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenKeyPressed", + "methodName": "setX", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "double" ], "parameterNames": [ - "keyCode" + "x" ], "params": [ - "KeyCode keyCode" + "double x" ], - "summary": "This method is called when a key is pressed. Override this method to define\ncustom behavior.", - "description": "This method is called when a key is pressed. Override this method to define\ncustom behavior.", - "scratchblock": "when [space v] key pressed", + "summary": "", + "description": "", + "scratchblock": "set x to (x)", "paramDocs": [ - "keyCode: the key that was pressed" + "x: the new x" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Drücken einer Taste aufgerufen" + "description": "Setzt die x-Position" } } }, { - "id": "Sprite/whenKeyReleased(KeyCode)", - "memberId": "Sprite/whenKeyReleased", + "id": "Sprite/setY(double)", + "memberId": "Sprite/setY", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenKeyReleased", + "methodName": "setY", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "double" ], "parameterNames": [ - "keyCode" + "y" ], "params": [ - "KeyCode keyCode" + "double y" ], - "summary": "This method is called when a key is released. Override this method to define\ncustom behavior.", - "description": "This method is called when a key is released. Override this method to define\ncustom behavior.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "set y to (y)", "paramDocs": [ - "keyCode: the key that was released" + "y: the new y" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyReleased", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/setY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Loslassen einer Taste aufgerufen" + "description": "Setzt die y-Position" } } }, { - "id": "Sprite/whenMouseClicked(MouseCode)", - "memberId": "Sprite/whenMouseClicked", + "id": "Sprite/show()", + "memberId": "Sprite/show", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenMouseClicked", + "methodName": "show", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Shows the sprite.", + "description": "Shows the sprite.", + "scratchblock": "show", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/show", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": { + "de": { + "description": "Macht die Figur sichtbar" + } + } + }, + { + "id": "Sprite/showVariable(String,Supplier)", + "memberId": "Sprite/showVariable", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "showVariable", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.MouseCode" + "java.lang.String", + "java.util.function.Supplier" ], "parameterNames": [ - "mouseCode" + "name", + "value" ], "params": [ - "MouseCode mouseCode" + "String name", + "Supplier value" ], - "summary": "This method is called when a mouse click event occurs. Override this method\nto define custom\nbehavior.", - "description": "This method is called when a mouse click event occurs. Override this method\nto define custom\nbehavior.", - "scratchblock": null, + "summary": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.", + "description": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.\n\n```java\nthis.showVariable(\"score\", () -> this.score);\n```", + "scratchblock": "show variable [name v]", "paramDocs": [ - "mouseCode: The code representing the mouse button that was clicked." + "name: the label", + "value: gives the value to show" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseClicked", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/showVariable", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/stamp()", + "memberId": "Sprite/stamp", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "stamp", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Stamps the costume onto the canvas of the sprite's pen layer (behind the sprites unless the\npen was moved): a picture of the sprite as it looks now, effects included, that stays.", + "description": "Stamps the costume onto the canvas of the sprite's pen layer (behind the sprites unless the\npen was moved): a picture of the sprite as it looks now, effects included, that stays.", + "scratchblock": "stamp", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei einem Mausklick aufgerufen, egal wo" + "description": "Druckt ein unbewegliches Abbild der Figur auf die Bühne" } } }, { - "id": "Sprite/whenMouseMoved(double,double)", - "memberId": "Sprite/whenMouseMoved", + "id": "Sprite/stamp(Layer)", + "memberId": "Sprite/stamp", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenMouseMoved", + "methodName": "stamp", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "org.openpatch.scratch.Layer" ], "parameterNames": [ - "x", - "y" + "layer" ], "params": [ - "double x", - "double y" + "Layer layer" ], - "summary": "This method is called when the mouse is moved. Override this method to define\ncustom behavior.", - "description": "This method is called when the mouse is moved. Override this method to define\ncustom behavior.", - "scratchblock": null, + "summary": "Stamps the costume onto the canvas of a layer.", + "description": "Stamps the costume onto the canvas of a layer.", + "scratchblock": "stamp", "paramDocs": [ - "x: The x-coordinate of the mouse pointer.", - "y: The y-coordinate of the mouse pointer." + "layer: the layer" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseMoved", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stamp", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei jeder Mausbewegung aufgerufen; x und y sind Bühnenkoordinaten" + "description": "Druckt ein unbewegliches Abbild der Figur auf die angegebene Ebene" } } }, { - "id": "Sprite/whenRemovedFromStage()", - "memberId": "Sprite/whenRemovedFromStage", + "id": "Sprite/stopAllSounds()", + "memberId": "Sprite/stopAllSounds", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenRemovedFromStage", + "methodName": "stopAllSounds", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "This method is called when the sprite is removed from the stage. Override\nthis method to define\ncustom behavior when the sprite is removed.", - "description": "This method is called when the sprite is removed from the stage. Override\nthis method to define\ncustom behavior when the sprite is removed.", - "scratchblock": null, + "summary": "Stops every sound this object started.", + "description": "Stops every sound this object started.", + "scratchblock": "stop all sounds", "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenRemovedFromStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopAllSounds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn die Figur von der Bühne entfernt wird" + "description": "Stoppt alle Klänge dieser Figur" } } }, { - "id": "Sprite/whenStartsAsClone()", - "memberId": "Sprite/whenStartsAsClone", + "id": "Sprite/stopSound(String)", + "memberId": "Sprite/stopSound", "owner": "org.openpatch.scratch.Sprite", "className": "Sprite", - "methodName": "whenStartsAsClone", + "methodName": "stopSound", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Runs when this sprite was just made as a clone, like Scratch's \"when I\nstart as a clone\". Override it to give clones their own behaviour, for\nexample to send a bullet on its way.", - "description": "Runs when this sprite was just made as a clone, like Scratch's \"when I\nstart as a clone\". Override it to give clones their own behaviour, for\nexample to send a bullet on its way.\n\n```java\npublic void whenStartsAsClone() {\n this.show();\n this.goToRandomPosition();\n}\n```", - "scratchblock": "when I start as a clone", - "paramDocs": [], + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "name" + ], + "params": [ + "String name" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "name: the sound to stop" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenStartsAsClone", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/stopSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Stoppt den Klang mit dem angegebenen Namen" + } + } }, { - "id": "Stage/add(Sprite)", - "memberId": "Stage/add", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "add", + "id": "Sprite/switchCostume(String)", + "memberId": "Sprite/switchCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "switchCostume", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "java.lang.String" ], "parameterNames": [ - "sprite" + "name" ], "params": [ - "Sprite sprite" + "String name" ], - "summary": "Adds a sprite to the stage. Sprites are drawn in the order they were added, so a sprite added\nlater is drawn on top of one added earlier.", - "description": "Adds a sprite to the stage. Sprites are drawn in the order they were added, so a sprite added\nlater is drawn on top of one added earlier.", - "scratchblock": null, + "summary": "Switches to the costume with that name; an unknown name changes nothing.", + "description": "Switches to the costume with that name; an unknown name changes nothing.", + "scratchblock": "switch costume to [name v]", "paramDocs": [ - "sprite: the sprite to add" + "name: the costume's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt der Bühne eine Figur hinzu" + "description": "Wechselt zum Kostüm mit dem Namen" } } }, { - "id": "Stage/add(Text)", - "memberId": "Stage/add", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "add", + "id": "Sprite/switchCostume(double)", + "memberId": "Sprite/switchCostume", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "switchCostume", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Text" + "double" ], "parameterNames": [ - "text" + "index" ], "params": [ - "Text text" + "double index" ], - "summary": "Add a text object to the stage", - "description": "Add a text object to the stage", - "scratchblock": null, + "summary": "Switches to a costume by number, counting from 0; numbers wrap around like Scratch's.", + "description": "Switches to a costume by number, counting from 0; numbers wrap around like Scratch's.", + "scratchblock": "switch costume to [name v]", "paramDocs": [ - "text: a text" + "index: the costume's number" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/switchCostume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt der Bühne einen Text hinzu" + "description": "Wechselt zum Kostüm mit der angegebenen Nummer" } } }, { - "id": "Stage/add(Pen)", - "memberId": "Stage/add", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "add", + "id": "Sprite/think(String)", + "memberId": "Sprite/think", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "think", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Pen" + "java.lang.String" ], "parameterNames": [ - "pen" + "text" ], "params": [ - "Pen pen" + "String text" ], - "summary": "Adds a Pen object to the stage.", - "description": "Adds a Pen object to the stage.", - "scratchblock": null, + "summary": "Shows a thought bubble until the sprite thinks something else; an empty text removes it.", + "description": "Shows a thought bubble until the sprite thinks something else; an empty text removes it.", + "scratchblock": "think [text]", "paramDocs": [ - "pen: the Pen object to be added to the stage" + "text: what the sprite thinks" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt der Bühne einen Stift hinzu" + "description": "Zeigt eine Denkblase an" } } }, { - "id": "Stage/addBackdrop(String,String,boolean)", - "memberId": "Stage/addBackdrop", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addBackdrop", + "id": "Sprite/think(String,double)", + "memberId": "Sprite/think", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "think", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "boolean" + "double" ], "parameterNames": [ - "name", - "imagePath", - "stretch" + "text", + "seconds" ], "params": [ - "String name", - "String imagePath", - "boolean stretch" + "String text", + "double seconds" ], - "summary": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "description": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "scratchblock": null, + "summary": "Shows a thought bubble for a number of seconds of game time.", + "description": "Shows a thought bubble for a number of seconds of game time.", + "scratchblock": "think [text] for (seconds) seconds", "paramDocs": [ - "name: a unique name", - "imagePath: a image path, or the name of a built-in sprite such as\n \"bg_castle\"", - "stretch: stretch image to window size" + "text: what the sprite thinks", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/think", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Fügt einen Hintergrund hinzu; bei stretch == true wird er auf Bühnengröße gedehnt" - } - } + "translations": {} }, { - "id": "Stage/addBackdrop(String,String)", - "memberId": "Stage/addBackdrop", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addBackdrop", + "id": "Sprite/toString()", + "memberId": "Sprite/toString", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "toString", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "The sprite's centre of the costume on the stage, as Scratch's \"x position\"/\"y position\".", + "description": "The sprite's centre of the costume on the stage, as Scratch's \"x position\"/\"y position\".", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/toString", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Sprite/turnLeft(double)", + "memberId": "Sprite/turnLeft", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "turnLeft", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "double" ], "parameterNames": [ - "name", - "imagePath" + "degrees" ], "params": [ - "String name", - "String imagePath" + "double degrees" ], - "summary": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "description": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "turn left (degrees) degrees", "paramDocs": [ - "name: a unique name", - "imagePath: a image path, or the name of a built-in sprite such as\n \"bg_castle\"" + "degrees: how far to turn anticlockwise" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnLeft", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen Hintergrund unter eigenem Namen hinzu" + "description": "Dreht die Figur um die angegebene Gradzahl nach links" } } }, { - "id": "Stage/addBackdrop(String)", - "memberId": "Stage/addBackdrop", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addBackdrop", + "id": "Sprite/turnRight(double)", + "memberId": "Sprite/turnRight", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "turnRight", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double" ], "parameterNames": [ - "name" + "degrees" ], "params": [ - "String name" + "double degrees" ], - "summary": "Add one of the backdrops that ship with Scratch for Java to the stage. The\nbackdrop gets the same name as the built-in sprite. If a backdrop with that\nname already exists do nothing.", - "description": "Add one of the backdrops that ship with Scratch for Java to the stage. The\nbackdrop gets the same name as the built-in sprite. If a backdrop with that\nname already exists do nothing.\n\nExample usage:\n\n```java\nthis.addBackdrop(\"bg_castle\");\n```", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "turn right (degrees) degrees", "paramDocs": [ - "name: the name of a built-in sprite, for example \"bg_castle\". Add the\n sheet in front of the name, for example \"platformer/grass\", if\n the same name exists on several sheets." + "degrees: how far to turn clockwise" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/turnRight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen der eingebauten Hintergründe hinzu" + "description": "Dreht die Figur um die angegebene Gradzahl nach rechts" } } }, { - "id": "Stage/addSound(String,String)", - "memberId": "Stage/addSound", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addSound", + "id": "Sprite/whenAddedToStage()", + "memberId": "Sprite/whenAddedToStage", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenAddedToStage", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String", - "java.lang.String" - ], - "parameterNames": [ - "name", - "soundPath" - ], - "params": [ - "String name", - "String soundPath" - ], - "summary": "Add a sound to the stage. If a sound with the received name already exists do\nnothing.", - "description": "Add a sound to the stage. If a sound with the received name already exists do\nnothing.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Called when the sprite was added to a stage. Override it to react.", + "description": "Called when the sprite was added to a stage. Override it to react.", "scratchblock": null, - "paramDocs": [ - "name: a unique name", - "soundPath: a sound path, or the name of a built-in sound such as\n \"footstep_carpet_000\"" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenAddedToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen Klang unter eigenem Namen hinzu" + "description": "Wird aufgerufen, wenn die Figur der Bühne hinzugefügt wird" } } }, { - "id": "Stage/addSound(String)", - "memberId": "Stage/addSound", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "addSound", + "id": "Sprite/whenBackdropSwitches(String)", + "memberId": "Sprite/whenBackdropSwitches", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenBackdropSwitches", "static": false, "returnType": "void", "parameterTypes": [ @@ -8670,63 +9212,55 @@ "params": [ "String name" ], - "summary": "Add one of the sounds that ship with Scratch for Java to the stage. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.", - "description": "Add one of the sounds that ship with Scratch for Java to the stage. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.\n\nExample usage:\n\n```java\nthis.addSound(\"footstep_carpet_000\");\n```", - "scratchblock": null, + "summary": "Called when the stage switches its backdrop.", + "description": "Called when the stage switches its backdrop.", + "scratchblock": "when backdrop switches to [name v]", "paramDocs": [ - "name: the name of a built-in sound, for example \"footstep_carpet_000\"" + "name: the new backdrop's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenBackdropSwitches", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt einen der eingebauten Klänge hinzu" + "description": "Wird aufgerufen, wenn der Hintergrund gewechselt wird" } } }, { - "id": "Stage/ask(String)", - "memberId": "Stage/ask", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "ask", + "id": "Sprite/whenClicked()", + "memberId": "Sprite/whenClicked", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenClicked", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "question" - ], - "params": [ - "String question" - ], - "summary": "Asks a question and waits for an answer to be typed in. A box appears at the\nbottom of the stage; whatever is typed goes into it until Enter is pressed.", - "description": "Asks a question and waits for an answer to be typed in. A box appears at the\nbottom of the stage; whatever is typed goes into it until Enter is pressed.\n\nUnlike Scratch, this does not pause anything. Your `run()` keeps being\ncalled while the question is on screen, so check [isAsking()](isAsking) or wait\nfor [getAnswer()](getAnswer) to change:\n\n```java\npublic void run() {\n if (!this.isAsking() && this.getAnswer().isEmpty()) {\n this.ask(\"What is your name?\");\n }\n if (!this.getAnswer().isEmpty()) {\n this.display(\"Hello \" + this.getAnswer() + \"!\");\n }\n}\n```", - "scratchblock": "ask [question] and wait", - "paramDocs": [ - "question: the question to show" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Called when this sprite is clicked: a mouse button is pressed over its hitbox, and no sprite\nin front of it is under the pointer.", + "description": "Called when this sprite is clicked: a mouse button is pressed over its hitbox, and no sprite\nin front of it is under the pointer.", + "scratchblock": "when this sprite clicked", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/ask", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenClicked", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" + "description": "Wird aufgerufen, wenn die Figur angeklickt wird" } } }, { - "id": "Stage/broadcast(String)", - "memberId": "Stage/broadcast", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "broadcast", + "id": "Sprite/whenIReceive(String)", + "memberId": "Sprite/whenIReceive", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenIReceive", "static": false, "returnType": "void", "parameterTypes": [ @@ -8738,4634 +9272,4500 @@ "params": [ "String message" ], - "summary": "Broadcasts a message to every sprite on the stage and to the stage itself,\nas in Scratch. Each of them runs its `whenIReceive` method with the\nmessage.", - "description": "Broadcasts a message to every sprite on the stage and to the stage itself,\nas in Scratch. Each of them runs its `whenIReceive` method with the\nmessage.", - "scratchblock": "broadcast [message v]", + "summary": "Called when a message is broadcast.", + "description": "Called when a message is broadcast.", + "scratchblock": "when I receive [message v]", "paramDocs": [ - "message: The message to broadcast." + "message: the message" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/broadcast", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenIReceive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Sendet eine Nachricht an alle whenIReceive-Empfänger" + "description": "Wird aufgerufen, wenn die Bühne eine Nachricht sendet" } } }, { - "id": "Stage/changeColor(double)", - "memberId": "Stage/changeColor", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeColor", + "id": "Sprite/whenKeyPressed(KeyCode)", + "memberId": "Sprite/whenKeyPressed", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenKeyPressed", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.KeyCode" ], "parameterNames": [ - "h" + "key" ], "params": [ - "double h" + "KeyCode key" ], - "summary": "Changes the background color by adding a step to the hue value.", - "description": "Changes the background color by adding a step to the hue value.", - "scratchblock": null, + "summary": "Called when a key is pressed, once per press (holding a key down does not repeat it).", + "description": "Called when a key is pressed, once per press (holding a key down does not repeat it).", + "scratchblock": "when [space v] key pressed", "paramDocs": [ - "h: a step value" + "key: the key" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert den Farbton des Hintergrunds um den angegebenen Wert" + "description": "Wird beim Drücken einer Taste aufgerufen" } } }, { - "id": "Stage/changeTint(double)", - "memberId": "Stage/changeTint", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeTint", + "id": "Sprite/whenKeyReleased(KeyCode)", + "memberId": "Sprite/whenKeyReleased", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenKeyReleased", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.KeyCode" ], "parameterNames": [ - "step" + "key" ], "params": [ - "double step" + "KeyCode key" ], - "summary": "Changes the colour the backdrop is tinted with by a step.", - "description": "Changes the colour the backdrop is tinted with by a step.", - "scratchblock": "change [color v] effect by (step)", + "summary": "Called when a key is released.", + "description": "Called when a key is released.", + "scratchblock": null, "paramDocs": [ - "step: a step value" + "key: the key" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenKeyReleased", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert den Farbton der Einfärbung um den angegebenen Wert" + "description": "Wird beim Loslassen einer Taste aufgerufen" } } }, { - "id": "Stage/changeTransparency(double)", - "memberId": "Stage/changeTransparency", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeTransparency", + "id": "Sprite/whenMouseClicked(MouseCode)", + "memberId": "Sprite/whenMouseClicked", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenMouseClicked", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.MouseCode" ], "parameterNames": [ - "step" + "button" ], "params": [ - "double step" + "MouseCode button" ], - "summary": "Changes how see-through the backdrop is by a step. A positive step fades it\nout, a negative one brings it back.", - "description": "Changes how see-through the backdrop is by a step. A positive step fades it\nout, a negative one brings it back.", - "scratchblock": "change [ghost v] effect by (step)", + "summary": "Called when a mouse button is pressed anywhere on the stage.", + "description": "Called when a mouse button is pressed anywhere on the stage.", + "scratchblock": null, "paramDocs": [ - "step: a step value" + "button: the button" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseClicked", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert die Transparenz des Hintergrunds" + "description": "Wird bei einem Mausklick aufgerufen, egal wo" } } }, { - "id": "Stage/changeVolume(double)", - "memberId": "Stage/changeVolume", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "changeVolume", + "id": "Sprite/whenMouseMoved(double,double)", + "memberId": "Sprite/whenMouseMoved", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenMouseMoved", "static": false, "returnType": "void", "parameterTypes": [ + "double", "double" ], "parameterNames": [ - "step" + "x", + "y" ], "params": [ - "double step" + "double x", + "double y" ], - "summary": "Makes every sound of this stage louder or quieter.", - "description": "Makes every sound of this stage louder or quieter.", - "scratchblock": "change volume by (step)", + "summary": "Called when the mouse moves.", + "description": "Called when the mouse moves.", + "scratchblock": null, "paramDocs": [ - "step: how much to add to the volume, in percent" + "x: x of the mouse pointer (world)", + "y: y of the mouse pointer (world)" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenMouseMoved", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Ändert die Lautstärke um den angegebenen Wert" + "description": "Wird bei jeder Mausbewegung aufgerufen; x und y sind Bühnenkoordinaten" } } }, { - "id": "Stage/constructor()", - "memberId": "Stage/constructor", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "constructor", + "id": "Sprite/whenRemovedFromStage()", + "memberId": "Sprite/whenRemovedFromStage", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenRemovedFromStage", "static": false, - "returnType": "Stage", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Stage. A stage is as big as the window it is shown in, so\nthe window has to exist first:", - "description": "Constructs a new Stage. A stage is as big as the window it is shown in, so\nthe window has to exist first:\n\n```java\nWindow myWindow = new Window(480, 360);\nmyWindow.setStage(new MyStage());\n```", + "summary": "Called when the sprite was removed from its stage. Override it to react.", + "description": "Called when the sprite was removed from its stage. Override it to react.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenRemovedFromStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt eine Bühne. Sie ist so groß wie das Fenster, das es schon geben muss" + "description": "Wird aufgerufen, wenn die Figur von der Bühne entfernt wird" } } }, { - "id": "Stage/count(Class)", - "memberId": "Stage/count", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "count", + "id": "Sprite/whenStartsAsClone()", + "memberId": "Sprite/whenStartsAsClone", + "owner": "org.openpatch.scratch.Sprite", + "className": "Sprite", + "methodName": "whenStartsAsClone", "static": false, - "returnType": "int", - "parameterTypes": [ - "java.lang.Class" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Class c" - ], - "summary": "Returns the number of sprites of the specified class.", - "description": "Returns the number of sprites of the specified class.", - "scratchblock": null, - "paramDocs": [ - "c: the class of the sprites to count" - ], - "returns": "the number of sprites of the specified class", + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Called in a new clone, right after it was made.", + "description": "Called in a new clone, right after it was made.", + "scratchblock": "when I start as a clone", + "paramDocs": [], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/count", + "docsUrl": "https://scratch4j.openpatch.org/reference/Sprite/whenStartsAsClone", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Anzahl der Figuren dieser Klasse zurück, z.B. count(Apfel.class)" - } - } + "translations": {} }, { - "id": "Stage/debug(Object[])", - "memberId": "Stage/debug", + "id": "Stage/add(Sprite)", + "memberId": "Stage/add", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "debug", + "methodName": "add", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.Object[]" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "values" + "sprite" ], "params": [ - "Object[] values" + "Sprite sprite" ], - "summary": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the stage's class name so you can tell\nwhich stage it came from.", - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the stage's class name so you can tell\nwhich stage it came from.\n\nExample:\n\n```java\nthis.debug(\"score =\", score, \"lives =\", lives);\n// prints: [MyStage] score = 5 lives = 3\n```", + "summary": "Adds a sprite, in front of the sprites of its layer. A sprite can only be on one stage; it\nleaves the old one.", + "description": "Adds a sprite, in front of the sprites of its layer. A sprite can only be on one stage; it\nleaves the old one.", "scratchblock": null, "paramDocs": [ - "values: one or more values to print" + "sprite: the sprite" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/debug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Fügt der Bühne eine Figur hinzu" + } + } }, { - "id": "Stage/display(String)", - "memberId": "Stage/display", + "id": "Stage/add(Pen)", + "memberId": "Stage/add", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "display", + "methodName": "add", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Pen" ], "parameterNames": [ - "text" + "pen" ], "params": [ - "String text" + "Pen pen" ], - "summary": "Displays the given text on the stage.", - "description": "Displays the given text on the stage.", + "summary": "Adds a pen of its own.", + "description": "Adds a pen of its own.", "scratchblock": null, "paramDocs": [ - "text: the text to be displayed" + "pen: the pen" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt einen Text am unteren Rand der Bühne an" + "description": "Fügt der Bühne einen Stift hinzu" } } }, { - "id": "Stage/display(String,int)", - "memberId": "Stage/display", + "id": "Stage/add(Text)", + "memberId": "Stage/add", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "display", + "methodName": "add", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.Text" ], "parameterNames": [ - "text", - "millis" + "text" ], "params": [ - "String text", - "int millis" + "Text text" ], - "summary": "Displays the given text on the screen for a specified duration.", - "description": "Displays the given text on the screen for a specified duration.", + "summary": "Adds a text of its own.", + "description": "Adds a text of its own.", "scratchblock": null, "paramDocs": [ - "text: The text to be displayed.", - "millis: The duration in milliseconds for which the text will be\n displayed." + "text: the text" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Zeigt einen Text für die angegebene Zeit in Millisekunden an" - } - } - }, - { - "id": "Stage/eraseAll()", - "memberId": "Stage/eraseAll", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "eraseAll", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Erases all lines on the pen layer.", - "description": "Erases all lines on the pen layer.", - "scratchblock": "erase all", - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/eraseAll", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/add", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Löscht alles, was mit Stiften gezeichnet wurde" + "description": "Fügt der Bühne einen Text hinzu" } } }, { - "id": "Stage/exit()", - "memberId": "Stage/exit", + "id": "Stage/addBackdrop(String,String)", + "memberId": "Stage/addBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "exit", + "methodName": "addBackdrop", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Close the window and therefore the whole application.", - "description": "Close the window and therefore the whole application.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/exit", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Beendet das Programm" - } - } - }, - { - "id": "Stage/find(Class)", - "memberId": "Stage/find", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "find", - "static": false, - "returnType": "List", "parameterTypes": [ - "java.lang.Class" + "java.lang.String", + "java.lang.String" ], "parameterNames": [ - "c" + "name", + "imagePath" ], "params": [ - "Class c" + "String name", + "String imagePath" ], - "summary": "Find sprites of a given class.", - "description": "Find sprites of a given class.", + "summary": "Adds a backdrop. The first one added is shown.", + "description": "Adds a backdrop. The first one added is shown.", "scratchblock": null, "paramDocs": [ - "c: Class" + "name: the backdrop's name", + "imagePath: the image file" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/find", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt alle Figuren dieser Klasse zurück, z.B. find(Apfel.class)" - } - } - }, - { - "id": "Stage/getAll()", - "memberId": "Stage/getAll", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "getAll", - "static": false, - "returnType": "List", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves a list of all sprites in the current stage.", - "description": "Retrieves a list of all sprites in the current stage.", - "scratchblock": null, - "paramDocs": [], - "returns": "a list containing all sp", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAll", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt alle Figuren auf der Bühne zurück" + "description": "Fügt einen Hintergrund unter eigenem Namen hinzu" } } }, { - "id": "Stage/getAnswer()", - "memberId": "Stage/getAnswer", + "id": "Stage/addBackdrop(String)", + "memberId": "Stage/addBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getAnswer", + "methodName": "addBackdrop", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the last answer that was typed in.", - "description": "Returns the last answer that was typed in.", - "scratchblock": "(answer)", - "paramDocs": [], - "returns": "the answer, or an empty string if nothing has been answered yet", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "imagePath" + ], + "params": [ + "String imagePath" + ], + "summary": "Adds a backdrop, named after its file.", + "description": "Adds a backdrop, named after its file.", + "scratchblock": null, + "paramDocs": [ + "imagePath: the image file, or a built-in sprite's name" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAnswer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die zuletzt eingegebene Antwort zurück, sonst eine leere Zeichenkette" + "description": "Fügt einen der eingebauten Hintergründe hinzu" } } }, { - "id": "Stage/getCamera()", - "memberId": "Stage/getCamera", + "id": "Stage/addBackdrop(String,String,boolean)", + "memberId": "Stage/addBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getCamera", + "methodName": "addBackdrop", "static": false, - "returnType": "Camera", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the current camera instance associated with this stage.", - "description": "Retrieves the current camera instance associated with this stage.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "boolean" + ], + "parameterNames": [ + "name", + "imagePath", + "stretch" + ], + "params": [ + "String name", + "String imagePath", + "boolean stretch" + ], + "summary": "Adds a backdrop, optionally stretched to the stage's size.", + "description": "Adds a backdrop, optionally stretched to the stage's size.", "scratchblock": null, - "paramDocs": [], - "returns": "the current Camera object.", + "paramDocs": [ + "name: the backdrop's name", + "imagePath: the image file, or a built-in sprite's name", + "stretch: whether to stretch it to the stage's size" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCamera", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Kamera der Bühne zurück" + "description": "Fügt einen Hintergrund hinzu; bei stretch == true wird er auf Bühnengröße gedehnt" } } }, { - "id": "Stage/getColor()", - "memberId": "Stage/getColor", + "id": "Stage/addSound(String,String)", + "memberId": "Stage/addSound", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getColor", + "methodName": "addSound", "static": false, - "returnType": "Color", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current color of the stage.", - "description": "Returns the current color of the stage.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "soundPath" + ], + "params": [ + "String name", + "String soundPath" + ], + "summary": "Adds a sound (WAV or OGG).", + "description": "Adds a sound (WAV or OGG).", "scratchblock": null, - "paramDocs": [], - "returns": "the current color", + "paramDocs": [ + "name: the sound's name, for [playSound(String)](playSound)", + "soundPath: the sound file" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Hintergrundfarbe zurück" + "description": "Fügt einen Klang unter eigenem Namen hinzu" } } }, { - "id": "Stage/getCurrentBackdropIndex()", - "memberId": "Stage/getCurrentBackdropIndex", + "id": "Stage/addSound(String)", + "memberId": "Stage/addSound", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getCurrentBackdropIndex", + "methodName": "addSound", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current backdrop index", - "description": "Returns the current backdrop index", - "scratchblock": "(backdrop [number v])", - "paramDocs": [], - "returns": "a backdrop index", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "soundPath" + ], + "params": [ + "String soundPath" + ], + "summary": "Adds a sound, named after its file.", + "description": "Adds a sound, named after its file.", + "scratchblock": null, + "paramDocs": [ + "soundPath: the sound file" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropIndex", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/addSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Nummer des aktuellen Hintergrunds zurück" + "description": "Fügt einen der eingebauten Klänge hinzu" } } }, { - "id": "Stage/getCurrentBackdropName()", - "memberId": "Stage/getCurrentBackdropName", + "id": "Stage/ask(String)", + "memberId": "Stage/ask", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getCurrentBackdropName", + "methodName": "ask", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current backdrop name", - "description": "Returns the current backdrop name", - "scratchblock": "(backdrop [name v])", - "paramDocs": [], - "returns": "a backdrop name", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "question" + ], + "params": [ + "String question" + ], + "summary": "Asks a question in a box along the bottom of the stage, as Scratch does, with a field to type\nthe answer in. Enter or the check button finishes it: then [isAsking()](isAsking) is false and [getAnswer()](getAnswer) has the answer.\nWhile a question is open, keys go to the answer box, not to the stage and its sprites.", + "description": "Asks a question in a box along the bottom of the stage, as Scratch does, with a field to type\nthe answer in. Enter or the check button finishes it: then [isAsking()](isAsking) is false and [getAnswer()](getAnswer) has the answer.\nWhile a question is open, keys go to the answer box, not to the stage and its sprites.", + "scratchblock": "ask [question] and wait", + "paramDocs": [ + "question: the question" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropName", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/ask", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Namen des aktuellen Hintergrunds zurück" + "description": "Stellt eine Frage; die Antwort wird über getAnswer() abgeholt" } } }, { - "id": "Stage/getDeltaTime()", - "memberId": "Stage/getDeltaTime", + "id": "Stage/broadcast(String)", + "memberId": "Stage/broadcast", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getDeltaTime", + "methodName": "broadcast", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Gets the seconds passed since the last frame.", - "description": "Gets the seconds passed since the last frame.", - "scratchblock": null, - "paramDocs": [], - "returns": "secons since last frame", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "message" + ], + "params": [ + "String message" + ], + "summary": "Sends a message to every sprite and then the stage; their `whenIReceive` runs at once.", + "description": "Sends a message to every sprite and then the stage; their `whenIReceive` runs at once.", + "scratchblock": "broadcast [message v]", + "paramDocs": [ + "message: the message" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getDeltaTime", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/broadcast", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" + "description": "Sendet eine Nachricht an alle whenIReceive-Empfänger" } } }, { - "id": "Stage/getFrameRate()", - "memberId": "Stage/getFrameRate", + "id": "Stage/changeColorEffect(double)", + "memberId": "Stage/changeColorEffect", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getFrameRate", + "methodName": "changeColorEffect", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Get the frame rate of the application.", - "description": "Get the frame rate of the application.", - "scratchblock": null, - "paramDocs": [], - "returns": "the frame rate", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [color v] effect by (by)", + "paramDocs": [ + "by: how much to change the backdrop's colour effect" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getFrameRate", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die aktuelle Bildrate zurück" - } - } + "translations": {} }, { - "id": "Stage/getHeight()", - "memberId": "Stage/getHeight", + "id": "Stage/changeTransparency(double)", + "memberId": "Stage/changeTransparency", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getHeight", + "methodName": "changeTransparency", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "scratchblock": null, - "paramDocs": [], - "returns": "the height of the sprite", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change [ghost v] effect by (step)", + "paramDocs": [ + "by: how much to change the backdrop's transparency" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Höhe der Bühne in Pixeln zurück" + "description": "Ändert die Transparenz des Hintergrunds" } } }, { - "id": "Stage/getMouse()", - "memberId": "Stage/getMouse", + "id": "Stage/changeVolume(double)", + "memberId": "Stage/changeVolume", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getMouse", + "methodName": "changeVolume", "static": false, - "returnType": "Vector2", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current position of the mouse cursor as a Vector2", - "description": "Returns the current position of the mouse cursor as a Vector2", - "scratchblock": null, - "paramDocs": [], - "returns": "mouse position", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "by" + ], + "params": [ + "double by" + ], + "summary": "", + "description": "", + "scratchblock": "change volume by (step)", + "paramDocs": [ + "by: how much to change the volume" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouse", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/changeVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Position des Mauszeigers zurück" + "description": "Ändert die Lautstärke um den angegebenen Wert" } } }, { - "id": "Stage/getMouseX()", - "memberId": "Stage/getMouseX", + "id": "Stage/constructor()", + "memberId": "Stage/constructor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getMouseX", + "methodName": "constructor", "static": false, - "returnType": "double", + "returnType": "Stage", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the current x-position of the mouse cursor", - "description": "Returns the current x-position of the mouse cursor", - "scratchblock": "(mouse x)", + "summary": "A stage the size of the window.", + "description": "A stage the size of the window.", + "scratchblock": null, "paramDocs": [], - "returns": "x-position", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die x-Position des Mauszeigers zurück" + "description": "Erzeugt eine Bühne. Sie ist so groß wie das Fenster, das es schon geben muss" } } }, { - "id": "Stage/getMouseY()", - "memberId": "Stage/getMouseY", + "id": "Stage/count(Class)", + "memberId": "Stage/count", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getMouseY", + "methodName": "count", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the current y-position of the mouse cursor", - "description": "Returns the current y-position of the mouse cursor", - "scratchblock": "(mouse y)", - "paramDocs": [], - "returns": "y-position", + "returnType": "int", + "parameterTypes": [ + "java.lang.Class" + ], + "parameterNames": [ + "type" + ], + "params": [ + "Class type" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "type: a class of sprites" + ], + "returns": "how many sprites of that class are on the stage", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/count", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die y-Position des Mauszeigers zurück" + "description": "Gibt die Anzahl der Figuren dieser Klasse zurück, z.B. count(Apfel.class)" } } }, { - "id": "Stage/getPixels()", - "memberId": "Stage/getPixels", + "id": "Stage/debug(Object[])", + "memberId": "Stage/debug", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getPixels", + "methodName": "debug", "static": false, - "returnType": "Pixels", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the colours of everything this stage has drawn.", - "description": "Returns the colours of everything this stage has drawn.\n\nExample usage:\n\n```java\nint[] colours = this.getPixels().main();\n```", + "returnType": "void", + "parameterTypes": [ + "java.lang.Object[]" + ], + "parameterNames": [ + "values" + ], + "params": [ + "Object[] values" + ], + "summary": "Prints values for debugging, but only while debug mode is on.", + "description": "Prints values for debugging, but only while debug mode is on.", "scratchblock": null, - "paramDocs": [], - "returns": "the pixels", + "paramDocs": [ + "values: what to print" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getPixels", - "availability": "desktop-only", - "availabilityReason": "The desktop pixel buffer is not exposed by the browser renderer.", - "translations": { - "de": { - "description": "Nur in der Desktop-Version: Zugriff auf einzelne Bildpunkte" - } - } + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/debug", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} }, { - "id": "Stage/getShaders()", - "memberId": "Stage/getShaders", + "id": "Stage/display(String)", + "memberId": "Stage/display", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getShaders", + "methodName": "display", "static": false, - "returnType": "Shaders", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shaders of this stage. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.", - "description": "Returns the shaders of this stage. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.\n\nExample usage:\n\n```java\nthis.getShaders().add(\"blur\", \"blur.frag\", null);\nthis.getShaders().switchTo(\"blur\");\n```\n\nSeveral shaders can be active at once with `activate`: the stage\ndraws with each in turn, in the order they were added.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "text" + ], + "params": [ + "String text" + ], + "summary": "Shows a text in a band along the bottom of the stage until something else is displayed; an\nempty text removes the band.", + "description": "Shows a text in a band along the bottom of the stage until something else is displayed; an\nempty text removes the band.", "scratchblock": null, - "paramDocs": [], - "returns": "the shaders", + "paramDocs": [ + "text: what to show" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getShaders", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Shader der Bühne zurück; sie verändern das ganze Bild ohne die UI" + "description": "Zeigt einen Text am unteren Rand der Bühne an" } } }, { - "id": "Stage/getSorting()", - "memberId": "Stage/getSorting", + "id": "Stage/display(String,double)", + "memberId": "Stage/display", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getSorting", + "methodName": "display", "static": false, - "returnType": "Sorting", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the order in which the sprites of this stage are drawn.", - "description": "Returns the order in which the sprites of this stage are drawn.\n\nExample usage:\n\n```java\nthis.getSorting().byY();\n```", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "double" + ], + "parameterNames": [ + "text", + "seconds" + ], + "params": [ + "String text", + "double seconds" + ], + "summary": "Shows a text in a band along the bottom of the stage for a number of seconds of game time.", + "description": "Shows a text in a band along the bottom of the stage for a number of seconds of game time.", "scratchblock": null, - "paramDocs": [], - "returns": "the sorting", + "paramDocs": [ + "text: what to show", + "seconds: how long" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getSorting", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/display", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Sortierung der Bühne zurück. Mit getSorting().byY() werden Figuren weiter unten vor denen weiter oben gezeichnet." - } - } + "translations": {} }, { - "id": "Stage/getTimer()", - "memberId": "Stage/getTimer", + "id": "Stage/eraseAll()", + "memberId": "Stage/eraseAll", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getTimer", + "methodName": "eraseAll", "static": false, - "returnType": "Timer", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the timer", - "description": "Returns the timer", - "scratchblock": "(timer)", + "summary": "Erases everything every pen drew and everything stamped, on every layer.", + "description": "Erases everything every pen drew and everything stamped, on every layer.", + "scratchblock": "erase all", "paramDocs": [], - "returns": "the timer", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTimer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/eraseAll", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Standard-Timer der Bühne zurück" + "description": "Löscht alles, was mit Stiften gezeichnet wurde" } } }, { - "id": "Stage/getTimer(String)", - "memberId": "Stage/getTimer", + "id": "Stage/extension(Class,Supplier)", + "memberId": "Stage/extension", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getTimer", + "methodName": "extension", "static": false, - "returnType": "Timer", + "returnType": "T", "parameterTypes": [ - "java.lang.String" + "java.lang.Class", + "java.util.function.Supplier" ], "parameterNames": [ - "name" + "type", + "factory" ], "params": [ - "String name" + "Class type", + "Supplier factory" ], - "summary": "Returns a timer by name", - "description": "Returns a timer by name", + "summary": "An extension's state for this stage, made on first use. For extensions, not for learner code.", + "description": "An extension's state for this stage, made on first use. For extensions, not for learner code.", "scratchblock": null, "paramDocs": [ - "name: a name" + "type: the state's class", + "factory: makes it" ], - "returns": "the timer", + "returns": "the stage's one instance", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTimer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/extension", + "availability": "desktop-only", + "availabilityReason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others.", + "translations": {} + }, + { + "id": "Stage/find(Class)", + "memberId": "Stage/find", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "find", + "static": false, + "returnType": "List", + "parameterTypes": [ + "java.lang.Class" + ], + "parameterNames": [ + "type" + ], + "params": [ + "Class type" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "type: a class of sprites" + ], + "returns": "every sprite of that class (subclasses included), back to front", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/find", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Timer mit dem angegebenen Namen zurück und legt ihn bei Bedarf an" + "description": "Gibt alle Figuren dieser Klasse zurück, z.B. find(Apfel.class)" } } }, { - "id": "Stage/getVolume()", - "memberId": "Stage/getVolume", + "id": "Stage/getAll()", + "memberId": "Stage/getAll", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getVolume", + "methodName": "getAll", "static": false, - "returnType": "double", + "returnType": "List", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns how loud the sounds of this stage play.", - "description": "Returns how loud the sounds of this stage play.", - "scratchblock": "(volume)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": "the volume, from 0 to 100", + "returns": "every sprite on the stage, back to front, layer by layer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAll", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Lautstärke in Prozent zurück" + "description": "Gibt alle Figuren auf der Bühne zurück" } } }, { - "id": "Stage/getWidth()", - "memberId": "Stage/getWidth", + "id": "Stage/getAnswer()", + "memberId": "Stage/getAnswer", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "getWidth", + "methodName": "getAnswer", "static": false, - "returnType": "int", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "description": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "(answer)", "paramDocs": [], - "returns": "the width of the sprite", + "returns": "the answer to the last question, \"\" before the first", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getAnswer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Breite der Bühne in Pixeln zurück" + "description": "Gibt die zuletzt eingegebene Antwort zurück, sonst eine leere Zeichenkette" } } }, { - "id": "Stage/hideVariable(String)", - "memberId": "Stage/hideVariable", + "id": "Stage/getCamera()", + "memberId": "Stage/getCamera", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "hideVariable", + "methodName": "getCamera", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "description": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "scratchblock": "hide variable [name v]", - "paramDocs": [ - "name: the name the monitor was shown with" - ], - "returns": null, + "returnType": "Camera", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the stage's camera", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/hideVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCamera", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Gibt die Kamera der Bühne zurück" + } + } }, { - "id": "Stage/isAsking()", - "memberId": "Stage/isAsking", + "id": "Stage/getColor()", + "memberId": "Stage/getColor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isAsking", + "methodName": "getColor", "static": false, - "returnType": "boolean", + "returnType": "Color", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether a question is on screen and still waiting for an answer.", - "description": "Checks whether a question is on screen and still waiting for an answer.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true while a question is waiting", + "returns": "the colour behind the backdrop", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isAsking", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" + "description": "Gibt die Hintergrundfarbe zurück" } } }, { - "id": "Stage/isDebug()", - "memberId": "Stage/isDebug", + "id": "Stage/getColorEffect()", + "memberId": "Stage/getColorEffect", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isDebug", + "methodName": "getColorEffect", "static": false, - "returnType": "boolean", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the application is in debug mode.", - "description": "Checks if the application is in debug mode.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true if the application is in debug mode, false otherwise.", + "returns": "the backdrop's colour effect", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isDebug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn die Fehlersuche eingeschaltet ist" - } - } + "translations": {} }, { - "id": "Stage/isKeyPressed(KeyCode)", - "memberId": "Stage/isKeyPressed", + "id": "Stage/getCurrentBackdropIndex()", + "memberId": "Stage/getCurrentBackdropIndex", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isKeyPressed", + "methodName": "getCurrentBackdropIndex", "static": false, - "returnType": "boolean", - "parameterTypes": [ - "org.openpatch.scratch.KeyCode" - ], - "parameterNames": [ - "keyCode" - ], - "params": [ - "KeyCode keyCode" - ], - "summary": "Returns true if the key is pressed", - "description": "Returns true if the key is pressed", - "scratchblock": "<key [space v] pressed?>", - "paramDocs": [ - "keyCode: a key" - ], - "returns": "key pressed", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(backdrop [number v])", + "paramDocs": [], + "returns": "the current backdrop's number, counting from 0", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropIndex", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" + "description": "Gibt die Nummer des aktuellen Hintergrunds zurück" } } }, { - "id": "Stage/isMouseDown()", - "memberId": "Stage/isMouseDown", + "id": "Stage/getCurrentBackdropName()", + "memberId": "Stage/getCurrentBackdropName", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isMouseDown", + "methodName": "getCurrentBackdropName", "static": false, - "returnType": "boolean", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns true is the mouse button is down", - "description": "Returns true is the mouse button is down", - "scratchblock": "<mouse down?>", + "summary": "", + "description": "", + "scratchblock": "(backdrop [name v])", "paramDocs": [], - "returns": "mouse button down", + "returns": "the current backdrop's name, or null without backdrops", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isMouseDown", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getCurrentBackdropName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" + "description": "Gibt den Namen des aktuellen Hintergrunds zurück" } } }, { - "id": "Stage/isSoundPlaying(String)", - "memberId": "Stage/isSoundPlaying", + "id": "Stage/getHeight()", + "memberId": "Stage/getHeight", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "isSoundPlaying", + "methodName": "getHeight", "static": false, - "returnType": "boolean", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Returns true if the sound if playing", - "description": "Returns true if the sound if playing", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "name: " - ], - "returns": "playing", + "paramDocs": [], + "returns": "the stage's height in stage pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isSoundPlaying", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" + "description": "Gibt die Höhe der Bühne in Pixeln zurück" } } }, { - "id": "Stage/nextBackdrop()", - "memberId": "Stage/nextBackdrop", + "id": "Stage/getMouse()", + "memberId": "Stage/getMouse", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "nextBackdrop", + "methodName": "getMouse", "static": false, - "returnType": "void", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to the next backdrop.", - "description": "Switch to the next backdrop.", - "scratchblock": "next backdrop", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the mouse pointer in world coordinates", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/nextBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouse", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum nächsten Hintergrund" + "description": "Gibt die Position des Mauszeigers zurück" } } }, { - "id": "Stage/pickRandom(int,int)", - "memberId": "Stage/pickRandom", + "id": "Stage/getMouseX()", + "memberId": "Stage/getMouseX", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "pickRandom", + "methodName": "getMouseX", "static": false, - "returnType": "int", - "parameterTypes": [ - "int", - "int" - ], - "parameterNames": [ - "from", - "to" - ], - "params": [ - "int from", - "int to" - ], - "summary": "Returns a random integer between the specified range (inclusive).", - "description": "Returns a random integer between the specified range (inclusive).", - "scratchblock": "(pick random (from) to (to))", - "paramDocs": [ - "from: the lower bound of the range (inclusive)", - "to: the upper bound of the range (inclusive)" - ], - "returns": "a random integer between `from` and `to` (inclusive)", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(mouse x)", + "paramDocs": [], + "returns": "x of the mouse pointer in world coordinates", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/pickRandom", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" + "description": "Gibt die x-Position des Mauszeigers zurück" } } }, { - "id": "Stage/playSound(String)", - "memberId": "Stage/playSound", + "id": "Stage/getMouseY()", + "memberId": "Stage/getMouseY", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "playSound", + "methodName": "getMouseY", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Plays a sound.", - "description": "Plays a sound.\n\nplaySoundCopy() returns an independent SoundPlayback with its own volume\nand can overlap earlier plays of the same sound.", - "scratchblock": "start sound [name v]", - "paramDocs": [ - "name: the sound name" - ], - "returns": null, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(mouse y)", + "paramDocs": [], + "returns": "y of the mouse pointer in world coordinates", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getMouseY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Spielt einen zuvor hinzugefügten Klang ab" + "description": "Gibt die y-Position des Mauszeigers zurück" } } }, { - "id": "Stage/playSoundCopy(String,double)", - "memberId": "Stage/playSoundCopy", - "owner": "org.openpatch.scratch.Stage", - "className": "Stage", - "methodName": "playSoundCopy", - "static": false, - "returnType": "SoundPlayback", - "parameterTypes": [ - "java.lang.String", - "double" - ], - "parameterNames": [ - "name", - "volume" - ], - "params": [ - "String name", - "double volume" - ], - "summary": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this stage.\nThe stage's ordinary volume does not change a copy's explicit volume.", - "description": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this stage.\nThe stage's ordinary volume does not change a copy's explicit volume.", - "scratchblock": null, - "paramDocs": [ - "name: a sound already added with addSound()", - "volume: volume from 0 to 100 percent" - ], - "returns": "this individual playback, also usable in try-with-resources", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSoundCopy", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Stage/previousBackdrop()", - "memberId": "Stage/previousBackdrop", + "id": "Stage/getShaders()", + "memberId": "Stage/getShaders", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "previousBackdrop", + "methodName": "getShaders", "static": false, - "returnType": "void", + "returnType": "Shaders", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to the previous backdrop.", - "description": "Switch to the previous backdrop.", - "scratchblock": "switch backdrop to [previous backdrop v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the stage's shaders, applied to the picture of its world layers", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/previousBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getShaders", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum vorherigen Hintergrund" + "description": "Gibt die Shader der Bühne zurück; sie verändern das ganze Bild ohne die UI" } } }, { - "id": "Stage/randomBackdrop()", - "memberId": "Stage/randomBackdrop", + "id": "Stage/getTimer()", + "memberId": "Stage/getTimer", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "randomBackdrop", + "methodName": "getTimer", "static": false, - "returnType": "void", + "returnType": "Timer", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Switch to a random backdrop.", - "description": "Switch to a random backdrop.", - "scratchblock": "switch backdrop to [random backdrop v]", + "summary": "", + "description": "", + "scratchblock": "(timer)", "paramDocs": [], - "returns": null, + "returns": "this object's timer, counting game time since it was made or reset", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/randomBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTimer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zu einem zufälligen Hintergrund" + "description": "Gibt den Standard-Timer der Bühne zurück" } } }, { - "id": "Stage/remove(Sprite)", - "memberId": "Stage/remove", + "id": "Stage/getTransparency()", + "memberId": "Stage/getTransparency", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "getTransparency", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Sprite" - ], - "parameterNames": [ - "sprite" - ], - "params": [ - "Sprite sprite" - ], - "summary": "Removes the specified sprite from the stage.", - "description": "Removes the specified sprite from the stage.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "sprite: the sprite to be removed" - ], - "returns": null, + "paramDocs": [], + "returns": "the backdrop's transparency in percent", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Entfernt die Figur von der Bühne" - } - } + "translations": {} }, { - "id": "Stage/remove(Pen)", - "memberId": "Stage/remove", + "id": "Stage/getVolume()", + "memberId": "Stage/getVolume", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "getVolume", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Pen" - ], - "parameterNames": [ - "pen" - ], - "params": [ - "Pen pen" - ], - "summary": "Removes the specified pen from the stage.", - "description": "Removes the specified pen from the stage.", - "scratchblock": null, - "paramDocs": [ - "pen: the pen to be removed" - ], - "returns": null, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "(volume)", + "paramDocs": [], + "returns": "this object's volume from 0 to 100", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt den Stift von der Bühne" + "description": "Gibt die Lautstärke in Prozent zurück" } } }, { - "id": "Stage/remove(Text)", - "memberId": "Stage/remove", + "id": "Stage/getWidth()", + "memberId": "Stage/getWidth", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "getWidth", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Text" - ], - "parameterNames": [ - "text" - ], - "params": [ - "Text text" - ], - "summary": "Removes the specified text from the stage.", - "description": "Removes the specified text from the stage.", + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "text: the text to be removed" - ], - "returns": null, + "paramDocs": [], + "returns": "the stage's width in stage pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt den Text von der Bühne" + "description": "Gibt die Breite der Bühne in Pixeln zurück" } } }, { - "id": "Stage/remove(Class)", - "memberId": "Stage/remove", + "id": "Stage/hideVariable(String)", + "memberId": "Stage/hideVariable", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "remove", + "methodName": "hideVariable", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.Class" + "java.lang.String" ], "parameterNames": [ - "c" + "name" ], "params": [ - "Class c" + "String name" ], - "summary": "Removes all sprites of the specified class from the stage.", - "description": "Removes all sprites of the specified class from the stage.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "hide variable [name v]", "paramDocs": [ - "c: the class of the sprites to remove" + "name: the label of a variable to hide again" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/hideVariable", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Entfernt alle Figuren dieser Klasse von der Bühne, z.B. remove(Apfel.class)" - } - } + "translations": {} }, { - "id": "Stage/removeAll()", - "memberId": "Stage/removeAll", + "id": "Stage/isAsking()", + "memberId": "Stage/isAsking", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "removeAll", + "methodName": "isAsking", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes all elements from the stage.", - "description": "Removes all elements from the stage.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether a question is waiting for its answer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/removeAll", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isAsking", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt alle Figuren von der Bühne" + "description": "Gibt genau dann true zurück, wenn noch auf eine Antwort gewartet wird" } } }, { - "id": "Stage/run()", - "memberId": "Stage/run", + "id": "Stage/isKeyPressed(KeyCode)", + "memberId": "Stage/isKeyPressed", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "run", + "methodName": "isKeyPressed", "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Executes the main logic of the stage. This method should be overridden by\nsubclasses to define\nthe specific behavior of the stage.", - "description": "Executes the main logic of the stage. This method should be overridden by\nsubclasses to define\nthe specific behavior of the stage.", - "scratchblock": null, - "paramDocs": [], - "returns": null, + "returnType": "boolean", + "parameterTypes": [ + "org.openpatch.scratch.KeyCode" + ], + "parameterNames": [ + "key" + ], + "params": [ + "KeyCode key" + ], + "summary": "", + "description": "", + "scratchblock": "<key [space v] pressed?>", + "paramDocs": [ + "key: a key" + ], + "returns": "whether the key is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/run", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird in jedem Frame aufgerufen" + "description": "Gibt genau dann true zurück, wenn die Taste gerade gedrückt ist" } } }, { - "id": "Stage/setColor(double)", - "memberId": "Stage/setColor", + "id": "Stage/isMouseDown()", + "memberId": "Stage/isMouseDown", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setColor", + "methodName": "isMouseDown", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "h" - ], - "params": [ - "double h" - ], - "summary": "Sets the background color via a hue value", - "description": "Sets the background color via a hue value", - "scratchblock": null, - "paramDocs": [ - "h: a hue value [0...255]" - ], - "returns": null, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": "<mouse down?>", + "paramDocs": [], + "returns": "whether a mouse button is held down", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isMouseDown", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe über den Farbton (0 bis 255)" + "description": "Gibt genau dann true zurück, wenn eine Maustaste gedrückt ist" } } }, { - "id": "Stage/setColor(double,double,double)", - "memberId": "Stage/setColor", + "id": "Stage/isSoundPlaying(String)", + "memberId": "Stage/isSoundPlaying", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setColor", + "methodName": "isSoundPlaying", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ - "double", - "double", - "double" + "java.lang.String" ], "parameterNames": [ - "r", - "g", - "b" + "name" ], "params": [ - "double r", - "double g", - "double b" + "String name" ], - "summary": "Sets the background color via a rgb value", - "description": "Sets the background color via a rgb value", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" + "name: a sound's name" ], - "returns": null, + "returns": "whether it is playing", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/isSoundPlaying", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" + "description": "Gibt genau dann true zurück, wenn der Klang gerade abgespielt wird" } } }, { - "id": "Stage/setColor(Color)", - "memberId": "Stage/setColor", + "id": "Stage/nextBackdrop()", + "memberId": "Stage/nextBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setColor", + "methodName": "nextBackdrop", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the color of the stage.", - "description": "Sets the color of the stage.", - "scratchblock": null, - "paramDocs": [ - "c: the new color to be set" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the next backdrop, after the last to the first.", + "description": "Switches to the next backdrop, after the last to the first.", + "scratchblock": "next backdrop", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/nextBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe" + "description": "Wechselt zum nächsten Hintergrund" } } }, { - "id": "Stage/setCursor(String)", - "memberId": "Stage/setCursor", + "id": "Stage/pickRandom(int,int)", + "memberId": "Stage/pickRandom", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setCursor", + "methodName": "pickRandom", "static": false, - "returnType": "void", + "returnType": "int", "parameterTypes": [ - "java.lang.String" + "int", + "int" ], "parameterNames": [ - "path" + "from", + "to" ], "params": [ - "String path" + "int from", + "int to" ], - "summary": "Sets the cursor image for the stage.", - "description": "Sets the cursor image for the stage.", - "scratchblock": null, + "summary": "A random whole number between two numbers, both included.", + "description": "A random whole number between two numbers, both included.", + "scratchblock": "(pick random (from) to (to))", "paramDocs": [ - "path: a path to an image file, or the name of a built-in sprite" + "from: the lowest", + "to: the highest" ], - "returns": null, + "returns": "the number", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/pickRandom", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt das Mauszeigerbild" + "description": "Gibt eine Zufallszahl zwischen from und to zurück (beide eingeschlossen)" } } }, { - "id": "Stage/setCursor(String,int,int)", - "memberId": "Stage/setCursor", + "id": "Stage/playSound(String)", + "memberId": "Stage/playSound", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setCursor", + "methodName": "playSound", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "path", - "x", - "y" + "name" ], "params": [ - "String path", - "int x", - "int y" + "String name" ], - "summary": "Sets the cursor image and its active spot coordinates.", - "description": "Sets the cursor image and its active spot coordinates.", - "scratchblock": null, + "summary": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "description": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", + "scratchblock": "start sound [name v]", "paramDocs": [ - "path: a path to an image file, or the name of a built-in sprite", - "x: the x-coordinate of the cursor's active spot", - "y: the y-coordinate of the cursor's active spot" + "name: the sound's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt das Mauszeigerbild mit eigenem Aktivpunkt" + "description": "Spielt einen zuvor hinzugefügten Klang ab" } } }, { - "id": "Stage/setDebug(boolean)", - "memberId": "Stage/setDebug", + "id": "Stage/playSoundCopy(String,double)", + "memberId": "Stage/playSoundCopy", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setDebug", + "methodName": "playSoundCopy", "static": false, - "returnType": "void", + "returnType": "SoundPlayback", "parameterTypes": [ - "boolean" + "java.lang.String", + "double" ], "parameterNames": [ - "debug" + "name", + "volume" ], "params": [ - "boolean debug" + "String name", + "double volume" ], - "summary": "Enables or disables the debug mode for the application.", - "description": "Enables or disables the debug mode for the application.", + "summary": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "description": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", "scratchblock": null, "paramDocs": [ - "debug: a boolean value where `true` enables debug mode and\n `false` disables\n it." + "name: the sound's name", + "volume: the copy's volume from 0 to 100" ], + "returns": "the copy, to stop it or change its volume", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/playSoundCopy", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/previousBackdrop()", + "memberId": "Stage/previousBackdrop", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "previousBackdrop", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the previous backdrop, before the first to the last.", + "description": "Switches to the previous backdrop, before the first to the last.", + "scratchblock": "switch backdrop to [previous backdrop v]", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setDebug", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/previousBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Schaltet die Ausgabe von debug() ein oder aus" + "description": "Wechselt zum vorherigen Hintergrund" } } }, { - "id": "Stage/setTint(double,double,double)", - "memberId": "Stage/setTint", + "id": "Stage/randomBackdrop()", + "memberId": "Stage/randomBackdrop", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setTint", + "methodName": "randomBackdrop", "static": false, "returnType": "void", - "parameterTypes": [ - "double", - "double", - "double" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "double r", - "double g", - "double b" - ], - "summary": "Sets the colour the backdrop is tinted with.", - "description": "Sets the colour the backdrop is tinted with.", - "scratchblock": null, - "paramDocs": [ - "r: a red value [0...255]", - "g: a green value [0...255]", - "b: a blue value [0...255]" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to a random backdrop other than the current one (if there is another).", + "description": "Switches to a random backdrop other than the current one (if there is another).", + "scratchblock": "switch backdrop to [random backdrop v]", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/randomBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt den Hintergrund ein (Anteile jeweils 0 bis 255)" + "description": "Wechselt zu einem zufälligen Hintergrund" } } }, { - "id": "Stage/setTint(double)", - "memberId": "Stage/setTint", + "id": "Stage/remove(Text)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setTint", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Text" ], "parameterNames": [ - "h" + "text" ], "params": [ - "double h" + "Text text" ], - "summary": "Sets the colour the backdrop is tinted with, as a hue.", - "description": "Sets the colour the backdrop is tinted with, as a hue.", - "scratchblock": "set [color v] effect to (h)", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "h: " + "text: a text of its own to remove" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTint", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Färbt den Hintergrund mit dem angegebenen Farbton ein (0 bis 255)" + "description": "Entfernt den Text von der Bühne" } } }, { - "id": "Stage/setTransparency(double)", - "memberId": "Stage/setTransparency", + "id": "Stage/remove(Sprite)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setTransparency", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Sprite" ], "parameterNames": [ - "transparency" + "sprite" ], "params": [ - "double transparency" + "Sprite sprite" ], - "summary": "Sets how see-through the backdrop is, as Scratch's ghost effect does: 0 is\nthe solid backdrop you start with and 100 is invisible.", - "description": "Sets how see-through the backdrop is, as Scratch's ghost effect does: 0 is\nthe solid backdrop you start with and 100 is invisible.", - "scratchblock": "set [ghost v] effect to (transparency)", + "summary": "Removes a sprite.", + "description": "Removes a sprite.", + "scratchblock": null, "paramDocs": [ - "transparency: [0...100], 0 solid and 100 invisible" + "sprite: the sprite" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Transparenz des Hintergrunds in Prozent" + "description": "Entfernt die Figur von der Bühne" } } }, { - "id": "Stage/setVolume(double)", - "memberId": "Stage/setVolume", + "id": "Stage/remove(Pen)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "setVolume", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Pen" ], "parameterNames": [ - "percent" + "pen" ], "params": [ - "double percent" + "Pen pen" ], - "summary": "Sets how loud every sound of this stage plays.", - "description": "Sets how loud every sound of this stage plays.", - "scratchblock": "set volume to (percent) %", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "percent: 0 for silent, 100 for full volume" + "pen: a pen of its own to remove" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setVolume", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Lautstärke in Prozent" + "description": "Entfernt den Stift von der Bühne" } } }, { - "id": "Stage/showVariable(String,Supplier)", - "memberId": "Stage/showVariable", + "id": "Stage/remove(Class)", + "memberId": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "showVariable", + "methodName": "remove", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.util.function.Supplier" + "java.lang.Class" ], "parameterNames": [ - "name", - "value" + "type" ], "params": [ - "String name", - "Supplier value" + "Class type" ], - "summary": "Shows a monitor for a variable in the top left corner of the stage, like\nScratch's variable monitors: the name and the current value, updated every\nframe. Showing the same name again replaces the monitor.", - "description": "Shows a monitor for a variable in the top left corner of the stage, like\nScratch's variable monitors: the name and the current value, updated every\nframe. Showing the same name again replaces the monitor.\n\n```java\nthis.showVariable(\"score\", () -> score);\n```", - "scratchblock": "show variable [name v]", + "summary": "Removes every sprite of a class (subclasses included).", + "description": "Removes every sprite of a class (subclasses included).", + "scratchblock": null, "paramDocs": [ - "name: what the monitor says", - "value: gives the value to show; asked for it every frame" + "type: the class" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/showVariable", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt den Wert einer Variablen auf der Bühne an" + "description": "Entfernt alle Figuren dieser Klasse von der Bühne, z.B. remove(Apfel.class)" } } }, { - "id": "Stage/stopAllSounds()", - "memberId": "Stage/stopAllSounds", + "id": "Stage/removeAll()", + "memberId": "Stage/removeAll", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "stopAllSounds", + "methodName": "removeAll", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Stops the playing of all sounds of the stage.", - "description": "Stops the playing of all sounds of the stage.", - "scratchblock": "stop all sounds", + "summary": "Removes every sprite, text and pen: an empty stage (backdrops and what was drawn stay).", + "description": "Removes every sprite, text and pen: an empty stage (backdrops and what was drawn stay).", + "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopAllSounds", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/removeAll", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Stoppt alle Klänge der Bühne" + "description": "Entfernt alle Figuren von der Bühne" } } }, { - "id": "Stage/stopSound(String)", - "memberId": "Stage/stopSound", + "id": "Stage/run()", + "memberId": "Stage/run", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "stopSound", + "methodName": "run", "static": false, "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Stops the playing of the sound with the given name", - "description": "Stops the playing of the sound with the given name", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Runs every tick before the sprites' `run()`. Override it with the stage's code.", + "description": "Runs every tick before the sprites' `run()`. Override it with the stage's code.", "scratchblock": null, - "paramDocs": [ - "name: Name of the sound" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopSound", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/run", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Stoppt den Klang mit dem angegebenen Namen" + "description": "Wird in jedem Frame aufgerufen" } } }, { - "id": "Stage/switchBackdrop(String)", - "memberId": "Stage/switchBackdrop", + "id": "Stage/setColor(Color)", + "memberId": "Stage/setColor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "switchBackdrop", + "methodName": "setColor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "name" + "color" ], "params": [ - "String name" + "Color color" ], - "summary": "Switch to a backdrop by name.", - "description": "Switch to a backdrop by name.", - "scratchblock": "switch backdrop to [name v]", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "name: the name of a backdrop" + "color: the colour behind the backdrop" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/switchBackdrop", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zum Hintergrund mit dem angegebenen Namen" + "description": "Setzt die Hintergrundfarbe" } } }, { - "id": "Stage/wait(int)", - "memberId": "Stage/wait", + "id": "Stage/setColor(double,double,double)", + "memberId": "Stage/setColor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "wait", + "methodName": "setColor", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double", + "double", + "double" ], "parameterNames": [ - "millis" + "red", + "green", + "blue" ], "params": [ - "int millis" + "double red", + "double green", + "double blue" ], - "summary": "Stop the execution of the whole applications for the given milliseconds.", - "description": "Stop the execution of the whole applications for the given milliseconds.", - "scratchblock": "wait (millis) seconds", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [ - "millis: Milliseconds" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/wait", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Pausiert das Programm für die angegebene Zeit in Millisekunden" + "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" } } }, { - "id": "Stage/waitUntil(BooleanSupplier)", - "memberId": "Stage/waitUntil", + "id": "Stage/setColorEffect(double)", + "memberId": "Stage/setColorEffect", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "waitUntil", + "methodName": "setColorEffect", "static": false, "returnType": "void", "parameterTypes": [ - "java.util.function.BooleanSupplier" + "double" ], "parameterNames": [ - "condition" + "value" ], "params": [ - "BooleanSupplier condition" + "double value" ], - "summary": "Waits until something becomes true, then carries on.", - "description": "Waits until something becomes true, then carries on.\n\nLike [wait(int)](wait) this holds up the code that calls it, not the whole\nprogram: sprites keep running and the stage keeps drawing while it waits.\nThat makes it useful for setting a scene up in a constructor, and a bad idea\ninside `run()`, which is called once per frame and should return quickly.\n\n```java\nthis.ask(\"What is your name?\");\nthis.waitUntil(() -> !this.isAsking());\nthis.display(\"Hello \" + this.getAnswer() + \"!\");\n```", - "scratchblock": "wait until <condition>", + "summary": "Scratch's colour effect on the backdrop: shifts its colours around the colour wheel (200 is\nall the way round). Like Scratch, it gives colours too grey or too dark to show a hue a\nlittle one, so white and black are tinted too.", + "description": "Scratch's colour effect on the backdrop: shifts its colours around the colour wheel (200 is\nall the way round). Like Scratch, it gives colours too grey or too dark to show a hue a\nlittle one, so white and black are tinted too.", + "scratchblock": "set [color v] effect to (value)", "paramDocs": [ - "condition: checked over and over until it is true" + "value: the effect" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/waitUntil", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setColorEffect", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wartet, bis die Bedingung erfüllt ist" - } - } + "translations": {} }, { - "id": "Stage/whenBackdropSwitches(String)", - "memberId": "Stage/whenBackdropSwitches", + "id": "Stage/setCursor(String)", + "memberId": "Stage/setCursor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenBackdropSwitches", + "methodName": "setCursor", "static": false, "returnType": "void", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "name" + "path" ], "params": [ - "String name" + "String path" ], - "summary": "This method is called when the backdrop switches to the specified name.\nOverride this method to\nadd custom behavior.", - "description": "This method is called when the backdrop switches to the specified name.\nOverride this method to\nadd custom behavior.", + "summary": "Shows an image instead of the mouse pointer while the mouse is over the stage.", + "description": "Shows an image instead of the mouse pointer while the mouse is over the stage.", "scratchblock": null, "paramDocs": [ - "name: the name of the backdrop to switch to" + "path: an image file, or a built-in sprite's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenBackdropSwitches", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Wechsel des Hintergrunds aufgerufen" + "description": "Setzt das Mauszeigerbild" } } }, { - "id": "Stage/whenIReceive(String)", - "memberId": "Stage/whenIReceive", + "id": "Stage/setCursor(String,int,int)", + "memberId": "Stage/setCursor", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenIReceive", + "methodName": "setCursor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "int", + "int" ], "parameterNames": [ - "message" + "path", + "x", + "y" ], "params": [ - "String message" + "String path", + "int x", + "int y" ], - "summary": "This method is called when a specific message is received. Override this\nmethod to add custom\nbehavior.", - "description": "This method is called when a specific message is received. Override this\nmethod to add custom\nbehavior.", - "scratchblock": "when I receive [message v]", + "summary": "Shows an image instead of the mouse pointer.", + "description": "Shows an image instead of the mouse pointer.", + "scratchblock": null, "paramDocs": [ - "message: The message that triggers this method." + "path: an image file, or a built-in sprite's name", + "x: pixels from the image's left edge to the point that clicks", + "y: pixels from the image's top edge to the point that clicks" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenIReceive", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setCursor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei broadcast(message) aufgerufen" + "description": "Setzt das Mauszeigerbild mit eigenem Aktivpunkt" } } }, { - "id": "Stage/whenKeyPressed(KeyCode)", - "memberId": "Stage/whenKeyPressed", + "id": "Stage/setTint(Color)", + "memberId": "Stage/setTint", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenKeyPressed", + "methodName": "setTint", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "keyCode" + "color" ], "params": [ - "KeyCode keyCode" + "Color color" ], - "summary": "This method is called when a key is pressed. Override this method to add\ncustom behavior.", - "description": "This method is called when a key is pressed. Override this method to add\ncustom behavior.", - "scratchblock": "when [space v] key pressed", + "summary": "Multiplies the backdrop by a colour. Not a Scratch block: Scratch's colour effect is\n[setColorEffect(double)](setColorEffect).", + "description": "Multiplies the backdrop by a colour. Not a Scratch block: Scratch's colour effect is\n[setColorEffect(double)](setColorEffect).", + "scratchblock": null, "paramDocs": [ - "keyCode: the key that was pressed" + "color: the tint, or null for none" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyPressed", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTint", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird beim Drücken der Taste aufgerufen" - } - } + "translations": {} }, { - "id": "Stage/whenKeyReleased(KeyCode)", - "memberId": "Stage/whenKeyReleased", + "id": "Stage/setTransparency(double)", + "memberId": "Stage/setTransparency", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenKeyReleased", + "methodName": "setTransparency", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.KeyCode" + "double" ], "parameterNames": [ - "keyCode" + "percent" ], "params": [ - "KeyCode keyCode" + "double percent" ], - "summary": "This method is called when a key is released. Override this method to add\ncustom behavior.", - "description": "This method is called when a key is released. Override this method to add\ncustom behavior.", - "scratchblock": null, + "summary": "Scratch's ghost effect on the backdrop: the stage colour shows through.", + "description": "Scratch's ghost effect on the backdrop: the stage colour shows through.", + "scratchblock": "set [ghost v] effect to (transparency)", "paramDocs": [ - "keyCode: the key that was released" + "percent: 0 opaque, 100 invisible" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyReleased", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setTransparency", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Loslassen der Taste aufgerufen" + "description": "Setzt die Transparenz des Hintergrunds in Prozent" } } }, { - "id": "Stage/whenMouseClicked(MouseCode)", - "memberId": "Stage/whenMouseClicked", + "id": "Stage/setVolume(double)", + "memberId": "Stage/setVolume", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenMouseClicked", + "methodName": "setVolume", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.MouseCode" + "double" ], "parameterNames": [ - "mouseEvent" + "volume" ], "params": [ - "MouseCode mouseEvent" + "double volume" ], - "summary": "This method is called when a mouse click event occurs. Overwrite this method\nto add custom\nbehavior.", - "description": "This method is called when a mouse click event occurs. Overwrite this method\nto add custom\nbehavior.", - "scratchblock": "when stage clicked", + "summary": "", + "description": "", + "scratchblock": "set volume to (percent) %", "paramDocs": [ - "mouseEvent: The mouse event that triggered this method." + "volume: this object's volume from 0 to 100" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseClicked", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/setVolume", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird bei einem Mausklick aufgerufen" + "description": "Setzt die Lautstärke in Prozent" } } }, { - "id": "Stage/whenMouseWheelMoved(int)", - "memberId": "Stage/whenMouseWheelMoved", + "id": "Stage/showVariable(String,Supplier)", + "memberId": "Stage/showVariable", "owner": "org.openpatch.scratch.Stage", "className": "Stage", - "methodName": "whenMouseWheelMoved", + "methodName": "showVariable", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "java.lang.String", + "java.util.function.Supplier" ], "parameterNames": [ - "steps" + "name", + "value" ], "params": [ - "int steps" + "String name", + "Supplier value" ], - "summary": "This method is called when the mouse wheel is moved. Overwrite this method to\nadd custom\nbehavior.", - "description": "This method is called when the mouse wheel is moved. Overwrite this method to\nadd custom\nbehavior.", - "scratchblock": null, + "summary": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.", + "description": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.\n\n```java\nthis.showVariable(\"score\", () -> this.score);\n```", + "scratchblock": "show variable [name v]", "paramDocs": [ - "steps: the number of steps the mouse wheel has moved. Positive values\n indicate movement\n away from the user, while negative values indicate movement\n towards the user." + "name: the label", + "value: gives the value to show" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseWheelMoved", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/showVariable", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird beim Drehen des Mausrads aufgerufen" + "description": "Zeigt den Wert einer Variablen auf der Bühne an" } } }, { - "id": "Text/addFont(String,String)", - "memberId": "Text/addFont", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "addFont", + "id": "Stage/sortBy(Comparator)", + "memberId": "Stage/sortBy", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "sortBy", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "java.util.Comparator" ], "parameterNames": [ - "name", - "path" + "comparator" ], "params": [ - "String name", - "String path" + "Comparator comparator" ], - "summary": "Adds a new font to the list of fonts if it does not already exist.", - "description": "Adds a new font to the list of fonts if it does not already exist.", + "summary": "Draws and runs the sprites of each layer in the order a comparator gives, back to front.", + "description": "Draws and runs the sprites of each layer in the order a comparator gives, back to front.", "scratchblock": null, "paramDocs": [ - "name: the name of the font to be added", - "path: the path to the font file" + "comparator: the order" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/addFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/sortBy", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/sortByY()", + "memberId": "Stage/sortByY", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "sortByY", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Draws and runs the sprites of each layer sorted by their y position: lower sprites in front,\nas in a top-down game. Applies from the next tick on, until [stopSorting()](stopSorting).", + "description": "Draws and runs the sprites of each layer sorted by their y position: lower sprites in front,\nas in a top-down game. Applies from the next tick on, until [stopSorting()](stopSorting).", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/sortByY", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/stopAllSounds()", + "memberId": "Stage/stopAllSounds", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "stopAllSounds", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Stops every sound this object started.", + "description": "Stops every sound this object started.", + "scratchblock": "stop all sounds", + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopAllSounds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Fügt eine Schriftart hinzu" + "description": "Stoppt alle Klänge der Bühne" } } }, { - "id": "Text/constructor()", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/stopSorting()", + "memberId": "Stage/stopSorting", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "stopSorting", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Text object with default values. The text is initialized to an empty string,\npositioned at (0, 0), with a default size of 0. The text style is set to plain and the text\nis centred on its position, as every text is. Call [setAlign(TextAlign)](setAlign) for anything\nelse.", - "description": "Constructs a new Text object with default values. The text is initialized to an empty string,\npositioned at (0, 0), with a default size of 0. The text style is set to plain and the text\nis centred on its position, as every text is. Call [setAlign(TextAlign)](setAlign) for anything\nelse.", + "summary": "Keeps the order the sprites have now and stops sorting them.", + "description": "Keeps the order the sprites have now and stops sorting them.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopSorting", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Stage/stopSound(String)", + "memberId": "Stage/stopSound", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "stopSound", + "static": false, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "name" + ], + "params": [ + "String name" + ], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [ + "name: the sound to stop" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/stopSound", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt einen leeren Text in der Mitte der Bühne" + "description": "Stoppt den Klang mit dem angegebenen Namen" } } }, { - "id": "Text/constructor(Sprite)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/switchBackdrop(String)", + "memberId": "Stage/switchBackdrop", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "switchBackdrop", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Sprite" + "java.lang.String" ], "parameterNames": [ - "s" + "name" ], "params": [ - "Sprite s" + "String name" ], - "summary": "Constructs a new Text object associated with a given Sprite.", - "description": "Constructs a new Text object associated with a given Sprite.", - "scratchblock": null, + "summary": "Switches to the backdrop with that name and tells the stage and every sprite\n(`whenBackdropSwitches`); an unknown name changes nothing.", + "description": "Switches to the backdrop with that name and tells the stage and every sprite\n(`whenBackdropSwitches`); an unknown name changes nothing.", + "scratchblock": "switch backdrop to [name v]", "paramDocs": [ - "s: the Sprite to associate with this Text object" + "name: the backdrop's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/switchBackdrop", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt einen Text an der angegebenen Position mit der angegebenen Breite" + "description": "Wechselt zum Hintergrund mit dem angegebenen Namen" } } }, { - "id": "Text/constructor(String,double,double,double)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/waitSeconds(double)", + "memberId": "Stage/waitSeconds", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "waitSeconds", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double", - "double", "double" ], "parameterNames": [ - "text", - "x", - "y", - "width" + "seconds" ], "params": [ - "String text", - "double x", - "double y", - "double width" + "double seconds" ], - "summary": "Constructs a new Text object with the specified text, position, and width.", - "description": "Constructs a new Text object with the specified text, position, and width.", + "summary": "Holds up the code that calls it for a number of seconds. Called in `main` (a program\nwritten straight down the page), the game keeps running meanwhile and the seconds are game\ntime. Called in `run()` or an event, the whole game waits, as it does for any slow\ncode; the window stays responsive.", + "description": "Holds up the code that calls it for a number of seconds. Called in `main` (a program\nwritten straight down the page), the game keeps running meanwhile and the seconds are game\ntime. Called in `run()` or an event, the whole game waits, as it does for any slow\ncode; the window stays responsive.", "scratchblock": null, "paramDocs": [ - "text: the text to be displayed", - "x: the x-coordinate of the text's position", - "y: the y-coordinate of the text's position", - "width: the width of the text" + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/waitSeconds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Text/constructor(String,double,double,double,TextStyle)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/waitUntil(BooleanSupplier)", + "memberId": "Stage/waitUntil", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "waitUntil", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double", - "double", - "double", - "org.openpatch.scratch.TextStyle" + "java.util.function.BooleanSupplier" ], "parameterNames": [ - "text", - "x", - "y", - "width", - "style" + "condition" ], "params": [ - "String text", - "double x", - "double y", - "double width", - "TextStyle style" + "BooleanSupplier condition" ], - "summary": "Constructs a new Text object with the specified text, position, width, and style.", - "description": "Constructs a new Text object with the specified text, position, width, and style.", - "scratchblock": null, + "summary": "Holds up the code that calls it until a condition is true; see [waitSeconds(double)](waitSeconds).", + "description": "Holds up the code that calls it until a condition is true; see [waitSeconds(double)](waitSeconds).", + "scratchblock": "wait until <condition>", "paramDocs": [ - "text: the text content to be displayed", - "x: the x-coordinate of the text's position", - "y: the y-coordinate of the text's position", - "width: the width of the text area", - "style: the style to be applied to the text" + "condition: checked about every millisecond" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/waitUntil", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt einen Text an der angegebenen Position, mit der angegebenen Breite und im angegebenen Stil" + "description": "Wartet, bis die Bedingung erfüllt ist" } } }, { - "id": "Text/constructor(Text)", - "memberId": "Text/constructor", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "constructor", + "id": "Stage/whenBackdropSwitches(String)", + "memberId": "Stage/whenBackdropSwitches", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenBackdropSwitches", "static": false, - "returnType": "Text", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Text" + "java.lang.String" ], "parameterNames": [ - "t" + "name" ], "params": [ - "Text t" + "String name" ], - "summary": "Copy constructor for the Text class. Creates a new Text object by copying the properties of the\ngiven Text object.", - "description": "Copy constructor for the Text class. Creates a new Text object by copying the properties of the\ngiven Text object.", + "summary": "Called when the backdrop switches.", + "description": "Called when the backdrop switches.", "scratchblock": null, "paramDocs": [ - "t: the Text object to copy" + "name: the new backdrop's name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Text/getAlign()", - "memberId": "Text/getAlign", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getAlign", - "static": false, - "returnType": "TextAlign", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns where the text sits relative to its position.", - "description": "Returns where the text sits relative to its position.", - "scratchblock": null, - "paramDocs": [], - "returns": "the alignment", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getAlign", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenBackdropSwitches", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Ausrichtung des Texts zurück" + "description": "Wird beim Wechsel des Hintergrunds aufgerufen" } } }, { - "id": "Text/getCurrentFontIndex()", - "memberId": "Text/getCurrentFontIndex", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getCurrentFontIndex", + "id": "Stage/whenIReceive(String)", + "memberId": "Stage/whenIReceive", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenIReceive", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the index of the current font.", - "description": "Returns the index of the current font.", - "scratchblock": null, - "paramDocs": [], - "returns": "the index of the current font", + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "message" + ], + "params": [ + "String message" + ], + "summary": "Called when a message is broadcast.", + "description": "Called when a message is broadcast.", + "scratchblock": "when I receive [message v]", + "paramDocs": [ + "message: the message" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontIndex", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenIReceive", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Nummer der aktuellen Schriftart zurück" + "description": "Wird bei broadcast(message) aufgerufen" } } }, { - "id": "Text/getCurrentFontName()", - "memberId": "Text/getCurrentFontName", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getCurrentFontName", + "id": "Stage/whenKeyPressed(KeyCode)", + "memberId": "Stage/whenKeyPressed", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenKeyPressed", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the name of the current font.", - "description": "Retrieves the name of the current font.", - "scratchblock": null, - "paramDocs": [], - "returns": "the name of the current font, or `null` if no fonts are available.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt den Namen der aktuellen Schriftart zurück" - } - } - }, - { - "id": "Text/getDefaultFont()", - "memberId": "Text/getDefaultFont", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getDefaultFont", - "static": true, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the font that text is written in by default.", - "description": "Returns the font that text is written in by default.", - "scratchblock": null, - "paramDocs": [], - "returns": "the path to the font file", + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.KeyCode" + ], + "parameterNames": [ + "key" + ], + "params": [ + "KeyCode key" + ], + "summary": "Called when a key is pressed, once per press.", + "description": "Called when a key is pressed, once per press.", + "scratchblock": "when [space v] key pressed", + "paramDocs": [ + "key: the key" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Standardschriftart zurück" + "description": "Wird beim Drücken der Taste aufgerufen" } } }, { - "id": "Text/getDefaultFontSize()", - "memberId": "Text/getDefaultFontSize", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getDefaultFontSize", - "static": true, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the size text is written in by default.", - "description": "Returns the size text is written in by default.", + "id": "Stage/whenKeyReleased(KeyCode)", + "memberId": "Stage/whenKeyReleased", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenKeyReleased", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.KeyCode" + ], + "parameterNames": [ + "key" + ], + "params": [ + "KeyCode key" + ], + "summary": "Called when a key is released.", + "description": "Called when a key is released.", "scratchblock": null, - "paramDocs": [], - "returns": "the font size", + "paramDocs": [ + "key: the key" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFontSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenKeyReleased", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Standardschriftgröße zurück" + "description": "Wird beim Loslassen der Taste aufgerufen" } } }, { - "id": "Text/getFont()", - "memberId": "Text/getFont", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getFont", + "id": "Stage/whenMouseClicked(MouseCode)", + "memberId": "Stage/whenMouseClicked", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenMouseClicked", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the name of the font.", - "description": "Retrieves the name of the font.", - "scratchblock": null, - "paramDocs": [], - "returns": "the name of the font as a String.", + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.MouseCode" + ], + "parameterNames": [ + "button" + ], + "params": [ + "MouseCode button" + ], + "summary": "Called when a mouse button is pressed anywhere on the stage.", + "description": "Called when a mouse button is pressed anywhere on the stage.", + "scratchblock": "when stage clicked", + "paramDocs": [ + "button: the button" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseClicked", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Namen der aktuellen Schriftart zurück" + "description": "Wird bei einem Mausklick aufgerufen" } } }, { - "id": "Text/getPosition()", - "memberId": "Text/getPosition", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "getPosition", + "id": "Stage/whenMouseWheelMoved(double)", + "memberId": "Stage/whenMouseWheelMoved", + "owner": "org.openpatch.scratch.Stage", + "className": "Stage", + "methodName": "whenMouseWheelMoved", "static": false, - "returnType": "Vector2", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the current position as a Vector2 object.", - "description": "Retrieves the current position as a Vector2 object.", + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "steps" + ], + "params": [ + "double steps" + ], + "summary": "Called when the mouse wheel turns.", + "description": "Called when the mouse wheel turns.", "scratchblock": null, - "paramDocs": [], - "returns": "a Vector2 object representing the current x and y coordinates.", + "paramDocs": [ + "steps: notches; positive is towards the user" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Stage/whenMouseWheelMoved", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Position des Texts zurück" - } - } + "translations": {} }, { - "id": "Text/getStage()", - "memberId": "Text/getStage", + "id": "Text/addFont(String,String)", + "memberId": "Text/addFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getStage", + "methodName": "addFont", "static": false, - "returnType": "Stage", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Retrieves the current stage associated with this object.", - "description": "Retrieves the current stage associated with this object.", + "returnType": "void", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ], + "parameterNames": [ + "name", + "path" + ], + "params": [ + "String name", + "String path" + ], + "summary": "Adds a font this text can switch to; the first one added is used.", + "description": "Adds a font this text can switch to; the first one added is used.", "scratchblock": null, - "paramDocs": [], - "returns": "the current stage", + "paramDocs": [ + "name: the font's name", + "path: the TTF or OTF file" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/addFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Bühne zurück, auf der der Text liegt" + "description": "Fügt eine Schriftart hinzu" } } }, { - "id": "Text/getStyle()", - "memberId": "Text/getStyle", + "id": "Text/constructor()", + "memberId": "Text/constructor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getStyle", + "methodName": "constructor", "static": false, - "returnType": "TextStyle", + "returnType": "Text", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the style the text is drawn in.", - "description": "Returns the style the text is drawn in.", + "summary": "An empty plain text at (0, 0).", + "description": "An empty plain text at (0, 0).", "scratchblock": null, "paramDocs": [], - "returns": "the style, never null", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStyle", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt den Stil zurück, in dem der Text gezeichnet wird" + "description": "Erzeugt einen leeren Text in der Mitte der Bühne" } } }, { - "id": "Text/getTextSize()", - "memberId": "Text/getTextSize", + "id": "Text/constructor(String,double,double,double)", + "memberId": "Text/constructor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getTextSize", + "methodName": "constructor", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the size of the text.", - "description": "Returns the size of the text.", + "returnType": "Text", + "parameterTypes": [ + "java.lang.String", + "double", + "double", + "double" + ], + "parameterNames": [ + "text", + "x", + "y", + "width" + ], + "params": [ + "String text", + "double x", + "double y", + "double width" + ], + "summary": "A plain text.", + "description": "A plain text.", "scratchblock": null, - "paramDocs": [], - "returns": "the size of the text as an integer", + "paramDocs": [ + "text: what it says", + "x: x of its position", + "y: y of its position (the first line's baseline)", + "width: where lines wrap; 0 for no wrapping" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getTextSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Schriftgröße zurück" - } - } + "translations": {} }, { - "id": "Text/getWidth()", - "memberId": "Text/getWidth", + "id": "Text/constructor(String,double,double,double,TextStyle)", + "memberId": "Text/constructor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getWidth", + "methodName": "constructor", "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the width of the text.", - "description": "Returns the width of the text.", + "returnType": "Text", + "parameterTypes": [ + "java.lang.String", + "double", + "double", + "double", + "org.openpatch.scratch.TextStyle" + ], + "parameterNames": [ + "text", + "x", + "y", + "width", + "style" + ], + "params": [ + "String text", + "double x", + "double y", + "double width", + "TextStyle style" + ], + "summary": "A text in a style.", + "description": "A text in a style.", "scratchblock": null, - "paramDocs": [], - "returns": "the width of the text as a double", + "paramDocs": [ + "text: what it says", + "x: x of its position", + "y: y of its position: the first baseline for plain text, the bottom edge of a box", + "width: where lines wrap; 0 for no wrapping", + "style: plain, box, speech or thought bubble" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die Breite des Textfelds zurück" + "description": "Erzeugt einen Text an der angegebenen Position, mit der angegebenen Breite und im angegebenen Stil" } } }, { - "id": "Text/getX()", - "memberId": "Text/getX", + "id": "Text/getAlign()", + "memberId": "Text/getAlign", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getX", + "methodName": "getAlign", "static": false, - "returnType": "double", + "returnType": "TextAlign", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the x-coordinate of this object.", - "description": "Returns the x-coordinate of this object.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the x-coordinate as a double", + "returns": "the alignment", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getAlign", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die x-Position zurück" + "description": "Gibt die Ausrichtung des Texts zurück" } } }, { - "id": "Text/getY()", - "memberId": "Text/getY", + "id": "Text/getCurrentFontIndex()", + "memberId": "Text/getCurrentFontIndex", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "getY", + "methodName": "getCurrentFontIndex", "static": false, - "returnType": "double", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the y-coordinate of this object.", - "description": "Returns the y-coordinate of this object.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the y-coordinate as a double", + "returns": "the number of the font in use, counting from 0; -1 for the default font", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontIndex", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die y-Position zurück" + "description": "Gibt die Nummer der aktuellen Schriftart zurück" } } }, { - "id": "Text/goLayersBackwards(int)", - "memberId": "Text/goLayersBackwards", + "id": "Text/getCurrentFontName()", + "memberId": "Text/getCurrentFontName", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goLayersBackwards", + "methodName": "getCurrentFontName", "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the text backwards by a specified number of layers in the stage. If\nthe text is not on a stage, the method does nothing.", - "description": "Moves the text backwards by a specified number of layers in the stage. If\nthe text is not on a stage, the method does nothing.", - "scratchblock": "go [backward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the text backwards" - ], - "returns": null, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the name of the font in use, or null for the default font", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersBackwards", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getCurrentFontName", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Schiebt den Text um die angegebene Anzahl Ebenen nach hinten" + "description": "Gibt den Namen der aktuellen Schriftart zurück" } } }, { - "id": "Text/goLayersForwards(int)", - "memberId": "Text/goLayersForwards", + "id": "Text/getDefaultFont()", + "memberId": "Text/getDefaultFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goLayersForwards", - "static": false, - "returnType": "void", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "number" - ], - "params": [ - "int number" - ], - "summary": "Moves the text forward by a specified number of layers within its stage. If\nthe text is not on a stage, the method does nothing.", - "description": "Moves the text forward by a specified number of layers within its stage. If\nthe text is not on a stage, the method does nothing.", - "scratchblock": "go [forward v] (number) layers", - "paramDocs": [ - "number: the number of layers to move the text forward" - ], - "returns": null, + "methodName": "getDefaultFont", + "static": true, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the default font file", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersForwards", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Bringt den Text um die angegebene Anzahl Ebenen nach vorne" + "description": "Gibt die Standardschriftart zurück" } } }, { - "id": "Text/goToBackLayer()", - "memberId": "Text/goToBackLayer", + "id": "Text/getDefaultFontSize()", + "memberId": "Text/getDefaultFontSize", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goToBackLayer", - "static": false, - "returnType": "void", + "methodName": "getDefaultFontSize", + "static": true, + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves this text to the back layer of the stage, behind every other text on\nit. If the text is not on a stage, the method does nothing.", - "description": "Moves this text to the back layer of the stage, behind every other text on\nit. If the text is not on a stage, the method does nothing.\n\nTexts are drawn on top of the sprites, so this orders a text against the\nother texts rather than against the sprites.", - "scratchblock": "go to [back v] layer", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the default font size", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToBackLayer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getDefaultFontSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Schiebt den Text hinter die anderen Texte" + "description": "Gibt die Standardschriftgröße zurück" } } }, { - "id": "Text/goToFrontLayer()", - "memberId": "Text/goToFrontLayer", + "id": "Text/getFont()", + "memberId": "Text/getFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "goToFrontLayer", + "methodName": "getFont", "static": false, - "returnType": "void", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Moves this text to the front layer of the stage, in front of every other\ntext on it. If the text is not on a stage, the method does nothing.", - "description": "Moves this text to the front layer of the stage, in front of every other\ntext on it. If the text is not on a stage, the method does nothing.\n\nTexts are drawn on top of the sprites, so this orders a text against the\nother texts rather than against the sprites.", - "scratchblock": "go to [front v] layer", + "summary": "", + "description": "", + "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the font file, or null for the default font", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToFrontLayer", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Bringt den Text vor die anderen Texte" + "description": "Gibt den Namen der aktuellen Schriftart zurück" } } }, { - "id": "Text/isUI()", - "memberId": "Text/isUI", + "id": "Text/getLayer()", + "memberId": "Text/getLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "isUI", + "methodName": "getLayer", "static": false, - "returnType": "boolean", + "returnType": "Layer", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the current instance is a UI element.", - "description": "Checks if the current instance is a UI element.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "`true` if this instance is a UI element, `false` otherwise.", + "returns": "the layer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/isUI", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt genau dann true zurück, wenn der Text zur Benutzeroberfläche gehört" - } - } + "translations": {} }, { - "id": "Text/nextFont()", - "memberId": "Text/nextFont", + "id": "Text/getPosition()", + "memberId": "Text/getPosition", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "nextFont", + "methodName": "getPosition", "static": false, - "returnType": "void", + "returnType": "Vector2", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Advances to the next font in the list of available fonts. The current font index is incremented\nby one and wraps around to the beginning of the list if it exceeds the number of available\nfonts.", - "description": "Advances to the next font in the list of available fonts. The current font index is incremented\nby one and wraps around to the beginning of the list if it exceeds the number of available\nfonts.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/nextFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zur nächsten Schriftart" + "description": "Gibt die Position des Texts zurück" } } }, { - "id": "Text/remove()", - "memberId": "Text/remove", + "id": "Text/getStage()", + "memberId": "Text/getStage", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "remove", + "methodName": "getStage", "static": false, - "returnType": "void", + "returnType": "Stage", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes this object from its current stage if it is associated with one. If the object is not\nassociated with any stage, this method does nothing.", - "description": "Removes this object from its current stage if it is associated with one. If the object is not\nassociated with any stage, this method does nothing.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the stage the text is on (a sprite's text: the sprite's stage), or null", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/remove", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Entfernt den Text von der Bühne" + "description": "Gibt die Bühne zurück, auf der der Text liegt" } } }, { - "id": "Text/setAlign(TextAlign)", - "memberId": "Text/setAlign", + "id": "Text/getStyle()", + "memberId": "Text/getStyle", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setAlign", + "methodName": "getStyle", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.TextAlign" - ], - "parameterNames": [ - "align" - ], - "params": [ - "TextAlign align" - ], - "summary": "Sets the alignment of the text.", - "description": "Sets the alignment of the text.", + "returnType": "TextStyle", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "align: where the text should sit relative to its position" - ], - "returns": null, + "paramDocs": [], + "returns": "the style", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setAlign", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getStyle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, wie der Text zu seiner Position ausgerichtet wird" + "description": "Gibt den Stil zurück, in dem der Text gezeichnet wird" } } }, { - "id": "Text/setBackgroundColor(int,int,int)", - "memberId": "Text/setBackgroundColor", + "id": "Text/getText()", + "memberId": "Text/getText", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setBackgroundColor", + "methodName": "getText", "static": false, - "returnType": "void", - "parameterTypes": [ - "int", - "int", - "int" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "int r", - "int g", - "int b" - ], - "summary": "Sets the background color using the specified RGB values.", - "description": "Sets the background color using the specified RGB values.", + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "r: the red component of the color (0-255)", - "g: the green component of the color (0-255)", - "b: the blue component of the color (0-255)" - ], - "returns": null, + "paramDocs": [], + "returns": "what the text says", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Hintergrundfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" - } - } + "translations": {} }, { - "id": "Text/setBackgroundColor(double)", - "memberId": "Text/setBackgroundColor", + "id": "Text/getTextSize()", + "memberId": "Text/getTextSize", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setBackgroundColor", + "methodName": "getTextSize", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "h" - ], - "params": [ - "double h" - ], - "summary": "Sets the background color using the specified hue value.", - "description": "Sets the background color using the specified hue value.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "h: the hue value for the background color" - ], - "returns": null, + "paramDocs": [], + "returns": "the font size, or the default", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getTextSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe über den Farbton (0 bis 255)" + "description": "Gibt die Schriftgröße zurück" } } }, { - "id": "Text/setBackgroundColor(Color)", - "memberId": "Text/setBackgroundColor", + "id": "Text/getWidth()", + "memberId": "Text/getWidth", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setBackgroundColor", + "methodName": "getWidth", "static": false, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the background color of the text.", - "description": "Sets the background color of the text.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "c: the new background color to be set" - ], - "returns": null, + "paramDocs": [], + "returns": "where lines wrap; 0 for no wrapping", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Hintergrundfarbe" + "description": "Gibt die Breite des Textfelds zurück" } } }, { - "id": "Text/setFont(String)", - "memberId": "Text/setFont", + "id": "Text/getX()", + "memberId": "Text/getX", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setFont", + "methodName": "getX", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "name" - ], - "params": [ - "String name" - ], - "summary": "Sets the font name for the text.", - "description": "Sets the font name for the text.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "name: the name of the font to be set" - ], - "returns": null, + "paramDocs": [], + "returns": "x of the position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt zur Schriftart mit dem angegebenen Namen" + "description": "Gibt die x-Position zurück" } } }, { - "id": "Text/setIsUI(boolean)", - "memberId": "Text/setIsUI", + "id": "Text/getY()", + "memberId": "Text/getY", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setIsUI", + "methodName": "getY", "static": false, - "returnType": "void", - "parameterTypes": [ - "boolean" - ], - "parameterNames": [ - "isUI" - ], - "params": [ - "boolean isUI" - ], - "summary": "Sets the UI status of this object.", - "description": "Sets the UI status of this object.", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "isUI: a boolean indicating whether this object is part of the UI" - ], - "returns": null, + "paramDocs": [], + "returns": "y of the position", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setIsUI", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/getY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, ob der Text zur Benutzeroberfläche gehört und sich nicht mit der Kamera bewegt" + "description": "Gibt die y-Position zurück" } } }, { - "id": "Text/setPosition(double,double)", - "memberId": "Text/setPosition", + "id": "Text/goLayersBackwards(int)", + "memberId": "Text/goLayersBackwards", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setPosition", + "methodName": "goLayersBackwards", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "int" ], "parameterNames": [ - "x", - "y" + "number" ], "params": [ - "double x", - "double y" + "int number" ], - "summary": "Sets the position of the text", - "description": "Sets the position of the text", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "go [backward v] (number) layers", "paramDocs": [ - "x: a x coordinate", - "y: a y coordinate" + "number: how many texts to move behind" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersBackwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" + "description": "Schiebt den Text um die angegebene Anzahl Ebenen nach hinten" } } }, { - "id": "Text/setPosition(Vector2)", - "memberId": "Text/setPosition", + "id": "Text/goLayersForwards(int)", + "memberId": "Text/goLayersForwards", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setPosition", + "methodName": "goLayersForwards", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "int" ], "parameterNames": [ - "v" + "number" ], "params": [ - "Vector2 v" + "int number" ], - "summary": "Sets the position of the text object using a Vector2 object.", - "description": "Sets the position of the text object using a Vector2 object.", - "scratchblock": null, + "summary": "", + "description": "", + "scratchblock": "go [forward v] (number) layers", "paramDocs": [ - "v: the Vector2 object containing the x and y coordinates" + "number: how many texts to move in front of" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goLayersForwards", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" + "description": "Bringt den Text um die angegebene Anzahl Ebenen nach vorne" } } }, { - "id": "Text/setStrokeColor(int,int,int)", - "memberId": "Text/setStrokeColor", + "id": "Text/goToBackLayer()", + "memberId": "Text/goToBackLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStrokeColor", + "methodName": "goToBackLayer", "static": false, "returnType": "void", - "parameterTypes": [ - "int", - "int", - "int" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "int r", - "int g", - "int b" - ], - "summary": "Sets the stroke color using the specified RGB values.", - "description": "Sets the stroke color using the specified RGB values.", - "scratchblock": null, - "paramDocs": [ - "r: the red component of the color (0-255)", - "g: the green component of the color (0-255)", - "b: the blue component of the color (0-255)" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Draws this text behind the other texts.", + "description": "Draws this text behind the other texts.", + "scratchblock": "go to [back v] layer", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToBackLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Rahmenfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" + "description": "Schiebt den Text hinter die anderen Texte" } } }, { - "id": "Text/setStrokeColor(double)", - "memberId": "Text/setStrokeColor", + "id": "Text/goToFrontLayer()", + "memberId": "Text/goToFrontLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStrokeColor", + "methodName": "goToFrontLayer", "static": false, "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "h" - ], - "params": [ - "double h" - ], - "summary": "Sets the stroke color using the specified hue value.", - "description": "Sets the stroke color using the specified hue value.", - "scratchblock": null, - "paramDocs": [ - "h: the hue value for the stroke color" - ], + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Draws this text in front of the other texts.", + "description": "Draws this text in front of the other texts.", + "scratchblock": "go to [front v] layer", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/goToFrontLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Rahmenfarbe über den Farbton (0 bis 255)" + "description": "Bringt den Text vor die anderen Texte" } } }, { - "id": "Text/setStrokeColor(Color)", - "memberId": "Text/setStrokeColor", + "id": "Text/hide()", + "memberId": "Text/hide", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStrokeColor", + "methodName": "hide", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.Color" - ], - "parameterNames": [ - "c" - ], - "params": [ - "Color c" - ], - "summary": "Sets the stroke color for the text.", - "description": "Sets the stroke color for the text.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Hides the text.", + "description": "Hides the text.", "scratchblock": null, - "paramDocs": [ - "c: the color to set as the stroke color" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/hide", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Rahmenfarbe" - } - } + "translations": {} }, { - "id": "Text/setStyle(TextStyle)", - "memberId": "Text/setStyle", + "id": "Text/isVisible()", + "memberId": "Text/isVisible", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setStyle", + "methodName": "isVisible", + "static": false, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether the text is shown", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/isVisible", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Text/nextFont()", + "memberId": "Text/nextFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "nextFont", "static": false, "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.TextStyle" - ], - "parameterNames": [ - "style" - ], - "params": [ - "TextStyle style" - ], - "summary": "Sets the style of the text.", - "description": "Sets the style of the text.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Switches to the next font added, after the last to the first.", + "description": "Switches to the next font added, after the last to the first.", "scratchblock": null, - "paramDocs": [ - "style: the TextStyle to be applied to the text" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStyle", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/nextFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt fest, ob der Text als Kasten, Sprech- oder Denkblase dargestellt wird" + "description": "Wechselt zur nächsten Schriftart" } } }, { - "id": "Text/setTextColor(int,int,int)", - "memberId": "Text/setTextColor", + "id": "Text/remove()", + "memberId": "Text/remove", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextColor", + "methodName": "remove", "static": false, "returnType": "void", - "parameterTypes": [ - "int", - "int", - "int" - ], - "parameterNames": [ - "r", - "g", - "b" - ], - "params": [ - "int r", - "int g", - "int b" - ], - "summary": "Sets the text color using RGB values.", - "description": "Sets the text color using RGB values.", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Removes the text from its stage.", + "description": "Removes the text from its stage.", "scratchblock": null, - "paramDocs": [ - "r: the red component of the color (0-255)", - "g: the green component of the color (0-255)", - "b: the blue component of the color (0-255)" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/remove", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Schriftfarbe aus Rot-, Grün- und Blauanteil (jeweils 0 bis 255)" + "description": "Entfernt den Text von der Bühne" } } }, { - "id": "Text/setTextColor(double)", - "memberId": "Text/setTextColor", + "id": "Text/setAlign(TextAlign)", + "memberId": "Text/setAlign", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextColor", + "methodName": "setAlign", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.TextAlign" ], "parameterNames": [ - "h" + "align" ], "params": [ - "double h" + "TextAlign align" ], - "summary": "Sets the text color using the specified hue value.", - "description": "Sets the text color using the specified hue value.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "h: the hue value for the text color" + "align: how lines sit relative to the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setAlign", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Schriftfarbe über den Farbton (0 bis 255)" + "description": "Legt fest, wie der Text zu seiner Position ausgerichtet wird" } } }, { - "id": "Text/setTextColor(Color)", - "memberId": "Text/setTextColor", + "id": "Text/setBackgroundColor(Color)", + "memberId": "Text/setBackgroundColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextColor", + "methodName": "setBackgroundColor", "static": false, "returnType": "void", "parameterTypes": [ "org.openpatch.scratch.Color" ], "parameterNames": [ - "c" + "color" ], "params": [ - "Color c" + "Color color" ], - "summary": "Sets the color of the text.", - "description": "Sets the color of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "c: the new color to be set for the text" + "color: the fill of a box or bubble" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Schriftfarbe" + "description": "Setzt die Hintergrundfarbe" } } }, { - "id": "Text/setTextSize(int)", - "memberId": "Text/setTextSize", + "id": "Text/setBackgroundColor(double,double,double)", + "memberId": "Text/setBackgroundColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setTextSize", + "methodName": "setBackgroundColor", "static": false, "returnType": "void", "parameterTypes": [ - "int" + "double", + "double", + "double" ], "parameterNames": [ - "size" + "red", + "green", + "blue" ], "params": [ - "int size" + "double red", + "double green", + "double blue" ], - "summary": "Sets the size of the text.", - "description": "Sets the size of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "size: the new size of the text" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextSize", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setBackgroundColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die Schriftgröße" - } - } + "translations": {} }, { - "id": "Text/setWidth(double)", - "memberId": "Text/setWidth", + "id": "Text/setFont(String)", + "memberId": "Text/setFont", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setWidth", + "methodName": "setFont", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "width" + "path" ], "params": [ - "double width" + "String path" ], - "summary": "Sets the width of the text.", - "description": "Sets the width of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "width: the new width to set" + "path: the font file for this text, or null for the default font" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Breite des Textfelds; längere Texte werden umgebrochen" + "description": "Wechselt zur Schriftart mit dem angegebenen Namen" } } }, { - "id": "Text/setX(double)", - "memberId": "Text/setX", + "id": "Text/setLayer(Layer)", + "memberId": "Text/setLayer", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setX", + "methodName": "setLayer", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.Layer" ], "parameterNames": [ - "x" + "layer" ], "params": [ - "double x" + "Layer layer" ], - "summary": "Sets the x-coordinate for this object.", - "description": "Sets the x-coordinate for this object.", + "summary": "Moves the text to another layer: [Layer.UI](../Layer/UI) keeps it in place when the camera moves;\nany other layer puts it into the world, in front of the foreground.", + "description": "Moves the text to another layer: [Layer.UI](../Layer/UI) keeps it in place when the camera moves;\nany other layer puts it into the world, in front of the foreground.", "scratchblock": null, "paramDocs": [ - "x: the new x-coordinate value" + "layer: the layer" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Setzt die x-Position" - } - } + "translations": {} }, { - "id": "Text/setY(double)", - "memberId": "Text/setY", + "id": "Text/setPosition(double,double)", + "memberId": "Text/setPosition", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "setY", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ + "double", "double" ], "parameterNames": [ + "x", "y" ], "params": [ + "double x", "double y" ], - "summary": "Sets the Y coordinate of the text.", - "description": "Sets the Y coordinate of the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "y: the new Y coordinate value" + "x: x of the position", + "y: y of the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die y-Position" + "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Text/showText(String)", - "memberId": "Text/showText", + "id": "Text/setPosition(Vector2)", + "memberId": "Text/setPosition", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "showText", + "methodName": "setPosition", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Vector2" ], "parameterNames": [ - "text" + "position" ], "params": [ - "String text" + "Vector2 position" ], - "summary": "Displays the specified text.", - "description": "Displays the specified text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "text: The text to be displayed. If the text is null or empty, the text will be set to\n null." + "position: the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setPosition", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt den Text an" + "description": "Setzt den Text an die angegebene Position (Mitte der Bühne ist 0/0)" } } }, { - "id": "Text/showText(String,int)", - "memberId": "Text/showText", + "id": "Text/setStrokeColor(Color)", + "memberId": "Text/setStrokeColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "showText", + "methodName": "setStrokeColor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "text", - "millis" + "color" ], "params": [ - "String text", - "int millis" + "Color color" ], - "summary": "Displays the specified text for a given duration.", - "description": "Displays the specified text for a given duration.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "text: The text to be displayed.", - "millis: The duration in milliseconds for which the text should be displayed." + "color: the outline of a box or bubble" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Zeigt den Text für die angegebene Zeit in Millisekunden an" + "description": "Setzt die Rahmenfarbe" } } }, { - "id": "Text/switchFont(String)", - "memberId": "Text/switchFont", + "id": "Text/setStrokeColor(double,double,double)", + "memberId": "Text/setStrokeColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "switchFont", + "methodName": "setStrokeColor", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "double", + "double", + "double" ], "parameterNames": [ - "name" + "red", + "green", + "blue" ], "params": [ - "String name" + "double red", + "double green", + "double blue" ], - "summary": "Switches the current font to the font with the specified name.", - "description": "Switches the current font to the font with the specified name.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the font to switch to" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/switchFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStrokeColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wechselt zur Schriftart mit dem angegebenen Namen" - } - } + "translations": {} }, { - "id": "Text/useFont(String,int)", - "memberId": "Text/useFont", + "id": "Text/setStyle(TextStyle)", + "memberId": "Text/setStyle", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useFont", - "static": true, + "methodName": "setStyle", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "org.openpatch.scratch.TextStyle" ], "parameterNames": [ - "path", - "size" + "style" ], "params": [ - "String path", - "int size" + "TextStyle style" ], - "summary": "Chooses the font all text is written in, and how big it is.", - "description": "Chooses the font all text is written in, and how big it is.\n\nCall it before the first stage is created. The font is loaded while the\nwindow starts up, so choosing one later is not reliable.\n\n```java\npublic static void main(String[] args) {\n Text.useFont(\"assets/Retro Gaming.ttf\", 11);\n new MyStage();\n}\n```", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "path: the path to a .ttf or .otf file", - "size: the size to write in" + "style: plain, box, speech or thought bubble" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setStyle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt Schriftart und -größe für alle Texte fest" + "description": "Legt fest, ob der Text als Kasten, Sprech- oder Denkblase dargestellt wird" } } }, { - "id": "Text/useFont(String)", - "memberId": "Text/useFont", + "id": "Text/setTextColor(Color)", + "memberId": "Text/setTextColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useFont", - "static": true, + "methodName": "setTextColor", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "parameterNames": [ - "path" + "color" ], "params": [ - "String path" + "Color color" ], - "summary": "Chooses the font all text is written in, keeping the current size.", - "description": "Chooses the font all text is written in, keeping the current size.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "path: the path to a .ttf or .otf file" + "color: the colour of the letters" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Legt die Schriftart für alle Texte fest" + "description": "Setzt die Schriftfarbe" } } }, { - "id": "Text/useFontSizes(int[])", - "memberId": "Text/useFontSizes", + "id": "Text/setTextColor(double,double,double)", + "memberId": "Text/setTextColor", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useFontSizes", - "static": true, + "methodName": "setTextColor", + "static": false, "returnType": "void", "parameterTypes": [ - "int[]" + "double", + "double", + "double" ], "parameterNames": [ - "sizes" + "red", + "green", + "blue" ], "params": [ - "int[] sizes" + "double red", + "double green", + "double blue" ], - "summary": "Prepares several sizes of the font in advance. Only needed when text is\nshown at more than one size, so that every size looks sharp.", - "description": "Prepares several sizes of the font in advance. Only needed when text is\nshown at more than one size, so that every size looks sharp.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "sizes: the sizes to prepare" + "red: red from 0 to 255", + "green: green from 0 to 255", + "blue: blue from 0 to 255" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFontSizes", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextColor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "Text/useSmoothing(boolean)", - "memberId": "Text/useSmoothing", + "id": "Text/setTextSize(double)", + "memberId": "Text/setTextSize", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "useSmoothing", - "static": true, + "methodName": "setTextSize", + "static": false, "returnType": "void", "parameterTypes": [ - "boolean" + "double" ], "parameterNames": [ - "smooth" + "size" ], "params": [ - "boolean smooth" + "double size" ], - "summary": "Chooses whether letters are smoothed. Turn it off for pixel fonts.", - "description": "Chooses whether letters are smoothed. Turn it off for pixel fonts.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "smooth: true to smooth the letters" + "size: the font size in stage units (in pixel-art mode rounded to whole font pixels when\n drawn)" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useSmoothing", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt fest, ob Schrift geglättet wird" - } - } - }, - { - "id": "Text/whenAddedToStage()", - "memberId": "Text/whenAddedToStage", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "whenAddedToStage", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the object is added to the stage. Override this method to define\ncustom behavior when the object is added to the stage.", - "description": "This method is called when the object is added to the stage. Override this method to define\ncustom behavior when the object is added to the stage.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenAddedToStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setTextSize", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" - } - } + "translations": {} }, { - "id": "Text/whenAddedToStage(Stage)", - "memberId": "Text/whenAddedToStage", + "id": "Text/setWidth(double)", + "memberId": "Text/setWidth", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "whenAddedToStage", + "methodName": "setWidth", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Stage" + "double" ], "parameterNames": [ - "stage" + "width" ], "params": [ - "Stage stage" + "double width" ], - "summary": "This method is called when the text is added to the stage. Override this method to define\ncustom behavior when the text.", - "description": "This method is called when the text is added to the stage. Override this method to define\ncustom behavior when the text.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "stage: The stage to which the text is added." + "width: where lines wrap, in stage units; 0 for no wrapping" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenAddedToStage", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" - } - } - }, - { - "id": "Text/whenRemovedFromStage()", - "memberId": "Text/whenRemovedFromStage", - "owner": "org.openpatch.scratch.Text", - "className": "Text", - "methodName": "whenRemovedFromStage", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the object is removed from the stage. Override this method to define\ncustom behavior that should occur when the object is no longer part of the stage.", - "description": "This method is called when the object is removed from the stage. Override this method to define\ncustom behavior that should occur when the object is no longer part of the stage.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenRemovedFromStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" + "description": "Setzt die Breite des Textfelds; längere Texte werden umgebrochen" } } }, { - "id": "Text/whenRemovedFromStage(Stage)", - "memberId": "Text/whenRemovedFromStage", + "id": "Text/setX(double)", + "memberId": "Text/setX", "owner": "org.openpatch.scratch.Text", "className": "Text", - "methodName": "whenRemovedFromStage", + "methodName": "setX", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Stage" + "double" ], "parameterNames": [ - "stage" + "x" ], "params": [ - "Stage stage" + "double x" ], - "summary": "This method is called when the text is removed from the stage. Override this method to define\ncustom behavior that should occur.", - "description": "This method is called when the text is removed from the stage. Override this method to define\ncustom behavior that should occur.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "stage: The stage from which the text is removed." + "x: x of the position" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenRemovedFromStage", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setX", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" + "description": "Setzt die x-Position" } } }, { - "id": "Timer/afterMillis(int)", - "memberId": "Timer/afterMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "afterMillis", + "id": "Text/setY(double)", + "memberId": "Text/setY", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "setY", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int" + "double" ], "parameterNames": [ - "millis" + "y" ], "params": [ - "int millis" + "double y" ], - "summary": "Checks if the specified number of milliseconds has passed since the method was first called.", - "description": "Checks if the specified number of milliseconds has passed since the method was first called.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "millis: the number of milliseconds to check against" + "y: y of the position" ], - "returns": "true if the specified number of milliseconds has passed since the method was first\n called, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/afterMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/setY", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt true zurück, sobald seit dem Zurücksetzen millis Millisekunden vergangen sind" + "description": "Setzt die y-Position" } } }, { - "id": "Timer/constructor()", - "memberId": "Timer/constructor", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "constructor", + "id": "Text/show()", + "memberId": "Text/show", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "show", "static": false, - "returnType": "Timer", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Timer object.", - "description": "Constructs a new Timer object.", + "summary": "Shows the text.", + "description": "Shows the text.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt einen neuen Timer" - } - } - }, - { - "id": "Timer/everyMillis(int)", - "memberId": "Timer/everyMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "everyMillis", - "static": false, - "returnType": "boolean", - "parameterTypes": [ - "int" - ], - "parameterNames": [ - "millis" - ], - "params": [ - "int millis" - ], - "summary": "Checks if the specified number of milliseconds has passed since the last time this method\nreturned true.", - "description": "Checks if the specified number of milliseconds has passed since the last time this method\nreturned true.", - "scratchblock": null, - "paramDocs": [ - "millis: The number of milliseconds to wait before returning true." - ], - "returns": "true if the specified number of milliseconds has passed since the last call that\n returned true, false otherwise.", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/everyMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/show", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt alle millis Millisekunden einmal true zurück" - } - } + "translations": {} }, { - "id": "Timer/forMillis(int)", - "memberId": "Timer/forMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "forMillis", + "id": "Text/showText(String)", + "memberId": "Text/showText", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "showText", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int" + "java.lang.String" ], "parameterNames": [ - "millis" + "text" ], "params": [ - "int millis" + "String text" ], - "summary": "Checks if the specified amount of milliseconds has passed since the method was first called. If\nthe method is called for the first time, it initializes the start time.", - "description": "Checks if the specified amount of milliseconds has passed since the method was first called. If\nthe method is called for the first time, it initializes the start time.", + "summary": "Shows the text with new words until it is changed or hidden.", + "description": "Shows the text with new words until it is changed or hidden.", "scratchblock": null, "paramDocs": [ - "millis: the number of milliseconds to check against" + "text: what it says; an empty text hides a bubble" ], - "returns": "true if the current time is less than the start time plus the specified milliseconds,\n false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/forMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt für die ersten millis Millisekunden nach dem Zurücksetzen true zurück" + "description": "Zeigt den Text an" } } }, { - "id": "Timer/intervalMillis(int)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", + "id": "Text/showText(String,double)", + "memberId": "Text/showText", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "showText", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int" + "java.lang.String", + "double" ], "parameterNames": [ - "millis" + "text", + "seconds" ], "params": [ - "int millis" + "String text", + "double seconds" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "Shows the text for a number of seconds of game time, then hides it.", + "description": "Shows the text for a number of seconds of game time, then hides it.", "scratchblock": null, "paramDocs": [ - "millis: the interval in milliseconds to check" + "text: what it says", + "seconds: how long" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/showText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wechselt alle millis Millisekunden zwischen true und false" - } - } + "translations": {} }, { - "id": "Timer/intervalMillis(int,boolean)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", + "id": "Text/switchFont(String)", + "memberId": "Text/switchFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "switchFont", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "int", - "boolean" + "java.lang.String" ], "parameterNames": [ - "millis", - "skipFirst" + "name" ], "params": [ - "int millis", - "boolean skipFirst" + "String name" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "millis: the interval in milliseconds to check", - "skipFirst: if true, the first interval will be skipped" + "name: the name of a font added with [addFont(String, String)](addFont)" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/switchFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Wechselt alle millis Millisekunden zwischen true und false; skipFirst überspringt das erste Intervall" + "description": "Wechselt zur Schriftart mit dem angegebenen Namen" } } }, { - "id": "Timer/intervalMillis(int,int)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", - "static": false, - "returnType": "boolean", + "id": "Text/useFont(String)", + "memberId": "Text/useFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "useFont", + "static": true, + "returnType": "void", "parameterTypes": [ - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "millis1", - "millis2" + "path" ], "params": [ - "int millis1", - "int millis2" + "String path" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "The font every text uses unless it sets its own, from now on. Without it, texts use Ubuntu\nMono, or Jersey 10 in pixel-art mode.", + "description": "The font every text uses unless it sets its own, from now on. Without it, texts use Ubuntu\nMono, or Jersey 10 in pixel-art mode.", "scratchblock": null, "paramDocs": [ - "millis1: the first interval in milliseconds to check", - "millis2: the second interval in milliseconds to check" + "path: a TTF or OTF file" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt millis1 Millisekunden lang true und danach millis2 Millisekunden lang false zurück" + "description": "Legt die Schriftart für alle Texte fest" } } }, { - "id": "Timer/intervalMillis(int,int,boolean)", - "memberId": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "intervalMillis", - "static": false, - "returnType": "boolean", + "id": "Text/useFont(String,double)", + "memberId": "Text/useFont", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "useFont", + "static": true, + "returnType": "void", "parameterTypes": [ - "int", - "int", - "boolean" + "java.lang.String", + "double" ], "parameterNames": [ - "millis1", - "millis2", - "skipFirst" + "path", + "pixelSize" ], "params": [ - "int millis1", - "int millis2", - "boolean skipFirst" + "String path", + "double pixelSize" ], - "summary": "Checks if the specified interval in milliseconds has passed.", - "description": "Checks if the specified interval in milliseconds has passed.", + "summary": "A pixel font as default font, with the size at which one of its pixels is one stage pixel:\nfor a pixel font whose outlines do not show its grid (most do: then [useFont(String)](useFont)\nis enough). In pixel-art mode sizes are rounded to whole pixels of it.", + "description": "A pixel font as default font, with the size at which one of its pixels is one stage pixel:\nfor a pixel font whose outlines do not show its grid (most do: then [useFont(String)](useFont)\nis enough). In pixel-art mode sizes are rounded to whole pixels of it.", "scratchblock": null, "paramDocs": [ - "millis1: the first interval in milliseconds to check", - "millis2: the second interval in milliseconds to check", - "skipFirst: if true, the first interval will be skipped" + "path: a TTF or OTF file", + "pixelSize: the size at which one font pixel is one stage pixel" ], - "returns": "true if the interval has passed, false otherwise", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/intervalMillis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/useFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt millis1 Millisekunden lang true und danach millis2 Millisekunden lang false zurück; skipFirst überspringt das erste Intervall" - } - } + "translations": {} }, { - "id": "Timer/millis()", - "memberId": "Timer/millis", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "millis", - "static": true, - "returnType": "int", + "id": "Text/whenAddedToStage()", + "memberId": "Text/whenAddedToStage", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "whenAddedToStage", + "static": false, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the number of milliseconds of game time since the program started.\nGame time stands still while the game is paused and runs slower or faster\nwith the game speed (see [Window.pause()](../Window/pause) and\n[Window.setGameSpeed(double)](../Window/setGameSpeed)); without either, it is the real time.", - "description": "Returns the number of milliseconds of game time since the program started.\nGame time stands still while the game is paused and runs slower or faster\nwith the game speed (see [Window.pause()](../Window/pause) and\n[Window.setGameSpeed(double)](../Window/setGameSpeed)); without either, it is the real time.", - "scratchblock": "(timer)", + "summary": "Called when the text was added to a stage.", + "description": "Called when the text was added to a stage.", + "scratchblock": null, "paramDocs": [], - "returns": "the milliseconds of game time since the program started", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/millis", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenAddedToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Gibt die seit dem Programmstart vergangenen Millisekunden zurück" + "description": "Wird aufgerufen, wenn der Text der Bühne hinzugefügt wird" } } }, { - "id": "Timer/reset()", - "memberId": "Timer/reset", - "owner": "org.openpatch.scratch.Timer", - "className": "Timer", - "methodName": "reset", + "id": "Text/whenRemovedFromStage()", + "memberId": "Text/whenRemovedFromStage", + "owner": "org.openpatch.scratch.Text", + "className": "Text", + "methodName": "whenRemovedFromStage", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Resets the timer.", - "description": "Resets the timer.", - "scratchblock": "reset timer", + "summary": "Called when the text was removed from its stage.", + "description": "Called when the text was removed from its stage.", + "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/reset", + "docsUrl": "https://scratch4j.openpatch.org/reference/Text/whenRemovedFromStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt den Timer auf 0 zurück" + "description": "Wird aufgerufen, wenn der Text von der Bühne entfernt wird" } } }, { - "id": "Triangle/constructor(double,double,double,double,double,double)", - "memberId": "Triangle/constructor", - "owner": "org.openpatch.scratch.Triangle", - "className": "Triangle", - "methodName": "constructor", + "id": "Timer/after(double)", + "memberId": "Timer/after", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "after", "static": false, - "returnType": "Triangle", + "returnType": "boolean", "parameterTypes": [ - "double", - "double", - "double", - "double", - "double", "double" ], "parameterNames": [ - "x1", - "y1", - "x2", - "y2", - "x3", - "y3" + "seconds" ], "params": [ - "double x1", - "double y1", - "double x2", - "double y2", - "double x3", - "double y3" + "double seconds" ], - "summary": "Creates a triangle with the specified vertices.", - "description": "Creates a triangle with the specified vertices.", + "summary": "False for a number of seconds from the first call on, true afterwards.", + "description": "False for a number of seconds from the first call on, true afterwards.", "scratchblock": null, "paramDocs": [ - "x1: the x-coordinate of the first vertex", - "y1: the y-coordinate of the first vertex", - "x2: the x-coordinate of the second vertex", - "y2: the y-coordinate of the second vertex", - "x3: the x-coordinate of the third vertex", - "y3: the y-coordinate of the third vertex" + "seconds: how long to wait" ], + "returns": "whether that time is over", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/after", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Timer/constructor()", + "memberId": "Timer/constructor", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "constructor", + "static": false, + "returnType": "Timer", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A timer starting now.", + "description": "A timer starting now.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Triangle/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Erzeugt ein Dreieck aus den drei Eckpunkten" + "description": "Erzeugt einen neuen Timer" } } }, { - "id": "UISprite/changeHeight(double)", - "memberId": "UISprite/changeHeight", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "changeHeight", + "id": "Timer/during(double)", + "memberId": "Timer/during", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "during", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ "double" ], "parameterNames": [ - "amount" + "seconds" ], "params": [ - "double amount" + "double seconds" ], - "summary": "Changes the height of the sprite by the given number of pixels.", - "description": "Changes the height of the sprite by the given number of pixels.", + "summary": "True for a number of seconds from the first call on, false afterwards.", + "description": "True for a number of seconds from the first call on, false afterwards.", "scratchblock": null, "paramDocs": [ - "amount: how many pixels to add to the height" + "seconds: how long" ], - "returns": null, + "returns": "whether that time is still running", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/changeHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/during", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Höhe um die angegebene Anzahl Pixel" - } - } + "translations": {} }, { - "id": "UISprite/changeWidth(double)", - "memberId": "UISprite/changeWidth", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "changeWidth", + "id": "Timer/every(double)", + "memberId": "Timer/every", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "every", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ "double" ], "parameterNames": [ - "amount" + "seconds" ], "params": [ - "double amount" + "double seconds" ], - "summary": "Changes the width of the sprite by the given number of pixels.", - "description": "Changes the width of the sprite by the given number of pixels.", + "summary": "True once every number of seconds: the first time that many seconds after the first call,\nthen again each time as many seconds have passed.", + "description": "True once every number of seconds: the first time that many seconds after the first call,\nthen again each time as many seconds have passed.", "scratchblock": null, "paramDocs": [ - "amount: how many pixels to add to the width" + "seconds: the period" ], - "returns": null, + "returns": "whether the period is over", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/changeWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/every", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Ändert die Breite um die angegebene Anzahl Pixel" - } - } + "translations": {} }, { - "id": "UISprite/constructor()", - "memberId": "UISprite/constructor", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "constructor", + "id": "Timer/getSeconds()", + "memberId": "Timer/getSeconds", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "getSeconds", "static": false, - "returnType": "UISprite", + "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a sprite that is drawn as part of the user interface.", - "description": "Creates a sprite that is drawn as part of the user interface.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "the seconds of game time since the timer started or was reset", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/getSeconds", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Erzeugt eine neue UI-Figur" - } - } + "translations": {} }, { - "id": "UISprite/disableNineSlice()", - "memberId": "UISprite/disableNineSlice", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "disableNineSlice", + "id": "Timer/interval(double)", + "memberId": "Timer/interval", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "interval", "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Lets the whole costume stretch again.", - "description": "Lets the whole costume stretch again.", + "returnType": "boolean", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "seconds" + ], + "params": [ + "double seconds" + ], + "summary": "Alternates: true for a number of seconds, then false for as long, and so on.", + "description": "Alternates: true for a number of seconds, then false for as long, and so on.", "scratchblock": null, - "paramDocs": [], - "returns": null, + "paramDocs": [ + "seconds: how long each phase lasts" + ], + "returns": "whether it is in an \"on\" phase", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/disableNineSlice", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/interval", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Lässt das ganze Kostüm wieder mitskalieren" - } - } + "translations": {} }, { - "id": "UISprite/setHeight(double)", - "memberId": "UISprite/setHeight", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "setHeight", + "id": "Timer/interval(double,double)", + "memberId": "Timer/interval", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "interval", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [ + "double", "double" ], "parameterNames": [ - "height" + "on", + "off" ], "params": [ - "double height" + "double on", + "double off" ], - "summary": "Sets the height of the sprite in pixels.", - "description": "Sets the height of the sprite in pixels.", + "summary": "Alternates: true for `on` seconds, then false for `off` seconds, and so on.", + "description": "Alternates: true for `on` seconds, then false for `off` seconds, and so on.", "scratchblock": null, "paramDocs": [ - "height: the height in pixels" + "on: how long it is true", + "off: how long it is false" ], + "returns": "whether it is in an \"on\" phase", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/interval", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Timer/reset()", + "memberId": "Timer/reset", + "owner": "org.openpatch.scratch.Timer", + "className": "Timer", + "methodName": "reset", + "static": false, + "returnType": "void", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Starts the timer again from 0, and every method below with it.", + "description": "Starts the timer again from 0, and every method below with it.", + "scratchblock": "reset timer", + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/setHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/Timer/reset", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Höhe in Pixeln" + "description": "Setzt den Timer auf 0 zurück" } } }, { - "id": "UISprite/setNineSlice(int,int,int,int)", - "memberId": "UISprite/setNineSlice", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "setNineSlice", - "static": false, - "returnType": "void", + "id": "Transition/fromShader(String)", + "memberId": "Transition/fromShader", + "owner": "org.openpatch.scratch.Transition", + "className": "Transition", + "methodName": "fromShader", + "static": true, + "returnType": "Transition", "parameterTypes": [ - "int", - "int", - "int", - "int" + "java.lang.String" ], "parameterNames": [ - "top", - "right", - "bottom", - "left" + "path" ], "params": [ - "int top", - "int right", - "int bottom", - "int left" + "String path" ], - "summary": "Keeps the corners and edges of the costume from stretching when the sprite\nis resized, so that a button costume can be made any size.", - "description": "Keeps the corners and edges of the costume from stretching when the sprite\nis resized, so that a button costume can be made any size.", + "summary": "A transition of your own: a shader body with `from`, `to` (the two pictures),\n`progress` (0 to 1), `uv` and `color`.", + "description": "A transition of your own: a shader body with `from`, `to` (the two pictures),\n`progress` (0 to 1), `uv` and `color`.", "scratchblock": null, "paramDocs": [ - "top: how many pixels of the costume belong to the top edge", - "right: how many pixels of the costume belong to the right edge", - "bottom: how many pixels of the costume belong to the bottom edge", - "left: how many pixels of the costume belong to the left edge" + "path: the file with the body" ], + "returns": "the transition", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Transition/fromShader", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Transition/getName()", + "memberId": "Transition/getName", + "owner": "org.openpatch.scratch.Transition", + "className": "Transition", + "methodName": "getName", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "the built-in name or the shader file", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Transition/getName", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Transition/toString()", + "memberId": "Transition/toString", + "owner": "org.openpatch.scratch.Transition", + "className": "Transition", + "methodName": "toString", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/setNineSlice", + "docsUrl": "https://scratch4j.openpatch.org/reference/Transition/toString", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Hält die Ecken und Ränder des Kostüms beim Skalieren fest (Nine-Slice)" - } - } + "translations": {} }, { - "id": "UISprite/setWidth(double)", - "memberId": "UISprite/setWidth", - "owner": "org.openpatch.scratch.UISprite", - "className": "UISprite", - "methodName": "setWidth", + "id": "Triangle/constructor(double,double,double,double,double,double)", + "memberId": "Triangle/constructor", + "owner": "org.openpatch.scratch.Triangle", + "className": "Triangle", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "Triangle", "parameterTypes": [ + "double", + "double", + "double", + "double", + "double", "double" ], "parameterNames": [ - "width" + "x1", + "y1", + "x2", + "y2", + "x3", + "y3" ], "params": [ - "double width" + "double x1", + "double y1", + "double x2", + "double y2", + "double x3", + "double y3" ], - "summary": "Sets the width of the sprite in pixels.", - "description": "Sets the width of the sprite in pixels.", + "summary": "A triangle.", + "description": "A triangle.", "scratchblock": null, "paramDocs": [ - "width: the width in pixels" + "x1: x of the first corner", + "y1: y of the first corner", + "x2: x of the second corner", + "y2: y of the second corner", + "x3: x of the third corner", + "y3: y of the third corner" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/UISprite/setWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/Triangle/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": { "de": { - "description": "Setzt die Breite in Pixeln" + "description": "Erzeugt ein Dreieck aus den drei Eckpunkten" } } }, @@ -13553,6 +13953,28 @@ } } }, + { + "id": "Vector2/direction()", + "memberId": "Vector2/direction", + "owner": "org.openpatch.scratch.Vector2", + "className": "Vector2", + "methodName": "direction", + "static": false, + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Returns the direction of the vector in Scratch's degrees: 0 points up, 90 to the right, 180\ndown and 270 to the left, the way `setDirection` on a sprite counts. [angle()](angle)\ncounts the mathematical way instead (0 to the right, anticlockwise).", + "description": "Returns the direction of the vector in Scratch's degrees: 0 points up, 90 to the right, 180\ndown and 270 to the left, the way `setDirection` on a sprite counts. [angle()](angle)\ncounts the mathematical way instead (0 to the right, anticlockwise).", + "scratchblock": null, + "paramDocs": [], + "returns": "the direction in degrees between 0 (inclusive) and 360 (exclusive)", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Vector2/direction", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Vector2/distance(Vector2)", "memberId": "Vector2/distance", @@ -14108,8 +14530,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Constructs a new Window with default dimensions. The default width is 480\npixels and the\ndefault height is 360 pixels.", - "description": "Constructs a new Window with default dimensions. The default width is 480\npixels and the\ndefault height is 360 pixels.\n\nA folder named `assets` is loaded while the loading screen shows, if\nthe project has one.", + "summary": "A window of 480 × 360, Scratch's stage size.", + "description": "A window of 480 × 360, Scratch's stage size.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14140,11 +14562,11 @@ "params": [ "String assets" ], - "summary": "Constructs a new Window with the specified assets. The window will have a\ndefault width of 480\npixels and a height of 360 pixels.", - "description": "Constructs a new Window with the specified assets. The window will have a\ndefault width of 480\npixels and a height of 360 pixels.\n\nThe images, sounds and fonts in that folder are loaded while the loading\nscreen shows, so they are ready when a sprite first uses them. Without\nit, a folder named `assets` is loaded, if there is one.", + "summary": "A window of 480 × 360 that loads every image, sound and font in a folder before the first\nframe, showing a loading screen.", + "description": "A window of 480 × 360 that loads every image, sound and font in a folder before the first\nframe, showing a loading screen.", "scratchblock": null, "paramDocs": [ - "assets: the path to the assets to be used in the window" + "assets: the folder, e.g. `\"assets\"`" ], "returns": null, "since": "", @@ -14177,12 +14599,12 @@ "int width", "int height" ], - "summary": "Constructs a new Window with the specified width and height.", - "description": "Constructs a new Window with the specified width and height.\n\nA folder named `assets` is loaded while the loading screen shows, if\nthe project has one.", + "summary": "A window whose stage has this size in stage pixels. The window opens at that size (in pixel\nart at the largest whole multiple that fits the screen) and scales the stage to fit when it\nis resized.", + "description": "A window whose stage has this size in stage pixels. The window opens at that size (in pixel\nart at the largest whole multiple that fits the screen) and scales the stage to fit when it\nis resized.", "scratchblock": null, "paramDocs": [ - "width: the width of the window", - "height: the height of the window" + "width: the stage width", + "height: the stage height" ], "returns": null, "since": "", @@ -14218,13 +14640,13 @@ "int height", "String assets" ], - "summary": "Constructs a new Window with the specified width, height, and assets path.\nEnsures that only\none instance of Window can be created.", - "description": "Constructs a new Window with the specified width, height, and assets path.\nEnsures that only\none instance of Window can be created.\n\nThe single exception is the window Java builds by itself: a class that\nextends Window and has a `main` method which is not static is\ninstantiated by the JVM before `main` is called, so the\n`new MyWindow()` in that `main` would be the second window. That\none reuses the first instead of failing.", + "summary": "A window of a size that loads a folder of assets first.", + "description": "A window of a size that loads a folder of assets first.", "scratchblock": null, "paramDocs": [ - "width: the width of the window", - "height: the height of the window\n\nThe images, sounds and fonts in the assets folder are loaded while the\nloading screen shows, so they are ready when a sprite first uses them.\nWithout it, a folder named `assets` is loaded, if there is one.", - "assets: the path to the assets" + "width: the stage width", + "height: the stage height", + "assets: the folder, or null" ], "returns": null, "since": "", @@ -14254,11 +14676,11 @@ "params": [ "Object[] values" ], - "summary": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the window's class name.", - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the window's class name.\n\nExample:\n\n```java\nthis.debug(\"fps =\", getFps());\n// prints: [MyWindow] fps = 60\n```", + "summary": "Prints values, but only in debug mode.", + "description": "Prints values, but only in debug mode.", "scratchblock": null, "paramDocs": [ - "values: one or more values to print" + "values: what to print" ], "returns": null, "since": "", @@ -14278,8 +14700,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Exits the application by invoking the `whenExits` method and then calling the\n`exit` method on\nthe `Applet` instance.", - "description": "Exits the application by invoking the `whenExits` method and then calling the\n`exit` method on\nthe `Applet` instance.", + "summary": "Ends the program: [whenExits()](whenExits) runs first.", + "description": "Ends the program: [whenExits()](whenExits) runs first.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14294,30 +14716,26 @@ } }, { - "id": "Window/getDeltaTime()", - "memberId": "Window/getDeltaTime", + "id": "Window/getFrameSmoothing()", + "memberId": "Window/getFrameSmoothing", "owner": "org.openpatch.scratch.Window", "className": "Window", - "methodName": "getDeltaTime", - "static": false, + "methodName": "getFrameSmoothing", + "static": true, "returnType": "double", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Gets the seconds of game time passed since the last frame. While the game\nis paused this is 0, and at half speed half the real time.", - "description": "Gets the seconds of game time passed since the last frame. While the game\nis paused this is 0, and at half speed half the real time.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "seconds since last frame", + "returns": "the frame smoothing in percent, 0 when off", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getDeltaTime", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getFrameSmoothing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt die Dauer des letzten Frames in Sekunden zurück" - } - } + "translations": {} }, { "id": "Window/getGameSpeed()", @@ -14330,11 +14748,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "The game speed set with [setGameSpeed(double)](setGameSpeed).", - "description": "The game speed set with [setGameSpeed(double)](setGameSpeed).", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "1 for normal speed", + "returns": "the game speed", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getGameSpeed", "availability": "implemented", @@ -14352,11 +14770,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the height of the current window.", - "description": "Retrieves the height of the current window.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the height of the window in pixels", + "returns": "the stage height in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getHeight", "availability": "implemented", @@ -14378,11 +14796,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the singleton instance of the Window class.", - "description": "Returns the singleton instance of the Window class.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the singleton instance of Window", + "returns": "the window, or null before it was created", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getInstance", "availability": "implemented", @@ -14404,11 +14822,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the title of the library.", - "description": "Returns the title of the library.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the title of the library as a String", + "returns": "\"Scratch for Java\"", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getLibraryTitle", "availability": "implemented", @@ -14430,11 +14848,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the version of the library.", - "description": "Returns the version of the library.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the version of the library as a String", + "returns": "the version of Scratch for Java, e.g. \"7.0.0\"", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getLibraryVersion", "availability": "implemented", @@ -14456,43 +14874,17 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the current stage from the Applet instance.", - "description": "Retrieves the current stage from the Applet instance.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the current Stage object", + "returns": "the stage shown", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, - { - "id": "Window/getTextureSampling()", - "memberId": "Window/getTextureSampling", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "getTextureSampling", - "static": true, - "returnType": "TextureSampling", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns how pictures are being smoothed.", - "description": "Returns how pictures are being smoothed.", - "scratchblock": null, - "paramDocs": [], - "returns": "the current setting", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getTextureSampling", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Gibt das eingestellte Glättungsverfahren zurück" - } - } - }, { "id": "Window/getWidth()", "memberId": "Window/getWidth", @@ -14504,11 +14896,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Retrieves the width of the current window.", - "description": "Retrieves the width of the current window.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the width of the window in pixels", + "returns": "the stage width in stage pixels", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/getWidth", "availability": "implemented", @@ -14530,11 +14922,11 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks if the application is in debug mode.", - "description": "Checks if the application is in debug mode.\n\nDebug mode can be toggled at runtime by pressing F12.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true if the application is in debug mode, false otherwise.", + "returns": "whether debug mode is on", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isDebug", "availability": "implemented", @@ -14556,33 +14948,77 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Whether the game is paused.", - "description": "Whether the game is paused.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "true while paused", + "returns": "whether the game is paused", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isPaused", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, + { + "id": "Window/isPixelArt()", + "memberId": "Window/isPixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "isPixelArt", + "static": true, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether pixel-art mode is on", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isPixelArt", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "Window/isSmoothPixelArt()", + "memberId": "Window/isSmoothPixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "isSmoothPixelArt", + "static": true, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": "whether the pixel art scrolls smoothly (see [useSmoothPixelArt()](useSmoothPixelArt))", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isSmoothPixelArt", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, { "id": "Window/isTransitioning()", "memberId": "Window/isTransitioning", "owner": "org.openpatch.scratch.Window", "className": "Window", "methodName": "isTransitioning", - "static": true, + "static": false, "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns whether a stage transition is in progress, including creation of\nthe destination stage.", - "description": "Returns whether a stage transition is in progress, including creation of\nthe destination stage.\n\nWhile a transition is running, calls to\n[transitionToStage(Stage, int)](transitionToStage) are ignored. A program that moves\nthe player or builds a new stage in the same breath as a warp should\nuse [transitionToStage(Supplier, int)](transitionToStage) so those changes are deferred\nuntil the screen is black and skipped when a transition is already running.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "`true` while a transition is in progress, `false` otherwise", + "returns": "whether a transition is in progress", "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/isTransitioning", "availability": "implemented", @@ -14600,8 +15036,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Pauses the game: `run()` is no longer called, and timers, gliding\nand animations stand still. The window keeps drawing, so the paused\npicture stays visible, and keys and clicks still reach methods like\n`whenKeyPressed`, so a key can [resume()](resume) the game.", - "description": "Pauses the game: `run()` is no longer called, and timers, gliding\nand animations stand still. The window keeps drawing, so the paused\npicture stays visible, and keys and clicks still reach methods like\n`whenKeyPressed`, so a key can [resume()](resume) the game.", + "summary": "Pauses the game: no ticks run; keys and the mouse still reach the stage and sprites.", + "description": "Pauses the game: no ticks run; keys and the mouse still reach the stage and sprites.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14626,8 +15062,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Lets a paused game go on where it stopped.", - "description": "Lets a paused game go on where it stopped.", + "summary": "Goes on after [pause()](pause).", + "description": "Goes on after [pause()](pause).", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14654,11 +15090,11 @@ "params": [ "boolean debug" ], - "summary": "Enables or disables the debug mode for the application.", - "description": "Enables or disables the debug mode for the application.\n\nDebug mode shows sprite positions, hitboxes, and other debug information.\nIt can also be toggled at runtime by pressing F12.", + "summary": "Debug mode shows what its panel in the bottom right corner has ticked: hitboxes, positions,\nthe mouse and camera, touching pairs, hidden sprites, the clones and the frame rate, and it\nlets `debug(\\u2026)` print. F12 switches it too, and `-Dscratch4j.debug=\\u2026` presets\nwhich options are on.", + "description": "Debug mode shows what its panel in the bottom right corner has ticked: hitboxes, positions,\nthe mouse and camera, touching pairs, hidden sprites, the clones and the frame rate, and it\nlets `debug(\\u2026)` print. F12 switches it too, and `-Dscratch4j.debug=\\u2026` presets\nwhich options are on.", "scratchblock": null, "paramDocs": [ - "debug: a boolean value where `true` enables debug mode and\n `false` disables\n it." + "debug: on or off" ], "returns": null, "since": "", @@ -14688,11 +15124,11 @@ "params": [ "double speed" ], - "summary": "Makes the game run slower or faster: 1 is normal, 0.5 half as fast, 2\ntwice as fast. `run()`, timers, gliding and animations all follow,\nso the whole game looks like slow motion; the window keeps drawing\nsmoothly.", - "description": "Makes the game run slower or faster: 1 is normal, 0.5 half as fast, 2\ntwice as fast. `run()`, timers, gliding and animations all follow,\nso the whole game looks like slow motion; the window keeps drawing\nsmoothly.", + "summary": "How fast the game runs: 1 is normal, 2 twice as fast, 0.5 half as fast; up to 8. Each tick\nstill is 1/60 s of game time; there are more or fewer of them per second.", + "description": "How fast the game runs: 1 is normal, 2 twice as fast, 0.5 half as fast; up to 8. Each tick\nstill is 1/60 s of game time; there are more or fewer of them per second.", "scratchblock": null, "paramDocs": [ - "speed: 1 for normal speed, smaller for slower, larger for faster" + "speed: the game speed" ], "returns": null, "since": "", @@ -14718,11 +15154,11 @@ "params": [ "Stage stage" ], - "summary": "Sets the current stage of the application.", - "description": "Sets the current stage of the application.", + "summary": "Shows a stage from the next tick on.", + "description": "Shows a stage from the next tick on.", "scratchblock": null, "paramDocs": [ - "stage: the new stage to be set" + "stage: the stage" ], "returns": null, "since": "", @@ -14746,8 +15182,8 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "While the game is paused: runs it for exactly one frame (every\n`run()` once) and pauses again. Useful to watch closely what\nhappens, for example when two sprites touch.", - "description": "While the game is paused: runs it for exactly one frame (every\n`run()` once) and pauses again. Useful to watch closely what\nhappens, for example when two sprites touch.", + "summary": "While paused: runs exactly one tick.", + "description": "While paused: runs exactly one tick.", "scratchblock": null, "paramDocs": [], "returns": null, @@ -14758,7 +15194,7 @@ "translations": {} }, { - "id": "Window/transitionToStage(Stage,int)", + "id": "Window/transitionToStage(Stage,double)", "memberId": "Window/transitionToStage", "owner": "org.openpatch.scratch.Window", "className": "Window", @@ -14767,782 +15203,636 @@ "returnType": "void", "parameterTypes": [ "org.openpatch.scratch.Stage", - "int" + "double" ], "parameterNames": [ "stage", - "duration" + "seconds" ], "params": [ "Stage stage", - "int duration" + "double seconds" ], - "summary": "Transitions to a new stage with a specified duration.", - "description": "Transitions to a new stage with a specified duration.", + "summary": "Fades to a stage through black.", + "description": "Fades to a stage through black.", "scratchblock": null, "paramDocs": [ - "stage: the new stage to transition to", - "duration: the duration of the transition in milliseconds" + "stage: the stage", + "seconds: how long" ], "returns": null, "since": "", "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Blendet über Schwarz zur angegebenen Bühne über" - } - } - }, - { - "id": "Window/transitionToStage(Supplier,int)", - "memberId": "Window/transitionToStage", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "transitionToStage", - "static": false, - "returnType": "void", - "parameterTypes": [ - "java.util.function.Supplier", - "int" - ], - "parameterNames": [ - "stage", - "duration" - ], - "params": [ - "Supplier stage", - "int duration" - ], - "summary": "Fades to black, creates the destination stage, then fades it in.", - "description": "Fades to black, creates the destination stage, then fades it in.\n\nThe supplier is called exactly once, when the screen is black. It is\nnever called when another transition is already running. Move shared\nsprites and update game state inside the supplier so those changes happen\nonly when the transition is accepted, while the old stage is hidden.\nThe call returns immediately; the supplier runs later on the animation thread.", - "scratchblock": null, - "paramDocs": [ - "stage: creates the destination stage; must return a non-null stage", - "duration: the duration, using the same timing as the Stage overload" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "Window/useFullScreen()", - "memberId": "Window/useFullScreen", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "useFullScreen", - "static": true, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Makes the window fill the whole screen.", - "description": "Makes the window fill the whole screen.\n\nCall it before the first stage is created, because the size of the window is\nsettled the moment it opens:\n\n```java\npublic static void main(String[] args) {\n Window.useFullScreen();\n new MyStage();\n}\n```", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useFullScreen", - "availability": "desktop-only", - "availabilityReason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation.", - "translations": { - "de": { - "description": "Nur in der Desktop-Version: startet im Vollbild" - } - } - }, - { - "id": "Window/useSplashLogo(String)", - "memberId": "Window/useSplashLogo", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "useSplashLogo", - "static": true, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "path" - ], - "params": [ - "String path" - ], - "summary": "Puts your own picture on the loading screen in place of the Scratch for Java\nlogo. The picture fades in while your project starts and fades out again\nonce it is ready.", - "description": "Puts your own picture on the loading screen in place of the Scratch for Java\nlogo. The picture fades in while your project starts and fades out again\nonce it is ready.\n\nIt is shrunk to fit if it is large, and never enlarged, so a picture of\nroughly 300 by 300 looks right in a window of the usual size.\n\nCall it before the first stage is created, because the loading screen is the\nfirst thing the window draws:\n\n```java\npublic static void main(String[] args) {\n Window.useSplashLogo(\"assets/logo.png\");\n new MyStage();\n}\n```", - "scratchblock": null, - "paramDocs": [ - "path: a path to an image file or the name of a built-in sprite, or\n `null` for the Scratch for Java logo" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useSplashLogo", - "availability": "desktop-only", - "availabilityReason": "The browser has no desktop splash window. This option only reports a limitation.", - "translations": { - "de": { - "description": "Nur in der Desktop-Version: zeigt beim Start ein Logo" - } - } - }, - { - "id": "Window/useTextureSampling(TextureSampling)", - "memberId": "Window/useTextureSampling", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "useTextureSampling", - "static": true, - "returnType": "void", - "parameterTypes": [ - "org.openpatch.scratch.TextureSampling" - ], - "parameterNames": [ - "sampling" - ], - "params": [ - "TextureSampling sampling" - ], - "summary": "Chooses how pictures are smoothed when they are drawn larger or smaller than\nthey really are. Pixel art usually wants [TextureSampling.POINT](../TextureSampling/POINT).", - "description": "Chooses how pictures are smoothed when they are drawn larger or smaller than\nthey really are. Pixel art usually wants [TextureSampling.POINT](../TextureSampling/POINT).\n\nCall it before the first stage is created.\n\n```java\nWindow.useTextureSampling(TextureSampling.POINT);\nnew MyStage();\n```", - "scratchblock": null, - "paramDocs": [ - "sampling: how to smooth pictures" - ], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useTextureSampling", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Legt fest, wie Bilder beim Vergrößern und Verkleinern geglättet werden. TextureSampling.POINT hält Pixelgrafik scharf, LINEAR (Standard) glättet. BILINEAR und TRILINEAR wirken im Browser wie LINEAR." - } - } - }, - { - "id": "Window/whenExits()", - "memberId": "Window/whenExits", - "owner": "org.openpatch.scratch.Window", - "className": "Window", - "methodName": "whenExits", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "This method is called when the window exits. Override this method to define\ncustom behavior\nwhen the window is closed.", - "description": "This method is called when the window exits. Override this method to define\ncustom behavior\nwhen the window is closed.", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/Window/whenExits", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": { - "de": { - "description": "Wird beim Beenden des Programms aufgerufen" - } - } + "translations": {} }, { - "id": "extensions/camera/Camera/changeX(double)", - "memberId": "extensions/camera/Camera/changeX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "changeX", + "id": "Window/transitionToStage(Supplier,double)", + "memberId": "Window/transitionToStage", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "transitionToStage", "static": false, "returnType": "void", "parameterTypes": [ + "java.util.function.Supplier", "double" ], "parameterNames": [ - "x" + "stage", + "seconds" ], "params": [ - "double x" + "Supplier stage", + "double seconds" ], - "summary": "Changes x by a certain amount", - "description": "Changes x by a certain amount", + "summary": "Fades to a stage made now, on the game thread: a slow constructor shows the loading screen\ninstead of freezing the window.", + "description": "Fades to a stage made now, on the game thread: a slow constructor shows the loading screen\ninstead of freezing the window.", "scratchblock": null, "paramDocs": [ - "x: number in pixels" + "stage: makes the stage, e.g. `() -> new Level2()`", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/changeX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/changeY(double)", - "memberId": "extensions/camera/Camera/changeY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "changeY", + "id": "Window/transitionToStage(Supplier,Transition,double)", + "memberId": "Window/transitionToStage", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "transitionToStage", "static": false, "returnType": "void", "parameterTypes": [ + "java.util.function.Supplier", + "org.openpatch.scratch.Transition", "double" ], "parameterNames": [ - "y" + "stage", + "transition", + "seconds" ], "params": [ - "double y" + "Supplier stage", + "Transition transition", + "double seconds" ], - "summary": "Changes y by a certain amount", - "description": "Changes y by a certain amount", + "summary": "Shows a stage made now through a transition.", + "description": "Shows a stage made now through a transition.\n\n```java\nwindow.transitionToStage(() -> new Level2(), Transition.SLIDE_LEFT, 0.5);\n```", "scratchblock": null, "paramDocs": [ - "y: number in pixels" + "stage: makes the stage", + "transition: how", + "seconds: how long" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/changeY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/transitionToStage", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/changeZoom(double)", - "memberId": "extensions/camera/Camera/changeZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "changeZoom", - "static": false, + "id": "Window/use(Extension)", + "memberId": "Window/use", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "use", + "static": true, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.extension.Extension" ], "parameterNames": [ - "dz" + "extension" ], "params": [ - "double dz" + "Extension extension" ], - "summary": "Changes the zoom level by a certain amount", - "description": "Changes the zoom level by a certain amount", + "summary": "Uses an extension that does not register itself through `META-INF/services` (one in\nyour own project). Call it before `new Window`.", + "description": "Uses an extension that does not register itself through `META-INF/services` (one in\nyour own project). Call it before `new Window`.", "scratchblock": null, "paramDocs": [ - "dz: the amount to change the zoom level by" + "extension: the extension" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/changeZoom", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/use", + "availability": "desktop-only", + "availabilityReason": "Extensions load through the desktop's ServiceLoader and run against its window and render threads. The browser ships its extensions natively; it does not load external or custom extensions.", "translations": {} }, { - "id": "extensions/camera/Camera/constructor()", - "memberId": "extensions/camera/Camera/constructor", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "constructor", - "static": false, - "returnType": "Camera", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Constructs a new Camera with default values. The default position is (0, 0) and the default\nzoom level is 100.", - "description": "Constructs a new Camera with default values. The default position is (0, 0) and the default\nzoom level is 100.", + "id": "Window/useFrameSmoothing(double)", + "memberId": "Window/useFrameSmoothing", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useFrameSmoothing", + "static": true, + "returnType": "void", + "parameterTypes": [ + "double" + ], + "parameterNames": [ + "percent" + ], + "params": [ + "double percent" + ], + "summary": "Frame smoothing: each frame is presented mixed with the one before it, this much in percent.\nA screen that holds each frame until the next (every 60 Hz LCD) smears whatever moves,\nbecause the eye gets one picture per 16.7 ms; two pictures per frame (50 is a good value)\nlook like one picture per 8.3 ms and smear about half as much. The world keeps its pixels:\nthe moment nothing moves, current and previous frame are the same and the picture is fully\nsharp. While things move, edges are softer \\u2014 that is the trade. Call it before\n`new Window`; 0 (the default) turns it off.", + "description": "Frame smoothing: each frame is presented mixed with the one before it, this much in percent.\nA screen that holds each frame until the next (every 60 Hz LCD) smears whatever moves,\nbecause the eye gets one picture per 16.7 ms; two pictures per frame (50 is a good value)\nlook like one picture per 8.3 ms and smear about half as much. The world keeps its pixels:\nthe moment nothing moves, current and previous frame are the same and the picture is fully\nsharp. While things move, edges are softer \\u2014 that is the trade. Call it before\n`new Window`; 0 (the default) turns it off.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "percent: how much of the previous frame each presented one keeps, 0 to 100" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useFrameSmoothing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/getPosition()", - "memberId": "extensions/camera/Camera/getPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getPosition", - "static": false, - "returnType": "Vector2", + "id": "Window/useFullScreen()", + "memberId": "Window/useFullScreen", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useFullScreen", + "static": true, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the position of the sprite", - "description": "Returns the position of the sprite", + "summary": "Opens the window full screen (a borderless window at the screen's size). Call it before `new Window`.", + "description": "Opens the window full screen (a borderless window at the screen's size). Call it before `new Window`.", "scratchblock": null, "paramDocs": [], - "returns": "a vector", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getPosition", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useFullScreen", + "availability": "desktop-only", + "availabilityReason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation.", + "translations": { + "de": { + "description": "Nur in der Desktop-Version: startet im Vollbild" + } + } }, { - "id": "extensions/camera/Camera/getX()", - "memberId": "extensions/camera/Camera/getX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getX", - "static": false, - "returnType": "double", + "id": "Window/usePixelArt()", + "memberId": "Window/usePixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "usePixelArt", + "static": true, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the x coordinate of the sprite", - "description": "Returns the x coordinate of the sprite", + "summary": "Pixel-art mode: images are not smoothed, the stage scales by whole numbers only, the default\nfont is Jersey 10 and font sizes are rounded to its pixels. Call it before `new Window`.", + "description": "Pixel-art mode: images are not smoothed, the stage scales by whole numbers only, the default\nfont is Jersey 10 and font sizes are rounded to its pixels. Call it before `new Window`.", "scratchblock": null, "paramDocs": [], - "returns": "a x coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getX", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/usePixelArt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/getY()", - "memberId": "extensions/camera/Camera/getY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getY", - "static": false, - "returnType": "double", + "id": "Window/useSmoothPixelArt()", + "memberId": "Window/useSmoothPixelArt", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useSmoothPixelArt", + "static": true, + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the y coordinate of the sprite", - "description": "Returns the y coordinate of the sprite", + "summary": "Smooth pixel art (Godot's \"canvas items\" way of showing pixel art): as [usePixelArt()](usePixelArt),\nbut the camera moves without snapping and zoom works at any factor. The world is drawn at the\nwindow's resolution with the sprites still sampled by nearest neighbour, so every pixel stays\na sharp square while things move \\u2014 the grid wobbles by a screen pixel instead of the picture\nstepping whole stage pixels (the look of Hyper Light Drifter, as Godot's guide puts it). With\nit, scrolling does not need [useFrameSmoothing(double)](useFrameSmoothing). Call it before\n`new Window`.", + "description": "Smooth pixel art (Godot's \"canvas items\" way of showing pixel art): as [usePixelArt()](usePixelArt),\nbut the camera moves without snapping and zoom works at any factor. The world is drawn at the\nwindow's resolution with the sprites still sampled by nearest neighbour, so every pixel stays\na sharp square while things move \\u2014 the grid wobbles by a screen pixel instead of the picture\nstepping whole stage pixels (the look of Hyper Light Drifter, as Godot's guide puts it). With\nit, scrolling does not need [useFrameSmoothing(double)](useFrameSmoothing). Call it before\n`new Window`.", "scratchblock": null, "paramDocs": [], - "returns": "a y coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getY", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useSmoothPixelArt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/getZoom()", - "memberId": "extensions/camera/Camera/getZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "getZoom", - "static": false, - "returnType": "double", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the zoom level", - "description": "Returns the zoom level", + "id": "Window/useSplashLogo(String)", + "memberId": "Window/useSplashLogo", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "useSplashLogo", + "static": true, + "returnType": "void", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "path" + ], + "params": [ + "String path" + ], + "summary": "The logo on the loading screen. Call it before `new Window`.", + "description": "The logo on the loading screen. Call it before `new Window`.", "scratchblock": null, - "paramDocs": [], - "returns": "the zoom level", + "paramDocs": [ + "path: an image" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/getZoom", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/useSplashLogo", + "availability": "desktop-only", + "availabilityReason": "The browser has no desktop splash window. This option only reports a limitation.", + "translations": { + "de": { + "description": "Nur in der Desktop-Version: zeigt beim Start ein Logo" + } + } }, { - "id": "extensions/camera/Camera/resetZoom()", - "memberId": "extensions/camera/Camera/resetZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "resetZoom", + "id": "Window/whenExits()", + "memberId": "Window/whenExits", + "owner": "org.openpatch.scratch.Window", + "className": "Window", + "methodName": "whenExits", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Resets the zoom level to 100", - "description": "Resets the zoom level to 100", + "summary": "Called when the program ends, on the game thread. Override it to save, say.", + "description": "Called when the program ends, on the game thread. Override it to save, say.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/resetZoom", + "docsUrl": "https://scratch4j.openpatch.org/reference/Window/whenExits", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} + "translations": { + "de": { + "description": "Wird beim Beenden des Programms aufgerufen" + } + } }, { - "id": "extensions/camera/Camera/setPosition(double,double)", - "memberId": "extensions/camera/Camera/setPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setPosition", + "id": "drawing/BitmapText/addGlyph(char,String)", + "memberId": "drawing/BitmapText/addGlyph", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "addGlyph", "static": false, "returnType": "void", "parameterTypes": [ - "double", - "double" + "char", + "java.lang.String" ], "parameterNames": [ - "x", - "y" + "character", + "path" ], "params": [ - "double x", - "double y" + "char character", + "String path" ], - "summary": "Sets the position of the sprite", - "description": "Sets the position of the sprite", + "summary": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", + "description": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", "scratchblock": null, "paramDocs": [ - "x: a x coordinate", - "y: a y coordinate" + "character: the character to replace", + "path: its image or built-in costume name" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/addGlyph", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setPosition(Vector2)", - "memberId": "extensions/camera/Camera/setPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setPosition", + "id": "drawing/BitmapText/constructor(String)", + "memberId": "drawing/BitmapText/constructor", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "constructor", "static": false, - "returnType": "void", + "returnType": "BitmapText", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" ], "parameterNames": [ - "v" + "pattern" ], "params": [ - "Vector2 v" + "String pattern" ], - "summary": "Sets the position of the sprite based on the coordinates of a given vector.", - "description": "Sets the position of the sprite based on the coordinates of a given vector.", + "summary": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", + "description": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", "scratchblock": null, "paramDocs": [ - "v: a vector" + "pattern: image path with an integer format, e.g. \"assets/font%03d.png\"" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setX(double)", - "memberId": "extensions/camera/Camera/setX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setX", + "id": "drawing/BitmapText/draw(Drawing)", + "memberId": "drawing/BitmapText/draw", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "draw", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "org.openpatch.scratch.drawing.Drawing" ], "parameterNames": [ - "x" + "drawing" ], "params": [ - "double x" + "Drawing drawing" ], - "summary": "Sets the x coordinate", - "description": "Sets the x coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "x: a x coordinate" + "drawing: the current frame's canvas" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setX", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/draw", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setY(double)", - "memberId": "extensions/camera/Camera/setY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setY", + "id": "drawing/BitmapText/getContent()", + "memberId": "drawing/BitmapText/getContent", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "getContent", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "y" - ], - "params": [ - "double y" - ], - "summary": "Sets the y coordinate", - "description": "Sets the y coordinate", + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "y: a y coordinate" - ], - "returns": null, + "paramDocs": [], + "returns": "the text being shown", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setY", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/getContent", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setZoom(double)", - "memberId": "extensions/camera/Camera/setZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setZoom", + "id": "drawing/BitmapText/getHeight()", + "memberId": "drawing/BitmapText/getHeight", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "getHeight", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "zoom" - ], - "params": [ - "double zoom" - ], - "summary": "Sets the zoom", - "description": "Sets the zoom", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "zoom: the zoom level" - ], - "returns": null, + "paramDocs": [], + "returns": "the displayed text's height, including line spacing and sprite size", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setZoom", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/getHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/setZoomLimit(double,double)", - "memberId": "extensions/camera/Camera/setZoomLimit", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "setZoomLimit", + "id": "drawing/BitmapText/getWidth()", + "memberId": "drawing/BitmapText/getWidth", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "getWidth", "static": false, - "returnType": "void", - "parameterTypes": [ - "double", - "double" - ], - "parameterNames": [ - "low", - "high" - ], - "params": [ - "double low", - "double high" - ], - "summary": "Sets the zoom limits", - "description": "Sets the zoom limits", + "returnType": "double", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [ - "low: the lower limit", - "high: the upper limit" - ], - "returns": null, + "paramDocs": [], + "returns": "the displayed text's width, including the sprite's size", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/setZoomLimit", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toGlobalPosition(Vector2)", - "memberId": "extensions/camera/Camera/toGlobalPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toGlobalPosition", + "id": "drawing/BitmapText/setAlign(TextAlign)", + "memberId": "drawing/BitmapText/setAlign", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setAlign", "static": false, - "returnType": "Vector2", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.TextAlign" ], "parameterNames": [ - "v" + "align" ], "params": [ - "Vector2 v" + "TextAlign align" ], - "summary": "Converts local camera coordinates to screen coordinates", - "description": "Converts local camera coordinates to screen coordinates", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "v: local camera coordinates" + "align: LEFT, CENTER or RIGHT (DEFAULT means LEFT)" ], - "returns": "screen coordinates", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toGlobalPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setAlign", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toGlobalX(double)", - "memberId": "extensions/camera/Camera/toGlobalX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toGlobalX", + "id": "drawing/BitmapText/setFont(String)", + "memberId": "drawing/BitmapText/setFont", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setFont", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "x" + "pattern" ], "params": [ - "double x" + "String pattern" ], - "summary": "Converts local camera x coordinate to screen x coordinate", - "description": "Converts local camera x coordinate to screen x coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "x: local camera x coordinate" + "pattern: glyph path with one integer format for the Unicode code point" ], - "returns": "screen x coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toGlobalX", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setFont", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toGlobalY(double)", - "memberId": "extensions/camera/Camera/toGlobalY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toGlobalY", + "id": "drawing/BitmapText/setLetterSpacing(double)", + "memberId": "drawing/BitmapText/setLetterSpacing", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setLetterSpacing", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "y" + "spacing" ], "params": [ - "double y" + "double spacing" ], - "summary": "Converts local camera y coordinate to screen y coordinate", - "description": "Converts local camera y coordinate to screen y coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "y: local camera y coordinate" + "spacing: gap between characters; negative values allow italic glyphs to overlap" ], - "returns": "screen y coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toGlobalY", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setLetterSpacing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toLocalPosition(Vector2)", - "memberId": "extensions/camera/Camera/toLocalPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toLocalPosition", + "id": "drawing/BitmapText/setLineSpacing(double)", + "memberId": "drawing/BitmapText/setLineSpacing", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setLineSpacing", "static": false, - "returnType": "Vector2", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.Vector2" + "double" ], "parameterNames": [ - "v" + "spacing" ], "params": [ - "Vector2 v" + "double spacing" ], - "summary": "Converts screen coordinates to local camera coordinates", - "description": "Converts screen coordinates to local camera coordinates", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "v: screen coordinates" + "spacing: extra pixels between lines" ], - "returns": "local coordinates", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toLocalPosition", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setLineSpacing", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toLocalX(double)", - "memberId": "extensions/camera/Camera/toLocalX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toLocalX", + "id": "drawing/BitmapText/setSpaceWidth(double)", + "memberId": "drawing/BitmapText/setSpaceWidth", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "setSpaceWidth", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ "double" ], "parameterNames": [ - "x" + "width" ], "params": [ - "double x" + "double width" ], - "summary": "Converts screen x coordinate to local camera x coordinate", - "description": "Converts screen x coordinate to local camera x coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "x: screen x coordinate" + "width: width of a space, in unscaled pixels" ], - "returns": "local x coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toLocalX", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/setSpaceWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/camera/Camera/toLocalY(double)", - "memberId": "extensions/camera/Camera/toLocalY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "className": "Camera", - "methodName": "toLocalY", + "id": "drawing/BitmapText/showText(String)", + "memberId": "drawing/BitmapText/showText", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "className": "BitmapText", + "methodName": "showText", "static": false, - "returnType": "double", + "returnType": "void", "parameterTypes": [ - "double" + "java.lang.String" ], "parameterNames": [ - "y" + "text" ], "params": [ - "double y" + "String text" ], - "summary": "Converts screen y coordinate to local camera y coordinate", - "description": "Converts screen y coordinate to local camera y coordinate", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "y: screen y coordinate" + "text: text to show, including spaces and newlines" ], - "returns": "local y coordinate", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/camera/Camera/toLocalY", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/BitmapText/showText", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/clip(double,double,double,double)", - "memberId": "extensions/drawing/Drawing/clip", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/clip(double,double,double,double)", + "memberId": "drawing/Drawing/clip", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "clip", "static": false, @@ -15565,26 +15855,26 @@ "double width", "double height" ], - "summary": "Limits subsequent drawing to a centred rectangle. This replaces the previous\nclip; it is always cleared when the sprite finishes drawing. For a rotated\nsprite, the clip is the screen-aligned bounding box of this rectangle.", - "description": "Limits subsequent drawing to a centred rectangle. This replaces the previous\nclip; it is always cleared when the sprite finishes drawing. For a rotated\nsprite, the clip is the screen-aligned bounding box of this rectangle.", + "summary": "Draws only inside a rectangle until [noClip()](noClip); a turned sprite clips to the rectangle\naround the turned one.", + "description": "Draws only inside a rectangle until [noClip()](noClip); a turned sprite clips to the rectangle\naround the turned one.", "scratchblock": null, "paramDocs": [ - "x: centre x", - "y: centre y", - "width: clip width", - "height: clip height" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/clip", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/clip", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/image(String,double,double)", - "memberId": "extensions/drawing/Drawing/image", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/image(String,double,double)", + "memberId": "drawing/Drawing/image", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "image", "static": false, @@ -15604,25 +15894,25 @@ "double x", "double y" ], - "summary": "Draws an image at its original size. A built-in costume name also works.", - "description": "Draws an image at its original size. A built-in costume name also works.", + "summary": "An image at its own size, centred on a point.", + "description": "An image at its own size, centred on a point.", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume", - "x: centre x", - "y: centre y" + "path: an image file or a built-in sprite name", + "x: x of its centre", + "y: y of its centre" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/image", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/image", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/image(String,double,double,double,double)", - "memberId": "extensions/drawing/Drawing/image", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/image(String,double,double,double,double)", + "memberId": "drawing/Drawing/image", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "image", "static": false, @@ -15648,27 +15938,27 @@ "double width", "double height" ], - "summary": "Draws an image at the requested size, preserving its source in the cache.", - "description": "Draws an image at the requested size, preserving its source in the cache.", + "summary": "An image stretched to a size, centred on a point.", + "description": "An image stretched to a size, centred on a point.", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume", - "x: centre x", - "y: centre y", - "width: drawn width in pixels", - "height: drawn height in pixels" + "path: an image file or a built-in sprite name", + "x: x of its centre", + "y: y of its centre", + "width: the width", + "height: the height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/image", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/image", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/imageHeight(String)", - "memberId": "extensions/drawing/Drawing/imageHeight", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/imageHeight(String)", + "memberId": "drawing/Drawing/imageHeight", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "imageHeight", "static": false, @@ -15686,19 +15976,19 @@ "description": "", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume" + "path: an image file or a built-in sprite name" ], - "returns": "its original height in pixels", + "returns": "its height in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/imageHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/imageHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/imageWidth(String)", - "memberId": "extensions/drawing/Drawing/imageWidth", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/imageWidth(String)", + "memberId": "drawing/Drawing/imageWidth", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "imageWidth", "static": false, @@ -15716,19 +16006,19 @@ "description": "", "scratchblock": null, "paramDocs": [ - "path: image file or built-in costume" + "path: an image file or a built-in sprite name" ], - "returns": "its original width in pixels", + "returns": "its width in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/imageWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/imageWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/noClip()", - "memberId": "extensions/drawing/Drawing/noClip", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/noClip()", + "memberId": "drawing/Drawing/noClip", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "noClip", "static": false, @@ -15736,21 +16026,21 @@ "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Removes this sprite's clip.", - "description": "Removes this sprite's clip.", + "summary": "Draws everywhere again.", + "description": "Draws everywhere again.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/noClip", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/noClip", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/polygon(double[],double[],Color)", - "memberId": "extensions/drawing/Drawing/polygon", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/polygon(double[],double[],Color)", + "memberId": "drawing/Drawing/polygon", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "polygon", "static": false, @@ -15770,25 +16060,25 @@ "double[] y", "Color color" ], - "summary": "Draws a filled polygon with at least three points. Concave polygons are\nsupported; crossing outlines are not.", - "description": "Draws a filled polygon with at least three points. Concave polygons are\nsupported; crossing outlines are not.", + "summary": "A filled polygon.", + "description": "A filled polygon.", "scratchblock": null, "paramDocs": [ - "x: x coordinates", - "y: y coordinates (same length as x)", - "color: fill colour" + "x: x of every corner", + "y: y of every corner", + "color: the fill" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/polygon", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/polygon", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/Drawing/rectangle(double,double,double,double,Color)", - "memberId": "extensions/drawing/Drawing/rectangle", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "drawing/Drawing/rectangle(double,double,double,double,Color)", + "memberId": "drawing/Drawing/rectangle", + "owner": "org.openpatch.scratch.drawing.Drawing", "className": "Drawing", "methodName": "rectangle", "static": false, @@ -15814,113 +16104,149 @@ "double height", "Color color" ], - "summary": "Draws a filled rectangle centred on (x,y).", - "description": "Draws a filled rectangle centred on (x,y).", + "summary": "A filled rectangle centred on a point.", + "description": "A filled rectangle centred on a point.", "scratchblock": null, "paramDocs": [ - "x: centre x", - "y: centre y", - "width: width in pixels", - "height: height in pixels", - "color: fill colour" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height", + "color: the fill" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/Drawing/rectangle", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/Drawing/rectangle", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/changeTransparency(double)", - "memberId": "extensions/drawing/DrawingSprite/changeTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "changeTransparency", + "id": "drawing/DrawingExtension/constructor()", + "memberId": "drawing/DrawingExtension/constructor", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "constructor", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "step" - ], - "params": [ - "double step" - ], - "summary": "", - "description": "", + "returnType": "DrawingExtension", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Registers the drawing extension; found through ServiceLoader, learners never see it.", + "description": "Registers the drawing extension; found through ServiceLoader, learners never see it.", "scratchblock": null, - "paramDocs": [ - "step: change in percentage points" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/changeTransparency", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/constructor()", - "memberId": "extensions/drawing/DrawingSprite/constructor", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "constructor", + "id": "drawing/DrawingExtension/id()", + "memberId": "drawing/DrawingExtension/id", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "id", "static": false, - "returnType": "DrawingSprite", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Creates a custom drawing sprite.", - "description": "Creates a custom drawing sprite.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/draw(Drawing)", - "memberId": "extensions/drawing/DrawingSprite/draw", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "draw", + "id": "drawing/DrawingExtension/install(ExtensionContext)", + "memberId": "drawing/DrawingExtension/install", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "install", "static": false, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "org.openpatch.scratch.extension.ExtensionContext" ], "parameterNames": [ - "drawing" + "ctx" ], "params": [ - "Drawing drawing" + "ExtensionContext ctx" ], - "summary": "Draws this frame's appearance. Override this method; use run() for changes\nto game state, since a paused game can still be redrawn.", - "description": "Draws this frame's appearance. Override this method; use run() for changes\nto game state, since a paused game can still be redrawn.", + "summary": "Every layer gets a drawer that lets the stage's visible drawing sprites of that layer draw,\nback to front.", + "description": "Every layer gets a drawer that lets the stage's visible drawing sprites of that layer draw,\nback to front.", "scratchblock": null, "paramDocs": [ - "drawing: this frame's canvas in local Scratch coordinates" + "ctx: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/draw", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/install", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/getTransparency()", - "memberId": "extensions/drawing/DrawingSprite/getTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "getTransparency", + "id": "drawing/DrawingExtension/name()", + "memberId": "drawing/DrawingExtension/name", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "name", "static": false, - "returnType": "double", + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "drawing/DrawingExtension/requires()", + "memberId": "drawing/DrawingExtension/requires", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "requires", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "drawing/DrawingExtension/version()", + "memberId": "drawing/DrawingExtension/version", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "className": "DrawingExtension", + "methodName": "version", + "static": false, + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], @@ -15928,2045 +16254,2383 @@ "description": "", "scratchblock": null, "paramDocs": [], - "returns": "transparency in percent", + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "drawing/DrawingSprite/constructor()", + "memberId": "drawing/DrawingSprite/constructor", + "owner": "org.openpatch.scratch.drawing.DrawingSprite", + "className": "DrawingSprite", + "methodName": "constructor", + "static": false, + "returnType": "DrawingSprite", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "A drawing sprite; it has no hitbox unless given one.", + "description": "A drawing sprite; it has no hitbox unless given one.", + "scratchblock": null, + "paramDocs": [], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/getTransparency", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingSprite/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/setIsUI(boolean)", - "memberId": "extensions/drawing/DrawingSprite/setIsUI", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "id": "drawing/DrawingSprite/draw(Drawing)", + "memberId": "drawing/DrawingSprite/draw", + "owner": "org.openpatch.scratch.drawing.DrawingSprite", "className": "DrawingSprite", - "methodName": "setIsUI", + "methodName": "draw", "static": false, "returnType": "void", "parameterTypes": [ - "boolean" + "org.openpatch.scratch.drawing.Drawing" ], "parameterNames": [ - "isUI" + "drawing" ], "params": [ - "boolean isUI" + "Drawing drawing" ], - "summary": "Chooses whether the drawing stays fixed on screen as UI.", - "description": "Chooses whether the drawing stays fixed on screen as UI.", + "summary": "Draws the sprite; called every frame on the game thread.", + "description": "Draws the sprite; called every frame on the game thread.", "scratchblock": null, "paramDocs": [ - "isUI: true for UI, false for the game world" + "drawing: what to draw with, in the sprite's own coordinates" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/setIsUI", + "docsUrl": "https://scratch4j.openpatch.org/reference/drawing/DrawingSprite/draw", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/drawing/DrawingSprite/setTransparency(double)", - "memberId": "extensions/drawing/DrawingSprite/setTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "className": "DrawingSprite", - "methodName": "setTransparency", + "id": "extension/Canvas/clip(double,double,double,double)", + "memberId": "extension/Canvas/clip", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "clip", "static": false, "returnType": "void", "parameterTypes": [ + "double", + "double", + "double", "double" ], "parameterNames": [ - "percent" + "x", + "y", + "width", + "height" ], "params": [ - "double percent" + "double x", + "double y", + "double width", + "double height" ], - "summary": "", - "description": "", + "summary": "Draws only inside a rectangle (axis-aligned on the screen) until [noClip()](noClip).", + "description": "Draws only inside a rectangle (axis-aligned on the screen) until [noClip()](noClip).", "scratchblock": null, "paramDocs": [ - "percent: 0 solid, 100 invisible" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/drawing/DrawingSprite/setTransparency", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/fs/File/constructor()", - "memberId": "extensions/fs/File/constructor", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "constructor", - "static": false, - "returnType": "File", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.", - "description": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.\n\nUsage examples:\n\n```java\n// Save an object as JSON\nFile.save(\"/path/to/file.json\", myObject);\n\n// Save an object as XML\nFile.saveXML(\"/path/to/file.xml\", myObject);\n\n// Load an object from JSON\nMyClass obj = File.load(\"/path/to/file.json\", MyClass.class);\n\n// Load an object from XML\nMyClass obj = File.loadXML(\"/path/to/file.xml\", MyClass.class);\n```\n\nNote: The file paths can be absolute or relative. If a relative path is\nprovided, the class\nwill attempt to load the file from the classpath.\n\nSupported file types:\n\n

    \n
  • JSON\n
  • XML\n
", - "scratchblock": null, - "paramDocs": [], - "returns": null, - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/clip", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/load(String,Class)", - "memberId": "extensions/fs/File/load", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "load", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawImage(String,double,double,double,double)", + "memberId": "extension/Canvas/drawImage", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawImage", + "static": false, + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.Class" + "double", + "double", + "double", + "double" ], "parameterNames": [ "path", - "cls" + "x", + "y", + "width", + "height" ], "params": [ "String path", - "Class cls" + "double x", + "double y", + "double width", + "double height" ], - "summary": "Loads an object of the specified class from a file at the given path.", - "description": "Loads an object of the specified class from a file at the given path.", + "summary": "An image (a file or a built-in sprite name), centred on a point.", + "description": "An image (a file or a built-in sprite name), centred on a point.", "scratchblock": null, "paramDocs": [ - "path: the path to the file from which the object is to be loaded", - "cls: the class of the object to be loaded" + "path: the image", + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height" ], - "returns": "the loaded object of the specified class", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/load", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawImage", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/loadOrCreate(String,Class)", - "memberId": "extensions/fs/File/loadOrCreate", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "loadOrCreate", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawImageQuad(String,int,int,int,int,double[])", + "memberId": "extension/Canvas/drawImageQuad", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawImageQuad", + "static": false, + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.Class" + "int", + "int", + "int", + "int", + "double[]" ], "parameterNames": [ "path", - "cls" + "sx", + "sy", + "sw", + "sh", + "corners" ], "params": [ "String path", - "Class cls" + "int sx", + "int sy", + "int sw", + "int sh", + "double[] corners" ], - "summary": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", - "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", + "summary": "A region of an image on any quad: turned, mirrored, sheared.", + "description": "A region of an image on any quad: turned, mirrored, sheared.", "scratchblock": null, "paramDocs": [ - "path: the path to the file from which the object is to be loaded", - "cls: the class of the object to be loaded" + "path: the image", + "sx: the region's left edge in image pixels", + "sy: its top edge", + "sw: its width", + "sh: its height", + "corners: where the region's top-left, top-right, bottom-right and bottom-left corners go:\n `x0, y0, \\u2026, x3, y3`" ], - "returns": "the loaded object of the specified class, or a new instance if the\n file does not exist", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/loadOrCreate", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawImageQuad", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/loadXML(String,Class)", - "memberId": "extensions/fs/File/loadXML", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "loadXML", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawImageRegion(String,int,int,int,int,double,double,double,double)", + "memberId": "extension/Canvas/drawImageRegion", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawImageRegion", + "static": false, + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.Class" + "int", + "int", + "int", + "int", + "double", + "double", + "double", + "double" ], "parameterNames": [ "path", - "cls" + "sx", + "sy", + "sw", + "sh", + "x", + "y", + "width", + "height" ], "params": [ "String path", - "Class cls" + "int sx", + "int sy", + "int sw", + "int sh", + "double x", + "double y", + "double width", + "double height" ], - "summary": "Loads an object of the specified class from an XML file at the given path.", - "description": "Loads an object of the specified class from an XML file at the given path.", + "summary": "A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font.", + "description": "A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font.", "scratchblock": null, "paramDocs": [ - "path: the path to the XML file", - "cls: the class of the object to be loaded" + "path: the image", + "sx: the region's left edge in image pixels", + "sy: its top edge", + "sw: its width", + "sh: its height", + "x: x of the centre", + "y: y of the centre", + "width: the width to draw it at", + "height: the height to draw it at" ], - "returns": "the object loaded from the XML file", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/loadXML", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawImageRegion", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/loadXMLOrCreate(String,Class)", - "memberId": "extensions/fs/File/loadXMLOrCreate", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "loadXMLOrCreate", - "static": true, - "returnType": "T", + "id": "extension/Canvas/drawOutline(double[],double[],Color,double)", + "memberId": "extension/Canvas/drawOutline", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawOutline", + "static": false, + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.Class" + "double[]", + "double[]", + "org.openpatch.scratch.Color", + "double" ], "parameterNames": [ - "path", - "cls" + "xs", + "ys", + "stroke", + "weight" ], "params": [ - "String path", - "Class cls" + "double[] xs", + "double[] ys", + "Color stroke", + "double weight" ], - "summary": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", - "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", + "summary": "The outline of a polygon.", + "description": "The outline of a polygon.", "scratchblock": null, "paramDocs": [ - "path: the path to the XML file", - "cls: the class of the object to be loaded" + "xs: x of every corner", + "ys: y of every corner", + "stroke: the outline's colour", + "weight: the outline's width" ], - "returns": "the object loaded from the XML file, or a new instance if the file\n does not exist", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/loadXMLOrCreate", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawOutline", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/save(String,T)", - "memberId": "extensions/fs/File/save", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "save", - "static": true, + "id": "extension/Canvas/drawPolygon(double[],double[],Color)", + "memberId": "extension/Canvas/drawPolygon", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawPolygon", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "T" + "double[]", + "double[]", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "path", - "obj" + "xs", + "ys", + "fill" ], "params": [ - "String path", - "T obj" + "double[] xs", + "double[] ys", + "Color fill" ], - "summary": "Saves the given object to the specified path in the default file type (JSON).", - "description": "Saves the given object to the specified path in the default file type (JSON).", + "summary": "A filled polygon, concave ones included.", + "description": "A filled polygon, concave ones included.", "scratchblock": null, "paramDocs": [ - "path: the path where the object should be saved", - "obj: the object to be saved" + "xs: x of every corner", + "ys: y of every corner, in the same order", + "fill: its colour" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/save", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawPolygon", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/File/saveXML(String,T)", - "memberId": "extensions/fs/File/saveXML", - "owner": "org.openpatch.scratch.extensions.fs.File", - "className": "File", - "methodName": "saveXML", - "static": true, + "id": "extension/Canvas/drawRectangle(double,double,double,double,Color)", + "memberId": "extension/Canvas/drawRectangle", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawRectangle", + "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "T" + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "path", - "obj" + "x", + "y", + "width", + "height", + "fill" ], "params": [ - "String path", - "T obj" + "double x", + "double y", + "double width", + "double height", + "Color fill" ], - "summary": "Saves the given object as an XML file at the specified path.", - "description": "Saves the given object as an XML file at the specified path.", + "summary": "A filled rectangle centred on a point.", + "description": "A filled rectangle centred on a point.", "scratchblock": null, "paramDocs": [ - "path: the path where the XML file will be saved", - "obj: the object to be saved as XML" + "x: x of its centre", + "y: y of its centre", + "width: its width", + "height: its height", + "fill: its colour" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/File/saveXML", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawRectangle", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/constructor(String,String,Class)", - "memberId": "extensions/fs/SaveData/constructor", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "constructor", + "id": "extension/Canvas/drawText(String,double,double,double,Color)", + "memberId": "extension/Canvas/drawText", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "drawText", "static": false, - "returnType": "SaveData", + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "java.lang.Class" + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "parameterNames": [ - "gameId", - "slot", - "type" + "text", + "x", + "y", + "size", + "color" ], "params": [ - "String gameId", - "String slot", - "Class type" + "String text", + "double x", + "double y", + "double size", + "Color color" ], - "summary": "Selects a game's save slot without creating a file or opening a database.", - "description": "Selects a game's save slot without creating a file or opening a database.", + "summary": "A line of text whose first baseline starts at a point, in the default font.", + "description": "A line of text whose first baseline starts at a point, in the default font.", "scratchblock": null, "paramDocs": [ - "gameId: a stable identifier, for example org.openpatch.coincatcher", - "slot: a slot name, for example slot1, slot2 or slot3", - "type: the data class to load" + "text: the text", + "x: where it starts", + "y: its baseline", + "size: the font size", + "color: the colour of the letters" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/drawText", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/getLocation()", - "memberId": "extensions/fs/SaveData/getLocation", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "getLocation", + "id": "extension/Canvas/imageHeight(String)", + "memberId": "extension/Canvas/imageHeight", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "imageHeight", "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", - "description": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", + "returnType": "int", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "path" + ], + "params": [ + "String path" + ], + "summary": "", + "description": "", "scratchblock": null, - "paramDocs": [], - "returns": "a description of the save location", + "paramDocs": [ + "path: an image or a built-in sprite name" + ], + "returns": "its height in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/getLocation", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/imageHeight", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/loadOrDefault(Supplier)", - "memberId": "extensions/fs/SaveData/loadOrDefault", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "loadOrDefault", + "id": "extension/Canvas/imageWidth(String)", + "memberId": "extension/Canvas/imageWidth", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "imageWidth", "static": false, - "returnType": "T", + "returnType": "int", "parameterTypes": [ - "java.util.function.Supplier" + "java.lang.String" ], "parameterNames": [ - "defaults" + "path" ], "params": [ - "Supplier defaults" + "String path" ], - "summary": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", - "description": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "defaults: creates initial progress for a missing slot; called only when missing" + "path: an image or a built-in sprite name" ], - "returns": "loaded progress, or the supplied defaults for a missing slot", + "returns": "its width in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/loadOrDefault", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/imageWidth", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/path()", - "memberId": "extensions/fs/SaveData/path", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "path", + "id": "extension/Canvas/noClip()", + "memberId": "extension/Canvas/noClip", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "noClip", "static": false, - "returnType": "Path", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", - "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "summary": "Draws everywhere again.", + "description": "Draws everywhere again.", "scratchblock": null, "paramDocs": [], - "returns": "the desktop file path", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/path", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/noClip", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/fs/SaveData/save(T)", - "memberId": "extensions/fs/SaveData/save", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "className": "SaveData", - "methodName": "save", + "id": "extension/Canvas/setOpacity(double)", + "memberId": "extension/Canvas/setOpacity", + "owner": "org.openpatch.scratch.extension.Canvas", + "className": "Canvas", + "methodName": "setOpacity", "static": false, "returnType": "void", "parameterTypes": [ - "T" + "double" ], "parameterNames": [ - "data" + "opacity" ], "params": [ - "T data" + "double opacity" ], - "summary": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", - "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "data: the progress to save; must not be null" + "opacity: how opaque what follows is drawn, 0 to 1" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/fs/SaveData/save", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Canvas/setOpacity", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/background()", - "memberId": "extensions/pixels/Pixels/background", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "background", + "id": "extension/Extension/coreVersion()", + "memberId": "extension/Extension/coreVersion", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "coreVersion", + "static": true, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "The version of the core library, e.g. `\"7.0.0\"`.", + "description": "The version of the core library, e.g. `\"7.0.0\"`.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/coreVersion", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/Extension/id()", + "memberId": "extension/Extension/id", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "id", "static": false, - "returnType": "int[]", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pixels of the background layer, where the pen and stamps draw.", - "description": "Returns the pixels of the background layer, where the pen and stamps draw.", + "summary": "A short unique id such as `\"tiled\"`, used in messages.", + "description": "A short unique id such as `\"tiled\"`, used in messages.", "scratchblock": null, "paramDocs": [], - "returns": "one colour per pixel", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/background", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/id", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/constructor(PGraphics,PGraphics,PGraphics)", - "memberId": "extensions/pixels/Pixels/constructor", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "constructor", + "id": "extension/Extension/install(ExtensionContext)", + "memberId": "extension/Extension/install", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "install", "static": false, - "returnType": "Pixels", + "returnType": "void", "parameterTypes": [ - "processing.core.PGraphics", - "processing.core.PGraphics", - "processing.core.PGraphics" + "org.openpatch.scratch.extension.ExtensionContext" ], "parameterNames": [ - "mainBuffer", - "backgroundBuffer", - "foregroundBuffer" + "ctx" ], "params": [ - "PGraphics mainBuffer", - "PGraphics backgroundBuffer", - "PGraphics foregroundBuffer" + "ExtensionContext ctx" ], - "summary": "Creates the pixel access for a stage.", - "description": "Creates the pixel access for a stage.", + "summary": "Adds the extension's hooks. Called once, on the window thread, before the first stage.", + "description": "Adds the extension's hooks. Called once, on the window thread, before the first stage.", "scratchblock": null, "paramDocs": [ - "mainBuffer: where the sprites are drawn", - "backgroundBuffer: where the background is drawn", - "foregroundBuffer: where the foreground is drawn" + "ctx: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/install", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/foreground()", - "memberId": "extensions/pixels/Pixels/foreground", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "foreground", + "id": "extension/Extension/name()", + "memberId": "extension/Extension/name", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "name", "static": false, - "returnType": "int[]", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pixels of the foreground layer.", - "description": "Returns the pixels of the foreground layer.", + "summary": "A name for people, such as `\"Tiled maps\"`.", + "description": "A name for people, such as `\"Tiled maps\"`.", "scratchblock": null, "paramDocs": [], - "returns": "one colour per pixel", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/foreground", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/name", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/pixels/Pixels/main()", - "memberId": "extensions/pixels/Pixels/main", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "className": "Pixels", - "methodName": "main", + "id": "extension/Extension/requires()", + "memberId": "extension/Extension/requires", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "requires", "static": false, - "returnType": "int[]", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the pixels of the layer the sprites are drawn on.", - "description": "Returns the pixels of the layer the sprites are drawn on.", + "summary": "The core versions this extension works with: `\"7\"` means any 7.x, `\"7.1\"` 7.1\nor newer, `\"7.1.2\"` 7.1.2 or newer, always below the next major version.", + "description": "The core versions this extension works with: `\"7\"` means any 7.x, `\"7.1\"` 7.1\nor newer, `\"7.1.2\"` 7.1.2 or newer, always below the next major version.", "scratchblock": null, "paramDocs": [], - "returns": "one colour per pixel", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/pixels/Pixels/main", - "availability": "desktop-only", - "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "translations": {} - }, - { - "id": "extensions/recorder/FFmpegRecorder/constructor(String)", - "memberId": "extensions/recorder/FFmpegRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "className": "FFmpegRecorder", - "methodName": "constructor", - "static": false, - "returnType": "FFmpegRecorder", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "path" - ], - "params": [ - "String path" - ], - "summary": "Constructs an FFmpegRecorder object with the specified path.", - "description": "Constructs an FFmpegRecorder object with the specified path.", - "scratchblock": null, - "paramDocs": [ - "path: the path where the recording will be saved\n \n\nThis constructor initializes the FFmpegRecorder by creating a temporary directory and\n setting up a pattern for temporary PNG files. If the temporary directory cannot be created,\n an error message is printed to the console." - ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FFmpegRecorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/requires", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FFmpegRecorder/saveFrame()", - "memberId": "extensions/recorder/FFmpegRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "className": "FFmpegRecorder", - "methodName": "saveFrame", + "id": "extension/Extension/version()", + "memberId": "extension/Extension/version", + "owner": "org.openpatch.scratch.extension.Extension", + "className": "Extension", + "methodName": "version", "static": false, - "returnType": "void", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Saves the current frame using the specified pattern.", - "description": "Saves the current frame using the specified pattern.", + "summary": "The extension's own version.", + "description": "The extension's own version.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FFmpegRecorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Extension/version", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FFmpegRecorder/stop()", - "memberId": "extensions/recorder/FFmpegRecorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "className": "FFmpegRecorder", - "methodName": "stop", + "id": "extension/ExtensionContext/addLayerDrawer(Layer,LayerDrawer)", + "memberId": "extension/ExtensionContext/addLayerDrawer", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "addLayerDrawer", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the recording process and converts the recorded frames into a video file using FFmpeg.", - "description": "Stops the recording process and converts the recorded frames into a video file using FFmpeg.\n\nThis method overrides the `stop` method from the superclass. It first calls the superclass's\n`stop` method, then checks if the temporary directory (`tmpDir`) is not null. If it is not\nnull, it constructs a command to run FFmpeg, which converts the recorded frames (stored as PNG\nfiles) into a video file with the specified frame rate and codec.\n\nThe FFmpeg command is executed, and a message is printed to the console indicating that the\nvideo conversion is in progress. If there is an error during the execution of the command, the\nerror message is printed to the console.", + "parameterTypes": [ + "org.openpatch.scratch.Layer", + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" + ], + "parameterNames": [ + "layer", + "drawer" + ], + "params": [ + "Layer layer", + "LayerDrawer drawer" + ], + "summary": "Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles,\ndrawings. Game thread, when the draw list is made.", + "description": "Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles,\ndrawings. Game thread, when the draw list is made.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "layer: ", + "drawer: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FFmpegRecorder/stop", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/addLayerDrawer", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FrameRecorder/constructor(String)", - "memberId": "extensions/recorder/FrameRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "className": "FrameRecorder", - "methodName": "constructor", + "id": "extension/ExtensionContext/addOverlayDrawer(LayerDrawer)", + "memberId": "extension/ExtensionContext/addOverlayDrawer", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "addOverlayDrawer", "static": false, - "returnType": "FrameRecorder", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], "parameterNames": [ - "outputFolder" + "drawer" ], "params": [ - "String outputFolder" + "LayerDrawer drawer" ], - "summary": "Constructs a new FrameRecorder with the specified output folder.", - "description": "Constructs a new FrameRecorder with the specified output folder.", + "summary": "Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave\nit out (Studio's watch pins). Game thread.", + "description": "Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave\nit out (Studio's watch pins). Game thread.", "scratchblock": null, "paramDocs": [ - "outputFolder: the folder where the recorded frames will be saved" + "drawer: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FrameRecorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/addOverlayDrawer", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FrameRecorder/saveFrame()", - "memberId": "extensions/recorder/FrameRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "className": "FrameRecorder", - "methodName": "saveFrame", + "id": "extension/ExtensionContext/afterFrame(BiConsumer)", + "memberId": "extension/ExtensionContext/afterFrame", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "afterFrame", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Saves the current frame of the stage to the specified output folder. The frame is saved as a\nPNG file with a filename pattern \"#######.png\". The exact filename will be generated based on\nthe current frame number. The picture is the stage at its own size, also when the window is\nbigger.", - "description": "Saves the current frame of the stage to the specified output folder. The frame is saved as a\nPNG file with a filename pattern \"#######.png\". The exact filename will be generated based on\nthe current frame number. The picture is the stage at its own size, also when the window is\nbigger.", + "parameterTypes": [ + "java.util.function.BiConsumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "BiConsumer hook" + ], + "summary": "After a frame was drawn, on the window thread.", + "description": "After a frame was drawn, on the window thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FrameRecorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/afterFrame", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/FrameRecorder/snapshot(String)", - "memberId": "extensions/recorder/FrameRecorder/snapshot", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "className": "FrameRecorder", - "methodName": "snapshot", + "id": "extension/ExtensionContext/beforeTick(Consumer)", + "memberId": "extension/ExtensionContext/beforeTick", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "beforeTick", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.util.function.Consumer" ], "parameterNames": [ - "filename" + "hook" ], "params": [ - "String filename" + "Consumer hook" ], - "summary": "Takes a snapshot of the current frame and saves it to the specified filename.", - "description": "Takes a snapshot of the current frame and saves it to the specified filename.", + "summary": "Every tick, after the tick's input and before timers and `run()`. Game thread.", + "description": "Every tick, after the tick's input and before timers and `run()`. Game thread.", "scratchblock": null, "paramDocs": [ - "filename: the name of the file to save the snapshot to" + "hook: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/FrameRecorder/snapshot", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/beforeTick", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/constructor(String)", - "memberId": "extensions/recorder/GifRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "constructor", + "id": "extension/ExtensionContext/dispatch(Stage,Class,Consumer)", + "memberId": "extension/ExtensionContext/dispatch", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "dispatch", "static": false, - "returnType": "GifRecorder", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.Stage", + "java.lang.Class", + "java.util.function.Consumer" ], "parameterNames": [ - "filePath" + "stage", + "listener", + "call" ], "params": [ - "String filePath" + "Stage stage", + "Class listener", + "Consumer call" ], - "summary": "Constructs a new GifRecorder object.", - "description": "Constructs a new GifRecorder object.", + "summary": "Calls a listener interface on the stage and every sprite of it that implements it, at the\npoint of the tick where key events arrive. Learner exceptions thrown there stop the game like\nany learner exception. Game thread.", + "description": "Calls a listener interface on the stage and every sprite of it that implements it, at the\npoint of the tick where key events arrive. Learner exceptions thrown there stop the game like\nany learner exception. Game thread.", "scratchblock": null, "paramDocs": [ - "filePath: the path where the GIF file will be saved" + "stage: ", + "listener: ", + "call: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/dispatch", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/saveFrame()", - "memberId": "extensions/recorder/GifRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "saveFrame", + "id": "extension/ExtensionContext/getTickCount()", + "memberId": "extension/ExtensionContext/getTickCount", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "getTickCount", "static": false, - "returnType": "void", + "returnType": "long", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Saves the current frame of the stage as a GIF image.", - "description": "Saves the current frame of the stage as a GIF image.\n\nThis method captures the stage at its own size, sets the frame rate, and adds the frame to\nthe GIF encoder. A window that is bigger than the stage (maximized, say) records the stage\nwithout the bars around it, and the frames keep their size when the window changes during the\nrecording.\n\nNote: This method catches and ignores any NullPointerException that may occur.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], + "returns": "ticks run so far", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/getTickCount", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/ExtensionContext/input(InputKey)", + "memberId": "extension/ExtensionContext/input", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "input", + "static": false, + "returnType": "T", + "parameterTypes": [ + "org.openpatch.scratch.extension.ExtensionContext.InputKey" + ], + "parameterNames": [ + "key" + ], + "params": [ + "InputKey key" + ], + "summary": "This batch's copy of a slot of the input snapshot. Game thread.", + "description": "This batch's copy of a slot of the input snapshot. Game thread.", + "scratchblock": null, + "paramDocs": [ + "key: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/input", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/snapshot()", - "memberId": "extensions/recorder/GifRecorder/snapshot", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "snapshot", + "id": "extension/ExtensionContext/isLoading()", + "memberId": "extension/ExtensionContext/isLoading", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "isLoading", "static": false, - "returnType": "void", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the\ncurrent frame, and then finishes the encoding process.", - "description": "Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the\ncurrent frame, and then finishes the encoding process.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": null, + "returns": "whether the loading screen is up", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/snapshot", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/isLoading", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/start()", - "memberId": "extensions/recorder/GifRecorder/start", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "start", + "id": "extension/ExtensionContext/onExit(Runnable)", + "memberId": "extension/ExtensionContext/onExit", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onExit", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Starts the GIF recording process.", - "description": "Starts the GIF recording process.", + "parameterTypes": [ + "java.lang.Runnable" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Runnable hook" + ], + "summary": "At the end of the program, after `whenExits()`. Game thread.", + "description": "At the end of the program, after `whenExits()`. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/start", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onExit", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/GifRecorder/stop()", - "memberId": "extensions/recorder/GifRecorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "className": "GifRecorder", - "methodName": "stop", + "id": "extension/ExtensionContext/onInputPoll(Consumer)", + "memberId": "extension/ExtensionContext/onInputPoll", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onInputPoll", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the GIF recording process and finalizes the GIF file.", - "description": "Stops the GIF recording process and finalizes the GIF file.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into\nthe snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed.", + "description": "Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into\nthe snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/GifRecorder/stop", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onInputPoll", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/constructor(String,String)", - "memberId": "extensions/recorder/Recorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "constructor", + "id": "extension/ExtensionContext/onKey(Consumer)", + "memberId": "extension/ExtensionContext/onKey", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onKey", "static": false, - "returnType": "Recorder", + "returnType": "void", "parameterTypes": [ - "java.lang.String", - "java.lang.String" + "java.util.function.Consumer" ], "parameterNames": [ - "path", - "ext" + "hook" ], "params": [ - "String path", - "String ext" + "Consumer hook" ], - "summary": "Constructs a new Recorder object with the specified file path and extension. If the provided\npath does not end with the specified extension, the extension is appended to the path.", - "description": "Constructs a new Recorder object with the specified file path and extension. If the provided\npath does not end with the specified extension, the extension is appended to the path.", + "summary": "Every key press and release, before learner code sees it; observe only. Game thread.", + "description": "Every key press and release, before learner code sees it; observe only. Game thread.", "scratchblock": null, "paramDocs": [ - "path: the file path where the recording will be saved", - "ext: the file extension to be used for the recording" + "hook: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onKey", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/post()", - "memberId": "extensions/recorder/Recorder/post", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "post", + "id": "extension/ExtensionContext/onLearnerError(Consumer)", + "memberId": "extension/ExtensionContext/onLearnerError", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onLearnerError", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Called after each frame is drawn. This method is registered with the Applet class to ensure\nthat frames are saved at the appropriate time during the recording process.", - "description": "Called after each frame is drawn. This method is registered with the Applet class to ensure\nthat frames are saved at the appropriate time during the recording process.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "A learner exception stopped the game. Game thread.", + "description": "A learner exception stopped the game. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/post", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onLearnerError", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/saveFrame()", - "memberId": "extensions/recorder/Recorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "saveFrame", + "id": "extension/ExtensionContext/onMouse(Consumer)", + "memberId": "extension/ExtensionContext/onMouse", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onMouse", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Saves the current frame. This method should be implemented by subclasses to define the specific\nbehavior for saving a frame.", - "description": "Saves the current frame. This method should be implemented by subclasses to define the specific\nbehavior for saving a frame.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "Every mouse event, before learner code sees it; observe only. Game thread.", + "description": "Every mouse event, before learner code sees it; observe only. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/saveFrame", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onMouse", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/start()", - "memberId": "extensions/recorder/Recorder/start", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "start", + "id": "extension/ExtensionContext/onStageCreated(Consumer)", + "memberId": "extension/ExtensionContext/onStageCreated", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onStageCreated", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Starts the recording process.", - "description": "Starts the recording process.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "A stage was made (on the thread that made it, usually the game thread or main).", + "description": "A stage was made (on the thread that made it, usually the game thread or main).", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/start", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onStageCreated", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/recorder/Recorder/stop()", - "memberId": "extensions/recorder/Recorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", - "className": "Recorder", - "methodName": "stop", + "id": "extension/ExtensionContext/onStageDisposed(Consumer)", + "memberId": "extension/ExtensionContext/onStageDisposed", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "onStageDisposed", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops the recording process.", - "description": "Stops the recording process.", + "parameterTypes": [ + "java.util.function.Consumer" + ], + "parameterNames": [ + "hook" + ], + "params": [ + "Consumer hook" + ], + "summary": "A stage stopped being shown. Game thread.", + "description": "A stage stopped being shown. Game thread.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "hook: " + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/recorder/Recorder/stop", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/onStageDisposed", "availability": "desktop-only", "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/constructor(String,String,String)", - "memberId": "extensions/shader/Shader/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "constructor", + "id": "extension/ExtensionContext/registerImageFormat(String,ImageDecoder)", + "memberId": "extension/ExtensionContext/registerImageFormat", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "registerImageFormat", "static": false, - "returnType": "Shader", + "returnType": "void", "parameterTypes": [ "java.lang.String", - "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder" ], "parameterNames": [ - "name", - "fragmentShaderPath", - "vertexShaderPath" + "suffix", + "decoder" ], "params": [ - "String name", - "String fragmentShaderPath", - "String vertexShaderPath" + "String suffix", + "ImageDecoder decoder" ], - "summary": "Constructor", - "description": "Constructor", + "summary": "Images whose name ends in `suffix` (e.g. `\".ase\"`) are decoded by\n`decoder`.", + "description": "Images whose name ends in `suffix` (e.g. `\".ase\"`) are decoded by\n`decoder`.", "scratchblock": null, "paramDocs": [ - "name: unique name", - "fragmentShaderPath: path to the fragment shader file", - "vertexShaderPath: path to the vertex shader file, or null for Processing's default one" + "suffix: ", + "decoder: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/registerImageFormat", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/constructor(Shader)", - "memberId": "extensions/shader/Shader/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "constructor", + "id": "extension/ExtensionContext/runOnGameThread(Runnable)", + "memberId": "extension/ExtensionContext/runOnGameThread", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "className": "ExtensionContext", + "methodName": "runOnGameThread", "static": false, - "returnType": "Shader", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.shader.Shader" + "java.lang.Runnable" ], "parameterNames": [ - "shader" + "task" ], "params": [ - "Shader shader" + "Runnable task" ], - "summary": "Copy constructor", - "description": "Copy constructor", + "summary": "Runs a task at the start of the next tick, before input.", + "description": "Runs a task at the start of the next tick, before input.", "scratchblock": null, "paramDocs": [ - "shader: shader" + "task: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ExtensionContext/runOnGameThread", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/getName()", - "memberId": "extensions/shader/Shader/getName", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "getName", + "id": "extension/Frame/getArgb()", + "memberId": "extension/Frame/getArgb", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "getArgb", "static": false, - "returnType": "String", + "returnType": "int[]", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the name", - "description": "Returns the name", + "summary": "Straight ARGB, top row first.", + "description": "Straight ARGB, top row first.", "scratchblock": null, "paramDocs": [], - "returns": "the name", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/getName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/getArgb", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/getPShader()", - "memberId": "extensions/shader/Shader/getPShader", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "getPShader", + "id": "extension/Frame/getHeight()", + "memberId": "extension/Frame/getHeight", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "getHeight", "static": false, - "returnType": "PShader", + "returnType": "int", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the shader", - "description": "Returns the shader", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], - "returns": "the shader", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/getPShader", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/getHeight", "availability": "desktop-only", - "availabilityReason": "Processing's PShader object belongs to the desktop renderer. The browser uses WebGL filters.", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/Frame/getWidth()", + "memberId": "extension/Frame/getWidth", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "getWidth", + "static": false, + "returnType": "int", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/getWidth", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/Frame/savePng(Path)", + "memberId": "extension/Frame/savePng", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "className": "Frame", + "methodName": "savePng", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "int" + "java.nio.file.Path" ], "parameterNames": [ - "name", - "x" + "file" ], "params": [ - "String name", - "int x" + "Path file" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: the name of the uniform in the shader file", - "x: the value" + "file: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/Frame/savePng", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,boolean)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/ImageDecoder/decode(byte[])", + "memberId": "extension/ImageDecoder/decode", + "owner": "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder", + "className": "ImageDecoder", + "methodName": "decode", "static": false, - "returnType": "void", + "returnType": "DecodedImage", "parameterTypes": [ - "java.lang.String", - "boolean" + "byte[]" ], "parameterNames": [ - "name", - "x" + "file" ], "params": [ - "String name", - "boolean x" + "byte[] file" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: " + "file: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/ImageDecoder/decode", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,double)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/InputKey/copy(T,T)", + "memberId": "extension/InputKey/copy", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "copy", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double" + "T", + "T" ], "parameterNames": [ - "name", - "x" + "from", + "into" ], "params": [ - "String name", - "double x" + "T from", + "T into" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "For the core: copies one state into another.", + "description": "For the core: copies one state into another.", "scratchblock": null, "paramDocs": [ - "name: ", - "x: " + "from: ", + "into: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/copy", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,int,int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/InputKey/create()", + "memberId": "extension/InputKey/create", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "create", "static": false, - "returnType": "void", + "returnType": "T", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "For the core: makes a state for this key.", + "description": "For the core: makes a state for this key.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/create", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/InputKey/of(String,Supplier,BiConsumer)", + "memberId": "extension/InputKey/of", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "of", + "static": true, + "returnType": "InputKey", "parameterTypes": [ "java.lang.String", - "int", - "int" + "java.util.function.Supplier", + "java.util.function.BiConsumer" ], "parameterNames": [ "name", - "x", - "y" + "factory", + "copy" ], "params": [ "String name", - "int x", - "int y" + "Supplier factory", + "BiConsumer copy" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: ", - "y: " + "name: for messages", + "factory: makes an empty state (twice: one per thread)", + "copy: copies the window thread's state into the game thread's: (from, into)" ], + "returns": "the key", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/of", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "extension/InputKey/toString()", + "memberId": "extension/InputKey/toString", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "className": "InputKey", + "methodName": "toString", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputKey/toString", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,boolean,boolean)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/InputSnapshot/get(InputKey)", + "memberId": "extension/InputSnapshot/get", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputSnapshot", + "className": "InputSnapshot", + "methodName": "get", "static": false, - "returnType": "void", + "returnType": "T", "parameterTypes": [ - "java.lang.String", - "boolean", - "boolean" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], "parameterNames": [ - "name", - "x", - "y" + "key" ], "params": [ - "String name", - "boolean x", - "boolean y" + "InputKey key" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: ", - "y: " + "key: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/InputSnapshot/get", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,double,double)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", + "id": "extension/LayerDrawer/draw(Stage,Canvas)", + "memberId": "extension/LayerDrawer/draw", + "owner": "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer", + "className": "LayerDrawer", + "methodName": "draw", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String", - "double", - "double" + "org.openpatch.scratch.Stage", + "org.openpatch.scratch.extension.Canvas" ], "parameterNames": [ - "name", - "x", - "y" + "stage", + "canvas" ], "params": [ - "String name", - "double x", - "double y" + "Stage stage", + "Canvas canvas" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [ - "name: ", - "x: ", - "y: " + "stage: ", + "canvas: " ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/extension/LayerDrawer/draw", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,Vector2)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getStick(GamepadStick)", + "memberId": "gamepad/Gamepad/getStick", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getStick", + "static": true, + "returnType": "Vector2", "parameterTypes": [ - "java.lang.String", - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.gamepad.GamepadStick" ], "parameterNames": [ - "name", - "vec" + "stick" ], "params": [ - "String name", - "Vector2 vec" + "GamepadStick stick" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "Where the first connected controller's stick points, (0, 0) if there is none.", + "description": "Where the first connected controller's stick points, (0, 0) if there is none.", "scratchblock": null, "paramDocs": [ - "name: ", - "vec: " + "stick: the stick to ask about" ], - "returns": null, + "returns": "its position, x \\u22121 to 1 and y \\u22121 to 1 (up is positive)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getStick", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,int[],int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getStick(int,GamepadStick)", + "memberId": "gamepad/Gamepad/getStick", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getStick", + "static": true, + "returnType": "Vector2", "parameterTypes": [ - "java.lang.String", - "int[]", - "int" + "int", + "org.openpatch.scratch.gamepad.GamepadStick" ], "parameterNames": [ - "name", - "values", - "ncoords" + "player", + "stick" ], "params": [ - "String name", - "int[] values", - "int ncoords" + "int player", + "GamepadStick stick" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "Where the player's controller's stick points, (0, 0) if it is not connected.", + "description": "Where the player's controller's stick points, (0, 0) if it is not connected.", "scratchblock": null, "paramDocs": [ - "name: ", - "values: ", - "ncoords: " + "player: the player, 1 to 4", + "stick: the stick to ask about" ], - "returns": null, + "returns": "its position, x \\u22121 to 1 and y \\u22121 to 1 (up is positive)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getStick", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,double[],int)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getTrigger(GamepadTrigger)", + "memberId": "gamepad/Gamepad/getTrigger", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getTrigger", + "static": true, + "returnType": "double", "parameterTypes": [ - "java.lang.String", - "double[]", - "int" + "org.openpatch.scratch.gamepad.GamepadTrigger" ], "parameterNames": [ - "name", - "values", - "ncoords" + "trigger" ], "params": [ - "String name", - "double[] values", - "int ncoords" + "GamepadTrigger trigger" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "How far down the first connected controller's trigger is, 0 if there is none.", + "description": "How far down the first connected controller's trigger is, 0 if there is none.", "scratchblock": null, "paramDocs": [ - "name: ", - "values: ", - "ncoords: " + "trigger: the trigger to ask about" ], - "returns": null, + "returns": "how far it is pressed, 0 (not at all) to 1 (fully)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getTrigger", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/set(String,Color)", - "memberId": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "set", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/getTrigger(int,GamepadTrigger)", + "memberId": "gamepad/Gamepad/getTrigger", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "getTrigger", + "static": true, + "returnType": "double", "parameterTypes": [ - "java.lang.String", - "org.openpatch.scratch.Color" + "int", + "org.openpatch.scratch.gamepad.GamepadTrigger" ], "parameterNames": [ - "name", - "c" + "player", + "trigger" ], "params": [ - "String name", - "Color c" + "int player", + "GamepadTrigger trigger" ], - "summary": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.", - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "summary": "How far down the player's controller's trigger is, 0 if it is not connected.", + "description": "How far down the player's controller's trigger is, 0 if it is not connected.", "scratchblock": null, "paramDocs": [ - "name: ", - "c: " + "player: the player, 1 to 4", + "trigger: the trigger to ask about" ], - "returns": null, + "returns": "how far it is pressed, 0 (not at all) to 1 (fully)", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/set", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/getTrigger", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shader/setName(String)", - "memberId": "extensions/shader/Shader/setName", - "owner": "org.openpatch.scratch.extensions.shader.Shader", - "className": "Shader", - "methodName": "setName", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/isButtonPressed(GamepadButton)", + "memberId": "gamepad/Gamepad/isButtonPressed", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isButtonPressed", + "static": true, + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "name" + "button" ], "params": [ - "String name" + "GamepadButton button" ], - "summary": "Sets the name", - "description": "Sets the name", + "summary": "Whether any controller has the button down.", + "description": "Whether any controller has the button down.", "scratchblock": null, "paramDocs": [ - "name: unique name" + "button: the button to ask about" ], - "returns": null, + "returns": "whether it is down on any connected controller", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shader/setName", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isButtonPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/activate(String)", - "memberId": "extensions/shader/Shaders/activate", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "activate", - "static": false, - "returnType": "void", + "id": "gamepad/Gamepad/isButtonPressed(int,GamepadButton)", + "memberId": "gamepad/Gamepad/isButtonPressed", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isButtonPressed", + "static": true, + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "int", + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "name" + "player", + "button" ], "params": [ - "String name" + "int player", + "GamepadButton button" ], - "summary": "Draws with the shader of the given name as well, without stopping the\nothers. Active shaders take turns in the order they were added, each\nworking on what the one before it drew, so a stage can be tinted and\nwobble at the same time. A sprite draws with the first of its active\nshaders only.", - "description": "Draws with the shader of the given name as well, without stopping the\nothers. Active shaders take turns in the order they were added, each\nworking on what the one before it drew, so a stage can be tinted and\nwobble at the same time. A sprite draws with the first of its active\nshaders only.", + "summary": "Whether the player's controller has the button down.", + "description": "Whether the player's controller has the button down.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "player: the player, 1 to 4", + "button: the button to ask about" ], + "returns": "whether it is down on that player's controller", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isButtonPressed", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "gamepad/Gamepad/isConnected()", + "memberId": "gamepad/Gamepad/isConnected", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isConnected", + "static": true, + "returnType": "boolean", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Whether any controller is connected.", + "description": "Whether any controller is connected.", + "scratchblock": null, + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/activate", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isConnected", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/add(String,String,String)", - "memberId": "extensions/shader/Shaders/add", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "add", - "static": false, - "returnType": "Shader", + "id": "gamepad/Gamepad/isConnected(int)", + "memberId": "gamepad/Gamepad/isConnected", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "className": "Gamepad", + "methodName": "isConnected", + "static": true, + "returnType": "boolean", "parameterTypes": [ - "java.lang.String", - "java.lang.String", - "java.lang.String" + "int" ], "parameterNames": [ - "name", - "fragmentShaderPath", - "vertexShaderPath" + "player" ], "params": [ - "String name", - "String fragmentShaderPath", - "String vertexShaderPath" + "int player" ], - "summary": "Adds a shader. If a shader with the given name already exists, that one is\nreturned instead.", - "description": "Adds a shader. If a shader with the given name already exists, that one is\nreturned instead.\n\nThe first shader added is drawn with right away; the ones after it wait\nuntil [switchTo(String)](switchTo), [next()](next) or\n[activate(String)](activate) picks them.\n\nThe vertex shader is usually `null`, which uses Processing's default\none. In the browser any other vertex shader is ignored.", + "summary": "Whether a controller sits in the player's slot.", + "description": "Whether a controller sits in the player's slot.", "scratchblock": null, "paramDocs": [ - "name: a unique name", - "fragmentShaderPath: the path to the fragment shader", - "vertexShaderPath: the path to the vertex shader, may be null" + "player: the player, 1 to 4" ], - "returns": "the shader", + "returns": "whether that slot has a controller", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/add", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/Gamepad/isConnected", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/constructor(String)", - "memberId": "extensions/shader/Shaders/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "constructor", + "id": "gamepad/GamepadListener/whenGamepadButtonPressed(GamepadButton)", + "memberId": "gamepad/GamepadListener/whenGamepadButtonPressed", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "className": "GamepadListener", + "methodName": "whenGamepadButtonPressed", "static": false, - "returnType": "Shaders", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "owner" + "button" ], "params": [ - "String owner" + "GamepadButton button" ], - "summary": "Creates an empty set of shaders.", - "description": "Creates an empty set of shaders.", + "summary": "A button went down on one of the controllers.", + "description": "A button went down on one of the controllers.", "scratchblock": null, "paramDocs": [ - "owner: what the shaders belong to, used in error messages: \"sprite\" or\n \"stage\"" + "button: the button that was pressed" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/GamepadListener/whenGamepadButtonPressed", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/constructor(Shaders)", - "memberId": "extensions/shader/Shaders/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "constructor", + "id": "gamepad/GamepadListener/whenGamepadButtonReleased(GamepadButton)", + "memberId": "gamepad/GamepadListener/whenGamepadButtonReleased", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "className": "GamepadListener", + "methodName": "whenGamepadButtonReleased", "static": false, - "returnType": "Shaders", + "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.shader.Shaders" + "org.openpatch.scratch.gamepad.GamepadButton" ], "parameterNames": [ - "s" + "button" ], "params": [ - "Shaders s" + "GamepadButton button" ], - "summary": "Copies a set of shaders.", - "description": "Copies a set of shaders.", + "summary": "A button came up on one of the controllers.", + "description": "A button came up on one of the controllers.", "scratchblock": null, "paramDocs": [ - "s: the shaders to copy" + "button: the button that was released" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/GamepadListener/whenGamepadButtonReleased", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/deactivate(String)", - "memberId": "extensions/shader/Shaders/deactivate", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "deactivate", + "id": "gamepad/GamepadListener/whenGamepadConnected(int)", + "memberId": "gamepad/GamepadListener/whenGamepadConnected", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "className": "GamepadListener", + "methodName": "whenGamepadConnected", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "player" ], "params": [ - "String name" + "int player" ], - "summary": "Stops drawing with the shader of the given name. The other active shaders\nstay.", - "description": "Stops drawing with the shader of the given name. The other active shaders\nstay.", + "summary": "A controller appeared in a player's slot.", + "description": "A controller appeared in a player's slot.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "player: the player whose slot got a controller, 1 to 4" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/deactivate", + "docsUrl": "https://scratch4j.openpatch.org/reference/gamepad/GamepadListener/whenGamepadConnected", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/shader/Shaders/get(String)", - "memberId": "extensions/shader/Shaders/get", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "get", + "id": "recorder/GifEncoder/addFrame(int[],int,int)", + "memberId": "recorder/GifEncoder/addFrame", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "addFrame", "static": false, - "returnType": "Shader", + "returnType": "boolean", "parameterTypes": [ - "java.lang.String" + "int[]", + "int", + "int" ], "parameterNames": [ - "name" + "argb", + "width", + "height" ], "params": [ - "String name" + "int[] argb", + "int width", + "int height" ], - "summary": "Returns a shader by name.", - "description": "Returns a shader by name.", + "summary": "Adds next GIF frame as an ARGB pixel array, top row first (0xAARRGGBB). The alpha channel is\nignored. The frame is not written immediately, but is actually deferred until the next frame\nis received so that timing data can be inserted. Invoking finish() flushes all\nframes. The size of the first frame is used for all subsequent frames; frames of another size\nare scaled with nearest-neighbour sampling.", + "description": "Adds next GIF frame as an ARGB pixel array, top row first (0xAARRGGBB). The alpha channel is\nignored. The frame is not written immediately, but is actually deferred until the next frame\nis received so that timing data can be inserted. Invoking finish() flushes all\nframes. The size of the first frame is used for all subsequent frames; frames of another size\nare scaled with nearest-neighbour sampling.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "argb: int array containing the frame's pixels, top row first.", + "width: int frame width.", + "height: int frame height." ], - "returns": "the shader, or null if there is none with that name", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/get", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/shader/Shaders/getActive()", - "memberId": "extensions/shader/Shaders/getActive", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getActive", - "static": false, - "returnType": "List", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shaders drawn with, in the order they take turns: the order in\nwhich they were added.", - "description": "Returns the shaders drawn with, in the order they take turns: the order in\nwhich they were added.", - "scratchblock": null, - "paramDocs": [], - "returns": "a new list of the active shaders, empty if there are none", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getActive", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/shader/Shaders/getCurrent()", - "memberId": "extensions/shader/Shaders/getCurrent", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getCurrent", - "static": false, - "returnType": "Shader", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Returns the shader currently drawn with. With several active, this is the\nfirst of them.", - "description": "Returns the shader currently drawn with. With several active, this is the\nfirst of them.", - "scratchblock": null, - "paramDocs": [], - "returns": "the current shader, or null if there is none", + "returns": "true if successful.", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getCurrent", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/addFrame", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/getCurrentIndex()", - "memberId": "extensions/shader/Shaders/getCurrentIndex", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getCurrentIndex", + "id": "recorder/GifEncoder/constructor()", + "memberId": "recorder/GifEncoder/constructor", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "constructor", "static": false, - "returnType": "int", + "returnType": "GifEncoder", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the position of the current shader.", - "description": "Returns the position of the current shader.", + "summary": "Encodes a GIF file consisting of one or more frames.", + "description": "Encodes a GIF file consisting of one or more frames.\n\n
\n Example:\n    GifEncoder e = new GifEncoder();\n    e.start(outputFileName);\n    e.setDelay(1000);   // 1 frame per sec\n    e.addFrame(argbPixels, width, height);\n    e.finish();\n
\n\nPorted from AnimatedGifEncoder (Kevin Weiner, FM Software, November 2003), with the LZW encoder\nadapted from Jef Poskanzer's Java port by way of J. M. G. Elliott, and the NeuQuant neural-net\nquantizer by Anthony Dekker, 1994. Uses only java.base: frames arrive as ARGB int arrays\ninstead of BufferedImages.", "scratchblock": null, "paramDocs": [], - "returns": "the position, or -1 if no shader is in use", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getCurrentIndex", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/constructor", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/getCurrentName()", - "memberId": "extensions/shader/Shaders/getCurrentName", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "getCurrentName", + "id": "recorder/GifEncoder/finish()", + "memberId": "recorder/GifEncoder/finish", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "finish", "static": false, - "returnType": "String", + "returnType": "boolean", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the name of the current shader.", - "description": "Returns the name of the current shader.", + "summary": "Flushes any pending data and closes output file. If writing to an OutputStream, the stream is\nnot closed.", + "description": "Flushes any pending data and closes output file. If writing to an OutputStream, the stream is\nnot closed.", "scratchblock": null, "paramDocs": [], - "returns": "the name, or null if no shader is in use", + "returns": "true if finished", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/getCurrentName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/finish", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/isActive(String)", - "memberId": "extensions/shader/Shaders/isActive", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "isActive", + "id": "recorder/GifEncoder/setDelay(int)", + "memberId": "recorder/GifEncoder/setDelay", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setDelay", "static": false, - "returnType": "boolean", + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "ms" ], "params": [ - "String name" + "int ms" ], - "summary": "Returns whether the shader of the given name is drawn with.", - "description": "Returns whether the shader of the given name is drawn with.", + "summary": "Sets the delay time between each frame, or changes it for subsequent frames (applies to last\nframe added).", + "description": "Sets the delay time between each frame, or changes it for subsequent frames (applies to last\nframe added).", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "ms: int delay time in milliseconds" ], - "returns": "true if the shader is active", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/isActive", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setDelay", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/next()", - "memberId": "extensions/shader/Shaders/next", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "next", + "id": "recorder/GifEncoder/setDispose(int)", + "memberId": "recorder/GifEncoder/setDispose", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setDispose", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Switches to the next shader, in the order they were added. After the last\none comes the first one again. It is then the only one drawn with.", - "description": "Switches to the next shader, in the order they were added. After the last\none comes the first one again. It is then the only one drawn with.", + "parameterTypes": [ + "int" + ], + "parameterNames": [ + "code" + ], + "params": [ + "int code" + ], + "summary": "Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default\nis 0 if no transparent color has been set, otherwise 2.", + "description": "Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default\nis 0 if no transparent color has been set, otherwise 2.", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "code: int disposal code." + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/next", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setDispose", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/reset()", - "memberId": "extensions/shader/Shaders/reset", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "reset", + "id": "recorder/GifEncoder/setFrameRate(float)", + "memberId": "recorder/GifEncoder/setFrameRate", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setFrameRate", "static": false, "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops drawing with shaders, so the sprite or stage looks as it does\nwithout one. The shaders are kept: [switchTo(String)](switchTo),\n[next()](next) or [activate(String)](activate) brings one back.", - "description": "Stops drawing with shaders, so the sprite or stage looks as it does\nwithout one. The shaders are kept: [switchTo(String)](switchTo),\n[next()](next) or [activate(String)](activate) brings one back.", + "parameterTypes": [ + "float" + ], + "parameterNames": [ + "fps" + ], + "params": [ + "float fps" + ], + "summary": "Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).", + "description": "Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).", "scratchblock": null, - "paramDocs": [], + "paramDocs": [ + "fps: float frame rate (frames per second)" + ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/reset", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setFrameRate", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/switchTo(String)", - "memberId": "extensions/shader/Shaders/switchTo", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "switchTo", + "id": "recorder/GifEncoder/setQuality(int)", + "memberId": "recorder/GifEncoder/setQuality", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setQuality", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "int" ], "parameterNames": [ - "name" + "quality" ], "params": [ - "String name" + "int quality" ], - "summary": "Switches to the shader with the given name, or with the given position in\nthe order the shaders were added. It is then the only one drawn with. A\nname that is not there leaves the shaders as they are and prints which ones\nthere are.", - "description": "Switches to the shader with the given name, or with the given position in\nthe order the shaders were added. It is then the only one drawn with. A\nname that is not there leaves the shaders as they are and prints which ones\nthere are.", + "summary": "Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by\nthe GIF specification). Lower values (minimum = 1) produce better colors, but slow processing\nsignificantly. 10 is the default, and produces good color mapping at reasonable speeds. Values\ngreater than 20 do not yield significant improvements in speed.", + "description": "Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by\nthe GIF specification). Lower values (minimum = 1) produce better colors, but slow processing\nsignificantly. 10 is the default, and produces good color mapping at reasonable speeds. Values\ngreater than 20 do not yield significant improvements in speed.", "scratchblock": null, "paramDocs": [ - "name: the name of the shader" + "quality: int greater than 0." ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/switchTo", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setQuality", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/shader/Shaders/switchTo(double)", - "memberId": "extensions/shader/Shaders/switchTo", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "className": "Shaders", - "methodName": "switchTo", + "id": "recorder/GifEncoder/setRepeat(int)", + "memberId": "recorder/GifEncoder/setRepeat", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setRepeat", "static": false, "returnType": "void", "parameterTypes": [ - "double" + "int" ], "parameterNames": [ - "index" + "iter" ], "params": [ - "double index" + "int iter" ], - "summary": "Switches to the shader at the given position. It is then the only one drawn\nwith.", - "description": "Switches to the shader at the given position. It is then the only one drawn\nwith.", + "summary": "Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play\nindefinitely. Must be invoked before the first image is added.", + "description": "Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play\nindefinitely. Must be invoked before the first image is added.", "scratchblock": null, "paramDocs": [ - "index: the position of the shader" + "iter: int number of iterations." ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/shader/Shaders/switchTo", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setRepeat", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "translations": {} }, { - "id": "extensions/sorting/Sorting/by(Comparator)", - "memberId": "extensions/sorting/Sorting/by", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "by", + "id": "recorder/GifEncoder/setTransparent(int)", + "memberId": "recorder/GifEncoder/setTransparent", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "setTransparent", "static": false, "returnType": "void", "parameterTypes": [ - "java.util.Comparator" + "int" ], "parameterNames": [ - "comparator" + "rgb" ], "params": [ - "Comparator comparator" + "int rgb" ], - "summary": "Draws sprites in an order of your own.", - "description": "Draws sprites in an order of your own.", + "summary": "Sets the transparent color for the last added frame and any subsequent frames. Since all\ncolors are subject to modification in the quantization process, the color in the final palette\nfor each frame closest to the given color becomes the transparent color for that frame. May be\nset to -1 to indicate no transparent color.", + "description": "Sets the transparent color for the last added frame and any subsequent frames. Since all\ncolors are subject to modification in the quantization process, the color in the final palette\nfor each frame closest to the given color becomes the transparent color for that frame. May be\nset to -1 to indicate no transparent color.", "scratchblock": null, "paramDocs": [ - "comparator: decides which of two sprites is drawn first" + "rgb: int color (0xRRGGBB) to be treated as transparent on display, or -1 for none." ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/by", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/setTransparent", "availability": "desktop-only", - "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "translations": {} + }, + { + "id": "recorder/GifEncoder/start(OutputStream)", + "memberId": "recorder/GifEncoder/start", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "start", + "static": false, + "returnType": "boolean", + "parameterTypes": [ + "java.io.OutputStream" + ], + "parameterNames": [ + "os" + ], + "params": [ + "OutputStream os" + ], + "summary": "Initiates GIF file creation on the given stream. The stream is not closed automatically.", + "description": "Initiates GIF file creation on the given stream. The stream is not closed automatically.", + "scratchblock": null, + "paramDocs": [ + "os: OutputStream on which GIF images are written." + ], + "returns": "false if initial write failed.", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/start", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "translations": {} + }, + { + "id": "recorder/GifEncoder/start(String)", + "memberId": "recorder/GifEncoder/start", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "className": "GifEncoder", + "methodName": "start", + "static": false, + "returnType": "boolean", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "file" + ], + "params": [ + "String file" + ], + "summary": "Initiates writing of a GIF file with the specified name.", + "description": "Initiates writing of a GIF file with the specified name.", + "scratchblock": null, + "paramDocs": [ + "file: String containing output file name." + ], + "returns": "false if open or initial write failed.", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifEncoder/start", + "availability": "desktop-only", + "availabilityReason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "translations": {} + }, + { + "id": "recorder/GifRecorder/constructor(String)", + "memberId": "recorder/GifRecorder/constructor", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "constructor", + "static": false, + "returnType": "GifRecorder", + "parameterTypes": [ + "java.lang.String" + ], + "parameterNames": [ + "path" + ], + "params": [ + "String path" + ], + "summary": "Records the stage as an animated GIF: every second frame of game time (30 a second), at stage\nsize, texts and the UI included.", + "description": "Records the stage as an animated GIF: every second frame of game time (30 a second), at stage\nsize, texts and the UI included.\n\n```java\nGifRecorder recorder = new GifRecorder(\"recording.gif\");\nrecorder.start();\n// \\u2026 later\nrecorder.stop();\n```", + "scratchblock": null, + "paramDocs": [ + "path: the GIF file to write; `.gif` is added when missing" + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/byY()", - "memberId": "extensions/sorting/Sorting/byY", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "byY", + "id": "recorder/GifRecorder/snapshot()", + "memberId": "recorder/GifRecorder/snapshot", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "snapshot", "static": false, "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Draws sprites that are further down the stage in front of sprites that are\nfurther up, which is what a view from above usually wants.", - "description": "Draws sprites that are further down the stage in front of sprites that are\nfurther up, which is what a view from above usually wants.", + "summary": "Saves the next frame as a GIF of one frame.", + "description": "Saves the next frame as a GIF of one frame.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/byY", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/snapshot", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/constructor()", - "memberId": "extensions/sorting/Sorting/constructor", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "constructor", + "id": "recorder/GifRecorder/start()", + "memberId": "recorder/GifRecorder/start", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "start", "static": false, - "returnType": "Sorting", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Decides the order in which the sprites of a stage are drawn.", - "description": "Decides the order in which the sprites of a stage are drawn.\n\nReached through `stage.getSorting()`:\n\n```java\nthis.getSorting().byY();\n```", + "summary": "Starts recording from the next frame on.", + "description": "Starts recording from the next frame on.", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/start", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/getComparator()", - "memberId": "extensions/sorting/Sorting/getComparator", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "getComparator", + "id": "recorder/GifRecorder/stop()", + "memberId": "recorder/GifRecorder/stop", + "owner": "org.openpatch.scratch.recorder.GifRecorder", + "className": "GifRecorder", + "methodName": "stop", "static": false, - "returnType": "Comparator", + "returnType": "void", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Returns the order currently used.", - "description": "Returns the order currently used.", + "summary": "Stops recording and finishes the file.", + "description": "Stops recording and finishes the file.", "scratchblock": null, "paramDocs": [], - "returns": "the comparator, or null if the sprites are not sorted", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/getComparator", - "availability": "desktop-only", - "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/GifRecorder/stop", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/sorting/Sorting/isOn()", - "memberId": "extensions/sorting/Sorting/isOn", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "isOn", + "id": "recorder/RecorderExtension/constructor()", + "memberId": "recorder/RecorderExtension/constructor", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "constructor", "static": false, - "returnType": "boolean", + "returnType": "RecorderExtension", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Checks whether the sprites are being sorted.", - "description": "Checks whether the sprites are being sorted.", + "summary": "Registers the recorder extension; found through ServiceLoader, learners never see it.", + "description": "Registers the recorder extension; found through ServiceLoader, learners never see it.", "scratchblock": null, "paramDocs": [], - "returns": "true if an order is set", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/isOn", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sorting/Sorting/off()", - "memberId": "extensions/sorting/Sorting/off", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "className": "Sorting", - "methodName": "off", + "id": "recorder/RecorderExtension/id()", + "memberId": "recorder/RecorderExtension/id", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "id", "static": false, - "returnType": "void", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Draws sprites in the order they were added, which is the default.", - "description": "Draws sprites in the order they were added, which is the default.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sorting/Sorting/off", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/close()", - "memberId": "extensions/sound/SoundPlayback/close", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "close", + "id": "recorder/RecorderExtension/install(ExtensionContext)", + "memberId": "recorder/RecorderExtension/install", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "install", "static": false, "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.extension.ExtensionContext" + ], + "parameterNames": [ + "ctx" + ], + "params": [ + "ExtensionContext ctx" + ], + "summary": "Hands every drawn frame to the recorders that are recording; frames are read back only then.", + "description": "Hands every drawn frame to the recorders that are recording; frames are read back only then.", + "scratchblock": null, + "paramDocs": [ + "ctx: " + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/install", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "recorder/RecorderExtension/name()", + "memberId": "recorder/RecorderExtension/name", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "name", + "static": false, + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "Stops this playback.", - "description": "Stops this playback.", + "summary": "", + "description": "", "scratchblock": null, "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/close", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/getName()", - "memberId": "extensions/sound/SoundPlayback/getName", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "getName", + "id": "recorder/RecorderExtension/requires()", + "memberId": "recorder/RecorderExtension/requires", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "requires", "static": false, "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "", - "description": "", + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", "scratchblock": null, "paramDocs": [], - "returns": "the name of the sound", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/getName", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/getVolume()", - "memberId": "extensions/sound/SoundPlayback/getVolume", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "getVolume", + "id": "recorder/RecorderExtension/version()", + "memberId": "recorder/RecorderExtension/version", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", + "className": "RecorderExtension", + "methodName": "version", "static": false, - "returnType": "double", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], @@ -17974,431 +18638,495 @@ "description": "", "scratchblock": null, "paramDocs": [], - "returns": "this playback's volume in percent", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/getVolume", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/recorder/RecorderExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/isPlaying()", - "memberId": "extensions/sound/SoundPlayback/isPlaying", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "isPlaying", + "id": "save/File/constructor()", + "memberId": "save/File/constructor", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "constructor", "static": false, - "returnType": "boolean", + "returnType": "File", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "", - "description": "", + "summary": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.", + "description": "The File class provides methods to save and load objects to and from files in\nJSON or XML format.\nIt supports saving and loading objects with automatic detection of file type\nbased on the method\nused. The class uses Jackson ObjectMapper for JSON and XmlMapper for XML\nserialization and\ndeserialization.\n\nUsage examples:\n\n```java\n// Save an object as JSON\nFile.save(\"/path/to/file.json\", myObject);\n\n// Save an object as XML\nFile.saveXML(\"/path/to/file.xml\", myObject);\n\n// Load an object from JSON\nMyClass obj = File.load(\"/path/to/file.json\", MyClass.class);\n\n// Load an object from XML\nMyClass obj = File.loadXML(\"/path/to/file.xml\", MyClass.class);\n```\n\nNote: The file paths can be absolute or relative. If a relative path is\nprovided, the class\nwill attempt to load the file from the classpath.\n\nSupported file types:\n\n
    \n
  • JSON\n
  • XML\n
", "scratchblock": null, "paramDocs": [], - "returns": "whether this playback is queued or playing", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/isPlaying", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/constructor", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "save/File/load(String,Class)", + "memberId": "save/File/load", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "load", + "static": true, + "returnType": "T", + "parameterTypes": [ + "java.lang.String", + "java.lang.Class" + ], + "parameterNames": [ + "path", + "cls" + ], + "params": [ + "String path", + "Class cls" + ], + "summary": "Loads an object of the specified class from a file at the given path.", + "description": "Loads an object of the specified class from a file at the given path.", + "scratchblock": null, + "paramDocs": [ + "path: the path to the file from which the object is to be loaded", + "cls: the class of the object to be loaded" + ], + "returns": "the loaded object of the specified class", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/load", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/setVolume(double)", - "memberId": "extensions/sound/SoundPlayback/setVolume", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "setVolume", - "static": false, - "returnType": "void", + "id": "save/File/loadOrCreate(String,Class)", + "memberId": "save/File/loadOrCreate", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "loadOrCreate", + "static": true, + "returnType": "T", "parameterTypes": [ - "double" + "java.lang.String", + "java.lang.Class" ], "parameterNames": [ - "percent" + "path", + "cls" ], "params": [ - "double percent" + "String path", + "Class cls" ], - "summary": "Changes only this playback's volume. Values outside 0..100 are clamped.", - "description": "Changes only this playback's volume. Values outside 0..100 are clamped.", + "summary": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", + "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", "scratchblock": null, "paramDocs": [ - "percent: volume in percent" + "path: the path to the file from which the object is to be loaded", + "cls: the class of the object to be loaded" ], - "returns": null, + "returns": "the loaded object of the specified class, or a new instance if the\n file does not exist", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/setVolume", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/loadOrCreate", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/sound/SoundPlayback/stop()", - "memberId": "extensions/sound/SoundPlayback/stop", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "className": "SoundPlayback", - "methodName": "stop", - "static": false, - "returnType": "void", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "Stops this playback, leaving other copies alone.", - "description": "Stops this playback, leaving other copies alone.", + "id": "save/File/loadXML(String,Class)", + "memberId": "save/File/loadXML", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "loadXML", + "static": true, + "returnType": "T", + "parameterTypes": [ + "java.lang.String", + "java.lang.Class" + ], + "parameterNames": [ + "path", + "cls" + ], + "params": [ + "String path", + "Class cls" + ], + "summary": "Loads an object of the specified class from an XML file at the given path.", + "description": "Loads an object of the specified class from an XML file at the given path.", "scratchblock": null, - "paramDocs": [], - "returns": null, + "paramDocs": [ + "path: the path to the XML file", + "cls: the class of the object to be loaded" + ], + "returns": "the object loaded from the XML file", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/sound/SoundPlayback/stop", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/loadXML", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/addGlyph(char,String)", - "memberId": "extensions/text/BitmapText/addGlyph", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "addGlyph", - "static": false, - "returnType": "void", + "id": "save/File/loadXMLOrCreate(String,Class)", + "memberId": "save/File/loadXMLOrCreate", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "loadXMLOrCreate", + "static": true, + "returnType": "T", "parameterTypes": [ - "char", - "java.lang.String" + "java.lang.String", + "java.lang.Class" ], "parameterNames": [ - "character", - "path" + "path", + "cls" ], "params": [ - "char character", - "String path" + "String path", + "Class cls" ], - "summary": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", - "description": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", + "summary": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", + "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", "scratchblock": null, "paramDocs": [ - "character: the character to replace", - "path: its image or built-in costume name" + "path: the path to the XML file", + "cls: the class of the object to be loaded" ], - "returns": null, + "returns": "the object loaded from the XML file, or a new instance if the file\n does not exist", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/addGlyph", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/loadXMLOrCreate", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/constructor(String)", - "memberId": "extensions/text/BitmapText/constructor", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "constructor", - "static": false, - "returnType": "BitmapText", + "id": "save/File/save(String,T)", + "memberId": "save/File/save", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "save", + "static": true, + "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "T" ], "parameterNames": [ - "pattern" + "path", + "obj" ], "params": [ - "String pattern" + "String path", + "T obj" ], - "summary": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", - "description": "Text made from image glyphs, such as font065.png for 'A'. Add it to a stage\nlike a sprite. Its position is the top of the first line, with each line\naligned left, centred or right. Spaces and line breaks do not load images.\nImage data uses the library cache, so changing text does not create sprites\nor reload files. Use ordinary Text for normal system/TrueType fonts.", + "summary": "Saves the given object to the specified path in the default file type (JSON).", + "description": "Saves the given object to the specified path in the default file type (JSON).", "scratchblock": null, "paramDocs": [ - "pattern: image path with an integer format, e.g. \"assets/font%03d.png\"" + "path: the path where the object should be saved", + "obj: the object to be saved" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/constructor", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/save", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/draw(Drawing)", - "memberId": "extensions/text/BitmapText/draw", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "draw", - "static": false, + "id": "save/File/saveXML(String,T)", + "memberId": "save/File/saveXML", + "owner": "org.openpatch.scratch.save.File", + "className": "File", + "methodName": "saveXML", + "static": true, "returnType": "void", "parameterTypes": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "java.lang.String", + "T" ], "parameterNames": [ - "drawing" + "path", + "obj" ], "params": [ - "Drawing drawing" + "String path", + "T obj" ], - "summary": "", - "description": "", + "summary": "Saves the given object as an XML file at the specified path.", + "description": "Saves the given object as an XML file at the specified path.", "scratchblock": null, "paramDocs": [ - "drawing: the current frame's canvas" + "path: the path where the XML file will be saved", + "obj: the object to be saved as XML" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/draw", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "translations": {} - }, - { - "id": "extensions/text/BitmapText/getContent()", - "memberId": "extensions/text/BitmapText/getContent", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "getContent", - "static": false, - "returnType": "String", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "", - "description": "", - "scratchblock": null, - "paramDocs": [], - "returns": "the text being shown", - "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/getContent", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/File/saveXML", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "translations": {} }, { - "id": "extensions/text/BitmapText/getHeight()", - "memberId": "extensions/text/BitmapText/getHeight", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "getHeight", + "id": "save/SaveData/constructor(String,String,Class)", + "memberId": "save/SaveData/constructor", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "constructor", "static": false, - "returnType": "int", - "parameterTypes": [], - "parameterNames": [], - "params": [], - "summary": "", - "description": "", + "returnType": "SaveData", + "parameterTypes": [ + "java.lang.String", + "java.lang.String", + "java.lang.Class" + ], + "parameterNames": [ + "gameId", + "slot", + "type" + ], + "params": [ + "String gameId", + "String slot", + "Class type" + ], + "summary": "Selects a game's save slot without creating a file or opening a database.", + "description": "Selects a game's save slot without creating a file or opening a database.", "scratchblock": null, - "paramDocs": [], - "returns": "the displayed text's height, including line spacing and sprite size", + "paramDocs": [ + "gameId: a stable identifier, for example org.openpatch.coincatcher", + "slot: a slot name, for example slot1, slot2 or slot3", + "type: the data class to load" + ], + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/getHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/getWidth()", - "memberId": "extensions/text/BitmapText/getWidth", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "getWidth", + "id": "save/SaveData/getLocation()", + "memberId": "save/SaveData/getLocation", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "getLocation", "static": false, - "returnType": "int", + "returnType": "String", "parameterTypes": [], "parameterNames": [], "params": [], - "summary": "", - "description": "", + "summary": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", + "description": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", "scratchblock": null, "paramDocs": [], - "returns": "the displayed text's width, including the sprite's size", + "returns": "a description of the save location", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/getLocation", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/setAlign(TextAlign)", - "memberId": "extensions/text/BitmapText/setAlign", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setAlign", + "id": "save/SaveData/loadOrDefault(Supplier)", + "memberId": "save/SaveData/loadOrDefault", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "loadOrDefault", "static": false, - "returnType": "void", + "returnType": "T", "parameterTypes": [ - "org.openpatch.scratch.TextAlign" + "java.util.function.Supplier" ], "parameterNames": [ - "align" + "defaults" ], "params": [ - "TextAlign align" + "Supplier defaults" ], - "summary": "", - "description": "", + "summary": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", + "description": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", "scratchblock": null, "paramDocs": [ - "align: LEFT, CENTER or RIGHT (DEFAULT means LEFT)" + "defaults: creates initial progress for a missing slot; called only when missing" ], - "returns": null, + "returns": "loaded progress, or the supplied defaults for a missing slot", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setAlign", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/loadOrDefault", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/setFont(String)", - "memberId": "extensions/text/BitmapText/setFont", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setFont", + "id": "save/SaveData/path()", + "memberId": "save/SaveData/path", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "path", + "static": false, + "returnType": "Path", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "scratchblock": null, + "paramDocs": [], + "returns": "the desktop file path", + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/path", + "availability": "desktop-only", + "availabilityReason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "translations": {} + }, + { + "id": "save/SaveData/save(T)", + "memberId": "save/SaveData/save", + "owner": "org.openpatch.scratch.save.SaveData", + "className": "SaveData", + "methodName": "save", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "T" ], "parameterNames": [ - "pattern" + "data" ], "params": [ - "String pattern" + "T data" ], - "summary": "", - "description": "", + "summary": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", + "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", "scratchblock": null, "paramDocs": [ - "pattern: glyph path with one integer format for the Unicode code point" + "data: the progress to save; must not be null" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setFont", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveData/save", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/text/BitmapText/setLetterSpacing(double)", - "memberId": "extensions/text/BitmapText/setLetterSpacing", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setLetterSpacing", + "id": "save/SaveExtension/constructor()", + "memberId": "save/SaveExtension/constructor", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "constructor", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "spacing" - ], - "params": [ - "double spacing" - ], - "summary": "", - "description": "", + "returnType": "SaveExtension", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Registers the save extension; found through ServiceLoader, learners never see it.", + "description": "Registers the save extension; found through ServiceLoader, learners never see it.", "scratchblock": null, - "paramDocs": [ - "spacing: gap between characters; negative values allow italic glyphs to overlap" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setLetterSpacing", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/text/BitmapText/setLineSpacing(double)", - "memberId": "extensions/text/BitmapText/setLineSpacing", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setLineSpacing", + "id": "save/SaveExtension/id()", + "memberId": "save/SaveExtension/id", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "id", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "spacing" - ], - "params": [ - "double spacing" - ], + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], "summary": "", "description": "", "scratchblock": null, - "paramDocs": [ - "spacing: extra pixels between lines" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setLineSpacing", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/text/BitmapText/setSpaceWidth(double)", - "memberId": "extensions/text/BitmapText/setSpaceWidth", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "setSpaceWidth", + "id": "save/SaveExtension/name()", + "memberId": "save/SaveExtension/name", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "name", "static": false, - "returnType": "void", - "parameterTypes": [ - "double" - ], - "parameterNames": [ - "width" - ], - "params": [ - "double width" - ], + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], "summary": "", "description": "", "scratchblock": null, - "paramDocs": [ - "width: width of a space, in unscaled pixels" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/setSpaceWidth", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/text/BitmapText/showText(String)", - "memberId": "extensions/text/BitmapText/showText", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "className": "BitmapText", - "methodName": "showText", + "id": "save/SaveExtension/requires()", + "memberId": "save/SaveExtension/requires", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "requires", "static": false, - "returnType": "void", - "parameterTypes": [ - "java.lang.String" - ], - "parameterNames": [ - "text" - ], - "params": [ - "String text" - ], + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "save/SaveExtension/version()", + "memberId": "save/SaveExtension/version", + "owner": "org.openpatch.scratch.save.SaveExtension", + "className": "SaveExtension", + "methodName": "version", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], "summary": "", "description": "", "scratchblock": null, - "paramDocs": [ - "text: text to show, including spaces and newlines" - ], + "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/text/BitmapText/showText", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/save/SaveExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/tiled/MapObject/constructor()", - "memberId": "extensions/tiled/MapObject/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/constructor()", + "memberId": "tiled/MapObject/constructor", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "constructor", "static": false, @@ -18412,15 +19140,15 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/constructor", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getProperty(String)", - "memberId": "extensions/tiled/MapObject/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getProperty(String)", + "memberId": "tiled/MapObject/getProperty", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getProperty", "static": false, @@ -18442,15 +19170,15 @@ ], "returns": "the value of the property with the specified name", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getProperty", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getProperty", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getPropertyBoolean(String)", - "memberId": "extensions/tiled/MapObject/getPropertyBoolean", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyBoolean(String)", + "memberId": "tiled/MapObject/getPropertyBoolean", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getPropertyBoolean", "static": false, @@ -18472,15 +19200,15 @@ ], "returns": "the boolean value of the property, or false if the property is not\n found or cannot be\n parsed as a boolean", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getPropertyBoolean", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getPropertyBoolean", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getPropertyFloat(String)", - "memberId": "extensions/tiled/MapObject/getPropertyFloat", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyFloat(String)", + "memberId": "tiled/MapObject/getPropertyFloat", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getPropertyFloat", "static": false, @@ -18502,15 +19230,15 @@ ], "returns": "the float value of the specified property", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getPropertyFloat", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getPropertyFloat", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getPropertyInt(String)", - "memberId": "extensions/tiled/MapObject/getPropertyInt", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyInt(String)", + "memberId": "tiled/MapObject/getPropertyInt", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getPropertyInt", "static": false, @@ -18532,15 +19260,15 @@ ], "returns": "the integer value of the property", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getPropertyInt", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getPropertyInt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/getShape()", - "memberId": "extensions/tiled/MapObject/getShape", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getShape()", + "memberId": "tiled/MapObject/getShape", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "getShape", "static": false, @@ -18554,15 +19282,15 @@ "paramDocs": [], "returns": "a Shape object representing the current map object.", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/getShape", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/getShape", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/MapObject/setClassName(String)", - "memberId": "extensions/tiled/MapObject/setClassName", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/setClassName(String)", + "memberId": "tiled/MapObject/setClassName", + "owner": "org.openpatch.scratch.tiled.MapObject", "className": "MapObject", "methodName": "setClassName", "static": false, @@ -18584,15 +19312,15 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/MapObject/setClassName", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/MapObject/setClassName", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/Property/constructor()", - "memberId": "extensions/tiled/Property/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.Property", + "id": "tiled/Property/constructor()", + "memberId": "tiled/Property/constructor", + "owner": "org.openpatch.scratch.tiled.Property", "className": "Property", "methodName": "constructor", "static": false, @@ -18606,15 +19334,15 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/Property/constructor", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/Property/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/Property/setText(String)", - "memberId": "extensions/tiled/Property/setText", - "owner": "org.openpatch.scratch.extensions.tiled.Property", + "id": "tiled/Property/setText(String)", + "memberId": "tiled/Property/setText", + "owner": "org.openpatch.scratch.tiled.Property", "className": "Property", "methodName": "setText", "static": false, @@ -18636,15 +19364,155 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/Property/setText", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/Property/setText", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/constructor()", + "memberId": "tiled/TiledExtension/constructor", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "constructor", + "static": false, + "returnType": "TiledExtension", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "Registers the tiled extension; found through ServiceLoader, learners never see it.", + "description": "Registers the tiled extension; found through ServiceLoader, learners never see it.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/constructor", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/id()", + "memberId": "tiled/TiledExtension/id", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "id", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/id", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/install(ExtensionContext)", + "memberId": "tiled/TiledExtension/install", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "install", + "static": false, + "returnType": "void", + "parameterTypes": [ + "org.openpatch.scratch.extension.ExtensionContext" + ], + "parameterNames": [ + "ctx" + ], + "params": [ + "ExtensionContext ctx" + ], + "summary": "Every layer of a stage draws its shown map layers, only the part the camera shows.", + "description": "Every layer of a stage draws its shown map layers, only the part the camera shows.", + "scratchblock": null, + "paramDocs": [ + "ctx: " + ], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/install", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/name()", + "memberId": "tiled/TiledExtension/name", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "name", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/name", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/requires()", + "memberId": "tiled/TiledExtension/requires", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "requires", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "First-party extensions are released together with the core.", + "description": "First-party extensions are released together with the core.", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/requires", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "translations": {} + }, + { + "id": "tiled/TiledExtension/version()", + "memberId": "tiled/TiledExtension/version", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "className": "TiledExtension", + "methodName": "version", + "static": false, + "returnType": "String", + "parameterTypes": [], + "parameterNames": [], + "params": [], + "summary": "", + "description": "", + "scratchblock": null, + "paramDocs": [], + "returns": null, + "since": "", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledExtension/version", + "availability": "desktop-only", + "availabilityReason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/constructor(String)", - "memberId": "extensions/tiled/TiledMap/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/constructor(String)", + "memberId": "tiled/TiledMap/constructor", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "constructor", "static": false, @@ -18666,15 +19534,15 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/constructor(String,Stage)", - "memberId": "extensions/tiled/TiledMap/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/constructor(String,Stage)", + "memberId": "tiled/TiledMap/constructor", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "constructor", "static": false, @@ -18700,15 +19568,15 @@ ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/constructor", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/constructor", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getHeight()", - "memberId": "extensions/tiled/TiledMap/getHeight", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getHeight()", + "memberId": "tiled/TiledMap/getHeight", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getHeight", "static": false, @@ -18722,15 +19590,15 @@ "paramDocs": [], "returns": "the number of map rows", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getObjectsFromLayer(String)", - "memberId": "extensions/tiled/TiledMap/getObjectsFromLayer", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getObjectsFromLayer(String)", + "memberId": "tiled/TiledMap/getObjectsFromLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getObjectsFromLayer", "static": false, @@ -18752,15 +19620,15 @@ ], "returns": "an array of MapObject from the specified layer, or null if the layer\n does not exist", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getObjectsFromLayer", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getObjectsFromLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getProperty(String)", - "memberId": "extensions/tiled/TiledMap/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getProperty(String)", + "memberId": "tiled/TiledMap/getProperty", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getProperty", "static": false, @@ -18782,15 +19650,15 @@ ], "returns": "its string value, including multiline strings", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getProperty", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getProperty", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getProperty(String,String)", - "memberId": "extensions/tiled/TiledMap/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getProperty(String,String)", + "memberId": "tiled/TiledMap/getProperty", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getProperty", "static": false, @@ -18816,15 +19684,15 @@ ], "returns": "the stored value or the default", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getProperty", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getProperty", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getPropertyBoolean(String)", - "memberId": "extensions/tiled/TiledMap/getPropertyBoolean", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyBoolean(String)", + "memberId": "tiled/TiledMap/getPropertyBoolean", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getPropertyBoolean", "static": false, @@ -18846,15 +19714,15 @@ ], "returns": "its boolean value", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getPropertyBoolean", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getPropertyBoolean", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getPropertyFloat(String)", - "memberId": "extensions/tiled/TiledMap/getPropertyFloat", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyFloat(String)", + "memberId": "tiled/TiledMap/getPropertyFloat", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getPropertyFloat", "static": false, @@ -18876,15 +19744,15 @@ ], "returns": "its floating-point value", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getPropertyFloat", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getPropertyFloat", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getPropertyInt(String)", - "memberId": "extensions/tiled/TiledMap/getPropertyInt", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyInt(String)", + "memberId": "tiled/TiledMap/getPropertyInt", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getPropertyInt", "static": false, @@ -18906,15 +19774,15 @@ ], "returns": "its integer value", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getPropertyInt", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getPropertyInt", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileCollisionShapes(int)", - "memberId": "extensions/tiled/TiledMap/getTileCollisionShapes", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileCollisionShapes(int)", + "memberId": "tiled/TiledMap/getTileCollisionShapes", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileCollisionShapes", "static": false, @@ -18936,15 +19804,15 @@ ], "returns": "rectangles, ellipses or polygons for this tile", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileCollisionShapes", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileCollisionShapes", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileCollisionShapes(String,int,int)", - "memberId": "extensions/tiled/TiledMap/getTileCollisionShapes", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileCollisionShapes(String,int,int)", + "memberId": "tiled/TiledMap/getTileCollisionShapes", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileCollisionShapes", "static": false, @@ -18974,15 +19842,15 @@ ], "returns": "positioned outlines, or an empty array outside/without collision", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileCollisionShapes", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileCollisionShapes", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileHeight()", - "memberId": "extensions/tiled/TiledMap/getTileHeight", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileHeight()", + "memberId": "tiled/TiledMap/getTileHeight", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileHeight", "static": false, @@ -18996,15 +19864,15 @@ "paramDocs": [], "returns": "the height of a map cell in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileHeight", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileHeight", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileId(String,int,int)", - "memberId": "extensions/tiled/TiledMap/getTileId", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileId(String,int,int)", + "memberId": "tiled/TiledMap/getTileId", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileId", "static": false, @@ -19034,15 +19902,15 @@ ], "returns": "global ID, or zero for an empty/outside cell", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileId", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileId", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getTileWidth()", - "memberId": "extensions/tiled/TiledMap/getTileWidth", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileWidth()", + "memberId": "tiled/TiledMap/getTileWidth", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getTileWidth", "static": false, @@ -19056,15 +19924,15 @@ "paramDocs": [], "returns": "the width of a map cell in pixels", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getTileWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getTileWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/getWidth()", - "memberId": "extensions/tiled/TiledMap/getWidth", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getWidth()", + "memberId": "tiled/TiledMap/getWidth", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "getWidth", "static": false, @@ -19078,105 +19946,109 @@ "paramDocs": [], "returns": "the number of map columns", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/getWidth", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/getWidth", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/spawn(String)", - "memberId": "extensions/tiled/TiledMap/spawn", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/hideLayer(String)", + "memberId": "tiled/TiledMap/hideLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", - "methodName": "spawn", + "methodName": "hideLayer", "static": false, - "returnType": "List", + "returnType": "void", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "layerName" + "name" ], "params": [ - "String layerName" + "String name" ], - "summary": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.", - "description": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.\n\nThe sprite's class needs one of these constructors, tried in this order:\none that takes the [MapObject](../MapObject/index) (to read its name and properties), one\nthat takes `(double x, double y)`, or one without parameters. Either\nway the sprite is put where the object is. An object drawn as an area\n(a rectangle, an ellipse or a polygon) also gives the sprite that area as\nits hitbox, which is how walls and water work without a costume.\n\nObjects whose type is not a sprite class, or that have no type, are left\nalone, so a layer can hold markers the program reads itself.\n\n```java\nTiledMap map = new TiledMap(\"level.tmx\", this);\nmap.spawn(\"Objects\");\n```", + "summary": "Stops drawing a tile layer shown with [showLayer(String, Layer)](showLayer).", + "description": "Stops drawing a tile layer shown with [showLayer(String, Layer)](showLayer).", "scratchblock": null, "paramDocs": [ - "layerName: the object layer" + "name: the tile layer's name in Tiled" ], - "returns": "the sprites that were made, in the order of the layer", + "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/spawn", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/hideLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/stampLayerToBackground(String)", - "memberId": "extensions/tiled/TiledMap/stampLayerToBackground", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/showLayer(String,Layer)", + "memberId": "tiled/TiledMap/showLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", - "methodName": "stampLayerToBackground", + "methodName": "showLayer", "static": false, "returnType": "void", "parameterTypes": [ - "java.lang.String" + "java.lang.String", + "org.openpatch.scratch.Layer" ], "parameterNames": [ - "name" + "name", + "layer" ], "params": [ - "String name" + "String name", + "Layer layer" ], - "summary": "Stamps a specified layer onto the background.", - "description": "Stamps a specified layer onto the background.", + "summary": "Shows a tile layer of the map in a layer of the stage, drawn every frame from now on (only\nthe tiles the camera shows). The map's top left corner is at (0, 0) of the world; the map\nextends right and down.", + "description": "Shows a tile layer of the map in a layer of the stage, drawn every frame from now on (only\nthe tiles the camera shows). The map's top left corner is at (0, 0) of the world; the map\nextends right and down.\n\n```java\nmap.showLayer(\"ground\", Layer.BACKGROUND);\nmap.showLayer(\"trees\", Layer.FOREGROUND);\n```", "scratchblock": null, "paramDocs": [ - "name: the name of the layer to be stamped onto the background" + "name: the tile layer's name in Tiled", + "layer: the stage's layer to draw it in" ], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/stampLayerToBackground", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/showLayer", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/stampLayerToForeground(String)", - "memberId": "extensions/tiled/TiledMap/stampLayerToForeground", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/spawn(String)", + "memberId": "tiled/TiledMap/spawn", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", - "methodName": "stampLayerToForeground", + "methodName": "spawn", "static": false, - "returnType": "void", + "returnType": "List", "parameterTypes": [ "java.lang.String" ], "parameterNames": [ - "name" + "layerName" ], "params": [ - "String name" + "String layerName" ], - "summary": "Stamps the specified layer to the foreground.", - "description": "Stamps the specified layer to the foreground.", + "summary": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.", + "description": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.\n\nThe sprite's class needs one of these constructors, tried in this order:\none that takes the [MapObject](../MapObject/index) (to read its name and properties), one\nthat takes `(double x, double y)`, or one without parameters. Either\nway the sprite is put where the object is. An object drawn as an area\n(a rectangle, an ellipse or a polygon) also gives the sprite that area as\nits hitbox, which is how walls and water work without a costume.\n\nObjects whose type is not a sprite class, or that have no type, are left\nalone, so a layer can hold markers the program reads itself.\n\n```java\nTiledMap map = new TiledMap(\"level.tmx\", this);\nmap.spawn(\"Objects\");\n```", "scratchblock": null, "paramDocs": [ - "name: the name of the layer to be stamped to the foreground" + "layerName: the object layer" ], - "returns": null, + "returns": "the sprites that were made, in the order of the layer", "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/stampLayerToForeground", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/spawn", "availability": "implemented", "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} }, { - "id": "extensions/tiled/TiledMap/toString()", - "memberId": "extensions/tiled/TiledMap/toString", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/toString()", + "memberId": "tiled/TiledMap/toString", + "owner": "org.openpatch.scratch.tiled.TiledMap", "className": "TiledMap", "methodName": "toString", "static": false, @@ -19190,15 +20062,15 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TiledMap/toString", - "availability": "implemented", - "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TiledMap/toString", + "availability": "desktop-only", + "availabilityReason": "Prints the desktop's parsed TMX tree as JSON; the browser reads maps without it.", "translations": {} }, { - "id": "extensions/tiled/TilesetImage/constructor()", - "memberId": "extensions/tiled/TilesetImage/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TilesetImage", + "id": "tiled/TilesetImage/constructor()", + "memberId": "tiled/TilesetImage/constructor", + "owner": "org.openpatch.scratch.tiled.TilesetImage", "className": "TilesetImage", "methodName": "constructor", "static": false, @@ -19212,9 +20084,9 @@ "paramDocs": [], "returns": null, "since": "", - "docsUrl": "https://scratch4j.openpatch.org/reference/extensions/tiled/TilesetImage/constructor", - "availability": "awaiting-browser-support", - "availabilityReason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "docsUrl": "https://scratch4j.openpatch.org/reference/tiled/TilesetImage/constructor", + "availability": "implemented", + "availabilityReason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "translations": {} } ] diff --git a/docs/public/catalogs/examples.json b/docs/public/catalogs/examples.json index 8afc476e..c8f69f23 100644 --- a/docs/public/catalogs/examples.json +++ b/docs/public/catalogs/examples.json @@ -6,7 +6,7 @@ { "id": "demo/cat", "kind": "demo", - "source": "src/examples/java/demos/cat", + "source": "examples/src/main/java/demos/cat", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -24,7 +24,7 @@ { "id": "demo/catPlatformer", "kind": "demo", - "source": "src/examples/java/demos/catPlatformer", + "source": "examples/src/main/java/demos/catPlatformer", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -35,15 +35,15 @@ "files": [ { "path": "Bean.java", - "sha256": "e711aead57857c6d25ff96f5e0de6a969ffd9c1b33f359e3f2bb8a36428f5a10" + "sha256": "2a29b5b353cf5408a9b0926e4a834733e45d06504eca0f778b49e475fcb27d8c" }, { "path": "Bug.java", - "sha256": "6a6e39b0925985b93f9e5e1c509fe898a9cd13a5dc2cba3f46b3c58eae58677a" + "sha256": "a3e060ff2c19606f94e26161d37e500acc67ace1708d5de059bd01189407789b" }, { "path": "Cat.java", - "sha256": "40752d42d41e75295bbea5463ae5f574b58ddc4a888cde56b319cf57a4484c40" + "sha256": "fb1e51731c37b0db917ec274a9fb9a5b9964ad132eae73ffbf462e71a629eebb" }, { "path": "CatPlatformer.java", @@ -51,7 +51,7 @@ }, { "path": "Goal.java", - "sha256": "a0ab034b3dbf2835a1b85dd1edbb32b67a7774dd8e41b3a493194ba778b97572" + "sha256": "c828b86c1b09f039f3b46bcf9d7424244df474a2b08aa7ac42d0316f6ca49ab6" }, { "path": "Ground.java", @@ -74,7 +74,7 @@ { "id": "demo/clock", "kind": "demo", - "source": "src/examples/java/demos/clock", + "source": "examples/src/main/java/demos/clock", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -124,7 +124,7 @@ { "id": "demo/coinCollector", "kind": "demo", - "source": "src/examples/java/demos/coinCollector", + "source": "examples/src/main/java/demos/coinCollector", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -138,7 +138,7 @@ }, { "path": "CoinCollector.java", - "sha256": "7ea50c78169a962f75a35e72d36b355b52af9f4b1b1233218d98e040318503b7" + "sha256": "82d0f645d9adbec7f06ff4b4eb7db38dafc5e0643c94d26b61a6de4030ad447e" }, { "path": "Ground.java", @@ -146,25 +146,25 @@ }, { "path": "Player.java", - "sha256": "0693a09310284af5d2fd58693ac1430d34ea9b09f210e91422d63449bb25497d" + "sha256": "0143c301cd7395ba82be98af8b56ed283b122411846e7b0dde203eaaa6eb5d8b" } ] }, { "id": "demo/donutIO", "kind": "demo", - "source": "src/examples/java/demos/donutIO", + "source": "examples/src/main/java/demos/donutIO", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "Background.java", - "sha256": "240f3eee3a70b9a9ffcd23d731400300ad1dccb2b9402d820ee9ec7fe250b258" + "sha256": "240686fd74eac29bea2de07abb9fdf7eb2d68f07b25e936eb151d00e2093b717" }, { "path": "Donut.java", - "sha256": "72e4ed699fc1de18ee2a48644d3c5425b762c667a7a7fdfa82aab7038a65a362" + "sha256": "12909d89ff89c8ab093150d102cd355ffd7c96644d741e2978a9ff35a29dfcbb" }, { "path": "FollowDonut.java", @@ -172,11 +172,11 @@ }, { "path": "Game.java", - "sha256": "dd47d147b288eb68780451f6f6c3a1234ff162d63039ec925a455092ccc3bddb" + "sha256": "01645a6b03f037958b4037f78ebdbe0174c7690314f77b2e7e292893cd9f75af" }, { "path": "GameOverStage.java", - "sha256": "8b03b31cb932b6972803e49a58501e5c7b04f0e7b2c4bc0473b7cfa2cf20089c" + "sha256": "7dec2067ba6e4edf4642670f838ee983a639307117b10a309ff36f94c9ee5557" }, { "path": "PlayerDonut.java", @@ -184,15 +184,15 @@ }, { "path": "StartStage.java", - "sha256": "9d4a0085c2377ad6e9fcba5fbd05936c1f344b6b12aeb6ec36c3579325b28821" + "sha256": "d511595cb10651f75e3a895550b041db4a1a2d7867d309e55ff6e47723095b6e" }, { "path": "WinStage.java", - "sha256": "691b5d745227a569d9e96fcee082c0ca022cb166702e5f70402f7f1d2573e6d1" + "sha256": "699a0026ff67d1079df2cb811283f0743ffb1cb0ccd849852169e05c1a9c0ca5" }, { "path": "WorldStage.java", - "sha256": "2c1e97bce4d27074b278d77f339c50eda6ad2632c2c324cc7bc50d2fb119566c" + "sha256": "d520f4b57fb2f7d2161ea407881cde464a7078dabd2cc7d7a8932d64ee21d3c8" }, { "path": "assets/donut.png", @@ -211,7 +211,7 @@ { "id": "demo/glide", "kind": "demo", - "source": "src/examples/java/demos/glide", + "source": "examples/src/main/java/demos/glide", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -228,18 +228,18 @@ { "id": "demo/pipes", "kind": "demo", - "source": "src/examples/java/demos/pipes", + "source": "examples/src/main/java/demos/pipes", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "PenSprite.java", - "sha256": "94b9fb824ef95dfbbd5c0f757aef771be165c1f7917fb5954b5f14651d516283" + "sha256": "9cc2544d691f9d771b868f0a644b8ea5eb74e89534a42aeeb7f88b87f064acf3" }, { "path": "Pipes.java", - "sha256": "3b516c93456ef4a74b149abb52844d877f6db846dd384f9156701fcacee81e28" + "sha256": "72540a41ffe2102900cf21da2a2430e95bcac6a93c61644e0b919343f0cc7ba5" }, { "path": "backdrops/chalk_board.jpg", @@ -258,7 +258,7 @@ { "id": "demo/quiz", "kind": "demo", - "source": "src/examples/java/demos/quiz", + "source": "examples/src/main/java/demos/quiz", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -275,35 +275,35 @@ { "id": "demo/rainbowVine", "kind": "demo", - "source": "src/examples/java/demos/rainbowVine", + "source": "examples/src/main/java/demos/rainbowVine", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "RainbowVine.java", - "sha256": "ab9f946430b98be3988e4b29606ecf135abc6b9f59002a04406bb9380e0df0c7" + "sha256": "138c92e3ec360946511bdaa3fbfcbf7680d7e0794bd0afd88940463328ba70ef" } ] }, { "id": "demo/randomDot", "kind": "demo", - "source": "src/examples/java/demos/randomDot", + "source": "examples/src/main/java/demos/randomDot", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "RandomDot.java", - "sha256": "29adafc8e89e37efb43cd41226bb557668f94345b8fd19ae9cdceaa7cf64b246" + "sha256": "85fca39a0f737838886790b33e3a78c0bf761fa22038f16d1647d49573b0f641" } ] }, { "id": "demo/robot", "kind": "demo", - "source": "src/examples/java/demos/robot", + "source": "examples/src/main/java/demos/robot", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -314,7 +314,7 @@ }, { "path": "RobotStage.java", - "sha256": "d3e5db133393de331fa3f9be1774ff8c74df9ce0437ddcc9cb6c726938a2abc6" + "sha256": "f4a13c806280372dd994a2b5c7c378622a7c56ab2cdcbca40a524da3dbcfe33e" }, { "path": "sprites/robot.png", @@ -325,7 +325,7 @@ { "id": "demo/saveSlots", "kind": "demo", - "source": "src/examples/java/demos/saveSlots", + "source": "examples/src/main/java/demos/saveSlots", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -347,14 +347,14 @@ }, { "path": "SaveSlotStage.java", - "sha256": "137d38a4b232e7c477d1d9b82143c986073221a9890a72783f8580818fd279e4" + "sha256": "952710f6d48438e6d4b504bd24d9d68da4164eeab8a98446d724e1de21d75c9e" } ] }, { "id": "demo/saving", "kind": "demo", - "source": "src/examples/java/demos/saving", + "source": "examples/src/main/java/demos/saving", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -365,21 +365,21 @@ }, { "path": "Saving.java", - "sha256": "083c69f9950f753e83a21bc722b4d91bdf476d6bb5d73f41d939c27d4ff60ac6" + "sha256": "07c5a1fa8f1205e86ad5770579f31f84c81583b72f43eaf7c38c1992b4a06479" } ] }, { "id": "demo/sensing", "kind": "demo", - "source": "src/examples/java/demos/sensing", + "source": "examples/src/main/java/demos/sensing", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "Sensing.java", - "sha256": "7a329ba9f3b5eed86c48eec6b963b22516a90267a4ee871bbf62775fc96b692d" + "sha256": "2ff78751e708d51ffb8b0afdcfab91c1fdd4f2a7de6c04beaf18a1b39dcba8bc" }, { "path": "sprites/hero.png", @@ -394,7 +394,7 @@ { "id": "demo/shader", "kind": "demo", - "source": "src/examples/java/demos/shader", + "source": "examples/src/main/java/demos/shader", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -405,11 +405,11 @@ }, { "path": "MySprite.java", - "sha256": "c1d6ef06a68dbcd7d77ea07f6fb7b50fc3d167c18075140db11b15b708affe6a" + "sha256": "0c1d54d65528f25b9b27c80e4e9aa8de6fd406b719ab27c0bc4aeb29cb01b311" }, { "path": "MyStage.java", - "sha256": "084c5cec165caab57efc5bc29a35858e369e13cee645ac1af38fe63d56cd3e90" + "sha256": "09ba7034c03535decd6f48b0db410d244fa41dad548e60cf5a31ab7007ea0680" }, { "path": "NormalSprite.java", @@ -421,27 +421,23 @@ }, { "path": "blobby.frag", - "sha256": "384933079eec3bb08beb0b141bec7cd59ff7ef17c4a8fa706e3c4f1640dba55b" + "sha256": "b4ee43f9290e7181eaf73cfa0d61951916655f284a390a74417bcded8572df6a" }, { "path": "cat.png", "sha256": "0423f61671a086906d972b266241d557934f86bdb8ec5ad6f50b08f3474efa0f" }, - { - "path": "default.vert", - "sha256": "74b864ff74fb681af02ede001826b988ec94edcbb2c3b3377cd08975edca7cbf" - }, { "path": "glitch.frag", - "sha256": "cc97afe4a6df211c95abf0dead361f05d32cf4e42d042d78ad47f22a3c1fdb5d" + "sha256": "c087dead430cf77c6b126a699533711597f0531a84b7ea599828e5157590bd62" }, { "path": "halftone.frag", - "sha256": "64e2eb806ed07b091fa5d9c15329cf776d2950832021fb985172edebd0c0df71" + "sha256": "feeeac1d83e851624d0bd1edfb83a037d42a2c72766bff67d3c73cf702d47c9e" }, { "path": "light.frag", - "sha256": "cbb7e7c862a6944b620919c8643b40f8986a6dcc389e2308966fa5f50694e551" + "sha256": "406c07398ade3a3bec38b7fe124bf900520d1372fcafff3ca43dbd272ac29578" }, { "path": "light.png", @@ -449,22 +445,22 @@ }, { "path": "neon.frag", - "sha256": "8e875c5eb0cc2884d3470ae96797bf3708e01eb1725a98ad560414d5c9493f75" + "sha256": "03e834af81c80587b7c1de2ee89fd9c0facd15aab9e2a38dfdbafe7045bb22ac" }, { "path": "pixel.frag", - "sha256": "3b3d471cd76f42313008ffaa3019fd382e80916ddc990c48b748786a54f5796f" + "sha256": "2642359211f3008c8e57b47ef97463a6727de042ccc6822cc67def9cdd0f41e2" }, { "path": "pixelate.frag", - "sha256": "7d0842e4fc000f92a2ac9cf113fce083b7c2c5e5bb43c2cb2edfbf0bc045075b" + "sha256": "b97cea96d4fe2ce65b00354f7096c69b1027e8cfd0685fb4c22e3c3636b4947c" } ] }, { "id": "demo/shakespeare", "kind": "demo", - "source": "src/examples/java/demos/shakespeare", + "source": "examples/src/main/java/demos/shakespeare", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -479,7 +475,7 @@ }, { "path": "Shakespeare.java", - "sha256": "de45a061414fb16ca748abd3fe0327df154257a76933fd41bcda446aa8965484" + "sha256": "28dd04fd2825a2ee6e3770dde8699881d9b1e6b7c13f7de2202b4bf0c4c6dd55" }, { "path": "assets/Singkong.ttf", @@ -490,7 +486,7 @@ { "id": "demo/smartRocket", "kind": "demo", - "source": "src/examples/java/demos/smartRocket", + "source": "examples/src/main/java/demos/smartRocket", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -509,7 +505,7 @@ }, { "path": "Rocket.java", - "sha256": "aacd80bf036fff40872615776c41049fb9e06d199a87f4c10a990bb1d9249415" + "sha256": "dc981311b03f78c6b88fbcb9f09f204e99253bb8a39c261f6654d8c9b107d407" }, { "path": "SmartRocket.java", @@ -517,7 +513,7 @@ }, { "path": "Ziel.java", - "sha256": "656a913936da7e1c41811fff6ca80d5ef0fa047b72534bb92a15d5163d72d511" + "sha256": "61fafe0d70651623b85039e3f4f68544e5a39fdb2ededd52b4476d540bfa24c0" }, { "path": "assets/rocket.png", @@ -532,7 +528,7 @@ { "id": "demo/stressTest", "kind": "demo", - "source": "src/examples/java/demos/stressTest", + "source": "examples/src/main/java/demos/stressTest", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], @@ -543,7 +539,7 @@ }, { "path": "Figure.java", - "sha256": "722315ba5fc50b965d100e10b4605325470909342561a3e7bf01a9b2df1c82c6" + "sha256": "40d78a80d3528fc9ab97aa6f621d66fdbd18c6de8865d7863885c6199f6665d2" }, { "path": "FigureState.java", @@ -930,26 +926,26 @@ { "id": "demo/tiled", "kind": "demo", - "source": "src/examples/java/demos/tiled", + "source": "examples/src/main/java/demos/tiled", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "Bamboo.java", - "sha256": "ef45cb82baf7adc0afe4bce3cd3d9c682140e565c7458648bd819621569ed0a4" + "sha256": "e34a0f3974c9fd718b5dc64e18de87f4678c7d094419f99e9fde16784c5775b0" }, { "path": "Enemy.java", - "sha256": "79e55b3bd2b799280fc3bb997700e8aa43fb410acab00b1546dacaefe465d61b" + "sha256": "290723fdc9747e0288e113a83f612f1a114528e38d0141c4e7cdbffdb21ce2ed" }, { "path": "Fireball.java", - "sha256": "48cd4c98729716490c2393eeeceae156381a1d4fa5a6b2bf37b25b37f1f55415" + "sha256": "d4ad9b4da3834994033969c1fd3003e06313d384054a58b2906122c35b15e58b" }, { "path": "GameState.java", - "sha256": "b7f6a5c03215e169f06986cf7856ec3873b432180d2a20665ae04801af93edaa" + "sha256": "92bb156764a03a3a6109ff4514e5d7f71a1556662b9d8a6e5def64f26f7ac1ad" }, { "path": "I18n.java", @@ -957,11 +953,11 @@ }, { "path": "Item.java", - "sha256": "e47faeb22edf46c14d082af212addbb7153d12db0e92ea55ee0d93efad9677d7" + "sha256": "5e09c2f6a37de88ac4938e3cf5d99b6c5975d120395810624bf9558289be5323" }, { "path": "Level.java", - "sha256": "836ae4f3e812081fb38ef0f6be6277cea64a190d9b676ce7401d8e0f493924c0" + "sha256": "cc23dac470d5f1c6368546d84281a5d28cef6727c90ed2041879fbc516fcd0bf" }, { "path": "Level1.tmx", @@ -973,15 +969,15 @@ }, { "path": "Player.java", - "sha256": "57e756ac071860864b23b94f94544acd434762b609e1269c2269697e757ed597" + "sha256": "ea4b1ae4977cec0863375b8513c79bff66b7f0c47992fe06496f54ff245f4aff" }, { "path": "Tiled.java", - "sha256": "960b45e33762de56bb58d730ac04f804b4caa89034754581ed37f23aebfa9080" + "sha256": "5d36d108981a89c7623489946d592bd11f910e023a8103eef1fca67b290bcec6" }, { "path": "UIItem.java", - "sha256": "7cf11e83c718558802931c182c4d5db58679dea3cc9f7fad21a37da0dad77349" + "sha256": "a6910a0d8669272a46e6734062bef5baa6cee95c583d426e9aa2a9c468be1c7c" }, { "path": "Wall.java", @@ -989,7 +985,7 @@ }, { "path": "Warp.java", - "sha256": "c203e54de7d36e77750eb06ca40de9911aa4b42f7ffe9b5dea868b2ded1a3eb8" + "sha256": "4e2f9addd0b0fc37f214e986e1331d479b6f4365b9e4e09040d9ed41185e02e6" }, { "path": "Water.java", @@ -1036,42 +1032,42 @@ { "id": "demo/timedDot", "kind": "demo", - "source": "src/examples/java/demos/timedDot", + "source": "examples/src/main/java/demos/timedDot", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "TimedDot.java", - "sha256": "122349586071c44793565603f0dc6a470c0665fe1655fa671dbc519dc21011ac" + "sha256": "4ffd93113ccce1ebe8461c3178a5155b6b6ce94e8f4067d34dd1e0bad081617d" } ] }, { "id": "demo/timer", "kind": "demo", - "source": "src/examples/java/demos/timer", + "source": "examples/src/main/java/demos/timer", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "TimerStage.java", - "sha256": "7d2e0fac9344fbf4d43c09a57ac4430cb8961613394ac0faf322e3852e2cfac2" + "sha256": "a9e9bf9cb594f18cf50898f1755bacd08708f2ac29b5d2286047eb9648e36626" } ] }, { "id": "demo/ui", "kind": "demo", - "source": "src/examples/java/demos/ui", + "source": "examples/src/main/java/demos/ui", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [], "files": [ { "path": "UI.java", - "sha256": "145ecc97c900d75c57b48be50c979466e0d50566ef91a50163ec243c4b04942b" + "sha256": "70abb18e4bb6b1ddf58b8b87407723871abe00b69c3e0066fa0d65818f8edb93" }, { "path": "bar_round_gloss_large.png", @@ -1094,7 +1090,7 @@ { "id": "demo/volume", "kind": "demo", - "source": "src/examples/java/demos/volume", + "source": "examples/src/main/java/demos/volume", "libraryVersion": "6.5.0", "flavour": "standard", "requiredSheets": [ @@ -1104,7 +1100,7 @@ "files": [ { "path": "Volume.java", - "sha256": "bb2fab55b3f111fd33ff7beb654b9c1eed23323089b6117840790f3cfaa91948" + "sha256": "0cc43883cd844833e4e69b7a069a995feae6e0ad01dbe60a4da4f2f146fdc959" } ] }, @@ -1118,11 +1114,11 @@ "files": [ { "path": "GhostSprite.java", - "sha256": "0384d2d29fd627071a580ffdb91b3ebec648f6a210ba6bce3ffb7959941c3652" + "sha256": "cfd42ab8644f073f4a43ba8ee81c2b5138847cac785a4a6e54e71956d3bba6c8" }, { "path": "HalloweenStage.java", - "sha256": "74f1d0b11088cd27882e7fd07630ee581b40392781b2ba2542dc03b54bcc8dbb" + "sha256": "d5a3528a091191268c21d58784cb83edb8a8007be30f02b12c12cae088bb9956" }, { "path": "HouseSprite.java", @@ -1130,11 +1126,7 @@ }, { "path": "PumpkinSprite.java", - "sha256": "2437b012ead25f8fdcb8297c0e94b1bbc4ec37037226f5aa8b5113d669e8b27b" - }, - { - "path": "package.bluej", - "sha256": "a9623d91bd998d884124ed3815a659d2195e71377b797edba9b97a0afc15e558" + "sha256": "867d2776e5bfedd90195ff524d1c948863cdedc25174fac4564a06b8c64438d9" }, { "path": "sounds/background.wav", @@ -1210,40 +1202,6 @@ } ] }, - { - "id": "tutorial/bluej-starter", - "kind": "tutorial", - "source": "docs/archives/bluej-starter", - "libraryVersion": "6.5.0", - "flavour": "standard", - "requiredSheets": [], - "files": [ - { - "path": "Cat.java", - "sha256": "f5e71d1da4812c7810701eeaf23bc2d8bb455b8c8d607fa0ab04fcebd8df9f2b" - }, - { - "path": "MyStage.java", - "sha256": "5de0b930fc63f2aef2d4d7f7e3ce6a8d8ec82ee5a28898347799c48bbdc5e781" - }, - { - "path": "MyWindow.java", - "sha256": "8056b03a70774938863b829c750300549323c4287eb9f9e6350cd77ccb101005" - }, - { - "path": "assets/.gitkeep", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, - { - "path": "assets/cat.png", - "sha256": "0423f61671a086906d972b266241d557934f86bdb8ec5ad6f50b08f3474efa0f" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - ] - }, { "id": "tutorial/bouncy-hedgehog", "kind": "tutorial", @@ -1280,10 +1238,6 @@ "path": "hedgehog.png", "sha256": "731e677d38912bf339a16cda8c61035db1db52489c462181e9be4874bd310db7" }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, { "path": "playground.jpg", "sha256": "c68f76ab3c5ac54be427706d571cd5b268141c4448b88e7277ebae45c347f0dd" @@ -1330,10 +1284,6 @@ "path": "hedgehog.png", "sha256": "731e677d38912bf339a16cda8c61035db1db52489c462181e9be4874bd310db7" }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, { "path": "playground.jpg", "sha256": "c68f76ab3c5ac54be427706d571cd5b268141c4448b88e7277ebae45c347f0dd" @@ -1358,15 +1308,11 @@ }, { "path": "CatStage.java", - "sha256": "2e8b06a4b21eff0fd15b3c70eb1a9cfe25477942c7e1fe0365af0a9bb1bb889b" + "sha256": "8fe655126ec3bedcf3024c5842ad826125e2a80d06dd4a24111440ce2df4f013" }, { "path": "cat.png", "sha256": "0423f61671a086906d972b266241d557934f86bdb8ec5ad6f50b08f3474efa0f" - }, - { - "path": "package.bluej", - "sha256": "d18f1b5e976159b105ce08a72f95f98dffc64cec82f0d618460e73d710040604" } ] }, @@ -1400,10 +1346,6 @@ { "path": "README.md", "sha256": "7867d20f01bf95412d4b307e34210e9a62e0850b2db0eb7453a82c011deab634" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1424,7 +1366,7 @@ }, { "path": "Alien.java", - "sha256": "37fb2e8f845c81076e592f8b831d6406d8051b8f01b07c4e9a2eb68e6a8ed4b1" + "sha256": "e603e05427f46b8f19be76c0c10094864f91a8db63718218714ab03e4e0f306a" }, { "path": "DodgeWindow.java", @@ -1445,10 +1387,6 @@ { "path": "TitleStage.java", "sha256": "ed6dc9b799881aab876e0ee5a9413c02fade47cfd003ccd3935b68b8e6c04a69" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1478,10 +1416,6 @@ { "path": "README.md", "sha256": "1cf7971612162c7486cd95894fa740ec9f3e8f8268e01790ef5cb48ed37a0507" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1507,10 +1441,6 @@ { "path": "README.md", "sha256": "2e83410662b1d66e3b506bc668ecb59ee2651b9fe5344a1b16e0c43b6e0c6d27" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ] }, @@ -1539,11 +1469,7 @@ }, { "path": "Walker.java", - "sha256": "828b0d93d40e8a85ad0734028d86b867f4a36b401a283755cef5a25132a50c20" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "sha256": "8d9480e92d0c6e39ef1e63cf88d7c37b0e22881c667193758d9608e972694917" } ] }, @@ -1572,15 +1498,11 @@ }, { "path": "Racer.java", - "sha256": "e0b1d2de350f0a5db7ed66e13332a878d32aa18c47db4db1a88cc2a4ebbb88b9" + "sha256": "9e704919283ba0ae1dbe01a37b110e610f00fe030dca6d7d43722834942516fc" }, { "path": "Referee.java", - "sha256": "1586c6e111c8b3351d76b2940ee45c287797a457545681a6e61a141f65c55e3b" - }, - { - "path": "package.bluej", - "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "sha256": "1d979941352ba316da7065711957d988424821569e512e6e131f4cadcac2d992" } ] }, @@ -1602,15 +1524,11 @@ }, { "path": "Cat.java", - "sha256": "f5e71d1da4812c7810701eeaf23bc2d8bb455b8c8d607fa0ab04fcebd8df9f2b" + "sha256": "237a182186dc30651ce89a9c50f1a1e957119e69d4c7292405f06028d60ed35c" }, { "path": "MyStage.java", - "sha256": "5de0b930fc63f2aef2d4d7f7e3ce6a8d8ec82ee5a28898347799c48bbdc5e781" - }, - { - "path": "MyWindow.java", - "sha256": "8056b03a70774938863b829c750300549323c4287eb9f9e6350cd77ccb101005" + "sha256": "08e71423d91cb006266462d83d15142b9f9c695e0d7e8b259499aeb327c8b005" }, { "path": "assets/.gitkeep", diff --git a/docs/public/compatibility.json b/docs/public/compatibility.json index 5fbb4e57..1894e03a 100644 --- a/docs/public/compatibility.json +++ b/docs/public/compatibility.json @@ -22,169 +22,114 @@ "scope": "Public constructors and method groups documented by the Javadoc doclet. Overload matching uses simple erased parameter names, constructor kind and static/instance kind; qualified parameter and return types are recorded. This is a source compatibility inventory, not a binary compatibility guarantee.", "limitations": [ "Availability describes documented member groups and browser declarations. Compilation tests do not prove rendering, timing or complete behavioral parity.", - "Fragment shaders use WebGL. Custom vertex shaders are desktop-only; the browser substitutes its default vertex shader.", - "File access, pixel-buffer, and recorder APIs are desktop-only. Tiled reads finite orthogonal TMX/TSX maps from workspace files or URLs. SaveData instead persists plain game data in IndexedDB, scoped to the hosting origin and browser profile.", + "Shaders are fragment shaders; the browser runs them with WebGL.", + "File access and recorder APIs are desktop-only; Pixels reads the stage on the graphics card. Tiled reads finite orthogonal TMX/TSX maps from workspace files or URLs. SaveData instead persists plain game data in IndexedDB, scoped to the hosting origin and browser profile.", "Reference examples are compiled with the standard flavor. Existing NRW runtime fixtures and a separate declaration inventory cover the NRW flavor.", "Java compiler dialect differences also apply, including Java package access and unsupported standard-library methods." ], "referenceValidation": { "flavor": "standard", - "examples": 437, + "examples": 355, "knownUnsupportedExamples": 0 }, "members": [ { - "id": "AnimatedSprite/addAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/changeX", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "addAnimation", - "constructor": false, - "static": false, - "parameters": [ - "java.lang.String", - "java.lang.String", - "int" - ], - "returns": "void", - "parameterNames": [ - "name", - "pattern", - "frames" - ], - "parameterDescriptions": [ - "the name of the animation", - "the pattern (@see String#format) of the file names. The frame\n starts from 1.", - "the number of frames in the animation" - ], - "description": "Adds an animation to the sprite.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "addAnimation", + "name": "changeX", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.util.function.Function", - "int" + "double" ], "returns": "void", "parameterNames": [ - "name", - "builder", - "frame" + "dx" ], "parameterDescriptions": [ - "the name of the animation", - "a function that builds the file names for the animation frames", - "the number of frames in the animation. The frame starts from\n 1." + "how far to move the camera along x" ], - "description": "Adds an animation to the sprite.\n\nTo add an animation with file names \"walk_1.png\", \"walk_2.png\",\n\"walk_3.png\", you can use the following code:\n\n```java\nsprite.addAnimation(\"walk\", i -> \"walk_\" + i + \".png\", 3);\n```", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/changeY", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ { - "name": "addAnimation", + "name": "changeY", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int" + "double" ], "returns": "void", "parameterNames": [ - "name", - "path", - "frames", - "width", - "height" + "dy" ], "parameterDescriptions": [ - "the name of the animation", - "the path to the animation frames", - "the number of frames in the animation", - "the width of each frame", - "the height of each frame" + "how far to move the camera along y" ], - "description": "Adds an animation to the sprite.\n\nFor an animation sprite sheet, where each frame is of equal width and height,\nyou can use this method to add an animation by specifying the path to the\nsprite sheet, the number of frames, and the dimensions of each frame.\nFor example, for a four-frame animation arranged in a single row, each frame\nbeing 64x64 pixels, you can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64);\n```", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/changeZoom", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ { - "name": "addAnimation", + "name": "changeZoom", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int", - "int" + "double" ], "returns": "void", "parameterNames": [ - "name", - "path", - "frames", - "width", - "height", - "row" + "dz" ], "parameterDescriptions": [ - "the name of the animation", - "the path to the animation frames", - "the number of frames in the animation", - "the width of each frame", - "the height of each frame", - "the row of the animation frames" + "percentage points to add to the zoom" ], - "description": "Adds an animation to the sprite.\n\nIf the animation frames are arranged in rows in a sprite sheet, you can use\nthis method to specify which row to use for the animation.\n\nFor example, for a four-frame animation arranged in a single row, you want the second, each frame\nbeing 64x64 pixels, you can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64, 2);\n```", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/constructor", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ { - "name": "addAnimation", - "constructor": false, + "name": "Camera", + "constructor": true, "static": false, - "parameters": [ - "java.lang.String", - "java.lang.String", - "int", - "int", - "int", - "int", - "boolean" - ], - "returns": "void", - "parameterNames": [ - "name", - "path", - "frames", - "width", - "height", - "column", - "useColumns" - ], - "parameterDescriptions": [ - "the name of the animation", - "the path to the animation frames", - "the number of frames in the animation", - "the width of each frame", - "the height of each frame", - "the column of the animation frames", - "whether to use columns or rows" - ], - "description": "Adds an animation to the sprite.\n\nIf the animation frames are arranged in either rows or columns in a sprite\nsheet, you can use this method to specify which column or row to use for the\nanimation. Take four frame animation arranged in a single column. Each frame is\n64x64 pixels. You can add the animation using the following code:\n\n```java\nsprite.addAnimation(\"walk\", \"assets/walk.png\", 4, 64, 64, 1, true); // use column 1\n```", + "parameters": [], + "returns": "org.openpatch.scratch.Camera", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A camera at (0, 0) with zoom 100. Every stage has its own: `getStage().getCamera()`.", "returnDescription": "", "scratchblock": "", "since": "" @@ -195,19 +140,19 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/clone", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/getPosition", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "clone", + "name": "getPosition", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.AnimatedSprite", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates a clone of this sprite with the same animations, playing the same\none, and puts it on the stage right behind this sprite. See\n[Sprite.clone()](../Sprite/clone).", - "returnDescription": "the clone, of the same class as this sprite", + "description": "", + "returnDescription": "the world position at the stage's centre", "scratchblock": "", "since": "" } @@ -217,38 +162,19 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/constructor", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/getX", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "AnimatedSprite", - "constructor": true, + "name": "getX", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.AnimatedSprite", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], "description": "", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "AnimatedSprite", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.AnimatedSprite" - ], - "returns": "org.openpatch.scratch.AnimatedSprite", - "parameterNames": [ - "animatedSprite" - ], - "parameterDescriptions": [ - "" - ], - "description": "", - "returnDescription": "", + "returnDescription": "the world x at the stage's centre", "scratchblock": "", "since": "" } @@ -258,19 +184,19 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/getAnimationFrame", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/getY", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "getAnimationFrame", + "name": "getY", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Gets the current animation frame.", - "returnDescription": "the current animation frame", + "description": "", + "returnDescription": "the world y at the stage's centre", "scratchblock": "", "since": "" } @@ -280,19 +206,19 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/getAnimationInterval", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/getZoom", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "getAnimationInterval", + "name": "getZoom", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Gets the interval between animation frames.", - "returnDescription": "the interval between animation frames", + "description": "", + "returnDescription": "the zoom in percent", "scratchblock": "", "since": "" } @@ -302,19 +228,19 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/isAnimationPlayed", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/resetZoom", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "isAnimationPlayed", + "name": "resetZoom", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks if the animation is played.", - "returnDescription": "true if the animation is played, false otherwise", + "description": "Back to zoom 100.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -324,46 +250,46 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/playAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/setPosition", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "playAnimation", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "double", + "double" ], "returns": "void", "parameterNames": [ - "name" + "x", + "y" ], "parameterDescriptions": [ - "the name of the animation to play" + "world x", + "world y" ], - "description": "Plays the animation with the specified name.", + "description": "Centres the camera on a world position.", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "playAnimation", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "boolean" + "org.openpatch.scratch.Vector2" ], "returns": "void", "parameterNames": [ - "name", - "once" + "position" ], "parameterDescriptions": [ - "the name of the animation to play", - "whether to play the animation once" + "world position" ], - "description": "Plays the animation with the specified name.", + "description": "Centres the camera on a world position.", "returnDescription": "", "scratchblock": "", "since": "" @@ -374,18 +300,24 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/resetAnimation", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/setX", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "resetAnimation", + "name": "setX", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Resets the animation. The animation will start from the first frame.", + "parameterNames": [ + "x" + ], + "parameterDescriptions": [ + "the world x to show at the stage's centre" + ], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -396,24 +328,24 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/setAnimationFrame", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/setY", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "setAnimationFrame", + "name": "setY", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], "returns": "void", "parameterNames": [ - "frame" + "y" ], "parameterDescriptions": [ - "the current animation frame" + "the world y to show at the stage's centre" ], - "description": "Sets the current animation frame.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -424,24 +356,24 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/setAnimationInterval", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/setZoom", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "setAnimationInterval", + "name": "setZoom", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], "returns": "void", "parameterNames": [ - "interval" + "zoom" ], "parameterDescriptions": [ - "the interval between animation frames" + "the zoom in percent" ], - "description": "Sets the interval between animation frames.", + "description": "Sets the zoom in percent: 200 shows everything twice as large, 50 half as large. It stays\nwithin the zoom limits (50 to 200 unless changed).", "returnDescription": "", "scratchblock": "", "since": "" @@ -452,19 +384,28 @@ "missingBrowserSignatures": [] }, { - "id": "AnimatedSprite/toString", - "owner": "org.openpatch.scratch.AnimatedSprite", + "id": "Camera/setZoomLimit", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "toString", + "name": "setZoomLimit", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns which animation is playing and how far into it.", - "returnDescription": "the sprite as a text", + "parameters": [ + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "min", + "max" + ], + "parameterDescriptions": [ + "the smallest zoom in percent", + "the largest zoom in percent" + ], + "description": "Limits the zoom.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -474,31 +415,25 @@ "missingBrowserSignatures": [] }, { - "id": "Circle/constructor", - "owner": "org.openpatch.scratch.Circle", + "id": "Camera/toScreenPosition", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "Circle", - "constructor": true, + "name": "toScreenPosition", + "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "org.openpatch.scratch.Vector2" ], - "returns": "org.openpatch.scratch.Circle", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "x", - "y", - "radius" + "world" ], "parameterDescriptions": [ - "the x-coordinate of the circle's center", - "the y-coordinate of the circle's center", - "the radius of the circle" + "a world position" ], - "description": "Creates a circle with no specified position or size.", - "returnDescription": "", + "description": "Where a world position shows on the stage.", + "returnDescription": "the screen position (origin at the stage's centre)", "scratchblock": "", "since": "" } @@ -508,28 +443,26 @@ "missingBrowserSignatures": [] }, { - "id": "Clock/constructor", - "owner": "org.openpatch.scratch.Clock", - "signatures": [], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Clock/getDay", - "owner": "org.openpatch.scratch.Clock", + "id": "Camera/toScreenX", + "owner": "org.openpatch.scratch.Camera", "signatures": [ { - "name": "getDay", + "name": "toScreenX", "constructor": false, - "static": true, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current day of the month, from 1 to 31.", - "returnDescription": "the day of the month", - "scratchblock": "(current [date v])", + "static": false, + "parameters": [ + "double" + ], + "returns": "double", + "parameterNames": [ + "worldX" + ], + "parameterDescriptions": [ + "a world x" + ], + "description": "", + "returnDescription": "where it shows on the stage", + "scratchblock": "", "since": "" } ], @@ -538,7 +471,183 @@ "missingBrowserSignatures": [] }, { - "id": "Clock/getDayOfWeek", + "id": "Camera/toScreenY", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ + { + "name": "toScreenY", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "double", + "parameterNames": [ + "worldY" + ], + "parameterDescriptions": [ + "a world y" + ], + "description": "", + "returnDescription": "where it shows on the stage", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/toWorldPosition", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ + { + "name": "toWorldPosition", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [ + "screen" + ], + "parameterDescriptions": [ + "a screen position (origin at the stage's centre)" + ], + "description": "Which world position shows at a place on the stage.", + "returnDescription": "the world position", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/toWorldX", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ + { + "name": "toWorldX", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "double", + "parameterNames": [ + "screenX" + ], + "parameterDescriptions": [ + "an x on the stage" + ], + "description": "", + "returnDescription": "the world x shown there", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Camera/toWorldY", + "owner": "org.openpatch.scratch.Camera", + "signatures": [ + { + "name": "toWorldY", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "double", + "parameterNames": [ + "screenY" + ], + "parameterDescriptions": [ + "a y on the stage" + ], + "description": "", + "returnDescription": "the world y shown there", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Circle/constructor", + "owner": "org.openpatch.scratch.Circle", + "signatures": [ + { + "name": "Circle", + "constructor": true, + "static": false, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "org.openpatch.scratch.Circle", + "parameterNames": [ + "x", + "y", + "radius" + ], + "parameterDescriptions": [ + "x of the centre", + "y of the centre", + "the radius" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Clock/constructor", + "owner": "org.openpatch.scratch.Clock", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Clock/getDay", + "owner": "org.openpatch.scratch.Clock", + "signatures": [ + { + "name": "getDay", + "constructor": false, + "static": true, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the current day of the month, from 1 to 31.", + "returnDescription": "the day of the month", + "scratchblock": "(current [date v])", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Clock/getDayOfWeek", "owner": "org.openpatch.scratch.Clock", "signatures": [ { @@ -714,46 +823,30 @@ "missingBrowserSignatures": [] }, { - "id": "Color/changeColor", + "id": "Color/constructor", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "changeColor", - "constructor": false, + "name": "Color", + "constructor": true, "static": false, "parameters": [ + "double", + "double", "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "h" + "red", + "green", + "blue" ], "parameterDescriptions": [ - "A hue value. Could be any positive or negative number." + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" ], - "description": "Changes the color accordining to a hue value, which is added to the current hue value. When the\nresulting value is greater than 255 it will be reset. For example: 285 => 30.", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Color/constructor", - "owner": "org.openpatch.scratch.Color", - "signatures": [ - { - "name": "Color", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Constructs a new Color object with default values.", + "description": "A colour from red, green and blue, each from 0 to 255 (values outside are clamped). The\ncolour is opaque.", "returnDescription": "", "scratchblock": "", "since": "" @@ -763,16 +856,25 @@ "constructor": true, "static": false, "parameters": [ - "java.lang.String" + "double", + "double", + "double", + "double" ], "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "hexCode" + "red", + "green", + "blue", + "alpha" ], "parameterDescriptions": [ - "" + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255", + "opacity from 0 to 255" ], - "description": "", + "description": "A colour from red, green, blue and alpha, each from 0 to 255 (values outside are clamped).\nAn alpha of 0 is invisible, 255 opaque.", "returnDescription": "", "scratchblock": "", "since": "" @@ -782,61 +884,73 @@ "constructor": true, "static": false, "parameters": [ - "double" + "java.lang.String" ], "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "h" + "hex" ], "parameterDescriptions": [ - "the hue value" + "the hex code" ], - "description": "Constructs a new Color object with the specified hue value.", + "description": "A colour from a hex code as in HTML and CSS: `\"#ff8000\"`, `\"ff8000\"`,\n`\"#f80\"`, or with alpha `\"#ff800080\"`.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Color/equals", + "owner": "org.openpatch.scratch.Color", + "signatures": [ { - "name": "Color", - "constructor": true, + "name": "equals", + "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "java.lang.Object" ], - "returns": "org.openpatch.scratch.Color", + "returns": "boolean", "parameterNames": [ - "r", - "g", - "b" + "other" ], "parameterDescriptions": [ - "the red value", - "the green value", - "the blue value" + "" ], - "description": "Constructs a new Color object with the specified rgb values.", + "description": "Two colours are equal when they pack into the same ARGB number.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Color/fromARGB", + "owner": "org.openpatch.scratch.Color", + "signatures": [ { - "name": "Color", - "constructor": true, - "static": false, + "name": "fromARGB", + "constructor": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Color" + "int" ], "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "c" + "argb" ], "parameterDescriptions": [ - "ScratchColor object to copy" + "alpha, red, green and blue in one int" ], - "description": "Copies the received ScratchColor object.", - "returnDescription": "", + "description": "A colour from a packed ARGB number, as [toARGB()](toARGB) gives it.", + "returnDescription": "the colour", "scratchblock": "", "since": "" } @@ -846,25 +960,31 @@ "missingBrowserSignatures": [] }, { - "id": "Color/equals", + "id": "Color/fromHSB", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "equals", + "name": "fromHSB", "constructor": false, - "static": false, + "static": true, "parameters": [ - "java.lang.Object" + "double", + "double", + "double" ], - "returns": "boolean", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "other" + "hue", + "saturation", + "brightness" ], "parameterDescriptions": [ - "the object to compare with" + "the colour from 0 to 100", + "from 0 (grey) to 100 (full colour)", + "from 0 (black) to 100 (full brightness)" ], - "description": "Two colours are the same when they are the same colour.", - "returnDescription": "whether both are colours with the same red, green and blue", + "description": "A colour from Scratch's colour, saturation and brightness, each from 0 to 100. The colour\ngoes around (110 is the same as 10); saturation and brightness are clamped.", + "returnDescription": "the colour", "scratchblock": "", "since": "" } @@ -874,19 +994,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/get", + "id": "Color/getAlpha", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "get", + "name": "getAlpha", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the color value as a hex code. This is useful for comparing pixels.", - "returnDescription": "hex code", + "description": "", + "returnDescription": "alpha (opacity) from 0 (invisible) to 255 (opaque)", "scratchblock": "", "since": "" } @@ -907,8 +1027,8 @@ "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the blue value.", - "returnDescription": "blue value [0...255]", + "description": "", + "returnDescription": "blue from 0 to 255", "scratchblock": "", "since": "" } @@ -918,19 +1038,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getGreen", + "id": "Color/getBrightness", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getGreen", + "name": "getBrightness", "constructor": false, "static": false, "parameters": [], "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the green value.", - "returnDescription": "green value [0...255]", + "description": "", + "returnDescription": "brightness from 0 (black) to 100", "scratchblock": "", "since": "" } @@ -940,19 +1060,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getH", + "id": "Color/getGreen", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getH", + "name": "getGreen", "constructor": false, "static": false, "parameters": [], "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the hue value.", - "returnDescription": "hue value [0...255]", + "description": "", + "returnDescription": "green from 0 to 255", "scratchblock": "", "since": "" } @@ -962,19 +1082,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getHSB", + "id": "Color/getHue", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getHSB", + "name": "getHue", "constructor": false, "static": false, "parameters": [], "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the color value on the HSB spectrum.", - "returnDescription": "hue value [0...255]", + "description": "", + "returnDescription": "Scratch's colour (hue) from 0 to 100; 0 for greys", "scratchblock": "", "since": "" } @@ -984,19 +1104,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getL", + "id": "Color/getRed", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getL", + "name": "getRed", "constructor": false, "static": false, "parameters": [], "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the luminosity value.", - "returnDescription": "luminosity value [0...255]", + "description": "", + "returnDescription": "red from 0 to 255", "scratchblock": "", "since": "" } @@ -1006,19 +1126,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getRed", + "id": "Color/getSaturation", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getRed", + "name": "getSaturation", "constructor": false, "static": false, "parameters": [], "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the red value.", - "returnDescription": "red value [0...255]", + "description": "", + "returnDescription": "saturation from 0 (grey) to 100", "scratchblock": "", "since": "" } @@ -1028,19 +1148,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/getS", + "id": "Color/hashCode", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getS", + "name": "hashCode", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the saturation value.", - "returnDescription": "saturation value [0...255]", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -1050,19 +1170,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/hashCode", + "id": "Color/toARGB", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "hashCode", + "name": "toARGB", "constructor": false, "static": false, "parameters": [], "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "", - "returnDescription": "a hash consistent with [equals(Object)](equals)", + "description": "The colour packed into one int as alpha, red, green and blue (8 bits each, rounded), the way\npixels are stored.", + "returnDescription": "the packed colour", "scratchblock": "", "since": "" } @@ -1072,50 +1192,19 @@ "missingBrowserSignatures": [] }, { - "id": "Color/setHSB", + "id": "Color/toString", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "setHSB", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "h" - ], - "parameterDescriptions": [ - "A hue value [0...255]" - ], - "description": "Setting the color value after the HSB spectrum. Saturation and Luminosity are fixed at 255.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "setHSB", + "name": "toString", "constructor": false, "static": false, - "parameters": [ - "double", - "double", - "double" - ], - "returns": "void", - "parameterNames": [ - "h", - "s", - "l" - ], - "parameterDescriptions": [ - "A hue value [0...255]", - "A saturation value [0...255]", - "A luminosity value [0...255]" - ], - "description": "Setting the color value after the HSB spectrum.", - "returnDescription": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "`#rrggbb`, or `#rrggbbaa` when not opaque", "scratchblock": "", "since": "" } @@ -1125,31 +1214,25 @@ "missingBrowserSignatures": [] }, { - "id": "Color/setRGB", + "id": "Color/withAlpha", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "setRGB", + "name": "withAlpha", "constructor": false, "static": false, "parameters": [ - "double", - "double", "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "r", - "g", - "b" + "alpha" ], "parameterDescriptions": [ - "A red value [0...255]", - "A green value [0...255]", - "A blue value [0...255]" + "opacity from 0 to 255" ], - "description": "Setting the color value after the RGB spectrum", - "returnDescription": "", + "description": "", + "returnDescription": "this colour with another alpha", "scratchblock": "", "since": "" } @@ -1159,56 +1242,25 @@ "missingBrowserSignatures": [] }, { - "id": "Color/toString", + "id": "Color/withBlue", "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "toString", + "name": "withBlue", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "The colour written out, so that printing one says something.\n\nWithout this a `System.out.println(mySprite.getTint())` printed\n`org.openpatch.scratch.Color@35432107`, which tells you nothing about\nthe colour and is the first thing anyone tries when a tint looks wrong.", - "returnDescription": "the colour as `Color[r=255.0, g=128.0, b=0.0]`", - "scratchblock": "", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Ellipse/constructor", - "owner": "org.openpatch.scratch.Ellipse", - "signatures": [ - { - "name": "Ellipse", - "constructor": true, - "static": false, "parameters": [ - "double", - "double", - "double", "double" ], - "returns": "org.openpatch.scratch.Ellipse", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "x", - "y", - "width", - "height" + "blue" ], "parameterDescriptions": [ - "", - "", - "", - "" + "blue from 0 to 255" ], - "description": "Creates an ellipse with no specified position or size.", - "returnDescription": "", + "description": "", + "returnDescription": "this colour with another blue", "scratchblock": "", "since": "" } @@ -1218,47 +1270,25 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/constructor", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Color/withBrightness", + "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "Hitbox", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Shape" - ], - "returns": "org.openpatch.scratch.Hitbox", - "parameterNames": [ - "shape" - ], - "parameterDescriptions": [ - "The shape of the hitbox." - ], - "description": "Constructs a hitbox with the specified shape.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "Hitbox", - "constructor": true, + "name": "withBrightness", + "constructor": false, "static": false, "parameters": [ - "double[]", - "double[]" + "double" ], - "returns": "org.openpatch.scratch.Hitbox", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "xPoints", - "yPoints" + "brightness" ], "parameterDescriptions": [ - "The x-coordinates of the points.", - "The y-coordinates of the points." + "from 0 to 100" ], - "description": "Constructs a hitbox with the specified x and y points.", - "returnDescription": "", + "description": "", + "returnDescription": "this colour with another brightness", "scratchblock": "", "since": "" } @@ -1268,28 +1298,25 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/contains", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Color/withGreen", + "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "contains", + "name": "withGreen", "constructor": false, "static": false, "parameters": [ - "double", "double" ], - "returns": "boolean", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "x", - "y" + "green" ], "parameterDescriptions": [ - "The x-coordinate of the point.", - "The y-coordinate of the point." + "green from 0 to 255" ], - "description": "Checks if the hitbox contains a point.", - "returnDescription": "`true` if the hitbox contains the point, `false`\n otherwise.", + "description": "", + "returnDescription": "this colour with another green", "scratchblock": "", "since": "" } @@ -1299,19 +1326,25 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/getBounds", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Color/withHue", + "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getBounds", + "name": "withHue", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Bounds", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the smallest upright rectangle the hitbox fits into.", - "returnDescription": "the bounding box of the hitbox", + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color", + "parameterNames": [ + "hue" + ], + "parameterDescriptions": [ + "the colour from 0 to 100" + ], + "description": "Another colour (hue), keeping saturation, brightness and alpha. The colour goes around, so\n`withHue(getHue() + 10)` works like Scratch's \"change color by 10\".", + "returnDescription": "this colour with another hue", "scratchblock": "", "since": "" } @@ -1321,19 +1354,25 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/getShape", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Color/withRed", + "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "getShape", + "name": "withRed", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Shape", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the shape of the hitbox.", - "returnDescription": "The shape of the hitbox.", + "parameters": [ + "double" + ], + "returns": "org.openpatch.scratch.Color", + "parameterNames": [ + "red" + ], + "parameterDescriptions": [ + "red from 0 to 255" + ], + "description": "", + "returnDescription": "this colour with another red", "scratchblock": "", "since": "" } @@ -1343,25 +1382,25 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/intersects", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Color/withSaturation", + "owner": "org.openpatch.scratch.Color", "signatures": [ { - "name": "intersects", + "name": "withSaturation", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Hitbox" + "double" ], - "returns": "boolean", + "returns": "org.openpatch.scratch.Color", "parameterNames": [ - "hitbox" + "saturation" ], "parameterDescriptions": [ - "The hitbox to check for intersection." + "from 0 to 100" ], - "description": "Checks if the hitbox intersects with another hitbox.", - "returnDescription": "`true` if the hitboxes intersect, `false` otherwise.", + "description": "", + "returnDescription": "this colour with another saturation", "scratchblock": "", "since": "" } @@ -1371,39 +1410,33 @@ "missingBrowserSignatures": [] }, { - "id": "Hitbox/translateAndRotateAndResize", - "owner": "org.openpatch.scratch.Hitbox", + "id": "Ellipse/constructor", + "owner": "org.openpatch.scratch.Ellipse", "signatures": [ { - "name": "translateAndRotateAndResize", - "constructor": false, + "name": "Ellipse", + "constructor": true, "static": false, "parameters": [ - "double", - "double", "double", "double", "double", "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Ellipse", "parameterNames": [ - "degrees", - "originX", - "originY", - "translateX", - "translateY", - "size" + "x", + "y", + "width", + "height" ], "parameterDescriptions": [ - "The angle in degrees to rotate the shape.", - "The x-coordinate of the rotation origin.", - "The y-coordinate of the rotation origin.", - "The x-coordinate to translate the shape.", - "The y-coordinate to translate the shape.", - "The size to scale the shape, where 100.0 represents the\n original size." + "the smallest x of the rectangle around it", + "the smallest y of the rectangle around it", + "the width", + "the height" ], - "description": "Transforms the shape by scaling, translating, and rotating it.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -1416,21 +1449,7 @@ { "id": "HtmlColor/constructor", "owner": "org.openpatch.scratch.HtmlColor", - "signatures": [ - { - "name": "HtmlColor", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.HtmlColor", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ], + "signatures": [], "status": "implemented", "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] @@ -2036,7 +2055,7 @@ ], "description": "\"mod\" is an abbreviation for \"modulo\". Modulo returns what is left over when\nthe first input is divided by the second, with the sign of the second input,\nas the Scratch block does.", "returnDescription": "what is left of the first value after dividing by the second", - "scratchblock": "", + "scratchblock": "((x) mod (y))", "since": "" } ], @@ -2086,7 +2105,7 @@ ], "description": "Rounds a number to a specified number of decimal places.", "returnDescription": "the rounded value", - "scratchblock": "", + "scratchblock": "(round (x))", "since": "" } ], @@ -2219,12 +2238,12 @@ ], "returns": "void", "parameterNames": [ - "c" + "by" ], "parameterDescriptions": [ - "a hue value [0...255]" + "how much to change the colour (hue, 0 to 100, going around)" ], - "description": "Change color via a hue value, which is added to the current hue value", + "description": "", "returnDescription": "", "scratchblock": "change pen [color v] by (c)", "since": "" @@ -2247,12 +2266,12 @@ ], "returns": "void", "parameterNames": [ - "size" + "by" ], "parameterDescriptions": [ - "size to change" + "how much to change the line width" ], - "description": "Change the size of the pen", + "description": "", "returnDescription": "", "scratchblock": "change pen size by (size)", "since": "" @@ -2275,12 +2294,12 @@ ], "returns": "void", "parameterNames": [ - "step" + "by" ], "parameterDescriptions": [ - "the step to change the transparency by" + "how much to change the transparency" ], - "description": "Change the transparency by a step", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -2302,45 +2321,7 @@ "returns": "org.openpatch.scratch.Pen", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructs a new Pen object.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "Pen", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "org.openpatch.scratch.Pen", - "parameterNames": [ - "s" - ], - "parameterDescriptions": [ - "the Sprite object to associate with this Pen" - ], - "description": "Constructs a new Pen object associated with the given Sprite.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "Pen", - "constructor": true, - "static": false, - "parameters": [ - "org.openpatch.scratch.Pen" - ], - "returns": "org.openpatch.scratch.Pen", - "parameterNames": [ - "p" - ], - "parameterDescriptions": [ - "Pen object to copy" - ], - "description": "Copies a Pen object.", + "description": "A pen of your own, at (0, 0); add it to a stage with `stage.add(pen)`.", "returnDescription": "", "scratchblock": "", "since": "" @@ -2362,7 +2343,7 @@ "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Set the pen down.", + "description": "Puts the pen down: it leaves a dot, and a line wherever it moves.", "returnDescription": "", "scratchblock": "pen down", "since": "" @@ -2384,7 +2365,7 @@ "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Erases all.", + "description": "Erases everything drawn on the pen's layer, by any pen or stamp.", "returnDescription": "", "scratchblock": "erase all", "since": "" @@ -2406,8 +2387,8 @@ "returns": "org.openpatch.scratch.Color", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the current color of the pen.", - "returnDescription": "the color of the pen", + "description": "", + "returnDescription": "the colour lines are drawn in", "scratchblock": "", "since": "" } @@ -2417,19 +2398,19 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/getSize", + "id": "Pen/getLayer", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "getSize", + "name": "getLayer", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "org.openpatch.scratch.Layer", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the size of the pen", - "returnDescription": "the size of the pen", + "description": "", + "returnDescription": "the layer whose canvas the pen draws on", "scratchblock": "", "since": "" } @@ -2439,19 +2420,19 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/goToBackground", + "id": "Pen/getPosition", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "goToBackground", + "name": "getPosition", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [], "parameterDescriptions": [], - "description": "Sets the pen to the background. This method changes the state of the pen to\nindicate that it is\nno longer in the foreground.", - "returnDescription": "", + "description": "", + "returnDescription": "the pen's world position", "scratchblock": "", "since": "" } @@ -2461,19 +2442,19 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/goToForeground", + "id": "Pen/getSize", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "goToForeground", + "name": "getSize", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Moves the pen to the foreground. This method sets the pen's state to indicate\nthat it is in the\nforeground.", - "returnDescription": "", + "description": "", + "returnDescription": "the line width in stage pixels", "scratchblock": "", "since": "" } @@ -2483,19 +2464,19 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/goToMousePointer", + "id": "Pen/getTransparency", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "goToMousePointer", + "name": "getTransparency", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Moves the object to the current position of the mouse pointer.", - "returnDescription": "", + "description": "", + "returnDescription": "the transparency in percent (0 opaque, 100 invisible)", "scratchblock": "", "since": "" } @@ -2505,18 +2486,18 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/goToRandomPosition", + "id": "Pen/goToMousePointer", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "goToRandomPosition", + "name": "goToMousePointer", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Moves the object to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", + "description": "Moves the pen to the mouse pointer, drawing if it is down.", "returnDescription": "", "scratchblock": "", "since": "" @@ -2527,19 +2508,41 @@ "missingBrowserSignatures": [] }, { - "id": "Pen/isInBackground", + "id": "Pen/goToRandomPosition", "owner": "org.openpatch.scratch.Pen", "signatures": [ { - "name": "isInBackground", + "name": "goToRandomPosition", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Moves the pen to a random position on the stage, drawing if it is down.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pen/isDown", + "owner": "org.openpatch.scratch.Pen", + "signatures": [ + { + "name": "isDown", "constructor": false, "static": false, "parameters": [], "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns true if the pen is in the background.", - "returnDescription": "true if the pen is in the background", + "description": "", + "returnDescription": "whether the pen is down and draws when it moves", "scratchblock": "", "since": "" } @@ -2561,12 +2564,12 @@ ], "returns": "void", "parameterNames": [ - "c" + "color" ], "parameterDescriptions": [ - "color of the pen" + "the colour to draw lines in" ], - "description": "Set the color of the pen", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -2580,14 +2583,14 @@ ], "returns": "void", "parameterNames": [ - "h" + "hue" ], "parameterDescriptions": [ - "a hue value [0...255]" + "the colour from 0 to 100" ], - "description": "Set color via hue value", + "description": "Sets the colour by Scratch's colour number (hue) from 0 to 100, at full saturation and\nbrightness, like Scratch's \"set pen color to\".", "returnDescription": "", - "scratchblock": "set pen [color v] to (h)", + "scratchblock": "", "since": "" }, { @@ -2601,16 +2604,44 @@ ], "returns": "void", "parameterNames": [ - "r", - "g", - "b" + "red", + "green", + "blue" + ], + "parameterDescriptions": [ + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pen/setLayer", + "owner": "org.openpatch.scratch.Pen", + "signatures": [ + { + "name": "setLayer", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Layer" + ], + "returns": "void", + "parameterNames": [ + "layer" ], "parameterDescriptions": [ - "a red value [0...255]", - "a green value [0...255]", - "a blue value [0...255]" + "the layer whose canvas the pen draws on" ], - "description": "Set color via rgb values", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -2638,10 +2669,10 @@ "y" ], "parameterDescriptions": [ - "x coordinate", - "y coordinate" + "world x", + "world y" ], - "description": "Set the position if the pen is down.", + "description": "Moves the pen, drawing a line from where it was if it is down.", "returnDescription": "", "scratchblock": "", "since": "" @@ -2655,12 +2686,12 @@ ], "returns": "void", "parameterNames": [ - "v" + "position" ], "parameterDescriptions": [ - "the Vector2 object containing the new x and y coordinates" + "world position" ], - "description": "Sets the position of the pen using a Vector2 object.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -2686,9 +2717,9 @@ "size" ], "parameterDescriptions": [ - "size of the pen" + "the line width in stage pixels (at least 1)" ], - "description": "Set the size of the pen", + "description": "", "returnDescription": "", "scratchblock": "set pen size to (size)", "since": "" @@ -2714,9 +2745,9 @@ "transparency" ], "parameterDescriptions": [ - "transparency of the pen" + "in percent (0 opaque, 100 invisible)" ], - "description": "Set the transparency", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -2738,7 +2769,7 @@ "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Stamps the current sprite onto the canvas. If the sprite is not null, it will\nstamp either to\nthe foreground or the background based on the value of the isForeground flag.", + "description": "Stamps the pen's sprite onto the pen's layer, like Scratch's \"stamp\" block.", "returnDescription": "", "scratchblock": "stamp", "since": "" @@ -2760,7 +2791,7 @@ "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Move the pen up.", + "description": "Lifts the pen: it no longer draws.", "returnDescription": "", "scratchblock": "pen up", "since": "" @@ -2770,6 +2801,167 @@ "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, + { + "id": "Pixels/constructor", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pixels/getArgb", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [ + { + "name": "getArgb", + "constructor": false, + "static": false, + "parameters": [ + "int", + "int" + ], + "returns": "int", + "parameterNames": [ + "x", + "y" + ], + "parameterDescriptions": [ + "pixels from the left edge", + "pixels from the top edge" + ], + "description": "", + "returnDescription": "the colour there packed as alpha, red, green, blue, or 0 outside", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pixels/getColor", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [ + { + "name": "getColor", + "constructor": false, + "static": false, + "parameters": [ + "int", + "int" + ], + "returns": "org.openpatch.scratch.Color", + "parameterNames": [ + "x", + "y" + ], + "parameterDescriptions": [ + "pixels from the left edge", + "pixels from the top edge" + ], + "description": "", + "returnDescription": "the colour there, or transparent black outside", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pixels/getHeight", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [ + { + "name": "getHeight", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the height in pixels", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pixels/getWidth", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [ + { + "name": "getWidth", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the width in pixels", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Pixels/of", + "owner": "org.openpatch.scratch.Pixels", + "signatures": [ + { + "name": "of", + "constructor": false, + "static": true, + "parameters": [ + "org.openpatch.scratch.Stage" + ], + "returns": "org.openpatch.scratch.Pixels", + "parameterNames": [ + "stage" + ], + "parameterDescriptions": [ + "the stage" + ], + "description": "The stage's pixels as they are now.", + "returnDescription": "its pixels, at stage size", + "scratchblock": "", + "since": "" + }, + { + "name": "of", + "constructor": false, + "static": true, + "parameters": [ + "java.lang.String" + ], + "returns": "org.openpatch.scratch.Pixels", + "parameterNames": [ + "imagePath" + ], + "parameterDescriptions": [ + "the image" + ], + "description": "The pixels of an image file.", + "returnDescription": "its pixels", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, { "id": "Polygon/addPoint", "owner": "org.openpatch.scratch.Polygon", @@ -2788,10 +2980,10 @@ "y" ], "parameterDescriptions": [ - "the x-coordinate", - "the y-coordinate" + "x of the corner", + "y of the corner" ], - "description": "Adds a point to the polygon.", + "description": "Adds a corner after the last one.", "returnDescription": "", "scratchblock": "", "since": "" @@ -2813,7 +3005,7 @@ "returns": "org.openpatch.scratch.Polygon", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates an empty polygon.", + "description": "A polygon without corners yet; add them with [addPoint(double, double)](addPoint).", "returnDescription": "", "scratchblock": "", "since": "" @@ -2832,10 +3024,10 @@ "yPoints" ], "parameterDescriptions": [ - "an array of x-coordinates", - "an array of y-coordinates" + "x of every corner", + "y of every corner, in the same order" ], - "description": "Creates a polygon with the specified vertices.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -3207,12 +3399,12 @@ "height" ], "parameterDescriptions": [ - "the x-coordinate of the rectangle's top-left corner", - "the y-coordinate of the rectangle's top-left corner", - "the width of the rectangle", - "the height of the rectangle" + "the smallest x", + "the smallest y", + "the width", + "the height" ], - "description": "Creates a rectangle with the specified position and size.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -3223,58 +3415,27 @@ "missingBrowserSignatures": [] }, { - "id": "Shape/constructor", - "owner": "org.openpatch.scratch.Shape", + "id": "Shader/constructor", + "owner": "org.openpatch.scratch.Shader", "signatures": [], "status": "implemented", "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "Shape/contains", - "owner": "org.openpatch.scratch.Shape", - "signatures": [ - { - "name": "contains", - "constructor": false, - "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "boolean", - "parameterNames": [ - "x", - "y" - ], - "parameterDescriptions": [ - "the x-coordinate of the point", - "the y-coordinate of the point" - ], - "description": "Check if the shape contains a point defined by its x and y coordinates.", - "returnDescription": "true if the shape contains the point, false otherwise", - "scratchblock": "", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Shape/getBounds", - "owner": "org.openpatch.scratch.Shape", + "id": "Shader/getName", + "owner": "org.openpatch.scratch.Shader", "signatures": [ { - "name": "getBounds", + "name": "getName", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Bounds", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Get the bounds of the shape.", - "returnDescription": "a Bounds object representing the bounding box of the shape", + "description": "", + "returnDescription": "the shader's name", "scratchblock": "", "since": "" } @@ -3284,204 +3445,165 @@ "missingBrowserSignatures": [] }, { - "id": "Shape/intersects", - "owner": "org.openpatch.scratch.Shape", + "id": "Shader/set", + "owner": "org.openpatch.scratch.Shader", "signatures": [ { - "name": "intersects", + "name": "set", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Shape" + "java.lang.String", + "double" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "other" + "uniform", + "value" ], "parameterDescriptions": [ - "the other shape to check intersection with" + "the uniform's name in the shader", + "an `int` or `float` uniform's value" ], - "description": "Check if the shape intersects with another shape.", - "returnDescription": "true if the shapes intersect, false otherwise", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Shape/rotate", - "owner": "org.openpatch.scratch.Shape", - "signatures": [ + }, { - "name": "rotate", + "name": "set", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "java.lang.String", + "int" ], - "returns": "org.openpatch.scratch.Shape", + "returns": "void", "parameterNames": [ - "theta", - "anchorX", - "anchorY" + "uniform", + "value" ], "parameterDescriptions": [ - "the angle in degrees to rotate", - "the x-coordinate of the anchor point", - "the y-coordinate of the anchor point" + "the uniform's name", + "an `int` uniform's value" ], - "description": "Rotate the shape by the specified angle around a given anchor point.", - "returnDescription": "a new Shape object that is rotated", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Shape/scale", - "owner": "org.openpatch.scratch.Shape", - "signatures": [ + }, { - "name": "scale", + "name": "set", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "java.lang.String", + "boolean" ], - "returns": "org.openpatch.scratch.Shape", + "returns": "void", "parameterNames": [ - "scaleX", - "scaleY" + "uniform", + "value" ], "parameterDescriptions": [ - "", - "" + "the uniform's name", + "a `bool` uniform's value" ], - "description": "Check if the shape is empty.", - "returnDescription": "true if the shape is empty, false otherwise", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Shape/translate", - "owner": "org.openpatch.scratch.Shape", - "signatures": [ + }, { - "name": "translate", + "name": "set", "constructor": false, "static": false, "parameters": [ + "java.lang.String", "double", "double" ], - "returns": "org.openpatch.scratch.Shape", + "returns": "void", "parameterNames": [ - "dx", - "dy" + "uniform", + "x", + "y" ], "parameterDescriptions": [ - "the distance to translate in the x direction", - "the distance to translate in the y direction" + "the uniform's name", + "a `vec2`'s x", + "a `vec2`'s y" ], - "description": "Translate the shape by the specified distances in the x and y directions.", - "returnDescription": "a new Shape object that is translated", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Sprite/addCostume", - "owner": "org.openpatch.scratch.Sprite", - "signatures": [ + }, { - "name": "addCostume", + "name": "set", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "java.lang.String", + "org.openpatch.scratch.Vector2" ], "returns": "void", "parameterNames": [ - "name" + "uniform", + "value" ], "parameterDescriptions": [ - "the name of a built-in sprite, for example \"bunny1_jump\". Add\n the sheet in front of the name, for example\n \"platformer/grass\", if the same name exists on several sheets." + "the uniform's name", + "a `vec2`" ], - "description": "Add one of the costumes that ship with Scratch for Java to the sprite. The\ncostume gets the same name as the built-in sprite. If a costume with that\nname already exists do nothing.\n\nExample usage:\n\n```java\nthis.addCostume(\"bunny1_jump\");\n```", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "addCostume", + "name": "set", "constructor": false, "static": false, "parameters": [ "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "name", - "imagePath" + "uniform", + "color" ], "parameterDescriptions": [ - "a unique name", - "a image path, or the name of a built-in sprite such as\n \"bunny1_jump\"" + "the uniform's name", + "a `vec4`: red, green, blue and alpha from 0 to 1" ], - "description": "Add a costume to the sprite. If a costume with the received name already\nexists do nothing.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "addCostume", + "name": "set", "constructor": false, "static": false, "parameters": [ "java.lang.String", - "java.lang.String", - "int", - "int", - "int", + "double[]", "int" ], "returns": "void", "parameterNames": [ - "name", - "spriteSheetPath", - "x", - "y", - "width", - "height" + "uniform", + "values", + "perElement" ], "parameterDescriptions": [ - "The name of the costume.", - "The path to the sprite sheet image file.", - "The x-coordinate of the top-left corner of the costume\n in the sprite sheet.", - "The y-coordinate of the top-left corner of the costume\n in the sprite sheet.", - "The width of the costume in the sprite sheet.", - "The height of the costume in the sprite sheet." + "the uniform's name", + "all values, one element after the other", + "values per element: 1 for `float[]`, 3 for `vec3[]`" ], - "description": "Adds a new costume to the sprite if a costume with the same name does not\nalready exist.", + "description": "An array uniform such as `uniform vec3 lights[100];`.", "returnDescription": "", "scratchblock": "", "since": "" @@ -3492,33 +3614,24 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/addCostumes", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shader/setName", + "owner": "org.openpatch.scratch.Shader", "signatures": [ { - "name": "addCostumes", + "name": "setName", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String", - "int", - "int" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "prefix", - "spriteSheet", - "tileWidth", - "tileHeight" + "name" ], "parameterDescriptions": [ - "a prefix for all generated costumes", - "a path to a sprite sheet, or the name of a built-in sprite", - "the width of a single tile", - "the height of a single tile" + "a new name" ], - "description": "Adds all tiles from a spritesheet as costumes. The costumes will be name by\nthe prefix and the\nindex in the spritesheet. For example if the prefix is \"tile\" and the\nspritesheet contains 4\ntiles, the costumes will be named \"tile0\", \"tile1\", \"tile2\", and \"tile3\".", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -3529,47 +3642,56 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/addSound", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/activate", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "addSound", + "name": "activate", "constructor": false, "static": false, "parameters": [ - "java.lang.String", "java.lang.String" ], "returns": "void", "parameterNames": [ - "name", - "soundPath" + "name" ], "parameterDescriptions": [ - "a unique name", - "a sound path, or the name of a built-in sound such as\n \"footstep_carpet_000\"" + "a shader to use in addition to the active ones" ], - "description": "Add a sound to the sprite. If a sound with the received name already exists\ndo nothing.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shaders/add", + "owner": "org.openpatch.scratch.Shaders", + "signatures": [ { - "name": "addSound", + "name": "add", "constructor": false, "static": false, "parameters": [ + "java.lang.String", "java.lang.String" ], - "returns": "void", + "returns": "org.openpatch.scratch.Shader", "parameterNames": [ - "name" + "name", + "fragmentPath" ], "parameterDescriptions": [ - "the name of a built-in sound, for example \"footstep_carpet_000\"" + "the shader's name", + "the file with the shader's body" ], - "description": "Add one of the sounds that ship with Scratch for Java to the sprite. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.\n\nExample usage:\n\n```java\nthis.addSound(\"footstep_carpet_000\");\n```", - "returnDescription": "", + "description": "Adds a shader, or returns the one of that name added before.", + "returnDescription": "the shader, to set its uniforms", "scratchblock": "", "since": "" } @@ -3579,11 +3701,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/ask", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/constructor", + "owner": "org.openpatch.scratch.Shaders", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shaders/deactivate", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "ask", + "name": "deactivate", "constructor": false, "static": false, "parameters": [ @@ -3591,14 +3721,14 @@ ], "returns": "void", "parameterNames": [ - "question" + "name" ], "parameterDescriptions": [ - "the question to show" + "a shader to stop using" ], - "description": "Asks a question and waits for an answer to be typed in. The question appears\nat the top of the stage.\n\nUnlike Scratch, this does not pause the sprite. `run()` keeps being called\nwhile the question is on screen, so check [isAsking()](isAsking) or wait for\n[getAnswer()](getAnswer) to change.", + "description": "", "returnDescription": "", - "scratchblock": "ask [question] and wait", + "scratchblock": "", "since": "" } ], @@ -3607,26 +3737,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/broadcast", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/get", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "broadcast", + "name": "get", "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "void", + "returns": "org.openpatch.scratch.Shader", "parameterNames": [ - "message" + "name" ], "parameterDescriptions": [ - "The message to broadcast." + "a shader's name" ], - "description": "Broadcasts a message to every sprite on the stage, this one included, and\nto the stage itself, as in Scratch. If the sprite is not on a stage, nothing\nhappens.", - "returnDescription": "", - "scratchblock": "broadcast [message v]", + "description": "", + "returnDescription": "the shader, or null", + "scratchblock": "", "since": "" } ], @@ -3635,47 +3765,41 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changePosition", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/getActive", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changePosition", + "name": "getActive", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "a vector representing the change in position" - ], - "description": "Changes the position of the sprite by a given vector.", - "returnDescription": "", + "parameters": [], + "returns": "java.util.List", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the shaders in use, in order", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shaders/getCurrent", + "owner": "org.openpatch.scratch.Shaders", + "signatures": [ { - "name": "changePosition", + "name": "getCurrent", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void", - "parameterNames": [ - "x", - "y" - ], - "parameterDescriptions": [ - "how far to move along the x-axis", - "how far to move along the y-axis" - ], - "description": "Changes the position of the sprite by the given amounts.", - "returnDescription": "", + "parameters": [], + "returns": "org.openpatch.scratch.Shader", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the first shader in use, or null", "scratchblock": "", "since": "" } @@ -3685,26 +3809,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeSize", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/getCurrentIndex", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changeSize", + "name": "getCurrentIndex", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "amount" - ], - "parameterDescriptions": [ - "a percentage [0...100]" - ], - "description": "Changes the size of the sprite by a given percentage.", - "returnDescription": "", - "scratchblock": "change size by (amount)", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the number of the first shader in use, or -1", + "scratchblock": "", "since": "" } ], @@ -3713,26 +3831,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeTint", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/getCurrentName", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changeTint", + "name": "getCurrentName", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "step" - ], - "parameterDescriptions": [ - "a step value" - ], - "description": "Changes the tint for the sprite by a step.", - "returnDescription": "", - "scratchblock": "change [color v] effect by (step)", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the name of the first shader in use, or null", + "scratchblock": "", "since": "" } ], @@ -3741,26 +3853,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeTransparency", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/isActive", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changeTransparency", + "name": "isActive", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], - "returns": "void", + "returns": "boolean", "parameterNames": [ - "step" + "name" ], "parameterDescriptions": [ - "a step value" + "a shader's name" ], - "description": "Changes how see-through the sprite is by a step. A positive step fades it\nout, a negative one brings it back.", - "returnDescription": "", - "scratchblock": "change [ghost v] effect by (step)", + "description": "", + "returnDescription": "whether it is in use", + "scratchblock": "", "since": "" } ], @@ -3769,26 +3881,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeVolume", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/next", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changeVolume", + "name": "next", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "step" - ], - "parameterDescriptions": [ - "how much to add to the volume, in percent" - ], - "description": "Makes every sound of this sprite louder or quieter.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Uses the next shader alone.", "returnDescription": "", - "scratchblock": "change volume by (step)", + "scratchblock": "", "since": "" } ], @@ -3797,11 +3903,52 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeX", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shaders/reset", + "owner": "org.openpatch.scratch.Shaders", "signatures": [ { - "name": "changeX", + "name": "reset", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Uses no shader.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shaders/switchTo", + "owner": "org.openpatch.scratch.Shaders", + "signatures": [ + { + "name": "switchTo", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the shader to use, alone" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "switchTo", "constructor": false, "static": false, "parameters": [ @@ -3809,14 +3956,14 @@ ], "returns": "void", "parameterNames": [ - "x" + "index" ], "parameterDescriptions": [ - "number in pixels" + "the shader to use alone, counting from 0; wraps around" ], - "description": "Changes x by a certain amount", + "description": "", "returnDescription": "", - "scratchblock": "change x by (x)", + "scratchblock": "", "since": "" } ], @@ -3825,26 +3972,37 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/changeY", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shape/constructor", + "owner": "org.openpatch.scratch.Shape", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shape/contains", + "owner": "org.openpatch.scratch.Shape", "signatures": [ { - "name": "changeY", + "name": "contains", "constructor": false, "static": false, "parameters": [ + "double", "double" ], - "returns": "void", + "returns": "boolean", "parameterNames": [ + "x", "y" ], "parameterDescriptions": [ - "number in pixels" + "x of a point", + "y of a point" ], - "description": "Changes y by a certain amount", - "returnDescription": "", - "scratchblock": "change y by (y)", + "description": "", + "returnDescription": "whether the point lies inside the shape", + "scratchblock": "", "since": "" } ], @@ -3853,20 +4011,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/clone", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shape/getBounds", + "owner": "org.openpatch.scratch.Shape", "signatures": [ { - "name": "clone", + "name": "getBounds", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Sprite", + "returns": "org.openpatch.scratch.Bounds", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates a clone of this sprite, like Scratch's \"create clone of myself\": a\nnew sprite of the same class (a clone of a `Cat` is a `Cat`),\nwith the same costume, position, direction, size and pen, and a copy of\nthe variables of your class. It is put on the stage right behind this\nsprite, and its [whenStartsAsClone()](whenStartsAsClone) runs; the constructor does\nnot run again.\n\nNumbers, text and booleans in your variables are the clone's own. A list\nor another object is shared with the original: give the clone its own in\n[whenStartsAsClone()](whenStartsAsClone) if it needs one.\n\n```java\nBullet bullet = (Bullet) this.clone();\n```", - "returnDescription": "the clone, of the same class as this sprite", - "scratchblock": "create clone of [myself v]", + "description": "", + "returnDescription": "the smallest rectangle around the shape", + "scratchblock": "", "since": "" } ], @@ -3875,60 +4033,81 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/constructor", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shape/getPoints", + "owner": "org.openpatch.scratch.Shape", "signatures": [ { - "name": "Sprite", - "constructor": true, + "name": "getPoints", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Sprite", + "returns": "double[]", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructs a new Sprite object with default settings.", - "returnDescription": "", + "description": "", + "returnDescription": "the outline's points `x0, y0, x1, y1, \\u2026` (a copy)", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shape/intersects", + "owner": "org.openpatch.scratch.Shape", + "signatures": [ { - "name": "Sprite", - "constructor": true, + "name": "intersects", + "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.Shape" ], - "returns": "org.openpatch.scratch.Sprite", + "returns": "boolean", "parameterNames": [ - "name", - "imagePath" + "other" ], "parameterDescriptions": [ - "a unique name for the costume", - "a path to an image file, or the name of a built-in sprite\n such as \"slimeGreen\"" + "another shape" ], - "description": "Constructs a new Sprite object with a specified costume.", - "returnDescription": "", + "description": "", + "returnDescription": "whether the two shapes overlap with some area; shapes that only touch do not", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Shape/rotate", + "owner": "org.openpatch.scratch.Shape", + "signatures": [ { - "name": "Sprite", - "constructor": true, + "name": "rotate", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double", + "double", + "double" ], - "returns": "org.openpatch.scratch.Sprite", + "returns": "org.openpatch.scratch.Shape", "parameterNames": [ - "s" + "degrees", + "anchorX", + "anchorY" ], "parameterDescriptions": [ - "a Sprite object to copy" + "the angle", + "x of the point to turn about", + "y of the point to turn about" ], - "description": "Copies a Sprite object.", - "returnDescription": "", + "description": "Turns the shape about a point, from the x axis towards the y axis (anticlockwise when y points\nup).", + "returnDescription": "the shape turned", "scratchblock": "", "since": "" } @@ -3938,25 +4117,28 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/debug", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shape/scale", + "owner": "org.openpatch.scratch.Shape", "signatures": [ { - "name": "debug", + "name": "scale", "constructor": false, "static": false, "parameters": [ - "java.lang.Object[]" + "double", + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Shape", "parameterNames": [ - "values" + "scaleX", + "scaleY" ], "parameterDescriptions": [ - "one or more values to print" + "factor along x (negative mirrors)", + "factor along y" ], - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the sprite's class name so you can tell\nwhich sprite it came from.\n\nExample:\n\n```java\nthis.debug(\"x =\", getX(), \"y =\", getY());\n// prints: [CatSprite] x = 100.0 y = 200.0\n```", - "returnDescription": "", + "description": "", + "returnDescription": "the shape scaled about the origin", "scratchblock": "", "since": "" } @@ -3966,20 +4148,29 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/deleteThisClone", - "owner": "org.openpatch.scratch.Sprite", + "id": "Shape/translate", + "owner": "org.openpatch.scratch.Shape", "signatures": [ { - "name": "deleteThisClone", + "name": "translate", "constructor": false, "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Removes this sprite from the stage if it is a clone, like Scratch's\n\"delete this clone\". The original stays.", - "returnDescription": "", - "scratchblock": "delete this clone", + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Shape", + "parameterNames": [ + "dx", + "dy" + ], + "parameterDescriptions": [ + "distance along x", + "distance along y" + ], + "description": "", + "returnDescription": "the shape moved", + "scratchblock": "", "since": "" } ], @@ -3988,42 +4179,28 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/disableHitbox", - "owner": "org.openpatch.scratch.Sprite", - "signatures": [ - { - "name": "disableHitbox", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Disables the hitbox for the sprite. Once the hitbox is disabled, the sprite\nwill no longer\ndetect collisions with other objects.", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ], + "id": "SoundPlayback/constructor", + "owner": "org.openpatch.scratch.SoundPlayback", + "signatures": [], "status": "implemented", "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "Sprite/distanceToMousePointer", - "owner": "org.openpatch.scratch.Sprite", + "id": "SoundPlayback/isPlaying", + "owner": "org.openpatch.scratch.SoundPlayback", "signatures": [ { - "name": "distanceToMousePointer", + "name": "isPlaying", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Calculates the distance from the current sprite to the mouse pointer.", - "returnDescription": "the distance to the mouse pointer as a double.", - "scratchblock": "(distance to [mouse-pointer v])", + "description": "", + "returnDescription": "whether this copy still plays", + "scratchblock": "", "since": "" } ], @@ -4032,26 +4209,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/distanceToSprite", - "owner": "org.openpatch.scratch.Sprite", + "id": "SoundPlayback/setVolume", + "owner": "org.openpatch.scratch.SoundPlayback", "signatures": [ { - "name": "distanceToSprite", + "name": "setVolume", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "sprite" + "volume" ], "parameterDescriptions": [ - "the other sprite to which the distance is calculated" + "from 0 to 100" ], - "description": "Calculates the Euclidean distance between this sprite and another sprite.", - "returnDescription": "the distance between this sprite and the specified sprite", - "scratchblock": "(distance to [sprite v])", + "description": "", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -4060,18 +4237,18 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/enableHitbox", - "owner": "org.openpatch.scratch.Sprite", + "id": "SoundPlayback/stop", + "owner": "org.openpatch.scratch.SoundPlayback", "signatures": [ { - "name": "enableHitbox", + "name": "stop", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Enables the hitbox for the sprite. This method sets the hitboxDisabled flag\nto false, allowing\nthe sprite to interact with other objects.", + "description": "Stops this copy.", "returnDescription": "", "scratchblock": "", "since": "" @@ -4082,42 +4259,1872 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getAnswer", + "id": "Sprite/addAnimation", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getAnswer", + "name": "addAnimation", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the last answer that was typed in.", - "returnDescription": "the answer, or an empty string if nothing has been answered yet", - "scratchblock": "(answer)", + "parameters": [ + "java.lang.String", + "java.lang.String", + "int" + ], + "returns": "void", + "parameterNames": [ + "name", + "pattern", + "frames" + ], + "parameterDescriptions": [ + "the animation's name", + "the file names, with `%d` for the frame number", + "how many frames" + ], + "description": "Adds an animation from numbered image files: the pattern's `%d` counts from 1.\n\n```java\nthis.addAnimation(\"walk\", \"assets/walk%d.png\", 4); // walk1.png \\u2026 walk4.png\n```", + "returnDescription": "", + "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + }, + { + "name": "addAnimation", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String", + "int", + "int" + ], + "returns": "void", + "parameterNames": [ + "name", + "pattern", + "from", + "to" + ], + "parameterDescriptions": [ + "the animation's name", + "the file names, with `%d` for the frame number", + "the number of the first frame", + "the number of the last frame" + ], + "description": "Adds an animation from numbered image files, from one number to another: for files that count\nfrom 0, or to use only some of them. If `to` is smaller than `from`, it counts down.\n\n```java\nthis.addAnimation(\"hit\", \"assets/hit%d.png\", 0, 4); // hit0.png \\u2026 hit4.png\n```", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "addAnimation", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String", + "int", + "int", + "int[]" + ], + "returns": "void", + "parameterNames": [ + "name", + "sheetPath", + "width", + "height", + "frames" + ], + "parameterDescriptions": [ + "the animation's name", + "the sprite sheet", + "the width of a frame", + "the height of a frame", + "the frames to show, in order" + ], + "description": "Adds an animation from a sprite sheet: frames of equal size, numbered row by row from the\ntop left, starting at 0.\n\n```java\nthis.addAnimation(\"walk\", \"assets/walk.png\", 32, 32, 0, 1, 2, 3); // the first row\nthis.addAnimation(\"down\", \"assets/hero.png\", 32, 32, 0, 4, 8, 12); // the first column of 4\n```", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/addCostume", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "addCostume", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name", + "imagePath" + ], + "parameterDescriptions": [ + "the costume's name, for [switchCostume(String)](switchCostume)", + "the image file (PNG, JPEG, GIF, BMP or TGA)" + ], + "description": "Adds a costume from an image file. The first costume added is the one the sprite wears.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "addCostume", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "imagePath" + ], + "parameterDescriptions": [ + "the image file" + ], + "description": "Adds a costume from an image file, named after the file.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "addCostume", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String", + "int", + "int", + "int", + "int" + ], + "returns": "void", + "parameterNames": [ + "name", + "imagePath", + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "the costume's name", + "the image file", + "left edge of the part, in pixels", + "top edge of the part, in pixels", + "width of the part", + "height of the part" + ], + "description": "Adds a costume cut out of a larger image, e.g. one frame of a sprite sheet.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/addCostumes", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "addCostumes", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String", + "int", + "int" + ], + "returns": "void", + "parameterNames": [ + "name", + "imagePath", + "width", + "height" + ], + "parameterDescriptions": [ + "the start of the costumes' names", + "the image file", + "width of one frame", + "height of one frame" + ], + "description": "Adds every frame of a sprite sheet as a costume, row by row, named `name0`,\n`name1`, \\u2026", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/addSound", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "addSound", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name", + "soundPath" + ], + "parameterDescriptions": [ + "the sound's name, for [playSound(String)](playSound)", + "the sound file" + ], + "description": "Adds a sound (WAV or OGG).", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "addSound", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "soundPath" + ], + "parameterDescriptions": [ + "the sound file" + ], + "description": "Adds a sound, named after its file.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/ask", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "ask", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "question" + ], + "parameterDescriptions": [ + "the question" + ], + "description": "Asks a question: the sprite says it in a bubble, and a box to type the answer in appears at\nthe bottom of the stage. Enter finishes it; see [Stage.ask(String)](../Stage/ask).", + "returnDescription": "", + "scratchblock": "ask [question] and wait", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/broadcast", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "broadcast", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "message" + ], + "parameterDescriptions": [ + "the message" + ], + "description": "Sends a message to the stage and every sprite on it; their [whenIReceive(String)](whenIReceive)\nruns at once, before this method returns.", + "returnDescription": "", + "scratchblock": "broadcast [message v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeColorEffect", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeColorEffect", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how much to change the colour effect" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change [color v] effect by (by)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeHeight", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeHeight", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how much higher to draw the sprite" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changePosition", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changePosition", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "dx", + "dy" + ], + "parameterDescriptions": [ + "how far to move along x", + "how far to move along y" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "changePosition", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how far to move" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeSize", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeSize", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "percent" + ], + "parameterDescriptions": [ + "how much to change the size, in percentage points" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change size by (amount)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeTransparency", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeTransparency", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how much to change the transparency" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change [ghost v] effect by (step)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeVolume", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeVolume", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how much to change the volume" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change volume by (step)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeWidth", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeWidth", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "by" + ], + "parameterDescriptions": [ + "how much wider to draw the sprite" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeX", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeX", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "dx" + ], + "parameterDescriptions": [ + "how far to move along x" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change x by (x)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/changeY", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "changeY", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "dy" + ], + "parameterDescriptions": [ + "how far to move along y" + ], + "description": "", + "returnDescription": "", + "scratchblock": "change y by (y)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/constructor", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "Sprite", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Sprite", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A sprite without costumes. Add some with [addCostume(String, String)](addCostume).", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "Sprite", + "constructor": true, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String" + ], + "returns": "org.openpatch.scratch.Sprite", + "parameterNames": [ + "name", + "imagePath" + ], + "parameterDescriptions": [ + "the costume's name", + "the image file" + ], + "description": "A sprite with one costume.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/createClone", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "createClone", + "constructor": false, + "static": false, + "parameters": [], + "returns": "T", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Makes a clone: a copy of this sprite with the same costumes, position, direction, effects and\nvariables, added to the stage just behind this sprite, as in Scratch. Its\n[whenStartsAsClone()](whenStartsAsClone) runs;\nits constructor does not. Numbers, texts and booleans in its variables are its own; lists and\nother objects are shared with this sprite until the clone gets its own in\n[whenStartsAsClone()](whenStartsAsClone).\n\n```java\nBullet bullet = this.createClone();\n```", + "returnDescription": "the clone", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/debug", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "debug", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Object[]" + ], + "returns": "void", + "parameterNames": [ + "values" + ], + "parameterDescriptions": [ + "what to print" + ], + "description": "Prints values for debugging, but only while debug mode is on (`window.setDebug(true)`\nor F12).", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/deleteThisClone", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "deleteThisClone", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Removes this sprite if it is a clone, stopping its sounds; does nothing for the original.", + "returnDescription": "", + "scratchblock": "delete this clone", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/disableHitbox", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "disableHitbox", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Touching ignores this sprite until [enableHitbox()](enableHitbox).", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/disableNineSlice", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "disableNineSlice", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Stretches the whole costume again.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/distanceToMousePointer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "distanceToMousePointer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the distance to the mouse pointer", + "scratchblock": "(distance to [mouse-pointer v])", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/distanceToSprite", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "distanceToSprite", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Sprite" + ], + "returns": "double", + "parameterNames": [ + "sprite" + ], + "parameterDescriptions": [ + "another sprite" + ], + "description": "", + "returnDescription": "the distance between the two positions", + "scratchblock": "(distance to [sprite v])", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/enableHitbox", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "enableHitbox", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Touching counts this sprite again.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/extension", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "extension", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class", + "java.util.function.Supplier" + ], + "returns": "T", + "parameterNames": [ + "type", + "factory" + ], + "parameterDescriptions": [ + "the state's class", + "makes it" + ], + "description": "An extension's state for this sprite, made on first use; a clone gets its own. For\nextensions, not for learner code.", + "returnDescription": "the sprite's one instance", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others.", + "missingBrowserSignatures": [ + { + "name": "extension", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class", + "java.util.function.Supplier" + ], + "returns": "T", + "parameterNames": [ + "type", + "factory" + ], + "parameterDescriptions": [ + "the state's class", + "makes it" + ], + "description": "An extension's state for this sprite, made on first use; a clone gets its own. For\nextensions, not for learner code.", + "returnDescription": "the sprite's one instance", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "Sprite/getAnimationFrame", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getAnimationFrame", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the frame of the current animation, counting from 0", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getAnimationInterval", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getAnimationInterval", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "how long each frame shows, in seconds", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getAnswer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getAnswer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the answer to the last question", + "scratchblock": "(answer)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getColorEffect", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getColorEffect", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the colour effect", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getCurrentCostumeIndex", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getCurrentCostumeIndex", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the current costume's number, counting from 0", + "scratchblock": "(costume [number v])", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getCurrentCostumeName", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getCurrentCostumeName", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the current costume's name, or null without costumes", + "scratchblock": "(costume [name v])", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getDirection", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getDirection", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the direction, from 0 (inclusive) to 360 (exclusive); 90 is right", + "scratchblock": "(direction)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getHeight", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getHeight", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the height the sprite is drawn at, in stage pixels", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getHitbox", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getHitbox", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Shape", + "parameterNames": [], + "parameterDescriptions": [], + "description": "The hitbox where the sprite is now, in stage coordinates: by default the rectangle around the\ncostume's painted pixels; null for a sprite without costumes.", + "returnDescription": "the hitbox, or null", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getLayer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getLayer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Layer", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the sprite's layer", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getMouse", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getMouse", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the mouse pointer's position, in world coordinates (or stage coordinates for UI)", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getMouseX", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getMouseX", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "x of the mouse pointer, in the sprite's coordinates (world, or the stage for UI)", + "scratchblock": "(mouse x)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getMouseY", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getMouseY", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "y of the mouse pointer", + "scratchblock": "(mouse y)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getPen", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getPen", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Pen", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the sprite's pen, which follows it", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getPosition", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getPosition", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the sprite's position", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getRotationStyle", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getRotationStyle", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.RotationStyle", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "how the costume follows the direction", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getShaders", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getShaders", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Shaders", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the sprite's shaders", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getSize", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getSize", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the size in percent of the costume's own size", + "scratchblock": "(size)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getStage", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getStage", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Stage", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage the sprite is on, or null", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getText", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getText", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Text", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the sprite's text, which say and think show in a bubble", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getTimer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getTimer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Timer", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "this object's timer, counting game time since it was made or reset", + "scratchblock": "(timer)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getTint", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getTint", + "constructor": false, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Color", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the tint, or null for none", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getTouchingSprite", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getTouchingSprite", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class" + ], + "returns": "T", + "parameterNames": [ + "type" + ], + "parameterDescriptions": [ + "a class of sprites" + ], + "description": "", + "returnDescription": "a sprite of that class the sprite touches, or null", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getTouchingSprites", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getTouchingSprites", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class" + ], + "returns": "java.util.List", + "parameterNames": [ + "type" + ], + "parameterDescriptions": [ + "a class of sprites" + ], + "description": "", + "returnDescription": "every sprite of that class the sprite touches", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getTransparency", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getTransparency", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the transparency in percent", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getVolume", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getVolume", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "this object's volume from 0 to 100", + "scratchblock": "(volume)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getWidth", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getWidth", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the width the sprite is drawn at, in stage pixels", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getX", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getX", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "x of the sprite's position", + "scratchblock": "(x position)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/getY", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "getY", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "y of the sprite's position", + "scratchblock": "(y position)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/glide", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "glide", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "seconds", + "x", + "y" + ], + "parameterDescriptions": [ + "how long the glide takes", + "x of the target", + "y of the target" + ], + "description": "Glides to a position in a number of seconds of game time; the sprite keeps running its code\nmeanwhile. A new glide replaces one that is still going.", + "returnDescription": "", + "scratchblock": "glide (seconds) secs to x: (x) y: (y)", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goLayersBackwards", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goLayersBackwards", + "constructor": false, + "static": false, + "parameters": [ + "int" + ], + "returns": "void", + "parameterNames": [ + "number" + ], + "parameterDescriptions": [ + "how many sprites of its layer to move behind" + ], + "description": "", + "returnDescription": "", + "scratchblock": "go [backward v] (number) layers", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goLayersForwards", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goLayersForwards", + "constructor": false, + "static": false, + "parameters": [ + "int" + ], + "returns": "void", + "parameterNames": [ + "number" + ], + "parameterDescriptions": [ + "how many sprites of its layer to move in front of" + ], + "description": "", + "returnDescription": "", + "scratchblock": "go [forward v] (number) layers", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goToBackLayer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goToBackLayer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Moves the sprite behind every other sprite of its layer.", + "returnDescription": "", + "scratchblock": "go to [back v] layer", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goToFrontLayer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goToFrontLayer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Moves the sprite in front of every other sprite of its layer.", + "returnDescription": "", + "scratchblock": "go to [front v] layer", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goToMousePointer", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goToMousePointer", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Goes to the mouse pointer.", + "returnDescription": "", + "scratchblock": "go to [mouse-pointer v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goToRandomPosition", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goToRandomPosition", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Goes to a random position on the stage.", + "returnDescription": "", + "scratchblock": "go to [random position v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/goToSprite", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "goToSprite", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Sprite" + ], + "returns": "void", + "parameterNames": [ + "sprite" + ], + "parameterDescriptions": [ + "the sprite whose position to go to" + ], + "description": "", + "returnDescription": "", + "scratchblock": "go to [sprite v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/hide", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "hide", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Hides the sprite: it is not drawn, cannot be touched and cannot be clicked.", + "returnDescription": "", + "scratchblock": "hide", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/hideVariable", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "hideVariable", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the label of a variable to hide again" + ], + "description": "", + "returnDescription": "", + "scratchblock": "hide variable [name v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/ifOnEdgeBounce", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "ifOnEdgeBounce", + "constructor": false, + "static": false, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Turns around when touching an edge of the stage and moves back inside, as in Scratch.", + "returnDescription": "", + "scratchblock": "if on edge, bounce", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isAnimationPlayed", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isAnimationPlayed", + "constructor": false, + "static": false, + "parameters": [], + "returns": "boolean", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether an animation played with `once` reached its last frame", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isAsking", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isAsking", + "constructor": false, + "static": false, + "parameters": [], + "returns": "boolean", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether a question is waiting for its answer", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "Sprite/getCurrentCostumeIndex", + "id": "Sprite/isClone", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getCurrentCostumeIndex", + "name": "isClone", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the current costume index", - "returnDescription": "a costume index", - "scratchblock": "(costume [number v])", + "description": "", + "returnDescription": "whether this sprite is a clone", + "scratchblock": "", "since": "" } ], @@ -4126,20 +6133,79 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getCurrentCostumeName", + "id": "Sprite/isColorTouchingColor", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getCurrentCostumeName", + "name": "isColorTouchingColor", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Color", + "org.openpatch.scratch.Color" + ], + "returns": "boolean", + "parameterNames": [ + "mine", + "color" + ], + "parameterDescriptions": [ + "a colour of the sprite", + "the colour to look for underneath" + ], + "description": "Whether a colour of the sprite touches a colour on the stage, like Scratch's \"color is\ntouching color\".", + "returnDescription": "whether they touch", + "scratchblock": "<color [#ff0000] is touching [#00ff00]?>", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isGliding", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isGliding", "constructor": false, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the current costume name", - "returnDescription": "a costume name", - "scratchblock": "(costume [name v])", + "description": "", + "returnDescription": "whether a glide is still going", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isKeyPressed", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isKeyPressed", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "boolean", + "parameterNames": [ + "key" + ], + "parameterDescriptions": [ + "a key" + ], + "description": "", + "returnDescription": "whether the key is held down", + "scratchblock": "<key [space v] pressed?>", "since": "" } ], @@ -4148,19 +6214,47 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getDeltaTime", + "id": "Sprite/isMouseDown", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getDeltaTime", + "name": "isMouseDown", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Gets the seconds passed since the last frame.", - "returnDescription": "seconds since last frame", + "description": "", + "returnDescription": "whether a mouse button is held down", + "scratchblock": "<mouse down?>", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isSoundPlaying", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isSoundPlaying", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String" + ], + "returns": "boolean", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "a sound's name" + ], + "description": "", + "returnDescription": "whether it is playing", "scratchblock": "", "since": "" } @@ -4170,20 +6264,73 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getDirection", + "id": "Sprite/isTouchingColor", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getDirection", + "name": "isTouchingColor", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Color" + ], + "returns": "boolean", + "parameterNames": [ + "color" + ], + "parameterDescriptions": [ + "the colour to look for" + ], + "description": "Whether the sprite touches a colour: a painted pixel of the sprite lies over that colour, as\nthe stage shows it now (backdrop, stage colour, pen strokes, stamps and other sprites with\ntheir effects; not texts, shaders or the UI layer). Colours match as in Scratch, with a small\ntolerance.", + "returnDescription": "whether the sprite touches it", + "scratchblock": "<touching color [#ff0000]?>", + "since": "" + }, + { + "name": "isTouchingColor", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "boolean", + "parameterNames": [ + "red", + "green", + "blue" + ], + "parameterDescriptions": [ + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" + ], + "description": "", + "returnDescription": "whether the sprite touches that colour", + "scratchblock": "<touching color [#ff0000]?>", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isTouchingEdge", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isTouchingEdge", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the direction of the sprite.", - "returnDescription": "the direction [0...360]", - "scratchblock": "(direction)", + "description": "", + "returnDescription": "whether the sprite's hitbox reaches an edge of the stage", + "scratchblock": "<touching [edge v]?>", "since": "" } ], @@ -4192,20 +6339,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getHeight", + "id": "Sprite/isTouchingMousePointer", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getHeight", + "name": "isTouchingMousePointer", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "returnDescription": "the height of the sprite", - "scratchblock": "", + "description": "", + "returnDescription": "whether the mouse pointer is over the sprite's hitbox", + "scratchblock": "<touching [mouse-pointer v]?>", "since": "" } ], @@ -4214,19 +6361,66 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getHitbox", + "id": "Sprite/isTouchingSprite", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getHitbox", + "name": "isTouchingSprite", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Sprite" + ], + "returns": "boolean", + "parameterNames": [ + "sprite" + ], + "parameterDescriptions": [ + "another sprite" + ], + "description": "", + "returnDescription": "whether the two hitboxes overlap (touching edges do not count); a hidden sprite\n touches nothing, and the UI layer never touches the world", + "scratchblock": "<touching [sprite v]?>", + "since": "" + }, + { + "name": "isTouchingSprite", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class" + ], + "returns": "boolean", + "parameterNames": [ + "type" + ], + "parameterDescriptions": [ + "a class of sprites" + ], + "description": "", + "returnDescription": "whether the sprite touches any sprite of that class (or a subclass)", + "scratchblock": "<touching [sprite v]?>", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/isVisible", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "isVisible", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Hitbox", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the hitbox of the sprite based on its current costume, position, and\nrotation. If the\nsprite has a hitbox already defined, it updates and returns it. Otherwise, it\ncalculates a new\nhitbox based on the sprite's dimensions and rotation.", - "returnDescription": "the hitbox of the sprite", + "description": "", + "returnDescription": "whether the sprite is shown", "scratchblock": "", "since": "" } @@ -4236,20 +6430,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getMouse", + "id": "Sprite/move", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getMouse", + "name": "move", + "constructor": false, + "static": false, + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "steps" + ], + "parameterDescriptions": [ + "how far, in stage pixels (negative moves backwards)" + ], + "description": "Moves forward in the sprite's direction.", + "returnDescription": "", + "scratchblock": "move (steps) steps", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/nextCostume", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ + { + "name": "nextCostume", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the current position of the mouse cursor.", - "returnDescription": "a Vector2 object representing the current mouse cursor position, with\n the x-coordinate\n obtained from getMouseX() and the y-coordinate obtained from\n getMouseY().", - "scratchblock": "", + "description": "Switches to the next costume, after the last one to the first.", + "returnDescription": "", + "scratchblock": "next costume", "since": "" } ], @@ -4258,20 +6480,29 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getMouseX", + "id": "Sprite/pickRandom", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getMouseX", + "name": "pickRandom", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current x-position of the mouse cursor", - "returnDescription": "x-position", - "scratchblock": "(mouse x)", + "parameters": [ + "int", + "int" + ], + "returns": "int", + "parameterNames": [ + "from", + "to" + ], + "parameterDescriptions": [ + "the lowest", + "the highest" + ], + "description": "A random whole number between two numbers, both included.", + "returnDescription": "the number", + "scratchblock": "(pick random (from) to (to))", "since": "" } ], @@ -4280,20 +6511,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getMouseY", + "id": "Sprite/playAnimation", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getMouseY", + "name": "playAnimation", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current y-position of the mouse cursor", - "returnDescription": "y-position", - "scratchblock": "(mouse y)", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the animation's name" + ], + "description": "Plays an animation, over and over. Call it every tick (in `run()`): it shows the next\nframe each time the animation interval has passed, and starts from the first frame when\nanother animation was playing before.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "playAnimation", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "boolean" + ], + "returns": "void", + "parameterNames": [ + "name", + "once" + ], + "parameterDescriptions": [ + "the animation's name", + "whether to stop at the last frame instead of starting over" + ], + "description": "Plays an animation; call it every tick.", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -4302,20 +6561,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getPen", + "id": "Sprite/playSound", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getPen", + "name": "playSound", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Pen", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the pen of the sprite.", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the sound's name" + ], + "description": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "start sound [name v]", "since": "" } ], @@ -4324,19 +6589,28 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getPosition", + "id": "Sprite/playSoundCopy", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getPosition", + "name": "playSoundCopy", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Retrieves the current position of the sprite.", - "returnDescription": "A [Vector2](../Vector2/index) object representing the x and y coordinates of the\n sprite.", + "parameters": [ + "java.lang.String", + "double" + ], + "returns": "org.openpatch.scratch.SoundPlayback", + "parameterNames": [ + "name", + "volume" + ], + "parameterDescriptions": [ + "the sound's name", + "the copy's volume from 0 to 100" + ], + "description": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "returnDescription": "the copy, to stop it or change its volume", "scratchblock": "", "since": "" } @@ -4346,19 +6620,44 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getShaders", + "id": "Sprite/pointTowards", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getShaders", + "name": "pointTowards", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the shaders of this sprite. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.\n\nExample usage:\n\n```java\nthis.getShaders().add(\"blur\", \"blur.frag\", null);\nthis.getShaders().switchTo(\"blur\");\n```\n\nA sprite draws with one shader: with several active, the first of them.", - "returnDescription": "the shaders", + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void", + "parameterNames": [ + "position" + ], + "parameterDescriptions": [ + "where to point" + ], + "description": "Points towards a position.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "pointTowards", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Sprite" + ], + "returns": "void", + "parameterNames": [ + "sprite" + ], + "parameterDescriptions": [ + "the sprite to point at" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4368,20 +6667,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getSize", + "id": "Sprite/pointTowardsMousePointer", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getSize", + "name": "pointTowardsMousePointer", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the size of the sprite.", - "returnDescription": "size in percentage", - "scratchblock": "(size)", + "description": "Points towards the mouse pointer.", + "returnDescription": "", + "scratchblock": "point towards [mouse-pointer v]", "since": "" } ], @@ -4390,20 +6689,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getStage", + "id": "Sprite/previousCostume", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getStage", + "name": "previousCostume", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Stage", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the current stage associated with this sprite.", - "returnDescription": "the stage associated with this sprite", - "scratchblock": "", + "description": "Switches to the previous costume, before the first one to the last.", + "returnDescription": "", + "scratchblock": "switch costume to (previous costume)", "since": "" } ], @@ -4412,19 +6711,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getText", + "id": "Sprite/remove", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getText", + "name": "remove", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Text", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the text associated with this sprite.", - "returnDescription": "the text associated with this sprite", + "description": "Removes the sprite from its stage.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4434,38 +6733,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getTimer", + "id": "Sprite/resetAnimation", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getTimer", + "name": "resetAnimation", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Timer", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Return the default timer", - "returnDescription": "the default timer", - "scratchblock": "(timer)", - "since": "" - }, - { - "name": "getTimer", - "constructor": false, - "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "org.openpatch.scratch.Timer", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "" - ], - "description": "Return a timer by name", - "returnDescription": "a timer", + "description": "Starts the current animation from its first frame again.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4475,19 +6755,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getTint", + "id": "Sprite/run", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getTint", + "name": "run", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Color", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the tint value of the current costume.", - "returnDescription": "the tint value of the current costume, or null if there are no\n costumes.", + "description": "Runs every tick, 60 times a second of game time. Override it with the sprite's code.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4497,26 +6777,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getTouchingSprite", + "id": "Sprite/say", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getTouchingSprite", + "name": "say", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "java.lang.String" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "c" + "text" ], "parameterDescriptions": [ - "the class object of the type of sprite to check for" + "what the sprite says" ], - "description": "Returns the first sprite of the specified type that is currently touching\nthis sprite.", - "returnDescription": "the first sprite of the specified type that is touching this sprite,\n or null if no such\n sprite is found", - "scratchblock": "", + "description": "Shows a speech bubble until the sprite says something else; an empty text removes it.", + "returnDescription": "", + "scratchblock": "say [text]", + "since": "" + }, + { + "name": "say", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "double" + ], + "returns": "void", + "parameterNames": [ + "text", + "seconds" + ], + "parameterDescriptions": [ + "what the sprite says", + "how long" + ], + "description": "Shows a speech bubble for a number of seconds of game time.", + "returnDescription": "", + "scratchblock": "say [text] for (seconds) seconds", "since": "" } ], @@ -4525,25 +6827,25 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getTouchingSprites", + "id": "Sprite/setAnimationFrame", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getTouchingSprites", + "name": "setAnimationFrame", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "int" ], - "returns": "java.util.List", + "returns": "void", "parameterNames": [ - "c" + "frame" ], "parameterDescriptions": [ - "the class of the type of sprites to return" + "the frame of the current animation to show next, counting from 0" ], - "description": "Returns a list of sprites of the specified type that are currently touching\nthis sprite.", - "returnDescription": "a list of sprites of the specified type that are touching this\n sprite, or null if the\n stage is not set", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4553,19 +6855,25 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getTransparency", + "id": "Sprite/setAnimationInterval", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getTransparency", + "name": "setAnimationInterval", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Gets the transparency of the current costume.", - "returnDescription": "how see-through the sprite is, 0 solid and 100 invisible", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "how long each frame shows" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -4575,20 +6883,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getVolume", + "id": "Sprite/setColorEffect", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getVolume", + "name": "setColorEffect", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns how loud the sounds of this sprite play.", - "returnDescription": "the volume, from 0 to 100", - "scratchblock": "(volume)", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "value" + ], + "parameterDescriptions": [ + "the effect" + ], + "description": "Scratch's colour effect: shifts every colour of the costume around the colour wheel. 0 is no\nchange; 100 is halfway round; 200 is all the way round again. Like Scratch, it gives colours\ntoo grey or too dark to show a hue a little one, so white and black are tinted too.", + "returnDescription": "", + "scratchblock": "set [color v] effect to (value)", "since": "" } ], @@ -4597,20 +6911,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getWidth", + "id": "Sprite/setDirection", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getWidth", + "name": "setDirection", "constructor": false, "static": false, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "returnDescription": "the width of the sprite", - "scratchblock": "", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "degrees" + ], + "parameterDescriptions": [ + "the direction" + ], + "description": "Points in a direction: 0 up, 90 right, 180 down, 270 left; other numbers go around.", + "returnDescription": "", + "scratchblock": "point in direction (degrees)", "since": "" } ], @@ -4619,20 +6939,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getX", + "id": "Sprite/setHeight", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getX", + "name": "setHeight", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the x coordinate of the sprite", - "returnDescription": "a x coordinate", - "scratchblock": "(x position)", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "height" + ], + "parameterDescriptions": [ + "the height in stage pixels; 0 to follow the costume and size again" + ], + "description": "Draws the sprite this high; see [setWidth(double)](setWidth).", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -4641,20 +6967,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/getY", + "id": "Sprite/setHitbox", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "getY", + "name": "setHitbox", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the y coordinate of the sprite", - "returnDescription": "a y coordinate", - "scratchblock": "(y position)", + "parameters": [ + "org.openpatch.scratch.Shape" + ], + "returns": "void", + "parameterNames": [ + "shape" + ], + "parameterDescriptions": [ + "the hitbox" + ], + "description": "Sets the hitbox: the shape that counts for touching, in costume pixels (origin at the\ncostume's top left corner, y down). It turns, grows and mirrors with the sprite.", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -4663,32 +6995,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/glide", + "id": "Sprite/setLayer", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "glide", + "name": "setLayer", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "org.openpatch.scratch.Layer" ], "returns": "void", "parameterNames": [ - "seconds", - "x", - "y" + "layer" ], "parameterDescriptions": [ - "how long the trip should take", - "where to end up", - "where to end up" + "the layer" ], - "description": "Slides the sprite to a place over the given time, instead of jumping there.\n\nUnlike Scratch this does not hold up the sprite: `run()` keeps being called\nwhile the sprite is on its way. Use [isGliding()](isGliding) to tell whether it\nhas arrived.", + "description": "Moves the sprite to another layer, in front of the sprites already there. A sprite in\n[Layer.UI](../Layer/UI) ignores the camera; its pen moves to the UI layer too.", "returnDescription": "", - "scratchblock": "glide (seconds) secs to x: (x) y: (y)", + "scratchblock": "", "since": "" } ], @@ -4697,26 +7023,35 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goLayersBackwards", + "id": "Sprite/setNineSlice", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goLayersBackwards", + "name": "setNineSlice", "constructor": false, "static": false, "parameters": [ + "int", + "int", + "int", "int" ], "returns": "void", "parameterNames": [ - "number" + "top", + "right", + "bottom", + "left" ], "parameterDescriptions": [ - "the number of layers to move the sprite backwards" + "costume pixels at the top that keep their height", + "costume pixels at the right that keep their width", + "costume pixels at the bottom that keep their height", + "costume pixels at the left that keep their width" ], - "description": "Moves the sprite backwards by a specified number of layers in the stage. If\nthe sprite is not\npart of a stage, the method does nothing.", + "description": "Stretches only the middle of the costume when the sprite is drawn at its own width and\nheight: the four corners keep their size (scaled with the sprite's size), the edges stretch\nalong one side.", "returnDescription": "", - "scratchblock": "go [backward v] (number) layers", + "scratchblock": "", "since": "" } ], @@ -4725,26 +7060,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goLayersForwards", + "id": "Sprite/setPosition", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goLayersForwards", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "int" + "double", + "double" ], "returns": "void", "parameterNames": [ - "number" + "x", + "y" ], "parameterDescriptions": [ - "the number of layers to move the sprite forward" + "x of the new position", + "y of the new position" ], - "description": "Moves the sprite forward by a specified number of layers within its stage.", + "description": "Goes to a position; with the pen down, it draws a line there.", "returnDescription": "", - "scratchblock": "go [forward v] (number) layers", + "scratchblock": "go to x: (x) y: (y)", + "since": "" + }, + { + "name": "setPosition", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "void", + "parameterNames": [ + "position" + ], + "parameterDescriptions": [ + "the new position" + ], + "description": "", + "returnDescription": "", + "scratchblock": "go to x: (x) y: (y)", "since": "" } ], @@ -4753,20 +7110,29 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goToBackLayer", + "id": "Sprite/setRotationCenter", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goToBackLayer", + "name": "setRotationCenter", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Moves the sprite to the back layer of the stage. If the sprite is not\nassociated with any\nstage, the method returns without performing any action.", + "parameterNames": [ + "x", + "y" + ], + "parameterDescriptions": [ + "pixels from the left edge", + "pixels from the top edge" + ], + "description": "Sets the point of the costumes the sprite turns around and stands on, in costume pixels from\nthe top left corner. Without it, that is the centre of each costume.", "returnDescription": "", - "scratchblock": "go to [back v] layer", + "scratchblock": "", "since": "" } ], @@ -4775,20 +7141,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goToFrontLayer", + "id": "Sprite/setRotationStyle", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goToFrontLayer", + "name": "setRotationStyle", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.RotationStyle" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Moves this sprite to the front layer of the stage. If the sprite is not part\nof any stage, the\nmethod does nothing.", + "parameterNames": [ + "style" + ], + "parameterDescriptions": [ + "how the costume follows the direction" + ], + "description": "", "returnDescription": "", - "scratchblock": "go to [front v] layer", + "scratchblock": "set rotation style [left-right v]", "since": "" } ], @@ -4797,20 +7169,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goToMousePointer", + "id": "Sprite/setSize", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goToMousePointer", + "name": "setSize", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Moves the sprite to the current position of the mouse pointer. This method\nupdates the sprite's\nposition to the coordinates of the mouse cursor.", + "parameterNames": [ + "percent" + ], + "parameterDescriptions": [ + "the size in percent of the costume's own size" + ], + "description": "", "returnDescription": "", - "scratchblock": "go to [mouse-pointer v]", + "scratchblock": "set size to (percentage) %", "since": "" } ], @@ -4819,20 +7197,51 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goToRandomPosition", + "id": "Sprite/setTint", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goToRandomPosition", + "name": "setTint", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Color" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Moves the sprite to a random position within the boundaries of the stage. The\nnew position is\ndetermined by generating random coordinates within the width and height of\nthe stage.", + "parameterNames": [ + "color" + ], + "parameterDescriptions": [ + "the tint, or null for none" + ], + "description": "Multiplies the costume by a colour: white leaves it as it is, red keeps only its red. Not a\nScratch block: Scratch's colour effect is [setColorEffect(double)](setColorEffect).", "returnDescription": "", - "scratchblock": "go to [random position v]", + "scratchblock": "", + "since": "" + }, + { + "name": "setTint", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "red", + "green", + "blue" + ], + "parameterDescriptions": [ + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" + ], + "description": "", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -4841,26 +7250,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/goToSprite", + "id": "Sprite/setTransparency", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "goToSprite", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "double" ], "returns": "void", "parameterNames": [ - "sprite" + "percent" ], "parameterDescriptions": [ - "the sprite to move to" + "0 opaque, 100 invisible" ], - "description": "Moves this sprite to the position of the specified sprite.", + "description": "Scratch's ghost effect.", "returnDescription": "", - "scratchblock": "go to [sprite v]", + "scratchblock": "set [ghost v] effect to (transparency)", "since": "" } ], @@ -4869,20 +7278,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/hide", + "id": "Sprite/setVolume", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "hide", + "name": "setVolume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Hides the sprite. The pen is not effected.", + "parameterNames": [ + "volume" + ], + "parameterDescriptions": [ + "this object's volume from 0 to 100" + ], + "description": "", "returnDescription": "", - "scratchblock": "hide", + "scratchblock": "set volume to (percent) %", "since": "" } ], @@ -4891,26 +7306,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/hideVariable", + "id": "Sprite/setWidth", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "hideVariable", + "name": "setWidth", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "double" ], "returns": "void", "parameterNames": [ - "name" + "width" ], "parameterDescriptions": [ - "the name the monitor was shown with" + "the width in stage pixels; 0 to follow the costume and size again" ], - "description": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", + "description": "Draws the sprite this wide, whatever its costume's width and size: for buttons, panels and\nplatforms. With [setNineSlice(int, int, int, int)](setNineSlice) the corners keep their size.", "returnDescription": "", - "scratchblock": "hide variable [name v]", + "scratchblock": "", "since": "" } ], @@ -4919,20 +7334,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/ifOnEdgeBounce", + "id": "Sprite/setX", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "ifOnEdgeBounce", + "name": "setX", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Checks if the sprite is on the edge of the stage and bounces it back if it\nis. The sprite's\ndirection is reversed when it hits the left or right border, and it is\nreversed and rotated by\n180 degrees when it hits the top or bottom border. The method does nothing if\nthe hitbox is\ndisabled or if the sprite is a UI element. It also does nothing if the\nsprite has not been added to a stage yet.", + "parameterNames": [ + "x" + ], + "parameterDescriptions": [ + "the new x" + ], + "description": "", "returnDescription": "", - "scratchblock": "if on edge, bounce", + "scratchblock": "set x to (x)", "since": "" } ], @@ -4941,20 +7362,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isAsking", + "id": "Sprite/setY", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isAsking", + "name": "setY", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Checks whether a question is on screen and still waiting for an answer.", - "returnDescription": "true while a question is waiting", - "scratchblock": "", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "y" + ], + "parameterDescriptions": [ + "the new y" + ], + "description": "", + "returnDescription": "", + "scratchblock": "set y to (y)", "since": "" } ], @@ -4963,20 +7390,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isClone", + "id": "Sprite/show", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isClone", + "name": "show", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Whether this sprite is a clone, made by [clone()](clone).", - "returnDescription": "true for a clone, false for the original", - "scratchblock": "", + "description": "Shows the sprite.", + "returnDescription": "", + "scratchblock": "show", "since": "" } ], @@ -4985,29 +7412,29 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isColorTouchingColor", + "id": "Sprite/showVariable", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isColorTouchingColor", + "name": "showVariable", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color", - "org.openpatch.scratch.Color" + "java.lang.String", + "java.util.function.Supplier" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "color", - "other" + "name", + "value" ], "parameterDescriptions": [ - "a colour of this sprite's costume", - "the colour to look for under it" + "the label", + "gives the value to show" ], - "description": "Checks whether a colour of the sprite is touching a colour on the stage:\nonly the parts of the costume painted in `color` count. A car whose\nfront bumper is red can ask whether the bumper touches the grass.\n\n```java\nif (this.isColorTouchingColor(HtmlColor.RED, HtmlColor.GREEN)) {\n this.say(\"Off the road!\");\n}\n```", - "returnDescription": "true if the colour touches the other colour", - "scratchblock": "<color [#ff0000] is touching [#00ff00]?>", + "description": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.\n\n```java\nthis.showVariable(\"score\", () -> this.score);\n```", + "returnDescription": "", + "scratchblock": "show variable [name v]", "since": "" } ], @@ -5016,48 +7443,39 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isGliding", + "id": "Sprite/stamp", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isGliding", + "name": "stamp", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks whether the sprite is still on its way to a place it was told to\nglide to.", - "returnDescription": "true while it is still moving", - "scratchblock": "", + "description": "Stamps the costume onto the canvas of the sprite's pen layer (behind the sprites unless the\npen was moved): a picture of the sprite as it looks now, effects included, that stays.", + "returnDescription": "", + "scratchblock": "stamp", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Sprite/isKeyPressed", - "owner": "org.openpatch.scratch.Sprite", - "signatures": [ + }, { - "name": "isKeyPressed", + "name": "stamp", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "org.openpatch.scratch.Layer" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "keyCode" + "layer" ], "parameterDescriptions": [ - "a key" + "the layer" ], - "description": "Returns true if the key is pressed", - "returnDescription": "key pressed", - "scratchblock": "<key [space v] pressed?>", + "description": "Stamps the costume onto the canvas of a layer.", + "returnDescription": "", + "scratchblock": "stamp", "since": "" } ], @@ -5066,20 +7484,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isMouseDown", + "id": "Sprite/stopAllSounds", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isMouseDown", + "name": "stopAllSounds", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns true is the mouse button is down", - "returnDescription": "mouse button down", - "scratchblock": "<mouse down?>", + "description": "Stops every sound this object started.", + "returnDescription": "", + "scratchblock": "stop all sounds", "since": "" } ], @@ -5088,25 +7506,25 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isSoundPlaying", + "id": "Sprite/stopSound", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isSoundPlaying", + "name": "stopSound", "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ "name" ], "parameterDescriptions": [ - "Name of the sound" + "the sound to stop" ], - "description": "Returns true if the sound if playing", - "returnDescription": "playing", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -5116,95 +7534,45 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isTouchingColor", + "id": "Sprite/switchCostume", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isTouchingColor", + "name": "switchCostume", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "java.lang.String" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "color" + "name" ], "parameterDescriptions": [ - "the colour to look for" + "the costume's name" ], - "description": "Checks whether the sprite is touching a colour: whether anything it paints\nlies over that colour on the stage - on the backdrop, on what the pen drew,\nor on another sprite.\n\nAs in Scratch, colours that are nearly the same count, so anti-aliased\nedges still match. Only what is under the painted part of the costume\ncounts, not the empty space around it, and not the hitbox.\n\n```java\nif (this.isTouchingColor(HtmlColor.RED)) {\n this.say(\"Ouch!\");\n}\n```\n\nThe time it takes grows with the size of the sprite, not of the stage.", - "returnDescription": "true if the sprite is touching the colour", - "scratchblock": "<touching color [#ff0000]?>", + "description": "Switches to the costume with that name; an unknown name changes nothing.", + "returnDescription": "", + "scratchblock": "switch costume to [name v]", "since": "" }, { - "name": "isTouchingColor", + "name": "switchCostume", "constructor": false, "static": false, "parameters": [ - "double", - "double", "double" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "r", - "g", - "b" + "index" ], "parameterDescriptions": [ - "the red part [0...255]", - "the green part [0...255]", - "the blue part [0...255]" + "the costume's number" ], - "description": "Checks whether the sprite is touching a colour given by its red, green and\nblue parts.", - "returnDescription": "true if the sprite is touching the colour", - "scratchblock": "", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Sprite/isTouchingEdge", - "owner": "org.openpatch.scratch.Sprite", - "signatures": [ - { - "name": "isTouchingEdge", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns true if the rectangle which contains the image is outside of the\nstage", - "returnDescription": "true if outside", - "scratchblock": "<touching [edge v]?>", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Sprite/isTouchingMousePointer", - "owner": "org.openpatch.scratch.Sprite", - "signatures": [ - { - "name": "isTouchingMousePointer", - "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns true is the mouse pointer is touching the hitbox of the sprite.", - "returnDescription": "true if touching", - "scratchblock": "<touching [mouse-pointer v]?>", + "description": "Switches to a costume by number, counting from 0; numbers wrap around like Scratch's.", + "returnDescription": "", + "scratchblock": "switch costume to [name v]", "since": "" } ], @@ -5213,45 +7581,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isTouchingSprite", + "id": "Sprite/think", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isTouchingSprite", + "name": "think", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "java.lang.String" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "sprite" + "text" ], "parameterDescriptions": [ - "The sprite to check for collision with." + "what the sprite thinks" ], - "description": "Checks if this sprite is touching another sprite.", - "returnDescription": "true if this sprite is touching the specified sprite, false\n otherwise. Returns false if\n the specified sprite is the same as this sprite, if the stage is\n null, if the specified\n sprite is null, not shown, or has its hitbox disabled.", - "scratchblock": "<touching [sprite v]?>", + "description": "Shows a thought bubble until the sprite thinks something else; an empty text removes it.", + "returnDescription": "", + "scratchblock": "think [text]", "since": "" }, { - "name": "isTouchingSprite", + "name": "think", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "java.lang.String", + "double" ], - "returns": "boolean", + "returns": "void", "parameterNames": [ - "c" + "text", + "seconds" ], "parameterDescriptions": [ - "the class type of the sprite to check for collision" + "what the sprite thinks", + "how long" ], - "description": "Checks if this sprite is touching any sprite of the specified class type.", - "returnDescription": "true if this sprite is touching any sprite of the specified class\n type, false otherwise", - "scratchblock": "", + "description": "Shows a thought bubble for a number of seconds of game time.", + "returnDescription": "", + "scratchblock": "think [text] for (seconds) seconds", "since": "" } ], @@ -5260,19 +7631,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/isVisible", + "id": "Sprite/toString", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "isVisible", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns if the sprite is visible", - "returnDescription": "is visible", + "description": "The sprite's centre of the costume on the stage, as Scratch's \"x position\"/\"y position\".", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -5282,11 +7653,11 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/move", + "id": "Sprite/turnLeft", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "move", + "name": "turnLeft", "constructor": false, "static": false, "parameters": [ @@ -5294,33 +7665,14 @@ ], "returns": "void", "parameterNames": [ - "steps" - ], - "parameterDescriptions": [ - "a number of pixels" - ], - "description": "Moves the sprite towards the current rotation by the received steps.", - "returnDescription": "", - "scratchblock": "move (steps) steps", - "since": "" - }, - { - "name": "move", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void", - "parameterNames": [ - "v" + "degrees" ], "parameterDescriptions": [ - "a vector" + "how far to turn anticlockwise" ], - "description": "Moves the sprite in the direction of the given vector. The length of the\nvector determines how\nmove the sprite will move in this direction.", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "turn left (degrees) degrees", "since": "" } ], @@ -5329,20 +7681,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/nextCostume", + "id": "Sprite/turnRight", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "nextCostume", + "name": "turnRight", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Switch to the next costume.", + "parameterNames": [ + "degrees" + ], + "parameterDescriptions": [ + "how far to turn clockwise" + ], + "description": "", "returnDescription": "", - "scratchblock": "next costume", + "scratchblock": "turn right (degrees) degrees", "since": "" } ], @@ -5351,29 +7709,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/pickRandom", + "id": "Sprite/whenAddedToStage", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "pickRandom", + "name": "whenAddedToStage", "constructor": false, "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "int", - "parameterNames": [ - "from", - "to" - ], - "parameterDescriptions": [ - "the lower bound of the range (inclusive)", - "the upper bound of the range (exclusive)" - ], - "description": "Returns a random integer between the specified range.", - "returnDescription": "a random integer between the specified range", - "scratchblock": "(pick random (from) to (to))", + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Called when the sprite was added to a stage. Override it to react.", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -5382,11 +7731,11 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/playSound", + "id": "Sprite/whenBackdropSwitches", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "playSound", + "name": "whenBackdropSwitches", "constructor": false, "static": false, "parameters": [ @@ -5397,11 +7746,11 @@ "name" ], "parameterDescriptions": [ - "the sound name" + "the new backdrop's name" ], - "description": "Plays a sound.\n\nEvery sprite plays its own copy, so ten sprites playing the same sound are\nheard ten times at once. One sprite only plays a sound once at a time:\nplaying it again while it is still going does nothing.", + "description": "Called when the stage switches its backdrop.", "returnDescription": "", - "scratchblock": "start sound [name v]\n\nplaySoundCopy() returns an independent SoundPlayback with its own volume\nand can overlap earlier plays of the same sound.", + "scratchblock": "when backdrop switches to [name v]", "since": "" } ], @@ -5410,29 +7759,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/playSoundCopy", + "id": "Sprite/whenClicked", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "playSoundCopy", + "name": "whenClicked", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "double" - ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "parameterNames": [ - "name", - "volume" - ], - "parameterDescriptions": [ - "a sound already added with addSound()", - "volume from 0 to 100 percent" - ], - "description": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this sprite.\nThe sprite's ordinary volume does not change a copy's explicit volume.", - "returnDescription": "this individual playback, also usable in try-with-resources", - "scratchblock": "", + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Called when this sprite is clicked: a mouse button is pressed over its hitbox, and no sprite\nin front of it is under the pointer.", + "returnDescription": "", + "scratchblock": "when this sprite clicked", "since": "" } ], @@ -5441,45 +7781,54 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/pointInDirection", + "id": "Sprite/whenIReceive", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "pointInDirection", + "name": "whenIReceive", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "degrees" + "message" ], "parameterDescriptions": [ - "The direction in degrees to point the sprite. 0 degrees is up,\n 90 degrees is to the right, 180 degrees is down, and 270\n degrees is to the left." + "the message" ], - "description": "Points the sprite in the specified direction.", + "description": "Called when a message is broadcast.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "when I receive [message v]", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Sprite/whenKeyPressed", + "owner": "org.openpatch.scratch.Sprite", + "signatures": [ { - "name": "pointInDirection", + "name": "whenKeyPressed", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.KeyCode" ], "returns": "void", "parameterNames": [ - "v" + "key" ], "parameterDescriptions": [ - "the target vector to point towards" + "the key" ], - "description": "Points the sprite in the direction of the given vector.", + "description": "Called when a key is pressed, once per press (holding a key down does not repeat it).", "returnDescription": "", - "scratchblock": "", + "scratchblock": "when [space v] key pressed", "since": "" } ], @@ -5488,20 +7837,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/pointTowardsMousePointer", + "id": "Sprite/whenKeyReleased", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "pointTowardsMousePointer", + "name": "whenKeyReleased", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Points the sprite towards the current position of the mouse pointer. This\nmethod calculates the\nangle between the sprite's current position and the mouse pointer's position,\nthen sets the\nsprite's direction accordingly.", + "parameterNames": [ + "key" + ], + "parameterDescriptions": [ + "the key" + ], + "description": "Called when a key is released.", "returnDescription": "", - "scratchblock": "point towards [mouse-pointer v]", + "scratchblock": "", "since": "" } ], @@ -5510,26 +7865,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/pointTowardsSprite", + "id": "Sprite/whenMouseClicked", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "pointTowardsSprite", + "name": "whenMouseClicked", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "org.openpatch.scratch.MouseCode" ], "returns": "void", "parameterNames": [ - "s" + "button" ], "parameterDescriptions": [ - "the sprite to point towards" + "the button" ], - "description": "Points the current sprite towards the specified sprite.", + "description": "Called when a mouse button is pressed anywhere on the stage.", "returnDescription": "", - "scratchblock": "point towards [sprite v]", + "scratchblock": "", "since": "" } ], @@ -5538,20 +7893,29 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/previousCostume", + "id": "Sprite/whenMouseMoved", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "previousCostume", + "name": "whenMouseMoved", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double", + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Switch to the previous costume.", + "parameterNames": [ + "x", + "y" + ], + "parameterDescriptions": [ + "x of the mouse pointer (world)", + "y of the mouse pointer (world)" + ], + "description": "Called when the mouse moves.", "returnDescription": "", - "scratchblock": "switch costume to (previous costume)", + "scratchblock": "", "since": "" } ], @@ -5560,18 +7924,18 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/remove", + "id": "Sprite/whenRemovedFromStage", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "remove", + "name": "whenRemovedFromStage", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Removes this sprite from its current stage. For \"delete this clone\", see\n[deleteThisClone()](deleteThisClone).", + "description": "Called when the sprite was removed from its stage. Override it to react.", "returnDescription": "", "scratchblock": "", "since": "" @@ -5582,20 +7946,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/run", + "id": "Sprite/whenStartsAsClone", "owner": "org.openpatch.scratch.Sprite", "signatures": [ { - "name": "run", + "name": "whenStartsAsClone", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is intended to be overridden by subclasses to define the behavior\nof the sprite\nwhen it is run. By default, this method does nothing.\n\nIt is called every frame.", + "description": "Called in a new clone, right after it was made.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "when I start as a clone", "since": "" } ], @@ -5604,48 +7968,64 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/say", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/add", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "say", + "name": "add", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Sprite" ], "returns": "void", "parameterNames": [ - "text" + "sprite" ], "parameterDescriptions": [ - "The text to be displayed in the speech bubble." + "the sprite" ], - "description": "Makes the sprite display a speech bubble with the specified text.", + "description": "Adds a sprite, in front of the sprites of its layer. A sprite can only be on one stage; it\nleaves the old one.", "returnDescription": "", - "scratchblock": "say [text]", + "scratchblock": "", "since": "" }, { - "name": "say", + "name": "add", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "int" + "org.openpatch.scratch.Pen" ], "returns": "void", "parameterNames": [ - "text", - "millis" + "pen" + ], + "parameterDescriptions": [ + "the pen" + ], + "description": "Adds a pen of its own.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "add", + "constructor": false, + "static": false, + "parameters": [ + "org.openpatch.scratch.Text" + ], + "returns": "void", + "parameterNames": [ + "text" ], "parameterDescriptions": [ - "The message to be displayed.", - "The duration in milliseconds for which the message will be\n displayed." + "the text" ], - "description": "Displays a text message for a specified duration.", + "description": "Adds a text of its own.", "returnDescription": "", - "scratchblock": "say [text] for (millis) seconds", + "scratchblock": "", "since": "" } ], @@ -5654,43 +8034,71 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setDirection", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/addBackdrop", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setDirection", + "name": "addBackdrop", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String", + "java.lang.String" ], "returns": "void", "parameterNames": [ - "degrees" + "name", + "imagePath" ], "parameterDescriptions": [ - "between 0 and 360" + "the backdrop's name", + "the image file" ], - "description": "Sets the direction of the sprite to a given degrees. When this value is 0 the\nsprite moves\nup, when it is 180 it moves down.", + "description": "Adds a backdrop. The first one added is shown.", "returnDescription": "", - "scratchblock": "point in direction (degrees)", + "scratchblock": "", "since": "" }, { - "name": "setDirection", + "name": "addBackdrop", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "v" + "imagePath" ], "parameterDescriptions": [ - "a vector" + "the image file, or a built-in sprite's name" + ], + "description": "Adds a backdrop, named after its file.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "addBackdrop", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "java.lang.String", + "boolean" + ], + "returns": "void", + "parameterNames": [ + "name", + "imagePath", + "stretch" ], - "description": "Sets the direction of the sprite to the direction of a given vector.", + "parameterDescriptions": [ + "the backdrop's name", + "the image file, or a built-in sprite's name", + "whether to stretch it to the stage's size" + ], + "description": "Adds a backdrop, optionally stretched to the stage's size.", "returnDescription": "", "scratchblock": "", "since": "" @@ -5701,43 +8109,46 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setHitbox", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/addSound", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setHitbox", + "name": "addSound", "constructor": false, "static": false, "parameters": [ - "double[]" + "java.lang.String", + "java.lang.String" ], "returns": "void", "parameterNames": [ - "points" + "name", + "soundPath" ], "parameterDescriptions": [ - "an array of integers representing the x and y coordinates of\n the hitbox vertices.\n The length of the array should be even, with each pair of\n integers representing a point (x,\n y)." + "the sound's name, for [playSound(String)](playSound)", + "the sound file" ], - "description": "Sets the hitbox for the sprite using the provided points. The points should\nbe provided in\npairs representing the x and y coordinates.", + "description": "Adds a sound (WAV or OGG).", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "setHitbox", + "name": "addSound", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Shape" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "shape" + "soundPath" ], "parameterDescriptions": [ - "the shape to be used for the hitbox" + "the sound file" ], - "description": "Sets the hitbox for the sprite using the specified shape.", + "description": "Adds a sound, named after its file.", "returnDescription": "", "scratchblock": "", "since": "" @@ -5748,48 +8159,82 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setPosition", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/ask", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setPosition", + "name": "ask", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "x", - "y" + "question" ], "parameterDescriptions": [ - "a x coordinate", - "a y coordinate" + "the question" ], - "description": "Sets the position of the sprite", + "description": "Asks a question in a box along the bottom of the stage, as Scratch does, with a field to type\nthe answer in. Enter or the check button finishes it: then [isAsking()](isAsking) is false and [getAnswer()](getAnswer) has the answer.\nWhile a question is open, keys go to the answer box, not to the stage and its sprites.", "returnDescription": "", - "scratchblock": "go to x: (x) y: (y)", + "scratchblock": "ask [question] and wait", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/broadcast", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "setPosition", + "name": "broadcast", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "message" + ], + "parameterDescriptions": [ + "the message" + ], + "description": "Sends a message to every sprite and then the stage; their `whenIReceive` runs at once.", + "returnDescription": "", + "scratchblock": "broadcast [message v]", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/changeColorEffect", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ + { + "name": "changeColorEffect", + "constructor": false, + "static": false, + "parameters": [ + "double" ], "returns": "void", "parameterNames": [ - "v" + "by" ], "parameterDescriptions": [ - "a vector" + "how much to change the backdrop's colour effect" ], - "description": "Sets the position of the sprite based on the coordinates of a given vector.", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "change [color v] effect by (by)", "since": "" } ], @@ -5798,29 +8243,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setRotationCenter", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/changeTransparency", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setRotationCenter", + "name": "changeTransparency", "constructor": false, "static": false, "parameters": [ - "double", "double" ], "returns": "void", "parameterNames": [ - "x", - "y" + "by" ], "parameterDescriptions": [ - "the x-coordinate in the costume, from its left edge", - "the y-coordinate in the costume, from its top edge" + "how much to change the backdrop's transparency" ], - "description": "Sets the point of the costume the sprite turns around - Scratch's rotation\ncenter. It is also the point that sits at the sprite's position, so it is\nwhere the pen draws from and what `goTo` puts in place.\n\nThe point is given in the costume's own pixels, counted from its top left\ncorner, the same way as [setHitbox(double...)](setHitbox): a sword whose hilt\nis 12 pixels from the left and 60 from the top swings around the hilt with\n`setRotationCenter(12, 60)`. It grows and shrinks with the sprite's\nsize and holds for every costume of the sprite. Without it, a sprite turns\naround the middle of its costume.\n\n```java\nthis.addCostume(\"hand\", \"assets/clock-hand.png\");\nthis.setRotationCenter(8, 100); // the end of the hand\n```", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "change [ghost v] effect by (step)", "since": "" } ], @@ -5829,26 +8271,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setRotationStyle", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/changeVolume", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setRotationStyle", + "name": "changeVolume", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.RotationStyle" + "double" ], "returns": "void", "parameterNames": [ - "style" + "by" ], "parameterDescriptions": [ - "the rotation style to be set" + "how much to change the volume" ], - "description": "Sets the rotation style for the sprite.", + "description": "", "returnDescription": "", - "scratchblock": "set rotation style [left-right v]", + "scratchblock": "change volume by (step)", "since": "" } ], @@ -5857,26 +8299,48 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setSize", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/constructor", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setSize", + "name": "Stage", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.Stage", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A stage the size of the window.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/count", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ + { + "name": "count", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.Class" ], - "returns": "void", + "returns": "int", "parameterNames": [ - "percentage" + "type" ], "parameterDescriptions": [ - "a percentage [0...100]" + "a class of sprites" ], - "description": "Sets the size of the sprite.", - "returnDescription": "", - "scratchblock": "set size to (percentage) %", + "description": "", + "returnDescription": "how many sprites of that class are on the stage", + "scratchblock": "", "since": "" } ], @@ -5885,70 +8349,76 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setTint", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/debug", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setTint", + "name": "debug", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "java.lang.Object[]" ], "returns": "void", "parameterNames": [ - "c" + "values" ], "parameterDescriptions": [ - "a color object" + "what to print" ], - "description": "Sets the tint for the sprite with an color object.", + "description": "Prints values for debugging, but only while debug mode is on.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/display", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "setTint", + "name": "display", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "r", - "g", - "b" + "text" ], "parameterDescriptions": [ - "a red value [0...255]", - "a green value [0...255]", - "a blue value [0...255]" + "what to show" ], - "description": "Sets the tint for the sprite with rgb.", + "description": "Shows a text in a band along the bottom of the stage until something else is displayed; an\nempty text removes the band.", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "setTint", + "name": "display", "constructor": false, "static": false, "parameters": [ + "java.lang.String", "double" ], "returns": "void", "parameterNames": [ - "h" + "text", + "seconds" ], "parameterDescriptions": [ - "a hue value [0...255]" + "what to show", + "how long" ], - "description": "Sets the tint for the sprite with a hue.", + "description": "Shows a text in a band along the bottom of the stage for a number of seconds of game time.", "returnDescription": "", - "scratchblock": "set [color v] effect to (h)", + "scratchblock": "", "since": "" } ], @@ -5957,26 +8427,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setTransparency", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/eraseAll", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setTransparency", + "name": "eraseAll", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "transparency" - ], - "parameterDescriptions": [ - "[0...100], 0 solid and 100 invisible" - ], - "description": "Sets how see-through the sprite is, as Scratch's ghost effect does: 0 is the\nsolid sprite you start with and 100 is invisible. Anything outside that is\npinned to it.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Erases everything every pen drew and everything stamped, on every layer.", "returnDescription": "", - "scratchblock": "set [ghost v] effect to (transparency)", + "scratchblock": "erase all", "since": "" } ], @@ -5985,54 +8449,80 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setVolume", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/extension", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setVolume", + "name": "extension", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.Class", + "java.util.function.Supplier" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "percent" + "type", + "factory" ], "parameterDescriptions": [ - "0 for silent, 100 for full volume" + "the state's class", + "makes it" ], - "description": "Sets how loud every sound of this sprite plays.", - "returnDescription": "", - "scratchblock": "set volume to (percent) %", + "description": "An extension's state for this stage, made on first use. For extensions, not for learner code.", + "returnDescription": "the stage's one instance", + "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "For extensions, which run against the desktop's window and render threads. The browser ships its extensions natively and loads no others.", + "missingBrowserSignatures": [ + { + "name": "extension", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.Class", + "java.util.function.Supplier" + ], + "returns": "T", + "parameterNames": [ + "type", + "factory" + ], + "parameterDescriptions": [ + "the state's class", + "makes it" + ], + "description": "An extension's state for this stage, made on first use. For extensions, not for learner code.", + "returnDescription": "the stage's one instance", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "Sprite/setX", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/find", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setX", + "name": "find", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.Class" ], - "returns": "void", + "returns": "java.util.List", "parameterNames": [ - "x" + "type" ], "parameterDescriptions": [ - "a x coordinate" + "a class of sprites" ], - "description": "Sets the x coordinate", - "returnDescription": "", - "scratchblock": "set x to (x)", + "description": "", + "returnDescription": "every sprite of that class (subclasses included), back to front", + "scratchblock": "", "since": "" } ], @@ -6041,26 +8531,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/setY", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getAll", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "setY", + "name": "getAll", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "y" - ], - "parameterDescriptions": [ - "a y coordinate" - ], - "description": "Sets the y coordinate", - "returnDescription": "", - "scratchblock": "set y to (y)", + "parameters": [], + "returns": "java.util.List", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "every sprite on the stage, back to front, layer by layer", + "scratchblock": "", "since": "" } ], @@ -6069,20 +8553,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/show", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getAnswer", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "show", + "name": "getAnswer", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Shows the sprite.", - "returnDescription": "", - "scratchblock": "show", + "description": "", + "returnDescription": "the answer to the last question, \"\" before the first", + "scratchblock": "(answer)", "since": "" } ], @@ -6091,29 +8575,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/showVariable", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getCamera", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "showVariable", + "name": "getCamera", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "java.util.function.Supplier" - ], - "returns": "void", - "parameterNames": [ - "name", - "value" - ], - "parameterDescriptions": [ - "the variable's name, shown after the sprite's", - "gives the value to show; asked for it every frame" - ], - "description": "Shows a monitor for one of this sprite's variables in the top left corner\nof the stage, like Scratch's variable monitors: \"Cat: score\" and the\ncurrent value, updated every frame. Showing the same name again replaces\nthe monitor; it goes away with the sprite.\n\n```java\npublic Cat() {\n this.addCostume(\"cat\", \"bunny1_stand\");\n this.showVariable(\"lives\", () -> lives);\n}\n```", - "returnDescription": "", - "scratchblock": "show variable [name v]", + "parameters": [], + "returns": "org.openpatch.scratch.Camera", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage's camera", + "scratchblock": "", "since": "" } ], @@ -6122,38 +8597,41 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/stamp", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getColor", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "stamp", + "name": "getColor", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Color", "parameterNames": [], "parameterDescriptions": [], - "description": "Stamps the current sprite to the background. A stamp is a non interactive\nversion of the sprite.", - "returnDescription": "", - "scratchblock": "stamp", + "description": "", + "returnDescription": "the colour behind the backdrop", + "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/getColorEffect", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "stamp", + "name": "getColorEffect", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Layer" - ], - "returns": "void", - "parameterNames": [ - "layer" - ], - "parameterDescriptions": [ - "which layer to stamp onto" - ], - "description": "Stamps the sprite onto one of the stage's layers. A stamp is a picture of\nthe sprite that stays where it is put, and is not interactive.\n\nExample usage:\n\n```java\nthis.stamp(Layer.UI);\n```", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the backdrop's colour effect", "scratchblock": "", "since": "" } @@ -6163,20 +8641,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/stopAllSounds", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getCurrentBackdropIndex", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "stopAllSounds", + "name": "getCurrentBackdropIndex", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "Stops the playing of all sounds of the sprite.", - "returnDescription": "", - "scratchblock": "stop all sounds", + "description": "", + "returnDescription": "the current backdrop's number, counting from 0", + "scratchblock": "(backdrop [number v])", "since": "" } ], @@ -6185,26 +8663,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/stopSound", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getCurrentBackdropName", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "stopSound", + "name": "getCurrentBackdropName", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "Name of the sound" - ], - "description": "Stops the playing of the sound with the given name", - "returnDescription": "", - "scratchblock": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the current backdrop's name, or null without backdrops", + "scratchblock": "(backdrop [name v])", "since": "" } ], @@ -6213,45 +8685,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/switchCostume", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getHeight", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "switchCostume", - "constructor": false, - "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the name of a costume" - ], - "description": "Switch to a costume by name.", - "returnDescription": "", - "scratchblock": "switch costume to [name v]", - "since": "" - }, - { - "name": "switchCostume", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "index" - ], - "parameterDescriptions": [ - "The index of the costume to switch to." - ], - "description": "Switches the current costume of the sprite to the costume at the specified\nindex.", - "returnDescription": "", - "scratchblock": "switch costume to (index)", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage's height in stage pixels", + "scratchblock": "", "since": "" } ], @@ -6260,48 +8707,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/think", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getMouse", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "think", - "constructor": false, - "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "text" - ], - "parameterDescriptions": [ - "The text to be displayed in the thought bubble." - ], - "description": "Displays a thought bubble with the specified text.", - "returnDescription": "", - "scratchblock": "think [text]", - "since": "" - }, - { - "name": "think", + "name": "getMouse", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "int" - ], - "returns": "void", - "parameterNames": [ - "text", - "millis" - ], - "parameterDescriptions": [ - "The text to be displayed in the thought bubble.", - "The duration in milliseconds for which the thought bubble will\n be displayed." - ], - "description": "Displays a thought bubble with the specified text for a given duration.", - "returnDescription": "", - "scratchblock": "think [text] for (millis) seconds", + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the mouse pointer in world coordinates", + "scratchblock": "", "since": "" } ], @@ -6310,26 +8729,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/turnLeft", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getMouseX", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "turnLeft", + "name": "getMouseX", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "degrees" - ], - "parameterDescriptions": [ - "between 0 and 360" - ], - "description": "Rotates the sprite by a certain degrees to the left.", - "returnDescription": "", - "scratchblock": "turn left (degrees) degrees", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "x of the mouse pointer in world coordinates", + "scratchblock": "(mouse x)", "since": "" } ], @@ -6338,26 +8751,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/turnRight", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getMouseY", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "turnRight", + "name": "getMouseY", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "degrees" - ], - "parameterDescriptions": [ - "between 0 and 360" - ], - "description": "Rotates the sprite by a certain degrees to the right.", - "returnDescription": "", - "scratchblock": "turn right (degrees) degrees", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "y of the mouse pointer in world coordinates", + "scratchblock": "(mouse y)", "since": "" } ], @@ -6366,19 +8773,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenAddedToStage", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getShaders", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenAddedToStage", + "name": "getShaders", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Shaders", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is called when the sprite is added to the stage. Override this\nmethod to define\ncustom behavior when the sprite is added to the stage.", - "returnDescription": "", + "description": "", + "returnDescription": "the stage's shaders, applied to the picture of its world layers", "scratchblock": "", "since": "" } @@ -6388,26 +8795,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenBackdropSwitches", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getTimer", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenBackdropSwitches", + "name": "getTimer", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the name of the backdrop to switch to" - ], - "description": "This method is called when the backdrop switches to the specified name.\nOverride this method to\ndefine custom behavior.", - "returnDescription": "", - "scratchblock": "when backdrop switches to [name v]", + "parameters": [], + "returns": "org.openpatch.scratch.Timer", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "this object's timer, counting game time since it was made or reset", + "scratchblock": "(timer)", "since": "" } ], @@ -6416,20 +8817,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenClicked", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getTransparency", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenClicked", + "name": "getTransparency", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is called when the sprite is clicked. Override this method to\ndefine custom\nbehavior for the sprite when it is clicked.", - "returnDescription": "", - "scratchblock": "when this sprite clicked", + "description": "", + "returnDescription": "the backdrop's transparency in percent", + "scratchblock": "", "since": "" } ], @@ -6438,26 +8839,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenIReceive", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getVolume", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenIReceive", + "name": "getVolume", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "message" - ], - "parameterDescriptions": [ - "The message that is received." - ], - "description": "This method is called when a message is received. Override this method to\ndefine custom\nbehavior.", - "returnDescription": "", - "scratchblock": "when I receive [message v]", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "this object's volume from 0 to 100", + "scratchblock": "(volume)", "since": "" } ], @@ -6466,26 +8861,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenKeyPressed", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/getWidth", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenKeyPressed", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "void", - "parameterNames": [ - "keyCode" - ], - "parameterDescriptions": [ - "the key that was pressed" - ], - "description": "This method is called when a key is pressed. Override this method to define\ncustom behavior.", - "returnDescription": "", - "scratchblock": "when [space v] key pressed", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage's width in stage pixels", + "scratchblock": "", "since": "" } ], @@ -6494,26 +8883,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenKeyReleased", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/hideVariable", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenKeyReleased", + "name": "hideVariable", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "keyCode" + "name" ], "parameterDescriptions": [ - "the key that was released" + "the label of a variable to hide again" ], - "description": "This method is called when a key is released. Override this method to define\ncustom behavior.", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "hide variable [name v]", "since": "" } ], @@ -6522,25 +8911,19 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenMouseClicked", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/isAsking", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenMouseClicked", + "name": "isAsking", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.MouseCode" - ], - "returns": "void", - "parameterNames": [ - "mouseCode" - ], - "parameterDescriptions": [ - "The code representing the mouse button that was clicked." - ], - "description": "This method is called when a mouse click event occurs. Override this method\nto define custom\nbehavior.", - "returnDescription": "", + "parameters": [], + "returns": "boolean", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether a question is waiting for its answer", "scratchblock": "", "since": "" } @@ -6550,29 +8933,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenMouseMoved", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/isKeyPressed", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenMouseMoved", + "name": "isKeyPressed", "constructor": false, "static": false, "parameters": [ - "double", - "double" + "org.openpatch.scratch.KeyCode" ], - "returns": "void", + "returns": "boolean", "parameterNames": [ - "x", - "y" + "key" ], "parameterDescriptions": [ - "The x-coordinate of the mouse pointer.", - "The y-coordinate of the mouse pointer." + "a key" ], - "description": "This method is called when the mouse is moved. Override this method to define\ncustom behavior.", - "returnDescription": "", - "scratchblock": "", + "description": "", + "returnDescription": "whether the key is held down", + "scratchblock": "<key [space v] pressed?>", "since": "" } ], @@ -6581,20 +8961,20 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenRemovedFromStage", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/isMouseDown", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenRemovedFromStage", + "name": "isMouseDown", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is called when the sprite is removed from the stage. Override\nthis method to define\ncustom behavior when the sprite is removed.", - "returnDescription": "", - "scratchblock": "", + "description": "", + "returnDescription": "whether a mouse button is held down", + "scratchblock": "<mouse down?>", "since": "" } ], @@ -6603,20 +8983,26 @@ "missingBrowserSignatures": [] }, { - "id": "Sprite/whenStartsAsClone", - "owner": "org.openpatch.scratch.Sprite", + "id": "Stage/isSoundPlaying", + "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "whenStartsAsClone", + "name": "isSoundPlaying", "constructor": false, "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Runs when this sprite was just made as a clone, like Scratch's \"when I\nstart as a clone\". Override it to give clones their own behaviour, for\nexample to send a bullet on its way.\n\n```java\npublic void whenStartsAsClone() {\n this.show();\n this.goToRandomPosition();\n}\n```", - "returnDescription": "", - "scratchblock": "when I start as a clone", + "parameters": [ + "java.lang.String" + ], + "returns": "boolean", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "a sound's name" + ], + "description": "", + "returnDescription": "whether it is playing", + "scratchblock": "", "since": "" } ], @@ -6625,64 +9011,79 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/add", + "id": "Stage/nextBackdrop", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "add", + "name": "nextBackdrop", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "sprite" - ], - "parameterDescriptions": [ - "the sprite to add" - ], - "description": "Adds a sprite to the stage. Sprites are drawn in the order they were added, so a sprite added\nlater is drawn on top of one added earlier.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Switches to the next backdrop, after the last to the first.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "next backdrop", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/pickRandom", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "add", + "name": "pickRandom", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Text" + "int", + "int" ], - "returns": "void", + "returns": "int", "parameterNames": [ - "text" + "from", + "to" ], "parameterDescriptions": [ - "a text" + "the lowest", + "the highest" ], - "description": "Add a text object to the stage", - "returnDescription": "", - "scratchblock": "", + "description": "A random whole number between two numbers, both included.", + "returnDescription": "the number", + "scratchblock": "(pick random (from) to (to))", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/playSound", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "add", + "name": "playSound", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Pen" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "pen" + "name" ], "parameterDescriptions": [ - "the Pen object to be added to the stage" + "the sound's name" ], - "description": "Adds a Pen object to the stage.", + "description": "Starts a sound, like Scratch's \"start sound\"; a sound that is still playing is not started\nagain.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "start sound [name v]", "since": "" } ], @@ -6691,73 +9092,73 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/addBackdrop", + "id": "Stage/playSoundCopy", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "addBackdrop", + "name": "playSoundCopy", "constructor": false, "static": false, "parameters": [ "java.lang.String", - "java.lang.String", - "boolean" + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.SoundPlayback", "parameterNames": [ "name", - "imagePath", - "stretch" + "volume" ], "parameterDescriptions": [ - "a unique name", - "a image path, or the name of a built-in sprite such as\n \"bg_castle\"", - "stretch image to window size" + "the sound's name", + "the copy's volume from 0 to 100" ], - "description": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", - "returnDescription": "", + "description": "Starts another copy of a sound, which plays alongside the others: for shots, steps, coins.", + "returnDescription": "the copy, to stop it or change its volume", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/previousBackdrop", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "addBackdrop", + "name": "previousBackdrop", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "java.lang.String" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "name", - "imagePath" - ], - "parameterDescriptions": [ - "a unique name", - "a image path, or the name of a built-in sprite such as\n \"bg_castle\"" - ], - "description": "Add a backdrop to the stage. If a backdrop with the received name already\nexists do nothing.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Switches to the previous backdrop, before the first to the last.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "switch backdrop to [previous backdrop v]", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/randomBackdrop", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "addBackdrop", + "name": "randomBackdrop", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the name of a built-in sprite, for example \"bg_castle\". Add the\n sheet in front of the name, for example \"platformer/grass\", if\n the same name exists on several sheets." - ], - "description": "Add one of the backdrops that ship with Scratch for Java to the stage. The\nbackdrop gets the same name as the built-in sprite. If a backdrop with that\nname already exists do nothing.\n\nExample usage:\n\n```java\nthis.addBackdrop(\"bg_castle\");\n```", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Switches to a random backdrop other than the current one (if there is another).", "returnDescription": "", - "scratchblock": "", + "scratchblock": "switch backdrop to [random backdrop v]", "since": "" } ], @@ -6766,104 +9167,83 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/addSound", + "id": "Stage/remove", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "addSound", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.Text" ], "returns": "void", "parameterNames": [ - "name", - "soundPath" + "text" ], "parameterDescriptions": [ - "a unique name", - "a sound path, or the name of a built-in sound such as\n \"footstep_carpet_000\"" + "a text of its own to remove" ], - "description": "Add a sound to the stage. If a sound with the received name already exists do\nnothing.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "addSound", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Sprite" ], "returns": "void", "parameterNames": [ - "name" + "sprite" ], "parameterDescriptions": [ - "the name of a built-in sound, for example \"footstep_carpet_000\"" + "the sprite" ], - "description": "Add one of the sounds that ship with Scratch for Java to the stage. The\nsound gets the same name as the built-in sound. If a sound with that name\nalready exists do nothing.\n\nExample usage:\n\n```java\nthis.addSound(\"footstep_carpet_000\");\n```", + "description": "Removes a sprite.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/ask", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "ask", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Pen" ], "returns": "void", "parameterNames": [ - "question" + "pen" ], "parameterDescriptions": [ - "the question to show" + "a pen of its own to remove" ], - "description": "Asks a question and waits for an answer to be typed in. A box appears at the\nbottom of the stage; whatever is typed goes into it until Enter is pressed.\n\nUnlike Scratch, this does not pause anything. Your `run()` keeps being\ncalled while the question is on screen, so check [isAsking()](isAsking) or wait\nfor [getAnswer()](getAnswer) to change:\n\n```java\npublic void run() {\n if (!this.isAsking() && this.getAnswer().isEmpty()) {\n this.ask(\"What is your name?\");\n }\n if (!this.getAnswer().isEmpty()) {\n this.display(\"Hello \" + this.getAnswer() + \"!\");\n }\n}\n```", + "description": "", "returnDescription": "", - "scratchblock": "ask [question] and wait", + "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/broadcast", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "broadcast", + "name": "remove", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "java.lang.Class" ], "returns": "void", "parameterNames": [ - "message" + "type" ], "parameterDescriptions": [ - "The message to broadcast." + "the class" ], - "description": "Broadcasts a message to every sprite on the stage and to the stage itself,\nas in Scratch. Each of them runs its `whenIReceive` method with the\nmessage.", + "description": "Removes every sprite of a class (subclasses included).", "returnDescription": "", - "scratchblock": "broadcast [message v]", + "scratchblock": "", "since": "" } ], @@ -6872,24 +9252,18 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/changeColor", + "id": "Stage/removeAll", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "changeColor", + "name": "removeAll", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "h" - ], - "parameterDescriptions": [ - "a step value" - ], - "description": "Changes the background color by adding a step to the hue value.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Removes every sprite, text and pen: an empty stage (backdrops and what was drawn stay).", "returnDescription": "", "scratchblock": "", "since": "" @@ -6900,26 +9274,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/changeTint", + "id": "Stage/run", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "changeTint", + "name": "run", "constructor": false, "static": false, - "parameters": [ - "double" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "step" - ], - "parameterDescriptions": [ - "a step value" - ], - "description": "Changes the colour the backdrop is tinted with by a step.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Runs every tick before the sprites' `run()`. Override it with the stage's code.", "returnDescription": "", - "scratchblock": "change [color v] effect by (step)", + "scratchblock": "", "since": "" } ], @@ -6928,54 +9296,51 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/changeTransparency", + "id": "Stage/setColor", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "changeTransparency", + "name": "setColor", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "step" + "color" ], "parameterDescriptions": [ - "a step value" + "the colour behind the backdrop" ], - "description": "Changes how see-through the backdrop is by a step. A positive step fades it\nout, a negative one brings it back.", + "description": "", "returnDescription": "", - "scratchblock": "change [ghost v] effect by (step)", + "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/changeVolume", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "changeVolume", + "name": "setColor", "constructor": false, "static": false, "parameters": [ + "double", + "double", "double" ], "returns": "void", "parameterNames": [ - "step" + "red", + "green", + "blue" ], "parameterDescriptions": [ - "how much to add to the volume, in percent" + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" ], - "description": "Makes every sound of this stage louder or quieter.", + "description": "", "returnDescription": "", - "scratchblock": "change volume by (step)", + "scratchblock": "", "since": "" } ], @@ -6984,20 +9349,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/constructor", + "id": "Stage/setColorEffect", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "Stage", - "constructor": true, + "name": "setColorEffect", + "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Constructs a new Stage. A stage is as big as the window it is shown in, so\nthe window has to exist first:\n\n```java\nWindow myWindow = new Window(480, 360);\nmyWindow.setStage(new MyStage());\n```", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "value" + ], + "parameterDescriptions": [ + "the effect" + ], + "description": "Scratch's colour effect on the backdrop: shifts its colours around the colour wheel (200 is\nall the way round). Like Scratch, it gives colours too grey or too dark to show a hue a\nlittle one, so white and black are tinted too.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "set [color v] effect to (value)", "since": "" } ], @@ -7006,52 +9377,49 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/count", + "id": "Stage/setCursor", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "count", + "name": "setCursor", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "java.lang.String" ], - "returns": "int", + "returns": "void", "parameterNames": [ - "c" + "path" ], "parameterDescriptions": [ - "the class of the sprites to count" + "an image file, or a built-in sprite's name" ], - "description": "Returns the number of sprites of the specified class.", - "returnDescription": "the number of sprites of the specified class", + "description": "Shows an image instead of the mouse pointer while the mouse is over the stage.", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/debug", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "debug", + "name": "setCursor", "constructor": false, "static": false, "parameters": [ - "java.lang.Object[]" + "java.lang.String", + "int", + "int" ], "returns": "void", "parameterNames": [ - "values" + "path", + "x", + "y" ], "parameterDescriptions": [ - "one or more values to print" + "an image file, or a built-in sprite's name", + "pixels from the image's left edge to the point that clicks", + "pixels from the image's top edge to the point that clicks" ], - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the stage's class name so you can tell\nwhich stage it came from.\n\nExample:\n\n```java\nthis.debug(\"score =\", score, \"lives =\", lives);\n// prints: [MyStage] score = 5 lives = 3\n```", + "description": "Shows an image instead of the mouse pointer.", "returnDescription": "", "scratchblock": "", "since": "" @@ -7062,48 +9430,54 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/display", + "id": "Stage/setTint", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "display", + "name": "setTint", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "text" + "color" ], "parameterDescriptions": [ - "the text to be displayed" + "the tint, or null for none" ], - "description": "Displays the given text on the stage.", + "description": "Multiplies the backdrop by a colour. Not a Scratch block: Scratch's colour effect is\n[setColorEffect(double)](setColorEffect).", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Stage/setTransparency", + "owner": "org.openpatch.scratch.Stage", + "signatures": [ { - "name": "display", + "name": "setTransparency", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "int" + "double" ], "returns": "void", "parameterNames": [ - "text", - "millis" + "percent" ], "parameterDescriptions": [ - "The text to be displayed.", - "The duration in milliseconds for which the text will be\n displayed." + "0 opaque, 100 invisible" ], - "description": "Displays the given text on the screen for a specified duration.", + "description": "Scratch's ghost effect on the backdrop: the stage colour shows through.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "set [ghost v] effect to (transparency)", "since": "" } ], @@ -7112,20 +9486,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/eraseAll", + "id": "Stage/setVolume", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "eraseAll", + "name": "setVolume", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Erases all lines on the pen layer.", + "parameterNames": [ + "volume" + ], + "parameterDescriptions": [ + "this object's volume from 0 to 100" + ], + "description": "", "returnDescription": "", - "scratchblock": "erase all", + "scratchblock": "set volume to (percent) %", "since": "" } ], @@ -7134,20 +9514,29 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/exit", + "id": "Stage/showVariable", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "exit", + "name": "showVariable", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "java.lang.String", + "java.util.function.Supplier" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Close the window and therefore the whole application.", + "parameterNames": [ + "name", + "value" + ], + "parameterDescriptions": [ + "the label", + "gives the value to show" + ], + "description": "Shows a variable in a box at the top left of the stage, like a Scratch monitor; its value is\nread every frame.\n\n```java\nthis.showVariable(\"score\", () -> this.score);\n```", "returnDescription": "", - "scratchblock": "", + "scratchblock": "show variable [name v]", "since": "" } ], @@ -7156,24 +9545,24 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/find", + "id": "Stage/sortBy", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "find", + "name": "sortBy", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "java.util.Comparator" ], - "returns": "java.util.List", + "returns": "void", "parameterNames": [ - "c" + "comparator" ], "parameterDescriptions": [ - "Class" + "the order" ], - "description": "Find sprites of a given class.", + "description": "Draws and runs the sprites of each layer in the order a comparator gives, back to front.", "returnDescription": "", "scratchblock": "", "since": "" @@ -7184,19 +9573,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getAll", + "id": "Stage/sortByY", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getAll", + "name": "sortByY", "constructor": false, "static": false, "parameters": [], - "returns": "java.util.List", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves a list of all sprites in the current stage.", - "returnDescription": "a list containing all sp", + "description": "Draws and runs the sprites of each layer sorted by their y position: lower sprites in front,\nas in a top-down game. Applies from the next tick on, until [stopSorting()](stopSorting).", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7206,20 +9595,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getAnswer", + "id": "Stage/stopAllSounds", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getAnswer", + "name": "stopAllSounds", "constructor": false, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the last answer that was typed in.", - "returnDescription": "the answer, or an empty string if nothing has been answered yet", - "scratchblock": "(answer)", + "description": "Stops every sound this object started.", + "returnDescription": "", + "scratchblock": "stop all sounds", "since": "" } ], @@ -7228,19 +9617,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getCamera", + "id": "Stage/stopSorting", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getCamera", + "name": "stopSorting", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.camera.Camera", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the current camera instance associated with this stage.", - "returnDescription": "the current Camera object.", + "description": "Keeps the order the sprites have now and stops sorting them.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7250,19 +9639,25 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getColor", + "id": "Stage/stopSound", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getColor", + "name": "stopSound", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Color", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current color of the stage.", - "returnDescription": "the current color", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the sound to stop" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7272,42 +9667,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getCurrentBackdropIndex", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ - { - "name": "getCurrentBackdropIndex", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current backdrop index", - "returnDescription": "a backdrop index", - "scratchblock": "(backdrop [number v])", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/getCurrentBackdropName", + "id": "Stage/switchBackdrop", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getCurrentBackdropName", + "name": "switchBackdrop", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current backdrop name", - "returnDescription": "a backdrop name", - "scratchblock": "(backdrop [name v])", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the backdrop's name" + ], + "description": "Switches to the backdrop with that name and tells the stage and every sprite\n(`whenBackdropSwitches`); an unknown name changes nothing.", + "returnDescription": "", + "scratchblock": "switch backdrop to [name v]", "since": "" } ], @@ -7316,19 +9695,25 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getDeltaTime", + "id": "Stage/waitSeconds", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getDeltaTime", + "name": "waitSeconds", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Gets the seconds passed since the last frame.", - "returnDescription": "secons since last frame", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "how long" + ], + "description": "Holds up the code that calls it for a number of seconds. Called in `main` (a program\nwritten straight down the page), the game keeps running meanwhile and the seconds are game\ntime. Called in `run()` or an event, the whole game waits, as it does for any slow\ncode; the window stays responsive.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7338,20 +9723,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getFrameRate", + "id": "Stage/waitUntil", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getFrameRate", + "name": "waitUntil", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Get the frame rate of the application.", - "returnDescription": "the frame rate", - "scratchblock": "", + "parameters": [ + "java.util.function.BooleanSupplier" + ], + "returns": "void", + "parameterNames": [ + "condition" + ], + "parameterDescriptions": [ + "checked about every millisecond" + ], + "description": "Holds up the code that calls it until a condition is true; see [waitSeconds(double)](waitSeconds).", + "returnDescription": "", + "scratchblock": "wait until <condition>", "since": "" } ], @@ -7360,19 +9751,25 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getHeight", + "id": "Stage/whenBackdropSwitches", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getHeight", + "name": "whenBackdropSwitches", "constructor": false, "static": false, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Return the height of the current costume or the pen size, when no costume is\navailable.", - "returnDescription": "the height of the sprite", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name" + ], + "parameterDescriptions": [ + "the new backdrop's name" + ], + "description": "Called when the backdrop switches.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7382,20 +9779,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getMouse", + "id": "Stage/whenIReceive", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getMouse", + "name": "whenIReceive", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current position of the mouse cursor as a Vector2", - "returnDescription": "mouse position", - "scratchblock": "", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "message" + ], + "parameterDescriptions": [ + "the message" + ], + "description": "Called when a message is broadcast.", + "returnDescription": "", + "scratchblock": "when I receive [message v]", "since": "" } ], @@ -7404,20 +9807,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getMouseX", + "id": "Stage/whenKeyPressed", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getMouseX", + "name": "whenKeyPressed", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current x-position of the mouse cursor", - "returnDescription": "x-position", - "scratchblock": "(mouse x)", + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "void", + "parameterNames": [ + "key" + ], + "parameterDescriptions": [ + "the key" + ], + "description": "Called when a key is pressed, once per press.", + "returnDescription": "", + "scratchblock": "when [space v] key pressed", "since": "" } ], @@ -7426,20 +9835,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getMouseY", + "id": "Stage/whenKeyReleased", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getMouseY", + "name": "whenKeyReleased", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the current y-position of the mouse cursor", - "returnDescription": "y-position", - "scratchblock": "(mouse y)", + "parameters": [ + "org.openpatch.scratch.KeyCode" + ], + "returns": "void", + "parameterNames": [ + "key" + ], + "parameterDescriptions": [ + "the key" + ], + "description": "Called when a key is released.", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -7448,41 +9863,53 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getPixels", + "id": "Stage/whenMouseClicked", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getPixels", + "name": "whenMouseClicked", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.pixels.Pixels", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the colours of everything this stage has drawn.\n\nExample usage:\n\n```java\nint[] colours = this.getPixels().main();\n```", - "returnDescription": "the pixels", - "scratchblock": "", + "parameters": [ + "org.openpatch.scratch.MouseCode" + ], + "returns": "void", + "parameterNames": [ + "button" + ], + "parameterDescriptions": [ + "the button" + ], + "description": "Called when a mouse button is pressed anywhere on the stage.", + "returnDescription": "", + "scratchblock": "when stage clicked", "since": "" } ], - "status": "desktop-only", - "reason": "The desktop pixel buffer is not exposed by the browser renderer.", + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "Stage/getShaders", + "id": "Stage/whenMouseWheelMoved", "owner": "org.openpatch.scratch.Stage", "signatures": [ { - "name": "getShaders", + "name": "whenMouseWheelMoved", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shaders", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the shaders of this stage. Shader handling lives behind this one\nmethod so that it does not crowd the everyday API.\n\nExample usage:\n\n```java\nthis.getShaders().add(\"blur\", \"blur.frag\", null);\nthis.getShaders().switchTo(\"blur\");\n```\n\nSeveral shaders can be active at once with `activate`: the stage\ndraws with each in turn, in the order they were added.", - "returnDescription": "the shaders", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "steps" + ], + "parameterDescriptions": [ + "notches; positive is towards the user" + ], + "description": "Called when the mouse wheel turns.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7492,19 +9919,28 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getSorting", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/addFont", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getSorting", + "name": "addFont", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.sorting.Sorting", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the order in which the sprites of this stage are drawn.\n\nExample usage:\n\n```java\nthis.getSorting().byY();\n```", - "returnDescription": "the sorting", + "parameters": [ + "java.lang.String", + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "name", + "path" + ], + "parameterDescriptions": [ + "the font's name", + "the TTF or OTF file" + ], + "description": "Adds a font this text can switch to; the first one added is used.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7514,38 +9950,78 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getTimer", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/constructor", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getTimer", - "constructor": false, + "name": "Text", + "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Timer", + "returns": "org.openpatch.scratch.Text", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the timer", - "returnDescription": "the timer", - "scratchblock": "(timer)", + "description": "An empty plain text at (0, 0).", + "returnDescription": "", + "scratchblock": "", "since": "" }, { - "name": "getTimer", - "constructor": false, + "name": "Text", + "constructor": true, "static": false, "parameters": [ - "java.lang.String" + "java.lang.String", + "double", + "double", + "double" ], - "returns": "org.openpatch.scratch.Timer", + "returns": "org.openpatch.scratch.Text", "parameterNames": [ - "name" + "text", + "x", + "y", + "width" ], "parameterDescriptions": [ - "a name" + "what it says", + "x of its position", + "y of its position (the first line's baseline)", + "where lines wrap; 0 for no wrapping" ], - "description": "Returns a timer by name", - "returnDescription": "the timer", + "description": "A plain text.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "Text", + "constructor": true, + "static": false, + "parameters": [ + "java.lang.String", + "double", + "double", + "double", + "org.openpatch.scratch.TextStyle" + ], + "returns": "org.openpatch.scratch.Text", + "parameterNames": [ + "text", + "x", + "y", + "width", + "style" + ], + "parameterDescriptions": [ + "what it says", + "x of its position", + "y of its position: the first baseline for plain text, the bottom edge of a box", + "where lines wrap; 0 for no wrapping", + "plain, box, speech or thought bubble" + ], + "description": "A text in a style.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -7555,20 +10031,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getVolume", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getAlign", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getVolume", + "name": "getAlign", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "org.openpatch.scratch.TextAlign", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns how loud the sounds of this stage play.", - "returnDescription": "the volume, from 0 to 100", - "scratchblock": "(volume)", + "description": "", + "returnDescription": "the alignment", + "scratchblock": "", "since": "" } ], @@ -7577,19 +10053,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/getWidth", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getCurrentFontIndex", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getWidth", + "name": "getCurrentFontIndex", "constructor": false, "static": false, "parameters": [], "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "Return the width of the current costume or the pen size, when no costume is\navailable.", - "returnDescription": "the width of the sprite", + "description": "", + "returnDescription": "the number of the font in use, counting from 0; -1 for the default font", "scratchblock": "", "since": "" } @@ -7599,26 +10075,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/hideVariable", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getCurrentFontName", + "owner": "org.openpatch.scratch.Text", "signatures": [ - { - "name": "hideVariable", - "constructor": false, - "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the name the monitor was shown with" - ], - "description": "Hides the monitor of a variable that [showVariable(String,\njava.util.function.Supplier)](showVariable(String,\njava.util.function.Supplier)) showed.", - "returnDescription": "", - "scratchblock": "hide variable [name v]", + { + "name": "getCurrentFontName", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the name of the font in use, or null for the default font", + "scratchblock": "", "since": "" } ], @@ -7627,19 +10097,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/isAsking", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getDefaultFont", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "isAsking", + "name": "getDefaultFont", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "boolean", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks whether a question is on screen and still waiting for an answer.", - "returnDescription": "true while a question is waiting", + "description": "", + "returnDescription": "the default font file", "scratchblock": "", "since": "" } @@ -7649,19 +10119,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/isDebug", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getDefaultFontSize", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "isDebug", + "name": "getDefaultFontSize", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "boolean", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks if the application is in debug mode.", - "returnDescription": "true if the application is in debug mode, false otherwise.", + "description": "", + "returnDescription": "the default font size", "scratchblock": "", "since": "" } @@ -7671,26 +10141,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/isKeyPressed", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getFont", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "isKeyPressed", + "name": "getFont", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.KeyCode" - ], - "returns": "boolean", - "parameterNames": [ - "keyCode" - ], - "parameterDescriptions": [ - "a key" - ], - "description": "Returns true if the key is pressed", - "returnDescription": "key pressed", - "scratchblock": "<key [space v] pressed?>", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the font file, or null for the default font", + "scratchblock": "", "since": "" } ], @@ -7699,20 +10163,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/isMouseDown", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getLayer", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "isMouseDown", + "name": "getLayer", "constructor": false, "static": false, "parameters": [], - "returns": "boolean", + "returns": "org.openpatch.scratch.Layer", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns true is the mouse button is down", - "returnDescription": "mouse button down", - "scratchblock": "<mouse down?>", + "description": "", + "returnDescription": "the layer", + "scratchblock": "", "since": "" } ], @@ -7721,25 +10185,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/isSoundPlaying", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getPosition", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "isSoundPlaying", + "name": "getPosition", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "boolean", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "" - ], - "description": "Returns true if the sound if playing", - "returnDescription": "playing", + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the position", "scratchblock": "", "since": "" } @@ -7749,20 +10207,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/nextBackdrop", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getStage", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "nextBackdrop", + "name": "getStage", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Stage", "parameterNames": [], "parameterDescriptions": [], - "description": "Switch to the next backdrop.", - "returnDescription": "", - "scratchblock": "next backdrop", + "description": "", + "returnDescription": "the stage the text is on (a sprite's text: the sprite's stage), or null", + "scratchblock": "", "since": "" } ], @@ -7771,29 +10229,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/pickRandom", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getStyle", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "pickRandom", + "name": "getStyle", "constructor": false, "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "int", - "parameterNames": [ - "from", - "to" - ], - "parameterDescriptions": [ - "the lower bound of the range (inclusive)", - "the upper bound of the range (inclusive)" - ], - "description": "Returns a random integer between the specified range (inclusive).", - "returnDescription": "a random integer between `from` and `to` (inclusive)", - "scratchblock": "(pick random (from) to (to))", + "parameters": [], + "returns": "org.openpatch.scratch.TextStyle", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the style", + "scratchblock": "", "since": "" } ], @@ -7802,26 +10251,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/playSound", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getText", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "playSound", + "name": "getText", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the sound name" - ], - "description": "Plays a sound.\n\nplaySoundCopy() returns an independent SoundPlayback with its own volume\nand can overlap earlier plays of the same sound.", - "returnDescription": "", - "scratchblock": "start sound [name v]", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "what the text says", + "scratchblock": "", "since": "" } ], @@ -7830,28 +10273,19 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/playSoundCopy", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getTextSize", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "playSoundCopy", + "name": "getTextSize", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "double" - ], - "returns": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "parameterNames": [ - "name", - "volume" - ], - "parameterDescriptions": [ - "a sound already added with addSound()", - "volume from 0 to 100 percent" - ], - "description": "Starts a separate copy of a sound at its own volume. Calling this again\ncan overlap the previous copy. The returned handle controls only this play;\nstopSound() and stopAllSounds() also stop copies owned by this stage.\nThe stage's ordinary volume does not change a copy's explicit volume.", - "returnDescription": "this individual playback, also usable in try-with-resources", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the font size, or the default", "scratchblock": "", "since": "" } @@ -7861,20 +10295,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/previousBackdrop", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getWidth", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "previousBackdrop", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Switch to the previous backdrop.", - "returnDescription": "", - "scratchblock": "switch backdrop to [previous backdrop v]", + "description": "", + "returnDescription": "where lines wrap; 0 for no wrapping", + "scratchblock": "", "since": "" } ], @@ -7883,20 +10317,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/randomBackdrop", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getX", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "randomBackdrop", + "name": "getX", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Switch to a random backdrop.", - "returnDescription": "", - "scratchblock": "switch backdrop to [random backdrop v]", + "description": "", + "returnDescription": "x of the position", + "scratchblock": "", "since": "" } ], @@ -7905,83 +10339,76 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/remove", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/getY", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "remove", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Sprite" - ], - "returns": "void", - "parameterNames": [ - "sprite" - ], - "parameterDescriptions": [ - "the sprite to be removed" - ], - "description": "Removes the specified sprite from the stage.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "remove", + "name": "getY", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Pen" - ], - "returns": "void", - "parameterNames": [ - "pen" - ], - "parameterDescriptions": [ - "the pen to be removed" - ], - "description": "Removes the specified pen from the stage.", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "y of the position", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/goLayersBackwards", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "remove", + "name": "goLayersBackwards", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Text" + "int" ], "returns": "void", "parameterNames": [ - "text" + "number" ], "parameterDescriptions": [ - "the text to be removed" + "how many texts to move behind" ], - "description": "Removes the specified text from the stage.", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "go [backward v] (number) layers", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/goLayersForwards", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "remove", + "name": "goLayersForwards", "constructor": false, "static": false, "parameters": [ - "java.lang.Class" + "int" ], "returns": "void", "parameterNames": [ - "c" + "number" ], "parameterDescriptions": [ - "the class of the sprites to remove" + "how many texts to move in front of" ], - "description": "Removes all sprites of the specified class from the stage.", + "description": "", "returnDescription": "", - "scratchblock": "", + "scratchblock": "go [forward v] (number) layers", "since": "" } ], @@ -7990,20 +10417,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/removeAll", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/goToBackLayer", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "removeAll", + "name": "goToBackLayer", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Removes all elements from the stage.", + "description": "Draws this text behind the other texts.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "go to [back v] layer", "since": "" } ], @@ -8012,20 +10439,20 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/run", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/goToFrontLayer", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "run", + "name": "goToFrontLayer", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Executes the main logic of the stage. This method should be overridden by\nsubclasses to define\nthe specific behavior of the stage.", + "description": "Draws this text in front of the other texts.", "returnDescription": "", - "scratchblock": "", + "scratchblock": "go to [front v] layer", "since": "" } ], @@ -8034,69 +10461,41 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setColor", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/hide", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setColor", - "constructor": false, - "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "h" - ], - "parameterDescriptions": [ - "a hue value [0...255]" - ], - "description": "Sets the background color via a hue value", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "setColor", + "name": "hide", "constructor": false, "static": false, - "parameters": [ - "double", - "double", - "double" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "r", - "g", - "b" - ], - "parameterDescriptions": [ - "a red value [0...255]", - "a green value [0...255]", - "a blue value [0...255]" - ], - "description": "Sets the background color via a rgb value", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Hides the text.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/isVisible", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "setColor", + "name": "isVisible", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void", - "parameterNames": [ - "c" - ], - "parameterDescriptions": [ - "the new color to be set" - ], - "description": "Sets the color of the stage.", - "returnDescription": "", + "parameters": [], + "returns": "boolean", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether the text is shown", "scratchblock": "", "since": "" } @@ -8106,49 +10505,40 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setCursor", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/nextFont", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setCursor", + "name": "nextFont", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "path" - ], - "parameterDescriptions": [ - "a path to an image file, or the name of a built-in sprite" - ], - "description": "Sets the cursor image for the stage.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Switches to the next font added, after the last to the first.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/remove", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "setCursor", + "name": "remove", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "int", - "int" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "path", - "x", - "y" - ], - "parameterDescriptions": [ - "a path to an image file, or the name of a built-in sprite", - "the x-coordinate of the cursor's active spot", - "the y-coordinate of the cursor's active spot" - ], - "description": "Sets the cursor image and its active spot coordinates.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Removes the text from its stage.", "returnDescription": "", "scratchblock": "", "since": "" @@ -8159,24 +10549,24 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setDebug", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setAlign", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setDebug", + "name": "setAlign", "constructor": false, "static": false, "parameters": [ - "boolean" + "org.openpatch.scratch.TextAlign" ], "returns": "void", "parameterNames": [ - "debug" + "align" ], "parameterDescriptions": [ - "a boolean value where `true` enables debug mode and\n `false` disables\n it." + "how lines sit relative to the position" ], - "description": "Enables or disables the debug mode for the application.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -8187,51 +10577,51 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setTint", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setBackgroundColor", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setTint", + "name": "setBackgroundColor", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "r", - "g", - "b" + "color" ], "parameterDescriptions": [ - "a red value [0...255]", - "a green value [0...255]", - "a blue value [0...255]" + "the fill of a box or bubble" ], - "description": "Sets the colour the backdrop is tinted with.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "setTint", + "name": "setBackgroundColor", "constructor": false, "static": false, "parameters": [ + "double", + "double", "double" ], "returns": "void", "parameterNames": [ - "h" + "red", + "green", + "blue" ], "parameterDescriptions": [ - "" + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" ], - "description": "Sets the colour the backdrop is tinted with, as a hue.", + "description": "", "returnDescription": "", - "scratchblock": "set [color v] effect to (h)", + "scratchblock": "", "since": "" } ], @@ -8240,26 +10630,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setTransparency", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setFont", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setTransparency", + "name": "setFont", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], "returns": "void", "parameterNames": [ - "transparency" + "path" ], "parameterDescriptions": [ - "[0...100], 0 solid and 100 invisible" + "the font file for this text, or null for the default font" ], - "description": "Sets how see-through the backdrop is, as Scratch's ghost effect does: 0 is\nthe solid backdrop you start with and 100 is invisible.", + "description": "", "returnDescription": "", - "scratchblock": "set [ghost v] effect to (transparency)", + "scratchblock": "", "since": "" } ], @@ -8268,26 +10658,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/setVolume", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setLayer", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "setVolume", + "name": "setLayer", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Layer" ], "returns": "void", "parameterNames": [ - "percent" + "layer" ], "parameterDescriptions": [ - "0 for silent, 100 for full volume" + "the layer" ], - "description": "Sets how loud every sound of this stage plays.", + "description": "Moves the text to another layer: [Layer.UI](../Layer/UI) keeps it in place when the camera moves;\nany other layer puts it into the world, in front of the foreground.", "returnDescription": "", - "scratchblock": "set volume to (percent) %", + "scratchblock": "", "since": "" } ], @@ -8296,77 +10686,46 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/showVariable", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setPosition", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "showVariable", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.util.function.Supplier" + "double", + "double" ], "returns": "void", "parameterNames": [ - "name", - "value" + "x", + "y" ], "parameterDescriptions": [ - "what the monitor says", - "gives the value to show; asked for it every frame" + "x of the position", + "y of the position" ], - "description": "Shows a monitor for a variable in the top left corner of the stage, like\nScratch's variable monitors: the name and the current value, updated every\nframe. Showing the same name again replaces the monitor.\n\n```java\nthis.showVariable(\"score\", () -> score);\n```", - "returnDescription": "", - "scratchblock": "show variable [name v]", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/stopAllSounds", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ - { - "name": "stopAllSounds", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Stops the playing of all sounds of the stage.", + "description": "", "returnDescription": "", - "scratchblock": "stop all sounds", + "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/stopSound", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "stopSound", + "name": "setPosition", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Vector2" ], "returns": "void", "parameterNames": [ - "name" + "position" ], "parameterDescriptions": [ - "Name of the sound" + "the position" ], - "description": "Stops the playing of the sound with the given name", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -8377,54 +10736,51 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/switchBackdrop", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setStrokeColor", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "switchBackdrop", + "name": "setStrokeColor", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "name" + "color" ], "parameterDescriptions": [ - "the name of a backdrop" + "the outline of a box or bubble" ], - "description": "Switch to a backdrop by name.", + "description": "", "returnDescription": "", - "scratchblock": "switch backdrop to [name v]", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/wait", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + "scratchblock": "", + "since": "" + }, { - "name": "wait", + "name": "setStrokeColor", "constructor": false, "static": false, "parameters": [ - "int" + "double", + "double", + "double" ], "returns": "void", "parameterNames": [ - "millis" + "red", + "green", + "blue" ], "parameterDescriptions": [ - "Milliseconds" + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" ], - "description": "Stop the execution of the whole applications for the given milliseconds.", + "description": "", "returnDescription": "", - "scratchblock": "wait (millis) seconds", + "scratchblock": "", "since": "" } ], @@ -8433,26 +10789,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/waitUntil", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setStyle", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "waitUntil", + "name": "setStyle", "constructor": false, "static": false, "parameters": [ - "java.util.function.BooleanSupplier" + "org.openpatch.scratch.TextStyle" ], "returns": "void", "parameterNames": [ - "condition" + "style" ], "parameterDescriptions": [ - "checked over and over until it is true" + "plain, box, speech or thought bubble" ], - "description": "Waits until something becomes true, then carries on.\n\nLike [wait(int)](wait) this holds up the code that calls it, not the whole\nprogram: sprites keep running and the stage keeps drawing while it waits.\nThat makes it useful for setting a scene up in a constructor, and a bad idea\ninside `run()`, which is called once per frame and should return quickly.\n\n```java\nthis.ask(\"What is your name?\");\nthis.waitUntil(() -> !this.isAsking());\nthis.display(\"Hello \" + this.getAnswer() + \"!\");\n```", + "description": "", "returnDescription": "", - "scratchblock": "wait until <condition>", + "scratchblock": "", "since": "" } ], @@ -8461,54 +10817,51 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/whenBackdropSwitches", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setTextColor", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "whenBackdropSwitches", + "name": "setTextColor", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "name" + "color" ], "parameterDescriptions": [ - "the name of the backdrop to switch to" + "the colour of the letters" ], - "description": "This method is called when the backdrop switches to the specified name.\nOverride this method to\nadd custom behavior.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Stage/whenIReceive", - "owner": "org.openpatch.scratch.Stage", - "signatures": [ + }, { - "name": "whenIReceive", + "name": "setTextColor", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "double", + "double", + "double" ], "returns": "void", "parameterNames": [ - "message" + "red", + "green", + "blue" ], "parameterDescriptions": [ - "The message that triggers this method." + "red from 0 to 255", + "green from 0 to 255", + "blue from 0 to 255" ], - "description": "This method is called when a specific message is received. Override this\nmethod to add custom\nbehavior.", + "description": "", "returnDescription": "", - "scratchblock": "when I receive [message v]", + "scratchblock": "", "since": "" } ], @@ -8517,26 +10870,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/whenKeyPressed", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setTextSize", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "whenKeyPressed", + "name": "setTextSize", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double" ], "returns": "void", "parameterNames": [ - "keyCode" + "size" ], "parameterDescriptions": [ - "the key that was pressed" + "the font size in stage units (in pixel-art mode rounded to whole font pixels when\n drawn)" ], - "description": "This method is called when a key is pressed. Override this method to add\ncustom behavior.", + "description": "", "returnDescription": "", - "scratchblock": "when [space v] key pressed", + "scratchblock": "", "since": "" } ], @@ -8545,24 +10898,24 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/whenKeyReleased", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setWidth", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "whenKeyReleased", + "name": "setWidth", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.KeyCode" + "double" ], "returns": "void", "parameterNames": [ - "keyCode" + "width" ], "parameterDescriptions": [ - "the key that was released" + "where lines wrap, in stage units; 0 for no wrapping" ], - "description": "This method is called when a key is released. Override this method to add\ncustom behavior.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -8573,26 +10926,26 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/whenMouseClicked", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setX", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "whenMouseClicked", + "name": "setX", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.MouseCode" + "double" ], "returns": "void", "parameterNames": [ - "mouseEvent" + "x" ], "parameterDescriptions": [ - "The mouse event that triggered this method." + "x of the position" ], - "description": "This method is called when a mouse click event occurs. Overwrite this method\nto add custom\nbehavior.", + "description": "", "returnDescription": "", - "scratchblock": "when stage clicked", + "scratchblock": "", "since": "" } ], @@ -8601,24 +10954,24 @@ "missingBrowserSignatures": [] }, { - "id": "Stage/whenMouseWheelMoved", - "owner": "org.openpatch.scratch.Stage", + "id": "Text/setY", + "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "whenMouseWheelMoved", + "name": "setY", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], "returns": "void", "parameterNames": [ - "steps" + "y" ], "parameterDescriptions": [ - "the number of steps the mouse wheel has moved. Positive values\n indicate movement\n away from the user, while negative values indicate movement\n towards the user." + "y of the position" ], - "description": "This method is called when the mouse wheel is moved. Overwrite this method to\nadd custom\nbehavior.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -8629,27 +10982,18 @@ "missingBrowserSignatures": [] }, { - "id": "Text/addFont", + "id": "Text/show", "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "addFont", + "name": "show", "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "java.lang.String" - ], + "parameters": [], "returns": "void", - "parameterNames": [ - "name", - "path" - ], - "parameterDescriptions": [ - "the name of the font to be added", - "the path to the font file" - ], - "description": "Adds a new font to the list of fonts if it does not already exist.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Shows the text.", "returnDescription": "", "scratchblock": "", "since": "" @@ -8660,138 +11004,125 @@ "missingBrowserSignatures": [] }, { - "id": "Text/constructor", + "id": "Text/showText", "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "Text", - "constructor": true, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Text", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Constructs a new Text object with default values. The text is initialized to an empty string,\npositioned at (0, 0), with a default size of 0. The text style is set to plain and the text\nis centred on its position, as every text is. Call [setAlign(TextAlign)](setAlign) for anything\nelse.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "Text", - "constructor": true, + "name": "showText", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Sprite" + "java.lang.String" ], - "returns": "org.openpatch.scratch.Text", + "returns": "void", "parameterNames": [ - "s" + "text" ], "parameterDescriptions": [ - "the Sprite to associate with this Text object" + "what it says; an empty text hides a bubble" ], - "description": "Constructs a new Text object associated with a given Sprite.", + "description": "Shows the text with new words until it is changed or hidden.", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "Text", - "constructor": true, + "name": "showText", + "constructor": false, "static": false, "parameters": [ "java.lang.String", - "double", - "double", "double" ], - "returns": "org.openpatch.scratch.Text", + "returns": "void", "parameterNames": [ "text", - "x", - "y", - "width" + "seconds" ], "parameterDescriptions": [ - "the text to be displayed", - "the x-coordinate of the text's position", - "the y-coordinate of the text's position", - "the width of the text" + "what it says", + "how long" ], - "description": "Constructs a new Text object with the specified text, position, and width.", + "description": "Shows the text for a number of seconds of game time, then hides it.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/switchFont", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "Text", - "constructor": true, + "name": "switchFont", + "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double", - "double", - "double", - "org.openpatch.scratch.TextStyle" + "java.lang.String" ], - "returns": "org.openpatch.scratch.Text", + "returns": "void", "parameterNames": [ - "text", - "x", - "y", - "width", - "style" + "name" ], "parameterDescriptions": [ - "the text content to be displayed", - "the x-coordinate of the text's position", - "the y-coordinate of the text's position", - "the width of the text area", - "the style to be applied to the text" + "the name of a font added with [addFont(String, String)](addFont)" ], - "description": "Constructs a new Text object with the specified text, position, width, and style.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Text/useFont", + "owner": "org.openpatch.scratch.Text", + "signatures": [ { - "name": "Text", - "constructor": true, - "static": false, + "name": "useFont", + "constructor": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Text" + "java.lang.String" ], - "returns": "org.openpatch.scratch.Text", + "returns": "void", "parameterNames": [ - "t" + "path" ], "parameterDescriptions": [ - "the Text object to copy" + "a TTF or OTF file" ], - "description": "Copy constructor for the Text class. Creates a new Text object by copying the properties of the\ngiven Text object.", + "description": "The font every text uses unless it sets its own, from now on. Without it, texts use Ubuntu\nMono, or Jersey 10 in pixel-art mode.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Text/getAlign", - "owner": "org.openpatch.scratch.Text", - "signatures": [ + }, { - "name": "getAlign", + "name": "useFont", "constructor": false, - "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.TextAlign", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns where the text sits relative to its position.", - "returnDescription": "the alignment", + "static": true, + "parameters": [ + "java.lang.String", + "double" + ], + "returns": "void", + "parameterNames": [ + "path", + "pixelSize" + ], + "parameterDescriptions": [ + "a TTF or OTF file", + "the size at which one font pixel is one stage pixel" + ], + "description": "A pixel font as default font, with the size at which one of its pixels is one stage pixel:\nfor a pixel font whose outlines do not show its grid (most do: then [useFont(String)](useFont)\nis enough). In pixel-art mode sizes are rounded to whole pixels of it.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -8801,19 +11132,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getCurrentFontIndex", + "id": "Text/whenAddedToStage", "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getCurrentFontIndex", + "name": "whenAddedToStage", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the index of the current font.", - "returnDescription": "the index of the current font", + "description": "Called when the text was added to a stage.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -8823,19 +11154,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getCurrentFontName", + "id": "Text/whenRemovedFromStage", "owner": "org.openpatch.scratch.Text", "signatures": [ { - "name": "getCurrentFontName", + "name": "whenRemovedFromStage", "constructor": false, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the name of the current font.", - "returnDescription": "the name of the current font, or `null` if no fonts are available.", + "description": "Called when the text was removed from its stage.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -8845,19 +11176,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getDefaultFont", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/after", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getDefaultFont", + "name": "after", "constructor": false, - "static": true, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the font that text is written in by default.", - "returnDescription": "the path to the font file", + "static": false, + "parameters": [ + "double" + ], + "returns": "boolean", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "how long to wait" + ], + "description": "False for a number of seconds from the first call on, true afterwards.", + "returnDescription": "whether that time is over", "scratchblock": "", "since": "" } @@ -8867,19 +11204,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getDefaultFontSize", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/constructor", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getDefaultFontSize", - "constructor": false, - "static": true, + "name": "Timer", + "constructor": true, + "static": false, "parameters": [], - "returns": "int", + "returns": "org.openpatch.scratch.Timer", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the size text is written in by default.", - "returnDescription": "the font size", + "description": "A timer starting now.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -8889,19 +11226,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getFont", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/during", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getFont", + "name": "during", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Retrieves the name of the font.", - "returnDescription": "the name of the font as a String.", + "parameters": [ + "double" + ], + "returns": "boolean", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "how long" + ], + "description": "True for a number of seconds from the first call on, false afterwards.", + "returnDescription": "whether that time is still running", "scratchblock": "", "since": "" } @@ -8911,19 +11254,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getPosition", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/every", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getPosition", + "name": "every", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Retrieves the current position as a Vector2 object.", - "returnDescription": "a Vector2 object representing the current x and y coordinates.", + "parameters": [ + "double" + ], + "returns": "boolean", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "the period" + ], + "description": "True once every number of seconds: the first time that many seconds after the first call,\nthen again each time as many seconds have passed.", + "returnDescription": "whether the period is over", "scratchblock": "", "since": "" } @@ -8933,19 +11282,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getStage", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/getSeconds", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getStage", + "name": "getSeconds", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Stage", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the current stage associated with this object.", - "returnDescription": "the current stage", + "description": "", + "returnDescription": "the seconds of game time since the timer started or was reset", "scratchblock": "", "since": "" } @@ -8955,19 +11304,47 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getStyle", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/interval", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getStyle", + "name": "interval", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.TextStyle", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the style the text is drawn in.", - "returnDescription": "the style, never null", + "parameters": [ + "double" + ], + "returns": "boolean", + "parameterNames": [ + "seconds" + ], + "parameterDescriptions": [ + "how long each phase lasts" + ], + "description": "Alternates: true for a number of seconds, then false for as long, and so on.", + "returnDescription": "whether it is in an \"on\" phase", + "scratchblock": "", + "since": "" + }, + { + "name": "interval", + "constructor": false, + "static": false, + "parameters": [ + "double", + "double" + ], + "returns": "boolean", + "parameterNames": [ + "on", + "off" + ], + "parameterDescriptions": [ + "how long it is true", + "how long it is false" + ], + "description": "Alternates: true for `on` seconds, then false for `off` seconds, and so on.", + "returnDescription": "whether it is in an \"on\" phase", "scratchblock": "", "since": "" } @@ -8977,20 +11354,20 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getTextSize", - "owner": "org.openpatch.scratch.Text", + "id": "Timer/reset", + "owner": "org.openpatch.scratch.Timer", "signatures": [ { - "name": "getTextSize", + "name": "reset", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the size of the text.", - "returnDescription": "the size of the text as an integer", - "scratchblock": "", + "description": "Starts the timer again from 0, and every method below with it.", + "returnDescription": "", + "scratchblock": "reset timer", "since": "" } ], @@ -8999,19 +11376,33 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getWidth", - "owner": "org.openpatch.scratch.Text", + "id": "Transition/constructor", + "owner": "org.openpatch.scratch.Transition", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Transition/fromShader", + "owner": "org.openpatch.scratch.Transition", "signatures": [ { - "name": "getWidth", + "name": "fromShader", "constructor": false, - "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the width of the text.", - "returnDescription": "the width of the text as a double", + "static": true, + "parameters": [ + "java.lang.String" + ], + "returns": "org.openpatch.scratch.Transition", + "parameterNames": [ + "path" + ], + "parameterDescriptions": [ + "the file with the body" + ], + "description": "A transition of your own: a shader body with `from`, `to` (the two pictures),\n`progress` (0 to 1), `uv` and `color`.", + "returnDescription": "the transition", "scratchblock": "", "since": "" } @@ -9021,19 +11412,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getX", - "owner": "org.openpatch.scratch.Text", + "id": "Transition/getName", + "owner": "org.openpatch.scratch.Transition", "signatures": [ { - "name": "getX", + "name": "getName", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the x-coordinate of this object.", - "returnDescription": "the x-coordinate as a double", + "description": "", + "returnDescription": "the built-in name or the shader file", "scratchblock": "", "since": "" } @@ -9043,19 +11434,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/getY", - "owner": "org.openpatch.scratch.Text", + "id": "Transition/toString", + "owner": "org.openpatch.scratch.Transition", "signatures": [ { - "name": "getY", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the y-coordinate of this object.", - "returnDescription": "the y-coordinate as a double", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -9065,26 +11456,41 @@ "missingBrowserSignatures": [] }, { - "id": "Text/goLayersBackwards", - "owner": "org.openpatch.scratch.Text", + "id": "Triangle/constructor", + "owner": "org.openpatch.scratch.Triangle", "signatures": [ { - "name": "goLayersBackwards", - "constructor": false, + "name": "Triangle", + "constructor": true, "static": false, "parameters": [ - "int" + "double", + "double", + "double", + "double", + "double", + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Triangle", "parameterNames": [ - "number" + "x1", + "y1", + "x2", + "y2", + "x3", + "y3" ], "parameterDescriptions": [ - "the number of layers to move the text backwards" + "x of the first corner", + "y of the first corner", + "x of the second corner", + "y of the second corner", + "x of the third corner", + "y of the third corner" ], - "description": "Moves the text backwards by a specified number of layers in the stage. If\nthe text is not on a stage, the method does nothing.", + "description": "", "returnDescription": "", - "scratchblock": "go [backward v] (number) layers", + "scratchblock": "", "since": "" } ], @@ -9093,26 +11499,26 @@ "missingBrowserSignatures": [] }, { - "id": "Text/goLayersForwards", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/add", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "goLayersForwards", + "name": "add", "constructor": false, "static": false, "parameters": [ - "int" + "org.openpatch.scratch.Vector2" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "number" + "v" ], "parameterDescriptions": [ - "the number of layers to move the text forward" + "" ], - "description": "Moves the text forward by a specified number of layers within its stage. If\nthe text is not on a stage, the method does nothing.", - "returnDescription": "", - "scratchblock": "go [forward v] (number) layers", + "description": "Adds another vector and returns the result", + "returnDescription": "the sum", + "scratchblock": "", "since": "" } ], @@ -9121,20 +11527,20 @@ "missingBrowserSignatures": [] }, { - "id": "Text/goToBackLayer", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/angle", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "goToBackLayer", + "name": "angle", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Moves this text to the back layer of the stage, behind every other text on\nit. If the text is not on a stage, the method does nothing.\n\nTexts are drawn on top of the sprites, so this orders a text against the\nother texts rather than against the sprites.", - "returnDescription": "", - "scratchblock": "go to [back v] layer", + "description": "Returns the angle of the vector.", + "returnDescription": "the angle", + "scratchblock": "", "since": "" } ], @@ -9143,20 +11549,20 @@ "missingBrowserSignatures": [] }, { - "id": "Text/goToFrontLayer", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/clone", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "goToFrontLayer", + "name": "clone", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [], "parameterDescriptions": [], - "description": "Moves this text to the front layer of the stage, in front of every other\ntext on it. If the text is not on a stage, the method does nothing.\n\nTexts are drawn on top of the sprites, so this orders a text against the\nother texts rather than against the sprites.", - "returnDescription": "", - "scratchblock": "go to [front v] layer", + "description": "Creates a clone of the vector", + "returnDescription": "the cloned vector", + "scratchblock": "", "since": "" } ], @@ -9165,40 +11571,59 @@ "missingBrowserSignatures": [] }, { - "id": "Text/isUI", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/constructor", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "isUI", - "constructor": false, + "name": "Vector2", + "constructor": true, "static": false, "parameters": [], - "returns": "boolean", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks if the current instance is a UI element.", - "returnDescription": "`true` if this instance is a UI element, `false` otherwise.", + "description": "Constructor for the null vector.", + "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Text/nextFont", - "owner": "org.openpatch.scratch.Text", - "signatures": [ + }, { - "name": "nextFont", - "constructor": false, + "name": "Vector2", + "constructor": true, + "static": false, + "parameters": [ + "double", + "double" + ], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [ + "x", + "y" + ], + "parameterDescriptions": [ + "x-coordinate", + "y-coordinate" + ], + "description": "Constructor for a 2D vector.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "Vector2", + "constructor": true, "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Advances to the next font in the list of available fonts. The current font index is incremented\nby one and wraps around to the beginning of the list if it exceeds the number of available\nfonts.", + "parameters": [ + "org.openpatch.scratch.Vector2" + ], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [ + "v" + ], + "parameterDescriptions": [ + "a vector" + ], + "description": "Copy constructor for copying a vector.", "returnDescription": "", "scratchblock": "", "since": "" @@ -9209,19 +11634,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/remove", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/direction", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "remove", + "name": "direction", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "Removes this object from its current stage if it is associated with one. If the object is not\nassociated with any stage, this method does nothing.", - "returnDescription": "", + "description": "Returns the direction of the vector in Scratch's degrees: 0 points up, 90 to the right, 180\ndown and 270 to the left, the way `setDirection` on a sprite counts. [angle()](angle)\ncounts the mathematical way instead (0 to the right, anticlockwise).", + "returnDescription": "the direction in degrees between 0 (inclusive) and 360 (exclusive)", "scratchblock": "", "since": "" } @@ -9231,25 +11656,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setAlign", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/distance", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setAlign", + "name": "distance", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.TextAlign" + "org.openpatch.scratch.Vector2" ], - "returns": "void", + "returns": "double", "parameterNames": [ - "align" + "v" ], "parameterDescriptions": [ - "where the text should sit relative to its position" + "a vector" ], - "description": "Sets the alignment of the text.", - "returnDescription": "", + "description": "Calculates the distance to another vector.", + "returnDescription": "the distance", "scratchblock": "", "since": "" } @@ -9259,69 +11684,53 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setBackgroundColor", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/distanceSq", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setBackgroundColor", - "constructor": false, - "static": false, - "parameters": [ - "int", - "int", - "int" - ], - "returns": "void", - "parameterNames": [ - "r", - "g", - "b" - ], - "parameterDescriptions": [ - "the red component of the color (0-255)", - "the green component of the color (0-255)", - "the blue component of the color (0-255)" - ], - "description": "Sets the background color using the specified RGB values.", - "returnDescription": "", - "scratchblock": "", - "since": "" - }, - { - "name": "setBackgroundColor", + "name": "distanceSq", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Vector2" ], - "returns": "void", + "returns": "double", "parameterNames": [ - "h" + "v" ], "parameterDescriptions": [ - "the hue value for the background color" + "a vector" ], - "description": "Sets the background color using the specified hue value.", - "returnDescription": "", + "description": "Calculates the squared distance to another vector.", + "returnDescription": "the squared distance", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/dot", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setBackgroundColor", + "name": "dot", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "org.openpatch.scratch.Vector2" ], - "returns": "void", + "returns": "double", "parameterNames": [ - "c" + "v" ], "parameterDescriptions": [ - "the new background color to be set" + "a vector" ], - "description": "Sets the background color of the text.", - "returnDescription": "", + "description": "Calculates the dot product.", + "returnDescription": "the dot product", "scratchblock": "", "since": "" } @@ -9331,25 +11740,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setFont", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/equals", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setFont", + "name": "equals", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "java.lang.Object" ], - "returns": "void", + "returns": "boolean", "parameterNames": [ - "name" + "obj" ], "parameterDescriptions": [ - "the name of the font to be set" + "the object to compare with" ], - "description": "Sets the font name for the text.", - "returnDescription": "", + "description": "Compares this vector with another object.", + "returnDescription": "true if the other object is a vector with the same x- and y-coordinate", "scratchblock": "", "since": "" } @@ -9359,25 +11768,28 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setIsUI", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/fromPolar", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setIsUI", + "name": "fromPolar", "constructor": false, - "static": false, + "static": true, "parameters": [ - "boolean" + "double", + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "isUI" + "magnitude", + "angle" ], "parameterDescriptions": [ - "a boolean indicating whether this object is part of the UI" + "of the vector", + "of the vector" ], - "description": "Sets the UI status of this object.", - "returnDescription": "", + "description": "Constructor method for constructing a vector based on polar coordinates.", + "returnDescription": "a vector", "scratchblock": "", "since": "" } @@ -9387,47 +11799,41 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setPosition", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/getX", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setPosition", + "name": "getX", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void", - "parameterNames": [ - "x", - "y" - ], - "parameterDescriptions": [ - "a x coordinate", - "a y coordinate" - ], - "description": "Sets the position of the text", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the x coordinate of the vector", + "returnDescription": "the x coordinate", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/getY", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setPosition", + "name": "getY", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "the Vector2 object containing the x and y coordinates" - ], - "description": "Sets the position of the text object using a Vector2 object.", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the y coordinate of the vector", + "returnDescription": "the y coordinate", "scratchblock": "", "since": "" } @@ -9437,69 +11843,63 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setStrokeColor", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/hashCode", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setStrokeColor", + "name": "hashCode", "constructor": false, "static": false, - "parameters": [ - "int", - "int", - "int" - ], - "returns": "void", - "parameterNames": [ - "r", - "g", - "b" - ], - "parameterDescriptions": [ - "the red component of the color (0-255)", - "the green component of the color (0-255)", - "the blue component of the color (0-255)" - ], - "description": "Sets the stroke color using the specified RGB values.", - "returnDescription": "", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the hash code of the vector. Vectors that are equal have the same hash code, which is\nwhat lets them be used as keys in a `HashMap`.", + "returnDescription": "the hash code of the vector", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/length", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setStrokeColor", + "name": "length", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "h" - ], - "parameterDescriptions": [ - "the hue value for the stroke color" - ], - "description": "Sets the stroke color using the specified hue value.", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Calculates the length of the vector.", + "returnDescription": "the length of the vector", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/lengthSq", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setStrokeColor", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.Color" - ], - "returns": "void", - "parameterNames": [ - "c" - ], - "parameterDescriptions": [ - "the color to set as the stroke color" - ], - "description": "Sets the stroke color for the text.", - "returnDescription": "", + "name": "lengthSq", + "constructor": false, + "static": false, + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Calculates the squared length of the vector.", + "returnDescription": "the squared length of the vector", "scratchblock": "", "since": "" } @@ -9509,25 +11909,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setStyle", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/multiply", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setStyle", + "name": "multiply", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.TextStyle" + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "style" + "scalar" ], "parameterDescriptions": [ - "the TextStyle to be applied to the text" + "a scalar" ], - "description": "Sets the style of the text.", - "returnDescription": "", + "description": "Multiplies a scalar and return the result.", + "returnDescription": "the vector", "scratchblock": "", "since": "" } @@ -9537,69 +11937,69 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setTextColor", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/normalVector", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setTextColor", + "name": "normalVector", "constructor": false, "static": false, - "parameters": [ - "int", - "int", - "int" - ], - "returns": "void", - "parameterNames": [ - "r", - "g", - "b" - ], - "parameterDescriptions": [ - "the red component of the color (0-255)", - "the green component of the color (0-255)", - "the blue component of the color (0-255)" - ], - "description": "Sets the text color using RGB values.", - "returnDescription": "", + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the normal vector, which is perpendicular to the vector.", + "returnDescription": "a normal vector", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/reverse", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setTextColor", + "name": "reverse", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "h" - ], - "parameterDescriptions": [ - "the hue value for the text color" - ], - "description": "Sets the text color using the specified hue value.", - "returnDescription": "", + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Reverses a vector and returns the result.", + "returnDescription": "the reversed vector", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Vector2/rotateBy", + "owner": "org.openpatch.scratch.Vector2", + "signatures": [ { - "name": "setTextColor", + "name": "rotateBy", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Color" + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "c" + "angle" ], "parameterDescriptions": [ - "the new color to be set for the text" + "an angle between [0, ..., 360]" ], - "description": "Sets the color of the text.", - "returnDescription": "", + "description": "Rotates the vector by an angle and returns the result.", + "returnDescription": "the rotated vector", "scratchblock": "", "since": "" } @@ -9609,25 +12009,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setTextSize", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/rotateTo", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setTextSize", + "name": "rotateTo", "constructor": false, "static": false, "parameters": [ - "int" + "double" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "size" + "angle" ], "parameterDescriptions": [ - "the new size of the text" + "an angle between [0,...,360]" ], - "description": "Sets the size of the text.", - "returnDescription": "", + "description": "Rotates the vector to a given angle and returns the result.", + "returnDescription": "the rotated vector", "scratchblock": "", "since": "" } @@ -9637,25 +12037,25 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setWidth", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/sub", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setWidth", + "name": "sub", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Vector2" ], - "returns": "void", + "returns": "org.openpatch.scratch.Vector2", "parameterNames": [ - "width" + "v" ], "parameterDescriptions": [ - "the new width to set" + "" ], - "description": "Sets the width of the text.", - "returnDescription": "", + "description": "Substracts another vector and returns the result", + "returnDescription": "the difference", "scratchblock": "", "since": "" } @@ -9665,25 +12065,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setX", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/toString", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setX", + "name": "toString", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "x" - ], - "parameterDescriptions": [ - "the new x-coordinate value" - ], - "description": "Sets the x-coordinate for this object.", - "returnDescription": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the vector as a text, for example `Vector2[60.0, 80.0]`.", + "returnDescription": "the vector as a text", "scratchblock": "", "since": "" } @@ -9693,25 +12087,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/setY", - "owner": "org.openpatch.scratch.Text", + "id": "Vector2/unitVector", + "owner": "org.openpatch.scratch.Vector2", "signatures": [ { - "name": "setY", + "name": "unitVector", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "y" - ], - "parameterDescriptions": [ - "the new Y coordinate value" - ], - "description": "Sets the Y coordinate of the text.", - "returnDescription": "", + "parameters": [], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the unit vector.", + "returnDescription": "a unit vector", "scratchblock": "", "since": "" } @@ -9721,124 +12109,112 @@ "missingBrowserSignatures": [] }, { - "id": "Text/showText", - "owner": "org.openpatch.scratch.Text", + "id": "Window/constructor", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "showText", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "text" - ], - "parameterDescriptions": [ - "The text to be displayed. If the text is null or empty, the text will be set to\n null." - ], - "description": "Displays the specified text.", + "parameters": [], + "returns": "org.openpatch.scratch.Window", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A window of 480 × 360, Scratch's stage size.", "returnDescription": "", "scratchblock": "", "since": "" }, { - "name": "showText", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, "parameters": [ - "java.lang.String", - "int" + "java.lang.String" ], - "returns": "void", + "returns": "org.openpatch.scratch.Window", "parameterNames": [ - "text", - "millis" + "assets" ], "parameterDescriptions": [ - "The text to be displayed.", - "The duration in milliseconds for which the text should be displayed." + "the folder, e.g. `\"assets\"`" ], - "description": "Displays the specified text for a given duration.", + "description": "A window of 480 × 360 that loads every image, sound and font in a folder before the first\nframe, showing a loading screen.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Text/switchFont", - "owner": "org.openpatch.scratch.Text", - "signatures": [ + }, { - "name": "switchFont", - "constructor": false, + "name": "Window", + "constructor": true, "static": false, "parameters": [ - "java.lang.String" + "int", + "int" ], - "returns": "void", + "returns": "org.openpatch.scratch.Window", "parameterNames": [ - "name" + "width", + "height" ], "parameterDescriptions": [ - "the name of the font to switch to" + "the stage width", + "the stage height" ], - "description": "Switches the current font to the font with the specified name.", + "description": "A window whose stage has this size in stage pixels. The window opens at that size (in pixel\nart at the largest whole multiple that fits the screen) and scales the stage to fit when it\nis resized.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Text/useFont", - "owner": "org.openpatch.scratch.Text", - "signatures": [ + }, { - "name": "useFont", - "constructor": false, - "static": true, + "name": "Window", + "constructor": true, + "static": false, "parameters": [ - "java.lang.String", - "int" + "int", + "int", + "java.lang.String" ], - "returns": "void", - "parameterNames": [ - "path", - "size" + "returns": "org.openpatch.scratch.Window", + "parameterNames": [ + "width", + "height", + "assets" ], "parameterDescriptions": [ - "the path to a .ttf or .otf file", - "the size to write in" + "the stage width", + "the stage height", + "the folder, or null" ], - "description": "Chooses the font all text is written in, and how big it is.\n\nCall it before the first stage is created. The font is loaded while the\nwindow starts up, so choosing one later is not reliable.\n\n```java\npublic static void main(String[] args) {\n Text.useFont(\"assets/Retro Gaming.ttf\", 11);\n new MyStage();\n}\n```", + "description": "A window of a size that loads a folder of assets first.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/debug", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "useFont", + "name": "debug", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String" + "java.lang.Object[]" ], "returns": "void", "parameterNames": [ - "path" + "values" ], "parameterDescriptions": [ - "the path to a .ttf or .otf file" + "what to print" ], - "description": "Chooses the font all text is written in, keeping the current size.", + "description": "Prints values, but only in debug mode.", "returnDescription": "", "scratchblock": "", "since": "" @@ -9849,24 +12225,18 @@ "missingBrowserSignatures": [] }, { - "id": "Text/useFontSizes", - "owner": "org.openpatch.scratch.Text", + "id": "Window/exit", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "useFontSizes", + "name": "exit", "constructor": false, - "static": true, - "parameters": [ - "int[]" - ], + "static": false, + "parameters": [], "returns": "void", - "parameterNames": [ - "sizes" - ], - "parameterDescriptions": [ - "the sizes to prepare" - ], - "description": "Prepares several sizes of the font in advance. Only needed when text is\nshown at more than one size, so that every size looks sharp.", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Ends the program: [whenExits()](whenExits) runs first.", "returnDescription": "", "scratchblock": "", "since": "" @@ -9877,25 +12247,19 @@ "missingBrowserSignatures": [] }, { - "id": "Text/useSmoothing", - "owner": "org.openpatch.scratch.Text", + "id": "Window/getFrameSmoothing", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "useSmoothing", + "name": "getFrameSmoothing", "constructor": false, "static": true, - "parameters": [ - "boolean" - ], - "returns": "void", - "parameterNames": [ - "smooth" - ], - "parameterDescriptions": [ - "true to smooth the letters" - ], - "description": "Chooses whether letters are smoothed. Turn it off for pixel fonts.", - "returnDescription": "", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the frame smoothing in percent, 0 when off", "scratchblock": "", "since": "" } @@ -9905,38 +12269,41 @@ "missingBrowserSignatures": [] }, { - "id": "Text/whenAddedToStage", - "owner": "org.openpatch.scratch.Text", + "id": "Window/getGameSpeed", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "whenAddedToStage", + "name": "getGameSpeed", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "double", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is called when the object is added to the stage. Override this method to define\ncustom behavior when the object is added to the stage.", - "returnDescription": "", + "description": "", + "returnDescription": "the game speed", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/getHeight", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "whenAddedToStage", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void", - "parameterNames": [ - "stage" - ], - "parameterDescriptions": [ - "The stage to which the text is added." - ], - "description": "This method is called when the text is added to the stage. Override this method to define\ncustom behavior when the text.", - "returnDescription": "", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage height in stage pixels", "scratchblock": "", "since": "" } @@ -9946,38 +12313,41 @@ "missingBrowserSignatures": [] }, { - "id": "Text/whenRemovedFromStage", - "owner": "org.openpatch.scratch.Text", + "id": "Window/getInstance", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "whenRemovedFromStage", + "name": "getInstance", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void", + "returns": "org.openpatch.scratch.Window", "parameterNames": [], "parameterDescriptions": [], - "description": "This method is called when the object is removed from the stage. Override this method to define\ncustom behavior that should occur when the object is no longer part of the stage.", - "returnDescription": "", + "description": "", + "returnDescription": "the window, or null before it was created", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/getLibraryTitle", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "whenRemovedFromStage", + "name": "getLibraryTitle", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Stage" - ], - "returns": "void", - "parameterNames": [ - "stage" - ], - "parameterDescriptions": [ - "The stage from which the text is removed." - ], - "description": "This method is called when the text is removed from the stage. Override this method to define\ncustom behavior that should occur.", - "returnDescription": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "\"Scratch for Java\"", "scratchblock": "", "since": "" } @@ -9987,25 +12357,19 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/afterMillis", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/getLibraryVersion", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "afterMillis", + "name": "getLibraryVersion", "constructor": false, "static": false, - "parameters": [ - "int" - ], - "returns": "boolean", - "parameterNames": [ - "millis" - ], - "parameterDescriptions": [ - "the number of milliseconds to check against" - ], - "description": "Checks if the specified number of milliseconds has passed since the method was first called.", - "returnDescription": "true if the specified number of milliseconds has passed since the method was first\n called, false otherwise", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the version of Scratch for Java, e.g. \"7.0.0\"", "scratchblock": "", "since": "" } @@ -10015,19 +12379,19 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/constructor", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/getStage", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "Timer", - "constructor": true, + "name": "getStage", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Timer", + "returns": "org.openpatch.scratch.Stage", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructs a new Timer object.", - "returnDescription": "", + "description": "", + "returnDescription": "the stage shown", "scratchblock": "", "since": "" } @@ -10037,25 +12401,19 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/everyMillis", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/getWidth", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "everyMillis", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "int" - ], - "returns": "boolean", - "parameterNames": [ - "millis" - ], - "parameterDescriptions": [ - "The number of milliseconds to wait before returning true." - ], - "description": "Checks if the specified number of milliseconds has passed since the last time this method\nreturned true.", - "returnDescription": "true if the specified number of milliseconds has passed since the last call that\n returned true, false otherwise.", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the stage width in stage pixels", "scratchblock": "", "since": "" } @@ -10065,25 +12423,19 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/forMillis", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/isDebug", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "forMillis", + "name": "isDebug", "constructor": false, "static": false, - "parameters": [ - "int" - ], + "parameters": [], "returns": "boolean", - "parameterNames": [ - "millis" - ], - "parameterDescriptions": [ - "the number of milliseconds to check against" - ], - "description": "Checks if the specified amount of milliseconds has passed since the method was first called. If\nthe method is called for the first time, it initializes the start time.", - "returnDescription": "true if the current time is less than the start time plus the specified milliseconds,\n false otherwise", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether debug mode is on", "scratchblock": "", "since": "" } @@ -10093,94 +12445,85 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/intervalMillis", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/isPaused", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "intervalMillis", + "name": "isPaused", "constructor": false, "static": false, - "parameters": [ - "int" - ], + "parameters": [], "returns": "boolean", - "parameterNames": [ - "millis" - ], - "parameterDescriptions": [ - "the interval in milliseconds to check" - ], - "description": "Checks if the specified interval in milliseconds has passed.", - "returnDescription": "true if the interval has passed, false otherwise", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether the game is paused", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/isPixelArt", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "intervalMillis", + "name": "isPixelArt", "constructor": false, - "static": false, - "parameters": [ - "int", - "boolean" - ], + "static": true, + "parameters": [], "returns": "boolean", - "parameterNames": [ - "millis", - "skipFirst" - ], - "parameterDescriptions": [ - "the interval in milliseconds to check", - "if true, the first interval will be skipped" - ], - "description": "Checks if the specified interval in milliseconds has passed.", - "returnDescription": "true if the interval has passed, false otherwise", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether pixel-art mode is on", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/isSmoothPixelArt", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "intervalMillis", + "name": "isSmoothPixelArt", "constructor": false, - "static": false, - "parameters": [ - "int", - "int" - ], + "static": true, + "parameters": [], "returns": "boolean", - "parameterNames": [ - "millis1", - "millis2" - ], - "parameterDescriptions": [ - "the first interval in milliseconds to check", - "the second interval in milliseconds to check" - ], - "description": "Checks if the specified interval in milliseconds has passed.", - "returnDescription": "true if the interval has passed, false otherwise", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether the pixel art scrolls smoothly (see [useSmoothPixelArt()](useSmoothPixelArt))", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/isTransitioning", + "owner": "org.openpatch.scratch.Window", + "signatures": [ { - "name": "intervalMillis", + "name": "isTransitioning", "constructor": false, "static": false, - "parameters": [ - "int", - "int", - "boolean" - ], + "parameters": [], "returns": "boolean", - "parameterNames": [ - "millis1", - "millis2", - "skipFirst" - ], - "parameterDescriptions": [ - "the first interval in milliseconds to check", - "the second interval in milliseconds to check", - "if true, the first interval will be skipped" - ], - "description": "Checks if the specified interval in milliseconds has passed.", - "returnDescription": "true if the interval has passed, false otherwise", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "whether a transition is in progress", "scratchblock": "", "since": "" } @@ -10190,20 +12533,20 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/millis", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/pause", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "millis", + "name": "pause", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "int", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the number of milliseconds of game time since the program started.\nGame time stands still while the game is paused and runs slower or faster\nwith the game speed (see [Window.pause()](../Window/pause) and\n[Window.setGameSpeed(double)](../Window/setGameSpeed)); without either, it is the real time.", - "returnDescription": "the milliseconds of game time since the program started", - "scratchblock": "(timer)", + "description": "Pauses the game: no ticks run; keys and the mouse still reach the stage and sprites.", + "returnDescription": "", + "scratchblock": "", "since": "" } ], @@ -10212,20 +12555,20 @@ "missingBrowserSignatures": [] }, { - "id": "Timer/reset", - "owner": "org.openpatch.scratch.Timer", + "id": "Window/resume", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "reset", + "name": "resume", "constructor": false, "static": false, "parameters": [], "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Resets the timer.", + "description": "Goes on after [pause()](pause).", "returnDescription": "", - "scratchblock": "reset timer", + "scratchblock": "", "since": "" } ], @@ -10234,39 +12577,24 @@ "missingBrowserSignatures": [] }, { - "id": "Triangle/constructor", - "owner": "org.openpatch.scratch.Triangle", + "id": "Window/setDebug", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "Triangle", - "constructor": true, + "name": "setDebug", + "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double", - "double", - "double", - "double" + "boolean" ], - "returns": "org.openpatch.scratch.Triangle", + "returns": "void", "parameterNames": [ - "x1", - "y1", - "x2", - "y2", - "x3", - "y3" + "debug" ], "parameterDescriptions": [ - "the x-coordinate of the first vertex", - "the y-coordinate of the first vertex", - "the x-coordinate of the second vertex", - "the y-coordinate of the second vertex", - "the x-coordinate of the third vertex", - "the y-coordinate of the third vertex" + "on or off" ], - "description": "Creates a triangle with the specified vertices.", + "description": "Debug mode shows what its panel in the bottom right corner has ticked: hitboxes, positions,\nthe mouse and camera, touching pairs, hidden sprites, the clones and the frame rate, and it\nlets `debug(\\u2026)` print. F12 switches it too, and `-Dscratch4j.debug=\\u2026` presets\nwhich options are on.", "returnDescription": "", "scratchblock": "", "since": "" @@ -10277,11 +12605,11 @@ "missingBrowserSignatures": [] }, { - "id": "UISprite/changeHeight", - "owner": "org.openpatch.scratch.UISprite", + "id": "Window/setGameSpeed", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "changeHeight", + "name": "setGameSpeed", "constructor": false, "static": false, "parameters": [ @@ -10289,12 +12617,12 @@ ], "returns": "void", "parameterNames": [ - "amount" + "speed" ], "parameterDescriptions": [ - "how many pixels to add to the height" + "the game speed" ], - "description": "Changes the height of the sprite by the given number of pixels.", + "description": "How fast the game runs: 1 is normal, 2 twice as fast, 0.5 half as fast; up to 8. Each tick\nstill is 1/60 s of game time; there are more or fewer of them per second.", "returnDescription": "", "scratchblock": "", "since": "" @@ -10305,24 +12633,24 @@ "missingBrowserSignatures": [] }, { - "id": "UISprite/changeWidth", - "owner": "org.openpatch.scratch.UISprite", + "id": "Window/setStage", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "changeWidth", + "name": "setStage", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Stage" ], "returns": "void", "parameterNames": [ - "amount" + "stage" ], "parameterDescriptions": [ - "how many pixels to add to the width" + "the stage" ], - "description": "Changes the width of the sprite by the given number of pixels.", + "description": "Shows a stage from the next tick on.", "returnDescription": "", "scratchblock": "", "since": "" @@ -10333,18 +12661,18 @@ "missingBrowserSignatures": [] }, { - "id": "UISprite/constructor", - "owner": "org.openpatch.scratch.UISprite", + "id": "Window/step", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "UISprite", - "constructor": true, + "name": "step", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.UISprite", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates a sprite that is drawn as part of the user interface.", + "description": "While paused: runs exactly one tick.", "returnDescription": "", "scratchblock": "", "since": "" @@ -10355,83 +12683,74 @@ "missingBrowserSignatures": [] }, { - "id": "UISprite/disableNineSlice", - "owner": "org.openpatch.scratch.UISprite", + "id": "Window/transitionToStage", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "disableNineSlice", + "name": "transitionToStage", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Stage", + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Lets the whole costume stretch again.", + "parameterNames": [ + "stage", + "seconds" + ], + "parameterDescriptions": [ + "the stage", + "how long" + ], + "description": "Fades to a stage through black.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "UISprite/setHeight", - "owner": "org.openpatch.scratch.UISprite", - "signatures": [ + }, { - "name": "setHeight", + "name": "transitionToStage", "constructor": false, "static": false, "parameters": [ + "java.util.function.Supplier", "double" ], "returns": "void", "parameterNames": [ - "height" + "stage", + "seconds" ], "parameterDescriptions": [ - "the height in pixels" + "makes the stage, e.g. `() -> new Level2()`", + "how long" ], - "description": "Sets the height of the sprite in pixels.", + "description": "Fades to a stage made now, on the game thread: a slow constructor shows the loading screen\ninstead of freezing the window.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "UISprite/setNineSlice", - "owner": "org.openpatch.scratch.UISprite", - "signatures": [ + }, { - "name": "setNineSlice", + "name": "transitionToStage", "constructor": false, "static": false, "parameters": [ - "int", - "int", - "int", - "int" + "java.util.function.Supplier", + "org.openpatch.scratch.Transition", + "double" ], "returns": "void", "parameterNames": [ - "top", - "right", - "bottom", - "left" + "stage", + "transition", + "seconds" ], "parameterDescriptions": [ - "how many pixels of the costume belong to the top edge", - "how many pixels of the costume belong to the right edge", - "how many pixels of the costume belong to the bottom edge", - "how many pixels of the costume belong to the left edge" + "makes the stage", + "how", + "how long" ], - "description": "Keeps the corners and edges of the costume from stretching when the sprite\nis resized, so that a button costume can be made any size.", + "description": "Shows a stage made now through a transition.\n\n```java\nwindow.transitionToStage(() -> new Level2(), Transition.SLIDE_LEFT, 0.5);\n```", "returnDescription": "", "scratchblock": "", "since": "" @@ -10442,53 +12761,73 @@ "missingBrowserSignatures": [] }, { - "id": "UISprite/setWidth", - "owner": "org.openpatch.scratch.UISprite", + "id": "Window/use", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "setWidth", + "name": "use", "constructor": false, - "static": false, + "static": true, "parameters": [ - "double" + "org.openpatch.scratch.extension.Extension" ], "returns": "void", "parameterNames": [ - "width" + "extension" ], "parameterDescriptions": [ - "the width in pixels" + "the extension" ], - "description": "Sets the width of the sprite in pixels.", + "description": "Uses an extension that does not register itself through `META-INF/services` (one in\nyour own project). Call it before `new Window`.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "Extensions load through the desktop's ServiceLoader and run against its window and render threads. The browser ships its extensions natively; it does not load external or custom extensions.", + "missingBrowserSignatures": [ + { + "name": "use", + "constructor": false, + "static": true, + "parameters": [ + "org.openpatch.scratch.extension.Extension" + ], + "returns": "void", + "parameterNames": [ + "extension" + ], + "parameterDescriptions": [ + "the extension" + ], + "description": "Uses an extension that does not register itself through `META-INF/services` (one in\nyour own project). Call it before `new Window`.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "Vector2/add", - "owner": "org.openpatch.scratch.Vector2", + "id": "Window/useFrameSmoothing", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "add", + "name": "useFrameSmoothing", "constructor": false, - "static": false, + "static": true, "parameters": [ - "org.openpatch.scratch.Vector2" + "double" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "v" + "percent" ], "parameterDescriptions": [ - "" + "how much of the previous frame each presented one keeps, 0 to 100" ], - "description": "Adds another vector and returns the result", - "returnDescription": "the sum", + "description": "Frame smoothing: each frame is presented mixed with the one before it, this much in percent.\nA screen that holds each frame until the next (every 60 Hz LCD) smears whatever moves,\nbecause the eye gets one picture per 16.7 ms; two pictures per frame (50 is a good value)\nlook like one picture per 8.3 ms and smear about half as much. The world keeps its pixels:\nthe moment nothing moves, current and previous frame are the same and the picture is fully\nsharp. While things move, edges are softer \\u2014 that is the trade. Call it before\n`new Window`; 0 (the default) turns it off.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10498,19 +12837,41 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/angle", - "owner": "org.openpatch.scratch.Vector2", + "id": "Window/useFullScreen", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "angle", + "name": "useFullScreen", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "double", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the angle of the vector.", - "returnDescription": "the angle", + "description": "Opens the window full screen (a borderless window at the screen's size). Call it before `new Window`.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/usePixelArt", + "owner": "org.openpatch.scratch.Window", + "signatures": [ + { + "name": "usePixelArt", + "constructor": false, + "static": true, + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Pixel-art mode: images are not smoothed, the stage scales by whole numbers only, the default\nfont is Jersey 10 and font sizes are rounded to its pixels. Call it before `new Window`.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10520,19 +12881,19 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/clone", - "owner": "org.openpatch.scratch.Vector2", + "id": "Window/useSmoothPixelArt", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "clone", + "name": "useSmoothPixelArt", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates a clone of the vector", - "returnDescription": "the cloned vector", + "description": "Smooth pixel art (Godot's \"canvas items\" way of showing pixel art): as [usePixelArt()](usePixelArt),\nbut the camera moves without snapping and zoom works at any factor. The world is drawn at the\nwindow's resolution with the sprites still sampled by nearest neighbour, so every pixel stays\na sharp square while things move \\u2014 the grid wobbles by a screen pixel instead of the picture\nstepping whole stage pixels (the look of Hyper Light Drifter, as Godot's guide puts it). With\nit, scrolling does not need [useFrameSmoothing(double)](useFrameSmoothing). Call it before\n`new Window`.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10542,59 +12903,105 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/constructor", - "owner": "org.openpatch.scratch.Vector2", + "id": "Window/useSplashLogo", + "owner": "org.openpatch.scratch.Window", "signatures": [ { - "name": "Vector2", - "constructor": true, + "name": "useSplashLogo", + "constructor": false, + "static": true, + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "path" + ], + "parameterDescriptions": [ + "an image" + ], + "description": "The logo on the loading screen. Call it before `new Window`.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The browser has no desktop splash window. This option only reports a limitation.", + "missingBrowserSignatures": [] + }, + { + "id": "Window/whenExits", + "owner": "org.openpatch.scratch.Window", + "signatures": [ + { + "name": "whenExits", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructor for the null vector.", + "description": "Called when the program ends, on the game thread. Override it to save, say.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "drawing/BitmapText/addGlyph", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "signatures": [ { - "name": "Vector2", - "constructor": true, + "name": "addGlyph", + "constructor": false, "static": false, "parameters": [ - "double", - "double" + "char", + "java.lang.String" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "x", - "y" + "character", + "path" ], "parameterDescriptions": [ - "x-coordinate", - "y-coordinate" + "the character to replace", + "its image or built-in costume name" ], - "description": "Constructor for a 2D vector.", + "description": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "drawing/BitmapText/constructor", + "owner": "org.openpatch.scratch.drawing.BitmapText", + "signatures": [ { - "name": "Vector2", + "name": "BitmapText", "constructor": true, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "java.lang.String" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "org.openpatch.scratch.drawing.BitmapText", "parameterNames": [ - "v" + "pattern" ], "parameterDescriptions": [ - "a vector" + "image path with an integer format, e.g. \"assets/font%03d.png\"" ], - "description": "Copy constructor for copying a vector.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -10605,25 +13012,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/distance", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/draw", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "distance", + "name": "draw", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.drawing.Drawing" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "v" + "drawing" ], "parameterDescriptions": [ - "a vector" + "the current frame's canvas" ], - "description": "Calculates the distance to another vector.", - "returnDescription": "the distance", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10633,25 +13040,19 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/distanceSq", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/getContent", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "distanceSq", + "name": "getContent", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "double", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "a vector" - ], - "description": "Calculates the squared distance to another vector.", - "returnDescription": "the squared distance", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the text being shown", "scratchblock": "", "since": "" } @@ -10661,25 +13062,19 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/dot", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/getHeight", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "dot", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], + "parameters": [], "returns": "double", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "a vector" - ], - "description": "Calculates the dot product.", - "returnDescription": "the dot product", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the displayed text's height, including line spacing and sprite size", "scratchblock": "", "since": "" } @@ -10689,25 +13084,19 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/equals", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/getWidth", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "equals", + "name": "getWidth", "constructor": false, "static": false, - "parameters": [ - "java.lang.Object" - ], - "returns": "boolean", - "parameterNames": [ - "obj" - ], - "parameterDescriptions": [ - "the object to compare with" - ], - "description": "Compares this vector with another object.", - "returnDescription": "true if the other object is a vector with the same x- and y-coordinate", + "parameters": [], + "returns": "double", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "the displayed text's width, including the sprite's size", "scratchblock": "", "since": "" } @@ -10717,28 +13106,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/fromPolar", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/setAlign", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "fromPolar", + "name": "setAlign", "constructor": false, - "static": true, + "static": false, "parameters": [ - "double", - "double" + "org.openpatch.scratch.TextAlign" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "magnitude", - "angle" + "align" ], "parameterDescriptions": [ - "of the vector", - "of the vector" + "LEFT, CENTER or RIGHT (DEFAULT means LEFT)" ], - "description": "Constructor method for constructing a vector based on polar coordinates.", - "returnDescription": "a vector", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10748,19 +13134,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/getX", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/setFont", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "getX", + "name": "setFont", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the x coordinate of the vector", - "returnDescription": "the x coordinate", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "pattern" + ], + "parameterDescriptions": [ + "glyph path with one integer format for the Unicode code point" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10770,19 +13162,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/getY", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/setLetterSpacing", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "getY", + "name": "setLetterSpacing", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the y coordinate of the vector", - "returnDescription": "the y coordinate", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "spacing" + ], + "parameterDescriptions": [ + "gap between characters; negative values allow italic glyphs to overlap" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10792,19 +13190,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/hashCode", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/setLineSpacing", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "hashCode", + "name": "setLineSpacing", "constructor": false, "static": false, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the hash code of the vector. Vectors that are equal have the same hash code, which is\nwhat lets them be used as keys in a `HashMap`.", - "returnDescription": "the hash code of the vector", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "spacing" + ], + "parameterDescriptions": [ + "extra pixels between lines" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10814,19 +13218,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/length", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/setSpaceWidth", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "length", + "name": "setSpaceWidth", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Calculates the length of the vector.", - "returnDescription": "the length of the vector", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "width" + ], + "parameterDescriptions": [ + "width of a space, in unscaled pixels" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10836,19 +13246,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/lengthSq", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/BitmapText/showText", + "owner": "org.openpatch.scratch.drawing.BitmapText", "signatures": [ { - "name": "lengthSq", + "name": "showText", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Calculates the squared length of the vector.", - "returnDescription": "the squared length of the vector", + "parameters": [ + "java.lang.String" + ], + "returns": "void", + "parameterNames": [ + "text" + ], + "parameterDescriptions": [ + "text to show, including spaces and newlines" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10858,25 +13274,34 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/multiply", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/clip", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "multiply", + "name": "clip", "constructor": false, "static": false, "parameters": [ + "double", + "double", + "double", "double" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "scalar" + "x", + "y", + "width", + "height" ], "parameterDescriptions": [ - "a scalar" + "x of its centre", + "y of its centre", + "its width", + "its height" ], - "description": "Multiplies a scalar and return the result.", - "returnDescription": "the vector", + "description": "Draws only inside a rectangle until [noClip()](noClip); a turned sprite clips to the rectangle\naround the turned one.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10886,19 +13311,70 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/normalVector", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/constructor", + "owner": "org.openpatch.scratch.drawing.Drawing", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "drawing/Drawing/image", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "normalVector", + "name": "image", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the normal vector, which is perpendicular to the vector.", - "returnDescription": "a normal vector", + "parameters": [ + "java.lang.String", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "path", + "x", + "y" + ], + "parameterDescriptions": [ + "an image file or a built-in sprite name", + "x of its centre", + "y of its centre" + ], + "description": "An image at its own size, centred on a point.", + "returnDescription": "", + "scratchblock": "", + "since": "" + }, + { + "name": "image", + "constructor": false, + "static": false, + "parameters": [ + "java.lang.String", + "double", + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "path", + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "an image file or a built-in sprite name", + "x of its centre", + "y of its centre", + "the width", + "the height" + ], + "description": "An image stretched to a size, centred on a point.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10908,19 +13384,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/reverse", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/imageHeight", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "reverse", + "name": "imageHeight", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Reverses a vector and returns the result.", - "returnDescription": "the reversed vector", + "parameters": [ + "java.lang.String" + ], + "returns": "int", + "parameterNames": [ + "path" + ], + "parameterDescriptions": [ + "an image file or a built-in sprite name" + ], + "description": "", + "returnDescription": "its height in pixels", "scratchblock": "", "since": "" } @@ -10930,25 +13412,25 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/rotateBy", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/imageWidth", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "rotateBy", + "name": "imageWidth", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "int", "parameterNames": [ - "angle" + "path" ], "parameterDescriptions": [ - "an angle between [0, ..., 360]" + "an image file or a built-in sprite name" ], - "description": "Rotates the vector by an angle and returns the result.", - "returnDescription": "the rotated vector", + "description": "", + "returnDescription": "its width in pixels", "scratchblock": "", "since": "" } @@ -10958,25 +13440,19 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/rotateTo", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/noClip", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "rotateTo", + "name": "noClip", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [ - "angle" - ], - "parameterDescriptions": [ - "an angle between [0,...,360]" - ], - "description": "Rotates the vector to a given angle and returns the result.", - "returnDescription": "the rotated vector", + "parameters": [], + "returns": "void", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Draws everywhere again.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -10986,25 +13462,31 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/sub", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/polygon", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "sub", + "name": "polygon", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "double[]", + "double[]", + "org.openpatch.scratch.Color" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "v" + "x", + "y", + "color" ], "parameterDescriptions": [ - "" + "x of every corner", + "y of every corner", + "the fill" ], - "description": "Substracts another vector and returns the result", - "returnDescription": "the difference", + "description": "A filled polygon.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -11014,19 +13496,37 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/toString", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/Drawing/rectangle", + "owner": "org.openpatch.scratch.drawing.Drawing", "signatures": [ { - "name": "toString", + "name": "rectangle", "constructor": false, "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the vector as a text, for example `Vector2[60.0, 80.0]`.", - "returnDescription": "the vector as a text", + "parameters": [ + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" + ], + "returns": "void", + "parameterNames": [ + "x", + "y", + "width", + "height", + "color" + ], + "parameterDescriptions": [ + "x of its centre", + "y of its centre", + "its width", + "its height", + "the fill" + ], + "description": "A filled rectangle centred on a point.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -11036,289 +13536,247 @@ "missingBrowserSignatures": [] }, { - "id": "Vector2/unitVector", - "owner": "org.openpatch.scratch.Vector2", + "id": "drawing/DrawingExtension/constructor", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", "signatures": [ { - "name": "unitVector", - "constructor": false, + "name": "DrawingExtension", + "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2", + "returns": "org.openpatch.scratch.drawing.DrawingExtension", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the unit vector.", - "returnDescription": "a unit vector", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/constructor", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "Window", + "name": "DrawingExtension", "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Window", + "returns": "org.openpatch.scratch.drawing.DrawingExtension", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructs a new Window with default dimensions. The default width is 480\npixels and the\ndefault height is 360 pixels.\n\nA folder named `assets` is loaded while the loading screen shows, if\nthe project has one.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "drawing/DrawingExtension/id", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "signatures": [ { - "name": "Window", - "constructor": true, + "name": "id", + "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "org.openpatch.scratch.Window", - "parameterNames": [ - "assets" - ], - "parameterDescriptions": [ - "the path to the assets to be used in the window" - ], - "description": "Constructs a new Window with the specified assets. The window will have a\ndefault width of 480\npixels and a height of 360 pixels.\n\nThe images, sounds and fonts in that folder are loaded while the loading\nscreen shows, so they are ready when a sprite first uses them. Without\nit, a folder named `assets` is loaded, if there is one.", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "Window", - "constructor": true, + "name": "id", + "constructor": false, "static": false, - "parameters": [ - "int", - "int" - ], - "returns": "org.openpatch.scratch.Window", - "parameterNames": [ - "width", - "height" - ], - "parameterDescriptions": [ - "the width of the window", - "the height of the window" - ], - "description": "Constructs a new Window with the specified width and height.\n\nA folder named `assets` is loaded while the loading screen shows, if\nthe project has one.", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "drawing/DrawingExtension/install", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", + "signatures": [ { - "name": "Window", - "constructor": true, + "name": "install", + "constructor": false, "static": false, "parameters": [ - "int", - "int", - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext" ], - "returns": "org.openpatch.scratch.Window", + "returns": "void", "parameterNames": [ - "width", - "height", - "assets" + "ctx" ], "parameterDescriptions": [ - "the width of the window", - "the height of the window\n\nThe images, sounds and fonts in the assets folder are loaded while the\nloading screen shows, so they are ready when a sprite first uses them.\nWithout it, a folder named `assets` is loaded, if there is one.", - "the path to the assets" + "" ], - "description": "Constructs a new Window with the specified width, height, and assets path.\nEnsures that only\none instance of Window can be created.\n\nThe single exception is the window Java builds by itself: a class that\nextends Window and has a `main` method which is not static is\ninstantiated by the JVM before `main` is called, so the\n`new MyWindow()` in that `main` would be the second window. That\none reuses the first instead of failing.", + "description": "Every layer gets a drawer that lets the stage's visible drawing sprites of that layer draw,\nback to front.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/debug", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "debug", + "name": "install", "constructor": false, "static": false, "parameters": [ - "java.lang.Object[]" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "values" + "ctx" ], "parameterDescriptions": [ - "one or more values to print" + "" ], - "description": "Prints a debug message to stdout when debug mode is enabled.\nThe message is prefixed with the window's class name.\n\nExample:\n\n```java\nthis.debug(\"fps =\", getFps());\n// prints: [MyWindow] fps = 60\n```", + "description": "Every layer gets a drawer that lets the stage's visible drawing sprites of that layer draw,\nback to front.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/exit", - "owner": "org.openpatch.scratch.Window", + "id": "drawing/DrawingExtension/name", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", "signatures": [ { - "name": "exit", + "name": "name", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Exits the application by invoking the `whenExits` method and then calling the\n`exit` method on\nthe `Applet` instance.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/getDeltaTime", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "getDeltaTime", + "name": "name", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Gets the seconds of game time passed since the last frame. While the game\nis paused this is 0, and at half speed half the real time.", - "returnDescription": "seconds since last frame", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/getGameSpeed", - "owner": "org.openpatch.scratch.Window", + "id": "drawing/DrawingExtension/requires", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", "signatures": [ { - "name": "getGameSpeed", + "name": "requires", "constructor": false, "static": false, "parameters": [], - "returns": "double", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "The game speed set with [setGameSpeed(double)](setGameSpeed).", - "returnDescription": "1 for normal speed", + "description": "First-party extensions are released together with the core.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/getHeight", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "getHeight", + "name": "requires", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Retrieves the height of the current window.", - "returnDescription": "the height of the window in pixels", + "description": "First-party extensions are released together with the core.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/getInstance", - "owner": "org.openpatch.scratch.Window", + "id": "drawing/DrawingExtension/version", + "owner": "org.openpatch.scratch.drawing.DrawingExtension", "signatures": [ { - "name": "getInstance", + "name": "version", "constructor": false, - "static": true, + "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Window", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the singleton instance of the Window class.", - "returnDescription": "the singleton instance of Window", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/getLibraryTitle", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "getLibraryTitle", + "name": "version", "constructor": false, "static": false, "parameters": [], "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the title of the library.", - "returnDescription": "the title of the library as a String", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/getLibraryVersion", - "owner": "org.openpatch.scratch.Window", + "id": "drawing/DrawingSprite/constructor", + "owner": "org.openpatch.scratch.drawing.DrawingSprite", "signatures": [ { - "name": "getLibraryVersion", - "constructor": false, + "name": "DrawingSprite", + "constructor": true, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "org.openpatch.scratch.drawing.DrawingSprite", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the version of the library.", - "returnDescription": "the version of the library as a String", + "description": "A drawing sprite; it has no hitbox unless given one.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -11328,19 +13786,25 @@ "missingBrowserSignatures": [] }, { - "id": "Window/getStage", - "owner": "org.openpatch.scratch.Window", + "id": "drawing/DrawingSprite/draw", + "owner": "org.openpatch.scratch.drawing.DrawingSprite", "signatures": [ { - "name": "getStage", + "name": "draw", "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.Stage", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Retrieves the current stage from the Applet instance.", - "returnDescription": "the current Stage object", + "parameters": [ + "org.openpatch.scratch.drawing.Drawing" + ], + "returns": "void", + "parameterNames": [ + "drawing" + ], + "parameterDescriptions": [ + "what to draw with, in the sprite's own coordinates" + ], + "description": "Draws the sprite; called every frame on the game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -11350,1398 +13814,1512 @@ "missingBrowserSignatures": [] }, { - "id": "Window/getTextureSampling", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/clip", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "getTextureSampling", + "name": "clip", "constructor": false, - "static": true, - "parameters": [], - "returns": "org.openpatch.scratch.TextureSampling", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns how pictures are being smoothed.", - "returnDescription": "the current setting", + "static": false, + "parameters": [ + "double", + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "x of its centre", + "y of its centre", + "its width", + "its height" + ], + "description": "Draws only inside a rectangle (axis-aligned on the screen) until [noClip()](noClip).", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/getWidth", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "getWidth", + "name": "clip", "constructor": false, "static": false, - "parameters": [], - "returns": "int", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Retrieves the width of the current window.", - "returnDescription": "the width of the window in pixels", + "parameters": [ + "double", + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "x of its centre", + "y of its centre", + "its width", + "its height" + ], + "description": "Draws only inside a rectangle (axis-aligned on the screen) until [noClip()](noClip).", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + ] + }, + { + "id": "extension/Canvas/constructor", + "owner": "org.openpatch.scratch.extension.Canvas", + "signatures": [], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "Window/isDebug", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawImage", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "isDebug", + "name": "drawImage", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Checks if the application is in debug mode.\n\nDebug mode can be toggled at runtime by pressing F12.", - "returnDescription": "true if the application is in debug mode, false otherwise.", + "parameters": [ + "java.lang.String", + "double", + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "path", + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "the image", + "x of its centre", + "y of its centre", + "its width", + "its height" + ], + "description": "An image (a file or a built-in sprite name), centred on a point.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/isPaused", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "isPaused", + "name": "drawImage", "constructor": false, "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Whether the game is paused.", - "returnDescription": "true while paused", + "parameters": [ + "java.lang.String", + "double", + "double", + "double", + "double" + ], + "returns": "void", + "parameterNames": [ + "path", + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "the image", + "x of its centre", + "y of its centre", + "its width", + "its height" + ], + "description": "An image (a file or a built-in sprite name), centred on a point.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/isTransitioning", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawImageQuad", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "isTransitioning", + "name": "drawImageQuad", "constructor": false, - "static": true, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns whether a stage transition is in progress, including creation of\nthe destination stage.\n\nWhile a transition is running, calls to\n[transitionToStage(Stage, int)](transitionToStage) are ignored. A program that moves\nthe player or builds a new stage in the same breath as a warp should\nuse [transitionToStage(Supplier, int)](transitionToStage) so those changes are deferred\nuntil the screen is black and skipped when a transition is already running.", - "returnDescription": "`true` while a transition is in progress, `false` otherwise", + "static": false, + "parameters": [ + "java.lang.String", + "int", + "int", + "int", + "int", + "double[]" + ], + "returns": "void", + "parameterNames": [ + "path", + "sx", + "sy", + "sw", + "sh", + "corners" + ], + "parameterDescriptions": [ + "the image", + "the region's left edge in image pixels", + "its top edge", + "its width", + "its height", + "where the region's top-left, top-right, bottom-right and bottom-left corners go:\n `x0, y0, \\u2026, x3, y3`" + ], + "description": "A region of an image on any quad: turned, mirrored, sheared.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/pause", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "pause", + "name": "drawImageQuad", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "java.lang.String", + "int", + "int", + "int", + "int", + "double[]" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Pauses the game: `run()` is no longer called, and timers, gliding\nand animations stand still. The window keeps drawing, so the paused\npicture stays visible, and keys and clicks still reach methods like\n`whenKeyPressed`, so a key can [resume()](resume) the game.", + "parameterNames": [ + "path", + "sx", + "sy", + "sw", + "sh", + "corners" + ], + "parameterDescriptions": [ + "the image", + "the region's left edge in image pixels", + "its top edge", + "its width", + "its height", + "where the region's top-left, top-right, bottom-right and bottom-left corners go:\n `x0, y0, \\u2026, x3, y3`" + ], + "description": "A region of an image on any quad: turned, mirrored, sheared.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/resume", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawImageRegion", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "resume", + "name": "drawImageRegion", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "java.lang.String", + "int", + "int", + "int", + "int", + "double", + "double", + "double", + "double" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Lets a paused game go on where it stopped.", + "parameterNames": [ + "path", + "sx", + "sy", + "sw", + "sh", + "x", + "y", + "width", + "height" + ], + "parameterDescriptions": [ + "the image", + "the region's left edge in image pixels", + "its top edge", + "its width", + "its height", + "x of the centre", + "y of the centre", + "the width to draw it at", + "the height to draw it at" + ], + "description": "A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/setDebug", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "setDebug", + "name": "drawImageRegion", "constructor": false, "static": false, "parameters": [ - "boolean" + "java.lang.String", + "int", + "int", + "int", + "int", + "double", + "double", + "double", + "double" ], "returns": "void", "parameterNames": [ - "debug" + "path", + "sx", + "sy", + "sw", + "sh", + "x", + "y", + "width", + "height" ], "parameterDescriptions": [ - "a boolean value where `true` enables debug mode and\n `false` disables\n it." + "the image", + "the region's left edge in image pixels", + "its top edge", + "its width", + "its height", + "x of the centre", + "y of the centre", + "the width to draw it at", + "the height to draw it at" ], - "description": "Enables or disables the debug mode for the application.\n\nDebug mode shows sprite positions, hitboxes, and other debug information.\nIt can also be toggled at runtime by pressing F12.", + "description": "A region of an image, centred on a point: one tile of a tileset, one glyph of a bitmap font.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/setGameSpeed", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawOutline", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "setGameSpeed", + "name": "drawOutline", "constructor": false, "static": false, "parameters": [ + "double[]", + "double[]", + "org.openpatch.scratch.Color", "double" ], "returns": "void", "parameterNames": [ - "speed" + "xs", + "ys", + "stroke", + "weight" ], "parameterDescriptions": [ - "1 for normal speed, smaller for slower, larger for faster" + "x of every corner", + "y of every corner", + "the outline's colour", + "the outline's width" ], - "description": "Makes the game run slower or faster: 1 is normal, 0.5 half as fast, 2\ntwice as fast. `run()`, timers, gliding and animations all follow,\nso the whole game looks like slow motion; the window keeps drawing\nsmoothly.", + "description": "The outline of a polygon.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/setStage", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "setStage", + "name": "drawOutline", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Stage" + "double[]", + "double[]", + "org.openpatch.scratch.Color", + "double" ], "returns": "void", "parameterNames": [ - "stage" + "xs", + "ys", + "stroke", + "weight" ], "parameterDescriptions": [ - "the new stage to be set" + "x of every corner", + "y of every corner", + "the outline's colour", + "the outline's width" ], - "description": "Sets the current stage of the application.", + "description": "The outline of a polygon.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/step", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawPolygon", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "step", + "name": "drawPolygon", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "double[]", + "double[]", + "org.openpatch.scratch.Color" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "While the game is paused: runs it for exactly one frame (every\n`run()` once) and pauses again. Useful to watch closely what\nhappens, for example when two sprites touch.", + "parameterNames": [ + "xs", + "ys", + "fill" + ], + "parameterDescriptions": [ + "x of every corner", + "y of every corner, in the same order", + "its colour" + ], + "description": "A filled polygon, concave ones included.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/transitionToStage", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "transitionToStage", + "name": "drawPolygon", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Stage", - "int" + "double[]", + "double[]", + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "stage", - "duration" + "xs", + "ys", + "fill" ], "parameterDescriptions": [ - "the new stage to transition to", - "the duration of the transition in milliseconds" + "x of every corner", + "y of every corner, in the same order", + "its colour" ], - "description": "Transitions to a new stage with a specified duration.", + "description": "A filled polygon, concave ones included.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "extension/Canvas/drawRectangle", + "owner": "org.openpatch.scratch.extension.Canvas", + "signatures": [ { - "name": "transitionToStage", + "name": "drawRectangle", "constructor": false, "static": false, "parameters": [ - "java.util.function.Supplier", - "int" + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "stage", - "duration" + "x", + "y", + "width", + "height", + "fill" ], "parameterDescriptions": [ - "creates the destination stage; must return a non-null stage", - "the duration, using the same timing as the Stage overload" + "x of its centre", + "y of its centre", + "its width", + "its height", + "its colour" ], - "description": "Fades to black, creates the destination stage, then fades it in.\n\nThe supplier is called exactly once, when the screen is black. It is\nnever called when another transition is already running. Move shared\nsprites and update game state inside the supplier so those changes happen\nonly when the transition is accepted, while the old stage is hidden.\nThe call returns immediately; the supplier runs later on the animation thread.", + "description": "A filled rectangle centred on a point.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/useFullScreen", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "useFullScreen", + "name": "drawRectangle", "constructor": false, - "static": true, - "parameters": [], + "static": false, + "parameters": [ + "double", + "double", + "double", + "double", + "org.openpatch.scratch.Color" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Makes the window fill the whole screen.\n\nCall it before the first stage is created, because the size of the window is\nsettled the moment it opens:\n\n```java\npublic static void main(String[] args) {\n Window.useFullScreen();\n new MyStage();\n}\n```", + "parameterNames": [ + "x", + "y", + "width", + "height", + "fill" + ], + "parameterDescriptions": [ + "x of its centre", + "y of its centre", + "its width", + "its height", + "its colour" + ], + "description": "A filled rectangle centred on a point.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "desktop-only", - "reason": "The embedded browser output uses its enclosing page; this desktop window option only reports a limitation.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/useSplashLogo", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/drawText", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "useSplashLogo", + "name": "drawText", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String" + "java.lang.String", + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "path" + "text", + "x", + "y", + "size", + "color" ], "parameterDescriptions": [ - "a path to an image file or the name of a built-in sprite, or\n `null` for the Scratch for Java logo" + "the text", + "where it starts", + "its baseline", + "the font size", + "the colour of the letters" ], - "description": "Puts your own picture on the loading screen in place of the Scratch for Java\nlogo. The picture fades in while your project starts and fades out again\nonce it is ready.\n\nIt is shrunk to fit if it is large, and never enlarged, so a picture of\nroughly 300 by 300 looks right in a window of the usual size.\n\nCall it before the first stage is created, because the loading screen is the\nfirst thing the window draws:\n\n```java\npublic static void main(String[] args) {\n Window.useSplashLogo(\"assets/logo.png\");\n new MyStage();\n}\n```", + "description": "A line of text whose first baseline starts at a point, in the default font.", "returnDescription": "", "scratchblock": "", "since": "" } ], "status": "desktop-only", - "reason": "The browser has no desktop splash window. This option only reports a limitation.", - "missingBrowserSignatures": [] - }, - { - "id": "Window/useTextureSampling", - "owner": "org.openpatch.scratch.Window", - "signatures": [ + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "useTextureSampling", + "name": "drawText", "constructor": false, - "static": true, + "static": false, "parameters": [ - "org.openpatch.scratch.TextureSampling" + "java.lang.String", + "double", + "double", + "double", + "org.openpatch.scratch.Color" ], "returns": "void", "parameterNames": [ - "sampling" + "text", + "x", + "y", + "size", + "color" ], "parameterDescriptions": [ - "how to smooth pictures" + "the text", + "where it starts", + "its baseline", + "the font size", + "the colour of the letters" ], - "description": "Chooses how pictures are smoothed when they are drawn larger or smaller than\nthey really are. Pixel art usually wants [TextureSampling.POINT](../TextureSampling/POINT).\n\nCall it before the first stage is created.\n\n```java\nWindow.useTextureSampling(TextureSampling.POINT);\nnew MyStage();\n```", + "description": "A line of text whose first baseline starts at a point, in the default font.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "Window/whenExits", - "owner": "org.openpatch.scratch.Window", + "id": "extension/Canvas/imageHeight", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "whenExits", + "name": "imageHeight", "constructor": false, "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "This method is called when the window exits. Override this method to define\ncustom behavior\nwhen the window is closed.", - "returnDescription": "", + "parameters": [ + "java.lang.String" + ], + "returns": "int", + "parameterNames": [ + "path" + ], + "parameterDescriptions": [ + "an image or a built-in sprite name" + ], + "description": "", + "returnDescription": "its height in pixels", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/changeX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "changeX", + "name": "imageHeight", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], - "returns": "void", + "returns": "int", "parameterNames": [ - "x" + "path" ], "parameterDescriptions": [ - "number in pixels" + "an image or a built-in sprite name" ], - "description": "Changes x by a certain amount", - "returnDescription": "", + "description": "", + "returnDescription": "its height in pixels", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/changeY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Canvas/imageWidth", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "changeY", + "name": "imageWidth", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], - "returns": "void", + "returns": "int", "parameterNames": [ - "y" + "path" ], "parameterDescriptions": [ - "number in pixels" + "an image or a built-in sprite name" ], - "description": "Changes y by a certain amount", - "returnDescription": "", + "description": "", + "returnDescription": "its width in pixels", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/changeZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "changeZoom", + "name": "imageWidth", "constructor": false, "static": false, "parameters": [ - "double" + "java.lang.String" ], - "returns": "void", + "returns": "int", "parameterNames": [ - "dz" + "path" ], "parameterDescriptions": [ - "the amount to change the zoom level by" + "an image or a built-in sprite name" ], - "description": "Changes the zoom level by a certain amount", - "returnDescription": "", + "description": "", + "returnDescription": "its width in pixels", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/constructor", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Canvas/noClip", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "Camera", - "constructor": true, + "name": "noClip", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.camera.Camera", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Constructs a new Camera with default values. The default position is (0, 0) and the default\nzoom level is 100.", + "description": "Draws everywhere again.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/getPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "getPosition", + "name": "noClip", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the position of the sprite", - "returnDescription": "a vector", + "description": "Draws everywhere again.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/getX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Canvas/setOpacity", + "owner": "org.openpatch.scratch.extension.Canvas", "signatures": [ { - "name": "getX", + "name": "setOpacity", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the x coordinate of the sprite", - "returnDescription": "a x coordinate", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "opacity" + ], + "parameterDescriptions": [ + "how opaque what follows is drawn, 0 to 1" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/getY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "getY", + "name": "setOpacity", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the y coordinate of the sprite", - "returnDescription": "a y coordinate", + "parameters": [ + "double" + ], + "returns": "void", + "parameterNames": [ + "opacity" + ], + "parameterDescriptions": [ + "how opaque what follows is drawn, 0 to 1" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + ] + }, + { + "id": "extension/Extension/constructor", + "owner": "org.openpatch.scratch.extension.Extension", + "signatures": [], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/camera/Camera/getZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/coreVersion", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "getZoom", + "name": "coreVersion", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "double", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the zoom level", - "returnDescription": "the zoom level", + "description": "The version of the core library, e.g. `\"7.0.0\"`.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/resetZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "resetZoom", + "name": "coreVersion", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Resets the zoom level to 100", + "description": "The version of the core library, e.g. `\"7.0.0\"`.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/setPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/id", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "setPosition", + "name": "id", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void", - "parameterNames": [ - "x", - "y" - ], - "parameterDescriptions": [ - "a x coordinate", - "a y coordinate" - ], - "description": "Sets the position of the sprite", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A short unique id such as `\"tiled\"`, used in messages.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "setPosition", + "name": "id", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "void", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "a vector" - ], - "description": "Sets the position of the sprite based on the coordinates of a given vector.", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A short unique id such as `\"tiled\"`, used in messages.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/setX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/install", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "setX", + "name": "install", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "x" + "ctx" ], "parameterDescriptions": [ - "a x coordinate" + "" ], - "description": "Sets the x coordinate", + "description": "Adds the extension's hooks. Called once, on the window thread, before the first stage.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/setY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "setY", + "name": "install", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "y" + "ctx" ], "parameterDescriptions": [ - "a y coordinate" + "" ], - "description": "Sets the y coordinate", + "description": "Adds the extension's hooks. Called once, on the window thread, before the first stage.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/setZoom", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/name", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "setZoom", + "name": "name", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "zoom" - ], - "parameterDescriptions": [ - "the zoom level" - ], - "description": "Sets the zoom", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A name for people, such as `\"Tiled maps\"`.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "name", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "A name for people, such as `\"Tiled maps\"`.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/camera/Camera/setZoomLimit", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/requires", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "setZoomLimit", + "name": "requires", "constructor": false, "static": false, - "parameters": [ - "double", - "double" - ], - "returns": "void", - "parameterNames": [ - "low", - "high" - ], - "parameterDescriptions": [ - "the lower limit", - "the upper limit" - ], - "description": "Sets the zoom limits", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "The core versions this extension works with: `\"7\"` means any 7.x, `\"7.1\"` 7.1\nor newer, `\"7.1.2\"` 7.1.2 or newer, always below the next major version.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "requires", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "The core versions this extension works with: `\"7\"` means any 7.x, `\"7.1\"` 7.1\nor newer, `\"7.1.2\"` 7.1.2 or newer, always below the next major version.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/camera/Camera/toGlobalPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/Extension/version", + "owner": "org.openpatch.scratch.extension.Extension", "signatures": [ { - "name": "toGlobalPosition", + "name": "version", "constructor": false, "static": false, - "parameters": [ - "org.openpatch.scratch.Vector2" - ], - "returns": "org.openpatch.scratch.Vector2", - "parameterNames": [ - "v" - ], - "parameterDescriptions": [ - "local camera coordinates" - ], - "description": "Converts local camera coordinates to screen coordinates", - "returnDescription": "screen coordinates", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "The extension's own version.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "version", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "The extension's own version.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/camera/Camera/toGlobalX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/ExtensionContext/addLayerDrawer", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "toGlobalX", + "name": "addLayerDrawer", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Layer", + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "x" + "layer", + "drawer" ], "parameterDescriptions": [ - "local camera x coordinate" + "", + "" ], - "description": "Converts local camera x coordinate to screen x coordinate", - "returnDescription": "screen x coordinate", + "description": "Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles,\ndrawings. Game thread, when the draw list is made.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/toGlobalY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "toGlobalY", + "name": "addLayerDrawer", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.Layer", + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "y" + "layer", + "drawer" ], "parameterDescriptions": [ - "local camera y coordinate" + "", + "" ], - "description": "Converts local camera y coordinate to screen y coordinate", - "returnDescription": "screen y coordinate", + "description": "Draws into a layer every frame, after the layer's canvas and before its sprites: map tiles,\ndrawings. Game thread, when the draw list is made.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/toLocalPosition", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/ExtensionContext/addOverlayDrawer", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "toLocalPosition", + "name": "addOverlayDrawer", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.Vector2" + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], - "returns": "org.openpatch.scratch.Vector2", + "returns": "void", "parameterNames": [ - "v" + "drawer" ], "parameterDescriptions": [ - "screen coordinates" + "" ], - "description": "Converts screen coordinates to local camera coordinates", - "returnDescription": "local coordinates", + "description": "Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave\nit out (Studio's watch pins). Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/camera/Camera/toLocalX", - "owner": "org.openpatch.scratch.extensions.camera.Camera", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "toLocalX", + "name": "addOverlayDrawer", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "x" + "drawer" ], "parameterDescriptions": [ - "screen x coordinate" + "" ], - "description": "Converts screen x coordinate to local camera x coordinate", - "returnDescription": "local x coordinate", + "description": "Draws above everything (UI, texts and monitors included) in stage coordinates; captures leave\nit out (Studio's watch pins). Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/camera/Camera/toLocalY", - "owner": "org.openpatch.scratch.extensions.camera.Camera", + "id": "extension/ExtensionContext/afterFrame", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "toLocalY", + "name": "afterFrame", "constructor": false, "static": false, "parameters": [ - "double" + "java.util.function.BiConsumer" ], - "returns": "double", + "returns": "void", "parameterNames": [ - "y" + "hook" ], "parameterDescriptions": [ - "screen y coordinate" + "" ], - "description": "Converts screen y coordinate to local camera y coordinate", - "returnDescription": "local y coordinate", + "description": "After a frame was drawn, on the window thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/Drawing/clip", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "clip", + "name": "afterFrame", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double", - "double" + "java.util.function.BiConsumer" ], "returns": "void", "parameterNames": [ - "x", - "y", - "width", - "height" + "hook" ], "parameterDescriptions": [ - "centre x", - "centre y", - "clip width", - "clip height" + "" ], - "description": "Limits subsequent drawing to a centred rectangle. This replaces the previous\nclip; it is always cleared when the sprite finishes drawing. For a rotated\nsprite, the clip is the screen-aligned bounding box of this rectangle.", + "description": "After a frame was drawn, on the window thread.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/Drawing/constructor", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", - "signatures": [], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/drawing/Drawing/image", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "extension/ExtensionContext/beforeTick", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "image", + "name": "beforeTick", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double", - "double" + "java.util.function.Consumer" ], "returns": "void", "parameterNames": [ - "path", - "x", - "y" + "hook" ], "parameterDescriptions": [ - "image file or built-in costume", - "centre x", - "centre y" + "" ], - "description": "Draws an image at its original size. A built-in costume name also works.", + "description": "Every tick, after the tick's input and before timers and `run()`. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "image", + "name": "beforeTick", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double", - "double", - "double", - "double" + "java.util.function.Consumer" ], "returns": "void", "parameterNames": [ - "path", - "x", - "y", - "width", - "height" + "hook" ], "parameterDescriptions": [ - "image file or built-in costume", - "centre x", - "centre y", - "drawn width in pixels", - "drawn height in pixels" + "" ], - "description": "Draws an image at the requested size, preserving its source in the cache.", + "description": "Every tick, after the tick's input and before timers and `run()`. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + ] + }, + { + "id": "extension/ExtensionContext/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext", + "signatures": [], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/drawing/Drawing/imageHeight", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "extension/ExtensionContext/dispatch", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "imageHeight", + "name": "dispatch", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Stage", + "java.lang.Class", + "java.util.function.Consumer" ], - "returns": "int", + "returns": "void", "parameterNames": [ - "path" + "stage", + "listener", + "call" ], "parameterDescriptions": [ - "image file or built-in costume" + "", + "", + "" ], - "description": "", - "returnDescription": "its original height in pixels", + "description": "Calls a listener interface on the stage and every sprite of it that implements it, at the\npoint of the tick where key events arrive. Learner exceptions thrown there stop the game like\nany learner exception. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/Drawing/imageWidth", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "imageWidth", + "name": "dispatch", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.Stage", + "java.lang.Class", + "java.util.function.Consumer" ], - "returns": "int", + "returns": "void", "parameterNames": [ - "path" + "stage", + "listener", + "call" ], "parameterDescriptions": [ - "image file or built-in costume" + "", + "", + "" ], - "description": "", - "returnDescription": "its original width in pixels", + "description": "Calls a listener interface on the stage and every sprite of it that implements it, at the\npoint of the tick where key events arrive. Learner exceptions thrown there stop the game like\nany learner exception. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/drawing/Drawing/noClip", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "extension/ExtensionContext/getTickCount", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "noClip", + "name": "getTickCount", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "long", "parameterNames": [], "parameterDescriptions": [], - "description": "Removes this sprite's clip.", - "returnDescription": "", + "description": "", + "returnDescription": "ticks run so far", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "getTickCount", + "constructor": false, + "static": false, + "parameters": [], + "returns": "long", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "ticks run so far", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/drawing/Drawing/polygon", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", + "id": "extension/ExtensionContext/input", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "polygon", + "name": "input", "constructor": false, "static": false, "parameters": [ - "double[]", - "double[]", - "org.openpatch.scratch.Color" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "x", - "y", - "color" + "key" ], "parameterDescriptions": [ - "x coordinates", - "y coordinates (same length as x)", - "fill colour" + "" ], - "description": "Draws a filled polygon with at least three points. Concave polygons are\nsupported; crossing outlines are not.", + "description": "This batch's copy of a slot of the input snapshot. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/Drawing/rectangle", - "owner": "org.openpatch.scratch.extensions.drawing.Drawing", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "rectangle", + "name": "input", "constructor": false, "static": false, "parameters": [ - "double", - "double", - "double", - "double", - "org.openpatch.scratch.Color" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "x", - "y", - "width", - "height", - "color" + "key" ], "parameterDescriptions": [ - "centre x", - "centre y", - "width in pixels", - "height in pixels", - "fill colour" + "" ], - "description": "Draws a filled rectangle centred on (x,y).", + "description": "This batch's copy of a slot of the input snapshot. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/drawing/DrawingSprite/changeTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "id": "extension/ExtensionContext/isLoading", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "changeTransparency", + "name": "isLoading", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "step" - ], - "parameterDescriptions": [ - "change in percentage points" - ], + "parameters": [], + "returns": "boolean", + "parameterNames": [], + "parameterDescriptions": [], "description": "", - "returnDescription": "", + "returnDescription": "whether the loading screen is up", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/DrawingSprite/constructor", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "DrawingSprite", - "constructor": true, + "name": "isLoading", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Creates a custom drawing sprite.", - "returnDescription": "", + "description": "", + "returnDescription": "whether the loading screen is up", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/drawing/DrawingSprite/draw", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "id": "extension/ExtensionContext/onExit", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "draw", + "name": "onExit", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "java.lang.Runnable" ], "returns": "void", "parameterNames": [ - "drawing" + "hook" ], "parameterDescriptions": [ - "this frame's canvas in local Scratch coordinates" + "" ], - "description": "Draws this frame's appearance. Override this method; use run() for changes\nto game state, since a paused game can still be redrawn.", + "description": "At the end of the program, after `whenExits()`. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/DrawingSprite/getTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "getTransparency", + "name": "onExit", "constructor": false, "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", - "returnDescription": "transparency in percent", + "parameters": [ + "java.lang.Runnable" + ], + "returns": "void", + "parameterNames": [ + "hook" + ], + "parameterDescriptions": [ + "" + ], + "description": "At the end of the program, after `whenExits()`. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/drawing/DrawingSprite/setIsUI", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", + "id": "extension/ExtensionContext/onInputPoll", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "setIsUI", + "name": "onInputPoll", "constructor": false, "static": false, "parameters": [ - "boolean" + "java.util.function.Consumer" ], "returns": "void", "parameterNames": [ - "isUI" + "hook" ], "parameterDescriptions": [ - "true for UI, false for the game world" + "" ], - "description": "Chooses whether the drawing stays fixed on screen as UI.", + "description": "Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into\nthe snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/drawing/DrawingSprite/setTransparency", - "owner": "org.openpatch.scratch.extensions.drawing.DrawingSprite", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "setTransparency", + "name": "onInputPoll", "constructor": false, "static": false, "parameters": [ - "double" + "java.util.function.Consumer" ], "returns": "void", "parameterNames": [ - "percent" + "hook" ], "parameterDescriptions": [ - "0 solid, 100 invisible" + "" ], - "description": "", + "description": "Once per batch of ticks, on the window thread (the one that started GLFW): poll devices into\nthe snapshot. GLFW polling functions only; setting GLFW callbacks is not allowed.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/fs/File/constructor", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/onKey", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "File", - "constructor": true, + "name": "onKey", + "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.fs.File", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", + "parameters": [ + "java.util.function.Consumer" + ], + "returns": "void", + "parameterNames": [ + "hook" + ], + "parameterDescriptions": [ + "" + ], + "description": "Every key press and release, before learner code sees it; observe only. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" @@ -12751,14 +15329,20 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "File", - "constructor": true, + "name": "onKey", + "constructor": false, "static": false, - "parameters": [], - "returns": "org.openpatch.scratch.extensions.fs.File", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", + "parameters": [ + "java.util.function.Consumer" + ], + "returns": "void", + "parameterNames": [ + "hook" + ], + "parameterDescriptions": [ + "" + ], + "description": "Every key press and release, before learner code sees it; observe only. Game thread.", "returnDescription": "", "scratchblock": "", "since": "" @@ -12766,28 +15350,25 @@ ] }, { - "id": "extensions/fs/File/load", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/onLearnerError", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "load", + "name": "onLearnerError", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the file from which the object is to be loaded", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from a file at the given path.", - "returnDescription": "the loaded object of the specified class", + "description": "A learner exception stopped the game. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -12796,52 +15377,46 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "load", + "name": "onLearnerError", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the file from which the object is to be loaded", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from a file at the given path.", - "returnDescription": "the loaded object of the specified class", + "description": "A learner exception stopped the game. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/fs/File/loadOrCreate", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/onMouse", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "loadOrCreate", + "name": "onMouse", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the file from which the object is to be loaded", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", - "returnDescription": "the loaded object of the specified class, or a new instance if the\n file does not exist", + "description": "Every mouse event, before learner code sees it; observe only. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -12850,52 +15425,46 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "loadOrCreate", + "name": "onMouse", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the file from which the object is to be loaded", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", - "returnDescription": "the loaded object of the specified class, or a new instance if the\n file does not exist", + "description": "Every mouse event, before learner code sees it; observe only. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/fs/File/loadXML", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/onStageCreated", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "loadXML", + "name": "onStageCreated", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the XML file", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from an XML file at the given path.", - "returnDescription": "the object loaded from the XML file", + "description": "A stage was made (on the thread that made it, usually the game thread or main).", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -12904,52 +15473,46 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "loadXML", + "name": "onStageCreated", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the XML file", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from an XML file at the given path.", - "returnDescription": "the object loaded from the XML file", + "description": "A stage was made (on the thread that made it, usually the game thread or main).", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/fs/File/loadXMLOrCreate", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/onStageDisposed", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "loadXMLOrCreate", + "name": "onStageDisposed", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the XML file", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", - "returnDescription": "the object loaded from the XML file, or a new instance if the file\n does not exist", + "description": "A stage stopped being shown. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -12958,51 +15521,48 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "loadXMLOrCreate", + "name": "onStageDisposed", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "java.lang.Class" + "java.util.function.Consumer" ], - "returns": "T", + "returns": "void", "parameterNames": [ - "path", - "cls" + "hook" ], "parameterDescriptions": [ - "the path to the XML file", - "the class of the object to be loaded" + "" ], - "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", - "returnDescription": "the object loaded from the XML file, or a new instance if the file\n does not exist", + "description": "A stage stopped being shown. Game thread.", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/fs/File/save", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/registerImageFormat", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "save", + "name": "registerImageFormat", "constructor": false, - "static": true, + "static": false, "parameters": [ "java.lang.String", - "T" + "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder" ], "returns": "void", "parameterNames": [ - "path", - "obj" + "suffix", + "decoder" ], "parameterDescriptions": [ - "the path where the object should be saved", - "the object to be saved" + "", + "" ], - "description": "Saves the given object to the specified path in the default file type (JSON).", + "description": "Images whose name ends in `suffix` (e.g. `\".ase\"`) are decoded by\n`decoder`.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13012,23 +15572,23 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "save", + "name": "registerImageFormat", "constructor": false, - "static": true, + "static": false, "parameters": [ "java.lang.String", - "T" + "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder" ], "returns": "void", "parameterNames": [ - "path", - "obj" + "suffix", + "decoder" ], "parameterDescriptions": [ - "the path where the object should be saved", - "the object to be saved" + "", + "" ], - "description": "Saves the given object to the specified path in the default file type (JSON).", + "description": "Images whose name ends in `suffix` (e.g. `\".ase\"`) are decoded by\n`decoder`.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13036,27 +15596,24 @@ ] }, { - "id": "extensions/fs/File/saveXML", - "owner": "org.openpatch.scratch.extensions.fs.File", + "id": "extension/ExtensionContext/runOnGameThread", + "owner": "org.openpatch.scratch.extension.ExtensionContext", "signatures": [ { - "name": "saveXML", + "name": "runOnGameThread", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "T" + "java.lang.Runnable" ], "returns": "void", "parameterNames": [ - "path", - "obj" + "task" ], "parameterDescriptions": [ - "the path where the XML file will be saved", - "the object to be saved as XML" + "" ], - "description": "Saves the given object as an XML file at the specified path.", + "description": "Runs a task at the start of the next tick, before input.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13066,23 +15623,20 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "saveXML", + "name": "runOnGameThread", "constructor": false, - "static": true, + "static": false, "parameters": [ - "java.lang.String", - "T" + "java.lang.Runnable" ], "returns": "void", "parameterNames": [ - "path", - "obj" + "task" ], "parameterDescriptions": [ - "the path where the XML file will be saved", - "the object to be saved as XML" + "" ], - "description": "Saves the given object as an XML file at the specified path.", + "description": "Runs a task at the start of the next tick, before input.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13090,103 +15644,99 @@ ] }, { - "id": "extensions/fs/SaveData/constructor", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", + "id": "extension/Frame/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", + "signatures": [], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [] + }, + { + "id": "extension/Frame/getArgb", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", "signatures": [ { - "name": "SaveData", - "constructor": true, + "name": "getArgb", + "constructor": false, "static": false, - "parameters": [ - "java.lang.String", - "java.lang.String", - "java.lang.Class" - ], - "returns": "org.openpatch.scratch.extensions.fs.SaveData", - "parameterNames": [ - "gameId", - "slot", - "type" - ], - "parameterDescriptions": [ - "a stable identifier, for example org.openpatch.coincatcher", - "a slot name, for example slot1, slot2 or slot3", - "the data class to load" - ], - "description": "Selects a game's save slot without creating a file or opening a database.", + "parameters": [], + "returns": "int[]", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Straight ARGB, top row first.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/fs/SaveData/getLocation", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", - "signatures": [ + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ { - "name": "getLocation", + "name": "getArgb", "constructor": false, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "int[]", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", - "returnDescription": "a description of the save location", + "description": "Straight ARGB, top row first.", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/fs/SaveData/loadOrDefault", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", + "id": "extension/Frame/getHeight", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", "signatures": [ { - "name": "loadOrDefault", + "name": "getHeight", "constructor": false, "static": false, - "parameters": [ - "java.util.function.Supplier" - ], - "returns": "T", - "parameterNames": [ - "defaults" - ], - "parameterDescriptions": [ - "creates initial progress for a missing slot; called only when missing" - ], - "description": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", - "returnDescription": "loaded progress, or the supplied defaults for a missing slot", + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "getHeight", + "constructor": false, + "static": false, + "parameters": [], + "returns": "int", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/fs/SaveData/path", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", + "id": "extension/Frame/getWidth", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", "signatures": [ { - "name": "path", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "java.nio.file.Path", + "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", - "returnDescription": "the desktop file path", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -13195,62 +15745,62 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "path", + "name": "getWidth", "constructor": false, "static": false, "parameters": [], - "returns": "java.nio.file.Path", + "returns": "int", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", - "returnDescription": "the desktop file path", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/fs/SaveData/save", - "owner": "org.openpatch.scratch.extensions.fs.SaveData", + "id": "extension/Frame/savePng", + "owner": "org.openpatch.scratch.extension.ExtensionContext.Frame", "signatures": [ { - "name": "save", + "name": "savePng", "constructor": false, "static": false, "parameters": [ - "T" + "java.nio.file.Path" ], "returns": "void", "parameterNames": [ - "data" + "file" ], "parameterDescriptions": [ - "the progress to save; must not be null" + "" ], - "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "save", + "name": "savePng", "constructor": false, "static": false, "parameters": [ - "T" + "java.nio.file.Path" ], "returns": "void", "parameterNames": [ - "data" + "file" ], "parameterDescriptions": [ - "the progress to save; must not be null" + "" ], - "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13258,52 +15808,32 @@ ] }, { - "id": "extensions/pixels/Pixels/background", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "signatures": [ - { - "name": "background", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int[]", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the pixels of the background layer, where the pen and stamps draw.", - "returnDescription": "one colour per pixel", - "scratchblock": "", - "since": "" - } - ], + "id": "extension/ImageDecoder/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder", + "signatures": [], "status": "desktop-only", "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/pixels/Pixels/constructor", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", + "id": "extension/ImageDecoder/decode", + "owner": "org.openpatch.scratch.extension.ExtensionContext.ImageDecoder", "signatures": [ { - "name": "Pixels", - "constructor": true, + "name": "decode", + "constructor": false, "static": false, "parameters": [ - "processing.core.PGraphics", - "processing.core.PGraphics", - "processing.core.PGraphics" + "byte[]" ], - "returns": "org.openpatch.scratch.extensions.pixels.Pixels", + "returns": "org.openpatch.scratch.extension.ExtensionContext.DecodedImage", "parameterNames": [ - "mainBuffer", - "backgroundBuffer", - "foregroundBuffer" + "file" ], "parameterDescriptions": [ - "where the sprites are drawn", - "where the background is drawn", - "where the foreground is drawn" + "" ], - "description": "Creates the pixel access for a stage.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13313,117 +15843,101 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "Pixels", - "constructor": true, + "name": "decode", + "constructor": false, "static": false, "parameters": [ - "processing.core.PGraphics", - "processing.core.PGraphics", - "processing.core.PGraphics" + "byte[]" ], - "returns": "org.openpatch.scratch.extensions.pixels.Pixels", + "returns": "org.openpatch.scratch.extension.ExtensionContext.DecodedImage", "parameterNames": [ - "mainBuffer", - "backgroundBuffer", - "foregroundBuffer" - ], - "parameterDescriptions": [ - "where the sprites are drawn", - "where the background is drawn", - "where the foreground is drawn" - ], - "description": "Creates the pixel access for a stage.", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ] - }, - { - "id": "extensions/pixels/Pixels/foreground", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", - "signatures": [ - { - "name": "foreground", - "constructor": false, - "static": false, - "parameters": [], - "returns": "int[]", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the pixels of the foreground layer.", - "returnDescription": "one colour per pixel", + "file" + ], + "parameterDescriptions": [ + "" + ], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } - ], + ] + }, + { + "id": "extension/InputKey/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "signatures": [], "status": "desktop-only", "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/pixels/Pixels/main", - "owner": "org.openpatch.scratch.extensions.pixels.Pixels", + "id": "extension/InputKey/copy", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", "signatures": [ { - "name": "main", + "name": "copy", "constructor": false, "static": false, - "parameters": [], - "returns": "int[]", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Returns the pixels of the layer the sprites are drawn on.", - "returnDescription": "one colour per pixel", + "parameters": [ + "T", + "T" + ], + "returns": "void", + "parameterNames": [ + "from", + "into" + ], + "parameterDescriptions": [ + "", + "" + ], + "description": "For the core: copies one state into another.", + "returnDescription": "", "scratchblock": "", "since": "" } ], "status": "desktop-only", "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/recorder/FFmpegRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", - "signatures": [ + "missingBrowserSignatures": [ { - "name": "FFmpegRecorder", - "constructor": true, + "name": "copy", + "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "T", + "T" ], - "returns": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", + "returns": "void", "parameterNames": [ - "path" + "from", + "into" ], "parameterDescriptions": [ - "the path where the recording will be saved\n \n\nThis constructor initializes the FFmpegRecorder by creating a temporary directory and\n setting up a pattern for temporary PNG files. If the temporary directory cannot be created,\n an error message is printed to the console." + "", + "" ], - "description": "Constructs an FFmpegRecorder object with the specified path.", + "description": "For the core: copies one state into another.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/recorder/FFmpegRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", + "id": "extension/InputKey/create", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", "signatures": [ { - "name": "saveFrame", + "name": "create", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "T", "parameterNames": [], "parameterDescriptions": [], - "description": "Saves the current frame using the specified pattern.", + "description": "For the core: makes a state for this key.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13433,14 +15947,14 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "saveFrame", + "name": "create", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "T", "parameterNames": [], "parameterDescriptions": [], - "description": "Saves the current frame using the specified pattern.", + "description": "For the core: makes a state for this key.", "returnDescription": "", "scratchblock": "", "since": "" @@ -13448,68 +15962,78 @@ ] }, { - "id": "extensions/recorder/FFmpegRecorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.FFmpegRecorder", + "id": "extension/InputKey/of", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", "signatures": [ { - "name": "stop", + "name": "of", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Stops the recording process and converts the recorded frames into a video file using FFmpeg.\n\nThis method overrides the `stop` method from the superclass. It first calls the superclass's\n`stop` method, then checks if the temporary directory (`tmpDir`) is not null. If it is not\nnull, it constructs a command to run FFmpeg, which converts the recorded frames (stored as PNG\nfiles) into a video file with the specified frame rate and codec.\n\nThe FFmpeg command is executed, and a message is printed to the console indicating that the\nvideo conversion is in progress. If there is an error during the execution of the command, the\nerror message is printed to the console.", - "returnDescription": "", + "static": true, + "parameters": [ + "java.lang.String", + "java.util.function.Supplier", + "java.util.function.BiConsumer" + ], + "returns": "org.openpatch.scratch.extension.ExtensionContext.InputKey", + "parameterNames": [ + "name", + "factory", + "copy" + ], + "parameterDescriptions": [ + "for messages", + "makes an empty state (twice: one per thread)", + "copies the window thread's state into the game thread's: (from, into)" + ], + "description": "", + "returnDescription": "the key", "scratchblock": "", "since": "" } ], "status": "desktop-only", "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/recorder/FrameRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", - "signatures": [ + "missingBrowserSignatures": [ { - "name": "FrameRecorder", - "constructor": true, - "static": false, + "name": "of", + "constructor": false, + "static": true, "parameters": [ - "java.lang.String" + "java.lang.String", + "java.util.function.Supplier", + "java.util.function.BiConsumer" ], - "returns": "org.openpatch.scratch.extensions.recorder.FrameRecorder", + "returns": "org.openpatch.scratch.extension.ExtensionContext.InputKey", "parameterNames": [ - "outputFolder" + "name", + "factory", + "copy" ], "parameterDescriptions": [ - "the folder where the recorded frames will be saved" + "for messages", + "makes an empty state (twice: one per thread)", + "copies the window thread's state into the game thread's: (from, into)" ], - "description": "Constructs a new FrameRecorder with the specified output folder.", - "returnDescription": "", + "description": "", + "returnDescription": "the key", "scratchblock": "", "since": "" } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/recorder/FrameRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", + "id": "extension/InputKey/toString", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputKey", "signatures": [ { - "name": "saveFrame", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Saves the current frame of the stage to the specified output folder. The frame is saved as a\nPNG file with a filename pattern \"#######.png\". The exact filename will be generated based on\nthe current frame number. The picture is the stage at its own size, also when the window is\nbigger.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13519,14 +16043,14 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "saveFrame", + "name": "toString", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Saves the current frame of the stage to the specified output folder. The frame is saved as a\nPNG file with a filename pattern \"#######.png\". The exact filename will be generated based on\nthe current frame number. The picture is the stage at its own size, also when the window is\nbigger.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13534,24 +16058,32 @@ ] }, { - "id": "extensions/recorder/FrameRecorder/snapshot", - "owner": "org.openpatch.scratch.extensions.recorder.FrameRecorder", + "id": "extension/InputSnapshot/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputSnapshot", + "signatures": [], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [] + }, + { + "id": "extension/InputSnapshot/get", + "owner": "org.openpatch.scratch.extension.ExtensionContext.InputSnapshot", "signatures": [ { - "name": "snapshot", + "name": "get", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "filename" + "key" ], "parameterDescriptions": [ - "the name of the file to save the snapshot to" + "" ], - "description": "Takes a snapshot of the current frame and saves it to the specified filename.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13561,20 +16093,20 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "snapshot", + "name": "get", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext.InputKey" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "filename" + "key" ], "parameterDescriptions": [ - "the name of the file to save the snapshot to" + "" ], - "description": "Takes a snapshot of the current frame and saves it to the specified filename.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13582,46 +16114,35 @@ ] }, { - "id": "extensions/recorder/GifRecorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "signatures": [ - { - "name": "GifRecorder", - "constructor": true, - "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "parameterNames": [ - "filePath" - ], - "parameterDescriptions": [ - "the path where the GIF file will be saved" - ], - "description": "Constructs a new GifRecorder object.", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ], + "id": "extension/LayerDrawer/constructor", + "owner": "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer", + "signatures": [], "status": "desktop-only", "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/GifRecorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", + "id": "extension/LayerDrawer/draw", + "owner": "org.openpatch.scratch.extension.ExtensionContext.LayerDrawer", "signatures": [ { - "name": "saveFrame", + "name": "draw", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Stage", + "org.openpatch.scratch.extension.Canvas" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Saves the current frame of the stage as a GIF image.\n\nThis method captures the stage at its own size, sets the frame rate, and adds the frame to\nthe GIF encoder. A window that is bigger than the stage (maximized, say) records the stage\nwithout the bars around it, and the frames keep their size when the window changes during the\nrecording.\n\nNote: This method catches and ignores any NullPointerException that may occur.", + "parameterNames": [ + "stage", + "canvas" + ], + "parameterDescriptions": [ + "", + "" + ], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13631,14 +16152,23 @@ "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [ { - "name": "saveFrame", + "name": "draw", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.Stage", + "org.openpatch.scratch.extension.Canvas" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Saves the current frame of the stage as a GIF image.\n\nThis method captures the stage at its own size, sets the frame rate, and adds the frame to\nthe GIF encoder. A window that is bigger than the stage (maximized, say) records the stage\nwithout the bars around it, and the frames keep their size when the window changes during the\nrecording.\n\nNote: This method catches and ignores any NullPointerException that may occur.", + "parameterNames": [ + "stage", + "canvas" + ], + "parameterDescriptions": [ + "", + "" + ], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -13646,795 +16176,822 @@ ] }, { - "id": "extensions/recorder/GifRecorder/snapshot", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", + "id": "gamepad/Gamepad/constructor", + "owner": "org.openpatch.scratch.gamepad.Gamepad", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "gamepad/Gamepad/getStick", + "owner": "org.openpatch.scratch.gamepad.Gamepad", "signatures": [ { - "name": "snapshot", + "name": "getStick", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the\ncurrent frame, and then finishes the encoding process.", - "returnDescription": "", + "static": true, + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadStick" + ], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [ + "stick" + ], + "parameterDescriptions": [ + "the stick to ask about" + ], + "description": "Where the first connected controller's stick points, (0, 0) if there is none.", + "returnDescription": "its position, x \\u22121 to 1 and y \\u22121 to 1 (up is positive)", "scratchblock": "", "since": "" - } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [ + }, { - "name": "snapshot", + "name": "getStick", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Captures a snapshot and saves it as a GIF. This method starts the GIF encoder, saves the\ncurrent frame, and then finishes the encoding process.", - "returnDescription": "", + "static": true, + "parameters": [ + "int", + "org.openpatch.scratch.gamepad.GamepadStick" + ], + "returns": "org.openpatch.scratch.Vector2", + "parameterNames": [ + "player", + "stick" + ], + "parameterDescriptions": [ + "the player, 1 to 4", + "the stick to ask about" + ], + "description": "Where the player's controller's stick points, (0, 0) if it is not connected.", + "returnDescription": "its position, x \\u22121 to 1 and y \\u22121 to 1 (up is positive)", "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/GifRecorder/start", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", + "id": "gamepad/Gamepad/getTrigger", + "owner": "org.openpatch.scratch.gamepad.Gamepad", "signatures": [ { - "name": "start", + "name": "getTrigger", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Starts the GIF recording process.", - "returnDescription": "", + "static": true, + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadTrigger" + ], + "returns": "double", + "parameterNames": [ + "trigger" + ], + "parameterDescriptions": [ + "the trigger to ask about" + ], + "description": "How far down the first connected controller's trigger is, 0 if there is none.", + "returnDescription": "how far it is pressed, 0 (not at all) to 1 (fully)", "scratchblock": "", "since": "" - } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/recorder/GifRecorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.GifRecorder", - "signatures": [ + }, { - "name": "stop", + "name": "getTrigger", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Stops the GIF recording process and finalizes the GIF file.", - "returnDescription": "", + "static": true, + "parameters": [ + "int", + "org.openpatch.scratch.gamepad.GamepadTrigger" + ], + "returns": "double", + "parameterNames": [ + "player", + "trigger" + ], + "parameterDescriptions": [ + "the player, 1 to 4", + "the trigger to ask about" + ], + "description": "How far down the player's controller's trigger is, 0 if it is not connected.", + "returnDescription": "how far it is pressed, 0 (not at all) to 1 (fully)", "scratchblock": "", "since": "" } ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/Recorder/constructor", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", + "id": "gamepad/Gamepad/isButtonPressed", + "owner": "org.openpatch.scratch.gamepad.Gamepad", "signatures": [ { - "name": "Recorder", - "constructor": true, - "static": false, + "name": "isButtonPressed", + "constructor": false, + "static": true, "parameters": [ - "java.lang.String", - "java.lang.String" + "org.openpatch.scratch.gamepad.GamepadButton" ], - "returns": "org.openpatch.scratch.extensions.recorder.Recorder", + "returns": "boolean", "parameterNames": [ - "path", - "ext" + "button" ], "parameterDescriptions": [ - "the file path where the recording will be saved", - "the file extension to be used for the recording" + "the button to ask about" ], - "description": "Constructs a new Recorder object with the specified file path and extension. If the provided\npath does not end with the specified extension, the extension is appended to the path.", - "returnDescription": "", + "description": "Whether any controller has the button down.", + "returnDescription": "whether it is down on any connected controller", "scratchblock": "", "since": "" - } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [ + }, { - "name": "Recorder", - "constructor": true, - "static": false, + "name": "isButtonPressed", + "constructor": false, + "static": true, "parameters": [ - "java.lang.String", - "java.lang.String" + "int", + "org.openpatch.scratch.gamepad.GamepadButton" ], - "returns": "org.openpatch.scratch.extensions.recorder.Recorder", + "returns": "boolean", "parameterNames": [ - "path", - "ext" + "player", + "button" ], "parameterDescriptions": [ - "the file path where the recording will be saved", - "the file extension to be used for the recording" + "the player, 1 to 4", + "the button to ask about" ], - "description": "Constructs a new Recorder object with the specified file path and extension. If the provided\npath does not end with the specified extension, the extension is appended to the path.", - "returnDescription": "", + "description": "Whether the player's controller has the button down.", + "returnDescription": "whether it is down on that player's controller", "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/Recorder/post", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", + "id": "gamepad/Gamepad/isConnected", + "owner": "org.openpatch.scratch.gamepad.Gamepad", "signatures": [ { - "name": "post", + "name": "isConnected", "constructor": false, - "static": false, + "static": true, "parameters": [], - "returns": "void", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Called after each frame is drawn. This method is registered with the Applet class to ensure\nthat frames are saved at the appropriate time during the recording process.", + "description": "Whether any controller is connected.", "returnDescription": "", "scratchblock": "", "since": "" - } - ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [ + }, { - "name": "post", + "name": "isConnected", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Called after each frame is drawn. This method is registered with the Applet class to ensure\nthat frames are saved at the appropriate time during the recording process.", - "returnDescription": "", + "static": true, + "parameters": [ + "int" + ], + "returns": "boolean", + "parameterNames": [ + "player" + ], + "parameterDescriptions": [ + "the player, 1 to 4" + ], + "description": "Whether a controller sits in the player's slot.", + "returnDescription": "whether that slot has a controller", "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "gamepad/GamepadListener/constructor", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", + "signatures": [], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/Recorder/saveFrame", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", + "id": "gamepad/GamepadListener/whenGamepadButtonPressed", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", "signatures": [ { - "name": "saveFrame", + "name": "whenGamepadButtonPressed", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadButton" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Saves the current frame. This method should be implemented by subclasses to define the specific\nbehavior for saving a frame.", + "parameterNames": [ + "button" + ], + "parameterDescriptions": [ + "the button that was pressed" + ], + "description": "A button went down on one of the controllers.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", - "missingBrowserSignatures": [ - { - "name": "saveFrame", - "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Saves the current frame. This method should be implemented by subclasses to define the specific\nbehavior for saving a frame.", - "returnDescription": "", - "scratchblock": "", - "since": "" - } - ] + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/Recorder/start", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", + "id": "gamepad/GamepadListener/whenGamepadButtonReleased", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", "signatures": [ { - "name": "start", + "name": "whenGamepadButtonReleased", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "org.openpatch.scratch.gamepad.GamepadButton" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Starts the recording process.", + "parameterNames": [ + "button" + ], + "parameterDescriptions": [ + "the button that was released" + ], + "description": "A button came up on one of the controllers.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "extensions/recorder/Recorder/stop", - "owner": "org.openpatch.scratch.extensions.recorder.Recorder", + "id": "gamepad/GamepadListener/whenGamepadConnected", + "owner": "org.openpatch.scratch.gamepad.GamepadListener", "signatures": [ { - "name": "stop", + "name": "whenGamepadConnected", "constructor": false, "static": false, - "parameters": [], + "parameters": [ + "int" + ], "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Stops the recording process.", + "parameterNames": [ + "player" + ], + "parameterDescriptions": [ + "the player whose slot got a controller, 1 to 4" + ], + "description": "A controller appeared in a player's slot.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", "missingBrowserSignatures": [] }, { - "id": "extensions/shader/Shader/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shader", + "id": "recorder/GifEncoder/addFrame", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "Shader", - "constructor": true, + "name": "addFrame", + "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String", - "java.lang.String" + "int[]", + "int", + "int" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader", + "returns": "boolean", "parameterNames": [ - "name", - "fragmentShaderPath", - "vertexShaderPath" + "argb", + "width", + "height" ], "parameterDescriptions": [ - "unique name", - "path to the fragment shader file", - "path to the vertex shader file, or null for Processing's default one" + "int array containing the frame's pixels, top row first.", + "int frame width.", + "int frame height." ], - "description": "Constructor", - "returnDescription": "", + "description": "Adds next GIF frame as an ARGB pixel array, top row first (0xAARRGGBB). The alpha channel is\nignored. The frame is not written immediately, but is actually deferred until the next frame\nis received so that timing data can be inserted. Invoking finish() flushes all\nframes. The size of the first frame is used for all subsequent frames; frames of another size\nare scaled with nearest-neighbour sampling.", + "returnDescription": "true if successful.", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "Shader", - "constructor": true, + "name": "addFrame", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.shader.Shader" + "int[]", + "int", + "int" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader", + "returns": "boolean", "parameterNames": [ - "shader" + "argb", + "width", + "height" ], "parameterDescriptions": [ - "shader" + "int array containing the frame's pixels, top row first.", + "int frame width.", + "int frame height." ], - "description": "Copy constructor", - "returnDescription": "", + "description": "Adds next GIF frame as an ARGB pixel array, top row first (0xAARRGGBB). The alpha channel is\nignored. The frame is not written immediately, but is actually deferred until the next frame\nis received so that timing data can be inserted. Invoking finish() flushes all\nframes. The size of the first frame is used for all subsequent frames; frames of another size\nare scaled with nearest-neighbour sampling.", + "returnDescription": "true if successful.", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shader/getName", - "owner": "org.openpatch.scratch.extensions.shader.Shader", + "id": "recorder/GifEncoder/constructor", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "getName", - "constructor": false, + "name": "GifEncoder", + "constructor": true, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "org.openpatch.scratch.recorder.GifEncoder", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the name", - "returnDescription": "the name", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ + { + "name": "GifEncoder", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.recorder.GifEncoder", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/shader/Shader/getPShader", - "owner": "org.openpatch.scratch.extensions.shader.Shader", + "id": "recorder/GifEncoder/finish", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "getPShader", + "name": "finish", "constructor": false, "static": false, "parameters": [], - "returns": "processing.opengl.PShader", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the shader", - "returnDescription": "the shader", + "description": "Flushes any pending data and closes output file. If writing to an OutputStream, the stream is\nnot closed.", + "returnDescription": "true if finished", "scratchblock": "", "since": "" } ], "status": "desktop-only", - "reason": "Processing's PShader object belongs to the desktop renderer. The browser uses WebGL filters.", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", "missingBrowserSignatures": [ { - "name": "getPShader", + "name": "finish", "constructor": false, "static": false, "parameters": [], - "returns": "processing.opengl.PShader", + "returns": "boolean", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the shader", - "returnDescription": "the shader", + "description": "Flushes any pending data and closes output file. If writing to an OutputStream, the stream is\nnot closed.", + "returnDescription": "true if finished", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/shader/Shader/set", - "owner": "org.openpatch.scratch.extensions.shader.Shader", + "id": "recorder/GifEncoder/setDelay", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "set", + "name": "setDelay", "constructor": false, "static": false, "parameters": [ - "java.lang.String", "int" ], "returns": "void", "parameterNames": [ - "name", - "x" + "ms" ], "parameterDescriptions": [ - "the name of the uniform in the shader file", - "the value" + "int delay time in milliseconds" ], - "description": "Sets a `uniform` of the shader: a value the shader reads but the\nprogram decides, such as the time for an animation or a position on the\nstage.\n\nThe name is the one the shader file declares, `uniform float blocks;`\nis set with `set(\"blocks\", 20)`. There is a `set` for one or two\nnumbers or booleans, a [Vector2](../Vector2/index), a\n[Color](../Color/index) (as a `vec3`), and an array of\nnumbers, `ncoords` at a time, for an array uniform like\n`uniform vec3 lights[10];`.\n\nA uniform keeps its value until it is set again, so a value that changes is\nset in `run()`.", + "description": "Sets the delay time between each frame, or changes it for subsequent frames (applies to last\nframe added).", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "set", + "name": "setDelay", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "boolean" + "int" ], "returns": "void", "parameterNames": [ - "name", - "x" + "ms" ], "parameterDescriptions": [ - "", - "" + "int delay time in milliseconds" ], - "description": "", + "description": "Sets the delay time between each frame, or changes it for subsequent frames (applies to last\nframe added).", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "recorder/GifEncoder/setDispose", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "signatures": [ { - "name": "set", + "name": "setDispose", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double" + "int" ], "returns": "void", "parameterNames": [ - "name", - "x" + "code" ], "parameterDescriptions": [ - "", - "" + "int disposal code." ], - "description": "", + "description": "Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default\nis 0 if no transparent color has been set, otherwise 2.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "set", + "name": "setDispose", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "int", "int" ], "returns": "void", "parameterNames": [ - "name", - "x", - "y" + "code" ], "parameterDescriptions": [ - "", - "", - "" + "int disposal code." ], - "description": "", + "description": "Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default\nis 0 if no transparent color has been set, otherwise 2.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "recorder/GifEncoder/setFrameRate", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "signatures": [ { - "name": "set", + "name": "setFrameRate", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "boolean", - "boolean" + "float" ], "returns": "void", "parameterNames": [ - "name", - "x", - "y" + "fps" ], "parameterDescriptions": [ - "", - "", - "" + "float frame rate (frames per second)" ], - "description": "", + "description": "Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "set", + "name": "setFrameRate", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double", - "double" + "float" ], "returns": "void", "parameterNames": [ - "name", - "x", - "y" + "fps" ], "parameterDescriptions": [ - "", - "", - "" + "float frame rate (frames per second)" ], - "description": "", + "description": "Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "recorder/GifEncoder/setQuality", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "signatures": [ { - "name": "set", + "name": "setQuality", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "org.openpatch.scratch.Vector2" + "int" ], "returns": "void", "parameterNames": [ - "name", - "vec" + "quality" ], "parameterDescriptions": [ - "", - "" + "int greater than 0." ], - "description": "", + "description": "Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by\nthe GIF specification). Lower values (minimum = 1) produce better colors, but slow processing\nsignificantly. 10 is the default, and produces good color mapping at reasonable speeds. Values\ngreater than 20 do not yield significant improvements in speed.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "set", + "name": "setQuality", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "int[]", "int" ], "returns": "void", "parameterNames": [ - "name", - "values", - "ncoords" + "quality" ], "parameterDescriptions": [ - "", - "", - "" + "int greater than 0." ], - "description": "", + "description": "Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by\nthe GIF specification). Lower values (minimum = 1) produce better colors, but slow processing\nsignificantly. 10 is the default, and produces good color mapping at reasonable speeds. Values\ngreater than 20 do not yield significant improvements in speed.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ] + }, + { + "id": "recorder/GifEncoder/setRepeat", + "owner": "org.openpatch.scratch.recorder.GifEncoder", + "signatures": [ { - "name": "set", + "name": "setRepeat", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "double[]", "int" ], "returns": "void", "parameterNames": [ - "name", - "values", - "ncoords" + "iter" ], "parameterDescriptions": [ - "", - "", - "" + "int number of iterations." ], - "description": "", + "description": "Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play\nindefinitely. Must be invoked before the first image is added.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "set", + "name": "setRepeat", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "org.openpatch.scratch.Color" + "int" ], "returns": "void", "parameterNames": [ - "name", - "c" + "iter" ], "parameterDescriptions": [ - "", - "" + "int number of iterations." ], - "description": "", + "description": "Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play\nindefinitely. Must be invoked before the first image is added.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shader/setName", - "owner": "org.openpatch.scratch.extensions.shader.Shader", + "id": "recorder/GifEncoder/setTransparent", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "setName", + "name": "setTransparent", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "int" ], "returns": "void", "parameterNames": [ - "name" + "rgb" ], "parameterDescriptions": [ - "unique name" + "int color (0xRRGGBB) to be treated as transparent on display, or -1 for none." ], - "description": "Sets the name", + "description": "Sets the transparent color for the last added frame and any subsequent frames. Since all\ncolors are subject to modification in the quantization process, the color in the final palette\nfor each frame closest to the given color becomes the transparent color for that frame. May be\nset to -1 to indicate no transparent color.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/shader/Shaders/activate", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "signatures": [ + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "activate", + "name": "setTransparent", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "int" ], "returns": "void", "parameterNames": [ - "name" + "rgb" ], "parameterDescriptions": [ - "the name of the shader" + "int color (0xRRGGBB) to be treated as transparent on display, or -1 for none." ], - "description": "Draws with the shader of the given name as well, without stopping the\nothers. Active shaders take turns in the order they were added, each\nworking on what the one before it drew, so a stage can be tinted and\nwobble at the same time. A sprite draws with the first of its active\nshaders only.", + "description": "Sets the transparent color for the last added frame and any subsequent frames. Since all\ncolors are subject to modification in the quantization process, the color in the final palette\nfor each frame closest to the given color becomes the transparent color for that frame. May be\nset to -1 to indicate no transparent color.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shaders/add", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/GifEncoder/start", + "owner": "org.openpatch.scratch.recorder.GifEncoder", "signatures": [ { - "name": "add", + "name": "start", "constructor": false, "static": false, "parameters": [ - "java.lang.String", - "java.lang.String", - "java.lang.String" + "java.io.OutputStream" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader", + "returns": "boolean", "parameterNames": [ - "name", - "fragmentShaderPath", - "vertexShaderPath" + "os" ], "parameterDescriptions": [ - "a unique name", - "the path to the fragment shader", - "the path to the vertex shader, may be null" + "OutputStream on which GIF images are written." ], - "description": "Adds a shader. If a shader with the given name already exists, that one is\nreturned instead.\n\nThe first shader added is drawn with right away; the ones after it wait\nuntil [switchTo(String)](switchTo), [next()](next) or\n[activate(String)](activate) picks them.\n\nThe vertex shader is usually `null`, which uses Processing's default\none. In the browser any other vertex shader is ignored.", - "returnDescription": "the shader", + "description": "Initiates GIF file creation on the given stream. The stream is not closed automatically.", + "returnDescription": "false if initial write failed.", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/shader/Shaders/constructor", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "signatures": [ + }, { - "name": "Shaders", - "constructor": true, + "name": "start", + "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "org.openpatch.scratch.extensions.shader.Shaders", + "returns": "boolean", "parameterNames": [ - "owner" + "file" ], "parameterDescriptions": [ - "what the shaders belong to, used in error messages: \"sprite\" or\n \"stage\"" + "String containing output file name." ], - "description": "Creates an empty set of shaders.", - "returnDescription": "", + "description": "Initiates writing of a GIF file with the specified name.", + "returnDescription": "false if open or initial write failed.", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The encoder behind the desktop's GifRecorder; recording is desktop-only.", + "missingBrowserSignatures": [ { - "name": "Shaders", - "constructor": true, + "name": "start", + "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.shader.Shaders" + "java.io.OutputStream" ], - "returns": "org.openpatch.scratch.extensions.shader.Shaders", + "returns": "boolean", "parameterNames": [ - "s" + "os" ], "parameterDescriptions": [ - "the shaders to copy" + "OutputStream on which GIF images are written." ], - "description": "Copies a set of shaders.", - "returnDescription": "", + "description": "Initiates GIF file creation on the given stream. The stream is not closed automatically.", + "returnDescription": "false if initial write failed.", "scratchblock": "", "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/shader/Shaders/deactivate", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "signatures": [ + }, { - "name": "deactivate", + "name": "start", "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "void", + "returns": "boolean", "parameterNames": [ - "name" + "file" ], "parameterDescriptions": [ - "the name of the shader" + "String containing output file name." ], - "description": "Stops drawing with the shader of the given name. The other active shaders\nstay.", - "returnDescription": "", + "description": "Initiates writing of a GIF file with the specified name.", + "returnDescription": "false if open or initial write failed.", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shaders/get", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/GifRecorder/constructor", + "owner": "org.openpatch.scratch.recorder.GifRecorder", "signatures": [ { - "name": "get", - "constructor": false, + "name": "GifRecorder", + "constructor": true, "static": false, "parameters": [ "java.lang.String" ], - "returns": "org.openpatch.scratch.extensions.shader.Shader", + "returns": "org.openpatch.scratch.recorder.GifRecorder", "parameterNames": [ - "name" + "path" ], "parameterDescriptions": [ - "the name of the shader" + "the GIF file to write; `.gif` is added when missing" ], - "description": "Returns a shader by name.", - "returnDescription": "the shader, or null if there is none with that name", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -14444,19 +17001,19 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/shader/Shaders/getActive", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/GifRecorder/snapshot", + "owner": "org.openpatch.scratch.recorder.GifRecorder", "signatures": [ { - "name": "getActive", + "name": "snapshot", "constructor": false, "static": false, "parameters": [], - "returns": "java.util.List", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the shaders drawn with, in the order they take turns: the order in\nwhich they were added.", - "returnDescription": "a new list of the active shaders, empty if there are none", + "description": "Saves the next frame as a GIF of one frame.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -14466,19 +17023,19 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/shader/Shaders/getCurrent", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/GifRecorder/start", + "owner": "org.openpatch.scratch.recorder.GifRecorder", "signatures": [ { - "name": "getCurrent", + "name": "start", "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.shader.Shader", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the shader currently drawn with. With several active, this is the\nfirst of them.", - "returnDescription": "the current shader, or null if there is none", + "description": "Starts recording from the next frame on.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -14488,19 +17045,19 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/shader/Shaders/getCurrentIndex", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/GifRecorder/stop", + "owner": "org.openpatch.scratch.recorder.GifRecorder", "signatures": [ { - "name": "getCurrentIndex", + "name": "stop", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "void", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the position of the current shader.", - "returnDescription": "the position, or -1 if no shader is in use", + "description": "Stops recording and finishes the file.", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -14510,188 +17067,155 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/shader/Shaders/getCurrentName", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/RecorderExtension/constructor", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "getCurrentName", - "constructor": false, + "name": "RecorderExtension", + "constructor": true, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "org.openpatch.scratch.recorder.RecorderExtension", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the name of the current shader.", - "returnDescription": "the name, or null if no shader is in use", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/shader/Shaders/isActive", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "isActive", - "constructor": false, + "name": "RecorderExtension", + "constructor": true, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "boolean", - "parameterNames": [ - "name" - ], - "parameterDescriptions": [ - "the name of the shader" - ], - "description": "Returns whether the shader of the given name is drawn with.", - "returnDescription": "true if the shader is active", + "parameters": [], + "returns": "org.openpatch.scratch.recorder.RecorderExtension", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shaders/next", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/RecorderExtension/id", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "next", + "name": "id", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Switches to the next shader, in the order they were added. After the last\none comes the first one again. It is then the only one drawn with.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/shader/Shaders/reset", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "reset", + "name": "id", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Stops drawing with shaders, so the sprite or stage looks as it does\nwithout one. The shaders are kept: [switchTo(String)](switchTo),\n[next()](next) or [activate(String)](activate) brings one back.", + "description": "", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/shader/Shaders/switchTo", - "owner": "org.openpatch.scratch.extensions.shader.Shaders", + "id": "recorder/RecorderExtension/install", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "switchTo", + "name": "install", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "name" + "ctx" ], "parameterDescriptions": [ - "the name of the shader" + "" ], - "description": "Switches to the shader with the given name, or with the given position in\nthe order the shaders were added. It is then the only one drawn with. A\nname that is not there leaves the shaders as they are and prints which ones\nthere are.", + "description": "Hands every drawn frame to the recorders that are recording; frames are read back only then.", "returnDescription": "", "scratchblock": "", "since": "" - }, + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "switchTo", + "name": "install", "constructor": false, "static": false, "parameters": [ - "double" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "index" + "ctx" ], "parameterDescriptions": [ - "the position of the shader" + "" ], - "description": "Switches to the shader at the given position. It is then the only one drawn\nwith.", + "description": "Hands every drawn frame to the recorders that are recording; frames are read back only then.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/sorting/Sorting/by", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", + "id": "recorder/RecorderExtension/name", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "by", + "name": "name", "constructor": false, "static": false, - "parameters": [ - "java.util.Comparator" - ], - "returns": "void", - "parameterNames": [ - "comparator" - ], - "parameterDescriptions": [ - "decides which of two sprites is drawn first" - ], - "description": "Draws sprites in an order of your own.", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "missingBrowserSignatures": [ { - "name": "by", + "name": "name", "constructor": false, "static": false, - "parameters": [ - "java.util.Comparator" - ], - "returns": "void", - "parameterNames": [ - "comparator" - ], - "parameterDescriptions": [ - "decides which of two sprites is drawn first" - ], - "description": "Draws sprites in an order of your own.", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -14699,244 +17223,356 @@ ] }, { - "id": "extensions/sorting/Sorting/byY", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", + "id": "recorder/RecorderExtension/requires", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "byY", + "name": "requires", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Draws sprites that are further down the stage in front of sprites that are\nfurther up, which is what a view from above usually wants.", + "description": "First-party extensions are released together with the core.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/sorting/Sorting/constructor", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "Sorting", - "constructor": true, + "name": "requires", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.sorting.Sorting", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "", + "description": "First-party extensions are released together with the core.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/sorting/Sorting/getComparator", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", + "id": "recorder/RecorderExtension/version", + "owner": "org.openpatch.scratch.recorder.RecorderExtension", "signatures": [ { - "name": "getComparator", + "name": "version", "constructor": false, "static": false, "parameters": [], - "returns": "java.util.Comparator", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the order currently used.", - "returnDescription": "the comparator, or null if the sprites are not sorted", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], "status": "desktop-only", - "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "missingBrowserSignatures": [ { - "name": "getComparator", + "name": "version", "constructor": false, "static": false, "parameters": [], - "returns": "java.util.Comparator", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Returns the order currently used.", - "returnDescription": "the comparator, or null if the sprites are not sorted", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ] }, { - "id": "extensions/sorting/Sorting/isOn", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", + "id": "save/File/constructor", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "isOn", - "constructor": false, + "name": "File", + "constructor": true, "static": false, "parameters": [], - "returns": "boolean", + "returns": "org.openpatch.scratch.save.File", "parameterNames": [], "parameterDescriptions": [], - "description": "Checks whether the sprites are being sorted.", - "returnDescription": "true if an order is set", + "description": "", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/sorting/Sorting/off", - "owner": "org.openpatch.scratch.extensions.sorting.Sorting", + "id": "save/File/load", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "off", + "name": "load", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Draws sprites in the order they were added, which is the default.", - "returnDescription": "", + "static": true, + "parameters": [ + "java.lang.String", + "java.lang.Class" + ], + "returns": "T", + "parameterNames": [ + "path", + "cls" + ], + "parameterDescriptions": [ + "the path to the file from which the object is to be loaded", + "the class of the object to be loaded" + ], + "description": "Loads an object of the specified class from a file at the given path.", + "returnDescription": "the loaded object of the specified class", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/sound/SoundPlayback/close", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/File/loadOrCreate", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "close", + "name": "loadOrCreate", "constructor": false, - "static": false, - "parameters": [], - "returns": "void", - "parameterNames": [], - "parameterDescriptions": [], - "description": "Stops this playback.", - "returnDescription": "", + "static": true, + "parameters": [ + "java.lang.String", + "java.lang.Class" + ], + "returns": "T", + "parameterNames": [ + "path", + "cls" + ], + "parameterDescriptions": [ + "the path to the file from which the object is to be loaded", + "the class of the object to be loaded" + ], + "description": "Loads an object of the specified class from a file at the given path, or\ncreates a new one if the file does not exist.", + "returnDescription": "the loaded object of the specified class, or a new instance if the\n file does not exist", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/sound/SoundPlayback/constructor", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", - "signatures": [], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "id": "save/File/loadXML", + "owner": "org.openpatch.scratch.save.File", + "signatures": [ + { + "name": "loadXML", + "constructor": false, + "static": true, + "parameters": [ + "java.lang.String", + "java.lang.Class" + ], + "returns": "T", + "parameterNames": [ + "path", + "cls" + ], + "parameterDescriptions": [ + "the path to the XML file", + "the class of the object to be loaded" + ], + "description": "Loads an object of the specified class from an XML file at the given path.", + "returnDescription": "the object loaded from the XML file", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/sound/SoundPlayback/getName", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/File/loadXMLOrCreate", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "getName", + "name": "loadXMLOrCreate", "constructor": false, - "static": false, - "parameters": [], - "returns": "java.lang.String", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", - "returnDescription": "the name of the sound", + "static": true, + "parameters": [ + "java.lang.String", + "java.lang.Class" + ], + "returns": "T", + "parameterNames": [ + "path", + "cls" + ], + "parameterDescriptions": [ + "the path to the XML file", + "the class of the object to be loaded" + ], + "description": "Loads an object of the specified class from an XML file at the given path,\nor creates a new one if the file does not exist.", + "returnDescription": "the object loaded from the XML file, or a new instance if the file\n does not exist", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", "missingBrowserSignatures": [] }, { - "id": "extensions/sound/SoundPlayback/getVolume", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/File/save", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "getVolume", + "name": "save", "constructor": false, - "static": false, - "parameters": [], - "returns": "double", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", - "returnDescription": "this playback's volume in percent", + "static": true, + "parameters": [ + "java.lang.String", + "T" + ], + "returns": "void", + "parameterNames": [ + "path", + "obj" + ], + "parameterDescriptions": [ + "the path where the object should be saved", + "the object to be saved" + ], + "description": "Saves the given object to the specified path in the default file type (JSON).", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "save", + "constructor": false, + "static": true, + "parameters": [ + "java.lang.String", + "T" + ], + "returns": "void", + "parameterNames": [ + "path", + "obj" + ], + "parameterDescriptions": [ + "the path where the object should be saved", + "the object to be saved" + ], + "description": "Saves the given object to the specified path in the default file type (JSON).", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/sound/SoundPlayback/isPlaying", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/File/saveXML", + "owner": "org.openpatch.scratch.save.File", "signatures": [ { - "name": "isPlaying", + "name": "saveXML", "constructor": false, - "static": false, - "parameters": [], - "returns": "boolean", - "parameterNames": [], - "parameterDescriptions": [], - "description": "", - "returnDescription": "whether this playback is queued or playing", + "static": true, + "parameters": [ + "java.lang.String", + "T" + ], + "returns": "void", + "parameterNames": [ + "path", + "obj" + ], + "parameterDescriptions": [ + "the path where the XML file will be saved", + "the object to be saved as XML" + ], + "description": "Saves the given object as an XML file at the specified path.", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "saveXML", + "constructor": false, + "static": true, + "parameters": [ + "java.lang.String", + "T" + ], + "returns": "void", + "parameterNames": [ + "path", + "obj" + ], + "parameterDescriptions": [ + "the path where the XML file will be saved", + "the object to be saved as XML" + ], + "description": "Saves the given object as an XML file at the specified path.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/sound/SoundPlayback/setVolume", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/SaveData/constructor", + "owner": "org.openpatch.scratch.save.SaveData", "signatures": [ { - "name": "setVolume", - "constructor": false, + "name": "SaveData", + "constructor": true, "static": false, "parameters": [ - "double" + "java.lang.String", + "java.lang.String", + "java.lang.Class" ], - "returns": "void", + "returns": "org.openpatch.scratch.save.SaveData", "parameterNames": [ - "percent" + "gameId", + "slot", + "type" ], "parameterDescriptions": [ - "volume in percent" + "a stable identifier, for example org.openpatch.coincatcher", + "a slot name, for example slot1, slot2 or slot3", + "the data class to load" ], - "description": "Changes only this playback's volume. Values outside 0..100 are clamped.", + "description": "Selects a game's save slot without creating a file or opening a database.", "returnDescription": "", "scratchblock": "", "since": "" @@ -14947,19 +17583,19 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/sound/SoundPlayback/stop", - "owner": "org.openpatch.scratch.extensions.sound.SoundPlayback", + "id": "save/SaveData/getLocation", + "owner": "org.openpatch.scratch.save.SaveData", "signatures": [ { - "name": "stop", + "name": "getLocation", "constructor": false, "static": false, "parameters": [], - "returns": "void", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], - "description": "Stops this playback, leaving other copies alone.", - "returnDescription": "", + "description": "Returns the save's location for diagnostics. On desktop this is a file path;\nin the browser it identifies an IndexedDB record rather than a file.", + "returnDescription": "a description of the save location", "scratchblock": "", "since": "" } @@ -14969,28 +17605,25 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/text/BitmapText/addGlyph", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveData/loadOrDefault", + "owner": "org.openpatch.scratch.save.SaveData", "signatures": [ { - "name": "addGlyph", + "name": "loadOrDefault", "constructor": false, "static": false, "parameters": [ - "char", - "java.lang.String" + "java.util.function.Supplier" ], - "returns": "void", + "returns": "T", "parameterNames": [ - "character", - "path" + "defaults" ], "parameterDescriptions": [ - "the character to replace", - "its image or built-in costume name" + "creates initial progress for a missing slot; called only when missing" ], - "description": "Assigns an image to a special character, such as a controller button.\nOverrides remain in effect when setFont() changes the ordinary glyphs.", - "returnDescription": "", + "description": "Returns defaults only when the file is missing. Unreadable, incompatible,\nempty or corrupt files raise IOException and remain untouched. Defaults\nstay in memory until the game explicitly calls save.", + "returnDescription": "loaded progress, or the supplied defaults for a missing slot", "scratchblock": "", "since": "" } @@ -15000,52 +17633,60 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/text/BitmapText/constructor", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveData/path", + "owner": "org.openpatch.scratch.save.SaveData", "signatures": [ { - "name": "BitmapText", - "constructor": true, + "name": "path", + "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "org.openpatch.scratch.extensions.text.BitmapText", - "parameterNames": [ - "pattern" - ], - "parameterDescriptions": [ - "image path with an integer format, e.g. \"assets/font%03d.png\"" - ], - "description": "", - "returnDescription": "", + "parameters": [], + "returns": "java.nio.file.Path", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "returnDescription": "the desktop file path", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + "status": "desktop-only", + "reason": "This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.", + "missingBrowserSignatures": [ + { + "name": "path", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.nio.file.Path", + "parameterNames": [], + "parameterDescriptions": [], + "description": "Returns the absolute save file path for desktop tools and Steam Auto-Cloud.", + "returnDescription": "the desktop file path", + "scratchblock": "", + "since": "" + } + ] }, { - "id": "extensions/text/BitmapText/draw", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveData/save", + "owner": "org.openpatch.scratch.save.SaveData", "signatures": [ { - "name": "draw", + "name": "save", "constructor": false, "static": false, "parameters": [ - "org.openpatch.scratch.extensions.drawing.Drawing" + "T" ], "returns": "void", "parameterNames": [ - "drawing" + "data" ], "parameterDescriptions": [ - "the current frame's canvas" + "the progress to save; must not be null" ], - "description": "", + "description": "Serializes before touching the save, flushes a sibling temporary file,\nand replaces the save through an atomic rename. If the filesystem does\nnot support atomic replacement, saving fails rather than falling back\nto an unsafe overwrite. Atomic rename is not a backup or an assurance\nagainst every possible storage failure.\nIn the browser, the method waits until the IndexedDB transaction commits.", "returnDescription": "", "scratchblock": "", "since": "" @@ -15056,249 +17697,159 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/text/BitmapText/getContent", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveExtension/constructor", + "owner": "org.openpatch.scratch.save.SaveExtension", "signatures": [ { - "name": "getContent", - "constructor": false, + "name": "SaveExtension", + "constructor": true, "static": false, "parameters": [], - "returns": "java.lang.String", + "returns": "org.openpatch.scratch.save.SaveExtension", "parameterNames": [], "parameterDescriptions": [], "description": "", - "returnDescription": "the text being shown", + "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/text/BitmapText/getHeight", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "getHeight", - "constructor": false, + "name": "SaveExtension", + "constructor": true, "static": false, "parameters": [], - "returns": "int", + "returns": "org.openpatch.scratch.save.SaveExtension", "parameterNames": [], "parameterDescriptions": [], "description": "", - "returnDescription": "the displayed text's height, including line spacing and sprite size", + "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/text/BitmapText/getWidth", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveExtension/id", + "owner": "org.openpatch.scratch.save.SaveExtension", "signatures": [ { - "name": "getWidth", + "name": "id", "constructor": false, "static": false, "parameters": [], - "returns": "int", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], "description": "", - "returnDescription": "the displayed text's width, including the sprite's size", - "scratchblock": "", - "since": "" - } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/text/BitmapText/setAlign", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "signatures": [ - { - "name": "setAlign", - "constructor": false, - "static": false, - "parameters": [ - "org.openpatch.scratch.TextAlign" - ], - "returns": "void", - "parameterNames": [ - "align" - ], - "parameterDescriptions": [ - "LEFT, CENTER or RIGHT (DEFAULT means LEFT)" - ], - "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/text/BitmapText/setFont", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "setFont", + "name": "id", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "pattern" - ], - "parameterDescriptions": [ - "glyph path with one integer format for the Unicode code point" - ], + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], "description": "", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/text/BitmapText/setLetterSpacing", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveExtension/name", + "owner": "org.openpatch.scratch.save.SaveExtension", "signatures": [ { - "name": "setLetterSpacing", + "name": "name", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "spacing" - ], - "parameterDescriptions": [ - "gap between characters; negative values allow italic glyphs to overlap" - ], + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], "description": "", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/text/BitmapText/setLineSpacing", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "setLineSpacing", + "name": "name", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "spacing" - ], - "parameterDescriptions": [ - "extra pixels between lines" - ], + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], "description": "", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/text/BitmapText/setSpaceWidth", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", + "id": "save/SaveExtension/requires", + "owner": "org.openpatch.scratch.save.SaveExtension", "signatures": [ { - "name": "setSpaceWidth", + "name": "requires", "constructor": false, "static": false, - "parameters": [ - "double" - ], - "returns": "void", - "parameterNames": [ - "width" - ], - "parameterDescriptions": [ - "width of a space, in unscaled pixels" - ], - "description": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "First-party extensions are released together with the core.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/text/BitmapText/showText", - "owner": "org.openpatch.scratch.extensions.text.BitmapText", - "signatures": [ + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ { - "name": "showText", + "name": "requires", "constructor": false, "static": false, - "parameters": [ - "java.lang.String" - ], - "returns": "void", - "parameterNames": [ - "text" - ], - "parameterDescriptions": [ - "text to show, including spaces and newlines" - ], - "description": "", + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "First-party extensions are released together with the core.", "returnDescription": "", "scratchblock": "", "since": "" } - ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] + ] }, { - "id": "extensions/tiled/MapObject/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "save/SaveExtension/version", + "owner": "org.openpatch.scratch.save.SaveExtension", "signatures": [ { - "name": "MapObject", - "constructor": true, + "name": "version", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.MapObject", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -15307,15 +17858,34 @@ "since": "" } ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "missingBrowserSignatures": [ + { + "name": "version", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "tiled/MapObject/constructor", + "owner": "org.openpatch.scratch.tiled.MapObject", + "signatures": [ { "name": "MapObject", "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.MapObject", + "returns": "org.openpatch.scratch.tiled.MapObject", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -15323,11 +17893,14 @@ "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getProperty", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "getProperty", @@ -15354,8 +17927,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/getPropertyBoolean", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyBoolean", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "getPropertyBoolean", @@ -15382,8 +17955,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/getPropertyFloat", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyFloat", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "getPropertyFloat", @@ -15410,8 +17983,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/getPropertyInt", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getPropertyInt", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "getPropertyInt", @@ -15438,8 +18011,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/getShape", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/getShape", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "getShape", @@ -15460,8 +18033,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/MapObject/setClassName", - "owner": "org.openpatch.scratch.extensions.tiled.MapObject", + "id": "tiled/MapObject/setClassName", + "owner": "org.openpatch.scratch.tiled.MapObject", "signatures": [ { "name": "setClassName", @@ -15483,11 +18056,38 @@ "since": "" } ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", - "missingBrowserSignatures": [ + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "tiled/Property/constructor", + "owner": "org.openpatch.scratch.tiled.Property", + "signatures": [ { - "name": "setClassName", + "name": "Property", + "constructor": true, + "static": false, + "parameters": [], + "returns": "org.openpatch.scratch.tiled.Property", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] + }, + { + "id": "tiled/Property/setText", + "owner": "org.openpatch.scratch.tiled.Property", + "signatures": [ + { + "name": "setText", "constructor": false, "static": false, "parameters": [ @@ -15495,28 +18095,31 @@ ], "returns": "void", "parameterNames": [ - "className" + "text" ], "parameterDescriptions": [ - "" + "the element text" ], - "description": "Tiled 1.9 renamed an object's type to class; both end up in [type](type)\n(an explicit type wins).", + "description": "Multi-line strings are written as the element's text instead of a value\nattribute.", "returnDescription": "", "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/Property/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.Property", + "id": "tiled/TiledExtension/constructor", + "owner": "org.openpatch.scratch.tiled.TiledExtension", "signatures": [ { - "name": "Property", + "name": "TiledExtension", "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.Property", + "returns": "org.openpatch.scratch.tiled.TiledExtension", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -15525,15 +18128,15 @@ "since": "" } ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "missingBrowserSignatures": [ { - "name": "Property", + "name": "TiledExtension", "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.Property", + "returns": "org.openpatch.scratch.tiled.TiledExtension", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -15544,47 +18147,191 @@ ] }, { - "id": "extensions/tiled/Property/setText", - "owner": "org.openpatch.scratch.extensions.tiled.Property", + "id": "tiled/TiledExtension/id", + "owner": "org.openpatch.scratch.tiled.TiledExtension", "signatures": [ { - "name": "setText", + "name": "id", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ + { + "name": "id", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "tiled/TiledExtension/install", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "signatures": [ + { + "name": "install", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "text" + "ctx" ], "parameterDescriptions": [ - "the element text" + "" ], - "description": "Multi-line strings are written as the element's text instead of a value\nattribute.", + "description": "Every layer of a stage draws its shown map layers, only the part the camera shows.", "returnDescription": "", "scratchblock": "", "since": "" } ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", "missingBrowserSignatures": [ { - "name": "setText", + "name": "install", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "org.openpatch.scratch.extension.ExtensionContext" ], "returns": "void", "parameterNames": [ - "text" + "ctx" ], "parameterDescriptions": [ - "the element text" + "" ], - "description": "Multi-line strings are written as the element's text instead of a value\nattribute.", + "description": "Every layer of a stage draws its shown map layers, only the part the camera shows.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "tiled/TiledExtension/name", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "signatures": [ + { + "name": "name", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ + { + "name": "name", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "tiled/TiledExtension/requires", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "signatures": [ + { + "name": "requires", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "First-party extensions are released together with the core.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ + { + "name": "requires", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "First-party extensions are released together with the core.", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ] + }, + { + "id": "tiled/TiledExtension/version", + "owner": "org.openpatch.scratch.tiled.TiledExtension", + "signatures": [ + { + "name": "version", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", + "returnDescription": "", + "scratchblock": "", + "since": "" + } + ], + "status": "desktop-only", + "reason": "The extension's entry point for the desktop's ServiceLoader. The browser ships this extension natively.", + "missingBrowserSignatures": [ + { + "name": "version", + "constructor": false, + "static": false, + "parameters": [], + "returns": "java.lang.String", + "parameterNames": [], + "parameterDescriptions": [], + "description": "", "returnDescription": "", "scratchblock": "", "since": "" @@ -15592,8 +18339,8 @@ ] }, { - "id": "extensions/tiled/TiledMap/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/constructor", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "TiledMap", @@ -15602,7 +18349,7 @@ "parameters": [ "java.lang.String" ], - "returns": "org.openpatch.scratch.extensions.tiled.TiledMap", + "returns": "org.openpatch.scratch.tiled.TiledMap", "parameterNames": [ "path" ], @@ -15622,7 +18369,7 @@ "java.lang.String", "org.openpatch.scratch.Stage" ], - "returns": "org.openpatch.scratch.extensions.tiled.TiledMap", + "returns": "org.openpatch.scratch.tiled.TiledMap", "parameterNames": [ "path", "stage" @@ -15642,8 +18389,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getHeight", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getHeight", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getHeight", @@ -15664,8 +18411,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getObjectsFromLayer", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getObjectsFromLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getObjectsFromLayer", @@ -15674,7 +18421,7 @@ "parameters": [ "java.lang.String" ], - "returns": "org.openpatch.scratch.extensions.tiled.MapObject[]", + "returns": "org.openpatch.scratch.tiled.MapObject[]", "parameterNames": [ "name" ], @@ -15692,8 +18439,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getProperty", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getProperty", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getProperty", @@ -15742,8 +18489,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getPropertyBoolean", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyBoolean", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getPropertyBoolean", @@ -15770,8 +18517,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getPropertyFloat", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyFloat", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getPropertyFloat", @@ -15798,8 +18545,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getPropertyInt", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getPropertyInt", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getPropertyInt", @@ -15826,8 +18573,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getTileCollisionShapes", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileCollisionShapes", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getTileCollisionShapes", @@ -15879,8 +18626,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getTileHeight", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileHeight", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getTileHeight", @@ -15901,8 +18648,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getTileId", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileId", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getTileId", @@ -15935,8 +18682,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getTileWidth", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getTileWidth", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getTileWidth", @@ -15957,8 +18704,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/getWidth", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/getWidth", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "getWidth", @@ -15979,25 +18726,25 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/spawn", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/hideLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { - "name": "spawn", + "name": "hideLayer", "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "java.util.List", + "returns": "void", "parameterNames": [ - "layerName" + "name" ], "parameterDescriptions": [ - "the object layer" + "the tile layer's name in Tiled" ], - "description": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.\n\nThe sprite's class needs one of these constructors, tried in this order:\none that takes the [MapObject](../MapObject/index) (to read its name and properties), one\nthat takes `(double x, double y)`, or one without parameters. Either\nway the sprite is put where the object is. An object drawn as an area\n(a rectangle, an ellipse or a polygon) also gives the sprite that area as\nits hitbox, which is how walls and water work without a costume.\n\nObjects whose type is not a sprite class, or that have no type, are left\nalone, so a layer can hold markers the program reads itself.\n\n```java\nTiledMap map = new TiledMap(\"level.tmx\", this);\nmap.spawn(\"Objects\");\n```", - "returnDescription": "the sprites that were made, in the order of the layer", + "description": "Stops drawing a tile layer shown with [showLayer(String, Layer)](showLayer).", + "returnDescription": "", "scratchblock": "", "since": "" } @@ -16007,24 +18754,27 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/stampLayerToBackground", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/showLayer", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { - "name": "stampLayerToBackground", + "name": "showLayer", "constructor": false, "static": false, "parameters": [ - "java.lang.String" + "java.lang.String", + "org.openpatch.scratch.Layer" ], "returns": "void", "parameterNames": [ - "name" + "name", + "layer" ], "parameterDescriptions": [ - "the name of the layer to be stamped onto the background" + "the tile layer's name in Tiled", + "the stage's layer to draw it in" ], - "description": "Stamps a specified layer onto the background.", + "description": "Shows a tile layer of the map in a layer of the stage, drawn every frame from now on (only\nthe tiles the camera shows). The map's top left corner is at (0, 0) of the world; the map\nextends right and down.\n\n```java\nmap.showLayer(\"ground\", Layer.BACKGROUND);\nmap.showLayer(\"trees\", Layer.FOREGROUND);\n```", "returnDescription": "", "scratchblock": "", "since": "" @@ -16035,25 +18785,25 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/stampLayerToForeground", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/spawn", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { - "name": "stampLayerToForeground", + "name": "spawn", "constructor": false, "static": false, "parameters": [ "java.lang.String" ], - "returns": "void", + "returns": "java.util.List", "parameterNames": [ - "name" + "layerName" ], "parameterDescriptions": [ - "the name of the layer to be stamped to the foreground" + "the object layer" ], - "description": "Stamps the specified layer to the foreground.", - "returnDescription": "", + "description": "Creates a sprite for each object of a layer whose type names a sprite class,\nand adds it to the stage. In Tiled, give an object the type (called\n\"class\" in newer versions of Tiled) `Player`, and the map makes a\n`new Player()` where the object is.\n\nThe sprite's class needs one of these constructors, tried in this order:\none that takes the [MapObject](../MapObject/index) (to read its name and properties), one\nthat takes `(double x, double y)`, or one without parameters. Either\nway the sprite is put where the object is. An object drawn as an area\n(a rectangle, an ellipse or a polygon) also gives the sprite that area as\nits hitbox, which is how walls and water work without a costume.\n\nObjects whose type is not a sprite class, or that have no type, are left\nalone, so a layer can hold markers the program reads itself.\n\n```java\nTiledMap map = new TiledMap(\"level.tmx\", this);\nmap.spawn(\"Objects\");\n```", + "returnDescription": "the sprites that were made, in the order of the layer", "scratchblock": "", "since": "" } @@ -16063,8 +18813,8 @@ "missingBrowserSignatures": [] }, { - "id": "extensions/tiled/TiledMap/toString", - "owner": "org.openpatch.scratch.extensions.tiled.TiledMap", + "id": "tiled/TiledMap/toString", + "owner": "org.openpatch.scratch.tiled.TiledMap", "signatures": [ { "name": "toString", @@ -16080,20 +18830,15 @@ "since": "" } ], - "status": "implemented", - "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", - "missingBrowserSignatures": [] - }, - { - "id": "extensions/tiled/TilesetImage/constructor", - "owner": "org.openpatch.scratch.extensions.tiled.TilesetImage", - "signatures": [ + "status": "desktop-only", + "reason": "Prints the desktop's parsed TMX tree as JSON; the browser reads maps without it.", + "missingBrowserSignatures": [ { - "name": "TilesetImage", - "constructor": true, + "name": "toString", + "constructor": false, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.TilesetImage", + "returns": "java.lang.String", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -16101,16 +18846,18 @@ "scratchblock": "", "since": "" } - ], - "status": "awaiting-browser-support", - "reason": "Some desktop overloads are not declared by the browser. See the missing signatures in the compatibility contract.", - "missingBrowserSignatures": [ + ] + }, + { + "id": "tiled/TilesetImage/constructor", + "owner": "org.openpatch.scratch.tiled.TilesetImage", + "signatures": [ { "name": "TilesetImage", "constructor": true, "static": false, "parameters": [], - "returns": "org.openpatch.scratch.extensions.tiled.TilesetImage", + "returns": "org.openpatch.scratch.tiled.TilesetImage", "parameterNames": [], "parameterDescriptions": [], "description": "", @@ -16118,7 +18865,10 @@ "scratchblock": "", "since": "" } - ] + ], + "status": "implemented", + "reason": "Declared by the browser; behavioral limitations and compiler dialect differences still apply.", + "missingBrowserSignatures": [] } ] } diff --git a/examples/.project b/examples/.project new file mode 100644 index 00000000..ae585a61 --- /dev/null +++ b/examples/.project @@ -0,0 +1,46 @@ + + + scratch-examples + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + .._templates_extension-starter_src_main_java + 2 + //home/mike/Sources/openpatch/scratch-for-java/templates/extension-starter/src/main/java/ + + + .._templates_extension-starter_src_test_java + 2 + //home/mike/Sources/openpatch/scratch-for-java/templates/extension-starter/src/test/java/ + + + + + 1792662947248 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/examples/pom.xml b/examples/pom.xml new file mode 100644 index 00000000..0fcf2c5b --- /dev/null +++ b/examples/pom.xml @@ -0,0 +1,137 @@ + + 4.0.0 + + + org.openpatch + scratch-parent + 6.5.0 + + + + scratch-examples + jar + Scratch for Java (examples) + + + true + true + + + + + org.openpatch + scratch + + + org.openpatch + scratch-tiled + ${project.version} + + + org.openpatch + scratch-save + ${project.version} + + + org.openpatch + scratch-recorder + ${project.version} + + + org.openpatch + scratch-drawing + ${project.version} + + + org.openpatch + scratch-gamepad + ${project.version} + + + + com.github.romankh3 + image-comparison + 4.4.0 + test + + + + + + + nrw + + true + true + true + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.6.0 + + + extension-starter-sources + generate-sources + + add-source + + + + ${project.basedir}/../templates/extension-starter/src/main/java + + ${project.basedir}/src/tools/java + + + + + extension-starter-tests + generate-test-sources + + add-test-source + + + + ${project.basedir}/../templates/extension-starter/src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + -Xmaxerrs + 10000 + + + + + + + + src/main/java + + **/*.java + + + + + diff --git a/examples/src/main/java/benchmark/Bench.java b/examples/src/main/java/benchmark/Bench.java new file mode 100644 index 00000000..3020fe2d --- /dev/null +++ b/examples/src/main/java/benchmark/Bench.java @@ -0,0 +1,131 @@ +package benchmark; + +import demos.stressTest.Dino; +import demos.stressTest.Figure; +import demos.stressTest.FigureState; +import demos.stressTest.Knight; +import demos.stressTest.Ninja; +import java.lang.management.ManagementFactory; +import java.util.Locale; +import org.openpatch.scratch.Color; +import org.openpatch.scratch.Sprite; +import org.openpatch.scratch.Stage; + +/** + * The scenes of {@code scripts/benchmark.sh}, the same source for 6.x and 7.0 (it uses only API + * both have): measures updates and frames per second, CPU and the cost of the checks, then ends. + * + *
    + *
  • {@code stress}: the stress-test demo, every figure running (as after pressing space) + *
  • {@code collide}: n turning sprites, each asking every update which of the others it + * touches (n - 1 hitbox checks each) + *
  • {@code color}: n sprites, each asking every update whether it touches a colour that is + * nowhere (a full colour check) + *
+ */ +public class Bench extends Stage { + public static String version, scene; + public static int n, width, height; + /** frames counted by 7.0's frame hook; stays -1 in 6.x, where every frame is one update */ + public static volatile long frames = -1; + static long checkNanos, checks; + + private static final double WARMUP = 3, MEASURE = 8; + private long started, measureFrom, updates, framesAtStart, cpuAtStart; + + public Bench() { + if (scene.equals("stress")) { + this.addBackdrop("outback", "demos/stressTest/assets/outback.png"); + for (int i = 0; i < n; i++) { + Figure f = i % 3 == 0 ? new Dino() : i % 3 == 1 ? new Knight() : new Ninja(); + f.state = FigureState.RUN; // as after pressing space: every figure runs + this.add(f); + } + } else { + this.addBackdrop("outback", "demos/stressTest/assets/outback.png"); + for (int i = 0; i < n; i++) { + this.add(scene.equals("collide") ? new Ball() : new Seeker()); + } + } + } + + static long cpu() { + return ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getProcessCpuTime(); + } + + public void run() { + long now = System.nanoTime(); + if (started == 0) { + started = now; + } + if (measureFrom == 0 && now - started >= WARMUP * 1e9) { + measureFrom = now; + updates = 0; + framesAtStart = frames; + cpuAtStart = cpu(); + checkNanos = 0; + checks = 0; + } + if (measureFrom == 0) { + return; + } + updates++; + double seconds = (now - measureFrom) / 1e9; + if (seconds >= MEASURE) { + double ups = updates / seconds; + double fps = frames < 0 ? ups : (frames - framesAtStart) / seconds; + double cores = (cpu() - cpuAtStart) / 1e9 / seconds; + double perUpdateMs = updates == 0 ? 0 : checkNanos / 1e6 / updates; + double perCheckNs = checks == 0 ? 0 : (double) checkNanos / checks; + System.out.println(String.format(Locale.ROOT, + "RESULT version=%s scene=%s n=%d updates=%.1f frames=%.1f cpu=%.2f checkMs=%.3f nsPerCheck=%.1f", + version, scene, n, ups, fps, cores, perUpdateMs, perCheckNs)); + System.out.flush(); + if (Boolean.getBoolean("benchmark.exit")) { + System.exit(0); // shutdown hooks run: a profiler can write its recording + } + Runtime.getRuntime().halt(0); // 6.x may hang in a normal exit + } + } + + /** Moves, turns, and asks which of the others it touches: n - 1 hitbox checks. */ + public static class Ball extends Sprite { + public Ball() { + this.addCostume("bunny1_stand"); + this.setSize(40); + this.setPosition(this.pickRandom(-width / 2 + 40, width / 2 - 40), this.pickRandom(-height / 2 + 40, height / 2 - 40)); + this.setDirection(this.pickRandom(0, 359)); + } + + public void run() { + this.move(2); + this.ifOnEdgeBounce(); + this.turnRight(1); + long t = System.nanoTime(); + this.getTouchingSprites(Ball.class); + checkNanos += System.nanoTime() - t; + checks += n - 1; + } + } + + /** Moves and asks whether it touches a colour that is nowhere: a full colour check. */ + public static class Seeker extends Sprite { + private static final Color NOWHERE = new Color(1, 254, 3); + + public Seeker() { + this.addCostume("bunny1_stand"); + this.setSize(40); + this.setPosition(this.pickRandom(-width / 2 + 40, width / 2 - 40), this.pickRandom(-height / 2 + 40, height / 2 - 40)); + this.setDirection(this.pickRandom(0, 359)); + } + + public void run() { + this.move(2); + this.ifOnEdgeBounce(); + long t = System.nanoTime(); + this.isTouchingColor(NOWHERE); + checkNanos += System.nanoTime() - t; + checks++; + } + } +} diff --git a/examples/src/main/java/benchmark/Benchmark.java b/examples/src/main/java/benchmark/Benchmark.java new file mode 100644 index 00000000..d8c0f829 --- /dev/null +++ b/examples/src/main/java/benchmark/Benchmark.java @@ -0,0 +1,37 @@ +package benchmark; + +import org.openpatch.scratch.Window; +import org.openpatch.scratch.extension.Extension; +import org.openpatch.scratch.extension.ExtensionContext; + +/** Starts a scene of {@link Bench} on 7.0: {@code Benchmark }. */ +public class Benchmark { + public static void main(String[] args) { + Bench.version = "7.0"; + Bench.scene = args[0]; + Bench.n = Integer.parseInt(args[1]); + Bench.width = args[0].equals("stress") ? 1200 : 960; + Bench.height = args[0].equals("stress") ? 800 : 720; + // counts the frames the window shows: ticks and frames are separate in 7.0 + Window.use(new Extension() { + public String id() { + return "benchmark-frames"; + } + + public String name() { + return "Frame counter"; + } + + public String version() { + return "1"; + } + + public void install(ExtensionContext ctx) { + Bench.frames = 0; + ctx.afterFrame((stage, frame) -> Bench.frames++); + } + }); + Window window = new Window(Bench.width, Bench.height, "demos/stressTest/assets"); + window.setStage(new Bench()); + } +} diff --git a/src/examples/java/demos/cat/CatSketch.java b/examples/src/main/java/demos/cat/CatSketch.java similarity index 100% rename from src/examples/java/demos/cat/CatSketch.java rename to examples/src/main/java/demos/cat/CatSketch.java diff --git a/docs/archives/bluej-starter/assets/cat.png b/examples/src/main/java/demos/cat/sprites/cat.png similarity index 100% rename from docs/archives/bluej-starter/assets/cat.png rename to examples/src/main/java/demos/cat/sprites/cat.png diff --git a/src/examples/java/demos/catPlatformer/Bean.java b/examples/src/main/java/demos/catPlatformer/Bean.java similarity index 67% rename from src/examples/java/demos/catPlatformer/Bean.java rename to examples/src/main/java/demos/catPlatformer/Bean.java index 452362f3..02849450 100644 --- a/src/examples/java/demos/catPlatformer/Bean.java +++ b/examples/src/main/java/demos/catPlatformer/Bean.java @@ -1,13 +1,13 @@ package demos.catPlatformer; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; /** A spinning coffee bean to collect. */ -public class Bean extends AnimatedSprite { +public class Bean extends Sprite { public Bean(double x, double y) { this.addAnimation("spin", "coffee_bean_%d", 4); - this.setAnimationInterval(120); + this.setAnimationInterval(0.12); this.setX(x); this.setY(y); } diff --git a/src/examples/java/demos/catPlatformer/Bug.java b/examples/src/main/java/demos/catPlatformer/Bug.java similarity index 91% rename from src/examples/java/demos/catPlatformer/Bug.java rename to examples/src/main/java/demos/catPlatformer/Bug.java index 562f8cfd..0f333685 100644 --- a/src/examples/java/demos/catPlatformer/Bug.java +++ b/examples/src/main/java/demos/catPlatformer/Bug.java @@ -1,10 +1,10 @@ package demos.catPlatformer; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; import org.openpatch.scratch.RotationStyle; /** A bug walking to and fro. Jump on it or punch it - but do not walk into it. */ -public class Bug extends AnimatedSprite { +public class Bug extends Sprite { /** The costume is 32 pixels high, the legs end 3 pixels above its bottom. */ private static final double FEET = 13; @@ -17,7 +17,7 @@ public class Bug extends AnimatedSprite { public Bug(double minX, double maxX, double floor) { this.addAnimation("walk", "bug_walk_%d", 4); this.addAnimation("squished", "bug_squished_%d", 2); - this.setAnimationInterval(120); + this.setAnimationInterval(0.12); this.setRotationStyle(RotationStyle.LEFT_RIGHT); this.minX = minX; this.maxX = maxX; diff --git a/src/examples/java/demos/catPlatformer/Cat.java b/examples/src/main/java/demos/catPlatformer/Cat.java similarity index 98% rename from src/examples/java/demos/catPlatformer/Cat.java rename to examples/src/main/java/demos/catPlatformer/Cat.java index 1d331e05..2cd16638 100644 --- a/src/examples/java/demos/catPlatformer/Cat.java +++ b/examples/src/main/java/demos/catPlatformer/Cat.java @@ -1,11 +1,11 @@ package demos.catPlatformer; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; import org.openpatch.scratch.KeyCode; import org.openpatch.scratch.RotationStyle; /** The Scratch for Java cat. Every one of its animations is on the built-in cat sheet. */ -public class Cat extends AnimatedSprite { +public class Cat extends Sprite { /** The costumes are 64 pixels high with the feet on the bottom row. */ private static final double FEET = 32; @@ -40,7 +40,7 @@ public Cat() { this.addAnimation("ko", "cat_ko_%d", 5); this.addAnimation("cheer", "cat_cheer_%d", 4); this.addAnimation("climb", "cat_climb_%d", 4); - this.setAnimationInterval(100); + this.setAnimationInterval(0.1); this.addSound("footstep_grass_000"); this.addSound("impactPunch_medium_004"); this.addSound("impactSoft_heavy_000"); diff --git a/src/examples/java/demos/catPlatformer/CatPlatformer.java b/examples/src/main/java/demos/catPlatformer/CatPlatformer.java similarity index 100% rename from src/examples/java/demos/catPlatformer/CatPlatformer.java rename to examples/src/main/java/demos/catPlatformer/CatPlatformer.java diff --git a/src/examples/java/demos/catPlatformer/Goal.java b/examples/src/main/java/demos/catPlatformer/Goal.java similarity index 73% rename from src/examples/java/demos/catPlatformer/Goal.java rename to examples/src/main/java/demos/catPlatformer/Goal.java index 0878d9a8..e42f1a68 100644 --- a/src/examples/java/demos/catPlatformer/Goal.java +++ b/examples/src/main/java/demos/catPlatformer/Goal.java @@ -1,13 +1,13 @@ package demos.catPlatformer; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; /** The steaming mug at the end of the level. */ -public class Goal extends AnimatedSprite { +public class Goal extends Sprite { public Goal(double x, double floor) { this.addAnimation("steam", "goal_mug_%d", 4); - this.setAnimationInterval(150); + this.setAnimationInterval(0.15); this.setX(x); // the mug stands on the bottom two rows of its 32 pixel costume this.setY(floor + 14); diff --git a/src/examples/java/demos/catPlatformer/Ground.java b/examples/src/main/java/demos/catPlatformer/Ground.java similarity index 100% rename from src/examples/java/demos/catPlatformer/Ground.java rename to examples/src/main/java/demos/catPlatformer/Ground.java diff --git a/src/examples/java/demos/catPlatformer/Heart.java b/examples/src/main/java/demos/catPlatformer/Heart.java similarity index 100% rename from src/examples/java/demos/catPlatformer/Heart.java rename to examples/src/main/java/demos/catPlatformer/Heart.java diff --git a/src/examples/java/demos/catPlatformer/Ladder.java b/examples/src/main/java/demos/catPlatformer/Ladder.java similarity index 100% rename from src/examples/java/demos/catPlatformer/Ladder.java rename to examples/src/main/java/demos/catPlatformer/Ladder.java diff --git a/src/examples/java/demos/catPlatformer/Platform.java b/examples/src/main/java/demos/catPlatformer/Platform.java similarity index 100% rename from src/examples/java/demos/catPlatformer/Platform.java rename to examples/src/main/java/demos/catPlatformer/Platform.java diff --git a/src/examples/java/demos/clock/ClockSprite.java b/examples/src/main/java/demos/clock/ClockSprite.java similarity index 100% rename from src/examples/java/demos/clock/ClockSprite.java rename to examples/src/main/java/demos/clock/ClockSprite.java diff --git a/src/examples/java/demos/clock/ClockStage.java b/examples/src/main/java/demos/clock/ClockStage.java similarity index 100% rename from src/examples/java/demos/clock/ClockStage.java rename to examples/src/main/java/demos/clock/ClockStage.java diff --git a/src/examples/java/demos/clock/HourHandSprite.java b/examples/src/main/java/demos/clock/HourHandSprite.java similarity index 100% rename from src/examples/java/demos/clock/HourHandSprite.java rename to examples/src/main/java/demos/clock/HourHandSprite.java diff --git a/src/examples/java/demos/clock/MinuteHandSprite.java b/examples/src/main/java/demos/clock/MinuteHandSprite.java similarity index 100% rename from src/examples/java/demos/clock/MinuteHandSprite.java rename to examples/src/main/java/demos/clock/MinuteHandSprite.java diff --git a/src/examples/java/demos/clock/SecondHandSprite.java b/examples/src/main/java/demos/clock/SecondHandSprite.java similarity index 100% rename from src/examples/java/demos/clock/SecondHandSprite.java rename to examples/src/main/java/demos/clock/SecondHandSprite.java diff --git a/src/examples/java/demos/clock/sprites/clock.png b/examples/src/main/java/demos/clock/sprites/clock.png similarity index 100% rename from src/examples/java/demos/clock/sprites/clock.png rename to examples/src/main/java/demos/clock/sprites/clock.png diff --git a/src/examples/java/demos/clock/sprites/clock.svg b/examples/src/main/java/demos/clock/sprites/clock.svg similarity index 100% rename from src/examples/java/demos/clock/sprites/clock.svg rename to examples/src/main/java/demos/clock/sprites/clock.svg diff --git a/src/examples/java/demos/clock/sprites/hour.png b/examples/src/main/java/demos/clock/sprites/hour.png similarity index 100% rename from src/examples/java/demos/clock/sprites/hour.png rename to examples/src/main/java/demos/clock/sprites/hour.png diff --git a/src/examples/java/demos/clock/sprites/minute.png b/examples/src/main/java/demos/clock/sprites/minute.png similarity index 100% rename from src/examples/java/demos/clock/sprites/minute.png rename to examples/src/main/java/demos/clock/sprites/minute.png diff --git a/src/examples/java/demos/clock/sprites/second.png b/examples/src/main/java/demos/clock/sprites/second.png similarity index 100% rename from src/examples/java/demos/clock/sprites/second.png rename to examples/src/main/java/demos/clock/sprites/second.png diff --git a/src/examples/java/demos/coinCollector/Coin.java b/examples/src/main/java/demos/coinCollector/Coin.java similarity index 100% rename from src/examples/java/demos/coinCollector/Coin.java rename to examples/src/main/java/demos/coinCollector/Coin.java diff --git a/src/examples/java/demos/coinCollector/CoinCollector.java b/examples/src/main/java/demos/coinCollector/CoinCollector.java similarity index 94% rename from src/examples/java/demos/coinCollector/CoinCollector.java rename to examples/src/main/java/demos/coinCollector/CoinCollector.java index ec6e6f39..e5abed6e 100644 --- a/src/examples/java/demos/coinCollector/CoinCollector.java +++ b/examples/src/main/java/demos/coinCollector/CoinCollector.java @@ -2,6 +2,7 @@ import org.openpatch.scratch.Stage; import org.openpatch.scratch.Text; +import org.openpatch.scratch.TextAlign; import org.openpatch.scratch.Window; /** @@ -51,7 +52,8 @@ public CoinCollector() { // end stage designer this.score = new Text(); - this.score.setPosition(-330, 200); + this.score.setPosition(-380, 200); + this.score.setAlign(TextAlign.LEFT); this.score.setTextSize(28); this.score.showText("Coins: 0 / " + COINS); this.add(this.score); diff --git a/src/examples/java/demos/coinCollector/Ground.java b/examples/src/main/java/demos/coinCollector/Ground.java similarity index 100% rename from src/examples/java/demos/coinCollector/Ground.java rename to examples/src/main/java/demos/coinCollector/Ground.java diff --git a/src/examples/java/demos/coinCollector/Player.java b/examples/src/main/java/demos/coinCollector/Player.java similarity index 95% rename from src/examples/java/demos/coinCollector/Player.java rename to examples/src/main/java/demos/coinCollector/Player.java index dfc23843..baafe454 100644 --- a/src/examples/java/demos/coinCollector/Player.java +++ b/examples/src/main/java/demos/coinCollector/Player.java @@ -2,10 +2,10 @@ import org.openpatch.scratch.KeyCode; import org.openpatch.scratch.RotationStyle; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; /** The alien you steer with the arrow keys. */ -public class Player extends AnimatedSprite { +public class Player extends Sprite { private static final int SIZE = 45; @@ -25,7 +25,7 @@ public Player() { this.addCostume("alienGreen_stand"); this.addCostume("alienGreen_jump"); this.addAnimation("walk", "alienGreen_walk%d", 2); - this.setAnimationInterval(120); + this.setAnimationInterval(0.12); this.addSound("handleCoins"); this.addSound("footstep_grass_000"); // end sprite editor diff --git a/src/examples/java/demos/donutIO/Background.java b/examples/src/main/java/demos/donutIO/Background.java similarity index 80% rename from src/examples/java/demos/donutIO/Background.java rename to examples/src/main/java/demos/donutIO/Background.java index 989a48c4..5edacb31 100644 --- a/src/examples/java/demos/donutIO/Background.java +++ b/examples/src/main/java/demos/donutIO/Background.java @@ -8,10 +8,11 @@ public Background() { // begin sprite editor this.addCostume("grid", "demos/donutIO/assets/grid.png"); // end sprite editor + // scenery: the grid covers the stage, so it must not count as touching anything + this.disableHitbox(); } public void run() { - this.getPen().eraseAll(); this.setX(this.getStage().getCamera().getX() - this.getStage().getCamera().getX() % 40); this.setY(this.getStage().getCamera().getY() - this.getStage().getCamera().getY() % 40); } diff --git a/src/examples/java/demos/donutIO/Donut.java b/examples/src/main/java/demos/donutIO/Donut.java similarity index 96% rename from src/examples/java/demos/donutIO/Donut.java rename to examples/src/main/java/demos/donutIO/Donut.java index 4636ee18..7070408e 100644 --- a/src/examples/java/demos/donutIO/Donut.java +++ b/examples/src/main/java/demos/donutIO/Donut.java @@ -37,7 +37,6 @@ public double getStrength() { public void run() { var touchingDonut = this.getTouchingSprite(Donut.class); - debug("touchingDonut: " + getX()); if (touchingDonut != null && this.strength >= touchingDonut.strength) { this.setStrength(this.strength + touchingDonut.strength); touchingDonut.remove(); diff --git a/src/examples/java/demos/donutIO/FollowDonut.java b/examples/src/main/java/demos/donutIO/FollowDonut.java similarity index 100% rename from src/examples/java/demos/donutIO/FollowDonut.java rename to examples/src/main/java/demos/donutIO/FollowDonut.java diff --git a/src/examples/java/demos/donutIO/Game.java b/examples/src/main/java/demos/donutIO/Game.java similarity index 86% rename from src/examples/java/demos/donutIO/Game.java rename to examples/src/main/java/demos/donutIO/Game.java index df8a9a08..dfb61395 100644 --- a/src/examples/java/demos/donutIO/Game.java +++ b/examples/src/main/java/demos/donutIO/Game.java @@ -1,7 +1,6 @@ package demos.donutIO; import org.openpatch.scratch.Window; -import org.openpatch.scratch.Text; public class Game extends Window { @@ -16,7 +15,6 @@ public Game() { } public static void main(String[] args) { - Text.useFontSizes(32, 48); // begin project settings // end project settings new Game(); diff --git a/src/examples/java/demos/donutIO/GameOverStage.java b/examples/src/main/java/demos/donutIO/GameOverStage.java similarity index 90% rename from src/examples/java/demos/donutIO/GameOverStage.java rename to examples/src/main/java/demos/donutIO/GameOverStage.java index b6394014..97d9afe5 100644 --- a/src/examples/java/demos/donutIO/GameOverStage.java +++ b/examples/src/main/java/demos/donutIO/GameOverStage.java @@ -34,10 +34,9 @@ public GameOverStage() { } public void whenKeyPressed(KeyCode keyCode) { - System.out.println(keyCode); if (keyCode == KeyCode.SPACE) { Game.LEVEL = 0; - Window.getInstance().transitionToStage(new WorldStage(), 500); + Window.getInstance().transitionToStage(new WorldStage(), 0.5); } } } diff --git a/src/examples/java/demos/donutIO/PlayerDonut.java b/examples/src/main/java/demos/donutIO/PlayerDonut.java similarity index 100% rename from src/examples/java/demos/donutIO/PlayerDonut.java rename to examples/src/main/java/demos/donutIO/PlayerDonut.java diff --git a/src/examples/java/demos/donutIO/StartStage.java b/examples/src/main/java/demos/donutIO/StartStage.java similarity index 94% rename from src/examples/java/demos/donutIO/StartStage.java rename to examples/src/main/java/demos/donutIO/StartStage.java index c6177718..a8241d32 100644 --- a/src/examples/java/demos/donutIO/StartStage.java +++ b/examples/src/main/java/demos/donutIO/StartStage.java @@ -44,7 +44,7 @@ public StartStage() { public void whenKeyPressed(KeyCode keyCode) { if (keyCode == KeyCode.SPACE) { Game.LEVEL = 0; - Window.getInstance().transitionToStage(new WorldStage(), 500); + Window.getInstance().transitionToStage(new WorldStage(), 0.5); } } } diff --git a/src/examples/java/demos/donutIO/WinStage.java b/examples/src/main/java/demos/donutIO/WinStage.java similarity index 92% rename from src/examples/java/demos/donutIO/WinStage.java rename to examples/src/main/java/demos/donutIO/WinStage.java index 8a2dafb7..ee7c05f0 100644 --- a/src/examples/java/demos/donutIO/WinStage.java +++ b/examples/src/main/java/demos/donutIO/WinStage.java @@ -36,7 +36,7 @@ public WinStage() { public void whenKeyPressed(KeyCode keyCode) { if (keyCode == KeyCode.SPACE) { Game.LEVEL += 1; - Window.getInstance().transitionToStage(new WorldStage(), 500); + Window.getInstance().transitionToStage(new WorldStage(), 0.5); } } } diff --git a/src/examples/java/demos/donutIO/WorldStage.java b/examples/src/main/java/demos/donutIO/WorldStage.java similarity index 95% rename from src/examples/java/demos/donutIO/WorldStage.java rename to examples/src/main/java/demos/donutIO/WorldStage.java index a296741e..0bb5bd4e 100644 --- a/src/examples/java/demos/donutIO/WorldStage.java +++ b/examples/src/main/java/demos/donutIO/WorldStage.java @@ -41,7 +41,7 @@ public WorldStage() { } public void run() { - if (this.getTimer().everyMillis(1000)) { + if (this.getTimer().every(1)) { var food = new Donut(); food.setStrength(Random.randomInt(2, 5)); this.add(food); @@ -57,12 +57,12 @@ public void run() { } if (this.count(FollowDonut.class) == 0) { - Window.getInstance().transitionToStage(new WinStage(), 500); + Window.getInstance().transitionToStage(new WinStage(), 0.5); return; } if (this.count(PlayerDonut.class) == 0) { - Window.getInstance().transitionToStage(new GameOverStage(), 500); + Window.getInstance().transitionToStage(new GameOverStage(), 0.5); return; } diff --git a/src/examples/java/demos/donutIO/assets/donut.png b/examples/src/main/java/demos/donutIO/assets/donut.png similarity index 100% rename from src/examples/java/demos/donutIO/assets/donut.png rename to examples/src/main/java/demos/donutIO/assets/donut.png diff --git a/src/examples/java/demos/donutIO/assets/donut.svg b/examples/src/main/java/demos/donutIO/assets/donut.svg similarity index 100% rename from src/examples/java/demos/donutIO/assets/donut.svg rename to examples/src/main/java/demos/donutIO/assets/donut.svg diff --git a/src/examples/java/demos/donutIO/assets/grid.png b/examples/src/main/java/demos/donutIO/assets/grid.png similarity index 100% rename from src/examples/java/demos/donutIO/assets/grid.png rename to examples/src/main/java/demos/donutIO/assets/grid.png diff --git a/src/examples/java/demos/glide/Glide.java b/examples/src/main/java/demos/glide/Glide.java similarity index 100% rename from src/examples/java/demos/glide/Glide.java rename to examples/src/main/java/demos/glide/Glide.java diff --git a/src/examples/java/demos/pipes/PenSprite.java b/examples/src/main/java/demos/pipes/PenSprite.java similarity index 85% rename from src/examples/java/demos/pipes/PenSprite.java rename to examples/src/main/java/demos/pipes/PenSprite.java index 7b4cf2a4..03a38372 100644 --- a/src/examples/java/demos/pipes/PenSprite.java +++ b/examples/src/main/java/demos/pipes/PenSprite.java @@ -13,7 +13,7 @@ public PenSprite() { super("pen", "demos/pipes/sprites/pen.png"); this.getPen().down(); this.getPen().setSize(2); - color = Random.random(255); + color = Random.random(100); this.getPen().setColor(color); this.hide(); @@ -25,13 +25,12 @@ public static void setColor(double color) { PenSprite.color = color; } - // when I start as a clone - public PenSprite(PenSprite pen) { - super(pen); - this.setDirection(pen.getDirection() + 90); + @Override + public void whenStartsAsClone() { + this.setDirection(this.getDirection() + 90); this.getPen().setColor(color); if (Math.random() < 0.05) { - color += Math.random() * 10; + color += Math.random() * 4; } } diff --git a/src/examples/java/demos/pipes/Pipes.java b/examples/src/main/java/demos/pipes/Pipes.java similarity index 89% rename from src/examples/java/demos/pipes/Pipes.java rename to examples/src/main/java/demos/pipes/Pipes.java index 8a91853a..29b0cb67 100644 --- a/src/examples/java/demos/pipes/Pipes.java +++ b/examples/src/main/java/demos/pipes/Pipes.java @@ -10,7 +10,7 @@ public class Pipes extends Stage { // end stage designer public Pipes() { - this.setTint(60); + this.setColorEffect(60); // begin stage designer this.addBackdrop("chalkBoard", "demos/pipes/backdrops/chalk_board.jpg"); this.addSound("bg", "demos/pipes/sounds/bensound-enigmatic.ogg"); @@ -21,7 +21,7 @@ public Pipes() { public void whenKeyPressed(KeyCode keyCode) { if (keyCode == KeyCode.SPACE) { - PenSprite.setColor(Random.random(255)); + PenSprite.setColor(Random.random(100)); } } @@ -30,7 +30,7 @@ public void run() { var pens = this.find(PenSprite.class); for (var pen : pens) { if (Random.random() < 0.05 && pens.size() < 15) { - this.add(new PenSprite((PenSprite) pen)); + pen.createClone(); } if (Random.random() < 0.01 && pens.size() > 1) { this.remove(pen); diff --git a/src/examples/java/demos/pipes/backdrops/chalk_board.jpg b/examples/src/main/java/demos/pipes/backdrops/chalk_board.jpg similarity index 100% rename from src/examples/java/demos/pipes/backdrops/chalk_board.jpg rename to examples/src/main/java/demos/pipes/backdrops/chalk_board.jpg diff --git a/src/examples/java/demos/pipes/sounds/bensound-enigmatic.ogg b/examples/src/main/java/demos/pipes/sounds/bensound-enigmatic.ogg similarity index 100% rename from src/examples/java/demos/pipes/sounds/bensound-enigmatic.ogg rename to examples/src/main/java/demos/pipes/sounds/bensound-enigmatic.ogg diff --git a/src/examples/java/demos/pipes/sprites/pen.png b/examples/src/main/java/demos/pipes/sprites/pen.png similarity index 100% rename from src/examples/java/demos/pipes/sprites/pen.png rename to examples/src/main/java/demos/pipes/sprites/pen.png diff --git a/src/examples/java/demos/quiz/Quiz.java b/examples/src/main/java/demos/quiz/Quiz.java similarity index 100% rename from src/examples/java/demos/quiz/Quiz.java rename to examples/src/main/java/demos/quiz/Quiz.java diff --git a/src/examples/java/demos/rainbowVine/RainbowVine.java b/examples/src/main/java/demos/rainbowVine/RainbowVine.java similarity index 93% rename from src/examples/java/demos/rainbowVine/RainbowVine.java rename to examples/src/main/java/demos/rainbowVine/RainbowVine.java index 4d5ad199..516666ba 100644 --- a/src/examples/java/demos/rainbowVine/RainbowVine.java +++ b/examples/src/main/java/demos/rainbowVine/RainbowVine.java @@ -33,7 +33,7 @@ public void run() { this.setPosition(this.getMouseX(), this.getMouseY()); this.turnRight(5); - if (this.getTimer().everyMillis(60)) { + if (this.getTimer().every(0.06)) { this.getStage().add(new LeafSprite(this)); } } @@ -56,7 +56,7 @@ public void run() { this.turnRight(5); this.move(5); this.getPen().changeSize(1); - if (this.getTimer().afterMillis(200)) { + if (this.getTimer().after(0.2)) { this.remove(); } } diff --git a/src/examples/java/demos/randomDot/RandomDot.java b/examples/src/main/java/demos/randomDot/RandomDot.java similarity index 94% rename from src/examples/java/demos/randomDot/RandomDot.java rename to examples/src/main/java/demos/randomDot/RandomDot.java index 758c2423..86057d19 100644 --- a/src/examples/java/demos/randomDot/RandomDot.java +++ b/examples/src/main/java/demos/randomDot/RandomDot.java @@ -25,7 +25,7 @@ public static void main(String[] args) { class RandomDotSprite extends Sprite { public void run() { - if (this.getTimer().everyMillis(100)) { + if (this.getTimer().every(0.1)) { this.getPen().up(); this.getPen().setSize(20); this.goToRandomPosition(); diff --git a/src/examples/java/demos/robot/RobotSprite.java b/examples/src/main/java/demos/robot/RobotSprite.java similarity index 100% rename from src/examples/java/demos/robot/RobotSprite.java rename to examples/src/main/java/demos/robot/RobotSprite.java diff --git a/src/examples/java/demos/robot/RobotStage.java b/examples/src/main/java/demos/robot/RobotStage.java similarity index 91% rename from src/examples/java/demos/robot/RobotStage.java rename to examples/src/main/java/demos/robot/RobotStage.java index b73b8a9f..c9f0bcb5 100644 --- a/src/examples/java/demos/robot/RobotStage.java +++ b/examples/src/main/java/demos/robot/RobotStage.java @@ -9,7 +9,7 @@ public class RobotStage extends Stage { // end stage designer public RobotStage() { - this.setDebug(true); + Window.getInstance().setDebug(true); // begin stage designer robotSprite = new RobotSprite(); this.add(robotSprite); diff --git a/src/examples/java/demos/robot/sprites/robot.png b/examples/src/main/java/demos/robot/sprites/robot.png similarity index 100% rename from src/examples/java/demos/robot/sprites/robot.png rename to examples/src/main/java/demos/robot/sprites/robot.png diff --git a/src/examples/java/demos/saveSlots/README.md b/examples/src/main/java/demos/saveSlots/README.md similarity index 100% rename from src/examples/java/demos/saveSlots/README.md rename to examples/src/main/java/demos/saveSlots/README.md diff --git a/src/examples/java/demos/saveSlots/SaveSlotGame.java b/examples/src/main/java/demos/saveSlots/SaveSlotGame.java similarity index 100% rename from src/examples/java/demos/saveSlots/SaveSlotGame.java rename to examples/src/main/java/demos/saveSlots/SaveSlotGame.java diff --git a/src/examples/java/demos/saveSlots/SaveSlotProgress.java b/examples/src/main/java/demos/saveSlots/SaveSlotProgress.java similarity index 100% rename from src/examples/java/demos/saveSlots/SaveSlotProgress.java rename to examples/src/main/java/demos/saveSlots/SaveSlotProgress.java diff --git a/src/examples/java/demos/saveSlots/SaveSlotStage.java b/examples/src/main/java/demos/saveSlots/SaveSlotStage.java similarity index 99% rename from src/examples/java/demos/saveSlots/SaveSlotStage.java rename to examples/src/main/java/demos/saveSlots/SaveSlotStage.java index 57ad6374..dd1f30f3 100644 --- a/src/examples/java/demos/saveSlots/SaveSlotStage.java +++ b/examples/src/main/java/demos/saveSlots/SaveSlotStage.java @@ -2,7 +2,7 @@ import java.io.IOException; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.fs.SaveData; +import org.openpatch.scratch.save.SaveData; /** Collect coins, then save and restore the score and both sprite positions. */ public class SaveSlotStage extends Stage { diff --git a/src/examples/java/demos/saving/ExampleSettings.java b/examples/src/main/java/demos/saving/ExampleSettings.java similarity index 100% rename from src/examples/java/demos/saving/ExampleSettings.java rename to examples/src/main/java/demos/saving/ExampleSettings.java diff --git a/src/examples/java/demos/saving/Saving.java b/examples/src/main/java/demos/saving/Saving.java similarity index 90% rename from src/examples/java/demos/saving/Saving.java rename to examples/src/main/java/demos/saving/Saving.java index c41dc6c2..91ee7430 100644 --- a/src/examples/java/demos/saving/Saving.java +++ b/examples/src/main/java/demos/saving/Saving.java @@ -1,6 +1,6 @@ package demos.saving; -import org.openpatch.scratch.extensions.fs.*; +import org.openpatch.scratch.save.*; public class Saving { diff --git a/src/examples/java/demos/sensing/Sensing.java b/examples/src/main/java/demos/sensing/Sensing.java similarity index 91% rename from src/examples/java/demos/sensing/Sensing.java rename to examples/src/main/java/demos/sensing/Sensing.java index f4a335b0..d1d2479b 100644 --- a/src/examples/java/demos/sensing/Sensing.java +++ b/examples/src/main/java/demos/sensing/Sensing.java @@ -1,10 +1,12 @@ package demos.sensing; +import org.openpatch.scratch.Layer; + import org.openpatch.scratch.KeyCode; import org.openpatch.scratch.Sprite; import org.openpatch.scratch.Stage; import org.openpatch.scratch.Window; -import org.openpatch.scratch.Hitbox; +import org.openpatch.scratch.Polygon; import org.openpatch.scratch.Ellipse; public class Sensing extends Stage { @@ -54,7 +56,7 @@ public Hero() { this.setDirection(45); this.move(80); - this.setHitbox(0, 0, 300, 0, 300, 570, 0, 570, 150, 275); + this.setHitbox(new Polygon(new double[] {0, 300, 300, 0, 150}, new double[] {0, 0, 570, 570, 275})); } public void run() { @@ -105,6 +107,6 @@ public void run() { /** A Hero pinned to the user interface layer. */ class UIHero extends Hero { public UIHero() { - this.setUI(true); + this.setLayer(Layer.UI); } } diff --git a/src/examples/java/demos/sensing/sprites/hero.png b/examples/src/main/java/demos/sensing/sprites/hero.png similarity index 100% rename from src/examples/java/demos/sensing/sprites/hero.png rename to examples/src/main/java/demos/sensing/sprites/hero.png diff --git a/src/examples/java/demos/sensing/sprites/hero2.png b/examples/src/main/java/demos/sensing/sprites/hero2.png similarity index 100% rename from src/examples/java/demos/sensing/sprites/hero2.png rename to examples/src/main/java/demos/sensing/sprites/hero2.png diff --git a/src/examples/java/demos/shader/LightSprite.java b/examples/src/main/java/demos/shader/LightSprite.java similarity index 100% rename from src/examples/java/demos/shader/LightSprite.java rename to examples/src/main/java/demos/shader/LightSprite.java diff --git a/src/examples/java/demos/shader/MySprite.java b/examples/src/main/java/demos/shader/MySprite.java similarity index 91% rename from src/examples/java/demos/shader/MySprite.java rename to examples/src/main/java/demos/shader/MySprite.java index 6328abd8..3824e5bb 100644 --- a/src/examples/java/demos/shader/MySprite.java +++ b/examples/src/main/java/demos/shader/MySprite.java @@ -9,10 +9,10 @@ public MySprite() { // begin sprite editor this.addCostume("cat", "demos/shader/cat.png"); // end sprite editor - var shader = this.getShaders().add("halftone", "demos/shader/halftone.frag", "demos/shader/default.vert"); - shader = this.getShaders().add("pixelate", "demos/shader/pixelate.frag", "demos/shader/default.vert"); + var shader = this.getShaders().add("halftone", "demos/shader/halftone.frag"); + shader = this.getShaders().add("pixelate", "demos/shader/pixelate.frag"); shader.set("pixels", 20.0, 10.0); - shader = this.getShaders().add("neon", "demos/shader/neon.frag", "demos/shader/default.vert"); + shader = this.getShaders().add("neon", "demos/shader/neon.frag"); shader.set("brt", 0.4); shader.set("rad", 1); this.getShaders().switchTo("halftone"); diff --git a/src/examples/java/demos/shader/MyStage.java b/examples/src/main/java/demos/shader/MyStage.java similarity index 86% rename from src/examples/java/demos/shader/MyStage.java rename to examples/src/main/java/demos/shader/MyStage.java index 67f62ef2..e808a3ee 100644 --- a/src/examples/java/demos/shader/MyStage.java +++ b/examples/src/main/java/demos/shader/MyStage.java @@ -2,7 +2,6 @@ import org.openpatch.scratch.KeyCode; import org.openpatch.scratch.Stage; -import org.openpatch.scratch.Timer; public class MyStage extends Stage { @@ -12,13 +11,13 @@ public class MyStage extends Stage { // end stage designer public MyStage() { - var shader = this.getShaders().add("blobby", "demos/shader/blobby.frag", "demos/shader/default.vert"); + var shader = this.getShaders().add("blobby", "demos/shader/blobby.frag"); shader.set("depth", 1.5); shader.set("rate", 1.5); - shader = this.getShaders().add("glitch", "demos/shader/glitch.frag", "demos/shader/default.vert"); + shader = this.getShaders().add("glitch", "demos/shader/glitch.frag"); shader.set("rate", 0.0001); - shader = this.getShaders().add("light", "demos/shader/light.frag", "demos/shader/default.vert"); - shader = this.getShaders().add("pixel", "demos/shader/pixel.frag", "demos/shader/default.vert"); + shader = this.getShaders().add("light", "demos/shader/light.frag"); + shader = this.getShaders().add("pixel", "demos/shader/pixel.frag"); this.getShaders().switchTo("pixel"); // begin stage designer mySprite = new MySprite(); @@ -50,8 +49,6 @@ public void run() { + " next sprite shader. Press M to remove the sprite shader."); var shader = this.getShaders().getCurrent(); if (shader != null) { - shader.set("time", Timer.millis() / 1000.0); - shader.set("resolution", (float) this.getWidth(), (float) this.getHeight()); if ("light".equals(shader.getName())) { var lights = this.find(LightSprite.class); var lightPos = new double[lights.size() * 3 + 3]; diff --git a/src/examples/java/demos/shader/NormalSprite.java b/examples/src/main/java/demos/shader/NormalSprite.java similarity index 100% rename from src/examples/java/demos/shader/NormalSprite.java rename to examples/src/main/java/demos/shader/NormalSprite.java diff --git a/src/examples/java/demos/shader/ShaderExample.java b/examples/src/main/java/demos/shader/ShaderExample.java similarity index 100% rename from src/examples/java/demos/shader/ShaderExample.java rename to examples/src/main/java/demos/shader/ShaderExample.java diff --git a/src/examples/java/demos/shader/blobby.frag b/examples/src/main/java/demos/shader/blobby.frag similarity index 55% rename from src/examples/java/demos/shader/blobby.frag rename to examples/src/main/java/demos/shader/blobby.frag index f0644943..c0321bc6 100644 --- a/src/examples/java/demos/shader/blobby.frag +++ b/examples/src/main/java/demos/shader/blobby.frag @@ -1,22 +1,11 @@ -#ifdef GL_ES -precision mediump float; -#endif - -#define PROCESSING_TEXTURE_SHADER - -varying vec4 vertTexCoord; -uniform sampler2D texture; - -uniform float time; -uniform vec2 resolution; uniform float depth; uniform float rate; #define N 16 void main( void ) { - vec2 p = vertTexCoord.st; - vec4 col = texture2D(texture, p).rgba; + vec2 p = uv; + vec4 col = texture(costume, p).rgba; vec2 v=(gl_FragCoord.xy-(resolution*0.5))/min(resolution.y,resolution.x)*10.0; float t=time * 0.3,r=2.0; @@ -27,5 +16,5 @@ void main( void ) { } r = (sin(r*0.09)*0.5)+0.5; r = pow(r, depth); - gl_FragColor = vec4(col.r,pow(max(r-0.55,0.0)*2.2,2.0),pow(max(r-4.875,0.1)*3.0,6.0), col.a ); + color = vec4(col.r,pow(max(r-0.55,0.0)*2.2,2.0),pow(max(r-4.875,0.1)*3.0,6.0), col.a ); } diff --git a/src/examples/java/demos/cat/sprites/cat.png b/examples/src/main/java/demos/shader/cat.png similarity index 100% rename from src/examples/java/demos/cat/sprites/cat.png rename to examples/src/main/java/demos/shader/cat.png diff --git a/examples/src/main/java/demos/shader/glitch.frag b/examples/src/main/java/demos/shader/glitch.frag new file mode 100644 index 00000000..a3ab987f --- /dev/null +++ b/examples/src/main/java/demos/shader/glitch.frag @@ -0,0 +1,18 @@ +uniform float rate; + +float rand(vec2 co) { + return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453) * 2.0 - 1.0; +} + +float offset(float blocks, vec2 uv) { + float shaderTime = time*rate; + return rand(vec2(shaderTime, floor(uv.y * blocks))); +} + +void main( void ) { + + color = texture(costume, uv); + color.r = texture(costume, uv + vec2(offset(64.0, uv) * 0.03, 0.0)).r; + color.g = texture(costume, uv + vec2(offset(64.0, uv) * 0.03 * 0.1666666, 0.0)).g; + color.b = texture(costume, uv + vec2(offset(64.0, uv) * 0.03, 0.0)).b; +} \ No newline at end of file diff --git a/src/examples/java/demos/shader/halftone.frag b/examples/src/main/java/demos/shader/halftone.frag similarity index 54% rename from src/examples/java/demos/shader/halftone.frag rename to examples/src/main/java/demos/shader/halftone.frag index eec3057a..b98bead9 100644 --- a/src/examples/java/demos/shader/halftone.frag +++ b/examples/src/main/java/demos/shader/halftone.frag @@ -1,25 +1,16 @@ -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - -#define PROCESSING_TEXTURE_SHADER - -varying vec4 vertTexCoord; -uniform sampler2D texture; uniform int pixelsPerRow; void main(void) { - vec2 p = vertTexCoord.st; - float pixelSize = 1.0 / float(pixelsPerRow); + vec2 p = uv; + float pixelSize = 1.0 / float(max(pixelsPerRow, 1)); float dx = mod(p.x, pixelSize) - pixelSize*0.5; float dy = mod(p.y, pixelSize) - pixelSize*0.5; p.x -= dx; p.y -= dy; - vec4 col = texture2D(texture, p).rgba; + vec4 col = texture(costume, p).rgba; float bright = 0.3333*(col.r+col.g+col.b); float dist = sqrt(dx*dx + dy*dy); @@ -27,6 +18,6 @@ void main(void) float m = step(dist, rad); vec3 col2 = mix(vec3(0.0), vec3(1.0), m); - gl_FragColor = vec4(col2, col.a); + color = vec4(col2, col.a); } diff --git a/src/examples/java/demos/shader/light.frag b/examples/src/main/java/demos/shader/light.frag similarity index 62% rename from src/examples/java/demos/shader/light.frag rename to examples/src/main/java/demos/shader/light.frag index 3fdcc887..8ceaa60e 100644 --- a/src/examples/java/demos/shader/light.frag +++ b/examples/src/main/java/demos/shader/light.frag @@ -1,24 +1,11 @@ -#version 140 - -#ifdef GL_ES -precision mediump float; -#endif - -#define PROCESSING_TEXTURE_SHADER - -in vec4 vertTexCoord; -uniform sampler2D texture; - uniform vec3[100] lights; -uniform vec2 resolution; float intensity = 100.0; vec3 ambient_light = vec3(0.1, 0.1, 0.1); -vec3 color = vec3(0.499, 0.499, 0.999); +vec3 color_ = vec3(0.499, 0.499, 0.999); void main(void) { - vec2 uv = vertTexCoord.xy; - vec4 fragColor = texture2D(texture, uv); + vec4 fragColor = texture(costume, uv); float diffuse = 0.0; float combined_intensity = 1.0; @@ -37,5 +24,5 @@ void main(void) { } } } - gl_FragColor = vec4(min(fragColor.rgb * ((color * diffuse) + ambient_light), fragColor.rgb), fragColor.a); + color = vec4(min(fragColor.rgb * ((color_ * diffuse) + ambient_light), fragColor.rgb), fragColor.a); } diff --git a/src/examples/java/demos/shader/light.png b/examples/src/main/java/demos/shader/light.png similarity index 100% rename from src/examples/java/demos/shader/light.png rename to examples/src/main/java/demos/shader/light.png diff --git a/examples/src/main/java/demos/shader/neon.frag b/examples/src/main/java/demos/shader/neon.frag new file mode 100644 index 00000000..9310ff10 --- /dev/null +++ b/examples/src/main/java/demos/shader/neon.frag @@ -0,0 +1,16 @@ +uniform float brt; +uniform int rad; + +void main(void) { + int i = 0; + int j = 0; + vec4 sum = vec4(0.0); + + for( i=-rad;i - * Each scene below is set up, given a few frames to settle, and saved as a PNG. - * {@code ./scripts/visual-parity.sh} renders them again and compares. Keep them + * Each scene below is set up, given a few ticks to settle, and saved as a PNG at stage size by + * {@link FrameSaver}, an extension on {@code afterFrame}. {@code ./scripts/visual-parity.sh} + * renders them again and compares. Keep them * still: no timers, no randomness, nothing that moves, or the comparison will * fail for reasons that are not a change in how things look. * @@ -33,7 +37,7 @@ public class VisualProbe extends Stage { /** Frames to let a scene settle before it is saved. */ private static final int SETTLE = 20; - private final FrameRecorder recorder; + private final FrameSaver saver; private final String[] scenes = { // sprites "sprite", "scaled", "turned", "ghost", "tint", "rotation-styles", "costumes", @@ -48,8 +52,8 @@ public class VisualProbe extends Stage { private int scene = -1; private int frames = 0; - public VisualProbe(String outputFolder) { - this.recorder = new FrameRecorder(outputFolder); + public VisualProbe(FrameSaver saver) { + this.saver = saver; this.setColor(255, 255, 255); } @@ -63,8 +67,14 @@ public void run() { if (this.frames < SETTLE) { return; } - this.recorder.snapshot(this.scenes[this.scene] + ".png"); - this.next(); + if (this.frames == SETTLE) { + // saved from the picture of this tick, once the window has drawn it + this.saver.request(this.scenes[this.scene] + ".png"); + return; + } + if (!this.saver.isPending()) { + this.next(); + } } /** Clears the stage and builds the next scene, or leaves when there is none. */ @@ -72,7 +82,7 @@ private void next() { this.removeAll(); this.display(""); // whatever the last scene turned on, so that the next one starts clean - this.setDebug(false); + Window.getInstance().setDebug(false); this.getCamera().setPosition(0, 0); this.getCamera().resetZoom(); this.scene++; @@ -128,7 +138,7 @@ private void build(String name) { // the colour effect, by hue and by rgb var plain = slime(-140, 0); var hue = slime(0, 0); - hue.setTint(160); + hue.setColorEffect(125); var rgb = slime(140, 0); rgb.setTint(255, 120, 120); this.add(plain); @@ -249,7 +259,7 @@ private void build(String name) { } case "debug" -> { // the hitbox outline, the direction and the position - this.setDebug(true); + Window.getInstance().setDebug(true); var s = slime(-60, 20); s.setDirection(135); this.add(s); @@ -259,7 +269,7 @@ private void build(String name) { this.add(slime(-80, 30)); this.add(slime(90, -40)); this.getCamera().setPosition(40, 0); - this.getCamera().setZoom(1.6); + this.getCamera().setZoom(160); } case "display" -> { // the band along the bottom, left to right @@ -284,7 +294,65 @@ private static Sprite slime(double x, double y) { } public static void main(String[] args) { + FrameSaver saver = new FrameSaver(Path.of(args.length > 0 ? args[0] : "frames")); + Window.use(saver); Window myWindow = new Window(480, 360); - myWindow.setStage(new VisualProbe(args.length > 0 ? args[0] : "frames")); + myWindow.setStage(new VisualProbe(saver)); + } + + /** Saves the picture of a requested tick as a PNG at stage size, through the public extension API. */ + public static final class FrameSaver implements Extension { + private final Path folder; + private volatile String requested; + + FrameSaver(Path folder) { + this.folder = folder; + } + + /** Game thread: save the picture drawn after this tick. */ + void request(String file) { + this.requested = file; + } + + boolean isPending() { + return this.requested != null; + } + + @Override + public String id() { + return "parity.frames"; + } + + @Override + public String name() { + return "Frame saver"; + } + + @Override + public String version() { + return "1"; + } + + @Override + public String requires() { + return Extension.coreVersion(); + } + + @Override + public void install(ExtensionContext ctx) { + ctx.afterFrame((stage, frame) -> { + String file = this.requested; + if (file == null) { + return; + } + try { + Files.createDirectories(this.folder); + frame.savePng(this.folder.resolve(file)); + } catch (java.io.IOException e) { + throw new java.io.UncheckedIOException(e); + } + this.requested = null; + }); + } } } diff --git a/src/examples/java/reference/AnimatedSpriteAddAnimation/MySprite.java b/examples/src/main/java/reference/AnimatedSpriteAddAnimation/MySprite.java similarity index 66% rename from src/examples/java/reference/AnimatedSpriteAddAnimation/MySprite.java rename to examples/src/main/java/reference/AnimatedSpriteAddAnimation/MySprite.java index d65508b6..79ade397 100644 --- a/src/examples/java/reference/AnimatedSpriteAddAnimation/MySprite.java +++ b/examples/src/main/java/reference/AnimatedSpriteAddAnimation/MySprite.java @@ -1,8 +1,8 @@ package reference.AnimatedSpriteAddAnimation; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; -public class MySprite extends AnimatedSprite { +public class MySprite extends Sprite { public MySprite() { this.addAnimation("idle", "bunny1_walk%d", 2); } diff --git a/src/examples/java/reference/AnimatedSpriteAddAnimation/MyStage.java b/examples/src/main/java/reference/AnimatedSpriteAddAnimation/MyStage.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteAddAnimation/MyStage.java rename to examples/src/main/java/reference/AnimatedSpriteAddAnimation/MyStage.java diff --git a/src/examples/java/reference/AnimatedSpriteAddAnimation/MyWindow.java b/examples/src/main/java/reference/AnimatedSpriteAddAnimation/MyWindow.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteAddAnimation/MyWindow.java rename to examples/src/main/java/reference/AnimatedSpriteAddAnimation/MyWindow.java diff --git a/src/examples/java/reference/AnimatedSpriteClone.java b/examples/src/main/java/reference/AnimatedSpriteClone.java similarity index 81% rename from src/examples/java/reference/AnimatedSpriteClone.java rename to examples/src/main/java/reference/AnimatedSpriteClone.java index 992d799d..b77d0a25 100644 --- a/src/examples/java/reference/AnimatedSpriteClone.java +++ b/examples/src/main/java/reference/AnimatedSpriteClone.java @@ -7,16 +7,16 @@ public AnimatedSpriteClone() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - AnimatedSprite mySprite = new AnimatedSprite(); + Sprite mySprite = new Sprite(); mySprite.addAnimation("walk", "bunny1_walk%d", 2); mySprite.playAnimation("walk"); myStage.add(mySprite); // A copy with the same animations, playing the same one. while (true) { - AnimatedSprite copy = mySprite.clone(); + Sprite copy = mySprite.createClone(); copy.goToRandomPosition(); - myStage.wait(700); + myStage.waitSeconds(0.7); } } diff --git a/src/examples/java/reference/AnimatedSpriteConstructors.java b/examples/src/main/java/reference/AnimatedSpriteConstructors.java similarity index 91% rename from src/examples/java/reference/AnimatedSpriteConstructors.java rename to examples/src/main/java/reference/AnimatedSpriteConstructors.java index 75776355..9072ffb6 100644 --- a/src/examples/java/reference/AnimatedSpriteConstructors.java +++ b/examples/src/main/java/reference/AnimatedSpriteConstructors.java @@ -9,7 +9,7 @@ public AnimatedSpriteConstructors() { myWindow.setStage(myStage); // An animated sprite is a sprite whose costumes are grouped into named // animations, each played frame by frame. - AnimatedSprite mySprite = new AnimatedSprite(); + Sprite mySprite = new Sprite(); mySprite.addAnimation("walk", "bunny1_walk%d", 2); mySprite.playAnimation("walk"); myStage.add(mySprite); diff --git a/src/examples/java/reference/AnimatedSpriteGetAnimationFrame/MySprite.java b/examples/src/main/java/reference/AnimatedSpriteGetAnimationFrame/MySprite.java similarity index 72% rename from src/examples/java/reference/AnimatedSpriteGetAnimationFrame/MySprite.java rename to examples/src/main/java/reference/AnimatedSpriteGetAnimationFrame/MySprite.java index 828d750a..1d62e04f 100644 --- a/src/examples/java/reference/AnimatedSpriteGetAnimationFrame/MySprite.java +++ b/examples/src/main/java/reference/AnimatedSpriteGetAnimationFrame/MySprite.java @@ -1,8 +1,8 @@ package reference.AnimatedSpriteGetAnimationFrame; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; -public class MySprite extends AnimatedSprite { +public class MySprite extends Sprite { public MySprite() { this.addAnimation("idle", "bunny1_walk%d", 2); } diff --git a/src/examples/java/reference/AnimatedSpriteGetAnimationFrame/MyStage.java b/examples/src/main/java/reference/AnimatedSpriteGetAnimationFrame/MyStage.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteGetAnimationFrame/MyStage.java rename to examples/src/main/java/reference/AnimatedSpriteGetAnimationFrame/MyStage.java diff --git a/src/examples/java/reference/AnimatedSpriteGetAnimationFrame/MyWindow.java b/examples/src/main/java/reference/AnimatedSpriteGetAnimationFrame/MyWindow.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteGetAnimationFrame/MyWindow.java rename to examples/src/main/java/reference/AnimatedSpriteGetAnimationFrame/MyWindow.java diff --git a/src/examples/java/reference/AnimatedSpriteGetAnimationInterval/MySprite.java b/examples/src/main/java/reference/AnimatedSpriteGetAnimationInterval/MySprite.java similarity index 73% rename from src/examples/java/reference/AnimatedSpriteGetAnimationInterval/MySprite.java rename to examples/src/main/java/reference/AnimatedSpriteGetAnimationInterval/MySprite.java index 3b4db7d3..dc0775f8 100644 --- a/src/examples/java/reference/AnimatedSpriteGetAnimationInterval/MySprite.java +++ b/examples/src/main/java/reference/AnimatedSpriteGetAnimationInterval/MySprite.java @@ -1,8 +1,8 @@ package reference.AnimatedSpriteGetAnimationInterval; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; -public class MySprite extends AnimatedSprite { +public class MySprite extends Sprite { public MySprite() { this.addAnimation("idle", "bunny1_walk%d", 2); } diff --git a/src/examples/java/reference/AnimatedSpriteGetAnimationInterval/MyStage.java b/examples/src/main/java/reference/AnimatedSpriteGetAnimationInterval/MyStage.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteGetAnimationInterval/MyStage.java rename to examples/src/main/java/reference/AnimatedSpriteGetAnimationInterval/MyStage.java diff --git a/src/examples/java/reference/AnimatedSpriteGetAnimationInterval/MyWindow.java b/examples/src/main/java/reference/AnimatedSpriteGetAnimationInterval/MyWindow.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteGetAnimationInterval/MyWindow.java rename to examples/src/main/java/reference/AnimatedSpriteGetAnimationInterval/MyWindow.java diff --git a/src/examples/java/reference/AnimatedSpriteIsAnimationPlayed/MySprite.java b/examples/src/main/java/reference/AnimatedSpriteIsAnimationPlayed/MySprite.java similarity index 78% rename from src/examples/java/reference/AnimatedSpriteIsAnimationPlayed/MySprite.java rename to examples/src/main/java/reference/AnimatedSpriteIsAnimationPlayed/MySprite.java index 06c4c685..6b11ecf3 100644 --- a/src/examples/java/reference/AnimatedSpriteIsAnimationPlayed/MySprite.java +++ b/examples/src/main/java/reference/AnimatedSpriteIsAnimationPlayed/MySprite.java @@ -1,8 +1,8 @@ package reference.AnimatedSpriteIsAnimationPlayed; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; -public class MySprite extends AnimatedSprite { +public class MySprite extends Sprite { public MySprite() { this.addAnimation("idle", "bunny1_walk%d", 2); } diff --git a/src/examples/java/reference/AnimatedSpriteIsAnimationPlayed/MyStage.java b/examples/src/main/java/reference/AnimatedSpriteIsAnimationPlayed/MyStage.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteIsAnimationPlayed/MyStage.java rename to examples/src/main/java/reference/AnimatedSpriteIsAnimationPlayed/MyStage.java diff --git a/src/examples/java/reference/AnimatedSpriteIsAnimationPlayed/MyWindow.java b/examples/src/main/java/reference/AnimatedSpriteIsAnimationPlayed/MyWindow.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteIsAnimationPlayed/MyWindow.java rename to examples/src/main/java/reference/AnimatedSpriteIsAnimationPlayed/MyWindow.java diff --git a/src/examples/java/reference/AnimatedSpritePlayAnimation/MySprite.java b/examples/src/main/java/reference/AnimatedSpritePlayAnimation/MySprite.java similarity index 67% rename from src/examples/java/reference/AnimatedSpritePlayAnimation/MySprite.java rename to examples/src/main/java/reference/AnimatedSpritePlayAnimation/MySprite.java index e623ff78..cd2c1231 100644 --- a/src/examples/java/reference/AnimatedSpritePlayAnimation/MySprite.java +++ b/examples/src/main/java/reference/AnimatedSpritePlayAnimation/MySprite.java @@ -1,8 +1,8 @@ package reference.AnimatedSpritePlayAnimation; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; -public class MySprite extends AnimatedSprite { +public class MySprite extends Sprite { public MySprite() { this.addAnimation("idle", "bunny1_walk%d", 2); } diff --git a/src/examples/java/reference/AnimatedSpritePlayAnimation/MyStage.java b/examples/src/main/java/reference/AnimatedSpritePlayAnimation/MyStage.java similarity index 100% rename from src/examples/java/reference/AnimatedSpritePlayAnimation/MyStage.java rename to examples/src/main/java/reference/AnimatedSpritePlayAnimation/MyStage.java diff --git a/src/examples/java/reference/AnimatedSpritePlayAnimation/MyWindow.java b/examples/src/main/java/reference/AnimatedSpritePlayAnimation/MyWindow.java similarity index 100% rename from src/examples/java/reference/AnimatedSpritePlayAnimation/MyWindow.java rename to examples/src/main/java/reference/AnimatedSpritePlayAnimation/MyWindow.java diff --git a/src/examples/java/reference/AnimatedSpriteResetAnimation/MySprite.java b/examples/src/main/java/reference/AnimatedSpriteResetAnimation/MySprite.java similarity index 76% rename from src/examples/java/reference/AnimatedSpriteResetAnimation/MySprite.java rename to examples/src/main/java/reference/AnimatedSpriteResetAnimation/MySprite.java index f97374b1..52005581 100644 --- a/src/examples/java/reference/AnimatedSpriteResetAnimation/MySprite.java +++ b/examples/src/main/java/reference/AnimatedSpriteResetAnimation/MySprite.java @@ -1,9 +1,9 @@ package reference.AnimatedSpriteResetAnimation; import org.openpatch.scratch.KeyCode; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; -public class MySprite extends AnimatedSprite { +public class MySprite extends Sprite { public MySprite() { this.addAnimation("idle", "bunny1_walk%d", 2); } diff --git a/src/examples/java/reference/AnimatedSpriteResetAnimation/MyStage.java b/examples/src/main/java/reference/AnimatedSpriteResetAnimation/MyStage.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteResetAnimation/MyStage.java rename to examples/src/main/java/reference/AnimatedSpriteResetAnimation/MyStage.java diff --git a/src/examples/java/reference/AnimatedSpriteResetAnimation/MyWindow.java b/examples/src/main/java/reference/AnimatedSpriteResetAnimation/MyWindow.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteResetAnimation/MyWindow.java rename to examples/src/main/java/reference/AnimatedSpriteResetAnimation/MyWindow.java diff --git a/src/examples/java/reference/AnimatedSpriteSetAnimationFrame/MySprite.java b/examples/src/main/java/reference/AnimatedSpriteSetAnimationFrame/MySprite.java similarity index 77% rename from src/examples/java/reference/AnimatedSpriteSetAnimationFrame/MySprite.java rename to examples/src/main/java/reference/AnimatedSpriteSetAnimationFrame/MySprite.java index b88b88e4..c0ba62dd 100644 --- a/src/examples/java/reference/AnimatedSpriteSetAnimationFrame/MySprite.java +++ b/examples/src/main/java/reference/AnimatedSpriteSetAnimationFrame/MySprite.java @@ -1,9 +1,9 @@ package reference.AnimatedSpriteSetAnimationFrame; import org.openpatch.scratch.KeyCode; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; -public class MySprite extends AnimatedSprite { +public class MySprite extends Sprite { public MySprite() { this.addAnimation("idle", "bunny1_walk%d", 2); } diff --git a/src/examples/java/reference/AnimatedSpriteSetAnimationFrame/MyStage.java b/examples/src/main/java/reference/AnimatedSpriteSetAnimationFrame/MyStage.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteSetAnimationFrame/MyStage.java rename to examples/src/main/java/reference/AnimatedSpriteSetAnimationFrame/MyStage.java diff --git a/src/examples/java/reference/AnimatedSpriteSetAnimationFrame/MyWindow.java b/examples/src/main/java/reference/AnimatedSpriteSetAnimationFrame/MyWindow.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteSetAnimationFrame/MyWindow.java rename to examples/src/main/java/reference/AnimatedSpriteSetAnimationFrame/MyWindow.java diff --git a/src/examples/java/reference/AnimatedSpriteSetAnimationInterval/MySprite.java b/examples/src/main/java/reference/AnimatedSpriteSetAnimationInterval/MySprite.java similarity index 66% rename from src/examples/java/reference/AnimatedSpriteSetAnimationInterval/MySprite.java rename to examples/src/main/java/reference/AnimatedSpriteSetAnimationInterval/MySprite.java index aa109b8e..e1c4127b 100644 --- a/src/examples/java/reference/AnimatedSpriteSetAnimationInterval/MySprite.java +++ b/examples/src/main/java/reference/AnimatedSpriteSetAnimationInterval/MySprite.java @@ -1,9 +1,9 @@ package reference.AnimatedSpriteSetAnimationInterval; import org.openpatch.scratch.KeyCode; -import org.openpatch.scratch.AnimatedSprite; +import org.openpatch.scratch.Sprite; -public class MySprite extends AnimatedSprite { +public class MySprite extends Sprite { public MySprite() { this.addAnimation("idle", "bunny1_walk%d", 2); } @@ -11,9 +11,9 @@ public MySprite() { public void run() { this.playAnimation("idle"); if (this.isKeyPressed(KeyCode.S)) { - this.setAnimationInterval(60); + this.setAnimationInterval(0.06); } else if (this.isKeyPressed(KeyCode.W)) { - this.setAnimationInterval(10); + this.setAnimationInterval(0.01); } } } diff --git a/src/examples/java/reference/AnimatedSpriteSetAnimationInterval/MyStage.java b/examples/src/main/java/reference/AnimatedSpriteSetAnimationInterval/MyStage.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteSetAnimationInterval/MyStage.java rename to examples/src/main/java/reference/AnimatedSpriteSetAnimationInterval/MyStage.java diff --git a/src/examples/java/reference/AnimatedSpriteSetAnimationInterval/MyWindow.java b/examples/src/main/java/reference/AnimatedSpriteSetAnimationInterval/MyWindow.java similarity index 100% rename from src/examples/java/reference/AnimatedSpriteSetAnimationInterval/MyWindow.java rename to examples/src/main/java/reference/AnimatedSpriteSetAnimationInterval/MyWindow.java diff --git a/src/examples/java/reference/AnimatedSpriteToString.java b/examples/src/main/java/reference/AnimatedSpriteToString.java similarity index 92% rename from src/examples/java/reference/AnimatedSpriteToString.java rename to examples/src/main/java/reference/AnimatedSpriteToString.java index 421fa124..47d54637 100644 --- a/src/examples/java/reference/AnimatedSpriteToString.java +++ b/examples/src/main/java/reference/AnimatedSpriteToString.java @@ -7,7 +7,7 @@ public AnimatedSpriteToString() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - AnimatedSprite mySprite = new AnimatedSprite(); + Sprite mySprite = new Sprite(); mySprite.addAnimation("walk", "bunny1_walk%d", 2); mySprite.playAnimation("walk"); myStage.add(mySprite); diff --git a/src/examples/java/reference/BitmapTextExample.java b/examples/src/main/java/reference/BitmapTextExample.java similarity index 90% rename from src/examples/java/reference/BitmapTextExample.java rename to examples/src/main/java/reference/BitmapTextExample.java index 1bf64946..51a353f1 100644 --- a/src/examples/java/reference/BitmapTextExample.java +++ b/examples/src/main/java/reference/BitmapTextExample.java @@ -1,7 +1,7 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.text.BitmapText; +import org.openpatch.scratch.drawing.BitmapText; /** @example.online false */ public class BitmapTextExample { @@ -17,7 +17,7 @@ public BitmapTextExample() { score.setLineSpacing(2); score.setSize(300); score.setPosition(0, 20); - score.setIsUI(true); + score.setLayer(Layer.UI); stage.add(score); stage.display("Image glyphs: " + score.getWidth() + " x " + score.getHeight()); window.setStage(stage); diff --git a/src/examples/java/reference/CameraChangeX.java b/examples/src/main/java/reference/CameraChangeX.java similarity index 87% rename from src/examples/java/reference/CameraChangeX.java rename to examples/src/main/java/reference/CameraChangeX.java index 9fab34f8..4b1d89a6 100644 --- a/src/examples/java/reference/CameraChangeX.java +++ b/examples/src/main/java/reference/CameraChangeX.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraChangeX { @@ -20,11 +20,11 @@ public CameraChangeX() { while (true) { while (myCamera.getX() < 200) { myCamera.changeX(2); - myStage.wait(30); + myStage.waitSeconds(0.03); } while (myCamera.getX() > -200) { myCamera.changeX(-2); - myStage.wait(30); + myStage.waitSeconds(0.03); } } } diff --git a/src/examples/java/reference/CameraChangeY.java b/examples/src/main/java/reference/CameraChangeY.java similarity index 86% rename from src/examples/java/reference/CameraChangeY.java rename to examples/src/main/java/reference/CameraChangeY.java index 82e3fa27..3852dffa 100644 --- a/src/examples/java/reference/CameraChangeY.java +++ b/examples/src/main/java/reference/CameraChangeY.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraChangeY { @@ -19,11 +19,11 @@ public CameraChangeY() { while (true) { while (myCamera.getY() < 100) { myCamera.changeY(2); - myStage.wait(30); + myStage.waitSeconds(0.03); } while (myCamera.getY() > -100) { myCamera.changeY(-2); - myStage.wait(30); + myStage.waitSeconds(0.03); } } } diff --git a/src/examples/java/reference/CameraChangeZoom.java b/examples/src/main/java/reference/CameraChangeZoom.java similarity index 87% rename from src/examples/java/reference/CameraChangeZoom.java rename to examples/src/main/java/reference/CameraChangeZoom.java index 48bf9a95..f2d677a8 100644 --- a/src/examples/java/reference/CameraChangeZoom.java +++ b/examples/src/main/java/reference/CameraChangeZoom.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraChangeZoom { @@ -20,11 +20,11 @@ public CameraChangeZoom() { while (true) { while (myCamera.getZoom() < 2) { myCamera.changeZoom(0.01); - myStage.wait(30); + myStage.waitSeconds(0.03); } while (myCamera.getZoom() > 1) { myCamera.changeZoom(-0.01); - myStage.wait(30); + myStage.waitSeconds(0.03); } } } diff --git a/src/examples/java/reference/CameraConstructors.java b/examples/src/main/java/reference/CameraConstructors.java similarity index 92% rename from src/examples/java/reference/CameraConstructors.java rename to examples/src/main/java/reference/CameraConstructors.java index ff23b0fe..69a6ffc9 100644 --- a/src/examples/java/reference/CameraConstructors.java +++ b/examples/src/main/java/reference/CameraConstructors.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraConstructors { diff --git a/src/examples/java/reference/CameraGetPosition.java b/examples/src/main/java/reference/CameraGetPosition.java similarity index 91% rename from src/examples/java/reference/CameraGetPosition.java rename to examples/src/main/java/reference/CameraGetPosition.java index cfbe8810..2c71b830 100644 --- a/src/examples/java/reference/CameraGetPosition.java +++ b/examples/src/main/java/reference/CameraGetPosition.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraGetPosition { diff --git a/src/examples/java/reference/CameraGetX.java b/examples/src/main/java/reference/CameraGetX.java similarity index 91% rename from src/examples/java/reference/CameraGetX.java rename to examples/src/main/java/reference/CameraGetX.java index d8414aa2..083ed355 100644 --- a/src/examples/java/reference/CameraGetX.java +++ b/examples/src/main/java/reference/CameraGetX.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraGetX { diff --git a/src/examples/java/reference/CameraGetY.java b/examples/src/main/java/reference/CameraGetY.java similarity index 91% rename from src/examples/java/reference/CameraGetY.java rename to examples/src/main/java/reference/CameraGetY.java index d13264d8..479d6cb5 100644 --- a/src/examples/java/reference/CameraGetY.java +++ b/examples/src/main/java/reference/CameraGetY.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraGetY { diff --git a/src/examples/java/reference/CameraGetZoom.java b/examples/src/main/java/reference/CameraGetZoom.java similarity index 91% rename from src/examples/java/reference/CameraGetZoom.java rename to examples/src/main/java/reference/CameraGetZoom.java index bb38918f..bd0adec5 100644 --- a/src/examples/java/reference/CameraGetZoom.java +++ b/examples/src/main/java/reference/CameraGetZoom.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraGetZoom { diff --git a/src/examples/java/reference/CameraResetZoom.java b/examples/src/main/java/reference/CameraResetZoom.java similarity index 88% rename from src/examples/java/reference/CameraResetZoom.java rename to examples/src/main/java/reference/CameraResetZoom.java index ad85fd84..6c4cfa3f 100644 --- a/src/examples/java/reference/CameraResetZoom.java +++ b/examples/src/main/java/reference/CameraResetZoom.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraResetZoom { @@ -17,7 +17,7 @@ public CameraResetZoom() { Camera myCamera = myStage.getCamera(); myCamera.setZoom(3); - myStage.wait(2000); + myStage.waitSeconds(2); // Back to the stage at its own size. myCamera.resetZoom(); } diff --git a/src/examples/java/reference/CameraSetPosition.java b/examples/src/main/java/reference/CameraSetPosition.java similarity index 84% rename from src/examples/java/reference/CameraSetPosition.java rename to examples/src/main/java/reference/CameraSetPosition.java index fffd20dc..89bc76d5 100644 --- a/src/examples/java/reference/CameraSetPosition.java +++ b/examples/src/main/java/reference/CameraSetPosition.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraSetPosition { @@ -19,12 +19,12 @@ public CameraSetPosition() { // The camera looks at this point on the stage. while (true) { myCamera.setPosition(-150, 0); - myStage.wait(1000); + myStage.waitSeconds(1); myCamera.setPosition(150, 0); - myStage.wait(1000); + myStage.waitSeconds(1); // A vector works too. myCamera.setPosition(new Vector2(0, 80)); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/CameraSetX.java b/examples/src/main/java/reference/CameraSetX.java similarity index 84% rename from src/examples/java/reference/CameraSetX.java rename to examples/src/main/java/reference/CameraSetX.java index 7de63f14..25487283 100644 --- a/src/examples/java/reference/CameraSetX.java +++ b/examples/src/main/java/reference/CameraSetX.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraSetX { @@ -18,9 +18,9 @@ public CameraSetX() { while (true) { myCamera.setX(-150); - myStage.wait(1000); + myStage.waitSeconds(1); myCamera.setX(150); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/CameraSetY.java b/examples/src/main/java/reference/CameraSetY.java similarity index 83% rename from src/examples/java/reference/CameraSetY.java rename to examples/src/main/java/reference/CameraSetY.java index a82e660f..65031038 100644 --- a/src/examples/java/reference/CameraSetY.java +++ b/examples/src/main/java/reference/CameraSetY.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraSetY { @@ -18,9 +18,9 @@ public CameraSetY() { while (true) { myCamera.setY(-80); - myStage.wait(1000); + myStage.waitSeconds(1); myCamera.setY(80); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/CameraSetZoom.java b/examples/src/main/java/reference/CameraSetZoom.java similarity index 85% rename from src/examples/java/reference/CameraSetZoom.java rename to examples/src/main/java/reference/CameraSetZoom.java index c15b48e1..7d180d7c 100644 --- a/src/examples/java/reference/CameraSetZoom.java +++ b/examples/src/main/java/reference/CameraSetZoom.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraSetZoom { @@ -19,9 +19,9 @@ public CameraSetZoom() { // 1 is the stage at its own size, 2 is twice as close. while (true) { myCamera.setZoom(1); - myStage.wait(1200); + myStage.waitSeconds(1.2); myCamera.setZoom(2); - myStage.wait(1200); + myStage.waitSeconds(1.2); } } diff --git a/src/examples/java/reference/CameraSetZoomLimit.java b/examples/src/main/java/reference/CameraSetZoomLimit.java similarity index 90% rename from src/examples/java/reference/CameraSetZoomLimit.java rename to examples/src/main/java/reference/CameraSetZoomLimit.java index 8ce4aa3e..a29d3391 100644 --- a/src/examples/java/reference/CameraSetZoomLimit.java +++ b/examples/src/main/java/reference/CameraSetZoomLimit.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraSetZoomLimit { @@ -21,7 +21,7 @@ public CameraSetZoomLimit() { while (true) { myCamera.changeZoom(0.02); myStage.display("zoom: " + myCamera.getZoom()); - myStage.wait(50); + myStage.waitSeconds(0.05); } } diff --git a/src/examples/java/reference/CameraToGlobalPosition.java b/examples/src/main/java/reference/CameraToGlobalPosition.java similarity index 90% rename from src/examples/java/reference/CameraToGlobalPosition.java rename to examples/src/main/java/reference/CameraToGlobalPosition.java index 59d59549..eaeb913d 100644 --- a/src/examples/java/reference/CameraToGlobalPosition.java +++ b/examples/src/main/java/reference/CameraToGlobalPosition.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraToGlobalPosition { @@ -20,7 +20,7 @@ public CameraToGlobalPosition() { // From a place on the screen back to the place on the stage - which is what // turns a mouse position into a place in the world. Vector2 onScreen = new Vector2(0, 0); - System.out.println("the middle of the screen is " + myCamera.toGlobalPosition(onScreen)); + System.out.println("the middle of the screen is " + myCamera.toScreenPosition(onScreen)); } public static void main(String[] args) { diff --git a/src/examples/java/reference/CameraToGlobalX.java b/examples/src/main/java/reference/CameraToGlobalX.java similarity index 88% rename from src/examples/java/reference/CameraToGlobalX.java rename to examples/src/main/java/reference/CameraToGlobalX.java index 664f2388..2a4a3ef4 100644 --- a/src/examples/java/reference/CameraToGlobalX.java +++ b/examples/src/main/java/reference/CameraToGlobalX.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraToGlobalX { @@ -17,7 +17,7 @@ public CameraToGlobalX() { Camera myCamera = myStage.getCamera(); myCamera.setPosition(100, 0); - System.out.println("the middle of the screen is x = " + myCamera.toGlobalX(0)); + System.out.println("the middle of the screen is x = " + myCamera.toScreenX(0)); } public static void main(String[] args) { diff --git a/src/examples/java/reference/CameraToGlobalY.java b/examples/src/main/java/reference/CameraToGlobalY.java similarity index 88% rename from src/examples/java/reference/CameraToGlobalY.java rename to examples/src/main/java/reference/CameraToGlobalY.java index 9c1f690a..72504e22 100644 --- a/src/examples/java/reference/CameraToGlobalY.java +++ b/examples/src/main/java/reference/CameraToGlobalY.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraToGlobalY { @@ -17,7 +17,7 @@ public CameraToGlobalY() { Camera myCamera = myStage.getCamera(); myCamera.setPosition(0, 60); - System.out.println("the middle of the screen is y = " + myCamera.toGlobalY(0)); + System.out.println("the middle of the screen is y = " + myCamera.toScreenY(0)); } public static void main(String[] args) { diff --git a/src/examples/java/reference/CameraToLocalPosition.java b/examples/src/main/java/reference/CameraToLocalPosition.java similarity index 82% rename from src/examples/java/reference/CameraToLocalPosition.java rename to examples/src/main/java/reference/CameraToLocalPosition.java index 91c98bba..34b0f914 100644 --- a/src/examples/java/reference/CameraToLocalPosition.java +++ b/examples/src/main/java/reference/CameraToLocalPosition.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraToLocalPosition { @@ -19,7 +19,7 @@ public CameraToLocalPosition() { myCamera.setPosition(100, 0); // From a place on the stage to the place on the screen it is drawn at. Vector2 onStage = new Vector2(100, 0); - System.out.println(onStage + " is drawn at " + myCamera.toLocalPosition(onStage)); + System.out.println(onStage + " is drawn at " + myCamera.toWorldPosition(onStage)); } public static void main(String[] args) { diff --git a/src/examples/java/reference/CameraToLocalX.java b/examples/src/main/java/reference/CameraToLocalX.java similarity index 88% rename from src/examples/java/reference/CameraToLocalX.java rename to examples/src/main/java/reference/CameraToLocalX.java index 827f0fcf..8d4f1e75 100644 --- a/src/examples/java/reference/CameraToLocalX.java +++ b/examples/src/main/java/reference/CameraToLocalX.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraToLocalX { @@ -17,7 +17,7 @@ public CameraToLocalX() { Camera myCamera = myStage.getCamera(); myCamera.setPosition(100, 0); - System.out.println("x = 100 on the stage is drawn at x = " + myCamera.toLocalX(100)); + System.out.println("x = 100 on the stage is drawn at x = " + myCamera.toWorldX(100)); } public static void main(String[] args) { diff --git a/src/examples/java/reference/CameraToLocalY.java b/examples/src/main/java/reference/CameraToLocalY.java similarity index 88% rename from src/examples/java/reference/CameraToLocalY.java rename to examples/src/main/java/reference/CameraToLocalY.java index 487f0b59..463d4b30 100644 --- a/src/examples/java/reference/CameraToLocalY.java +++ b/examples/src/main/java/reference/CameraToLocalY.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class CameraToLocalY { @@ -17,7 +17,7 @@ public CameraToLocalY() { Camera myCamera = myStage.getCamera(); myCamera.setPosition(0, 60); - System.out.println("y = 60 on the stage is drawn at y = " + myCamera.toLocalY(60)); + System.out.println("y = 60 on the stage is drawn at y = " + myCamera.toWorldY(60)); } public static void main(String[] args) { diff --git a/src/examples/java/reference/CircleConstructors.java b/examples/src/main/java/reference/CircleConstructors.java similarity index 92% rename from src/examples/java/reference/CircleConstructors.java rename to examples/src/main/java/reference/CircleConstructors.java index 230c5851..4e672854 100644 --- a/src/examples/java/reference/CircleConstructors.java +++ b/examples/src/main/java/reference/CircleConstructors.java @@ -7,7 +7,7 @@ public CircleConstructors() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); diff --git a/src/examples/java/reference/ClockAll.java b/examples/src/main/java/reference/ClockAll.java similarity index 100% rename from src/examples/java/reference/ClockAll.java rename to examples/src/main/java/reference/ClockAll.java diff --git a/src/examples/java/reference/ClockGetCurrentTime.java b/examples/src/main/java/reference/ClockGetCurrentTime.java similarity index 100% rename from src/examples/java/reference/ClockGetCurrentTime.java rename to examples/src/main/java/reference/ClockGetCurrentTime.java diff --git a/src/examples/java/reference/ClockGetDay.java b/examples/src/main/java/reference/ClockGetDay.java similarity index 100% rename from src/examples/java/reference/ClockGetDay.java rename to examples/src/main/java/reference/ClockGetDay.java diff --git a/src/examples/java/reference/ClockGetDayOfWeek.java b/examples/src/main/java/reference/ClockGetDayOfWeek.java similarity index 100% rename from src/examples/java/reference/ClockGetDayOfWeek.java rename to examples/src/main/java/reference/ClockGetDayOfWeek.java diff --git a/src/examples/java/reference/ClockGetDaysSince2000.java b/examples/src/main/java/reference/ClockGetDaysSince2000.java similarity index 100% rename from src/examples/java/reference/ClockGetDaysSince2000.java rename to examples/src/main/java/reference/ClockGetDaysSince2000.java diff --git a/src/examples/java/reference/ClockGetHour.java b/examples/src/main/java/reference/ClockGetHour.java similarity index 100% rename from src/examples/java/reference/ClockGetHour.java rename to examples/src/main/java/reference/ClockGetHour.java diff --git a/src/examples/java/reference/ClockGetMillisecond.java b/examples/src/main/java/reference/ClockGetMillisecond.java similarity index 100% rename from src/examples/java/reference/ClockGetMillisecond.java rename to examples/src/main/java/reference/ClockGetMillisecond.java diff --git a/src/examples/java/reference/ClockGetMinute.java b/examples/src/main/java/reference/ClockGetMinute.java similarity index 100% rename from src/examples/java/reference/ClockGetMinute.java rename to examples/src/main/java/reference/ClockGetMinute.java diff --git a/src/examples/java/reference/ClockGetMonth.java b/examples/src/main/java/reference/ClockGetMonth.java similarity index 100% rename from src/examples/java/reference/ClockGetMonth.java rename to examples/src/main/java/reference/ClockGetMonth.java diff --git a/src/examples/java/reference/ClockGetSecond.java b/examples/src/main/java/reference/ClockGetSecond.java similarity index 100% rename from src/examples/java/reference/ClockGetSecond.java rename to examples/src/main/java/reference/ClockGetSecond.java diff --git a/src/examples/java/reference/ClockGetYear.java b/examples/src/main/java/reference/ClockGetYear.java similarity index 100% rename from src/examples/java/reference/ClockGetYear.java rename to examples/src/main/java/reference/ClockGetYear.java diff --git a/src/examples/java/reference/ColorConstructors.java b/examples/src/main/java/reference/ColorConstructors.java similarity index 54% rename from src/examples/java/reference/ColorConstructors.java rename to examples/src/main/java/reference/ColorConstructors.java index 29318fbe..d169a57d 100644 --- a/src/examples/java/reference/ColorConstructors.java +++ b/examples/src/main/java/reference/ColorConstructors.java @@ -8,15 +8,16 @@ public ColorConstructors() { Stage myStage = new Stage(); myWindow.setStage(myStage); - // The four ways of naming a colour. The stage shows the last one. - Color white = new Color(); + // The ways of naming a colour. The stage shows the last one. + Color white = new Color(255, 255, 255); Color fromHex = new Color("#ff8800"); - Color fromHue = new Color(140); + Color fromHue = Color.fromHSB(55, 100, 100); Color fromRgb = new Color(30, 120, 220); - Color copy = new Color(fromRgb); + // Colours are immutable, so a colour can be shared instead of copied. + Color copy = fromRgb; System.out.println("white is " + white.getRed() + ", " + white.getGreen() + ", " + white.getBlue()); - System.out.println("#ff8800 has the hue " + fromHex.getH()); - System.out.println("hue 140 is " + fromHue.getRed() + ", " + fromHue.getGreen() + ", " + fromHue.getBlue()); + System.out.println("#ff8800 has the hue " + fromHex.getHue()); + System.out.println("hue 55 is " + fromHue.getRed() + ", " + fromHue.getGreen() + ", " + fromHue.getBlue()); myStage.setColor(copy); } diff --git a/src/examples/java/reference/ColorGetBlue.java b/examples/src/main/java/reference/ColorGetBlue.java similarity index 100% rename from src/examples/java/reference/ColorGetBlue.java rename to examples/src/main/java/reference/ColorGetBlue.java diff --git a/src/examples/java/reference/ColorGetGreen.java b/examples/src/main/java/reference/ColorGetGreen.java similarity index 100% rename from src/examples/java/reference/ColorGetGreen.java rename to examples/src/main/java/reference/ColorGetGreen.java diff --git a/src/examples/java/reference/ColorGetRed.java b/examples/src/main/java/reference/ColorGetRed.java similarity index 100% rename from src/examples/java/reference/ColorGetRed.java rename to examples/src/main/java/reference/ColorGetRed.java diff --git a/src/examples/java/reference/ColorToString.java b/examples/src/main/java/reference/ColorToString.java similarity index 100% rename from src/examples/java/reference/ColorToString.java rename to examples/src/main/java/reference/ColorToString.java diff --git a/src/examples/java/reference/DrawingSpriteExample.java b/examples/src/main/java/reference/DrawingSpriteExample.java similarity index 94% rename from src/examples/java/reference/DrawingSpriteExample.java rename to examples/src/main/java/reference/DrawingSpriteExample.java index b0ec4d32..67a1574f 100644 --- a/src/examples/java/reference/DrawingSpriteExample.java +++ b/examples/src/main/java/reference/DrawingSpriteExample.java @@ -1,7 +1,7 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.drawing.*; +import org.openpatch.scratch.drawing.*; /** A road made from projected 2D points. Keep projection and physics in the game. */ public class DrawingSpriteExample { diff --git a/src/examples/java/reference/EllipseConstructors.java b/examples/src/main/java/reference/EllipseConstructors.java similarity index 92% rename from src/examples/java/reference/EllipseConstructors.java rename to examples/src/main/java/reference/EllipseConstructors.java index 692edffd..dd1a9c00 100644 --- a/src/examples/java/reference/EllipseConstructors.java +++ b/examples/src/main/java/reference/EllipseConstructors.java @@ -7,7 +7,7 @@ public EllipseConstructors() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); diff --git a/src/examples/java/reference/FileSave/FileSave.java b/examples/src/main/java/reference/FileSave/FileSave.java similarity index 93% rename from src/examples/java/reference/FileSave/FileSave.java rename to examples/src/main/java/reference/FileSave/FileSave.java index 407835c8..d16b8d2d 100644 --- a/src/examples/java/reference/FileSave/FileSave.java +++ b/examples/src/main/java/reference/FileSave/FileSave.java @@ -1,6 +1,6 @@ package reference.FileSave; -import org.openpatch.scratch.extensions.fs.*; +import org.openpatch.scratch.save.*; public class FileSave { diff --git a/examples/src/main/java/reference/GamepadExample.java b/examples/src/main/java/reference/GamepadExample.java new file mode 100644 index 00000000..1500d6eb --- /dev/null +++ b/examples/src/main/java/reference/GamepadExample.java @@ -0,0 +1,44 @@ +package reference; +import org.openpatch.scratch.*; +import org.openpatch.scratch.gamepad.Gamepad; +import org.openpatch.scratch.gamepad.GamepadButton; +import org.openpatch.scratch.gamepad.GamepadListener; +import org.openpatch.scratch.gamepad.GamepadStick; + + +/** + * A controller is a desktop thing: the Online IDE has no gamepad classes yet. + * + * @example.online false + */ +public class GamepadExample { + public GamepadExample() { + Window myWindow = new Window(480, 360); + Stage myStage = new Stage(); + myWindow.setStage(myStage); + Sprite mySprite = new GamepadSprite(); + myStage.add(mySprite); + } + + public static void main(String[] args) { + new GamepadExample(); + } +} + +class GamepadSprite extends Sprite implements GamepadListener { + @Override + public void run() { + // The first connected controller's left stick: x −1 to 1, y up as on the stage. + this.changePosition(Gamepad.getStick(GamepadStick.LEFT).multiply(5)); + if (Gamepad.isButtonPressed(GamepadButton.START)) { + this.setDirection(90); + } + } + + @Override + public void whenGamepadButtonPressed(GamepadButton button) { + if (button == GamepadButton.A) { + this.changeY(20); // jump + } + } +} diff --git a/src/examples/java/reference/HitboxGetBounds.java b/examples/src/main/java/reference/HitboxGetBounds.java similarity index 94% rename from src/examples/java/reference/HitboxGetBounds.java rename to examples/src/main/java/reference/HitboxGetBounds.java index a761359d..2bda356d 100644 --- a/src/examples/java/reference/HitboxGetBounds.java +++ b/examples/src/main/java/reference/HitboxGetBounds.java @@ -7,7 +7,7 @@ public HitboxGetBounds() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); diff --git a/src/examples/java/reference/HitboxIntersects.java b/examples/src/main/java/reference/HitboxIntersects.java similarity index 90% rename from src/examples/java/reference/HitboxIntersects.java rename to examples/src/main/java/reference/HitboxIntersects.java index d20159c9..fd2e82cc 100644 --- a/src/examples/java/reference/HitboxIntersects.java +++ b/examples/src/main/java/reference/HitboxIntersects.java @@ -7,7 +7,7 @@ public HitboxIntersects() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite green = new Sprite("green", "slimeGreen"); green.setX(-150); myStage.add(green); @@ -20,7 +20,7 @@ public HitboxIntersects() { green.changeX(4); green.ifOnEdgeBounce(); myStage.display("touching: " + green.getHitbox().intersects(blue.getHitbox())); - myStage.wait(30); + myStage.waitSeconds(0.03); } } diff --git a/src/examples/java/reference/HtmlColorAll.java b/examples/src/main/java/reference/HtmlColorAll.java similarity index 89% rename from src/examples/java/reference/HtmlColorAll.java rename to examples/src/main/java/reference/HtmlColorAll.java index a1373bf6..db25372f 100644 --- a/src/examples/java/reference/HtmlColorAll.java +++ b/examples/src/main/java/reference/HtmlColorAll.java @@ -10,9 +10,9 @@ public HtmlColorAll() { // The 140 colours every browser knows, each one a ready-made Color. myStage.setColor(HtmlColor.CORNFLOWER_BLUE); - myStage.wait(1500); + myStage.waitSeconds(1.5); myStage.setColor(HtmlColor.TOMATO); - myStage.wait(1500); + myStage.waitSeconds(1.5); myStage.setColor(HtmlColor.MEDIUM_SEA_GREEN); } diff --git a/src/examples/java/reference/HtmlColorGetRandom.java b/examples/src/main/java/reference/HtmlColorGetRandom.java similarity index 93% rename from src/examples/java/reference/HtmlColorGetRandom.java rename to examples/src/main/java/reference/HtmlColorGetRandom.java index ad5ccb4b..7c410ea3 100644 --- a/src/examples/java/reference/HtmlColorGetRandom.java +++ b/examples/src/main/java/reference/HtmlColorGetRandom.java @@ -11,7 +11,7 @@ public HtmlColorGetRandom() { // A different one of the 140 HTML colours every second. while (true) { myStage.setColor(HtmlColor.getRandom()); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/OperatorsAbsOf.java b/examples/src/main/java/reference/OperatorsAbsOf.java similarity index 100% rename from src/examples/java/reference/OperatorsAbsOf.java rename to examples/src/main/java/reference/OperatorsAbsOf.java diff --git a/src/examples/java/reference/OperatorsAcosOf.java b/examples/src/main/java/reference/OperatorsAcosOf.java similarity index 100% rename from src/examples/java/reference/OperatorsAcosOf.java rename to examples/src/main/java/reference/OperatorsAcosOf.java diff --git a/src/examples/java/reference/OperatorsAll.java b/examples/src/main/java/reference/OperatorsAll.java similarity index 100% rename from src/examples/java/reference/OperatorsAll.java rename to examples/src/main/java/reference/OperatorsAll.java diff --git a/src/examples/java/reference/OperatorsAsinOf.java b/examples/src/main/java/reference/OperatorsAsinOf.java similarity index 100% rename from src/examples/java/reference/OperatorsAsinOf.java rename to examples/src/main/java/reference/OperatorsAsinOf.java diff --git a/src/examples/java/reference/OperatorsAtanOf.java b/examples/src/main/java/reference/OperatorsAtanOf.java similarity index 100% rename from src/examples/java/reference/OperatorsAtanOf.java rename to examples/src/main/java/reference/OperatorsAtanOf.java diff --git a/src/examples/java/reference/OperatorsCeilingOf.java b/examples/src/main/java/reference/OperatorsCeilingOf.java similarity index 100% rename from src/examples/java/reference/OperatorsCeilingOf.java rename to examples/src/main/java/reference/OperatorsCeilingOf.java diff --git a/src/examples/java/reference/OperatorsConstrain.java b/examples/src/main/java/reference/OperatorsConstrain.java similarity index 100% rename from src/examples/java/reference/OperatorsConstrain.java rename to examples/src/main/java/reference/OperatorsConstrain.java diff --git a/src/examples/java/reference/OperatorsCosOf.java b/examples/src/main/java/reference/OperatorsCosOf.java similarity index 100% rename from src/examples/java/reference/OperatorsCosOf.java rename to examples/src/main/java/reference/OperatorsCosOf.java diff --git a/src/examples/java/reference/OperatorsEToThePowerOf.java b/examples/src/main/java/reference/OperatorsEToThePowerOf.java similarity index 100% rename from src/examples/java/reference/OperatorsEToThePowerOf.java rename to examples/src/main/java/reference/OperatorsEToThePowerOf.java diff --git a/src/examples/java/reference/OperatorsFloorOf.java b/examples/src/main/java/reference/OperatorsFloorOf.java similarity index 100% rename from src/examples/java/reference/OperatorsFloorOf.java rename to examples/src/main/java/reference/OperatorsFloorOf.java diff --git a/src/examples/java/reference/OperatorsLerp/MyStage.java b/examples/src/main/java/reference/OperatorsLerp/MyStage.java similarity index 60% rename from src/examples/java/reference/OperatorsLerp/MyStage.java rename to examples/src/main/java/reference/OperatorsLerp/MyStage.java index 990a4d1f..5757c465 100644 --- a/src/examples/java/reference/OperatorsLerp/MyStage.java +++ b/examples/src/main/java/reference/OperatorsLerp/MyStage.java @@ -7,18 +7,17 @@ public class MyStage extends Stage { private Pen myPen; - private int startMillis = 0; + private Timer myTimer = new Timer(); public MyStage() { - startMillis = Timer.millis(); myPen = new Pen(); this.add(myPen); } public void run() { - var currentMillis = Timer.millis(); - var x = Operators.lerp(0, this.getWidth() / 2.0, (currentMillis - startMillis) / 3000.0); - var y = Operators.lerp(0, this.getHeight() / 2.0, (currentMillis - startMillis) / 3000.0); + var seconds = myTimer.getSeconds(); + var x = Operators.lerp(0, this.getWidth() / 2.0, seconds / 3.0); + var y = Operators.lerp(0, this.getHeight() / 2.0, seconds / 3.0); myPen.setPosition(x, y); System.out.println(x); System.out.println(this.getWidth()); diff --git a/src/examples/java/reference/OperatorsLerp/MyWindow.java b/examples/src/main/java/reference/OperatorsLerp/MyWindow.java similarity index 100% rename from src/examples/java/reference/OperatorsLerp/MyWindow.java rename to examples/src/main/java/reference/OperatorsLerp/MyWindow.java diff --git a/src/examples/java/reference/OperatorsLnOf.java b/examples/src/main/java/reference/OperatorsLnOf.java similarity index 100% rename from src/examples/java/reference/OperatorsLnOf.java rename to examples/src/main/java/reference/OperatorsLnOf.java diff --git a/src/examples/java/reference/OperatorsLogOf.java b/examples/src/main/java/reference/OperatorsLogOf.java similarity index 100% rename from src/examples/java/reference/OperatorsLogOf.java rename to examples/src/main/java/reference/OperatorsLogOf.java diff --git a/src/examples/java/reference/OperatorsMap.java b/examples/src/main/java/reference/OperatorsMap.java similarity index 100% rename from src/examples/java/reference/OperatorsMap.java rename to examples/src/main/java/reference/OperatorsMap.java diff --git a/src/examples/java/reference/OperatorsMax.java b/examples/src/main/java/reference/OperatorsMax.java similarity index 100% rename from src/examples/java/reference/OperatorsMax.java rename to examples/src/main/java/reference/OperatorsMax.java diff --git a/src/examples/java/reference/OperatorsMin.java b/examples/src/main/java/reference/OperatorsMin.java similarity index 100% rename from src/examples/java/reference/OperatorsMin.java rename to examples/src/main/java/reference/OperatorsMin.java diff --git a/src/examples/java/reference/OperatorsMod.java b/examples/src/main/java/reference/OperatorsMod.java similarity index 100% rename from src/examples/java/reference/OperatorsMod.java rename to examples/src/main/java/reference/OperatorsMod.java diff --git a/src/examples/java/reference/OperatorsRound.java b/examples/src/main/java/reference/OperatorsRound.java similarity index 100% rename from src/examples/java/reference/OperatorsRound.java rename to examples/src/main/java/reference/OperatorsRound.java diff --git a/src/examples/java/reference/OperatorsSinOf.java b/examples/src/main/java/reference/OperatorsSinOf.java similarity index 100% rename from src/examples/java/reference/OperatorsSinOf.java rename to examples/src/main/java/reference/OperatorsSinOf.java diff --git a/src/examples/java/reference/OperatorsSqrtOf.java b/examples/src/main/java/reference/OperatorsSqrtOf.java similarity index 100% rename from src/examples/java/reference/OperatorsSqrtOf.java rename to examples/src/main/java/reference/OperatorsSqrtOf.java diff --git a/src/examples/java/reference/OperatorsTanOf.java b/examples/src/main/java/reference/OperatorsTanOf.java similarity index 100% rename from src/examples/java/reference/OperatorsTanOf.java rename to examples/src/main/java/reference/OperatorsTanOf.java diff --git a/src/examples/java/reference/OperatorsTenToThePowerOf.java b/examples/src/main/java/reference/OperatorsTenToThePowerOf.java similarity index 100% rename from src/examples/java/reference/OperatorsTenToThePowerOf.java rename to examples/src/main/java/reference/OperatorsTenToThePowerOf.java diff --git a/src/examples/java/reference/PenChangeColor.java b/examples/src/main/java/reference/PenChangeColor.java similarity index 94% rename from src/examples/java/reference/PenChangeColor.java rename to examples/src/main/java/reference/PenChangeColor.java index 762bfb08..e40cc53e 100644 --- a/src/examples/java/reference/PenChangeColor.java +++ b/examples/src/main/java/reference/PenChangeColor.java @@ -16,7 +16,7 @@ public PenChangeColor() { myPen.down(); myPen.goToRandomPosition(); myPen.up(); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/PenChangeSize.java b/examples/src/main/java/reference/PenChangeSize.java similarity index 94% rename from src/examples/java/reference/PenChangeSize.java rename to examples/src/main/java/reference/PenChangeSize.java index b70dcf04..415cb785 100644 --- a/src/examples/java/reference/PenChangeSize.java +++ b/examples/src/main/java/reference/PenChangeSize.java @@ -13,7 +13,7 @@ public PenChangeSize() { myPen.down(); myPen.setPosition(myStage.pickRandom(0, myStage.getWidth()), 45); myPen.up(); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/PenChangeTransparency.java b/examples/src/main/java/reference/PenChangeTransparency.java similarity index 94% rename from src/examples/java/reference/PenChangeTransparency.java rename to examples/src/main/java/reference/PenChangeTransparency.java index d5eaa394..af79ffe4 100644 --- a/src/examples/java/reference/PenChangeTransparency.java +++ b/examples/src/main/java/reference/PenChangeTransparency.java @@ -16,7 +16,7 @@ public PenChangeTransparency() { myPen.down(); myPen.goToRandomPosition(); myPen.up(); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/PenConstructors.java b/examples/src/main/java/reference/PenConstructors.java similarity index 94% rename from src/examples/java/reference/PenConstructors.java rename to examples/src/main/java/reference/PenConstructors.java index 7f88e86d..c00c8626 100644 --- a/src/examples/java/reference/PenConstructors.java +++ b/examples/src/main/java/reference/PenConstructors.java @@ -14,7 +14,7 @@ public PenConstructors() { myPen.down(); while (true) { myPen.goToRandomPosition(); - myStage.wait(300); + myStage.waitSeconds(0.3); } } diff --git a/src/examples/java/reference/PenDown.java b/examples/src/main/java/reference/PenDown.java similarity index 93% rename from src/examples/java/reference/PenDown.java rename to examples/src/main/java/reference/PenDown.java index ec161291..458244a2 100644 --- a/src/examples/java/reference/PenDown.java +++ b/examples/src/main/java/reference/PenDown.java @@ -12,7 +12,7 @@ public PenDown() { myPen.setSize(10); myPen.setPosition(120, 45); myPen.setColor(0, 255, 0); - myStage.wait(500); + myStage.waitSeconds(0.5); } public static void main(String[] args) { diff --git a/src/examples/java/reference/PenEraseAll.java b/examples/src/main/java/reference/PenEraseAll.java similarity index 100% rename from src/examples/java/reference/PenEraseAll.java rename to examples/src/main/java/reference/PenEraseAll.java diff --git a/src/examples/java/reference/PenGetColor.java b/examples/src/main/java/reference/PenGetColor.java similarity index 83% rename from src/examples/java/reference/PenGetColor.java rename to examples/src/main/java/reference/PenGetColor.java index 09329d2f..2ade7ee4 100644 --- a/src/examples/java/reference/PenGetColor.java +++ b/examples/src/main/java/reference/PenGetColor.java @@ -12,7 +12,7 @@ public PenGetColor() { myPen.setColor(140); Color penColor = myPen.getColor(); - System.out.println("hue " + penColor.getH() + ", red " + penColor.getRed()); + System.out.println("hue " + penColor.getHue() + ", red " + penColor.getRed()); } public static void main(String[] args) { diff --git a/src/examples/java/reference/PenGetSize.java b/examples/src/main/java/reference/PenGetSize.java similarity index 100% rename from src/examples/java/reference/PenGetSize.java rename to examples/src/main/java/reference/PenGetSize.java diff --git a/src/examples/java/reference/PenGoToBackground.java b/examples/src/main/java/reference/PenGoToBackground.java similarity index 90% rename from src/examples/java/reference/PenGoToBackground.java rename to examples/src/main/java/reference/PenGoToBackground.java index 63f6a1f7..44765bf7 100644 --- a/src/examples/java/reference/PenGoToBackground.java +++ b/examples/src/main/java/reference/PenGoToBackground.java @@ -16,10 +16,10 @@ public PenGoToBackground() { myPen.setColor(0); myPen.down(); // Behind the sprites: the drawing is covered by everything on the stage. - myPen.goToBackground(); + myPen.setLayer(Layer.BACKGROUND); while (true) { myPen.goToRandomPosition(); - myStage.wait(300); + myStage.waitSeconds(0.3); } } diff --git a/src/examples/java/reference/PenGoToForeground.java b/examples/src/main/java/reference/PenGoToForeground.java similarity index 90% rename from src/examples/java/reference/PenGoToForeground.java rename to examples/src/main/java/reference/PenGoToForeground.java index d66acebb..18b089b8 100644 --- a/src/examples/java/reference/PenGoToForeground.java +++ b/examples/src/main/java/reference/PenGoToForeground.java @@ -16,10 +16,10 @@ public PenGoToForeground() { myPen.setColor(0); myPen.down(); // In front of the sprites: the drawing covers everything on the stage. - myPen.goToForeground(); + myPen.setLayer(Layer.FOREGROUND); while (true) { myPen.goToRandomPosition(); - myStage.wait(300); + myStage.waitSeconds(0.3); } } diff --git a/src/examples/java/reference/PenGoToMousePointer.java b/examples/src/main/java/reference/PenGoToMousePointer.java similarity index 94% rename from src/examples/java/reference/PenGoToMousePointer.java rename to examples/src/main/java/reference/PenGoToMousePointer.java index e67e5134..064f2da1 100644 --- a/src/examples/java/reference/PenGoToMousePointer.java +++ b/examples/src/main/java/reference/PenGoToMousePointer.java @@ -15,7 +15,7 @@ public PenGoToMousePointer() { // Drawing follows the mouse. Click into the stage first. while (true) { myPen.goToMousePointer(); - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/PenGoToRandomPosition.java b/examples/src/main/java/reference/PenGoToRandomPosition.java similarity index 94% rename from src/examples/java/reference/PenGoToRandomPosition.java rename to examples/src/main/java/reference/PenGoToRandomPosition.java index 966ecbca..5590f573 100644 --- a/src/examples/java/reference/PenGoToRandomPosition.java +++ b/examples/src/main/java/reference/PenGoToRandomPosition.java @@ -15,7 +15,7 @@ public PenGoToRandomPosition() { // A tangle of straight lines, one every third of a second. while (true) { myPen.goToRandomPosition(); - myStage.wait(300); + myStage.waitSeconds(0.3); } } diff --git a/src/examples/java/reference/PenIsInBackground.java b/examples/src/main/java/reference/PenIsInBackground.java similarity index 62% rename from src/examples/java/reference/PenIsInBackground.java rename to examples/src/main/java/reference/PenIsInBackground.java index af4c4c76..c5a6e302 100644 --- a/src/examples/java/reference/PenIsInBackground.java +++ b/examples/src/main/java/reference/PenIsInBackground.java @@ -10,9 +10,9 @@ public PenIsInBackground() { Pen myPen = new Pen(); myStage.add(myPen); - System.out.println("draws behind the sprites: " + myPen.isInBackground()); - myPen.goToBackground(); - System.out.println("and now: " + myPen.isInBackground()); + System.out.println("draws behind the sprites: " + myPen.getLayer().equals(Layer.BACKGROUND)); + myPen.setLayer(Layer.BACKGROUND); + System.out.println("and now: " + myPen.getLayer().equals(Layer.BACKGROUND)); } public static void main(String[] args) { diff --git a/src/examples/java/reference/PenSetColor.java b/examples/src/main/java/reference/PenSetColor.java similarity index 93% rename from src/examples/java/reference/PenSetColor.java rename to examples/src/main/java/reference/PenSetColor.java index 09a412d0..7a31a946 100644 --- a/src/examples/java/reference/PenSetColor.java +++ b/examples/src/main/java/reference/PenSetColor.java @@ -13,7 +13,7 @@ public PenSetColor() { myPen.setSize(10); myPen.setColor(0, 255, 0); myPen.setPosition(120, 45); - myStage.wait(1500); + myStage.waitSeconds(1.5); } public static void main(String[] args) { diff --git a/src/examples/java/reference/PenSetPosition.java b/examples/src/main/java/reference/PenSetPosition.java similarity index 95% rename from src/examples/java/reference/PenSetPosition.java rename to examples/src/main/java/reference/PenSetPosition.java index 44d3f3f4..9ce4d88d 100644 --- a/src/examples/java/reference/PenSetPosition.java +++ b/examples/src/main/java/reference/PenSetPosition.java @@ -16,7 +16,7 @@ public PenSetPosition() { myPen.down(); myPen.setPosition(myStage.pickRandom(-myStage.getWidth() / 2, myStage.getWidth() / 2), 45); myPen.up(); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/PenSetSize.java b/examples/src/main/java/reference/PenSetSize.java similarity index 88% rename from src/examples/java/reference/PenSetSize.java rename to examples/src/main/java/reference/PenSetSize.java index 26f7e714..9e105812 100644 --- a/src/examples/java/reference/PenSetSize.java +++ b/examples/src/main/java/reference/PenSetSize.java @@ -13,12 +13,12 @@ public PenSetSize() { myPen.setSize(10); while (true) { myPen.down(); - if (myStage.getTimer().everyMillis(500)) { + if (myStage.getTimer().every(0.5)) { myPen.setSize(myStage.pickRandom(5, 20)); } myPen.goToRandomPosition(); myPen.up(); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/PenSetTransparency.java b/examples/src/main/java/reference/PenSetTransparency.java similarity index 100% rename from src/examples/java/reference/PenSetTransparency.java rename to examples/src/main/java/reference/PenSetTransparency.java diff --git a/src/examples/java/reference/PenStamp.java b/examples/src/main/java/reference/PenStamp.java similarity index 94% rename from src/examples/java/reference/PenStamp.java rename to examples/src/main/java/reference/PenStamp.java index d9d0ae23..2afe581b 100644 --- a/src/examples/java/reference/PenStamp.java +++ b/examples/src/main/java/reference/PenStamp.java @@ -17,7 +17,7 @@ public PenStamp() { myPen.goToRandomPosition(); myPen.changeColor(20); myPen.stamp(); - myStage.wait(300); + myStage.waitSeconds(0.3); } } diff --git a/src/examples/java/reference/PenUp.java b/examples/src/main/java/reference/PenUp.java similarity index 92% rename from src/examples/java/reference/PenUp.java rename to examples/src/main/java/reference/PenUp.java index a9b66b29..63c835c1 100644 --- a/src/examples/java/reference/PenUp.java +++ b/examples/src/main/java/reference/PenUp.java @@ -23,9 +23,9 @@ public PenUp() { myPen.setPosition(200, 0); myPen.up(); - myStage.wait(1500); + myStage.waitSeconds(1.5); myStage.eraseAll(); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/PolygonAddPoint.java b/examples/src/main/java/reference/PolygonAddPoint.java similarity index 94% rename from src/examples/java/reference/PolygonAddPoint.java rename to examples/src/main/java/reference/PolygonAddPoint.java index fb853bbd..6f113191 100644 --- a/src/examples/java/reference/PolygonAddPoint.java +++ b/examples/src/main/java/reference/PolygonAddPoint.java @@ -7,7 +7,7 @@ public PolygonAddPoint() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); diff --git a/src/examples/java/reference/PolygonConstructors.java b/examples/src/main/java/reference/PolygonConstructors.java similarity index 93% rename from src/examples/java/reference/PolygonConstructors.java rename to examples/src/main/java/reference/PolygonConstructors.java index 1211ea8b..3e36d8bf 100644 --- a/src/examples/java/reference/PolygonConstructors.java +++ b/examples/src/main/java/reference/PolygonConstructors.java @@ -7,7 +7,7 @@ public PolygonConstructors() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); diff --git a/src/examples/java/reference/RandomAll.java b/examples/src/main/java/reference/RandomAll.java similarity index 100% rename from src/examples/java/reference/RandomAll.java rename to examples/src/main/java/reference/RandomAll.java diff --git a/src/examples/java/reference/RandomNoise.java b/examples/src/main/java/reference/RandomNoise.java similarity index 100% rename from src/examples/java/reference/RandomNoise.java rename to examples/src/main/java/reference/RandomNoise.java diff --git a/src/examples/java/reference/RandomNoiseSeed.java b/examples/src/main/java/reference/RandomNoiseSeed.java similarity index 100% rename from src/examples/java/reference/RandomNoiseSeed.java rename to examples/src/main/java/reference/RandomNoiseSeed.java diff --git a/src/examples/java/reference/RandomRandom.java b/examples/src/main/java/reference/RandomRandom.java similarity index 100% rename from src/examples/java/reference/RandomRandom.java rename to examples/src/main/java/reference/RandomRandom.java diff --git a/src/examples/java/reference/RandomRandomInt.java b/examples/src/main/java/reference/RandomRandomInt.java similarity index 100% rename from src/examples/java/reference/RandomRandomInt.java rename to examples/src/main/java/reference/RandomRandomInt.java diff --git a/src/examples/java/reference/RandomRandomPosition.java b/examples/src/main/java/reference/RandomRandomPosition.java similarity index 94% rename from src/examples/java/reference/RandomRandomPosition.java rename to examples/src/main/java/reference/RandomRandomPosition.java index e1ad389c..f716bf51 100644 --- a/src/examples/java/reference/RandomRandomPosition.java +++ b/examples/src/main/java/reference/RandomRandomPosition.java @@ -13,7 +13,7 @@ public RandomRandomPosition() { myStage.add(mySprite); while (true) { mySprite.setPosition(Random.randomPosition()); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/RandomRandomSeed.java b/examples/src/main/java/reference/RandomRandomSeed.java similarity index 100% rename from src/examples/java/reference/RandomRandomSeed.java rename to examples/src/main/java/reference/RandomRandomSeed.java diff --git a/src/examples/java/reference/RandomRandomVector2.java b/examples/src/main/java/reference/RandomRandomVector2.java similarity index 100% rename from src/examples/java/reference/RandomRandomVector2.java rename to examples/src/main/java/reference/RandomRandomVector2.java diff --git a/src/examples/java/reference/RandomRandomX.java b/examples/src/main/java/reference/RandomRandomX.java similarity index 94% rename from src/examples/java/reference/RandomRandomX.java rename to examples/src/main/java/reference/RandomRandomX.java index a299e05e..d3606839 100644 --- a/src/examples/java/reference/RandomRandomX.java +++ b/examples/src/main/java/reference/RandomRandomX.java @@ -13,7 +13,7 @@ public RandomRandomX() { myStage.add(mySprite); while (true) { mySprite.setX(Random.randomX()); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/RandomRandomY.java b/examples/src/main/java/reference/RandomRandomY.java similarity index 93% rename from src/examples/java/reference/RandomRandomY.java rename to examples/src/main/java/reference/RandomRandomY.java index 1bdd72f4..202771cf 100644 --- a/src/examples/java/reference/RandomRandomY.java +++ b/examples/src/main/java/reference/RandomRandomY.java @@ -12,7 +12,7 @@ public RandomRandomY() { myStage.add(mySprite); while (true) { mySprite.setY(Random.randomY()); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/RectangleConstructors.java b/examples/src/main/java/reference/RectangleConstructors.java similarity index 92% rename from src/examples/java/reference/RectangleConstructors.java rename to examples/src/main/java/reference/RectangleConstructors.java index e45d044b..aced95c3 100644 --- a/src/examples/java/reference/RectangleConstructors.java +++ b/examples/src/main/java/reference/RectangleConstructors.java @@ -7,7 +7,7 @@ public RectangleConstructors() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); diff --git a/src/examples/java/reference/SaveDataExample.java b/examples/src/main/java/reference/SaveDataExample.java similarity index 93% rename from src/examples/java/reference/SaveDataExample.java rename to examples/src/main/java/reference/SaveDataExample.java index 85d55141..46c2c17f 100644 --- a/src/examples/java/reference/SaveDataExample.java +++ b/examples/src/main/java/reference/SaveDataExample.java @@ -1,7 +1,7 @@ package reference; import java.io.IOException; -import org.openpatch.scratch.extensions.fs.SaveData; +import org.openpatch.scratch.save.SaveData; public class SaveDataExample { public SaveDataExample() { diff --git a/src/examples/java/reference/ShaderSet.java b/examples/src/main/java/reference/ShaderSet.java similarity index 87% rename from src/examples/java/reference/ShaderSet.java rename to examples/src/main/java/reference/ShaderSet.java index e71a6a0a..d11d5d00 100644 --- a/src/examples/java/reference/ShaderSet.java +++ b/examples/src/main/java/reference/ShaderSet.java @@ -1,6 +1,5 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.shader.*; public class ShaderSet { @@ -12,14 +11,14 @@ public ShaderSet() { mySprite.setSize(200); myStage.add(mySprite); - Shader pixelate = mySprite.getShaders().add("pixelate", "assets/pixelate.frag", null); + Shader pixelate = mySprite.getShaders().add("pixelate", "assets/pixelate.frag"); while (true) { // "blocks" is a uniform of pixelate.frag: the further right the mouse, // the more blocks across and the sharper the slime double blocks = 2 + (myStage.getMouseX() + 300) / 10; pixelate.set("blocks", blocks); - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/ShadersActivate.java b/examples/src/main/java/reference/ShadersActivate.java similarity index 78% rename from src/examples/java/reference/ShadersActivate.java rename to examples/src/main/java/reference/ShadersActivate.java index d2d01226..64c078c1 100644 --- a/src/examples/java/reference/ShadersActivate.java +++ b/examples/src/main/java/reference/ShadersActivate.java @@ -1,6 +1,5 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.shader.*; public class ShadersActivate { @@ -12,8 +11,8 @@ public ShadersActivate() { myStage.add(new Sprite("slime", "slimeGreen")); // the first shader added is active at once: the stage is gray - myStage.getShaders().add("grayscale", "assets/grayscale.frag", null); - Shader waves = myStage.getShaders().add("waves", "assets/waves.frag", null); + myStage.getShaders().add("grayscale", "assets/grayscale.frag"); + myStage.getShaders().add("waves", "assets/waves.frag"); while (true) { // while the mouse is down, the gray stage wobbles as well @@ -22,8 +21,7 @@ public ShadersActivate() { } else { myStage.getShaders().deactivate("waves"); } - waves.set("time", Timer.millis() / 1000.0); - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/ShadersAdd.java b/examples/src/main/java/reference/ShadersAdd.java similarity index 71% rename from src/examples/java/reference/ShadersAdd.java rename to examples/src/main/java/reference/ShadersAdd.java index 6916944a..53b3b13c 100644 --- a/src/examples/java/reference/ShadersAdd.java +++ b/examples/src/main/java/reference/ShadersAdd.java @@ -10,8 +10,8 @@ public ShadersAdd() { Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); - // a fragment shader file, and null for Processing's default vertex shader - mySprite.getShaders().add("invert", "assets/invert.frag", null); + // a name for the shader and its fragment shader file + mySprite.getShaders().add("invert", "assets/invert.frag"); } public static void main(String[] args) { diff --git a/src/examples/java/reference/ShadersNext.java b/examples/src/main/java/reference/ShadersNext.java similarity index 85% rename from src/examples/java/reference/ShadersNext.java rename to examples/src/main/java/reference/ShadersNext.java index 9395e3e9..4f3eb0ff 100644 --- a/src/examples/java/reference/ShadersNext.java +++ b/examples/src/main/java/reference/ShadersNext.java @@ -10,12 +10,12 @@ public ShadersNext() { Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); - mySprite.getShaders().add("grayscale", "assets/grayscale.frag", null); - mySprite.getShaders().add("invert", "assets/invert.frag", null); + mySprite.getShaders().add("grayscale", "assets/grayscale.frag"); + mySprite.getShaders().add("invert", "assets/invert.frag"); while (true) { mySprite.say(mySprite.getShaders().getCurrentName()); - myStage.wait(1000); + myStage.waitSeconds(1); // after the last shader comes the first one again mySprite.getShaders().next(); } diff --git a/src/examples/java/reference/ShadersReset.java b/examples/src/main/java/reference/ShadersReset.java similarity index 81% rename from src/examples/java/reference/ShadersReset.java rename to examples/src/main/java/reference/ShadersReset.java index 99ab4e4d..a2000e27 100644 --- a/src/examples/java/reference/ShadersReset.java +++ b/examples/src/main/java/reference/ShadersReset.java @@ -10,13 +10,13 @@ public ShadersReset() { Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); - mySprite.getShaders().add("invert", "assets/invert.frag", null); + mySprite.getShaders().add("invert", "assets/invert.frag"); while (true) { - myStage.wait(1000); + myStage.waitSeconds(1); // back to the plain costume; the shader is kept for later mySprite.getShaders().reset(); - myStage.wait(1000); + myStage.waitSeconds(1); mySprite.getShaders().switchTo("invert"); } } diff --git a/src/examples/java/reference/ShadersSwitchTo.java b/examples/src/main/java/reference/ShadersSwitchTo.java similarity index 86% rename from src/examples/java/reference/ShadersSwitchTo.java rename to examples/src/main/java/reference/ShadersSwitchTo.java index 787b7f4a..480ac3be 100644 --- a/src/examples/java/reference/ShadersSwitchTo.java +++ b/examples/src/main/java/reference/ShadersSwitchTo.java @@ -11,8 +11,8 @@ public ShadersSwitchTo() { myStage.add(mySprite); // the first shader added is the one drawn with - mySprite.getShaders().add("grayscale", "assets/grayscale.frag", null); - mySprite.getShaders().add("invert", "assets/invert.frag", null); + mySprite.getShaders().add("grayscale", "assets/grayscale.frag"); + mySprite.getShaders().add("invert", "assets/invert.frag"); while (true) { if (mySprite.isMouseDown()) { @@ -20,7 +20,7 @@ public ShadersSwitchTo() { } else { mySprite.getShaders().switchTo("grayscale"); } - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/ShapeConstructors.java b/examples/src/main/java/reference/ShapeConstructors.java similarity index 100% rename from src/examples/java/reference/ShapeConstructors.java rename to examples/src/main/java/reference/ShapeConstructors.java diff --git a/src/examples/java/reference/ShapeContains.java b/examples/src/main/java/reference/ShapeContains.java similarity index 100% rename from src/examples/java/reference/ShapeContains.java rename to examples/src/main/java/reference/ShapeContains.java diff --git a/src/examples/java/reference/ShapeGetBounds.java b/examples/src/main/java/reference/ShapeGetBounds.java similarity index 100% rename from src/examples/java/reference/ShapeGetBounds.java rename to examples/src/main/java/reference/ShapeGetBounds.java diff --git a/src/examples/java/reference/ShapeIntersects.java b/examples/src/main/java/reference/ShapeIntersects.java similarity index 100% rename from src/examples/java/reference/ShapeIntersects.java rename to examples/src/main/java/reference/ShapeIntersects.java diff --git a/src/examples/java/reference/ShapeRotate.java b/examples/src/main/java/reference/ShapeRotate.java similarity index 100% rename from src/examples/java/reference/ShapeRotate.java rename to examples/src/main/java/reference/ShapeRotate.java diff --git a/src/examples/java/reference/ShapeScale.java b/examples/src/main/java/reference/ShapeScale.java similarity index 100% rename from src/examples/java/reference/ShapeScale.java rename to examples/src/main/java/reference/ShapeScale.java diff --git a/src/examples/java/reference/ShapeTranslate.java b/examples/src/main/java/reference/ShapeTranslate.java similarity index 100% rename from src/examples/java/reference/ShapeTranslate.java rename to examples/src/main/java/reference/ShapeTranslate.java diff --git a/src/examples/java/reference/SoundPlaybackExample.java b/examples/src/main/java/reference/SoundPlaybackExample.java similarity index 93% rename from src/examples/java/reference/SoundPlaybackExample.java rename to examples/src/main/java/reference/SoundPlaybackExample.java index a968631e..d0858209 100644 --- a/src/examples/java/reference/SoundPlaybackExample.java +++ b/examples/src/main/java/reference/SoundPlaybackExample.java @@ -1,7 +1,7 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.sound.SoundPlayback; +import org.openpatch.scratch.SoundPlayback; public class SoundPlaybackExample { public SoundPlaybackExample() { diff --git a/src/examples/java/reference/SpriteAddCostume.java b/examples/src/main/java/reference/SpriteAddCostume.java similarity index 93% rename from src/examples/java/reference/SpriteAddCostume.java rename to examples/src/main/java/reference/SpriteAddCostume.java index a2952284..9daa56ca 100644 --- a/src/examples/java/reference/SpriteAddCostume.java +++ b/examples/src/main/java/reference/SpriteAddCostume.java @@ -9,7 +9,7 @@ public SpriteAddCostume() { Sprite zeta = new Sprite("green", "slimeGreen"); zeta.addCostume("yellow", "slimeBlue"); myStage.add(zeta); - myStage.wait(1000); + myStage.waitSeconds(1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteAddCostumes.java b/examples/src/main/java/reference/SpriteAddCostumes.java similarity index 95% rename from src/examples/java/reference/SpriteAddCostumes.java rename to examples/src/main/java/reference/SpriteAddCostumes.java index 2ed45048..ea3f7d63 100644 --- a/src/examples/java/reference/SpriteAddCostumes.java +++ b/examples/src/main/java/reference/SpriteAddCostumes.java @@ -16,7 +16,7 @@ public SpriteAddCostumes() { mySprite.setSize(30); while (true) { mySprite.nextCostume(); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/SpriteAddSound.java b/examples/src/main/java/reference/SpriteAddSound.java similarity index 95% rename from src/examples/java/reference/SpriteAddSound.java rename to examples/src/main/java/reference/SpriteAddSound.java index 86d00aaa..54dfdfb1 100644 --- a/src/examples/java/reference/SpriteAddSound.java +++ b/examples/src/main/java/reference/SpriteAddSound.java @@ -14,7 +14,7 @@ public SpriteAddSound() { mySprite.addSound("bump", "impactWood_heavy_001"); while (true) { mySprite.playSound("bump"); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/SpriteAsk.java b/examples/src/main/java/reference/SpriteAsk.java similarity index 95% rename from src/examples/java/reference/SpriteAsk.java rename to examples/src/main/java/reference/SpriteAsk.java index 1b1f2a95..8418669d 100644 --- a/src/examples/java/reference/SpriteAsk.java +++ b/examples/src/main/java/reference/SpriteAsk.java @@ -14,7 +14,7 @@ public SpriteAsk() { // typed once isAsking() has gone back to false. mySprite.ask("What is your name?"); while (mySprite.isAsking()) { - myStage.wait(50); + myStage.waitSeconds(0.05); } mySprite.say("Hello " + mySprite.getAnswer()); } diff --git a/src/examples/java/reference/SpriteBroadcast.java b/examples/src/main/java/reference/SpriteBroadcast.java similarity index 92% rename from src/examples/java/reference/SpriteBroadcast.java rename to examples/src/main/java/reference/SpriteBroadcast.java index 1de8442f..56168602 100644 --- a/src/examples/java/reference/SpriteBroadcast.java +++ b/examples/src/main/java/reference/SpriteBroadcast.java @@ -20,7 +20,8 @@ public ReceiveStage() { public void whenIReceive(String message) { if (message.equals("change-custome")) { - this.changeColor(50); + Color color = this.getColor(); + this.setColor(color.withHue(color.getHue() + 50)); } } } diff --git a/examples/src/main/java/reference/SpriteChangeColorEffect.java b/examples/src/main/java/reference/SpriteChangeColorEffect.java new file mode 100644 index 00000000..1201d032 --- /dev/null +++ b/examples/src/main/java/reference/SpriteChangeColorEffect.java @@ -0,0 +1,21 @@ +package reference; +import org.openpatch.scratch.*; + +public class SpriteChangeColorEffect { + public SpriteChangeColorEffect() { + Window myWindow = new Window(600, 240); + Stage myStage = new Stage(); + myWindow.setStage(myStage); + Sprite mySprite = new Sprite("slime", "slimeBlue"); + myStage.add(mySprite); + // small steps take the slime once round the colour wheel, over and over + while (true) { + mySprite.changeColorEffect(5); + myStage.waitSeconds(0.05); + } + } + + public static void main(String[] args) { + new SpriteChangeColorEffect(); + } +} diff --git a/src/examples/java/reference/SpriteChangePosition.java b/examples/src/main/java/reference/SpriteChangePosition.java similarity index 91% rename from src/examples/java/reference/SpriteChangePosition.java rename to examples/src/main/java/reference/SpriteChangePosition.java index 2cb53857..185bff2f 100644 --- a/src/examples/java/reference/SpriteChangePosition.java +++ b/examples/src/main/java/reference/SpriteChangePosition.java @@ -16,10 +16,10 @@ public SpriteChangePosition() { while (true) { mySprite.changePosition(step); mySprite.ifOnEdgeBounce(); - myStage.wait(50); + myStage.waitSeconds(0.05); mySprite.changePosition(10, 5); mySprite.ifOnEdgeBounce(); - myStage.wait(50); + myStage.waitSeconds(0.05); } } diff --git a/src/examples/java/reference/SpriteChangeSize.java b/examples/src/main/java/reference/SpriteChangeSize.java similarity index 90% rename from src/examples/java/reference/SpriteChangeSize.java rename to examples/src/main/java/reference/SpriteChangeSize.java index 2112a7be..86452120 100644 --- a/src/examples/java/reference/SpriteChangeSize.java +++ b/examples/src/main/java/reference/SpriteChangeSize.java @@ -14,11 +14,11 @@ public SpriteChangeSize() { while (true) { while (mySprite.getSize() < 200) { mySprite.changeSize(5); - myStage.wait(50); + myStage.waitSeconds(0.05); } while (mySprite.getSize() > 50) { mySprite.changeSize(-5); - myStage.wait(50); + myStage.waitSeconds(0.05); } } } diff --git a/src/examples/java/reference/SpriteChangeTransparency.java b/examples/src/main/java/reference/SpriteChangeTransparency.java similarity index 90% rename from src/examples/java/reference/SpriteChangeTransparency.java rename to examples/src/main/java/reference/SpriteChangeTransparency.java index dc26f03a..a0eabbd2 100644 --- a/src/examples/java/reference/SpriteChangeTransparency.java +++ b/examples/src/main/java/reference/SpriteChangeTransparency.java @@ -13,10 +13,10 @@ public SpriteChangeTransparency() { while (true) { for (int i = 0; i < 10; i++) { mySprite.changeTransparency(10); - myStage.wait(100); + myStage.waitSeconds(0.1); } mySprite.setTransparency(0); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/SpriteChangeVolume.java b/examples/src/main/java/reference/SpriteChangeVolume.java similarity index 94% rename from src/examples/java/reference/SpriteChangeVolume.java rename to examples/src/main/java/reference/SpriteChangeVolume.java index 5014416f..b41e51cc 100644 --- a/src/examples/java/reference/SpriteChangeVolume.java +++ b/examples/src/main/java/reference/SpriteChangeVolume.java @@ -15,7 +15,7 @@ public SpriteChangeVolume() { // Fading out. while (mySprite.getVolume() > 0) { mySprite.changeVolume(-5); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/SpriteChangeX.java b/examples/src/main/java/reference/SpriteChangeX.java similarity index 87% rename from src/examples/java/reference/SpriteChangeX.java rename to examples/src/main/java/reference/SpriteChangeX.java index a4aaa4a6..df7ab5a0 100644 --- a/src/examples/java/reference/SpriteChangeX.java +++ b/examples/src/main/java/reference/SpriteChangeX.java @@ -8,9 +8,9 @@ public SpriteChangeX() { myWindow.setStage(myStage); Sprite mySprite = new Sprite("zeta", "slimeGreen"); myStage.add(mySprite); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.changeX(100); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteChangeY.java b/examples/src/main/java/reference/SpriteChangeY.java similarity index 83% rename from src/examples/java/reference/SpriteChangeY.java rename to examples/src/main/java/reference/SpriteChangeY.java index 26954f22..90a41483 100644 --- a/src/examples/java/reference/SpriteChangeY.java +++ b/examples/src/main/java/reference/SpriteChangeY.java @@ -8,11 +8,11 @@ public SpriteChangeY() { myWindow.setStage(myStage); Sprite mySprite = new Sprite("zeta", "slimeGreen"); myStage.add(mySprite); - myStage.wait(1000); + myStage.waitSeconds(1); mySprite.changeY(-20); - myStage.wait(1000); + myStage.waitSeconds(1); mySprite.changeY(40); - myStage.wait(1000); + myStage.waitSeconds(1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteClone.java b/examples/src/main/java/reference/SpriteClone.java similarity index 87% rename from src/examples/java/reference/SpriteClone.java rename to examples/src/main/java/reference/SpriteClone.java index fdca9249..8dbe1d00 100644 --- a/src/examples/java/reference/SpriteClone.java +++ b/examples/src/main/java/reference/SpriteClone.java @@ -12,9 +12,9 @@ public SpriteClone() { // A copy that is added to the same stage, next to the original. for (int i = 0; i < 8; i++) { - Sprite copy = mySprite.clone(); + Sprite copy = mySprite.createClone(); copy.goToRandomPosition(); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/SpriteConstructors.java b/examples/src/main/java/reference/SpriteConstructors.java similarity index 91% rename from src/examples/java/reference/SpriteConstructors.java rename to examples/src/main/java/reference/SpriteConstructors.java index 73c17b62..9684d887 100644 --- a/src/examples/java/reference/SpriteConstructors.java +++ b/examples/src/main/java/reference/SpriteConstructors.java @@ -17,9 +17,8 @@ public SpriteConstructors() { myStage.add(empty); // A copy of a sprite, with the same costumes and the same size. - Sprite copy = new Sprite(green); + Sprite copy = green.createClone(); copy.setX(120); - myStage.add(copy); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteDebug.java b/examples/src/main/java/reference/SpriteDebug.java similarity index 88% rename from src/examples/java/reference/SpriteDebug.java rename to examples/src/main/java/reference/SpriteDebug.java index 7abccf49..8c5351f6 100644 --- a/src/examples/java/reference/SpriteDebug.java +++ b/examples/src/main/java/reference/SpriteDebug.java @@ -10,12 +10,12 @@ public SpriteDebug() { Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); - myStage.setDebug(true); + Window.getInstance().setDebug(true); // Values printed onto the stage next to the sprite, without stopping it. while (true) { mySprite.changeX(2); mySprite.debug("x", mySprite.getX(), "direction", mySprite.getDirection()); - myStage.wait(50); + myStage.waitSeconds(0.05); } } diff --git a/src/examples/java/reference/SpriteDeleteThisClone.java b/examples/src/main/java/reference/SpriteDeleteThisClone.java similarity index 91% rename from src/examples/java/reference/SpriteDeleteThisClone.java rename to examples/src/main/java/reference/SpriteDeleteThisClone.java index 73fee261..31231924 100644 --- a/src/examples/java/reference/SpriteDeleteThisClone.java +++ b/examples/src/main/java/reference/SpriteDeleteThisClone.java @@ -12,8 +12,8 @@ public Coin() { public void run() { if (!this.isClone()) { // The original drops a new coin every second and stays where it is. - if (this.getTimer().everyMillis(1000)) { - this.clone(); + if (this.getTimer().every(1)) { + this.createClone(); } return; } diff --git a/src/examples/java/reference/SpriteDisableHitbox.java b/examples/src/main/java/reference/SpriteDisableHitbox.java similarity index 92% rename from src/examples/java/reference/SpriteDisableHitbox.java rename to examples/src/main/java/reference/SpriteDisableHitbox.java index 2ac688f9..1c555c61 100644 --- a/src/examples/java/reference/SpriteDisableHitbox.java +++ b/examples/src/main/java/reference/SpriteDisableHitbox.java @@ -7,7 +7,7 @@ public SpriteDisableHitbox() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); diff --git a/src/examples/java/reference/SpriteDistanceToMousePointer.java b/examples/src/main/java/reference/SpriteDistanceToMousePointer.java similarity index 94% rename from src/examples/java/reference/SpriteDistanceToMousePointer.java rename to examples/src/main/java/reference/SpriteDistanceToMousePointer.java index 5c60ecf8..20bc8917 100644 --- a/src/examples/java/reference/SpriteDistanceToMousePointer.java +++ b/examples/src/main/java/reference/SpriteDistanceToMousePointer.java @@ -13,7 +13,7 @@ public SpriteDistanceToMousePointer() { while (true) { gamma.changeX(5); myStage.display("Distance: " + gamma.distanceToMousePointer()); - myStage.wait(100); + myStage.waitSeconds(0.1); } } diff --git a/src/examples/java/reference/SpriteDistanceToSprite.java b/examples/src/main/java/reference/SpriteDistanceToSprite.java similarity index 95% rename from src/examples/java/reference/SpriteDistanceToSprite.java rename to examples/src/main/java/reference/SpriteDistanceToSprite.java index 8933f135..8467b8f8 100644 --- a/src/examples/java/reference/SpriteDistanceToSprite.java +++ b/examples/src/main/java/reference/SpriteDistanceToSprite.java @@ -19,7 +19,7 @@ public SpriteDistanceToSprite() { gamma.changeX(5); zeta.changeX(-5); myStage.display("Distance: " + gamma.distanceToSprite(zeta)); - myStage.wait(100); + myStage.waitSeconds(0.1); } } diff --git a/src/examples/java/reference/SpriteEnableHitbox.java b/examples/src/main/java/reference/SpriteEnableHitbox.java similarity index 84% rename from src/examples/java/reference/SpriteEnableHitbox.java rename to examples/src/main/java/reference/SpriteEnableHitbox.java index f44ff1e7..a43af29c 100644 --- a/src/examples/java/reference/SpriteEnableHitbox.java +++ b/examples/src/main/java/reference/SpriteEnableHitbox.java @@ -7,16 +7,16 @@ public SpriteEnableHitbox() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); // Touching is worked out from the hitbox, which debug mode draws. while (true) { mySprite.disableHitbox(); - myStage.wait(1500); + myStage.waitSeconds(1.5); mySprite.enableHitbox(); - myStage.wait(1500); + myStage.waitSeconds(1.5); } } diff --git a/src/examples/java/reference/SpriteGetAnswer.java b/examples/src/main/java/reference/SpriteGetAnswer.java similarity index 94% rename from src/examples/java/reference/SpriteGetAnswer.java rename to examples/src/main/java/reference/SpriteGetAnswer.java index 29236ee1..a6c416eb 100644 --- a/src/examples/java/reference/SpriteGetAnswer.java +++ b/examples/src/main/java/reference/SpriteGetAnswer.java @@ -12,7 +12,7 @@ public SpriteGetAnswer() { mySprite.ask("How old are you?"); while (mySprite.isAsking()) { - myStage.wait(50); + myStage.waitSeconds(0.05); } System.out.println("The answer was " + mySprite.getAnswer()); } diff --git a/src/examples/java/reference/SpriteGetCurrentCostumeIndex.java b/examples/src/main/java/reference/SpriteGetCurrentCostumeIndex.java similarity index 92% rename from src/examples/java/reference/SpriteGetCurrentCostumeIndex.java rename to examples/src/main/java/reference/SpriteGetCurrentCostumeIndex.java index 3b4dace6..276a7d7f 100644 --- a/src/examples/java/reference/SpriteGetCurrentCostumeIndex.java +++ b/examples/src/main/java/reference/SpriteGetCurrentCostumeIndex.java @@ -12,10 +12,10 @@ public SpriteGetCurrentCostumeIndex() { myStage.add(mySprite); mySprite.think("Index: " + mySprite.getCurrentCostumeIndex()); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.nextCostume(); mySprite.think("Index: " + mySprite.getCurrentCostumeIndex()); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGetCurrentCostumeName.java b/examples/src/main/java/reference/SpriteGetCurrentCostumeName.java similarity index 91% rename from src/examples/java/reference/SpriteGetCurrentCostumeName.java rename to examples/src/main/java/reference/SpriteGetCurrentCostumeName.java index b95a812e..724d05b5 100644 --- a/src/examples/java/reference/SpriteGetCurrentCostumeName.java +++ b/examples/src/main/java/reference/SpriteGetCurrentCostumeName.java @@ -11,10 +11,10 @@ public SpriteGetCurrentCostumeName() { myStage.add(mySprite); mySprite.think("Name: " + mySprite.getCurrentCostumeName()); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.nextCostume(); mySprite.think("Name: " + mySprite.getCurrentCostumeName()); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGetDirection.java b/examples/src/main/java/reference/SpriteGetDirection.java similarity index 95% rename from src/examples/java/reference/SpriteGetDirection.java rename to examples/src/main/java/reference/SpriteGetDirection.java index 2e7601f3..bdfe870c 100644 --- a/src/examples/java/reference/SpriteGetDirection.java +++ b/examples/src/main/java/reference/SpriteGetDirection.java @@ -12,7 +12,7 @@ public SpriteGetDirection() { mySprite.changeY(30); mySprite.setDirection(45); mySprite.say("Direction: " + mySprite.getDirection()); - myStage.wait(3000); + myStage.waitSeconds(3); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGetHeight.java b/examples/src/main/java/reference/SpriteGetHeight.java similarity index 94% rename from src/examples/java/reference/SpriteGetHeight.java rename to examples/src/main/java/reference/SpriteGetHeight.java index 1558f23d..ba578cda 100644 --- a/src/examples/java/reference/SpriteGetHeight.java +++ b/examples/src/main/java/reference/SpriteGetHeight.java @@ -10,7 +10,7 @@ public SpriteGetHeight() { mySprite.changeY(30); myStage.add(mySprite); mySprite.say("Height: " + mySprite.getHeight()); - myStage.wait(1000); + myStage.waitSeconds(1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGetHitbox.java b/examples/src/main/java/reference/SpriteGetHitbox.java similarity index 85% rename from src/examples/java/reference/SpriteGetHitbox.java rename to examples/src/main/java/reference/SpriteGetHitbox.java index e4178176..f079d89b 100644 --- a/src/examples/java/reference/SpriteGetHitbox.java +++ b/examples/src/main/java/reference/SpriteGetHitbox.java @@ -7,11 +7,11 @@ public SpriteGetHitbox() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); - Hitbox myHitbox = mySprite.getHitbox(); + Shape myHitbox = mySprite.getHitbox(); System.out.println("The hitbox is " + myHitbox.getBounds().width() + " pixels wide."); } diff --git a/src/examples/java/reference/SpriteGetMouse.java b/examples/src/main/java/reference/SpriteGetMouse.java similarity index 100% rename from src/examples/java/reference/SpriteGetMouse.java rename to examples/src/main/java/reference/SpriteGetMouse.java diff --git a/src/examples/java/reference/SpriteGetMouseX.java b/examples/src/main/java/reference/SpriteGetMouseX.java similarity index 93% rename from src/examples/java/reference/SpriteGetMouseX.java rename to examples/src/main/java/reference/SpriteGetMouseX.java index 1973c27a..123cc32d 100644 --- a/src/examples/java/reference/SpriteGetMouseX.java +++ b/examples/src/main/java/reference/SpriteGetMouseX.java @@ -12,7 +12,7 @@ public SpriteGetMouseX() { while (true) { mySprite.say("mouse x: " + mySprite.getMouseX()); - myStage.wait(100); + myStage.waitSeconds(0.1); } } diff --git a/src/examples/java/reference/SpriteGetMouseY.java b/examples/src/main/java/reference/SpriteGetMouseY.java similarity index 93% rename from src/examples/java/reference/SpriteGetMouseY.java rename to examples/src/main/java/reference/SpriteGetMouseY.java index 80e5dd51..900d8f27 100644 --- a/src/examples/java/reference/SpriteGetMouseY.java +++ b/examples/src/main/java/reference/SpriteGetMouseY.java @@ -12,7 +12,7 @@ public SpriteGetMouseY() { while (true) { mySprite.say("mouse y: " + mySprite.getMouseY()); - myStage.wait(100); + myStage.waitSeconds(0.1); } } diff --git a/src/examples/java/reference/SpriteGetPen.java b/examples/src/main/java/reference/SpriteGetPen.java similarity index 95% rename from src/examples/java/reference/SpriteGetPen.java rename to examples/src/main/java/reference/SpriteGetPen.java index 6d4bc6c3..eb7f0fd2 100644 --- a/src/examples/java/reference/SpriteGetPen.java +++ b/examples/src/main/java/reference/SpriteGetPen.java @@ -13,7 +13,7 @@ public SpriteGetPen() { mySprite.getPen().down(); while (mySprite.getX() < 250) { mySprite.changeX(5); - myStage.wait(50); + myStage.waitSeconds(0.05); } // Lifting it lets the sprite move on without drawing. mySprite.getPen().up(); diff --git a/src/examples/java/reference/SpriteGetPosition.java b/examples/src/main/java/reference/SpriteGetPosition.java similarity index 100% rename from src/examples/java/reference/SpriteGetPosition.java rename to examples/src/main/java/reference/SpriteGetPosition.java diff --git a/src/examples/java/reference/SpriteGetShaders.java b/examples/src/main/java/reference/SpriteGetShaders.java similarity index 89% rename from src/examples/java/reference/SpriteGetShaders.java rename to examples/src/main/java/reference/SpriteGetShaders.java index 06b09fd0..8ccf64f9 100644 --- a/src/examples/java/reference/SpriteGetShaders.java +++ b/examples/src/main/java/reference/SpriteGetShaders.java @@ -15,7 +15,7 @@ public SpriteGetShaders() { // the same costume, drawn through a shader that takes the colour out Sprite grey = new Sprite("slime", "slimeGreen"); grey.setPosition(100, 0); - grey.getShaders().add("grayscale", "assets/grayscale.frag", null); + grey.getShaders().add("grayscale", "assets/grayscale.frag"); myStage.add(grey); } diff --git a/src/examples/java/reference/SpriteGetSize.java b/examples/src/main/java/reference/SpriteGetSize.java similarity index 100% rename from src/examples/java/reference/SpriteGetSize.java rename to examples/src/main/java/reference/SpriteGetSize.java diff --git a/src/examples/java/reference/SpriteGetStage.java b/examples/src/main/java/reference/SpriteGetStage.java similarity index 100% rename from src/examples/java/reference/SpriteGetStage.java rename to examples/src/main/java/reference/SpriteGetStage.java diff --git a/src/examples/java/reference/SpriteGetText.java b/examples/src/main/java/reference/SpriteGetText.java similarity index 100% rename from src/examples/java/reference/SpriteGetText.java rename to examples/src/main/java/reference/SpriteGetText.java diff --git a/src/examples/java/reference/SpriteGetTimer.java b/examples/src/main/java/reference/SpriteGetTimer.java similarity index 71% rename from src/examples/java/reference/SpriteGetTimer.java rename to examples/src/main/java/reference/SpriteGetTimer.java index 5b7545fa..b634f82b 100644 --- a/src/examples/java/reference/SpriteGetTimer.java +++ b/examples/src/main/java/reference/SpriteGetTimer.java @@ -10,16 +10,17 @@ public SpriteGetTimer() { Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); - // The sprite's own timer, and as many more as you care to name. + // The sprite's own timer, and as many more as you need. + Timer stepsTimer = new Timer(); while (true) { - if (mySprite.getTimer().everyMillis(1000)) { + if (mySprite.getTimer().every(1)) { mySprite.nextCostume(); } - if (mySprite.getTimer("steps").everyMillis(100)) { + if (stepsTimer.every(0.1)) { mySprite.changeX(5); mySprite.ifOnEdgeBounce(); } - myStage.wait(10); + myStage.waitSeconds(0.01); } } diff --git a/src/examples/java/reference/SpriteGetTint.java b/examples/src/main/java/reference/SpriteGetTint.java similarity index 62% rename from src/examples/java/reference/SpriteGetTint.java rename to examples/src/main/java/reference/SpriteGetTint.java index edb14321..e35dbb61 100644 --- a/src/examples/java/reference/SpriteGetTint.java +++ b/examples/src/main/java/reference/SpriteGetTint.java @@ -10,15 +10,14 @@ public SpriteGetTint() { Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); - mySprite.setTint(200); + mySprite.setTint(Color.fromHSB(78, 100, 100)); Color tint = mySprite.getTint(); - System.out.println("hue " + tint.getH() + ", red " + tint.getRed()); - // The colour that comes back is the sprite's own, so changing it tints the - // sprite as well. + System.out.println("hue " + tint.getHue() + ", red " + tint.getRed()); + // Colours are immutable, so the sprite is given a new tint each round. while (true) { - tint.changeColor(2); + tint = tint.withHue(tint.getHue() + 2); mySprite.setTint(tint); - myStage.wait(50); + myStage.waitSeconds(0.05); } } diff --git a/src/examples/java/reference/SpriteGetTouchingSprite.java b/examples/src/main/java/reference/SpriteGetTouchingSprite.java similarity index 96% rename from src/examples/java/reference/SpriteGetTouchingSprite.java rename to examples/src/main/java/reference/SpriteGetTouchingSprite.java index bc0e7e34..211fadfa 100644 --- a/src/examples/java/reference/SpriteGetTouchingSprite.java +++ b/examples/src/main/java/reference/SpriteGetTouchingSprite.java @@ -28,7 +28,7 @@ public Coin() { if (touched != null) { touched.remove(); } - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/SpriteGetTouchingSprites.java b/examples/src/main/java/reference/SpriteGetTouchingSprites.java similarity index 96% rename from src/examples/java/reference/SpriteGetTouchingSprites.java rename to examples/src/main/java/reference/SpriteGetTouchingSprites.java index 011a3a9a..69388e76 100644 --- a/src/examples/java/reference/SpriteGetTouchingSprites.java +++ b/examples/src/main/java/reference/SpriteGetTouchingSprites.java @@ -27,7 +27,7 @@ public Coin() { while (true) { player.goToMousePointer(); player.say("touching " + player.getTouchingSprites(Coin.class).size() + " coins"); - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/SpriteGetTransparency.java b/examples/src/main/java/reference/SpriteGetTransparency.java similarity index 96% rename from src/examples/java/reference/SpriteGetTransparency.java rename to examples/src/main/java/reference/SpriteGetTransparency.java index a0a1bda3..70e7fffe 100644 --- a/src/examples/java/reference/SpriteGetTransparency.java +++ b/examples/src/main/java/reference/SpriteGetTransparency.java @@ -14,7 +14,7 @@ public SpriteGetTransparency() { System.out.println("A new sprite is at " + mySprite.getTransparency() + "."); mySprite.setTransparency(90); System.out.println("Now it is at " + mySprite.getTransparency() + " - nearly gone."); - myStage.wait(3000); + myStage.waitSeconds(3); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGetVolume.java b/examples/src/main/java/reference/SpriteGetVolume.java similarity index 100% rename from src/examples/java/reference/SpriteGetVolume.java rename to examples/src/main/java/reference/SpriteGetVolume.java diff --git a/src/examples/java/reference/SpriteGetWidth.java b/examples/src/main/java/reference/SpriteGetWidth.java similarity index 94% rename from src/examples/java/reference/SpriteGetWidth.java rename to examples/src/main/java/reference/SpriteGetWidth.java index ab9af8db..796af71a 100644 --- a/src/examples/java/reference/SpriteGetWidth.java +++ b/examples/src/main/java/reference/SpriteGetWidth.java @@ -11,7 +11,7 @@ public SpriteGetWidth() { mySprite.changeX(-80); mySprite.changeY(30); mySprite.say("Width: " + mySprite.getWidth()); - myStage.wait(3000); + myStage.waitSeconds(3); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGetX.java b/examples/src/main/java/reference/SpriteGetX.java similarity index 94% rename from src/examples/java/reference/SpriteGetX.java rename to examples/src/main/java/reference/SpriteGetX.java index 6fd86b29..8a1356ff 100644 --- a/src/examples/java/reference/SpriteGetX.java +++ b/examples/src/main/java/reference/SpriteGetX.java @@ -11,7 +11,7 @@ public SpriteGetX() { mySprite.changeX(-80); mySprite.changeY(30); mySprite.say("X: " + mySprite.getX()); - myStage.wait(3000); + myStage.waitSeconds(3); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGetY.java b/examples/src/main/java/reference/SpriteGetY.java similarity index 94% rename from src/examples/java/reference/SpriteGetY.java rename to examples/src/main/java/reference/SpriteGetY.java index adab15ea..c6a4ed65 100644 --- a/src/examples/java/reference/SpriteGetY.java +++ b/examples/src/main/java/reference/SpriteGetY.java @@ -11,7 +11,7 @@ public SpriteGetY() { mySprite.changeX(-80); mySprite.changeY(30); mySprite.say("Y: " + mySprite.getY()); - myStage.wait(3000); + myStage.waitSeconds(3); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGlide.java b/examples/src/main/java/reference/SpriteGlide.java similarity index 90% rename from src/examples/java/reference/SpriteGlide.java rename to examples/src/main/java/reference/SpriteGlide.java index 6e7785d8..b9d130dc 100644 --- a/src/examples/java/reference/SpriteGlide.java +++ b/examples/src/main/java/reference/SpriteGlide.java @@ -13,9 +13,9 @@ public SpriteGlide() { // Sliding to a place over a set time, instead of jumping there. while (true) { mySprite.glide(2, 200, 60); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.glide(2, -200, -60); - myStage.wait(2000); + myStage.waitSeconds(2); } } diff --git a/src/examples/java/reference/SpriteGoLayersBackwards.java b/examples/src/main/java/reference/SpriteGoLayersBackwards.java similarity index 92% rename from src/examples/java/reference/SpriteGoLayersBackwards.java rename to examples/src/main/java/reference/SpriteGoLayersBackwards.java index eae39224..658d67f6 100644 --- a/src/examples/java/reference/SpriteGoLayersBackwards.java +++ b/examples/src/main/java/reference/SpriteGoLayersBackwards.java @@ -15,9 +15,9 @@ public SpriteGoLayersBackwards() { Sprite gamma = new Sprite("gamma", "slimePurple"); gamma.changeX(10); myStage.add(gamma); - myStage.wait(1000); + myStage.waitSeconds(1); gamma.goLayersBackwards(2); - myStage.wait(1000); + myStage.waitSeconds(1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGoLayersForwards.java b/examples/src/main/java/reference/SpriteGoLayersForwards.java similarity index 89% rename from src/examples/java/reference/SpriteGoLayersForwards.java rename to examples/src/main/java/reference/SpriteGoLayersForwards.java index 2e8deb81..b3fe9869 100644 --- a/src/examples/java/reference/SpriteGoLayersForwards.java +++ b/examples/src/main/java/reference/SpriteGoLayersForwards.java @@ -15,11 +15,11 @@ public SpriteGoLayersForwards() { myStage.add(new Sprite("zeta", "slimeGreen")); myStage.add(new Sprite("zeta", "slimeGreen")); myStage.add(new Sprite("zeta", "slimeGreen")); - myStage.wait(1000); + myStage.waitSeconds(1); gamma.goLayersForwards(2); - myStage.wait(1000); + myStage.waitSeconds(1); gamma.goLayersForwards(3); - myStage.wait(1000); + myStage.waitSeconds(1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGoToBackLayer.java b/examples/src/main/java/reference/SpriteGoToBackLayer.java similarity index 92% rename from src/examples/java/reference/SpriteGoToBackLayer.java rename to examples/src/main/java/reference/SpriteGoToBackLayer.java index de60cd2d..de83fa1d 100644 --- a/src/examples/java/reference/SpriteGoToBackLayer.java +++ b/examples/src/main/java/reference/SpriteGoToBackLayer.java @@ -14,9 +14,9 @@ public SpriteGoToBackLayer() { myStage.add(new Sprite("zeta", "slimeGreen")); myStage.add(new Sprite("zeta", "slimeGreen")); myStage.add(gamma); - myStage.wait(1000); + myStage.waitSeconds(1); gamma.goToBackLayer(); - myStage.wait(1000); + myStage.waitSeconds(1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGoToFrontLayer.java b/examples/src/main/java/reference/SpriteGoToFrontLayer.java similarity index 92% rename from src/examples/java/reference/SpriteGoToFrontLayer.java rename to examples/src/main/java/reference/SpriteGoToFrontLayer.java index 90597aba..a4a81387 100644 --- a/src/examples/java/reference/SpriteGoToFrontLayer.java +++ b/examples/src/main/java/reference/SpriteGoToFrontLayer.java @@ -14,9 +14,9 @@ public SpriteGoToFrontLayer() { myStage.add(new Sprite("zeta", "slimeGreen")); myStage.add(new Sprite("zeta", "slimeGreen")); myStage.add(new Sprite("zeta", "slimeGreen")); - myStage.wait(1000); + myStage.waitSeconds(1); gamma.goToFrontLayer(); - myStage.wait(1000); + myStage.waitSeconds(1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteGoToMousePointer.java b/examples/src/main/java/reference/SpriteGoToMousePointer.java similarity index 94% rename from src/examples/java/reference/SpriteGoToMousePointer.java rename to examples/src/main/java/reference/SpriteGoToMousePointer.java index 9d2483da..0def7f94 100644 --- a/src/examples/java/reference/SpriteGoToMousePointer.java +++ b/examples/src/main/java/reference/SpriteGoToMousePointer.java @@ -13,7 +13,7 @@ public SpriteGoToMousePointer() { // Click into the stage first, so that it takes the keyboard and the mouse. while (true) { mySprite.goToMousePointer(); - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/SpriteGoToRandomPosition.java b/examples/src/main/java/reference/SpriteGoToRandomPosition.java similarity index 93% rename from src/examples/java/reference/SpriteGoToRandomPosition.java rename to examples/src/main/java/reference/SpriteGoToRandomPosition.java index d432ca7d..2a5e8f6a 100644 --- a/src/examples/java/reference/SpriteGoToRandomPosition.java +++ b/examples/src/main/java/reference/SpriteGoToRandomPosition.java @@ -12,7 +12,7 @@ public SpriteGoToRandomPosition() { while (true) { mySprite.goToRandomPosition(); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/SpriteGoToSprite.java b/examples/src/main/java/reference/SpriteGoToSprite.java similarity index 95% rename from src/examples/java/reference/SpriteGoToSprite.java rename to examples/src/main/java/reference/SpriteGoToSprite.java index c87c3a59..655a209c 100644 --- a/src/examples/java/reference/SpriteGoToSprite.java +++ b/examples/src/main/java/reference/SpriteGoToSprite.java @@ -14,7 +14,7 @@ public SpriteGoToSprite() { Sprite blue = new Sprite("blue", "slimeBlue"); myStage.add(blue); - myStage.wait(1500); + myStage.waitSeconds(1.5); // Straight to where the other sprite stands. blue.goToSprite(green); } diff --git a/src/examples/java/reference/SpriteHide.java b/examples/src/main/java/reference/SpriteHide.java similarity index 87% rename from src/examples/java/reference/SpriteHide.java rename to examples/src/main/java/reference/SpriteHide.java index ee2ff33a..a3282204 100644 --- a/src/examples/java/reference/SpriteHide.java +++ b/examples/src/main/java/reference/SpriteHide.java @@ -8,9 +8,9 @@ public SpriteHide() { myWindow.setStage(myStage); Sprite mySprite = new Sprite("zeta", "slimeGreen"); myStage.add(mySprite); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.hide(); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteHideVariable.java b/examples/src/main/java/reference/SpriteHideVariable.java similarity index 100% rename from src/examples/java/reference/SpriteHideVariable.java rename to examples/src/main/java/reference/SpriteHideVariable.java diff --git a/src/examples/java/reference/SpriteIfOnEdgeBounce.java b/examples/src/main/java/reference/SpriteIfOnEdgeBounce.java similarity index 94% rename from src/examples/java/reference/SpriteIfOnEdgeBounce.java rename to examples/src/main/java/reference/SpriteIfOnEdgeBounce.java index f4e0932c..a9d52b5d 100644 --- a/src/examples/java/reference/SpriteIfOnEdgeBounce.java +++ b/examples/src/main/java/reference/SpriteIfOnEdgeBounce.java @@ -12,7 +12,7 @@ public SpriteIfOnEdgeBounce() { while (true) { mySprite.move(5); mySprite.ifOnEdgeBounce(); - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/SpriteIsAsking.java b/examples/src/main/java/reference/SpriteIsAsking.java similarity index 94% rename from src/examples/java/reference/SpriteIsAsking.java rename to examples/src/main/java/reference/SpriteIsAsking.java index 937978e0..69eafb39 100644 --- a/src/examples/java/reference/SpriteIsAsking.java +++ b/examples/src/main/java/reference/SpriteIsAsking.java @@ -13,7 +13,7 @@ public SpriteIsAsking() { mySprite.ask("Are you still there?"); // True for as long as the box is on the stage waiting to be filled in. while (mySprite.isAsking()) { - myStage.wait(50); + myStage.waitSeconds(0.05); } mySprite.say("Thank you"); } diff --git a/src/examples/java/reference/SpriteIsClone.java b/examples/src/main/java/reference/SpriteIsClone.java similarity index 96% rename from src/examples/java/reference/SpriteIsClone.java rename to examples/src/main/java/reference/SpriteIsClone.java index e533a16f..de8b09d1 100644 --- a/src/examples/java/reference/SpriteIsClone.java +++ b/examples/src/main/java/reference/SpriteIsClone.java @@ -23,7 +23,7 @@ public void run() { myWindow.setStage(myStage); Slime slime = new Slime(); myStage.add(slime); - slime.clone(); + slime.createClone(); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteIsColorTouchingColor.java b/examples/src/main/java/reference/SpriteIsColorTouchingColor.java similarity index 100% rename from src/examples/java/reference/SpriteIsColorTouchingColor.java rename to examples/src/main/java/reference/SpriteIsColorTouchingColor.java diff --git a/src/examples/java/reference/SpriteIsGliding.java b/examples/src/main/java/reference/SpriteIsGliding.java similarity index 94% rename from src/examples/java/reference/SpriteIsGliding.java rename to examples/src/main/java/reference/SpriteIsGliding.java index e841484f..6ae004a0 100644 --- a/src/examples/java/reference/SpriteIsGliding.java +++ b/examples/src/main/java/reference/SpriteIsGliding.java @@ -13,7 +13,7 @@ public SpriteIsGliding() { mySprite.glide(3, 200, 0); while (mySprite.isGliding()) { mySprite.say("on my way ..."); - myStage.wait(100); + myStage.waitSeconds(0.1); } mySprite.say("arrived"); } diff --git a/src/examples/java/reference/SpriteIsKeyPressed.java b/examples/src/main/java/reference/SpriteIsKeyPressed.java similarity index 100% rename from src/examples/java/reference/SpriteIsKeyPressed.java rename to examples/src/main/java/reference/SpriteIsKeyPressed.java diff --git a/src/examples/java/reference/SpriteIsMouseDown.java b/examples/src/main/java/reference/SpriteIsMouseDown.java similarity index 100% rename from src/examples/java/reference/SpriteIsMouseDown.java rename to examples/src/main/java/reference/SpriteIsMouseDown.java diff --git a/src/examples/java/reference/SpriteIsSoundPlaying.java b/examples/src/main/java/reference/SpriteIsSoundPlaying.java similarity index 94% rename from src/examples/java/reference/SpriteIsSoundPlaying.java rename to examples/src/main/java/reference/SpriteIsSoundPlaying.java index 1a457716..c79e7272 100644 --- a/src/examples/java/reference/SpriteIsSoundPlaying.java +++ b/examples/src/main/java/reference/SpriteIsSoundPlaying.java @@ -14,7 +14,7 @@ public SpriteIsSoundPlaying() { mySprite.playSound("music"); while (true) { mySprite.say("playing: " + mySprite.isSoundPlaying("music")); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/SpriteIsTouchingColor.java b/examples/src/main/java/reference/SpriteIsTouchingColor.java similarity index 100% rename from src/examples/java/reference/SpriteIsTouchingColor.java rename to examples/src/main/java/reference/SpriteIsTouchingColor.java diff --git a/src/examples/java/reference/SpriteIsTouchingEdge.java b/examples/src/main/java/reference/SpriteIsTouchingEdge.java similarity index 94% rename from src/examples/java/reference/SpriteIsTouchingEdge.java rename to examples/src/main/java/reference/SpriteIsTouchingEdge.java index d28a6cc3..df82b0d9 100644 --- a/src/examples/java/reference/SpriteIsTouchingEdge.java +++ b/examples/src/main/java/reference/SpriteIsTouchingEdge.java @@ -13,7 +13,7 @@ public SpriteIsTouchingEdge() { while (true) { mySprite.say("Is touching edge? " + mySprite.isTouchingEdge()); mySprite.changeY(10); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/SpriteIsTouchingMousePointer.java b/examples/src/main/java/reference/SpriteIsTouchingMousePointer.java similarity index 100% rename from src/examples/java/reference/SpriteIsTouchingMousePointer.java rename to examples/src/main/java/reference/SpriteIsTouchingMousePointer.java diff --git a/src/examples/java/reference/SpriteIsTouchingSprite.java b/examples/src/main/java/reference/SpriteIsTouchingSprite.java similarity index 95% rename from src/examples/java/reference/SpriteIsTouchingSprite.java rename to examples/src/main/java/reference/SpriteIsTouchingSprite.java index 5d65e9c2..371fe64e 100644 --- a/src/examples/java/reference/SpriteIsTouchingSprite.java +++ b/examples/src/main/java/reference/SpriteIsTouchingSprite.java @@ -18,7 +18,7 @@ public SpriteIsTouchingSprite() { while (!gamma.isTouchingSprite(zeta)) { gamma.changeX(5); zeta.changeX(-5); - myStage.wait(100); + myStage.waitSeconds(0.1); } } diff --git a/src/examples/java/reference/SpriteIsVisible.java b/examples/src/main/java/reference/SpriteIsVisible.java similarity index 90% rename from src/examples/java/reference/SpriteIsVisible.java rename to examples/src/main/java/reference/SpriteIsVisible.java index 17247517..5fa495da 100644 --- a/src/examples/java/reference/SpriteIsVisible.java +++ b/examples/src/main/java/reference/SpriteIsVisible.java @@ -9,10 +9,10 @@ public SpriteIsVisible() { Sprite gamma = new Sprite("gamma", "slimePurple"); myStage.add(gamma); myStage.display("Gamma Visible? " + gamma.isVisible()); - myStage.wait(2000); + myStage.waitSeconds(2); gamma.hide(); myStage.display("Gamma Visible? " + gamma.isVisible()); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteMove.java b/examples/src/main/java/reference/SpriteMove.java similarity index 93% rename from src/examples/java/reference/SpriteMove.java rename to examples/src/main/java/reference/SpriteMove.java index a9b5727a..b49d894d 100644 --- a/src/examples/java/reference/SpriteMove.java +++ b/examples/src/main/java/reference/SpriteMove.java @@ -11,7 +11,7 @@ public SpriteMove() { gamma.turnLeft(20); while (true) { gamma.move(5); - myStage.wait(100); + myStage.waitSeconds(0.1); } } diff --git a/src/examples/java/reference/SpriteNextCostume.java b/examples/src/main/java/reference/SpriteNextCostume.java similarity index 85% rename from src/examples/java/reference/SpriteNextCostume.java rename to examples/src/main/java/reference/SpriteNextCostume.java index 6effec07..3553e26b 100644 --- a/src/examples/java/reference/SpriteNextCostume.java +++ b/examples/src/main/java/reference/SpriteNextCostume.java @@ -9,11 +9,11 @@ public SpriteNextCostume() { Sprite zeta = new Sprite("green", "slimeGreen"); zeta.addCostume("yellow", "slimeBlue"); myStage.add(zeta); - myStage.wait(2000); + myStage.waitSeconds(2); zeta.nextCostume(); - myStage.wait(2000); + myStage.waitSeconds(2); zeta.nextCostume(); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpritePickRandom.java b/examples/src/main/java/reference/SpritePickRandom.java similarity index 93% rename from src/examples/java/reference/SpritePickRandom.java rename to examples/src/main/java/reference/SpritePickRandom.java index e225333c..92a591b8 100644 --- a/src/examples/java/reference/SpritePickRandom.java +++ b/examples/src/main/java/reference/SpritePickRandom.java @@ -11,7 +11,7 @@ public SpritePickRandom() { while (true) { int random = zeta.pickRandom(0, 100); zeta.think("Random: " + random); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/SpritePlaySound.java b/examples/src/main/java/reference/SpritePlaySound.java similarity index 89% rename from src/examples/java/reference/SpritePlaySound.java rename to examples/src/main/java/reference/SpritePlaySound.java index fde0b2cd..739f94a0 100644 --- a/src/examples/java/reference/SpritePlaySound.java +++ b/examples/src/main/java/reference/SpritePlaySound.java @@ -14,9 +14,9 @@ public SpritePlaySound() { while (true) { mySprite.changeY(40); mySprite.playSound("bump"); - myStage.wait(500); + myStage.waitSeconds(0.5); mySprite.changeY(-40); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/SpritePointTowardsMousePointer.java b/examples/src/main/java/reference/SpritePointTowardsMousePointer.java similarity index 100% rename from src/examples/java/reference/SpritePointTowardsMousePointer.java rename to examples/src/main/java/reference/SpritePointTowardsMousePointer.java diff --git a/src/examples/java/reference/SpritePointTowardsSprite.java b/examples/src/main/java/reference/SpritePointTowardsSprite.java similarity index 90% rename from src/examples/java/reference/SpritePointTowardsSprite.java rename to examples/src/main/java/reference/SpritePointTowardsSprite.java index 810122d2..c375afac 100644 --- a/src/examples/java/reference/SpritePointTowardsSprite.java +++ b/examples/src/main/java/reference/SpritePointTowardsSprite.java @@ -16,8 +16,8 @@ public SpritePointTowardsSprite() { // The green one keeps facing the blue one, wherever it wanders off to. while (true) { blue.goToRandomPosition(); - green.pointTowardsSprite(blue); - myStage.wait(1000); + green.pointTowards(blue); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/SpritePreviousCostume.java b/examples/src/main/java/reference/SpritePreviousCostume.java similarity index 95% rename from src/examples/java/reference/SpritePreviousCostume.java rename to examples/src/main/java/reference/SpritePreviousCostume.java index 4d099508..f26eb8c0 100644 --- a/src/examples/java/reference/SpritePreviousCostume.java +++ b/examples/src/main/java/reference/SpritePreviousCostume.java @@ -15,7 +15,7 @@ public SpritePreviousCostume() { // Backwards through the costumes, wrapping round to the last one. while (true) { mySprite.previousCostume(); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/SpriteRemove.java b/examples/src/main/java/reference/SpriteRemove.java similarity index 94% rename from src/examples/java/reference/SpriteRemove.java rename to examples/src/main/java/reference/SpriteRemove.java index f2b91e2b..6f1a3401 100644 --- a/src/examples/java/reference/SpriteRemove.java +++ b/examples/src/main/java/reference/SpriteRemove.java @@ -10,7 +10,7 @@ public SpriteRemove() { Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); - myStage.wait(2000); + myStage.waitSeconds(2); // Takes the sprite off the stage. Its run() is not called again. mySprite.remove(); } diff --git a/src/examples/java/reference/SpriteRun.java b/examples/src/main/java/reference/SpriteRun.java similarity index 100% rename from src/examples/java/reference/SpriteRun.java rename to examples/src/main/java/reference/SpriteRun.java diff --git a/src/examples/java/reference/SpriteSay.java b/examples/src/main/java/reference/SpriteSay.java similarity index 93% rename from src/examples/java/reference/SpriteSay.java rename to examples/src/main/java/reference/SpriteSay.java index a5781c4f..1d928c37 100644 --- a/src/examples/java/reference/SpriteSay.java +++ b/examples/src/main/java/reference/SpriteSay.java @@ -9,7 +9,7 @@ public SpriteSay() { Sprite zeta = new Sprite("green", "slimeGreen"); myStage.add(zeta); zeta.say("Hi! I'm Zeta and can say line breaks"); - myStage.wait(3000); + myStage.waitSeconds(3); } public static void main(String[] args) { diff --git a/examples/src/main/java/reference/SpriteSetColorEffect.java b/examples/src/main/java/reference/SpriteSetColorEffect.java new file mode 100644 index 00000000..2390a7f1 --- /dev/null +++ b/examples/src/main/java/reference/SpriteSetColorEffect.java @@ -0,0 +1,25 @@ +package reference; +import org.openpatch.scratch.*; + +public class SpriteSetColorEffect { + public SpriteSetColorEffect() { + Window myWindow = new Window(600, 240); + Stage myStage = new Stage(); + myWindow.setStage(myStage); + Sprite mySprite = new Sprite("slime", "slimeBlue"); + myStage.add(mySprite); + // 0 is the costume as drawn, 100 is halfway round the colour wheel, 200 is back again + while (true) { + mySprite.setColorEffect(0); + myStage.waitSeconds(1); + mySprite.setColorEffect(50); + myStage.waitSeconds(1); + mySprite.setColorEffect(100); + myStage.waitSeconds(1); + } + } + + public static void main(String[] args) { + new SpriteSetColorEffect(); + } +} diff --git a/src/examples/java/reference/SpriteSetDirection.java b/examples/src/main/java/reference/SpriteSetDirection.java similarity index 91% rename from src/examples/java/reference/SpriteSetDirection.java rename to examples/src/main/java/reference/SpriteSetDirection.java index c39e1d7d..170f801a 100644 --- a/src/examples/java/reference/SpriteSetDirection.java +++ b/examples/src/main/java/reference/SpriteSetDirection.java @@ -11,10 +11,10 @@ public SpriteSetDirection() { mySprite.changeX(-80); mySprite.changeY(30); mySprite.say("Direction: " + mySprite.getDirection()); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.setDirection(45); mySprite.say("Direction: " + mySprite.getDirection()); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteSetHitbox.java b/examples/src/main/java/reference/SpriteSetHitbox.java similarity index 63% rename from src/examples/java/reference/SpriteSetHitbox.java rename to examples/src/main/java/reference/SpriteSetHitbox.java index c8649eb4..f01636ad 100644 --- a/src/examples/java/reference/SpriteSetHitbox.java +++ b/examples/src/main/java/reference/SpriteSetHitbox.java @@ -7,13 +7,13 @@ public SpriteSetHitbox() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("zeta", "slimeGreen"); myStage.add(mySprite); - myStage.wait(2000); - // x and y of each corner, in turn - mySprite.setHitbox(0, 0, 10, 0, 10, 10, 0, 10); - myStage.wait(2000); + myStage.waitSeconds(2); + // a rectangle in costume pixels, with its origin at the top left + mySprite.setHitbox(new Rectangle(0, 0, 10, 10)); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteSetPosition.java b/examples/src/main/java/reference/SpriteSetPosition.java similarity index 95% rename from src/examples/java/reference/SpriteSetPosition.java rename to examples/src/main/java/reference/SpriteSetPosition.java index 5c1967c4..c6a3412e 100644 --- a/src/examples/java/reference/SpriteSetPosition.java +++ b/examples/src/main/java/reference/SpriteSetPosition.java @@ -15,7 +15,7 @@ public SpriteSetPosition() { int y = myStage.pickRandom(-myStage.getHeight() / 2, myStage.getHeight() / 2); mySprite.setPosition(x, y); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/SpriteSetRotationCenter.java b/examples/src/main/java/reference/SpriteSetRotationCenter.java similarity index 96% rename from src/examples/java/reference/SpriteSetRotationCenter.java rename to examples/src/main/java/reference/SpriteSetRotationCenter.java index e8edea0b..e72fce00 100644 --- a/src/examples/java/reference/SpriteSetRotationCenter.java +++ b/examples/src/main/java/reference/SpriteSetRotationCenter.java @@ -23,7 +23,7 @@ public SpriteSetRotationCenter() { while (true) { middle.turnRight(2); hand.turnRight(2); - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/SpriteSetRotationStyle.java b/examples/src/main/java/reference/SpriteSetRotationStyle.java similarity index 90% rename from src/examples/java/reference/SpriteSetRotationStyle.java rename to examples/src/main/java/reference/SpriteSetRotationStyle.java index 057d2a07..c0383566 100644 --- a/src/examples/java/reference/SpriteSetRotationStyle.java +++ b/examples/src/main/java/reference/SpriteSetRotationStyle.java @@ -14,18 +14,18 @@ public SpriteSetRotationStyle() { mySprite.changeX(-80); mySprite.changeY(30); mySprite.say("Rotation: " + mySprite.getDirection()); - myStage.wait(1000); + myStage.waitSeconds(1); mySprite.setDirection(45); mySprite.say("All-Around: " + mySprite.getDirection()); - myStage.wait(1000); + myStage.waitSeconds(1); mySprite.setRotationStyle(RotationStyle.DONT); mySprite.setDirection(180); mySprite.say("Don't: " + mySprite.getDirection()); - myStage.wait(1000); + myStage.waitSeconds(1); mySprite.setRotationStyle(RotationStyle.LEFT_RIGHT); mySprite.setDirection(200); mySprite.say("LEFT-RIGHT: " + mySprite.getDirection()); - myStage.wait(1000); + myStage.waitSeconds(1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteSetSize.java b/examples/src/main/java/reference/SpriteSetSize.java similarity index 91% rename from src/examples/java/reference/SpriteSetSize.java rename to examples/src/main/java/reference/SpriteSetSize.java index 22a38cd2..cf150aec 100644 --- a/src/examples/java/reference/SpriteSetSize.java +++ b/examples/src/main/java/reference/SpriteSetSize.java @@ -13,10 +13,10 @@ public SpriteSetSize() { mySprite.changeX(-80); mySprite.changeY(30); mySprite.say("Size: " + mySprite.getSize()); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.setSize(50); mySprite.say("Size: " + mySprite.getSize()); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteSetTint.java b/examples/src/main/java/reference/SpriteSetTint.java similarity index 61% rename from src/examples/java/reference/SpriteSetTint.java rename to examples/src/main/java/reference/SpriteSetTint.java index 5c4594ee..381e05ba 100644 --- a/src/examples/java/reference/SpriteSetTint.java +++ b/examples/src/main/java/reference/SpriteSetTint.java @@ -1,7 +1,5 @@ package reference; -import org.openpatch.scratch.Sprite; -import org.openpatch.scratch.Stage; -import org.openpatch.scratch.Window; +import org.openpatch.scratch.*; public class SpriteSetTint { public SpriteSetTint() { @@ -10,9 +8,10 @@ public SpriteSetTint() { myWindow.setStage(myStage); Sprite mySprite = new Sprite("slime", "slimeBlue"); myStage.add(mySprite); - myStage.wait(2000); - mySprite.setTint(200); - myStage.wait(2000); + myStage.waitSeconds(2); + // multiplies every pixel by the colour (white would leave the costume as it is) + mySprite.setTint(new Color(160, 255, 160)); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteSetTransparency.java b/examples/src/main/java/reference/SpriteSetTransparency.java similarity index 88% rename from src/examples/java/reference/SpriteSetTransparency.java rename to examples/src/main/java/reference/SpriteSetTransparency.java index bef6f5f4..fdcc3728 100644 --- a/src/examples/java/reference/SpriteSetTransparency.java +++ b/examples/src/main/java/reference/SpriteSetTransparency.java @@ -10,12 +10,12 @@ public SpriteSetTransparency() { myWindow.setStage(myStage); Sprite mySprite = new Sprite("slime", "slimeBlue"); myStage.add(mySprite); - myStage.wait(2000); + myStage.waitSeconds(2); // The ghost effect: 0 is the solid sprite you start with, 100 is invisible. mySprite.setTransparency(50); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.setTransparency(90); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteSetVolume.java b/examples/src/main/java/reference/SpriteSetVolume.java similarity index 100% rename from src/examples/java/reference/SpriteSetVolume.java rename to examples/src/main/java/reference/SpriteSetVolume.java diff --git a/src/examples/java/reference/SpriteSetX.java b/examples/src/main/java/reference/SpriteSetX.java similarity index 89% rename from src/examples/java/reference/SpriteSetX.java rename to examples/src/main/java/reference/SpriteSetX.java index 1e1f5eae..17013734 100644 --- a/src/examples/java/reference/SpriteSetX.java +++ b/examples/src/main/java/reference/SpriteSetX.java @@ -10,9 +10,9 @@ public SpriteSetX() { myWindow.setStage(myStage); Sprite mySprite = new Sprite("slime", "slimeBlue"); myStage.add(mySprite); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.setX(50); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteSetY.java b/examples/src/main/java/reference/SpriteSetY.java similarity index 89% rename from src/examples/java/reference/SpriteSetY.java rename to examples/src/main/java/reference/SpriteSetY.java index c12cf244..61d7dad9 100644 --- a/src/examples/java/reference/SpriteSetY.java +++ b/examples/src/main/java/reference/SpriteSetY.java @@ -10,9 +10,9 @@ public SpriteSetY() { myWindow.setStage(myStage); Sprite mySprite = new Sprite("slime", "slimeBlue"); myStage.add(mySprite); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.setY(20); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteShow.java b/examples/src/main/java/reference/SpriteShow.java similarity index 85% rename from src/examples/java/reference/SpriteShow.java rename to examples/src/main/java/reference/SpriteShow.java index 4b663ac5..bbeb2bb6 100644 --- a/src/examples/java/reference/SpriteShow.java +++ b/examples/src/main/java/reference/SpriteShow.java @@ -10,11 +10,11 @@ public SpriteShow() { myWindow.setStage(myStage); Sprite mySprite = new Sprite("slime", "slimeBlue"); myStage.add(mySprite); - myStage.wait(3000); + myStage.waitSeconds(3); mySprite.hide(); - myStage.wait(3000); + myStage.waitSeconds(3); mySprite.show(); - myStage.wait(3000); + myStage.waitSeconds(3); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteShowVariable.java b/examples/src/main/java/reference/SpriteShowVariable.java similarity index 100% rename from src/examples/java/reference/SpriteShowVariable.java rename to examples/src/main/java/reference/SpriteShowVariable.java diff --git a/src/examples/java/reference/SpriteStamp.java b/examples/src/main/java/reference/SpriteStamp.java similarity index 87% rename from src/examples/java/reference/SpriteStamp.java rename to examples/src/main/java/reference/SpriteStamp.java index eb9d3ed4..e10a31c5 100644 --- a/src/examples/java/reference/SpriteStamp.java +++ b/examples/src/main/java/reference/SpriteStamp.java @@ -11,13 +11,13 @@ public SpriteStamp() { Sprite mySprite = new Sprite("slime", "slimeBlue"); myStage.add(mySprite); mySprite.setX(-80); - myStage.wait(3000); + myStage.waitSeconds(3); mySprite.stamp(); mySprite.changeX(50); - myStage.wait(3000); + myStage.waitSeconds(3); mySprite.stamp(); mySprite.changeX(50); - myStage.wait(3000); + myStage.waitSeconds(3); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteStopAllSounds.java b/examples/src/main/java/reference/SpriteStopAllSounds.java similarity index 95% rename from src/examples/java/reference/SpriteStopAllSounds.java rename to examples/src/main/java/reference/SpriteStopAllSounds.java index 7fe7d9a1..74aa6d66 100644 --- a/src/examples/java/reference/SpriteStopAllSounds.java +++ b/examples/src/main/java/reference/SpriteStopAllSounds.java @@ -14,7 +14,7 @@ public SpriteStopAllSounds() { mySprite.addSound("bump", "impactWood_heavy_001"); mySprite.playSound("music"); mySprite.playSound("bump"); - myStage.wait(2000); + myStage.waitSeconds(2); // Everything this sprite is playing, at once. mySprite.stopAllSounds(); } diff --git a/src/examples/java/reference/SpriteStopSound.java b/examples/src/main/java/reference/SpriteStopSound.java similarity index 94% rename from src/examples/java/reference/SpriteStopSound.java rename to examples/src/main/java/reference/SpriteStopSound.java index 415a2a84..18d9fffd 100644 --- a/src/examples/java/reference/SpriteStopSound.java +++ b/examples/src/main/java/reference/SpriteStopSound.java @@ -12,7 +12,7 @@ public SpriteStopSound() { mySprite.addSound("music", "jingles_STEEL16"); mySprite.playSound("music"); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.stopSound("music"); } diff --git a/src/examples/java/reference/SpriteSwitchCostume.java b/examples/src/main/java/reference/SpriteSwitchCostume.java similarity index 90% rename from src/examples/java/reference/SpriteSwitchCostume.java rename to examples/src/main/java/reference/SpriteSwitchCostume.java index d05cedf8..726f75fd 100644 --- a/src/examples/java/reference/SpriteSwitchCostume.java +++ b/examples/src/main/java/reference/SpriteSwitchCostume.java @@ -11,9 +11,9 @@ public SpriteSwitchCostume() { Sprite zeta = new Sprite("green", "slimeGreen"); zeta.addCostume("yellow", "slimeBlue"); myStage.add(zeta); - myStage.wait(3000); + myStage.waitSeconds(3); zeta.switchCostume("yellow"); - myStage.wait(3000); + myStage.waitSeconds(3); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteThink.java b/examples/src/main/java/reference/SpriteThink.java similarity index 94% rename from src/examples/java/reference/SpriteThink.java rename to examples/src/main/java/reference/SpriteThink.java index 453fa04f..81ba5d03 100644 --- a/src/examples/java/reference/SpriteThink.java +++ b/examples/src/main/java/reference/SpriteThink.java @@ -11,7 +11,7 @@ public SpriteThink() { Sprite zeta = new Sprite("green", "slimeGreen"); myStage.add(zeta); zeta.think("Hi! I'm Zeta and can think line breaks if the line gets too long."); - myStage.wait(1000); + myStage.waitSeconds(1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/SpriteTimer.java b/examples/src/main/java/reference/SpriteTimer.java similarity index 83% rename from src/examples/java/reference/SpriteTimer.java rename to examples/src/main/java/reference/SpriteTimer.java index c6b41764..9ab4179a 100644 --- a/src/examples/java/reference/SpriteTimer.java +++ b/examples/src/main/java/reference/SpriteTimer.java @@ -1,5 +1,6 @@ package reference; import org.openpatch.scratch.Sprite; +import org.openpatch.scratch.Timer; import org.openpatch.scratch.Stage; import org.openpatch.scratch.Window; @@ -11,8 +12,9 @@ public SpriteTimer() { Sprite timeMe = new Sprite("zeta", "slimeGreen"); timeMe.addCostume("gamma", "slimePurple"); myStage.add(timeMe); + Timer identityChange = new Timer(); while (true) { - if (timeMe.getTimer("identityChange").everyMillis(1000)) { + if (identityChange.every(1)) { timeMe.nextCostume(); } } diff --git a/src/examples/java/reference/SpriteTurnLeft.java b/examples/src/main/java/reference/SpriteTurnLeft.java similarity index 93% rename from src/examples/java/reference/SpriteTurnLeft.java rename to examples/src/main/java/reference/SpriteTurnLeft.java index 8e9d26e8..bb2b5d98 100644 --- a/src/examples/java/reference/SpriteTurnLeft.java +++ b/examples/src/main/java/reference/SpriteTurnLeft.java @@ -12,7 +12,7 @@ public SpriteTurnLeft() { myStage.add(zeta); while (true) { zeta.turnLeft(2); - myStage.wait(50); + myStage.waitSeconds(0.05); } } diff --git a/src/examples/java/reference/SpriteTurnRight.java b/examples/src/main/java/reference/SpriteTurnRight.java similarity index 93% rename from src/examples/java/reference/SpriteTurnRight.java rename to examples/src/main/java/reference/SpriteTurnRight.java index 86e3360c..07e71770 100644 --- a/src/examples/java/reference/SpriteTurnRight.java +++ b/examples/src/main/java/reference/SpriteTurnRight.java @@ -12,7 +12,7 @@ public SpriteTurnRight() { myStage.add(zeta); while (true) { zeta.turnLeft(2); - myStage.wait(50); + myStage.waitSeconds(0.05); } } diff --git a/src/examples/java/reference/SpriteWhenAddedToStage.java b/examples/src/main/java/reference/SpriteWhenAddedToStage.java similarity index 100% rename from src/examples/java/reference/SpriteWhenAddedToStage.java rename to examples/src/main/java/reference/SpriteWhenAddedToStage.java diff --git a/src/examples/java/reference/SpriteWhenBackdropSwitches.java b/examples/src/main/java/reference/SpriteWhenBackdropSwitches.java similarity index 94% rename from src/examples/java/reference/SpriteWhenBackdropSwitches.java rename to examples/src/main/java/reference/SpriteWhenBackdropSwitches.java index 79f59896..893f3884 100644 --- a/src/examples/java/reference/SpriteWhenBackdropSwitches.java +++ b/examples/src/main/java/reference/SpriteWhenBackdropSwitches.java @@ -12,7 +12,7 @@ public SpriteWhenBackdropSwitches() { myStage.addBackdrop("sea", "UIbg"); myStage.add(new CustomSprite()); while (true) { - if (myStage.getTimer("backdrop").intervalMillis(1000)) { + if (myStage.getTimer().interval(1)) { myStage.switchBackdrop("sea"); } else { myStage.switchBackdrop("forest"); diff --git a/src/examples/java/reference/SpriteWhenClicked.java b/examples/src/main/java/reference/SpriteWhenClicked.java similarity index 100% rename from src/examples/java/reference/SpriteWhenClicked.java rename to examples/src/main/java/reference/SpriteWhenClicked.java diff --git a/src/examples/java/reference/SpriteWhenIReceive.java b/examples/src/main/java/reference/SpriteWhenIReceive.java similarity index 92% rename from src/examples/java/reference/SpriteWhenIReceive.java rename to examples/src/main/java/reference/SpriteWhenIReceive.java index f961c3bb..0992b5e9 100644 --- a/src/examples/java/reference/SpriteWhenIReceive.java +++ b/examples/src/main/java/reference/SpriteWhenIReceive.java @@ -27,9 +27,9 @@ public void whenIReceive(String message) { while (true) { myStage.broadcast("up"); - myStage.wait(600); + myStage.waitSeconds(0.6); myStage.broadcast("down"); - myStage.wait(600); + myStage.waitSeconds(0.6); } } diff --git a/src/examples/java/reference/SpriteWhenKeyPressed.java b/examples/src/main/java/reference/SpriteWhenKeyPressed.java similarity index 100% rename from src/examples/java/reference/SpriteWhenKeyPressed.java rename to examples/src/main/java/reference/SpriteWhenKeyPressed.java diff --git a/src/examples/java/reference/SpriteWhenKeyReleased.java b/examples/src/main/java/reference/SpriteWhenKeyReleased.java similarity index 100% rename from src/examples/java/reference/SpriteWhenKeyReleased.java rename to examples/src/main/java/reference/SpriteWhenKeyReleased.java diff --git a/src/examples/java/reference/SpriteWhenMouseClicked.java b/examples/src/main/java/reference/SpriteWhenMouseClicked.java similarity index 100% rename from src/examples/java/reference/SpriteWhenMouseClicked.java rename to examples/src/main/java/reference/SpriteWhenMouseClicked.java diff --git a/src/examples/java/reference/SpriteWhenMouseMoved.java b/examples/src/main/java/reference/SpriteWhenMouseMoved.java similarity index 100% rename from src/examples/java/reference/SpriteWhenMouseMoved.java rename to examples/src/main/java/reference/SpriteWhenMouseMoved.java diff --git a/src/examples/java/reference/SpriteWhenRemovedFromStage.java b/examples/src/main/java/reference/SpriteWhenRemovedFromStage.java similarity index 95% rename from src/examples/java/reference/SpriteWhenRemovedFromStage.java rename to examples/src/main/java/reference/SpriteWhenRemovedFromStage.java index b0840c04..11249242 100644 --- a/src/examples/java/reference/SpriteWhenRemovedFromStage.java +++ b/examples/src/main/java/reference/SpriteWhenRemovedFromStage.java @@ -19,7 +19,7 @@ public void whenRemovedFromStage() { myWindow.setStage(myStage); MySprite mySprite = new MySprite(); myStage.add(mySprite); - myStage.wait(2000); + myStage.waitSeconds(2); mySprite.remove(); } diff --git a/src/examples/java/reference/SpriteWhenStartsAsClone.java b/examples/src/main/java/reference/SpriteWhenStartsAsClone.java similarity index 90% rename from src/examples/java/reference/SpriteWhenStartsAsClone.java rename to examples/src/main/java/reference/SpriteWhenStartsAsClone.java index 17a2f74d..bcd3b85c 100644 --- a/src/examples/java/reference/SpriteWhenStartsAsClone.java +++ b/examples/src/main/java/reference/SpriteWhenStartsAsClone.java @@ -18,8 +18,8 @@ public void whenStartsAsClone() { public void run() { if (this.isClone()) { this.turnRight(3); - } else if (this.getTimer().everyMillis(500)) { - this.clone(); + } else if (this.getTimer().every(0.5)) { + this.createClone(); } } } diff --git a/src/examples/java/reference/StageAdd.java b/examples/src/main/java/reference/StageAdd.java similarity index 100% rename from src/examples/java/reference/StageAdd.java rename to examples/src/main/java/reference/StageAdd.java diff --git a/src/examples/java/reference/StageAddBackdrop.java b/examples/src/main/java/reference/StageAddBackdrop.java similarity index 93% rename from src/examples/java/reference/StageAddBackdrop.java rename to examples/src/main/java/reference/StageAddBackdrop.java index 76a7604d..d96a74ac 100644 --- a/src/examples/java/reference/StageAddBackdrop.java +++ b/examples/src/main/java/reference/StageAddBackdrop.java @@ -8,7 +8,7 @@ public StageAddBackdrop() { Stage myStage = new Stage(); myWindow.setStage(myStage); myStage.addBackdrop("forest", "background", true); - myStage.wait(1000); + myStage.waitSeconds(1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageAddSound.java b/examples/src/main/java/reference/StageAddSound.java similarity index 100% rename from src/examples/java/reference/StageAddSound.java rename to examples/src/main/java/reference/StageAddSound.java diff --git a/src/examples/java/reference/StageAsk.java b/examples/src/main/java/reference/StageAsk.java similarity index 92% rename from src/examples/java/reference/StageAsk.java rename to examples/src/main/java/reference/StageAsk.java index 0a404ade..15af566a 100644 --- a/src/examples/java/reference/StageAsk.java +++ b/examples/src/main/java/reference/StageAsk.java @@ -10,7 +10,7 @@ public StageAsk() { myStage.ask("What is your name?"); while (myStage.isAsking()) { - myStage.wait(50); + myStage.waitSeconds(0.05); } myStage.display("Hello " + myStage.getAnswer()); } diff --git a/src/examples/java/reference/StageBroadcast.java b/examples/src/main/java/reference/StageBroadcast.java similarity index 92% rename from src/examples/java/reference/StageBroadcast.java rename to examples/src/main/java/reference/StageBroadcast.java index 59f0fc26..1b545cb2 100644 --- a/src/examples/java/reference/StageBroadcast.java +++ b/examples/src/main/java/reference/StageBroadcast.java @@ -26,9 +26,9 @@ public void whenIReceive(String message) { // Every sprite on the stage hears the message. while (true) { myStage.broadcast("up"); - myStage.wait(600); + myStage.waitSeconds(0.6); myStage.broadcast("down"); - myStage.wait(600); + myStage.waitSeconds(0.6); } } diff --git a/src/examples/java/reference/StageChangeTint.java b/examples/src/main/java/reference/StageChangeColorEffect.java similarity index 56% rename from src/examples/java/reference/StageChangeTint.java rename to examples/src/main/java/reference/StageChangeColorEffect.java index 9ac7823a..6cf2842b 100644 --- a/src/examples/java/reference/StageChangeTint.java +++ b/examples/src/main/java/reference/StageChangeColorEffect.java @@ -1,18 +1,19 @@ package reference; import org.openpatch.scratch.*; -public class StageChangeTint { - public StageChangeTint() { +public class StageChangeColorEffect { + public StageChangeColorEffect() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); myStage.addBackdrop("forest", "background"); - myStage.wait(2000); - myStage.changeTint(200); - myStage.wait(2000); + while (true) { + myStage.changeColorEffect(5); + myStage.waitSeconds(0.05); + } } public static void main(String[] args) { - new StageChangeTint(); + new StageChangeColorEffect(); } } diff --git a/src/examples/java/reference/StageChangeTransparency.java b/examples/src/main/java/reference/StageChangeTransparency.java similarity index 89% rename from src/examples/java/reference/StageChangeTransparency.java rename to examples/src/main/java/reference/StageChangeTransparency.java index d30f9bc0..8bea5653 100644 --- a/src/examples/java/reference/StageChangeTransparency.java +++ b/examples/src/main/java/reference/StageChangeTransparency.java @@ -11,10 +11,10 @@ public StageChangeTransparency() { while (true) { for (int i = 0; i < 10; i++) { myStage.changeTransparency(10); - myStage.wait(100); + myStage.waitSeconds(0.1); } myStage.setTransparency(0); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/StageChangeVolume.java b/examples/src/main/java/reference/StageChangeVolume.java similarity index 93% rename from src/examples/java/reference/StageChangeVolume.java rename to examples/src/main/java/reference/StageChangeVolume.java index e7a8a906..d9e5711e 100644 --- a/src/examples/java/reference/StageChangeVolume.java +++ b/examples/src/main/java/reference/StageChangeVolume.java @@ -12,7 +12,7 @@ public StageChangeVolume() { myStage.playSound("music"); while (myStage.getVolume() > 0) { myStage.changeVolume(-5); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/StageConstructors.java b/examples/src/main/java/reference/StageConstructors.java similarity index 100% rename from src/examples/java/reference/StageConstructors.java rename to examples/src/main/java/reference/StageConstructors.java diff --git a/src/examples/java/reference/StageCount.java b/examples/src/main/java/reference/StageCount.java similarity index 95% rename from src/examples/java/reference/StageCount.java rename to examples/src/main/java/reference/StageCount.java index c12aa83f..63984836 100644 --- a/src/examples/java/reference/StageCount.java +++ b/examples/src/main/java/reference/StageCount.java @@ -19,7 +19,7 @@ public Coin() { for (int i = 0; i < 10; i++) { myStage.add(new Coin()); System.out.println(myStage.count(Coin.class) + " coins"); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/StageDebug.java b/examples/src/main/java/reference/StageDebug.java similarity index 79% rename from src/examples/java/reference/StageDebug.java rename to examples/src/main/java/reference/StageDebug.java index b559ec34..adecc380 100644 --- a/src/examples/java/reference/StageDebug.java +++ b/examples/src/main/java/reference/StageDebug.java @@ -8,14 +8,14 @@ public StageDebug() { Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); // Values written onto the stage while it runs, instead of into the console. while (true) { mySprite.changeX(2); - myStage.debug("x", mySprite.getX(), "frame rate", myStage.getFrameRate()); - myStage.wait(50); + myStage.debug("x", mySprite.getX()); + myStage.waitSeconds(0.05); } } diff --git a/src/examples/java/reference/StageDisplay.java b/examples/src/main/java/reference/StageDisplay.java similarity index 65% rename from src/examples/java/reference/StageDisplay.java rename to examples/src/main/java/reference/StageDisplay.java index d3a0f2e1..bb7c22bc 100644 --- a/src/examples/java/reference/StageDisplay.java +++ b/examples/src/main/java/reference/StageDisplay.java @@ -6,11 +6,9 @@ public StageDisplay() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.display( - "Welcome! This is a longer text with auto line breaks! So if you write a long sentence it" - + " should wrap to the next line and the height of the box should increase.", - 2000); - myStage.wait(2000); + myStage.display("Welcome! This is a longer text with auto line breaks! So if you write a long sentence it" + + " should wrap to the next line and the height of the box should increase.", 2); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageEraseAll.java b/examples/src/main/java/reference/StageEraseAll.java similarity index 88% rename from src/examples/java/reference/StageEraseAll.java rename to examples/src/main/java/reference/StageEraseAll.java index 73bc15db..a0280a01 100644 --- a/src/examples/java/reference/StageEraseAll.java +++ b/examples/src/main/java/reference/StageEraseAll.java @@ -15,8 +15,8 @@ public StageEraseAll() { // Draws a while, then wipes everything the pens and stamps have left behind. while (true) { myPen.goToRandomPosition(); - myStage.wait(200); - if (myStage.getTimer().everyMillis(3000)) { + myStage.waitSeconds(0.2); + if (myStage.getTimer().every(3)) { myStage.eraseAll(); } } diff --git a/src/examples/java/reference/StageExit.java b/examples/src/main/java/reference/StageExit.java similarity index 87% rename from src/examples/java/reference/StageExit.java rename to examples/src/main/java/reference/StageExit.java index 820aa673..ecbb49ed 100644 --- a/src/examples/java/reference/StageExit.java +++ b/examples/src/main/java/reference/StageExit.java @@ -9,9 +9,9 @@ public StageExit() { Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); - myStage.wait(3000); + myStage.waitSeconds(3); // Closes the window and ends the program. - myStage.exit(); + Window.getInstance().exit(); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageFind.java b/examples/src/main/java/reference/StageFind.java similarity index 95% rename from src/examples/java/reference/StageFind.java rename to examples/src/main/java/reference/StageFind.java index 5bd4a531..c6b7aaf1 100644 --- a/src/examples/java/reference/StageFind.java +++ b/examples/src/main/java/reference/StageFind.java @@ -12,7 +12,7 @@ public StageFind() { myStage.add(new CustomSprite()); myStage.add(new Sprite()); myStage.display("Sprites: " + myStage.find(CustomSprite.class).size()); - myStage.wait(2000); + myStage.waitSeconds(2); } class CustomSprite extends Sprite {} diff --git a/src/examples/java/reference/StageGetAll.java b/examples/src/main/java/reference/StageGetAll.java similarity index 93% rename from src/examples/java/reference/StageGetAll.java rename to examples/src/main/java/reference/StageGetAll.java index c51067e6..3a984f83 100644 --- a/src/examples/java/reference/StageGetAll.java +++ b/examples/src/main/java/reference/StageGetAll.java @@ -10,7 +10,7 @@ public StageGetAll() { myStage.add(new Sprite()); myStage.add(new Sprite()); myStage.display("All: " + myStage.getAll().size()); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageGetAnswer.java b/examples/src/main/java/reference/StageGetAnswer.java similarity index 93% rename from src/examples/java/reference/StageGetAnswer.java rename to examples/src/main/java/reference/StageGetAnswer.java index ba2fdce4..5d8884e2 100644 --- a/src/examples/java/reference/StageGetAnswer.java +++ b/examples/src/main/java/reference/StageGetAnswer.java @@ -10,7 +10,7 @@ public StageGetAnswer() { myStage.ask("How old are you?"); while (myStage.isAsking()) { - myStage.wait(50); + myStage.waitSeconds(0.05); } System.out.println("The answer was " + myStage.getAnswer()); } diff --git a/src/examples/java/reference/StageGetCamera.java b/examples/src/main/java/reference/StageGetCamera.java similarity index 88% rename from src/examples/java/reference/StageGetCamera.java rename to examples/src/main/java/reference/StageGetCamera.java index 8cb2cbe2..40af382d 100644 --- a/src/examples/java/reference/StageGetCamera.java +++ b/examples/src/main/java/reference/StageGetCamera.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.camera.Camera; +import org.openpatch.scratch.Camera; public class StageGetCamera { @@ -16,7 +16,7 @@ public StageGetCamera() { while (true) { myCamera.changeZoom(0.01); myCamera.changeX(1); - myStage.wait(50); + myStage.waitSeconds(0.05); } } diff --git a/src/examples/java/reference/StageGetColor.java b/examples/src/main/java/reference/StageGetColor.java similarity index 71% rename from src/examples/java/reference/StageGetColor.java rename to examples/src/main/java/reference/StageGetColor.java index 4183c9ce..2a6a193f 100644 --- a/src/examples/java/reference/StageGetColor.java +++ b/examples/src/main/java/reference/StageGetColor.java @@ -8,9 +8,9 @@ public StageGetColor() { Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setColor(140); + myStage.setColor(Color.fromHSB(55, 100, 100)); Color background = myStage.getColor(); - System.out.println("hue " + background.getH() + ", red " + background.getRed()); + System.out.println("hue " + background.getHue() + ", red " + background.getRed()); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageGetCurrentBackdropIndex.java b/examples/src/main/java/reference/StageGetCurrentBackdropIndex.java similarity index 91% rename from src/examples/java/reference/StageGetCurrentBackdropIndex.java rename to examples/src/main/java/reference/StageGetCurrentBackdropIndex.java index c8255847..9782cdbd 100644 --- a/src/examples/java/reference/StageGetCurrentBackdropIndex.java +++ b/examples/src/main/java/reference/StageGetCurrentBackdropIndex.java @@ -9,10 +9,10 @@ public StageGetCurrentBackdropIndex() { myStage.addBackdrop("forest", "background"); myStage.addBackdrop("sea", "UIbg"); myStage.display("Index: " + myStage.getCurrentBackdropIndex()); - myStage.wait(2000); + myStage.waitSeconds(2); myStage.nextBackdrop(); myStage.display("Index: " + myStage.getCurrentBackdropIndex()); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageGetCurrentBackdropName.java b/examples/src/main/java/reference/StageGetCurrentBackdropName.java similarity index 91% rename from src/examples/java/reference/StageGetCurrentBackdropName.java rename to examples/src/main/java/reference/StageGetCurrentBackdropName.java index 2b8c9ddb..b987cf91 100644 --- a/src/examples/java/reference/StageGetCurrentBackdropName.java +++ b/examples/src/main/java/reference/StageGetCurrentBackdropName.java @@ -9,10 +9,10 @@ public StageGetCurrentBackdropName() { myStage.addBackdrop("forest", "background"); myStage.addBackdrop("sea", "UIbg"); myStage.display("Name: " + myStage.getCurrentBackdropName()); - myStage.wait(2000); + myStage.waitSeconds(2); myStage.nextBackdrop(); myStage.display("Name: " + myStage.getCurrentBackdropName()); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageGetHeight.java b/examples/src/main/java/reference/StageGetHeight.java similarity index 92% rename from src/examples/java/reference/StageGetHeight.java rename to examples/src/main/java/reference/StageGetHeight.java index faca4a52..951f4a97 100644 --- a/src/examples/java/reference/StageGetHeight.java +++ b/examples/src/main/java/reference/StageGetHeight.java @@ -7,7 +7,7 @@ public StageGetHeight() { Stage myStage = new Stage(); myWindow.setStage(myStage); myStage.display("Height: " + myStage.getHeight()); - myStage.wait(500); + myStage.waitSeconds(0.5); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageGetMouse.java b/examples/src/main/java/reference/StageGetMouse.java similarity index 100% rename from src/examples/java/reference/StageGetMouse.java rename to examples/src/main/java/reference/StageGetMouse.java diff --git a/src/examples/java/reference/StageGetMouseX.java b/examples/src/main/java/reference/StageGetMouseX.java similarity index 92% rename from src/examples/java/reference/StageGetMouseX.java rename to examples/src/main/java/reference/StageGetMouseX.java index 34b6518d..0b357240 100644 --- a/src/examples/java/reference/StageGetMouseX.java +++ b/examples/src/main/java/reference/StageGetMouseX.java @@ -10,7 +10,7 @@ public StageGetMouseX() { while (true) { myStage.display("mouse x: " + myStage.getMouseX()); - myStage.wait(100); + myStage.waitSeconds(0.1); } } diff --git a/src/examples/java/reference/StageGetMouseY.java b/examples/src/main/java/reference/StageGetMouseY.java similarity index 92% rename from src/examples/java/reference/StageGetMouseY.java rename to examples/src/main/java/reference/StageGetMouseY.java index 9a75b89e..11b568d3 100644 --- a/src/examples/java/reference/StageGetMouseY.java +++ b/examples/src/main/java/reference/StageGetMouseY.java @@ -10,7 +10,7 @@ public StageGetMouseY() { while (true) { myStage.display("mouse y: " + myStage.getMouseY()); - myStage.wait(100); + myStage.waitSeconds(0.1); } } diff --git a/src/examples/java/reference/StageGetShaders.java b/examples/src/main/java/reference/StageGetShaders.java similarity index 80% rename from src/examples/java/reference/StageGetShaders.java rename to examples/src/main/java/reference/StageGetShaders.java index c72eb76c..58628aa7 100644 --- a/src/examples/java/reference/StageGetShaders.java +++ b/examples/src/main/java/reference/StageGetShaders.java @@ -1,6 +1,5 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.shader.*; public class StageGetShaders { @@ -12,11 +11,10 @@ public StageGetShaders() { myStage.add(new Sprite("slime", "slimeGreen")); // a stage shader draws everything on the stage: backdrop, pen and sprites - Shader waves = myStage.getShaders().add("waves", "assets/waves.frag", null); + Shader waves = myStage.getShaders().add("waves", "assets/waves.frag"); while (true) { - waves.set("time", Timer.millis() / 1000.0); - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/StageGetSorting.java b/examples/src/main/java/reference/StageGetSorting.java similarity index 93% rename from src/examples/java/reference/StageGetSorting.java rename to examples/src/main/java/reference/StageGetSorting.java index b57b9b4f..796179f5 100644 --- a/src/examples/java/reference/StageGetSorting.java +++ b/examples/src/main/java/reference/StageGetSorting.java @@ -18,7 +18,7 @@ public StageGetSorting() { // whoever stands further down is drawn in front: the slime passes // behind the cactus on its way up and in front of it on its way down - myStage.getSorting().byY(); + myStage.sortByY(); int step = 2; while (true) { @@ -26,7 +26,7 @@ public StageGetSorting() { if (slime.getY() > 100 || slime.getY() < -100) { step = -step; } - myStage.wait(20); + myStage.waitSeconds(0.02); } } diff --git a/src/examples/java/reference/StageGetTimer.java b/examples/src/main/java/reference/StageGetTimer.java similarity index 59% rename from src/examples/java/reference/StageGetTimer.java rename to examples/src/main/java/reference/StageGetTimer.java index a91cb837..a454bd36 100644 --- a/src/examples/java/reference/StageGetTimer.java +++ b/examples/src/main/java/reference/StageGetTimer.java @@ -10,15 +10,17 @@ public StageGetTimer() { Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); - // The stage's own timer, and as many more as you care to name. + // The stage's own timer, and as many more as you need. + Timer colourTimer = new Timer(); while (true) { - if (myStage.getTimer().everyMillis(1000)) { + if (myStage.getTimer().every(1)) { mySprite.nextCostume(); } - if (myStage.getTimer("colour").everyMillis(2000)) { - myStage.changeColor(40); + if (colourTimer.every(2)) { + Color color = myStage.getColor(); + myStage.setColor(color.withHue(color.getHue() + 40)); } - myStage.wait(10); + myStage.waitSeconds(0.01); } } diff --git a/src/examples/java/reference/StageGetVolume.java b/examples/src/main/java/reference/StageGetVolume.java similarity index 100% rename from src/examples/java/reference/StageGetVolume.java rename to examples/src/main/java/reference/StageGetVolume.java diff --git a/src/examples/java/reference/StageGetWidth.java b/examples/src/main/java/reference/StageGetWidth.java similarity index 85% rename from src/examples/java/reference/StageGetWidth.java rename to examples/src/main/java/reference/StageGetWidth.java index 5cce17a3..fb2dd2a0 100644 --- a/src/examples/java/reference/StageGetWidth.java +++ b/examples/src/main/java/reference/StageGetWidth.java @@ -7,8 +7,8 @@ public StageGetWidth() { Stage myStage = new Stage(); myWindow.setStage(myStage); myStage.display("Width: " + myStage.getWidth()); - myStage.wait(500); - myStage.wait(500); + myStage.waitSeconds(0.5); + myStage.waitSeconds(0.5); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageHideVariable.java b/examples/src/main/java/reference/StageHideVariable.java similarity index 100% rename from src/examples/java/reference/StageHideVariable.java rename to examples/src/main/java/reference/StageHideVariable.java diff --git a/src/examples/java/reference/StageIsAsking.java b/examples/src/main/java/reference/StageIsAsking.java similarity index 93% rename from src/examples/java/reference/StageIsAsking.java rename to examples/src/main/java/reference/StageIsAsking.java index 1d451ff0..6c144243 100644 --- a/src/examples/java/reference/StageIsAsking.java +++ b/examples/src/main/java/reference/StageIsAsking.java @@ -11,7 +11,7 @@ public StageIsAsking() { myStage.ask("Are you still there?"); // True for as long as the box is on the stage waiting to be filled in. while (myStage.isAsking()) { - myStage.wait(50); + myStage.waitSeconds(0.05); } myStage.display("Thank you"); } diff --git a/src/examples/java/reference/StageIsDebug.java b/examples/src/main/java/reference/StageIsDebug.java similarity index 71% rename from src/examples/java/reference/StageIsDebug.java rename to examples/src/main/java/reference/StageIsDebug.java index ca556f46..3d7658f3 100644 --- a/src/examples/java/reference/StageIsDebug.java +++ b/examples/src/main/java/reference/StageIsDebug.java @@ -8,8 +8,8 @@ public StageIsDebug() { Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); - System.out.println("Debug mode is on: " + myStage.isDebug()); + Window.getInstance().setDebug(true); + System.out.println("Debug mode is on: " + Window.getInstance().isDebug()); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageIsKeyPressed.java b/examples/src/main/java/reference/StageIsKeyPressed.java similarity index 100% rename from src/examples/java/reference/StageIsKeyPressed.java rename to examples/src/main/java/reference/StageIsKeyPressed.java diff --git a/src/examples/java/reference/StageIsMouseDown.java b/examples/src/main/java/reference/StageIsMouseDown.java similarity index 100% rename from src/examples/java/reference/StageIsMouseDown.java rename to examples/src/main/java/reference/StageIsMouseDown.java diff --git a/src/examples/java/reference/StageIsSoundPlaying.java b/examples/src/main/java/reference/StageIsSoundPlaying.java similarity index 93% rename from src/examples/java/reference/StageIsSoundPlaying.java rename to examples/src/main/java/reference/StageIsSoundPlaying.java index 4521f82e..5923914f 100644 --- a/src/examples/java/reference/StageIsSoundPlaying.java +++ b/examples/src/main/java/reference/StageIsSoundPlaying.java @@ -12,7 +12,7 @@ public StageIsSoundPlaying() { myStage.playSound("music"); while (true) { myStage.display("playing: " + myStage.isSoundPlaying("music")); - myStage.wait(200); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/StageNextBackdrop.java b/examples/src/main/java/reference/StageNextBackdrop.java similarity index 88% rename from src/examples/java/reference/StageNextBackdrop.java rename to examples/src/main/java/reference/StageNextBackdrop.java index 20d7bd51..af1b30e2 100644 --- a/src/examples/java/reference/StageNextBackdrop.java +++ b/examples/src/main/java/reference/StageNextBackdrop.java @@ -8,9 +8,9 @@ public StageNextBackdrop() { myWindow.setStage(myStage); myStage.addBackdrop("forest", "background"); myStage.addBackdrop("sea", "UIbg"); - myStage.wait(2000); + myStage.waitSeconds(2); myStage.nextBackdrop(); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StagePickRandom.java b/examples/src/main/java/reference/StagePickRandom.java similarity index 92% rename from src/examples/java/reference/StagePickRandom.java rename to examples/src/main/java/reference/StagePickRandom.java index deacf3b6..49ede6ec 100644 --- a/src/examples/java/reference/StagePickRandom.java +++ b/examples/src/main/java/reference/StagePickRandom.java @@ -9,7 +9,7 @@ public StagePickRandom() { while (true) { int random = myStage.pickRandom(0, 100); myStage.display("Random: " + random); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/StagePlaySound.java b/examples/src/main/java/reference/StagePlaySound.java similarity index 92% rename from src/examples/java/reference/StagePlaySound.java rename to examples/src/main/java/reference/StagePlaySound.java index a68b6c28..daeef353 100644 --- a/src/examples/java/reference/StagePlaySound.java +++ b/examples/src/main/java/reference/StagePlaySound.java @@ -11,7 +11,7 @@ public StagePlaySound() { myStage.addSound("bump", "impactWood_heavy_001"); while (true) { myStage.playSound("bump"); - myStage.wait(800); + myStage.waitSeconds(0.8); } } diff --git a/src/examples/java/reference/StagePreviousBackdrop.java b/examples/src/main/java/reference/StagePreviousBackdrop.java similarity index 94% rename from src/examples/java/reference/StagePreviousBackdrop.java rename to examples/src/main/java/reference/StagePreviousBackdrop.java index a3a79f52..1f83d296 100644 --- a/src/examples/java/reference/StagePreviousBackdrop.java +++ b/examples/src/main/java/reference/StagePreviousBackdrop.java @@ -13,7 +13,7 @@ public StagePreviousBackdrop() { // Backwards through the backdrops, wrapping round to the last one. while (true) { myStage.previousBackdrop(); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/StageRandomBackdrop.java b/examples/src/main/java/reference/StageRandomBackdrop.java similarity index 93% rename from src/examples/java/reference/StageRandomBackdrop.java rename to examples/src/main/java/reference/StageRandomBackdrop.java index cd9c9369..bfe02490 100644 --- a/src/examples/java/reference/StageRandomBackdrop.java +++ b/examples/src/main/java/reference/StageRandomBackdrop.java @@ -12,7 +12,7 @@ public StageRandomBackdrop() { myStage.addBackdrop("second", "UIbg"); while (true) { myStage.randomBackdrop(); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/StageRemove.java b/examples/src/main/java/reference/StageRemove.java similarity index 87% rename from src/examples/java/reference/StageRemove.java rename to examples/src/main/java/reference/StageRemove.java index 6748edf4..44fe2ae4 100644 --- a/src/examples/java/reference/StageRemove.java +++ b/examples/src/main/java/reference/StageRemove.java @@ -8,9 +8,9 @@ public StageRemove() { myWindow.setStage(myStage); Sprite gamma = new Sprite("gamma", "slimePurple"); myStage.add(gamma); - myStage.wait(2000); + myStage.waitSeconds(2); myStage.remove(gamma); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageRemoveAll.java b/examples/src/main/java/reference/StageRemoveAll.java similarity index 90% rename from src/examples/java/reference/StageRemoveAll.java rename to examples/src/main/java/reference/StageRemoveAll.java index 36f3b123..6a52288e 100644 --- a/src/examples/java/reference/StageRemoveAll.java +++ b/examples/src/main/java/reference/StageRemoveAll.java @@ -12,9 +12,9 @@ public StageRemoveAll() { Sprite zeta = new Sprite("zeta", "slimeGreen"); zeta.changeX(-20); myStage.add(zeta); - myStage.wait(2000); + myStage.waitSeconds(2); myStage.removeAll(); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageRun.java b/examples/src/main/java/reference/StageRun.java similarity index 78% rename from src/examples/java/reference/StageRun.java rename to examples/src/main/java/reference/StageRun.java index b65b8c43..46f9009b 100644 --- a/src/examples/java/reference/StageRun.java +++ b/examples/src/main/java/reference/StageRun.java @@ -8,7 +8,8 @@ public CustomStage() { } public void run() { - this.changeColor(0.5); + Color color = this.getColor(); + this.setColor(color.withHue(color.getHue() + 0.5)); } } diff --git a/src/examples/java/reference/StageSetColor.java b/examples/src/main/java/reference/StageSetColor.java similarity index 73% rename from src/examples/java/reference/StageSetColor.java rename to examples/src/main/java/reference/StageSetColor.java index 4e36c8eb..e86fe96e 100644 --- a/src/examples/java/reference/StageSetColor.java +++ b/examples/src/main/java/reference/StageSetColor.java @@ -6,9 +6,9 @@ public StageSetColor() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.wait(2000); - myStage.setColor(200); - myStage.wait(2000); + myStage.waitSeconds(2); + myStage.setColor(Color.fromHSB(78, 100, 100)); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/examples/src/main/java/reference/StageSetColorEffect.java b/examples/src/main/java/reference/StageSetColorEffect.java new file mode 100644 index 00000000..c36b349e --- /dev/null +++ b/examples/src/main/java/reference/StageSetColorEffect.java @@ -0,0 +1,21 @@ +package reference; +import org.openpatch.scratch.*; + +public class StageSetColorEffect { + public StageSetColorEffect() { + Window myWindow = new Window(600, 240); + Stage myStage = new Stage(); + myWindow.setStage(myStage); + myStage.addBackdrop("forest", "background"); + while (true) { + myStage.setColorEffect(0); + myStage.waitSeconds(1); + myStage.setColorEffect(100); + myStage.waitSeconds(1); + } + } + + public static void main(String[] args) { + new StageSetColorEffect(); + } +} diff --git a/src/examples/java/reference/StageSetCursor.java b/examples/src/main/java/reference/StageSetCursor.java similarity index 95% rename from src/examples/java/reference/StageSetCursor.java rename to examples/src/main/java/reference/StageSetCursor.java index e5844092..3166e71b 100644 --- a/src/examples/java/reference/StageSetCursor.java +++ b/examples/src/main/java/reference/StageSetCursor.java @@ -17,7 +17,7 @@ public StageSetCursor() { myStage.setCursor("hudJewel_red", 22, 20); } myStage.display("Mouse: " + myStage.getMouseX() + ", " + myStage.getMouseY()); - myStage.wait(16); + myStage.waitSeconds(0.016); } } diff --git a/src/examples/java/reference/StageSetDebug.java b/examples/src/main/java/reference/StageSetDebug.java similarity index 76% rename from src/examples/java/reference/StageSetDebug.java rename to examples/src/main/java/reference/StageSetDebug.java index e92f7e8f..f10501e4 100644 --- a/src/examples/java/reference/StageSetDebug.java +++ b/examples/src/main/java/reference/StageSetDebug.java @@ -12,10 +12,10 @@ public StageSetDebug() { myStage.add(mySprite); // Debug mode draws the hitboxes and shows whatever debug() is given. while (true) { - myStage.setDebug(true); - myStage.wait(1500); - myStage.setDebug(false); - myStage.wait(1500); + Window.getInstance().setDebug(true); + myStage.waitSeconds(1.5); + Window.getInstance().setDebug(false); + myStage.waitSeconds(1.5); } } diff --git a/src/examples/java/reference/StageSetTint.java b/examples/src/main/java/reference/StageSetTint.java similarity index 63% rename from src/examples/java/reference/StageSetTint.java rename to examples/src/main/java/reference/StageSetTint.java index 8a4ba181..e499140a 100644 --- a/src/examples/java/reference/StageSetTint.java +++ b/examples/src/main/java/reference/StageSetTint.java @@ -7,9 +7,10 @@ public StageSetTint() { Stage myStage = new Stage(); myWindow.setStage(myStage); myStage.addBackdrop("forest", "background"); - myStage.wait(2000); - myStage.setTint(200); - myStage.wait(2000); + myStage.waitSeconds(2); + // multiplies every pixel of the backdrop by the colour (white would leave it as it is) + myStage.setTint(new Color(255, 160, 60)); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageSetTransparency.java b/examples/src/main/java/reference/StageSetTransparency.java similarity index 90% rename from src/examples/java/reference/StageSetTransparency.java rename to examples/src/main/java/reference/StageSetTransparency.java index f047a391..f5d6f8fe 100644 --- a/src/examples/java/reference/StageSetTransparency.java +++ b/examples/src/main/java/reference/StageSetTransparency.java @@ -7,11 +7,11 @@ public StageSetTransparency() { Stage myStage = new Stage(); myWindow.setStage(myStage); myStage.addBackdrop("forest", "background"); - myStage.wait(2000); + myStage.waitSeconds(2); // 0 is fully solid and 100 is invisible, so 50 fades the backdrop halfway // into the stage colour behind it. myStage.setTransparency(50); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageSetVolume.java b/examples/src/main/java/reference/StageSetVolume.java similarity index 100% rename from src/examples/java/reference/StageSetVolume.java rename to examples/src/main/java/reference/StageSetVolume.java diff --git a/src/examples/java/reference/StageShowVariable.java b/examples/src/main/java/reference/StageShowVariable.java similarity index 92% rename from src/examples/java/reference/StageShowVariable.java rename to examples/src/main/java/reference/StageShowVariable.java index 1be5a2cc..8240803f 100644 --- a/src/examples/java/reference/StageShowVariable.java +++ b/examples/src/main/java/reference/StageShowVariable.java @@ -12,7 +12,7 @@ public MyStage() { } public void run() { - if (this.getTimer().everyMillis(1000)) { + if (this.getTimer().every(1)) { seconds++; } } diff --git a/src/examples/java/reference/StageStopAllSounds.java b/examples/src/main/java/reference/StageStopAllSounds.java similarity index 94% rename from src/examples/java/reference/StageStopAllSounds.java rename to examples/src/main/java/reference/StageStopAllSounds.java index 0adf25c3..3fcc6f51 100644 --- a/src/examples/java/reference/StageStopAllSounds.java +++ b/examples/src/main/java/reference/StageStopAllSounds.java @@ -12,7 +12,7 @@ public StageStopAllSounds() { myStage.addSound("bump", "impactWood_heavy_001"); myStage.playSound("music"); myStage.playSound("bump"); - myStage.wait(2000); + myStage.waitSeconds(2); myStage.stopAllSounds(); } diff --git a/src/examples/java/reference/StageStopSound.java b/examples/src/main/java/reference/StageStopSound.java similarity index 93% rename from src/examples/java/reference/StageStopSound.java rename to examples/src/main/java/reference/StageStopSound.java index 1a6bec40..bbee6434 100644 --- a/src/examples/java/reference/StageStopSound.java +++ b/examples/src/main/java/reference/StageStopSound.java @@ -10,7 +10,7 @@ public StageStopSound() { myStage.addSound("music", "jingles_STEEL16"); myStage.playSound("music"); - myStage.wait(2000); + myStage.waitSeconds(2); myStage.stopSound("music"); } diff --git a/src/examples/java/reference/StageSwitchBackdrop.java b/examples/src/main/java/reference/StageSwitchBackdrop.java similarity index 88% rename from src/examples/java/reference/StageSwitchBackdrop.java rename to examples/src/main/java/reference/StageSwitchBackdrop.java index be1e17c2..f39fb086 100644 --- a/src/examples/java/reference/StageSwitchBackdrop.java +++ b/examples/src/main/java/reference/StageSwitchBackdrop.java @@ -8,9 +8,9 @@ public StageSwitchBackdrop() { myWindow.setStage(myStage); myStage.addBackdrop("forest", "background"); myStage.addBackdrop("sea", "UIbg"); - myStage.wait(2000); + myStage.waitSeconds(2); myStage.switchBackdrop("sea"); - myStage.wait(2000); + myStage.waitSeconds(2); } public static void main(String[] args) { diff --git a/src/examples/java/reference/StageTimer.java b/examples/src/main/java/reference/StageTimer.java similarity index 63% rename from src/examples/java/reference/StageTimer.java rename to examples/src/main/java/reference/StageTimer.java index 3d7f96a6..a3640f94 100644 --- a/src/examples/java/reference/StageTimer.java +++ b/examples/src/main/java/reference/StageTimer.java @@ -6,9 +6,11 @@ public StageTimer() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); + Timer identityChange = new Timer(); while (true) { - if (myStage.getTimer("identityChange").everyMillis(1000)) { - myStage.changeColor(40); + if (identityChange.every(1)) { + Color color = myStage.getColor(); + myStage.setColor(color.withHue(color.getHue() + 40)); } } } diff --git a/src/examples/java/reference/StageWait.java b/examples/src/main/java/reference/StageWait.java similarity index 94% rename from src/examples/java/reference/StageWait.java rename to examples/src/main/java/reference/StageWait.java index 22ae723d..afbf3b02 100644 --- a/src/examples/java/reference/StageWait.java +++ b/examples/src/main/java/reference/StageWait.java @@ -14,7 +14,7 @@ public StageWait() { // down the page paces itself. while (true) { mySprite.changeX(50); - myStage.wait(500); + myStage.waitSeconds(0.5); mySprite.ifOnEdgeBounce(); } } diff --git a/src/examples/java/reference/StageWaitUntil.java b/examples/src/main/java/reference/StageWaitUntil.java similarity index 100% rename from src/examples/java/reference/StageWaitUntil.java rename to examples/src/main/java/reference/StageWaitUntil.java diff --git a/src/examples/java/reference/StageWhenBackdropSwitches.java b/examples/src/main/java/reference/StageWhenBackdropSwitches.java similarity index 89% rename from src/examples/java/reference/StageWhenBackdropSwitches.java rename to examples/src/main/java/reference/StageWhenBackdropSwitches.java index bb3be771..51f6a76a 100644 --- a/src/examples/java/reference/StageWhenBackdropSwitches.java +++ b/examples/src/main/java/reference/StageWhenBackdropSwitches.java @@ -4,11 +4,11 @@ public class StageWhenBackdropSwitches { public StageWhenBackdropSwitches() { Stage myStage = new CustomStage(); - myStage.wait(1000); + myStage.waitSeconds(1); myStage.nextBackdrop(); - myStage.wait(1000); + myStage.waitSeconds(1); myStage.nextBackdrop(); - myStage.wait(1000); + myStage.waitSeconds(1); } class CustomStage extends Stage { diff --git a/src/examples/java/reference/StageWhenIReceive.java b/examples/src/main/java/reference/StageWhenIReceive.java similarity index 79% rename from src/examples/java/reference/StageWhenIReceive.java rename to examples/src/main/java/reference/StageWhenIReceive.java index be1e80e3..9bc90552 100644 --- a/src/examples/java/reference/StageWhenIReceive.java +++ b/examples/src/main/java/reference/StageWhenIReceive.java @@ -11,7 +11,8 @@ public MyStage() { // The stage hears its own messages too. public void whenIReceive(String message) { if (message.equals("darker")) { - this.changeColor(10); + Color color = this.getColor(); + this.setColor(color.withHue(color.getHue() + 10)); } } } @@ -19,7 +20,7 @@ public void whenIReceive(String message) { MyStage myStage = new MyStage(); while (true) { myStage.broadcast("darker"); - myStage.wait(500); + myStage.waitSeconds(0.5); } } diff --git a/src/examples/java/reference/StageWhenKeyPressed.java b/examples/src/main/java/reference/StageWhenKeyPressed.java similarity index 100% rename from src/examples/java/reference/StageWhenKeyPressed.java rename to examples/src/main/java/reference/StageWhenKeyPressed.java diff --git a/src/examples/java/reference/StageWhenKeyReleased.java b/examples/src/main/java/reference/StageWhenKeyReleased.java similarity index 100% rename from src/examples/java/reference/StageWhenKeyReleased.java rename to examples/src/main/java/reference/StageWhenKeyReleased.java diff --git a/src/examples/java/reference/StageWhenMouseClicked.java b/examples/src/main/java/reference/StageWhenMouseClicked.java similarity index 100% rename from src/examples/java/reference/StageWhenMouseClicked.java rename to examples/src/main/java/reference/StageWhenMouseClicked.java diff --git a/src/examples/java/reference/StageWhenMouseWheelMoved.java b/examples/src/main/java/reference/StageWhenMouseWheelMoved.java similarity index 89% rename from src/examples/java/reference/StageWhenMouseWheelMoved.java rename to examples/src/main/java/reference/StageWhenMouseWheelMoved.java index 37466e97..dbf9e934 100644 --- a/src/examples/java/reference/StageWhenMouseWheelMoved.java +++ b/examples/src/main/java/reference/StageWhenMouseWheelMoved.java @@ -7,7 +7,7 @@ public CustomStage() { } @Override - public void whenMouseWheelMoved(int steps) { + public void whenMouseWheelMoved(double steps) { this.display("Mouse Wheel Steps: " + steps); } } diff --git a/src/examples/java/reference/TextAddFont.java b/examples/src/main/java/reference/TextAddFont.java similarity index 100% rename from src/examples/java/reference/TextAddFont.java rename to examples/src/main/java/reference/TextAddFont.java diff --git a/src/examples/java/reference/TextConstructors.java b/examples/src/main/java/reference/TextConstructors.java similarity index 100% rename from src/examples/java/reference/TextConstructors.java rename to examples/src/main/java/reference/TextConstructors.java diff --git a/src/examples/java/reference/TextGetAlign.java b/examples/src/main/java/reference/TextGetAlign.java similarity index 100% rename from src/examples/java/reference/TextGetAlign.java rename to examples/src/main/java/reference/TextGetAlign.java diff --git a/src/examples/java/reference/TextGetCurrentFontIndex.java b/examples/src/main/java/reference/TextGetCurrentFontIndex.java similarity index 100% rename from src/examples/java/reference/TextGetCurrentFontIndex.java rename to examples/src/main/java/reference/TextGetCurrentFontIndex.java diff --git a/src/examples/java/reference/TextGetCurrentFontName.java b/examples/src/main/java/reference/TextGetCurrentFontName.java similarity index 100% rename from src/examples/java/reference/TextGetCurrentFontName.java rename to examples/src/main/java/reference/TextGetCurrentFontName.java diff --git a/src/examples/java/reference/TextGetDefaultFont.java b/examples/src/main/java/reference/TextGetDefaultFont.java similarity index 100% rename from src/examples/java/reference/TextGetDefaultFont.java rename to examples/src/main/java/reference/TextGetDefaultFont.java diff --git a/src/examples/java/reference/TextGetDefaultFontSize.java b/examples/src/main/java/reference/TextGetDefaultFontSize.java similarity index 100% rename from src/examples/java/reference/TextGetDefaultFontSize.java rename to examples/src/main/java/reference/TextGetDefaultFontSize.java diff --git a/src/examples/java/reference/TextGetFont.java b/examples/src/main/java/reference/TextGetFont.java similarity index 100% rename from src/examples/java/reference/TextGetFont.java rename to examples/src/main/java/reference/TextGetFont.java diff --git a/src/examples/java/reference/TextGetPosition.java b/examples/src/main/java/reference/TextGetPosition.java similarity index 100% rename from src/examples/java/reference/TextGetPosition.java rename to examples/src/main/java/reference/TextGetPosition.java diff --git a/src/examples/java/reference/TextGetStage.java b/examples/src/main/java/reference/TextGetStage.java similarity index 100% rename from src/examples/java/reference/TextGetStage.java rename to examples/src/main/java/reference/TextGetStage.java diff --git a/src/examples/java/reference/TextGetStyle.java b/examples/src/main/java/reference/TextGetStyle.java similarity index 95% rename from src/examples/java/reference/TextGetStyle.java rename to examples/src/main/java/reference/TextGetStyle.java index 871457c0..c24dedc0 100644 --- a/src/examples/java/reference/TextGetStyle.java +++ b/examples/src/main/java/reference/TextGetStyle.java @@ -16,7 +16,7 @@ public TextGetStyle() { for (TextStyle style : TextStyle.values()) { myText.setStyle(style); myText.showText("This one is " + myText.getStyle()); - myStage.wait(1500); + myStage.waitSeconds(1.5); } } } diff --git a/src/examples/java/reference/TextGetTextSize.java b/examples/src/main/java/reference/TextGetTextSize.java similarity index 100% rename from src/examples/java/reference/TextGetTextSize.java rename to examples/src/main/java/reference/TextGetTextSize.java diff --git a/src/examples/java/reference/TextGetWidth.java b/examples/src/main/java/reference/TextGetWidth.java similarity index 100% rename from src/examples/java/reference/TextGetWidth.java rename to examples/src/main/java/reference/TextGetWidth.java diff --git a/src/examples/java/reference/TextGetX.java b/examples/src/main/java/reference/TextGetX.java similarity index 100% rename from src/examples/java/reference/TextGetX.java rename to examples/src/main/java/reference/TextGetX.java diff --git a/src/examples/java/reference/TextGetY.java b/examples/src/main/java/reference/TextGetY.java similarity index 100% rename from src/examples/java/reference/TextGetY.java rename to examples/src/main/java/reference/TextGetY.java diff --git a/src/examples/java/reference/TextGoLayersBackwards.java b/examples/src/main/java/reference/TextGoLayersBackwards.java similarity index 90% rename from src/examples/java/reference/TextGoLayersBackwards.java rename to examples/src/main/java/reference/TextGoLayersBackwards.java index e0e75ad4..e4408743 100644 --- a/src/examples/java/reference/TextGoLayersBackwards.java +++ b/examples/src/main/java/reference/TextGoLayersBackwards.java @@ -24,11 +24,11 @@ public TextGoLayersBackwards() { myStage.add(three); while (true) { - myStage.wait(1200); + myStage.waitSeconds(1.2); three.goLayersBackwards(1); - myStage.wait(1200); + myStage.waitSeconds(1.2); three.goLayersBackwards(1); - myStage.wait(1200); + myStage.waitSeconds(1.2); three.goLayersForwards(2); } } diff --git a/src/examples/java/reference/TextGoLayersForwards.java b/examples/src/main/java/reference/TextGoLayersForwards.java similarity index 90% rename from src/examples/java/reference/TextGoLayersForwards.java rename to examples/src/main/java/reference/TextGoLayersForwards.java index ce508c86..65bb8a23 100644 --- a/src/examples/java/reference/TextGoLayersForwards.java +++ b/examples/src/main/java/reference/TextGoLayersForwards.java @@ -24,11 +24,11 @@ public TextGoLayersForwards() { myStage.add(three); while (true) { - myStage.wait(1200); + myStage.waitSeconds(1.2); one.goLayersForwards(1); - myStage.wait(1200); + myStage.waitSeconds(1.2); one.goLayersForwards(1); - myStage.wait(1200); + myStage.waitSeconds(1.2); one.goLayersBackwards(2); } } diff --git a/src/examples/java/reference/TextGoToBackLayer.java b/examples/src/main/java/reference/TextGoToBackLayer.java similarity index 92% rename from src/examples/java/reference/TextGoToBackLayer.java rename to examples/src/main/java/reference/TextGoToBackLayer.java index 34e5ce7a..3726962c 100644 --- a/src/examples/java/reference/TextGoToBackLayer.java +++ b/examples/src/main/java/reference/TextGoToBackLayer.java @@ -19,9 +19,9 @@ public TextGoToBackLayer() { myStage.add(world); while (true) { - myStage.wait(1200); + myStage.waitSeconds(1.2); world.goToBackLayer(); - myStage.wait(1200); + myStage.waitSeconds(1.2); hello.goToBackLayer(); } } diff --git a/src/examples/java/reference/TextGoToFrontLayer.java b/examples/src/main/java/reference/TextGoToFrontLayer.java similarity index 92% rename from src/examples/java/reference/TextGoToFrontLayer.java rename to examples/src/main/java/reference/TextGoToFrontLayer.java index 5cb37ff1..76788924 100644 --- a/src/examples/java/reference/TextGoToFrontLayer.java +++ b/examples/src/main/java/reference/TextGoToFrontLayer.java @@ -19,9 +19,9 @@ public TextGoToFrontLayer() { myStage.add(world); while (true) { - myStage.wait(1200); + myStage.waitSeconds(1.2); hello.goToFrontLayer(); - myStage.wait(1200); + myStage.waitSeconds(1.2); world.goToFrontLayer(); } } diff --git a/src/examples/java/reference/TextIsUI.java b/examples/src/main/java/reference/TextIsUI.java similarity index 74% rename from src/examples/java/reference/TextIsUI.java rename to examples/src/main/java/reference/TextIsUI.java index d34a0273..b406f5c0 100644 --- a/src/examples/java/reference/TextIsUI.java +++ b/examples/src/main/java/reference/TextIsUI.java @@ -10,9 +10,9 @@ public TextIsUI() { Text myText = new Text("Hello World", 0, 0, 400); myStage.add(myText); - System.out.println("Moves with the camera: " + myText.isUI()); - myText.setIsUI(true); - System.out.println("Now a part of the interface: " + myText.isUI()); + System.out.println("Moves with the camera: " + myText.getLayer().equals(Layer.UI)); + myText.setLayer(Layer.UI); + System.out.println("Now a part of the interface: " + myText.getLayer().equals(Layer.UI)); } public static void main(String[] args) { diff --git a/src/examples/java/reference/TextNextFont.java b/examples/src/main/java/reference/TextNextFont.java similarity index 95% rename from src/examples/java/reference/TextNextFont.java rename to examples/src/main/java/reference/TextNextFont.java index c47abef7..069370e4 100644 --- a/src/examples/java/reference/TextNextFont.java +++ b/examples/src/main/java/reference/TextNextFont.java @@ -16,7 +16,7 @@ public TextNextFont() { while (true) { myText.nextFont(); myText.showText(myText.getCurrentFontName()); - myStage.wait(1500); + myStage.waitSeconds(1.5); } } diff --git a/src/examples/java/reference/TextRemove.java b/examples/src/main/java/reference/TextRemove.java similarity index 93% rename from src/examples/java/reference/TextRemove.java rename to examples/src/main/java/reference/TextRemove.java index 8d2c0463..1550a7a1 100644 --- a/src/examples/java/reference/TextRemove.java +++ b/examples/src/main/java/reference/TextRemove.java @@ -10,7 +10,7 @@ public TextRemove() { Text myText = new Text("Hello World", 0, 0, 400); myStage.add(myText); - myStage.wait(2000); + myStage.waitSeconds(2); // Takes the text off the stage again. myText.remove(); } diff --git a/src/examples/java/reference/TextSetAlign.java b/examples/src/main/java/reference/TextSetAlign.java similarity index 87% rename from src/examples/java/reference/TextSetAlign.java rename to examples/src/main/java/reference/TextSetAlign.java index 27a9314f..36319e94 100644 --- a/src/examples/java/reference/TextSetAlign.java +++ b/examples/src/main/java/reference/TextSetAlign.java @@ -16,11 +16,11 @@ public TextSetAlign() { // of the stage the whole time. while (true) { myText.setAlign(TextAlign.LEFT); - myStage.wait(1200); + myStage.waitSeconds(1.2); myText.setAlign(TextAlign.CENTER); - myStage.wait(1200); + myStage.waitSeconds(1.2); myText.setAlign(TextAlign.RIGHT); - myStage.wait(1200); + myStage.waitSeconds(1.2); } } diff --git a/src/examples/java/reference/TextSetBackgroundColor.java b/examples/src/main/java/reference/TextSetBackgroundColor.java similarity index 92% rename from src/examples/java/reference/TextSetBackgroundColor.java rename to examples/src/main/java/reference/TextSetBackgroundColor.java index 5ab8eb26..0f959cac 100644 --- a/src/examples/java/reference/TextSetBackgroundColor.java +++ b/examples/src/main/java/reference/TextSetBackgroundColor.java @@ -13,10 +13,10 @@ public TextSetBackgroundColor() { // The background is only drawn by the styles that have one. myText.setStyle(TextStyle.BOX); myText.setTextSize(32); - myStage.wait(1000); + myStage.waitSeconds(1); myText.setBackgroundColor(40, 40, 60); myText.setTextColor(255, 255, 255); - myStage.wait(1000); + myStage.waitSeconds(1); myText.setBackgroundColor(HtmlColor.GOLD); myText.setTextColor(60, 40, 0); } diff --git a/src/examples/java/reference/TextSetFont.java b/examples/src/main/java/reference/TextSetFont.java similarity index 100% rename from src/examples/java/reference/TextSetFont.java rename to examples/src/main/java/reference/TextSetFont.java diff --git a/src/examples/java/reference/TextSetIsUI.java b/examples/src/main/java/reference/TextSetIsUI.java similarity index 94% rename from src/examples/java/reference/TextSetIsUI.java rename to examples/src/main/java/reference/TextSetIsUI.java index bff70c5f..e71d8c89 100644 --- a/src/examples/java/reference/TextSetIsUI.java +++ b/examples/src/main/java/reference/TextSetIsUI.java @@ -13,7 +13,7 @@ public TextSetIsUI() { myStage.getCamera().setZoom(2); // A UI text ignores the camera, so it stays put and keeps its size while // everything else is zoomed in. - myText.setIsUI(true); + myText.setLayer(Layer.UI); } public static void main(String[] args) { diff --git a/src/examples/java/reference/TextSetPosition.java b/examples/src/main/java/reference/TextSetPosition.java similarity index 89% rename from src/examples/java/reference/TextSetPosition.java rename to examples/src/main/java/reference/TextSetPosition.java index 185bf215..04d2416f 100644 --- a/src/examples/java/reference/TextSetPosition.java +++ b/examples/src/main/java/reference/TextSetPosition.java @@ -10,9 +10,9 @@ public TextSetPosition() { Text myText = new Text("Hello World", 0, 0, 400); myStage.add(myText); - myStage.wait(1000); + myStage.waitSeconds(1); myText.setPosition(-150, 60); - myStage.wait(1000); + myStage.waitSeconds(1); // The same thing with a vector. myText.setPosition(new Vector2(150, -60)); } diff --git a/src/examples/java/reference/TextSetStrokeColor.java b/examples/src/main/java/reference/TextSetStrokeColor.java similarity index 95% rename from src/examples/java/reference/TextSetStrokeColor.java rename to examples/src/main/java/reference/TextSetStrokeColor.java index 8be0d09b..221105ea 100644 --- a/src/examples/java/reference/TextSetStrokeColor.java +++ b/examples/src/main/java/reference/TextSetStrokeColor.java @@ -14,7 +14,7 @@ public TextSetStrokeColor() { myText.setTextSize(32); // The line around the box. myText.setStrokeColor(220, 40, 40); - myStage.wait(1500); + myStage.waitSeconds(1.5); myText.setStrokeColor(HtmlColor.CORNFLOWER_BLUE); } diff --git a/src/examples/java/reference/TextSetStyle.java b/examples/src/main/java/reference/TextSetStyle.java similarity index 82% rename from src/examples/java/reference/TextSetStyle.java rename to examples/src/main/java/reference/TextSetStyle.java index 5125de06..34c9c1ac 100644 --- a/src/examples/java/reference/TextSetStyle.java +++ b/examples/src/main/java/reference/TextSetStyle.java @@ -13,13 +13,13 @@ public TextSetStyle() { // The four ways a text can look. while (true) { myText.setStyle(TextStyle.PLAIN); - myStage.wait(1500); + myStage.waitSeconds(1.5); myText.setStyle(TextStyle.BOX); - myStage.wait(1500); + myStage.waitSeconds(1.5); myText.setStyle(TextStyle.SPEAK); - myStage.wait(1500); + myStage.waitSeconds(1.5); myText.setStyle(TextStyle.THINK); - myStage.wait(1500); + myStage.waitSeconds(1.5); } } diff --git a/src/examples/java/reference/TextSetTextColor.java b/examples/src/main/java/reference/TextSetTextColor.java similarity index 72% rename from src/examples/java/reference/TextSetTextColor.java rename to examples/src/main/java/reference/TextSetTextColor.java index f7749ffc..897030ea 100644 --- a/src/examples/java/reference/TextSetTextColor.java +++ b/examples/src/main/java/reference/TextSetTextColor.java @@ -11,13 +11,13 @@ public TextSetTextColor() { myStage.add(myText); myText.setTextSize(32); - myStage.wait(1000); + myStage.waitSeconds(1); // Red, green and blue between 0 and 255 ... myText.setTextColor(220, 40, 40); - myStage.wait(1000); - // ... or a hue between 0 and 255 ... - myText.setTextColor(140); - myStage.wait(1000); + myStage.waitSeconds(1); + // ... or a colour built from a hue, a saturation and a brightness (0-100) ... + myText.setTextColor(Color.fromHSB(55, 100, 100)); + myStage.waitSeconds(1); // ... or a colour that already exists. myText.setTextColor(HtmlColor.CORNFLOWER_BLUE); } diff --git a/src/examples/java/reference/TextSetTextSize.java b/examples/src/main/java/reference/TextSetTextSize.java similarity index 87% rename from src/examples/java/reference/TextSetTextSize.java rename to examples/src/main/java/reference/TextSetTextSize.java index ecb17134..592eb828 100644 --- a/src/examples/java/reference/TextSetTextSize.java +++ b/examples/src/main/java/reference/TextSetTextSize.java @@ -14,11 +14,11 @@ public TextSetTextSize() { // rather than growing smoothly. while (true) { myText.setTextSize(16); - myStage.wait(1000); + myStage.waitSeconds(1); myText.setTextSize(32); - myStage.wait(1000); + myStage.waitSeconds(1); myText.setTextSize(64); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/TextSetWidth.java b/examples/src/main/java/reference/TextSetWidth.java similarity index 90% rename from src/examples/java/reference/TextSetWidth.java rename to examples/src/main/java/reference/TextSetWidth.java index 1bb718d0..8028a82d 100644 --- a/src/examples/java/reference/TextSetWidth.java +++ b/examples/src/main/java/reference/TextSetWidth.java @@ -15,9 +15,9 @@ public TextSetWidth() { // How wide the text may grow before it wraps onto the next line. while (true) { myText.setWidth(400); - myStage.wait(1500); + myStage.waitSeconds(1.5); myText.setWidth(150); - myStage.wait(1500); + myStage.waitSeconds(1.5); } } diff --git a/src/examples/java/reference/TextSetX.java b/examples/src/main/java/reference/TextSetX.java similarity index 87% rename from src/examples/java/reference/TextSetX.java rename to examples/src/main/java/reference/TextSetX.java index 7972f624..b4bd477a 100644 --- a/src/examples/java/reference/TextSetX.java +++ b/examples/src/main/java/reference/TextSetX.java @@ -12,9 +12,9 @@ public TextSetX() { while (true) { myText.setX(-200); - myStage.wait(1000); + myStage.waitSeconds(1); myText.setX(200); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/TextSetY.java b/examples/src/main/java/reference/TextSetY.java similarity index 87% rename from src/examples/java/reference/TextSetY.java rename to examples/src/main/java/reference/TextSetY.java index 39a34923..4ce58a4f 100644 --- a/src/examples/java/reference/TextSetY.java +++ b/examples/src/main/java/reference/TextSetY.java @@ -12,9 +12,9 @@ public TextSetY() { while (true) { myText.setY(-80); - myStage.wait(1000); + myStage.waitSeconds(1); myText.setY(80); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/TextShowText.java b/examples/src/main/java/reference/TextShowText.java similarity index 81% rename from src/examples/java/reference/TextShowText.java rename to examples/src/main/java/reference/TextShowText.java index 4caff589..ccb31b2e 100644 --- a/src/examples/java/reference/TextShowText.java +++ b/examples/src/main/java/reference/TextShowText.java @@ -10,11 +10,11 @@ public TextShowText() { Text myText = new Text("Hello World", 0, 0, 400); myStage.add(myText); - myStage.wait(1500); + myStage.waitSeconds(1.5); myText.showText("Something else"); - myStage.wait(1500); + myStage.waitSeconds(1.5); // With a time limit the text takes itself away again. - myText.showText("Only for a moment", 1500); + myText.showText("Only for a moment", 1.5); } public static void main(String[] args) { diff --git a/src/examples/java/reference/TextSwitchFont.java b/examples/src/main/java/reference/TextSwitchFont.java similarity index 91% rename from src/examples/java/reference/TextSwitchFont.java rename to examples/src/main/java/reference/TextSwitchFont.java index 8b582b08..19e89e2c 100644 --- a/src/examples/java/reference/TextSwitchFont.java +++ b/examples/src/main/java/reference/TextSwitchFont.java @@ -16,9 +16,9 @@ public TextSwitchFont() { // starts with. while (true) { myText.switchFont("serif"); - myStage.wait(1500); + myStage.waitSeconds(1.5); myText.switchFont(Text.getDefaultFont()); - myStage.wait(1500); + myStage.waitSeconds(1.5); } } diff --git a/src/examples/java/reference/TextUseFont.java b/examples/src/main/java/reference/TextUseFont.java similarity index 90% rename from src/examples/java/reference/TextUseFont.java rename to examples/src/main/java/reference/TextUseFont.java index d85c8ebd..84e80a5a 100644 --- a/src/examples/java/reference/TextUseFont.java +++ b/examples/src/main/java/reference/TextUseFont.java @@ -6,12 +6,13 @@ public class TextUseFont { public TextUseFont() { // One font for every text in the program, chosen before the first stage // is built - the fonts are loaded as the window opens. - Text.useFont("serif", 32); + Text.useFont("serif"); Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); Text myText = new Text("Hello World", 0, 0, 400); + myText.setTextSize(32); myStage.add(myText); } diff --git a/src/examples/java/reference/TextWhenAddedToStage.java b/examples/src/main/java/reference/TextWhenAddedToStage.java similarity index 100% rename from src/examples/java/reference/TextWhenAddedToStage.java rename to examples/src/main/java/reference/TextWhenAddedToStage.java diff --git a/src/examples/java/reference/TextWhenRemovedFromStage.java b/examples/src/main/java/reference/TextWhenRemovedFromStage.java similarity index 95% rename from src/examples/java/reference/TextWhenRemovedFromStage.java rename to examples/src/main/java/reference/TextWhenRemovedFromStage.java index c9246b9b..e1f14b69 100644 --- a/src/examples/java/reference/TextWhenRemovedFromStage.java +++ b/examples/src/main/java/reference/TextWhenRemovedFromStage.java @@ -20,7 +20,7 @@ public void whenRemovedFromStage() { myWindow.setStage(myStage); MyText myText = new MyText(); myStage.add(myText); - myStage.wait(2000); + myStage.waitSeconds(2); myText.remove(); } diff --git a/src/examples/java/reference/TiledMapData.java b/examples/src/main/java/reference/TiledMapData.java similarity index 94% rename from src/examples/java/reference/TiledMapData.java rename to examples/src/main/java/reference/TiledMapData.java index 8f77ee89..0e4e1057 100644 --- a/src/examples/java/reference/TiledMapData.java +++ b/examples/src/main/java/reference/TiledMapData.java @@ -1,7 +1,7 @@ package reference; import org.openpatch.scratch.Shape; -import org.openpatch.scratch.extensions.tiled.TiledMap; +import org.openpatch.scratch.tiled.TiledMap; /** * Reading map data does not need a window. diff --git a/src/examples/java/reference/TiledMapRender.java b/examples/src/main/java/reference/TiledMapRender.java similarity index 88% rename from src/examples/java/reference/TiledMapRender.java rename to examples/src/main/java/reference/TiledMapRender.java index 869dbac7..54e67d6c 100644 --- a/src/examples/java/reference/TiledMapRender.java +++ b/examples/src/main/java/reference/TiledMapRender.java @@ -1,6 +1,6 @@ package reference; import org.openpatch.scratch.Stage; -import org.openpatch.scratch.extensions.tiled.TiledMap; +import org.openpatch.scratch.tiled.TiledMap; import org.openpatch.scratch.Window; public class TiledMapRender { diff --git a/src/examples/java/reference/TiledSpawn.java b/examples/src/main/java/reference/TiledSpawn.java similarity index 93% rename from src/examples/java/reference/TiledSpawn.java rename to examples/src/main/java/reference/TiledSpawn.java index 585da64a..4a7e9014 100644 --- a/src/examples/java/reference/TiledSpawn.java +++ b/examples/src/main/java/reference/TiledSpawn.java @@ -1,7 +1,7 @@ package reference; import org.openpatch.scratch.*; -import org.openpatch.scratch.extensions.tiled.*; +import org.openpatch.scratch.tiled.*; /** @example.online false */ public class TiledSpawn { diff --git a/src/examples/java/reference/TimerAfterMillis.java b/examples/src/main/java/reference/TimerAfterMillis.java similarity index 92% rename from src/examples/java/reference/TimerAfterMillis.java rename to examples/src/main/java/reference/TimerAfterMillis.java index 58f6ac3b..f7dcafcb 100644 --- a/src/examples/java/reference/TimerAfterMillis.java +++ b/examples/src/main/java/reference/TimerAfterMillis.java @@ -10,7 +10,7 @@ public TimerAfterMillis() { Timer myTimer = new Timer(); while (true) { myStage.display("Waiting..."); - if (myTimer.afterMillis(3000)) { + if (myTimer.after(3)) { break; } } diff --git a/src/examples/java/reference/TimerConstructors.java b/examples/src/main/java/reference/TimerConstructors.java similarity index 89% rename from src/examples/java/reference/TimerConstructors.java rename to examples/src/main/java/reference/TimerConstructors.java index 646b4180..f4e2700d 100644 --- a/src/examples/java/reference/TimerConstructors.java +++ b/examples/src/main/java/reference/TimerConstructors.java @@ -13,10 +13,10 @@ public TimerConstructors() { // A timer of your own, counting from the moment it is built. Timer myTimer = new Timer(); while (true) { - if (myTimer.everyMillis(1000)) { + if (myTimer.every(1)) { mySprite.nextCostume(); } - myStage.wait(10); + myStage.waitSeconds(0.01); } } diff --git a/src/examples/java/reference/TimerEveryMillis.java b/examples/src/main/java/reference/TimerEveryMillis.java similarity index 83% rename from src/examples/java/reference/TimerEveryMillis.java rename to examples/src/main/java/reference/TimerEveryMillis.java index 9987c20b..df97aec1 100644 --- a/src/examples/java/reference/TimerEveryMillis.java +++ b/examples/src/main/java/reference/TimerEveryMillis.java @@ -9,8 +9,8 @@ public TimerEveryMillis() { myWindow.setStage(myStage); Timer myTimer = new Timer(); int i = 0; - while (myStage.getTimer().forMillis(3000)) { - if (myTimer.everyMillis(500)) { + while (myStage.getTimer().during(3)) { + if (myTimer.every(0.5)) { myStage.display("Count: " + i++); } } diff --git a/src/examples/java/reference/TimerForMillis.java b/examples/src/main/java/reference/TimerForMillis.java similarity index 83% rename from src/examples/java/reference/TimerForMillis.java rename to examples/src/main/java/reference/TimerForMillis.java index f92ad10e..d53fec59 100644 --- a/src/examples/java/reference/TimerForMillis.java +++ b/examples/src/main/java/reference/TimerForMillis.java @@ -9,13 +9,13 @@ public TimerForMillis() { myWindow.setStage(myStage); Timer myTimer = new Timer(); myStage.display("Start!"); - myStage.wait(500); - while (myTimer.forMillis(1000)) { + myStage.waitSeconds(0.5); + while (myTimer.during(1)) { myStage.display("Running..."); } ; myStage.display("Stop!"); - myStage.wait(500); + myStage.waitSeconds(0.5); } public static void main(String[] args) { diff --git a/src/examples/java/reference/TimerIntervalMillis.java b/examples/src/main/java/reference/TimerIntervalMillis.java similarity index 84% rename from src/examples/java/reference/TimerIntervalMillis.java rename to examples/src/main/java/reference/TimerIntervalMillis.java index 426fccc0..4bff7112 100644 --- a/src/examples/java/reference/TimerIntervalMillis.java +++ b/examples/src/main/java/reference/TimerIntervalMillis.java @@ -8,8 +8,8 @@ public TimerIntervalMillis() { Stage myStage = new Stage(); myWindow.setStage(myStage); Timer myTimer = new Timer(); - while (myStage.getTimer().forMillis(3000)) { - if (myTimer.intervalMillis(500)) { + while (myStage.getTimer().during(3)) { + if (myTimer.interval(0.5)) { myStage.display("Interval 1"); } else { myStage.display("Interval 2"); diff --git a/src/examples/java/reference/TimerIntervalMillis2.java b/examples/src/main/java/reference/TimerIntervalMillis2.java similarity index 83% rename from src/examples/java/reference/TimerIntervalMillis2.java rename to examples/src/main/java/reference/TimerIntervalMillis2.java index d60bb433..c0a42a25 100644 --- a/src/examples/java/reference/TimerIntervalMillis2.java +++ b/examples/src/main/java/reference/TimerIntervalMillis2.java @@ -8,8 +8,8 @@ public TimerIntervalMillis2() { Stage myStage = new Stage(); myWindow.setStage(myStage); Timer myTimer = new Timer(); - while (myStage.getTimer().forMillis(3000)) { - if (myTimer.intervalMillis(500, 1000)) { + while (myStage.getTimer().during(3)) { + if (myTimer.interval(0.5, 1)) { myStage.display("Interval 1"); } else { myStage.display("Interval 2"); diff --git a/src/examples/java/reference/TimerReset.java b/examples/src/main/java/reference/TimerReset.java similarity index 81% rename from src/examples/java/reference/TimerReset.java rename to examples/src/main/java/reference/TimerReset.java index 3f5d6a4d..88b6f64f 100644 --- a/src/examples/java/reference/TimerReset.java +++ b/examples/src/main/java/reference/TimerReset.java @@ -9,18 +9,18 @@ public TimerReset() { myWindow.setStage(myStage); Timer myTimer = new Timer(); myStage.display("Start!"); - myStage.wait(500); - while (myTimer.forMillis(1000)) { + myStage.waitSeconds(0.5); + while (myTimer.during(1)) { myStage.display("Running 1st..."); } ; myTimer.reset(); - while (myTimer.forMillis(1000)) { + while (myTimer.during(1)) { myStage.display("Running 2nd..."); } ; myStage.display("Stop!"); - myStage.wait(500); + myStage.waitSeconds(0.5); } public static void main(String[] args) { diff --git a/src/examples/java/reference/TriangleConstructors.java b/examples/src/main/java/reference/TriangleConstructors.java similarity index 92% rename from src/examples/java/reference/TriangleConstructors.java rename to examples/src/main/java/reference/TriangleConstructors.java index e17bb399..c6391dae 100644 --- a/src/examples/java/reference/TriangleConstructors.java +++ b/examples/src/main/java/reference/TriangleConstructors.java @@ -7,7 +7,7 @@ public TriangleConstructors() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.setDebug(true); + Window.getInstance().setDebug(true); Sprite mySprite = new Sprite("slime", "slimeGreen"); myStage.add(mySprite); diff --git a/src/examples/java/reference/UISpriteChangeHeight.java b/examples/src/main/java/reference/UISpriteChangeHeight.java similarity index 81% rename from src/examples/java/reference/UISpriteChangeHeight.java rename to examples/src/main/java/reference/UISpriteChangeHeight.java index d36a915a..6c4905bd 100644 --- a/src/examples/java/reference/UISpriteChangeHeight.java +++ b/examples/src/main/java/reference/UISpriteChangeHeight.java @@ -7,18 +7,19 @@ public UISpriteChangeHeight() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - UISprite myBar = new UISprite(); + Sprite myBar = new Sprite(); + myBar.setLayer(Layer.UI); myBar.addCostume("bar", "buttonLarge"); myBar.setHeight(20); myStage.add(myBar); while (true) { while (myBar.getHeight() < 160) { myBar.changeHeight(4); - myStage.wait(100); + myStage.waitSeconds(0.1); } while (myBar.getHeight() > 20) { myBar.changeHeight(-4); - myStage.wait(100); + myStage.waitSeconds(0.1); } } } diff --git a/src/examples/java/reference/UISpriteChangeWidth.java b/examples/src/main/java/reference/UISpriteChangeWidth.java similarity index 83% rename from src/examples/java/reference/UISpriteChangeWidth.java rename to examples/src/main/java/reference/UISpriteChangeWidth.java index 6cb2ed22..d1f79091 100644 --- a/src/examples/java/reference/UISpriteChangeWidth.java +++ b/examples/src/main/java/reference/UISpriteChangeWidth.java @@ -7,7 +7,8 @@ public UISpriteChangeWidth() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - UISprite myBar = new UISprite(); + Sprite myBar = new Sprite(); + myBar.setLayer(Layer.UI); myBar.addCostume("bar", "buttonLarge"); myBar.setWidth(100); myStage.add(myBar); @@ -15,11 +16,11 @@ public UISpriteChangeWidth() { while (true) { while (myBar.getWidth() < 400) { myBar.changeWidth(10); - myStage.wait(100); + myStage.waitSeconds(0.1); } while (myBar.getWidth() > 100) { myBar.changeWidth(-10); - myStage.wait(100); + myStage.waitSeconds(0.1); } } } diff --git a/src/examples/java/reference/UISpriteConstructors.java b/examples/src/main/java/reference/UISpriteConstructors.java similarity index 90% rename from src/examples/java/reference/UISpriteConstructors.java rename to examples/src/main/java/reference/UISpriteConstructors.java index 59d0b4d8..0cd0910a 100644 --- a/src/examples/java/reference/UISpriteConstructors.java +++ b/examples/src/main/java/reference/UISpriteConstructors.java @@ -11,7 +11,8 @@ public UISpriteConstructors() { // A UI sprite ignores the camera, which is what makes it useful for a // button or a health bar: it keeps its place and its size while the world // behind it moves. - UISprite myButton = new UISprite(); + Sprite myButton = new Sprite(); + myButton.setLayer(Layer.UI); myButton.addCostume("button", "buttonLarge"); myButton.setPosition(0, -80); myStage.add(myButton); diff --git a/src/examples/java/reference/UISpriteDisableNineSlice.java b/examples/src/main/java/reference/UISpriteDisableNineSlice.java similarity index 82% rename from src/examples/java/reference/UISpriteDisableNineSlice.java rename to examples/src/main/java/reference/UISpriteDisableNineSlice.java index 582f6331..a0b07ae8 100644 --- a/src/examples/java/reference/UISpriteDisableNineSlice.java +++ b/examples/src/main/java/reference/UISpriteDisableNineSlice.java @@ -7,7 +7,8 @@ public UISpriteDisableNineSlice() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - UISprite myPanel = new UISprite(); + Sprite myPanel = new Sprite(); + myPanel.setLayer(Layer.UI); myPanel.addCostume("panel", "buttonLarge"); myPanel.setWidth(420); myStage.add(myPanel); @@ -15,9 +16,9 @@ public UISpriteDisableNineSlice() { // costume is stretched. while (true) { myPanel.setNineSlice(6, 6, 6, 6); - myStage.wait(1500); + myStage.waitSeconds(1.5); myPanel.disableNineSlice(); - myStage.wait(1500); + myStage.waitSeconds(1.5); } } diff --git a/src/examples/java/reference/UISpriteSetHeight.java b/examples/src/main/java/reference/UISpriteSetHeight.java similarity index 78% rename from src/examples/java/reference/UISpriteSetHeight.java rename to examples/src/main/java/reference/UISpriteSetHeight.java index 182d3c4c..75773c40 100644 --- a/src/examples/java/reference/UISpriteSetHeight.java +++ b/examples/src/main/java/reference/UISpriteSetHeight.java @@ -7,14 +7,15 @@ public UISpriteSetHeight() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - UISprite myBar = new UISprite(); + Sprite myBar = new Sprite(); + myBar.setLayer(Layer.UI); myBar.addCostume("bar", "buttonLarge"); myStage.add(myBar); while (true) { myBar.setHeight(40); - myStage.wait(1000); + myStage.waitSeconds(1); myBar.setHeight(120); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/UISpriteSetNineSlice.java b/examples/src/main/java/reference/UISpriteSetNineSlice.java similarity index 83% rename from src/examples/java/reference/UISpriteSetNineSlice.java rename to examples/src/main/java/reference/UISpriteSetNineSlice.java index dd4c0941..8855abc1 100644 --- a/src/examples/java/reference/UISpriteSetNineSlice.java +++ b/examples/src/main/java/reference/UISpriteSetNineSlice.java @@ -7,7 +7,8 @@ public UISpriteSetNineSlice() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - UISprite myPanel = new UISprite(); + Sprite myPanel = new Sprite(); + myPanel.setLayer(Layer.UI); myPanel.addCostume("panel", "buttonLarge"); myStage.add(myPanel); // Nine-slicing keeps the corners of the costume their own size and stretches @@ -15,9 +16,9 @@ public UISpriteSetNineSlice() { myPanel.setNineSlice(6, 6, 6, 6); while (true) { myPanel.setWidth(150); - myStage.wait(1200); + myStage.waitSeconds(1.2); myPanel.setWidth(420); - myStage.wait(1200); + myStage.waitSeconds(1.2); } } diff --git a/src/examples/java/reference/UISpriteSetWidth.java b/examples/src/main/java/reference/UISpriteSetWidth.java similarity index 81% rename from src/examples/java/reference/UISpriteSetWidth.java rename to examples/src/main/java/reference/UISpriteSetWidth.java index 705b36be..94b58527 100644 --- a/src/examples/java/reference/UISpriteSetWidth.java +++ b/examples/src/main/java/reference/UISpriteSetWidth.java @@ -7,15 +7,16 @@ public UISpriteSetWidth() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - UISprite myBar = new UISprite(); + Sprite myBar = new Sprite(); + myBar.setLayer(Layer.UI); myBar.addCostume("bar", "buttonLarge"); myStage.add(myBar); // A UI sprite is measured in pixels rather than scaled in percent. while (true) { myBar.setWidth(120); - myStage.wait(1000); + myStage.waitSeconds(1); myBar.setWidth(360); - myStage.wait(1000); + myStage.waitSeconds(1); } } diff --git a/src/examples/java/reference/Vector2Add.java b/examples/src/main/java/reference/Vector2Add.java similarity index 100% rename from src/examples/java/reference/Vector2Add.java rename to examples/src/main/java/reference/Vector2Add.java diff --git a/src/examples/java/reference/Vector2Angle.java b/examples/src/main/java/reference/Vector2Angle.java similarity index 100% rename from src/examples/java/reference/Vector2Angle.java rename to examples/src/main/java/reference/Vector2Angle.java diff --git a/src/examples/java/reference/Vector2Clone.java b/examples/src/main/java/reference/Vector2Clone.java similarity index 100% rename from src/examples/java/reference/Vector2Clone.java rename to examples/src/main/java/reference/Vector2Clone.java diff --git a/src/examples/java/reference/Vector2Constructors.java b/examples/src/main/java/reference/Vector2Constructors.java similarity index 100% rename from src/examples/java/reference/Vector2Constructors.java rename to examples/src/main/java/reference/Vector2Constructors.java diff --git a/src/examples/java/reference/Vector2Distance.java b/examples/src/main/java/reference/Vector2Distance.java similarity index 100% rename from src/examples/java/reference/Vector2Distance.java rename to examples/src/main/java/reference/Vector2Distance.java diff --git a/src/examples/java/reference/Vector2DistanceSq.java b/examples/src/main/java/reference/Vector2DistanceSq.java similarity index 100% rename from src/examples/java/reference/Vector2DistanceSq.java rename to examples/src/main/java/reference/Vector2DistanceSq.java diff --git a/src/examples/java/reference/Vector2Dot.java b/examples/src/main/java/reference/Vector2Dot.java similarity index 100% rename from src/examples/java/reference/Vector2Dot.java rename to examples/src/main/java/reference/Vector2Dot.java diff --git a/src/examples/java/reference/Vector2Equals.java b/examples/src/main/java/reference/Vector2Equals.java similarity index 100% rename from src/examples/java/reference/Vector2Equals.java rename to examples/src/main/java/reference/Vector2Equals.java diff --git a/src/examples/java/reference/Vector2FromPolar.java b/examples/src/main/java/reference/Vector2FromPolar.java similarity index 100% rename from src/examples/java/reference/Vector2FromPolar.java rename to examples/src/main/java/reference/Vector2FromPolar.java diff --git a/src/examples/java/reference/Vector2GetX.java b/examples/src/main/java/reference/Vector2GetX.java similarity index 100% rename from src/examples/java/reference/Vector2GetX.java rename to examples/src/main/java/reference/Vector2GetX.java diff --git a/src/examples/java/reference/Vector2GetY.java b/examples/src/main/java/reference/Vector2GetY.java similarity index 100% rename from src/examples/java/reference/Vector2GetY.java rename to examples/src/main/java/reference/Vector2GetY.java diff --git a/src/examples/java/reference/Vector2HashCode.java b/examples/src/main/java/reference/Vector2HashCode.java similarity index 100% rename from src/examples/java/reference/Vector2HashCode.java rename to examples/src/main/java/reference/Vector2HashCode.java diff --git a/src/examples/java/reference/Vector2Length.java b/examples/src/main/java/reference/Vector2Length.java similarity index 100% rename from src/examples/java/reference/Vector2Length.java rename to examples/src/main/java/reference/Vector2Length.java diff --git a/src/examples/java/reference/Vector2LengthSq.java b/examples/src/main/java/reference/Vector2LengthSq.java similarity index 100% rename from src/examples/java/reference/Vector2LengthSq.java rename to examples/src/main/java/reference/Vector2LengthSq.java diff --git a/src/examples/java/reference/Vector2Multiply.java b/examples/src/main/java/reference/Vector2Multiply.java similarity index 100% rename from src/examples/java/reference/Vector2Multiply.java rename to examples/src/main/java/reference/Vector2Multiply.java diff --git a/src/examples/java/reference/Vector2NormalVector.java b/examples/src/main/java/reference/Vector2NormalVector.java similarity index 100% rename from src/examples/java/reference/Vector2NormalVector.java rename to examples/src/main/java/reference/Vector2NormalVector.java diff --git a/src/examples/java/reference/Vector2Reverse.java b/examples/src/main/java/reference/Vector2Reverse.java similarity index 100% rename from src/examples/java/reference/Vector2Reverse.java rename to examples/src/main/java/reference/Vector2Reverse.java diff --git a/src/examples/java/reference/Vector2RotateBy.java b/examples/src/main/java/reference/Vector2RotateBy.java similarity index 100% rename from src/examples/java/reference/Vector2RotateBy.java rename to examples/src/main/java/reference/Vector2RotateBy.java diff --git a/src/examples/java/reference/Vector2RotateTo.java b/examples/src/main/java/reference/Vector2RotateTo.java similarity index 100% rename from src/examples/java/reference/Vector2RotateTo.java rename to examples/src/main/java/reference/Vector2RotateTo.java diff --git a/src/examples/java/reference/Vector2Sub.java b/examples/src/main/java/reference/Vector2Sub.java similarity index 100% rename from src/examples/java/reference/Vector2Sub.java rename to examples/src/main/java/reference/Vector2Sub.java diff --git a/src/examples/java/reference/Vector2ToString.java b/examples/src/main/java/reference/Vector2ToString.java similarity index 100% rename from src/examples/java/reference/Vector2ToString.java rename to examples/src/main/java/reference/Vector2ToString.java diff --git a/src/examples/java/reference/Vector2UnitVector.java b/examples/src/main/java/reference/Vector2UnitVector.java similarity index 100% rename from src/examples/java/reference/Vector2UnitVector.java rename to examples/src/main/java/reference/Vector2UnitVector.java diff --git a/src/examples/java/reference/WindowConstructors.java b/examples/src/main/java/reference/WindowConstructors.java similarity index 100% rename from src/examples/java/reference/WindowConstructors.java rename to examples/src/main/java/reference/WindowConstructors.java diff --git a/src/examples/java/reference/WindowDebug.java b/examples/src/main/java/reference/WindowDebug.java similarity index 65% rename from src/examples/java/reference/WindowDebug.java rename to examples/src/main/java/reference/WindowDebug.java index ab6ec6a6..b92cc4ba 100644 --- a/src/examples/java/reference/WindowDebug.java +++ b/examples/src/main/java/reference/WindowDebug.java @@ -8,10 +8,10 @@ public WindowDebug() { Stage myStage = new Stage(); myWindow.setStage(myStage); myWindow.setDebug(true); - // Values written onto the window while it runs. + // Values written onto the window while it runs. (F12 shows the frame rate.) while (true) { - myWindow.debug("frames per second", myStage.getFrameRate()); - myStage.wait(200); + myWindow.debug("seconds", myStage.getTimer().getSeconds()); + myStage.waitSeconds(0.2); } } diff --git a/src/examples/java/reference/WindowExit.java b/examples/src/main/java/reference/WindowExit.java similarity index 92% rename from src/examples/java/reference/WindowExit.java rename to examples/src/main/java/reference/WindowExit.java index b4454d7c..5a734431 100644 --- a/src/examples/java/reference/WindowExit.java +++ b/examples/src/main/java/reference/WindowExit.java @@ -6,7 +6,7 @@ public WindowExit() { Window myWindow = new Window(600, 240); Stage myStage = new Stage(); myWindow.setStage(myStage); - myStage.wait(3000); + myStage.waitSeconds(3); // Closes the window and ends the program. myWindow.exit(); } diff --git a/src/examples/java/reference/WindowGetHeight.java b/examples/src/main/java/reference/WindowGetHeight.java similarity index 100% rename from src/examples/java/reference/WindowGetHeight.java rename to examples/src/main/java/reference/WindowGetHeight.java diff --git a/src/examples/java/reference/WindowGetInstance.java b/examples/src/main/java/reference/WindowGetInstance.java similarity index 100% rename from src/examples/java/reference/WindowGetInstance.java rename to examples/src/main/java/reference/WindowGetInstance.java diff --git a/src/examples/java/reference/WindowGetLibraryTitle.java b/examples/src/main/java/reference/WindowGetLibraryTitle.java similarity index 100% rename from src/examples/java/reference/WindowGetLibraryTitle.java rename to examples/src/main/java/reference/WindowGetLibraryTitle.java diff --git a/src/examples/java/reference/WindowGetLibraryVersion.java b/examples/src/main/java/reference/WindowGetLibraryVersion.java similarity index 100% rename from src/examples/java/reference/WindowGetLibraryVersion.java rename to examples/src/main/java/reference/WindowGetLibraryVersion.java diff --git a/src/examples/java/reference/WindowGetStage.java b/examples/src/main/java/reference/WindowGetStage.java similarity index 100% rename from src/examples/java/reference/WindowGetStage.java rename to examples/src/main/java/reference/WindowGetStage.java diff --git a/src/examples/java/reference/WindowGetWidth.java b/examples/src/main/java/reference/WindowGetWidth.java similarity index 100% rename from src/examples/java/reference/WindowGetWidth.java rename to examples/src/main/java/reference/WindowGetWidth.java diff --git a/src/examples/java/reference/WindowIsDebug.java b/examples/src/main/java/reference/WindowIsDebug.java similarity index 100% rename from src/examples/java/reference/WindowIsDebug.java rename to examples/src/main/java/reference/WindowIsDebug.java diff --git a/src/examples/java/reference/WindowPause.java b/examples/src/main/java/reference/WindowPause.java similarity index 100% rename from src/examples/java/reference/WindowPause.java rename to examples/src/main/java/reference/WindowPause.java diff --git a/src/examples/java/reference/WindowSetDebug.java b/examples/src/main/java/reference/WindowSetDebug.java similarity index 100% rename from src/examples/java/reference/WindowSetDebug.java rename to examples/src/main/java/reference/WindowSetDebug.java diff --git a/src/examples/java/reference/WindowSetGameSpeed.java b/examples/src/main/java/reference/WindowSetGameSpeed.java similarity index 100% rename from src/examples/java/reference/WindowSetGameSpeed.java rename to examples/src/main/java/reference/WindowSetGameSpeed.java diff --git a/src/examples/java/reference/WindowSetStage.java b/examples/src/main/java/reference/WindowSetStage.java similarity index 91% rename from src/examples/java/reference/WindowSetStage.java rename to examples/src/main/java/reference/WindowSetStage.java index 0e6134fa..fd80d5d4 100644 --- a/src/examples/java/reference/WindowSetStage.java +++ b/examples/src/main/java/reference/WindowSetStage.java @@ -17,9 +17,9 @@ public WindowSetStage() { // in place of the one before it. while (true) { myWindow.setStage(secondLevel); - secondLevel.wait(2000); + secondLevel.waitSeconds(2); myWindow.setStage(firstLevel); - firstLevel.wait(2000); + firstLevel.waitSeconds(2); } } diff --git a/src/examples/java/reference/WindowStep.java b/examples/src/main/java/reference/WindowStep.java similarity index 100% rename from src/examples/java/reference/WindowStep.java rename to examples/src/main/java/reference/WindowStep.java diff --git a/src/examples/java/reference/WindowTransitionToStage.java b/examples/src/main/java/reference/WindowTransitionToStage.java similarity index 69% rename from src/examples/java/reference/WindowTransitionToStage.java rename to examples/src/main/java/reference/WindowTransitionToStage.java index 7098bfc6..211295ba 100644 --- a/src/examples/java/reference/WindowTransitionToStage.java +++ b/examples/src/main/java/reference/WindowTransitionToStage.java @@ -6,13 +6,13 @@ public class WindowTransitionToStage { public WindowTransitionToStage() { Window myWindow = new Window(600, 240); Stage first = new Stage(); - first.setColor(140); + first.setColor(Color.fromHSB(55, 100, 100)); Stage second = new Stage(); - second.setColor(20); + second.setColor(Color.fromHSB(8, 100, 100)); myWindow.setStage(first); - first.wait(1500); - // The same as switching, but fading over the given number of milliseconds. - myWindow.transitionToStage(second, 1000); + first.waitSeconds(1.5); + // The same as switching, but fading over the given number of seconds. + myWindow.transitionToStage(second, 1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/WindowTransitionToStageSupplier.java b/examples/src/main/java/reference/WindowTransitionToStageSupplier.java similarity index 80% rename from src/examples/java/reference/WindowTransitionToStageSupplier.java rename to examples/src/main/java/reference/WindowTransitionToStageSupplier.java index 46f86370..79ebed87 100644 --- a/src/examples/java/reference/WindowTransitionToStageSupplier.java +++ b/examples/src/main/java/reference/WindowTransitionToStageSupplier.java @@ -6,17 +6,17 @@ public class WindowTransitionToStageSupplier { public WindowTransitionToStageSupplier() { Window window = new Window(600, 240); Stage first = new Stage(); - first.setColor(140); + first.setColor(Color.fromHSB(55, 100, 100)); window.setStage(first); - first.wait(1500); + first.waitSeconds(1.5); // Build the next stage only when the screen is black. // Further requests during the fade never call their supplier. window.transitionToStage(() -> { Stage next = new Stage(); - next.setColor(20); + next.setColor(Color.fromHSB(8, 100, 100)); return next; - }, 1000); + }, 1); } public static void main(String[] args) { diff --git a/src/examples/java/reference/WindowUseFullScreen.java b/examples/src/main/java/reference/WindowUseFullScreen.java similarity index 100% rename from src/examples/java/reference/WindowUseFullScreen.java rename to examples/src/main/java/reference/WindowUseFullScreen.java diff --git a/src/examples/java/reference/WindowUseSplashLogo.java b/examples/src/main/java/reference/WindowUseSplashLogo.java similarity index 100% rename from src/examples/java/reference/WindowUseSplashLogo.java rename to examples/src/main/java/reference/WindowUseSplashLogo.java diff --git a/src/examples/java/reference/WindowUseTextureSampling.java b/examples/src/main/java/reference/WindowUseTextureSampling.java similarity index 91% rename from src/examples/java/reference/WindowUseTextureSampling.java rename to examples/src/main/java/reference/WindowUseTextureSampling.java index 4a1afd10..c5b5d9cb 100644 --- a/src/examples/java/reference/WindowUseTextureSampling.java +++ b/examples/src/main/java/reference/WindowUseTextureSampling.java @@ -6,7 +6,7 @@ public class WindowUseTextureSampling { public WindowUseTextureSampling() { // POINT keeps the pixels of a costume square when it is scaled up, which // is what pixel art wants. It has to be said before the window is built. - Window.useTextureSampling(TextureSampling.POINT); + Window.usePixelArt(); Window myWindow = new Window(600, 240); Stage myStage = new Stage(); Sprite mySprite = new Sprite("slime", "slimeGreen"); diff --git a/src/examples/java/reference/WindowWhenExits.java b/examples/src/main/java/reference/WindowWhenExits.java similarity index 93% rename from src/examples/java/reference/WindowWhenExits.java rename to examples/src/main/java/reference/WindowWhenExits.java index 7a7c471e..8cb9c78c 100644 --- a/src/examples/java/reference/WindowWhenExits.java +++ b/examples/src/main/java/reference/WindowWhenExits.java @@ -17,7 +17,7 @@ public void whenExits() { } MyWindow myWindow = new MyWindow(); - myWindow.getStage().wait(3000); + myWindow.getStage().waitSeconds(3); myWindow.exit(); } diff --git a/src/examples/java/reference/assets/background_forest.png b/examples/src/main/java/reference/assets/background_forest.png similarity index 100% rename from src/examples/java/reference/assets/background_forest.png rename to examples/src/main/java/reference/assets/background_forest.png diff --git a/src/examples/java/reference/assets/background_sea.png b/examples/src/main/java/reference/assets/background_sea.png similarity index 100% rename from src/examples/java/reference/assets/background_sea.png rename to examples/src/main/java/reference/assets/background_sea.png diff --git a/src/examples/java/reference/assets/bee_idle.png b/examples/src/main/java/reference/assets/bee_idle.png similarity index 100% rename from src/examples/java/reference/assets/bee_idle.png rename to examples/src/main/java/reference/assets/bee_idle.png diff --git a/src/examples/java/reference/assets/bitmap-font/048.png b/examples/src/main/java/reference/assets/bitmap-font/048.png similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/048.png rename to examples/src/main/java/reference/assets/bitmap-font/048.png diff --git a/src/examples/java/reference/assets/bitmap-font/049.png b/examples/src/main/java/reference/assets/bitmap-font/049.png similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/049.png rename to examples/src/main/java/reference/assets/bitmap-font/049.png diff --git a/src/examples/java/reference/assets/bitmap-font/050.png b/examples/src/main/java/reference/assets/bitmap-font/050.png similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/050.png rename to examples/src/main/java/reference/assets/bitmap-font/050.png diff --git a/src/examples/java/reference/assets/bitmap-font/051.png b/examples/src/main/java/reference/assets/bitmap-font/051.png similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/051.png rename to examples/src/main/java/reference/assets/bitmap-font/051.png diff --git a/src/examples/java/reference/assets/bitmap-font/052.png b/examples/src/main/java/reference/assets/bitmap-font/052.png similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/052.png rename to examples/src/main/java/reference/assets/bitmap-font/052.png diff --git a/src/examples/java/reference/assets/bitmap-font/053.png b/examples/src/main/java/reference/assets/bitmap-font/053.png similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/053.png rename to examples/src/main/java/reference/assets/bitmap-font/053.png diff --git a/src/examples/java/reference/assets/bitmap-font/054.png b/examples/src/main/java/reference/assets/bitmap-font/054.png similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/054.png rename to examples/src/main/java/reference/assets/bitmap-font/054.png diff --git a/src/examples/java/reference/assets/bitmap-font/055.png b/examples/src/main/java/reference/assets/bitmap-font/055.png similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/055.png rename to examples/src/main/java/reference/assets/bitmap-font/055.png diff --git a/src/examples/java/reference/assets/bitmap-font/056.png b/examples/src/main/java/reference/assets/bitmap-font/056.png similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/056.png rename to examples/src/main/java/reference/assets/bitmap-font/056.png diff --git a/src/examples/java/reference/assets/bitmap-font/057.png b/examples/src/main/java/reference/assets/bitmap-font/057.png similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/057.png rename to examples/src/main/java/reference/assets/bitmap-font/057.png diff --git a/src/examples/java/reference/assets/bitmap-font/README.md b/examples/src/main/java/reference/assets/bitmap-font/README.md similarity index 100% rename from src/examples/java/reference/assets/bitmap-font/README.md rename to examples/src/main/java/reference/assets/bitmap-font/README.md diff --git a/src/examples/java/reference/assets/bump.wav b/examples/src/main/java/reference/assets/bump.wav similarity index 100% rename from src/examples/java/reference/assets/bump.wav rename to examples/src/main/java/reference/assets/bump.wav diff --git a/src/examples/java/reference/assets/cursor_hand.png b/examples/src/main/java/reference/assets/cursor_hand.png similarity index 100% rename from src/examples/java/reference/assets/cursor_hand.png rename to examples/src/main/java/reference/assets/cursor_hand.png diff --git a/src/examples/java/reference/assets/cursor_sword.png b/examples/src/main/java/reference/assets/cursor_sword.png similarity index 100% rename from src/examples/java/reference/assets/cursor_sword.png rename to examples/src/main/java/reference/assets/cursor_sword.png diff --git a/src/examples/java/reference/assets/gamma_purple_badge.png b/examples/src/main/java/reference/assets/gamma_purple_badge.png similarity index 100% rename from src/examples/java/reference/assets/gamma_purple_badge.png rename to examples/src/main/java/reference/assets/gamma_purple_badge.png diff --git a/examples/src/main/java/reference/assets/grayscale.frag b/examples/src/main/java/reference/assets/grayscale.frag new file mode 100644 index 00000000..eeaf912a --- /dev/null +++ b/examples/src/main/java/reference/assets/grayscale.frag @@ -0,0 +1,8 @@ +// The picture being drawn, and where on it this pixel is: (0, 0) is one +// corner, (1, 1) the opposite one. + +void main(void) { + vec4 color_ = texture(costume, uv); + float grey = (color_.r + color_.g + color_.b) / 3.0; + color = vec4(grey, grey, grey, color_.a); +} diff --git a/examples/src/main/java/reference/assets/invert.frag b/examples/src/main/java/reference/assets/invert.frag new file mode 100644 index 00000000..8d03d72d --- /dev/null +++ b/examples/src/main/java/reference/assets/invert.frag @@ -0,0 +1,6 @@ +void main(void) { + vec4 color_ = texture(costume, uv); + // color_.a instead of 1.0: in the browser a colour comes multiplied by its + // transparency, and 1.0 would turn the clear pixels around a costume white + color = vec4(color_.a - color_.rgb, color_.a); +} diff --git a/src/examples/java/reference/assets/map.json b/examples/src/main/java/reference/assets/map.json similarity index 100% rename from src/examples/java/reference/assets/map.json rename to examples/src/main/java/reference/assets/map.json diff --git a/src/examples/java/reference/assets/music.mp3 b/examples/src/main/java/reference/assets/music.mp3 similarity index 100% rename from src/examples/java/reference/assets/music.mp3 rename to examples/src/main/java/reference/assets/music.mp3 diff --git a/examples/src/main/java/reference/assets/pixelate.frag b/examples/src/main/java/reference/assets/pixelate.frag new file mode 100644 index 00000000..e2be0879 --- /dev/null +++ b/examples/src/main/java/reference/assets/pixelate.frag @@ -0,0 +1,8 @@ +// how many blocks across, set by the program with shader.set("blocks", ...) +uniform float blocks; + +void main(void) { + vec2 p = uv; + p = (floor(p * blocks) + 0.5) / blocks; + color = texture(costume, p); +} diff --git a/src/examples/java/reference/assets/slime.png b/examples/src/main/java/reference/assets/slime.png similarity index 100% rename from src/examples/java/reference/assets/slime.png rename to examples/src/main/java/reference/assets/slime.png diff --git a/src/examples/java/reference/assets/tiled-data.tmx b/examples/src/main/java/reference/assets/tiled-data.tmx similarity index 100% rename from src/examples/java/reference/assets/tiled-data.tmx rename to examples/src/main/java/reference/assets/tiled-data.tmx diff --git a/examples/src/main/java/reference/assets/waves.frag b/examples/src/main/java/reference/assets/waves.frag new file mode 100644 index 00000000..18eb7c8a --- /dev/null +++ b/examples/src/main/java/reference/assets/waves.frag @@ -0,0 +1,7 @@ +// `time` is game time in seconds, filled in for every shader + +void main(void) { + vec2 p = uv; + p.x += sin(p.y * 30.0 + time * 4.0) * 0.01; + color = texture(costume, p); +} diff --git a/src/examples/java/reference/assets/zeta_green_badge.png b/examples/src/main/java/reference/assets/zeta_green_badge.png similarity index 100% rename from src/examples/java/reference/assets/zeta_green_badge.png rename to examples/src/main/java/reference/assets/zeta_green_badge.png diff --git a/src/examples/java/reference/assets/zeta_yellow_badge.png b/examples/src/main/java/reference/assets/zeta_yellow_badge.png similarity index 100% rename from src/examples/java/reference/assets/zeta_yellow_badge.png rename to examples/src/main/java/reference/assets/zeta_yellow_badge.png diff --git a/src/examples/java/reference/settings.json b/examples/src/main/java/reference/settings.json similarity index 100% rename from src/examples/java/reference/settings.json rename to examples/src/main/java/reference/settings.json diff --git a/src/examples/java/reference/settings.xml b/examples/src/main/java/reference/settings.xml similarity index 100% rename from src/examples/java/reference/settings.xml rename to examples/src/main/java/reference/settings.xml diff --git a/examples/src/test/java/demos/tiled/TiledDemoTest.java b/examples/src/test/java/demos/tiled/TiledDemoTest.java new file mode 100644 index 00000000..66acdf40 --- /dev/null +++ b/examples/src/test/java/demos/tiled/TiledDemoTest.java @@ -0,0 +1,77 @@ +package demos.tiled; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.KeyCode; +import org.openpatch.scratch.internal.Game; +import org.openpatch.scratch.internal.input.InputEvent; + +/** + * The tiled demo against its real map, without a window: the walls and the water block the + * player, and the warp notices it. (The warp's transition itself needs a window; here only the + * touching is checked.) + */ +class TiledDemoTest { + + private Game game; + private Player player; + + @BeforeEach + void setUp() { + I18n.setup(); + GameState.load(); + var state = GameState.get(); + // a save on this machine must not move the start around + state.items = new String[0]; + state.playerX = Double.MAX_VALUE; + state.playerY = Double.MAX_VALUE; + state.map = "Level1"; + this.game = Game.headless(640, 360); + var level = new Level("Level1", null); + this.game.setStage(level); + this.player = level.getPlayer(); + } + + @AfterEach + void tearDown() { + this.game.setStage(null); + } + + private void hold(KeyCode key) { + this.game.post(new InputEvent.Key(key, true)); + } + + @Test + void theWallsBlockThePlayer() { + // the wall on the right (Tiled object 18) covers x 902..959 at the player's height; + // 500 ticks of 2 px would cross the whole map without it + this.hold(KeyCode.RIGHT); + this.game.runTicks(500); + + assertTrue(this.player.getX() > 700, "the player moved right, to " + this.player.getX()); + assertTrue(this.player.getX() < 902, "the wall stopped the player at " + this.player.getX()); + } + + @Test + void theWaterBlocksThePlayerWithoutTheScroll() { + // the lake (Tiled object 2) covers x 247.6..391.4 at the player's height + this.hold(KeyCode.LEFT); + this.game.runTicks(500); + + assertTrue(this.player.getX() < 505, "the player moved left, to " + this.player.getX()); + assertTrue(this.player.getX() > 391.4, "the water stopped the player at " + this.player.getX()); + } + + @Test + void theWarpNoticesThePlayer() { + // the warp at the top (Tiled object 25) covers x 482..541, stage y -21..-1 + this.player.setPosition(505, -5); + this.game.runTicks(1); + + assertNotNull(this.player.getTouchingSprite(Warp.class), "the player touches the warp"); + } +} diff --git a/src/test/java/doclets/OnlineExampleTest.java b/examples/src/test/java/doclets/OnlineExampleTest.java similarity index 89% rename from src/test/java/doclets/OnlineExampleTest.java rename to examples/src/test/java/doclets/OnlineExampleTest.java index a0997c87..87bff3b7 100644 --- a/src/test/java/doclets/OnlineExampleTest.java +++ b/examples/src/test/java/doclets/OnlineExampleTest.java @@ -40,12 +40,14 @@ */ class OnlineExampleTest { - private static final Path REFERENCE = Path.of("src", "examples", "java", "reference"); + private static final Path REFERENCE = docs.Root.ROOT.resolve("examples/src/main/java/reference"); @Test void desktopExamplesAreNotOfferedAsBrowserPrograms() { org.junit.jupiter.api.Assertions.assertNull(OnlineExample.of("", List.of("BitmapTextExample.java"))); org.junit.jupiter.api.Assertions.assertNull(OnlineExample.of("", List.of("TiledMapData.java"))); + // the Online IDE has no gamepad classes yet + org.junit.jupiter.api.Assertions.assertNull(OnlineExample.of("", List.of("GamepadExample.java"))); } @Test @@ -121,16 +123,13 @@ private String asCompilationUnit(String online) { // In the Online IDE every class is in scope without an import, which is // why the rewrite drops them. Putting the extensions back here is what // lets the same program be compiled against the desktop library. + // 7.0: camera, sound, text, pixels, shader and sorting are in the core package; the + // extension jars have packages of their own (decision log, "package layout") return "import org.openpatch.scratch.*;\n" - + "import org.openpatch.scratch.extensions.camera.*;\n" - + "import org.openpatch.scratch.extensions.drawing.*;\n" - + "import org.openpatch.scratch.extensions.sound.*;\n" - + "import org.openpatch.scratch.extensions.text.*;\n" - + "import org.openpatch.scratch.extensions.fs.*;\n" - + "import org.openpatch.scratch.extensions.pixels.*;\n" - + "import org.openpatch.scratch.extensions.shader.*;\n" - + "import org.openpatch.scratch.extensions.sorting.*;\n" - + "import org.openpatch.scratch.extensions.tiled.*;\n" + + "import org.openpatch.scratch.drawing.*;\n" + + "import org.openpatch.scratch.recorder.*;\n" + + "import org.openpatch.scratch.save.*;\n" + + "import org.openpatch.scratch.tiled.*;\n" + online; } diff --git a/src/test/java/docs/DemoPagesTest.java b/examples/src/test/java/docs/DemoPagesTest.java similarity index 100% rename from src/test/java/docs/DemoPagesTest.java rename to examples/src/test/java/docs/DemoPagesTest.java diff --git a/src/test/java/org/openpatch/scratch/DocumentationSnippetsTest.java b/examples/src/test/java/docs/DocumentationSnippetsTest.java similarity index 97% rename from src/test/java/org/openpatch/scratch/DocumentationSnippetsTest.java rename to examples/src/test/java/docs/DocumentationSnippetsTest.java index 999da83e..e23e8486 100644 --- a/src/test/java/org/openpatch/scratch/DocumentationSnippetsTest.java +++ b/examples/src/test/java/docs/DocumentationSnippetsTest.java @@ -1,4 +1,4 @@ -package org.openpatch.scratch; +package docs; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeTrue; @@ -48,7 +48,7 @@ class DocumentationSnippetsTest { @Test void everyDocumentationExampleCompiles() throws IOException { - Path docs = Path.of("docs", "book"); + Path docs = Path.of("..", "docs", "book"); if (!Files.isDirectory(docs)) { return; // documentation is not part of every checkout } @@ -264,7 +264,7 @@ private String firstClassIn(String block) { */ @Test void everyInteractiveExampleCompiles() throws IOException { - Path docs = Path.of("docs", "book"); + Path docs = Path.of("..", "docs", "book"); if (!Files.isDirectory(docs)) { return; // documentation is not part of every checkout } @@ -322,9 +322,10 @@ private String asCompilationUnit(String block) { return "import org.openpatch.scratch.Random;\n" + "import org.openpatch.scratch.Timer;\n" + "import org.openpatch.scratch.*;\n" - + "import org.openpatch.scratch.extensions.fs.File;\n" - + "import org.openpatch.scratch.extensions.tiled.*;\n" - + "import org.openpatch.scratch.extensions.fs.*;\nimport java.io.*;\n" + + "import org.openpatch.scratch.save.File;\n" + + "import org.openpatch.scratch.drawing.*;\n" + + "import org.openpatch.scratch.save.*;\n" + + "import org.openpatch.scratch.tiled.*;\nimport java.io.*;\n" + "import java.text.*;\nimport java.util.*;\n" + block; } } diff --git a/src/test/java/parity/VisualParity.java b/examples/src/test/java/parity/VisualParity.java similarity index 100% rename from src/test/java/parity/VisualParity.java rename to examples/src/test/java/parity/VisualParity.java diff --git a/src/test/java/portable/PortableBehaviorChecks.java b/examples/src/test/java/portable/PortableBehaviorChecks.java similarity index 91% rename from src/test/java/portable/PortableBehaviorChecks.java rename to examples/src/test/java/portable/PortableBehaviorChecks.java index 9e01a6fc..41e4057c 100644 --- a/src/test/java/portable/PortableBehaviorChecks.java +++ b/examples/src/test/java/portable/PortableBehaviorChecks.java @@ -16,11 +16,11 @@ public static void run() { require(player.score == 8, "score after collecting"); coin.setX(1000); require(!player.getHitbox().intersects(coin.getHitbox()), "separated sprites"); - CheckWalker copy = (CheckWalker) player.clone(); + CheckWalker copy = player.createClone(); require(copy.score == 8 && copy.isClone(), "clone fields"); copy.score = 9; require(player.score == 8, "independent score"); - require(player.getTimer("check") != copy.getTimer("check"), "independent timers"); + require(player.getTimer() != copy.getTimer(), "independent timers"); Random.randomSeed(2026); int first = Random.randomInt(100); int second = Random.randomInt(100); diff --git a/examples/src/test/java/portable/PortableBehaviorChecksTest.java b/examples/src/test/java/portable/PortableBehaviorChecksTest.java new file mode 100644 index 00000000..24f52b0e --- /dev/null +++ b/examples/src/test/java/portable/PortableBehaviorChecksTest.java @@ -0,0 +1,32 @@ +package portable; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openpatch.scratch.internal.Game; + +/** + * Runs the checks the online IDE runs unchanged (compatibility/checks, copied here by + * scripts/release-catalogs.py). Sprites need a game in 7.0: a headless one, as the browser + * runner has its own. + */ +class PortableBehaviorChecksTest { + + Game game; + + @BeforeEach + void setUp() { + this.game = Game.headless(480, 360); + this.game.setStage(new org.openpatch.scratch.Stage()); + } + + @AfterEach + void tearDown() { + this.game.setStage(null); + } + + @Test + void movementCollisionScoreCloneAndRandomness() { + PortableBehaviorChecks.run(); + } +} diff --git a/examples/src/test/resources/parity/frames/backdrop.png b/examples/src/test/resources/parity/frames/backdrop.png new file mode 100644 index 00000000..d1458f29 Binary files /dev/null and b/examples/src/test/resources/parity/frames/backdrop.png differ diff --git a/examples/src/test/resources/parity/frames/camera.png b/examples/src/test/resources/parity/frames/camera.png new file mode 100644 index 00000000..cf896718 Binary files /dev/null and b/examples/src/test/resources/parity/frames/camera.png differ diff --git a/examples/src/test/resources/parity/frames/costumes.png b/examples/src/test/resources/parity/frames/costumes.png new file mode 100644 index 00000000..67ceb5fa Binary files /dev/null and b/examples/src/test/resources/parity/frames/costumes.png differ diff --git a/examples/src/test/resources/parity/frames/debug.png b/examples/src/test/resources/parity/frames/debug.png new file mode 100644 index 00000000..a25c8561 Binary files /dev/null and b/examples/src/test/resources/parity/frames/debug.png differ diff --git a/examples/src/test/resources/parity/frames/display.png b/examples/src/test/resources/parity/frames/display.png new file mode 100644 index 00000000..af6f6f64 Binary files /dev/null and b/examples/src/test/resources/parity/frames/display.png differ diff --git a/examples/src/test/resources/parity/frames/ghost.png b/examples/src/test/resources/parity/frames/ghost.png new file mode 100644 index 00000000..dc84bd35 Binary files /dev/null and b/examples/src/test/resources/parity/frames/ghost.png differ diff --git a/examples/src/test/resources/parity/frames/pen.png b/examples/src/test/resources/parity/frames/pen.png new file mode 100644 index 00000000..007ab539 Binary files /dev/null and b/examples/src/test/resources/parity/frames/pen.png differ diff --git a/examples/src/test/resources/parity/frames/rotation-styles.png b/examples/src/test/resources/parity/frames/rotation-styles.png new file mode 100644 index 00000000..b8d942f3 Binary files /dev/null and b/examples/src/test/resources/parity/frames/rotation-styles.png differ diff --git a/examples/src/test/resources/parity/frames/say-wraps.png b/examples/src/test/resources/parity/frames/say-wraps.png new file mode 100644 index 00000000..7fdb0006 Binary files /dev/null and b/examples/src/test/resources/parity/frames/say-wraps.png differ diff --git a/examples/src/test/resources/parity/frames/say.png b/examples/src/test/resources/parity/frames/say.png new file mode 100644 index 00000000..15ef189d Binary files /dev/null and b/examples/src/test/resources/parity/frames/say.png differ diff --git a/examples/src/test/resources/parity/frames/scaled.png b/examples/src/test/resources/parity/frames/scaled.png new file mode 100644 index 00000000..0932aec2 Binary files /dev/null and b/examples/src/test/resources/parity/frames/scaled.png differ diff --git a/examples/src/test/resources/parity/frames/sprite.png b/examples/src/test/resources/parity/frames/sprite.png new file mode 100644 index 00000000..3badd57b Binary files /dev/null and b/examples/src/test/resources/parity/frames/sprite.png differ diff --git a/examples/src/test/resources/parity/frames/stamps.png b/examples/src/test/resources/parity/frames/stamps.png new file mode 100644 index 00000000..cc8d386c Binary files /dev/null and b/examples/src/test/resources/parity/frames/stamps.png differ diff --git a/examples/src/test/resources/parity/frames/text-align.png b/examples/src/test/resources/parity/frames/text-align.png new file mode 100644 index 00000000..44356afa Binary files /dev/null and b/examples/src/test/resources/parity/frames/text-align.png differ diff --git a/examples/src/test/resources/parity/frames/text-box.png b/examples/src/test/resources/parity/frames/text-box.png new file mode 100644 index 00000000..17a892ae Binary files /dev/null and b/examples/src/test/resources/parity/frames/text-box.png differ diff --git a/examples/src/test/resources/parity/frames/text-colours.png b/examples/src/test/resources/parity/frames/text-colours.png new file mode 100644 index 00000000..e88d3b26 Binary files /dev/null and b/examples/src/test/resources/parity/frames/text-colours.png differ diff --git a/examples/src/test/resources/parity/frames/text-layers.png b/examples/src/test/resources/parity/frames/text-layers.png new file mode 100644 index 00000000..907bc9e4 Binary files /dev/null and b/examples/src/test/resources/parity/frames/text-layers.png differ diff --git a/examples/src/test/resources/parity/frames/text-plain.png b/examples/src/test/resources/parity/frames/text-plain.png new file mode 100644 index 00000000..66f39bc5 Binary files /dev/null and b/examples/src/test/resources/parity/frames/text-plain.png differ diff --git a/examples/src/test/resources/parity/frames/text-speak.png b/examples/src/test/resources/parity/frames/text-speak.png new file mode 100644 index 00000000..b40769a7 Binary files /dev/null and b/examples/src/test/resources/parity/frames/text-speak.png differ diff --git a/examples/src/test/resources/parity/frames/text-think.png b/examples/src/test/resources/parity/frames/text-think.png new file mode 100644 index 00000000..3b1adb7c Binary files /dev/null and b/examples/src/test/resources/parity/frames/text-think.png differ diff --git a/examples/src/test/resources/parity/frames/think.png b/examples/src/test/resources/parity/frames/think.png new file mode 100644 index 00000000..5b984a56 Binary files /dev/null and b/examples/src/test/resources/parity/frames/think.png differ diff --git a/examples/src/test/resources/parity/frames/tint.png b/examples/src/test/resources/parity/frames/tint.png new file mode 100644 index 00000000..c62db5b7 Binary files /dev/null and b/examples/src/test/resources/parity/frames/tint.png differ diff --git a/examples/src/test/resources/parity/frames/turned.png b/examples/src/test/resources/parity/frames/turned.png new file mode 100644 index 00000000..686da291 Binary files /dev/null and b/examples/src/test/resources/parity/frames/turned.png differ diff --git a/src/tools/java/doclets/OnlineExample.java b/examples/src/tools/java/doclets/OnlineExample.java similarity index 99% rename from src/tools/java/doclets/OnlineExample.java rename to examples/src/tools/java/doclets/OnlineExample.java index 37c3a728..0aae0d49 100644 --- a/src/tools/java/doclets/OnlineExample.java +++ b/examples/src/tools/java/doclets/OnlineExample.java @@ -57,7 +57,7 @@ private OnlineExample() { * wherever it did start, upwards, rather than assumed to be right here. */ private static Path findReference() { - Path relative = Path.of("src", "examples", "java", "reference"); + Path relative = Path.of("examples", "src", "main", "java", "reference"); for (Path dir = Path.of("").toAbsolutePath(); dir != null; dir = dir.getParent()) { Path candidate = dir.resolve(relative); if (Files.isDirectory(candidate)) { @@ -95,7 +95,7 @@ private static Path findReference() { private static final Pattern SHADER = Pattern.compile(".*\\.(?:frag|vert|glsl)"); /** Where the files an example brings along are served from. */ - private static final Path PUBLIC = REFERENCE.resolve("../../../../docs/public/reference").normalize(); + private static final Path PUBLIC = REFERENCE.resolve("../../../../../docs/public/reference").normalize(); /** * The example as one Online IDE program, or {@code null} when it cannot be diff --git a/src/tools/java/doclets/Scratch4JDoclet.java b/examples/src/tools/java/doclets/Scratch4JDoclet.java similarity index 100% rename from src/tools/java/doclets/Scratch4JDoclet.java rename to examples/src/tools/java/doclets/Scratch4JDoclet.java diff --git a/src/tools/java/doclets/package-info.java b/examples/src/tools/java/doclets/package-info.java similarity index 100% rename from src/tools/java/doclets/package-info.java rename to examples/src/tools/java/doclets/package-info.java diff --git a/src/tools/java/docs/GenerateAssetPages.java b/examples/src/tools/java/docs/GenerateAssetPages.java similarity index 93% rename from src/tools/java/docs/GenerateAssetPages.java rename to examples/src/tools/java/docs/GenerateAssetPages.java index 6b37e1f3..5cb0d870 100644 --- a/src/tools/java/docs/GenerateAssetPages.java +++ b/examples/src/tools/java/docs/GenerateAssetPages.java @@ -33,9 +33,9 @@ public final class GenerateAssetPages { /** Edge length of the box a sprite preview is scaled to fit into. */ private static final int TILE = 88; - private static final Path RESOURCES = Path.of("src/main/resources"); - private static final Path BOOK = Path.of("docs/book"); - private static final Path PUBLIC = Path.of("docs/public/builtin"); + private static final Path RESOURCES = Root.ROOT.resolve("core/src/main/resources"); + private static final Path BOOK = Root.ROOT.resolve("docs/book"); + private static final Path PUBLIC = Root.ROOT.resolve("docs/public/builtin"); public static void main(String[] args) throws IOException { Files.createDirectories(BOOK); @@ -123,7 +123,7 @@ private static String spritePage() { bySheet.put(sheet, new ArrayList<>()); } for (BuiltinAssets.Entry entry : entries) { - bySheet.computeIfAbsent(entry.sheet, s -> new ArrayList<>()).add(entry); + bySheet.computeIfAbsent(entry.sheet(), s -> new ArrayList<>()).add(entry); } for (Map.Entry> group : bySheet.entrySet()) { @@ -155,8 +155,8 @@ private static String tile(BuiltinAssets.Entry entry) { // and at wildly different sizes, so the preview uses the part that is // actually painted. The name still refers to the whole sprite. int[] box = Sheets.contentBox(entry); - int x = entry.x + box[0]; - int y = entry.y + box[1]; + int x = entry.x() + box[0]; + int y = entry.y() + box[1]; int width = box[2]; int height = box[3]; @@ -167,21 +167,21 @@ private static String tile(BuiltinAssets.Entry entry) { // The sheet holds a sprite the way Kenney drew it, so one the library turns // to face right is turned here as well. A transform leaves the layout alone, // and the frame centres the sprite, so it turns about its own middle. - String transform = switch ((int) entry.direction) { + String transform = switch ((int) entry.direction()) { case 0 -> "scale(" + round(scale) + ") rotate(90deg)"; case 180 -> "scale(" + round(scale) + ") rotate(-90deg)"; case -90 -> "scale(-" + round(scale) + "," + round(scale) + ")"; default -> "scale(" + round(scale) + ")"; }; - boolean quarterTurn = entry.direction == 0 || entry.direction == 180; - int shownWidth = quarterTurn ? entry.height : entry.width; - int shownHeight = quarterTurn ? entry.width : entry.height; + boolean quarterTurn = entry.direction() == 0 || entry.direction() == 180; + int shownWidth = quarterTurn ? entry.height() : entry.width(); + int shownHeight = quarterTurn ? entry.width() : entry.height(); return "