osu-beatmap-renderer 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -17
- package/dist/osu-beatmap-renderer.js +3 -2
- package/package.json +1 -1
- package/src/BeatmapEngine.js +2 -1
package/README.md
CHANGED
|
@@ -10,23 +10,6 @@ npm install osu-beatmap-renderer pixi.js
|
|
|
10
10
|
|
|
11
11
|
`pixi.js` is a peer dependency (use v7 or newer).
|
|
12
12
|
|
|
13
|
-
## Quick start
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
import { BeatmapEngine } from "osu-beatmap-renderer";
|
|
17
|
-
|
|
18
|
-
const engine = new BeatmapEngine(document.getElementById("renderer"));
|
|
19
|
-
await engine.init();
|
|
20
|
-
await engine.loadBeatmap({
|
|
21
|
-
osuUrl: "https://example.com/beatmap.osu",
|
|
22
|
-
audioUrl: "https://example.com/audio.mp3",
|
|
23
|
-
backgroundUrl: "https://example.com/bg.jpg",
|
|
24
|
-
});
|
|
25
|
-
engine.play();
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
You can pass `osuText` instead of `osuUrl` if you already have the file as a string.
|
|
29
|
-
|
|
30
13
|
## Build from source
|
|
31
14
|
|
|
32
15
|
```bash
|
|
@@ -840,7 +840,7 @@ function adjustAnchorPositions(anchorPositions, layout) {
|
|
|
840
840
|
anchor.y = layout.topLeftY + anchor.y * layout.gridUnit;
|
|
841
841
|
}
|
|
842
842
|
}
|
|
843
|
-
const DEFAULT_AUDIO_OFFSET_MS =
|
|
843
|
+
const DEFAULT_AUDIO_OFFSET_MS = 100;
|
|
844
844
|
let globalAudioOffsetMs = DEFAULT_AUDIO_OFFSET_MS;
|
|
845
845
|
const listeners = /* @__PURE__ */ new Set();
|
|
846
846
|
function getGlobalAudioOffsetMs() {
|
|
@@ -875,6 +875,7 @@ const FADE_OUT_MS = 250;
|
|
|
875
875
|
const AUDIO_SYNC_SAMPLE_INTERVAL_MS = 200;
|
|
876
876
|
const SLIDER_BODY_ALPHA = 0.9;
|
|
877
877
|
const APPROACH_CIRCLE_Z_BASE = 1e9;
|
|
878
|
+
const BACKGROUND_Z_INDEX = -APPROACH_CIRCLE_Z_BASE;
|
|
878
879
|
const SLIDER_BODY_DARKEN_FACTOR = 0.7;
|
|
879
880
|
const SLIDER_RT_OVERSAMPLE = 2;
|
|
880
881
|
class BeatmapEngine {
|
|
@@ -945,7 +946,7 @@ class BeatmapEngine {
|
|
|
945
946
|
this.containerEl.innerHTML = "";
|
|
946
947
|
this.containerEl.appendChild(this.app.canvas);
|
|
947
948
|
this.backgroundSprite = new PIXI.Sprite();
|
|
948
|
-
this.backgroundSprite.zIndex =
|
|
949
|
+
this.backgroundSprite.zIndex = BACKGROUND_Z_INDEX;
|
|
949
950
|
this.app.stage.addChild(this.backgroundSprite);
|
|
950
951
|
this.textures = await this.loadAssets();
|
|
951
952
|
this.hitsoundPlayer = new HitsoundPlayer({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "osu-beatmap-renderer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Standalone osu! beatmap renderer powered by PixiJS. Parses .osu files and renders hit objects with hitsounds.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/osu-beatmap-renderer.js",
|
package/src/BeatmapEngine.js
CHANGED
|
@@ -23,6 +23,7 @@ const FADE_OUT_MS = 250;
|
|
|
23
23
|
const AUDIO_SYNC_SAMPLE_INTERVAL_MS = 200;
|
|
24
24
|
const SLIDER_BODY_ALPHA = 0.9;
|
|
25
25
|
const APPROACH_CIRCLE_Z_BASE = 1_000_000_000;
|
|
26
|
+
const BACKGROUND_Z_INDEX = -APPROACH_CIRCLE_Z_BASE;
|
|
26
27
|
const SLIDER_BODY_DARKEN_FACTOR = 0.7;
|
|
27
28
|
const SLIDER_RT_OVERSAMPLE = 2;
|
|
28
29
|
|
|
@@ -105,7 +106,7 @@ export class BeatmapEngine {
|
|
|
105
106
|
this.containerEl.appendChild(this.app.canvas);
|
|
106
107
|
|
|
107
108
|
this.backgroundSprite = new PIXI.Sprite();
|
|
108
|
-
this.backgroundSprite.zIndex =
|
|
109
|
+
this.backgroundSprite.zIndex = BACKGROUND_Z_INDEX;
|
|
109
110
|
this.app.stage.addChild(this.backgroundSprite);
|
|
110
111
|
|
|
111
112
|
this.textures = await this.loadAssets();
|