Skip to content

Commit

Permalink
Update noteskin arrow tex using update
Browse files Browse the repository at this point in the history
  • Loading branch information
tillvit committed Jan 10, 2024
1 parent 41dc27f commit 7743ada
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
33 changes: 15 additions & 18 deletions app/src/chart/gameTypes/dance/default/DanceDefaultNoteTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Sprite,
Texture,
} from "pixi.js"
import { App } from "../../../../App"
import { Options } from "../../../../util/Options"
import { NotedataEntry } from "../../../sm/NoteTypes"

Expand Down Expand Up @@ -60,7 +59,7 @@ export class DanceDefaultNoteTexture {

private static loaded = false

static async initArrowTex(app: App) {
static async initArrowTex() {
if (this.loaded) return

// Initialize rendertextures in here so we can read options
Expand Down Expand Up @@ -162,21 +161,6 @@ export class DanceDefaultNoteTexture {
DanceDefaultNoteTexture.mineConainer.addChild(mine_frame)
}

app.ticker.add(() => {
app.renderer.render(DanceDefaultNoteTexture.arrowFrame, {
renderTexture: DanceDefaultNoteTexture.arrowFrameTex,
})
app.renderer.render(DanceDefaultNoteTexture.arrowContainer, {
renderTexture: DanceDefaultNoteTexture.arrowTex,
})
app.renderer.render(DanceDefaultNoteTexture.mineConainer, {
renderTexture: DanceDefaultNoteTexture.mineTex,
})
app.renderer.render(DanceDefaultNoteTexture.liftContainer, {
renderTexture: DanceDefaultNoteTexture.liftTex,
})
})

this.loaded = true
}

Expand Down Expand Up @@ -221,7 +205,7 @@ export class DanceDefaultNoteTexture {
.addIndex(vIndex)
}

static setArrowTexTime(beat: number, second: number) {
static setArrowTexTime(app: App, beat: number, second: number) {

Check failure on line 208 in app/src/chart/gameTypes/dance/default/DanceDefaultNoteTexture.ts

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'App'.
if (!this.loaded) return
for (let i = 0; i < 10; i++) {
const tapShader: Mesh<Shader> =
Expand All @@ -235,6 +219,19 @@ export class DanceDefaultNoteTexture {
DanceDefaultNoteTexture.mineConainer.children[0]
)).shader.uniforms.time = second
DanceDefaultNoteTexture.mineConainer.rotation = (second % 1) * Math.PI * 2

app.renderer.render(DanceDefaultNoteTexture.arrowFrame, {
renderTexture: DanceDefaultNoteTexture.arrowFrameTex,
})
app.renderer.render(DanceDefaultNoteTexture.arrowContainer, {
renderTexture: DanceDefaultNoteTexture.arrowTex,
})
app.renderer.render(DanceDefaultNoteTexture.mineConainer, {
renderTexture: DanceDefaultNoteTexture.mineTex,
})
app.renderer.render(DanceDefaultNoteTexture.liftContainer, {
renderTexture: DanceDefaultNoteTexture.liftTex,
})
}

static setNoteTex(arrow: Sprite, note: NotedataEntry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DanceDefaultNoteskinObject extends NoteSkin {
constructor(renderer: ChartRenderer) {
super(renderer)

DanceDefaultNoteTexture.initArrowTex(renderer.chartManager.app)
DanceDefaultNoteTexture.initArrowTex()
}

createReceptor(_: number) {
Expand All @@ -31,6 +31,7 @@ class DanceDefaultNoteskinObject extends NoteSkin {

update(): void {
DanceDefaultNoteTexture.setArrowTexTime(
this.renderer.chartManager.app,
this.renderer.getVisualBeat(),
this.renderer.getVisualTime()
)
Expand Down

0 comments on commit 7743ada

Please sign in to comment.