Skip to content

Commit

Permalink
[LIVE] save score to png
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Dec 2, 2018
1 parent 745a7e6 commit eea59f7
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 55 deletions.
12 changes: 10 additions & 2 deletions app/src/ts/main/on-score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ function createScore (csv: string) {
return { fullCombo, score }
}

let song: { src: string; bpm: number; score: ScoreNote[]; fullCombo: number } | null = null
let song: { src: string; bpm: number; score: ScoreNote[]; fullCombo: number; difficulty: string } | null = null

ipcMain.on('getSong', (event: Event) => {
const sync = song
song = null
event.returnValue = sync
})

const difficultyMap: any = {
1: 'DEBUT',
2: 'REGULAR',
3: 'PRO',
4: 'MASTER',
5: 'MASTER+'
}

export default async function (event: Event, scoreFile: string, difficulty: number | string, bpm: number, src: string) {
let bdb = await openSqlite(scoreFile)
let rows = await bdb._all(`SELECT data FROM blobs WHERE name LIKE "%/_${difficulty}.csv" ESCAPE '/'`)
Expand All @@ -51,6 +59,6 @@ export default async function (event: Event, scoreFile: string, difficulty: numb

let { fullCombo, score } = createScore(data)

song = { src, bpm, score, fullCombo }
song = { src, bpm, score, fullCombo, difficulty: difficultyMap[difficulty] }
event.sender.send('score')
}
Loading

0 comments on commit eea59f7

Please sign in to comment.