feat: implemented haptics

feat: Implemented a select menu
fix: Only used audio clips compile
This commit is contained in:
Simeon Radivoev 2026-04-07 15:28:56 +03:00
parent 02a4f2c9a9
commit 54dd9256e3
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
51 changed files with 580 additions and 466 deletions

View file

@ -1,24 +1,31 @@
import audioSprite from 'audiosprite';
import { $, which } from 'bun';
import fs from "node:fs/promises";
import { $ } from 'bun';
import path from 'node:path';
import { soundMap } from '../src/mainview/scripts/audio/audioConstants';
var files = await Array.fromAsync(new Bun.Glob('*.{ogg,wav}').scan({ cwd: './src/sounds' }));
var allFiles = await Array.fromAsync(new Bun.Glob('*.{ogg,wav}').scan({ cwd: './src/sounds' }));
const files = Object.values(soundMap).map(v =>
{
const existingFile = allFiles.find(f => f.startsWith(v.key));
if (!existingFile) throw new Error(`Could not find file for sound ${v.key}`);
const filePath = path.join(path.resolve('./src/sounds'), existingFile);
return filePath;
});
console.log("Loaded", files.join(","));
await new Promise((resolve) =>
{
audioSprite(
files.map(f => path.join(path.resolve('./src/sounds'), f)),
audioSprite(files,
{
output: path.resolve('./src/mainview/assets/sounds'),
path: path.resolve('./src/sounds'),
format: 'howler',
export: 'ogg'
}, async function (err, obj: any)
{
if (err) return console.error(err);
delete obj.urls;
Bun.file('./src/mainview/assets/sounds.json').write(JSON.stringify(obj, null, 2)).then(r => resolve(true));
});
},
async function (err, obj: any)
{
if (err) return console.error(err);
delete obj.urls;
Bun.file('./src/mainview/assets/sounds.json').write(JSON.stringify(obj, null, 2)).then(r => resolve(true));
});
});