mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts] Update main dependencies, add formatting script, add Biome for linting, temporary commit
This commit is contained in:
parent
b544dd99ed
commit
8eb9ba957b
1
.gitignore
vendored
1
.gitignore
vendored
@ -251,3 +251,4 @@ spine-libgdx/.factorypath
|
||||
spine-libgdx/.project
|
||||
.clang-format
|
||||
spine-c/codegen/spine-cpp-types.json
|
||||
spine-flutter/example/devtools_options.yaml
|
||||
|
||||
11
spine-ts/biome.json
Normal file
11
spine-ts/biome.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"formatter": {
|
||||
"enabled": false
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true
|
||||
}
|
||||
}
|
||||
}
|
||||
1013
spine-ts/package-lock.json
generated
1013
spine-ts/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,8 @@
|
||||
"prepublish": "npm run clean && npm run build",
|
||||
"clean": "npx rimraf spine-core/dist spine-canvas/dist spine-canvaskit/dist spine-webgl/dist spine-phaser-v3/dist spine-phaser-v4/dist spine-player/dist spine-threejs/dist spine-pixi-v7/dist spine-pixi-v8/dist spine-webcomponents/dist",
|
||||
"build": "npm run clean && npm run build:modules && concurrently 'npm run build:core:iife' 'npm run build:core:esm' 'npm run build:canvas:iife' 'npm run build:canvas:esm' 'npm run build:canvaskit:iife' 'npm run build:canvaskit:esm' 'npm run build:webgl:iife' 'npm run build:webgl:esm' 'npm run build:phaser-v3:iife' 'npm run build:phaser-v4:iife' 'npm run build:phaser-v3:esm' 'npm run build:phaser-v4:esm' 'npm run build:player:iife' 'npm run build:player:esm' 'npm run build:player:css' 'npm run build:threejs:iife' 'npm run build:threejs:esm' 'npm run build:pixi-v7:iife' 'npm run build:pixi-v7:esm' 'npm run build:pixi-v8:iife' 'npm run build:pixi-v8:esm' 'npm run build:webcomponents:iife' 'npm run build:webcomponents:esm'",
|
||||
"format": "npx tsx scripts/format.ts",
|
||||
"lint": "npx biome lint .",
|
||||
"postbuild": "npm run minify",
|
||||
"build:modules": "npx tsc -b -clean && npx tsc -b",
|
||||
"build:core:iife": "npx esbuild --bundle spine-core/src/index.ts --tsconfig=spine-core/tsconfig.json --sourcemap --outfile=spine-core/dist/iife/spine-core.js --format=iife --global-name=spine",
|
||||
@ -82,12 +84,15 @@
|
||||
"spine-webcomponents"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/offscreencanvas": "^2019.6.4",
|
||||
"concurrently": "^7.6.0",
|
||||
"@types/offscreencanvas": "^2019.7.3",
|
||||
"concurrently": "^9.2.0",
|
||||
"copyfiles": "^2.4.1",
|
||||
"esbuild": "^0.25.4",
|
||||
"esbuild": "^0.25.6",
|
||||
"alive-server": "^1.3.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "5.6.2"
|
||||
"rimraf": "^6.0.1",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-formatter": "^7.2.2",
|
||||
"@biomejs/biome": "^2.1.1",
|
||||
"tsx": "^4.19.2"
|
||||
}
|
||||
}
|
||||
|
||||
38
spine-ts/scripts/format.ts
Normal file
38
spine-ts/scripts/format.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
|
||||
function findTypeScriptFiles(dir: string, files: string[] = []): string[] {
|
||||
if (!fs.existsSync(dir)) return files;
|
||||
|
||||
fs.readdirSync(dir).forEach(name => {
|
||||
const filePath = path.join(dir, name);
|
||||
const stat = fs.statSync(filePath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
// Skip node_modules and dist directories
|
||||
if (name !== 'node_modules' && name !== 'dist') {
|
||||
findTypeScriptFiles(filePath, files);
|
||||
}
|
||||
} else if (name.endsWith('.ts') && !name.endsWith('.d.ts')) {
|
||||
files.push(filePath);
|
||||
}
|
||||
});
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
// Find all TypeScript files in spine-* directories
|
||||
const allFiles: string[] = [];
|
||||
fs.readdirSync('.').forEach(name => {
|
||||
if (name.startsWith('spine-') && fs.statSync(name).isDirectory()) {
|
||||
findTypeScriptFiles(name, allFiles);
|
||||
}
|
||||
});
|
||||
|
||||
if (allFiles.length > 0) {
|
||||
console.log(`Formatting ${allFiles.length} TypeScript files...`);
|
||||
execSync(`npx tsfmt -r ${allFiles.join(' ')}`, { stdio: 'inherit' });
|
||||
} else {
|
||||
console.log('No TypeScript files found to format.');
|
||||
}
|
||||
12
spine-ts/scripts/tsconfig.json
Normal file
12
spine-ts/scripts/tsconfig.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "commonjs",
|
||||
"lib": ["ES2020"],
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@ -48,20 +48,20 @@ class Printer {
|
||||
private indentLevel = 0;
|
||||
private readonly INDENT = " ";
|
||||
|
||||
print(text: string): void {
|
||||
print (text: string): void {
|
||||
const indent = this.INDENT.repeat(this.indentLevel);
|
||||
console.log(indent + text);
|
||||
}
|
||||
|
||||
indent(): void {
|
||||
indent (): void {
|
||||
this.indentLevel++;
|
||||
}
|
||||
|
||||
unindent(): void {
|
||||
unindent (): void {
|
||||
this.indentLevel--;
|
||||
}
|
||||
|
||||
printSkeletonData(data: SkeletonData): void {
|
||||
printSkeletonData (data: SkeletonData): void {
|
||||
this.print("SkeletonData {");
|
||||
this.indent();
|
||||
|
||||
@ -83,7 +83,7 @@ class Printer {
|
||||
this.print("}");
|
||||
}
|
||||
|
||||
printSkeleton(skeleton: Skeleton): void {
|
||||
printSkeleton (skeleton: Skeleton): void {
|
||||
this.print("Skeleton {");
|
||||
this.indent();
|
||||
|
||||
@ -99,7 +99,7 @@ class Printer {
|
||||
this.print("}");
|
||||
}
|
||||
|
||||
private formatFloat(value: number): string {
|
||||
private formatFloat (value: number): string {
|
||||
// Format to 6 decimal places, matching Java/C++ output
|
||||
return value.toFixed(6).replace(',', '.');
|
||||
}
|
||||
@ -107,7 +107,7 @@ class Printer {
|
||||
|
||||
// Main DebugPrinter class
|
||||
class DebugPrinter {
|
||||
static async main(args: string[]): Promise<void> {
|
||||
static async main (args: string[]): Promise<void> {
|
||||
if (args.length < 2) {
|
||||
console.error("Usage: DebugPrinter <skeleton-path> <atlas-path> [animation-name]");
|
||||
process.exit(1);
|
||||
@ -163,7 +163,7 @@ class DebugPrinter {
|
||||
}
|
||||
}
|
||||
|
||||
private static async loadSkeletonData(skeletonPath: string, atlas: TextureAtlas): Promise<SkeletonData> {
|
||||
private static async loadSkeletonData (skeletonPath: string, atlas: TextureAtlas): Promise<SkeletonData> {
|
||||
const attachmentLoader = new AtlasAttachmentLoader(atlas);
|
||||
const ext = path.extname(skeletonPath).toLowerCase();
|
||||
|
||||
|
||||
@ -2,12 +2,12 @@ import * as Phaser from "phaser"
|
||||
import * as spine from "@esotericsoftware/spine-phaser-v3"
|
||||
|
||||
class SpineDemo extends Phaser.Scene {
|
||||
preload() {
|
||||
preload () {
|
||||
this.load.spineBinary("spineboy-data", "/assets/spineboy-pro.skel");
|
||||
this.load.spineAtlas("spineboy-atlas", "/assets/spineboy-pma.atlas");
|
||||
}
|
||||
|
||||
create() {
|
||||
create () {
|
||||
const spineboy = this.add.spine(400, 500, 'spineboy-data', "spineboy-atlas");
|
||||
spineboy.scale = 0.5;
|
||||
spineboy.animationState.setAnimation(0, "walk", true);
|
||||
|
||||
@ -37,13 +37,13 @@ export const Alpha = components.Alpha;
|
||||
export interface Type<
|
||||
T,
|
||||
P extends any[] = any[]
|
||||
> extends Function {
|
||||
> extends Function {
|
||||
new(...args: P): T;
|
||||
}
|
||||
|
||||
export type Mixin<GameObjectComponent, GameObjectConstraint extends Phaser.GameObjects.GameObject> = <
|
||||
GameObjectType extends Type<GameObjectConstraint>
|
||||
>(
|
||||
>(
|
||||
BaseGameObject: GameObjectType
|
||||
) => GameObjectType & Type<GameObjectComponent>;
|
||||
|
||||
|
||||
@ -2,12 +2,12 @@ import * as Phaser from "phaser"
|
||||
import * as spine from "@esotericsoftware/spine-phaser-v4"
|
||||
|
||||
class SpineDemo extends Phaser.Scene {
|
||||
preload() {
|
||||
preload () {
|
||||
this.load.spineBinary("spineboy-data", "/assets/spineboy-pro.skel");
|
||||
this.load.spineAtlas("spineboy-atlas", "/assets/spineboy-pma.atlas");
|
||||
}
|
||||
|
||||
create() {
|
||||
create () {
|
||||
const spineboy = this.add.spine(400, 500, 'spineboy-data', "spineboy-atlas");
|
||||
spineboy.scale = 0.5;
|
||||
spineboy.animationState.setAnimation(0, "walk", true);
|
||||
|
||||
@ -37,13 +37,13 @@ export const Alpha = components.Alpha;
|
||||
export interface Type<
|
||||
T,
|
||||
P extends any[] = any[]
|
||||
> extends Function {
|
||||
> extends Function {
|
||||
new(...args: P): T;
|
||||
}
|
||||
|
||||
export type Mixin<GameObjectComponent, GameObjectConstraint extends Phaser.GameObjects.GameObject> = <
|
||||
GameObjectType extends Type<GameObjectConstraint>
|
||||
>(
|
||||
>(
|
||||
BaseGameObject: GameObjectType
|
||||
) => GameObjectType & Type<GameObjectComponent>;
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ export const app = new Application<HTMLCanvasElement>({
|
||||
});
|
||||
|
||||
/** Setup app and initialise assets */
|
||||
async function init() {
|
||||
async function init () {
|
||||
// Add pixi canvas element (app.view) to the document's body
|
||||
document.body.appendChild(app.view);
|
||||
|
||||
|
||||
@ -62,11 +62,11 @@ const spineTextureAtlasLoader: AssetExtension<RawAtlas | TextureAtlas, ISpineAtl
|
||||
name: loaderName,
|
||||
},
|
||||
|
||||
test(url: string): boolean {
|
||||
test (url: string): boolean {
|
||||
return checkExtension(url, ".atlas");
|
||||
},
|
||||
|
||||
async load(url: string): Promise<RawAtlas> {
|
||||
async load (url: string): Promise<RawAtlas> {
|
||||
const response = await settings.ADAPTER.fetch(url);
|
||||
|
||||
const txt = await response.text();
|
||||
@ -74,7 +74,7 @@ const spineTextureAtlasLoader: AssetExtension<RawAtlas | TextureAtlas, ISpineAtl
|
||||
return txt;
|
||||
},
|
||||
|
||||
testParse(asset: unknown, options: ResolvedAsset): Promise<boolean> {
|
||||
testParse (asset: unknown, options: ResolvedAsset): Promise<boolean> {
|
||||
const isExtensionRight = checkExtension(options.src!, ".atlas");
|
||||
const isString = typeof asset === "string";
|
||||
const isExplicitLoadParserSet = options.loadParser === loaderName;
|
||||
@ -82,11 +82,11 @@ const spineTextureAtlasLoader: AssetExtension<RawAtlas | TextureAtlas, ISpineAtl
|
||||
return Promise.resolve((isExtensionRight || isExplicitLoadParserSet) && isString);
|
||||
},
|
||||
|
||||
unload(atlas: TextureAtlas) {
|
||||
unload (atlas: TextureAtlas) {
|
||||
atlas.dispose();
|
||||
},
|
||||
|
||||
async parse(asset: RawAtlas, options: {src: string, data: ISpineAtlasMetadata}, loader: Loader): Promise<TextureAtlas> {
|
||||
async parse (asset: RawAtlas, options: { src: string, data: ISpineAtlasMetadata }, loader: Loader): Promise<TextureAtlas> {
|
||||
const metadata: ISpineAtlasMetadata = options.data || {};
|
||||
let basePath = utils.path.dirname(options.src);
|
||||
|
||||
@ -36,11 +36,11 @@ type SkeletonBinaryAsset = Uint8Array;
|
||||
|
||||
const loaderName = "spineSkeletonLoader";
|
||||
|
||||
function isJson(resource: any): resource is SkeletonJsonAsset {
|
||||
function isJson (resource: any): resource is SkeletonJsonAsset {
|
||||
return resource.hasOwnProperty("bones");
|
||||
}
|
||||
|
||||
function isBuffer(resource: any): resource is SkeletonBinaryAsset {
|
||||
function isBuffer (resource: any): resource is SkeletonBinaryAsset {
|
||||
return resource instanceof Uint8Array;
|
||||
}
|
||||
|
||||
@ -55,18 +55,18 @@ const spineLoaderExtension: AssetExtension<SkeletonJsonAsset | SkeletonBinaryAss
|
||||
name: loaderName,
|
||||
},
|
||||
|
||||
test(url) {
|
||||
test (url) {
|
||||
return checkExtension(url, ".skel");
|
||||
},
|
||||
|
||||
async load(url: string): Promise<SkeletonBinaryAsset> {
|
||||
async load (url: string): Promise<SkeletonBinaryAsset> {
|
||||
const response = await settings.ADAPTER.fetch(url);
|
||||
|
||||
const buffer = new Uint8Array(await response.arrayBuffer());
|
||||
|
||||
return buffer;
|
||||
},
|
||||
testParse(asset: unknown, options: ResolvedAsset): Promise<boolean> {
|
||||
testParse (asset: unknown, options: ResolvedAsset): Promise<boolean> {
|
||||
const isJsonSpineModel = checkExtension(options.src!, ".json") && isJson(asset);
|
||||
const isBinarySpineModel = checkExtension(options.src!, ".skel") && isBuffer(asset);
|
||||
const isExplicitLoadParserSet = options.loadParser === loaderName;
|
||||
@ -44,7 +44,7 @@ export class DarkTintBatchGeometry extends Geometry {
|
||||
* @param {boolean} [_static=false] - Optimization flag, where `false`
|
||||
* is updated every frame, `true` doesn't change frame-to-frame.
|
||||
*/
|
||||
constructor(_static = false) {
|
||||
constructor (_static = false) {
|
||||
super();
|
||||
|
||||
this._buffer = new Buffer(undefined, _static, false);
|
||||
|
||||
@ -38,7 +38,7 @@ export class DarkTintGeometry extends Geometry {
|
||||
* @param {boolean} [_static=false] - Optimization flag, where `false`
|
||||
* is updated every frame, `true` doesn't change frame-to-frame.
|
||||
*/
|
||||
constructor(_static = false) {
|
||||
constructor (_static = false) {
|
||||
super();
|
||||
|
||||
const verticesBuffer = new Buffer(undefined);
|
||||
|
||||
@ -94,7 +94,7 @@ export class DarkTintMaterial extends Shader {
|
||||
private _tintColor: Color;
|
||||
private _darkTintColor: Color;
|
||||
|
||||
constructor(texture?: Texture) {
|
||||
constructor (texture?: Texture) {
|
||||
const uniforms = {
|
||||
uSampler: texture ?? Texture.EMPTY,
|
||||
alpha: 1,
|
||||
@ -127,10 +127,10 @@ export class DarkTintMaterial extends Shader {
|
||||
this._colorDirty = true;
|
||||
}
|
||||
|
||||
public get texture(): Texture {
|
||||
public get texture (): Texture {
|
||||
return this.uniforms.uSampler;
|
||||
}
|
||||
public set texture(value: Texture) {
|
||||
public set texture (value: Texture) {
|
||||
if (this.uniforms.uSampler !== value) {
|
||||
if (!this.uniforms.uSampler.baseTexture.alphaMode !== !value.baseTexture.alphaMode) {
|
||||
this._colorDirty = true;
|
||||
@ -141,7 +141,7 @@ export class DarkTintMaterial extends Shader {
|
||||
}
|
||||
}
|
||||
|
||||
public set alpha(value: number) {
|
||||
public set alpha (value: number) {
|
||||
if (value === this._alpha) {
|
||||
return;
|
||||
}
|
||||
@ -149,11 +149,11 @@ export class DarkTintMaterial extends Shader {
|
||||
this._alpha = value;
|
||||
this._colorDirty = true;
|
||||
}
|
||||
public get alpha(): number {
|
||||
public get alpha (): number {
|
||||
return this._alpha;
|
||||
}
|
||||
|
||||
public set tint(value: ColorSource) {
|
||||
public set tint (value: ColorSource) {
|
||||
if (value === this.tint) {
|
||||
return;
|
||||
}
|
||||
@ -162,11 +162,11 @@ export class DarkTintMaterial extends Shader {
|
||||
this._tintRGB = this._tintColor.toLittleEndianNumber();
|
||||
this._colorDirty = true;
|
||||
}
|
||||
public get tint(): ColorSource {
|
||||
public get tint (): ColorSource {
|
||||
return this._tintColor.value!;
|
||||
}
|
||||
|
||||
public set darkTint(value: ColorSource) {
|
||||
public set darkTint (value: ColorSource) {
|
||||
if (value === this.darkTint) {
|
||||
return;
|
||||
}
|
||||
@ -175,20 +175,20 @@ export class DarkTintMaterial extends Shader {
|
||||
this._darkTintRGB = this._darkTintColor.toLittleEndianNumber();
|
||||
this._colorDirty = true;
|
||||
}
|
||||
public get darkTint(): ColorSource {
|
||||
public get darkTint (): ColorSource {
|
||||
return this._darkTintColor.value!;
|
||||
}
|
||||
|
||||
public get tintValue(): number {
|
||||
public get tintValue (): number {
|
||||
return this._tintColor.toNumber();
|
||||
}
|
||||
|
||||
public get darkTintValue(): number {
|
||||
public get darkTintValue (): number {
|
||||
return this._darkTintColor.toNumber();
|
||||
}
|
||||
|
||||
/** Gets called automatically by the Mesh. Intended to be overridden for custom {@link PIXI.MeshMaterial} objects. */
|
||||
public update(): void {
|
||||
public update (): void {
|
||||
if (this._colorDirty) {
|
||||
this._colorDirty = false;
|
||||
Color.shared.setValue(this._tintColor).premultiply(this._alpha, true).toArray(this.uniforms.uColor);
|
||||
|
||||
@ -51,24 +51,24 @@ export class DarkTintMesh extends Mesh<DarkTintMaterial> {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
public _darkTintRGB: number = 0;
|
||||
|
||||
constructor(texture?: Texture) {
|
||||
constructor (texture?: Texture) {
|
||||
super(new DarkTintGeometry(), new DarkTintMaterial(texture), undefined, undefined);
|
||||
}
|
||||
|
||||
public get darkTint(): ColorSource | null {
|
||||
public get darkTint (): ColorSource | null {
|
||||
return "darkTint" in this.shader ? (this.shader as unknown as DarkTintMaterial).darkTint : null;
|
||||
}
|
||||
|
||||
public set darkTint(value: ColorSource | null) {
|
||||
public set darkTint (value: ColorSource | null) {
|
||||
(this.shader as unknown as DarkTintMaterial).darkTint = value!;
|
||||
}
|
||||
|
||||
public get darkTintValue(): number {
|
||||
public get darkTintValue (): number {
|
||||
return (this.shader as unknown as DarkTintMaterial).darkTintValue;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
protected override _renderToBatch(renderer: Renderer): void {
|
||||
protected override _renderToBatch (renderer: Renderer): void {
|
||||
const geometry = this.geometry;
|
||||
const shader = this.shader;
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ export class DarkTintRenderer extends BatchRenderer {
|
||||
type: ExtensionType.RendererPlugin,
|
||||
};
|
||||
|
||||
constructor(renderer: Renderer) {
|
||||
constructor (renderer: Renderer) {
|
||||
super(renderer);
|
||||
this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);
|
||||
this.geometryClass = DarkTintBatchGeometry;
|
||||
@ -91,7 +91,7 @@ export class DarkTintRenderer extends BatchRenderer {
|
||||
this.vertexSize = 7;
|
||||
}
|
||||
|
||||
public override packInterleavedGeometry(element: IDarkTintElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array, aIndex: number, iIndex: number): void {
|
||||
public override packInterleavedGeometry (element: IDarkTintElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array, aIndex: number, iIndex: number): void {
|
||||
const { uint32View, float32View } = attributeBuffer;
|
||||
const packedVertices = aIndex / this.vertexSize;
|
||||
const uvs = element.uvs;
|
||||
|
||||
@ -4,8 +4,8 @@ export * from './SpineDebugRenderer.js';
|
||||
export * from './SpineTexture.js';
|
||||
export * from './SlotMesh.js';
|
||||
export * from './DarkSlotMesh.js';
|
||||
export * from './assets/atlasLoader.js';
|
||||
export * from './assets/skeletonLoader.js';
|
||||
export * from './assets/Atlas-Loader.js';
|
||||
export * from './assets/Skeleton-Loader.js';
|
||||
export * from './darkTintMesh/DarkTintBatchGeom.js';
|
||||
export * from './darkTintMesh/DarkTintGeom.js';
|
||||
export * from './darkTintMesh/DarkTintMaterial.js';
|
||||
@ -14,5 +14,5 @@ export * from './darkTintMesh/DarkTintRenderer.js';
|
||||
export * from "@esotericsoftware/spine-core";
|
||||
|
||||
|
||||
import './assets/atlasLoader.js'; // Side effects install the loaders into pixi
|
||||
import './assets/skeletonLoader.js'; // Side effects install the loaders into pixi
|
||||
import './assets/Atlas-Loader.js'; // Side effects install the loaders into pixi
|
||||
import './assets/Skeleton-Loader.js'; // Side effects install the loaders into pixi
|
||||
|
||||
@ -5,7 +5,7 @@ import { Spine } from '@esotericsoftware/spine-pixi-v8';
|
||||
export const app = new Application();
|
||||
|
||||
/** Setup app and initialise assets */
|
||||
async function init() {
|
||||
async function init () {
|
||||
await app.init({
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
|
||||
@ -28,13 +28,13 @@
|
||||
*****************************************************************************/
|
||||
|
||||
import './require-shim.js'; // Side effects add require pixi.js to global scope
|
||||
import './assets/atlasLoader.js'; // Side effects install the loaders into pixi
|
||||
import './assets/skeletonLoader.js'; // Side effects install the loaders into pixi
|
||||
import './assets/Atlas-Loader.js'; // Side effects install the loaders into pixi
|
||||
import './assets/Skeleton-Loader.js'; // Side effects install the loaders into pixi
|
||||
import './darktint/DarkTintBatcher.js'; // Side effects install the batcher into pixi
|
||||
import './SpinePipe.js';
|
||||
|
||||
export * from './assets/atlasLoader.js';
|
||||
export * from './assets/skeletonLoader.js';
|
||||
export * from './assets/Atlas-Loader.js';
|
||||
export * from './assets/Skeleton-Loader.js';
|
||||
export * from './require-shim.js';
|
||||
export * from './Spine.js';
|
||||
export * from './SpineDebugRenderer.js';
|
||||
|
||||
@ -21,7 +21,7 @@ let atlasFile = skeletonFile
|
||||
.replace(".json", ".atlas");
|
||||
let animation = "walk";
|
||||
|
||||
function init() {
|
||||
function init () {
|
||||
// create the THREE.JS camera, scene and renderer (WebGL)
|
||||
let width = window.innerWidth,
|
||||
height = window.innerHeight;
|
||||
@ -55,7 +55,7 @@ function init() {
|
||||
requestAnimationFrame(load);
|
||||
}
|
||||
|
||||
function load() {
|
||||
function load () {
|
||||
if (assetManager.isLoadingComplete()) {
|
||||
// Add a box to the scene to which we attach the skeleton mesh
|
||||
geometry = new THREE.BoxGeometry(200, 200, 200);
|
||||
@ -85,7 +85,7 @@ function load() {
|
||||
// Create a SkeletonMesh from the data and attach it to the scene
|
||||
skeletonMesh = new spine.SkeletonMesh({
|
||||
skeletonData,
|
||||
materialFactory(parameters) {
|
||||
materialFactory (parameters) {
|
||||
return new THREE.MeshStandardMaterial({ ...parameters, metalness: .5 });
|
||||
},
|
||||
});
|
||||
@ -97,7 +97,7 @@ function load() {
|
||||
}
|
||||
|
||||
let lastTime = Date.now();
|
||||
function render() {
|
||||
function render () {
|
||||
// calculate delta time for animation purposes
|
||||
let now = Date.now() / 1000;
|
||||
let delta = now - lastFrameTime;
|
||||
@ -118,7 +118,7 @@ function render() {
|
||||
requestAnimationFrame(render);
|
||||
}
|
||||
|
||||
function resize() {
|
||||
function resize () {
|
||||
let w = window.innerWidth;
|
||||
let h = window.innerHeight;
|
||||
if (canvas.width != w || canvas.height != h) {
|
||||
|
||||
11
tests/biome.json
Normal file
11
tests/biome.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"formatter": {
|
||||
"enabled": false
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,11 +3,15 @@
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"compare": "tsx compare-with-reference-impl.ts"
|
||||
"compare": "tsx compare-with-reference-impl.ts",
|
||||
"format": "npx tsfmt -r ./**/*.ts",
|
||||
"lint": "npx biome lint ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.0.0",
|
||||
"tsx": "^4.0.0"
|
||||
"tsx": "^4.0.0",
|
||||
"typescript-formatter": "^7.2.2",
|
||||
"@biomejs/biome": "^2.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mariozechner/lsp-cli": "^0.1.3"
|
||||
|
||||
24
tests/tsfmt.json
Normal file
24
tests/tsfmt.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"baseIndentSize": 0,
|
||||
"indentSize": 4,
|
||||
"tabSize": 4,
|
||||
"indentStyle": 2,
|
||||
"newLineCharacter": "\n",
|
||||
"convertTabsToSpaces": false,
|
||||
"insertSpaceAfterCommaDelimiter": true,
|
||||
"insertSpaceAfterSemicolonInForStatements": true,
|
||||
"insertSpaceBeforeAndAfterBinaryOperators": true,
|
||||
"insertSpaceAfterConstructor": true,
|
||||
"insertSpaceAfterKeywordsInControlFlowStatements": true,
|
||||
"insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
|
||||
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
|
||||
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
|
||||
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
|
||||
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
|
||||
"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
|
||||
"insertSpaceAfterTypeAssertion": false,
|
||||
"insertSpaceBeforeFunctionParenthesis": true,
|
||||
"insertSpaceBeforeTypeAnnotation": false,
|
||||
"placeOpenBraceOnNewLineForFunctions": false,
|
||||
"placeOpenBraceOnNewLineForControlBlocks": false
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user