mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-02-17 02:22:36 +01:00
Huge refactor
This commit is contained in:
parent
d12306cda7
commit
815f1cd6c9
@ -1,25 +0,0 @@
|
|||||||
image: node:16.3
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- test
|
|
||||||
- compile
|
|
||||||
|
|
||||||
ESLinter:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npm i
|
|
||||||
- node ./node_modules/eslint/bin/eslint.js src/
|
|
||||||
cache:
|
|
||||||
key: ${CI_COMMIT_BRANCH}
|
|
||||||
paths:
|
|
||||||
- node_modules
|
|
||||||
|
|
||||||
Compile:
|
|
||||||
stage: compile
|
|
||||||
script:
|
|
||||||
- yarn install
|
|
||||||
- yarn compile
|
|
||||||
cache:
|
|
||||||
key: ${CI_COMMIT_BRANCH}
|
|
||||||
paths:
|
|
||||||
- node_modules
|
|
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@ -6,9 +6,9 @@
|
|||||||
"typescript.format.placeOpenBraceOnNewLineForFunctions": true,
|
"typescript.format.placeOpenBraceOnNewLineForFunctions": true,
|
||||||
"editor.wordWrap": "on",
|
"editor.wordWrap": "on",
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": true,
|
"source.fixAll.eslint": "explicit",
|
||||||
"source.fixAll.sortJSON": false,
|
"source.fixAll.sortJSON": "never",
|
||||||
"source.organizeImports": true
|
"source.organizeImports": "explicit"
|
||||||
},
|
},
|
||||||
"editor.formatOnSave": false,
|
"editor.formatOnSave": false,
|
||||||
"git.ignoreLimitWarning": true,
|
"git.ignoreLimitWarning": true,
|
||||||
|
62
package.json
62
package.json
@ -1,20 +1,24 @@
|
|||||||
{
|
{
|
||||||
"name": "@nitrots/nitro-renderer",
|
"name": "@nitrots/nitro-renderer",
|
||||||
"description": "Javascript library for rendering Nitro in the browser using PixiJS",
|
"description": "Javascript library for rendering Nitro in the browser using PixiJS",
|
||||||
"version": "1.6.6",
|
"version": "2.0.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"workspaces": [
|
||||||
|
"packages/*"
|
||||||
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.krews.org/nitro/nitro-renderer.git"
|
"url": "https://github.com/billsonnn/nitro-renderer.git"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://git.krews.org/nitro/nitro-renderer/issues"
|
"url": "https://github.com/billsonnn/nitro-renderer/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://git.krews.org/nitro/nitro-renderer",
|
"homepage": "https://github.com/billsonnn/nitro-renderer",
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
||||||
@ -22,44 +26,20 @@
|
|||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pixi/app": "~7.2.4",
|
"howler": "^2.2.4",
|
||||||
"@pixi/assets": "^7.2.4",
|
"pako": "^2.1.0",
|
||||||
"@pixi/basis": "~7.2.4",
|
"pixi-filters": "^6.0.0",
|
||||||
"@pixi/canvas-display": "~7.2.4",
|
"pixi.js": "~8.0.1"
|
||||||
"@pixi/canvas-extract": "~7.2.4",
|
|
||||||
"@pixi/canvas-renderer": "~7.2.4",
|
|
||||||
"@pixi/compressed-textures": "^7.2.4",
|
|
||||||
"@pixi/core": "~7.2.4",
|
|
||||||
"@pixi/display": "~7.2.4",
|
|
||||||
"@pixi/events": "~7.2.4",
|
|
||||||
"@pixi/extensions": "~7.2.4",
|
|
||||||
"@pixi/extract": "~7.2.4",
|
|
||||||
"@pixi/filter-alpha": "~7.2.4",
|
|
||||||
"@pixi/filter-color-matrix": "~7.2.4",
|
|
||||||
"@pixi/graphics": "~7.2.4",
|
|
||||||
"@pixi/graphics-extras": "~7.2.4",
|
|
||||||
"@pixi/math-extras": "~7.2.4",
|
|
||||||
"@pixi/mixin-cache-as-bitmap": "~7.2.4",
|
|
||||||
"@pixi/mixin-get-child-by-name": "~7.2.4",
|
|
||||||
"@pixi/mixin-get-global-position": "~7.2.4",
|
|
||||||
"@pixi/sprite": "~7.2.4",
|
|
||||||
"@pixi/sprite-tiling": "~7.2.4",
|
|
||||||
"@pixi/spritesheet": "~7.2.4",
|
|
||||||
"@pixi/text": "~7.2.4",
|
|
||||||
"@pixi/utils": "^7.2.4",
|
|
||||||
"gifuct-js": "^2.1.2",
|
|
||||||
"howler": "^2.2.3",
|
|
||||||
"pako": "^2.0.4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-typescript": "^10.0.1",
|
"@rollup/plugin-typescript": "^11.1.6",
|
||||||
"@types/howler": "^2.2.7",
|
"@types/howler": "^2.2.11",
|
||||||
"@types/pako": "^1.0.3",
|
"@types/pako": "^2.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
||||||
"@typescript-eslint/parser": "^5.30.7",
|
"@typescript-eslint/parser": "^7.1.1",
|
||||||
"eslint": "^8.20.0",
|
"eslint": "^8.57.0",
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1",
|
||||||
"typescript": "~4.4.4",
|
"typescript": "~5.4.2",
|
||||||
"vite": "^4.0.2"
|
"vite": "^5.1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
51
packages/api/.gitignore
vendored
Normal file
51
packages/api/.gitignore
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
/out-tsc
|
||||||
|
# Only exists if Bazel was run
|
||||||
|
/bazel-out
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
|
||||||
|
# profiling files
|
||||||
|
chrome-profiler-events*.json
|
||||||
|
speed-measure-plugin*.json
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
/.idea
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# IDE - VSCode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.history/*
|
||||||
|
|
||||||
|
# misc
|
||||||
|
/.sass-cache
|
||||||
|
/connect.lock
|
||||||
|
/coverage
|
||||||
|
/libpeerconnection.log
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
testem.log
|
||||||
|
/typings
|
||||||
|
.git
|
||||||
|
|
||||||
|
# System Files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
*.zip
|
||||||
|
*.as
|
||||||
|
*.bin
|
1
packages/api/index.ts
Normal file
1
packages/api/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './src';
|
22
packages/api/package.json
Normal file
22
packages/api/package.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "@nitrots/api",
|
||||||
|
"description": "Nitro api module",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"scripts": {
|
||||||
|
"build": "vite build",
|
||||||
|
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
||||||
|
"eslint": "eslint ./src --fix"
|
||||||
|
},
|
||||||
|
"main": "./index",
|
||||||
|
"dependencies": {
|
||||||
|
"pixi.js": "^8.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "~5.4.2"
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +1,18 @@
|
|||||||
|
|
||||||
import { Resource, Texture } from '@pixi/core';
|
import { Spritesheet, Texture } from 'pixi.js';
|
||||||
import { Spritesheet } from '@pixi/spritesheet';
|
|
||||||
import { IAssetData } from './IAssetData';
|
import { IAssetData } from './IAssetData';
|
||||||
import { IGraphicAsset } from './IGraphicAsset';
|
import { IGraphicAsset } from './IGraphicAsset';
|
||||||
import { IGraphicAssetCollection } from './IGraphicAssetCollection';
|
import { IGraphicAssetCollection } from './IGraphicAssetCollection';
|
||||||
|
|
||||||
export interface IAssetManager
|
export interface IAssetManager
|
||||||
{
|
{
|
||||||
getTexture(name: string): Texture<Resource>;
|
getTexture(name: string): Texture;
|
||||||
setTexture(name: string, texture: Texture<Resource>): void;
|
setTexture(name: string, texture: Texture): void;
|
||||||
|
addAssetToCollection(collectionName: string, assetName: string, texture: Texture, override?: boolean): boolean;
|
||||||
getAsset(name: string): IGraphicAsset;
|
getAsset(name: string): IGraphicAsset;
|
||||||
getCollection(name: string): IGraphicAssetCollection;
|
getCollection(name: string): IGraphicAssetCollection;
|
||||||
createCollection(data: IAssetData, spritesheet: Spritesheet): IGraphicAssetCollection;
|
createCollection(data: IAssetData, spritesheet: Spritesheet): IGraphicAssetCollection;
|
||||||
downloadAssets(urls: string[]): Promise<boolean>;
|
downloadAssets(urls: string[]): Promise<boolean>;
|
||||||
downloadAsset(url: string): Promise<boolean>;
|
downloadAsset(url: string): Promise<boolean>;
|
||||||
collections: Map<string, IGraphicAssetCollection>;
|
readonly collections: Map<string, IGraphicAssetCollection>;
|
||||||
}
|
}
|
19
packages/api/src/asset/IGraphicAsset.ts
Normal file
19
packages/api/src/asset/IGraphicAsset.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { Rectangle, Texture } from 'pixi.js';
|
||||||
|
|
||||||
|
export interface IGraphicAsset
|
||||||
|
{
|
||||||
|
recycle(): void;
|
||||||
|
readonly name: string;
|
||||||
|
readonly source: string;
|
||||||
|
readonly texture: Texture;
|
||||||
|
readonly usesPalette: boolean;
|
||||||
|
readonly x: number;
|
||||||
|
readonly y: number;
|
||||||
|
readonly width: number;
|
||||||
|
readonly height: number;
|
||||||
|
readonly offsetX: number;
|
||||||
|
readonly offsetY: number;
|
||||||
|
readonly flipH: boolean;
|
||||||
|
readonly flipV: boolean;
|
||||||
|
readonly rectangle: Rectangle;
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import { BaseTexture, Resource, Texture } from '@pixi/core';
|
import { Texture, TextureSource } from 'pixi.js';
|
||||||
import { IAssetData } from './IAssetData';
|
import { IAssetData } from './IAssetData';
|
||||||
import { IGraphicAsset } from './IGraphicAsset';
|
import { IGraphicAsset } from './IGraphicAsset';
|
||||||
import { IGraphicAssetPalette } from './IGraphicAssetPalette';
|
import { IGraphicAssetPalette } from './IGraphicAssetPalette';
|
||||||
@ -11,15 +11,14 @@ export interface IGraphicAssetCollection
|
|||||||
define(data: IAssetData): void;
|
define(data: IAssetData): void;
|
||||||
getAsset(name: string): IGraphicAsset;
|
getAsset(name: string): IGraphicAsset;
|
||||||
getAssetWithPalette(name: string, paletteName: string): IGraphicAsset;
|
getAssetWithPalette(name: string, paletteName: string): IGraphicAsset;
|
||||||
getTexture(name: string): Texture<Resource>;
|
getTexture(name: string): Texture;
|
||||||
getPaletteNames(): string[];
|
getPaletteNames(): string[];
|
||||||
getPaletteColors(paletteName: string): number[];
|
getPaletteColors(paletteName: string): number[];
|
||||||
getPalette(name: string): IGraphicAssetPalette;
|
getPalette(name: string): IGraphicAssetPalette;
|
||||||
addAsset(name: string, texture: Texture<Resource>, override: boolean, x?: number, y?: number, flipH?: boolean, flipV?: boolean): boolean;
|
addAsset(name: string, texture: Texture, override: boolean, x?: number, y?: number, flipH?: boolean, flipV?: boolean): boolean;
|
||||||
disposeAsset(name: string): void;
|
disposeAsset(name: string): void;
|
||||||
referenceCount: number;
|
referenceCount: number;
|
||||||
referenceTimestamp: number;
|
|
||||||
name: string;
|
name: string;
|
||||||
baseTexture: BaseTexture;
|
textureSource: TextureSource;
|
||||||
data: IAssetData;
|
data: IAssetData;
|
||||||
}
|
}
|
8
packages/api/src/asset/IGraphicAssetPalette.ts
Normal file
8
packages/api/src/asset/IGraphicAssetPalette.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { Texture } from 'pixi.js';
|
||||||
|
|
||||||
|
export interface IGraphicAssetPalette
|
||||||
|
{
|
||||||
|
applyPalette(texture: Texture): Texture;
|
||||||
|
primaryColor: number;
|
||||||
|
secondaryColor: number;
|
||||||
|
}
|
@ -1,10 +1,3 @@
|
|||||||
export * from './animation';
|
|
||||||
export * from './AssetManager';
|
|
||||||
export * from './GetAssetManager';
|
|
||||||
export * from './GraphicAsset';
|
|
||||||
export * from './GraphicAssetCollection';
|
|
||||||
export * from './GraphicAssetGifCollection';
|
|
||||||
export * from './GraphicAssetPalette';
|
|
||||||
export * from './IAsset';
|
export * from './IAsset';
|
||||||
export * from './IAssetAlias';
|
export * from './IAssetAlias';
|
||||||
export * from './IAssetData';
|
export * from './IAssetData';
|
||||||
@ -12,8 +5,8 @@ export * from './IAssetManager';
|
|||||||
export * from './IAssetPalette';
|
export * from './IAssetPalette';
|
||||||
export * from './IGraphicAsset';
|
export * from './IGraphicAsset';
|
||||||
export * from './IGraphicAssetCollection';
|
export * from './IGraphicAssetCollection';
|
||||||
export * from './IGraphicAssetGifCollection';
|
|
||||||
export * from './IGraphicAssetPalette';
|
export * from './IGraphicAssetPalette';
|
||||||
|
export * from './animation';
|
||||||
export * from './logic';
|
export * from './logic';
|
||||||
export * from './logic/model';
|
export * from './logic/model';
|
||||||
export * from './logic/particlesystem';
|
export * from './logic/particlesystem';
|
9
packages/api/src/asset/spritesheet/ISpritesheetData.ts
Normal file
9
packages/api/src/asset/spritesheet/ISpritesheetData.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { SpritesheetData } from 'pixi.js';
|
||||||
|
import { ISpritesheetFrame } from './ISpritesheetFrame';
|
||||||
|
import { ISpritesheetMeta } from './ISpritesheetMeta';
|
||||||
|
|
||||||
|
export interface ISpritesheetData extends SpritesheetData
|
||||||
|
{
|
||||||
|
meta: ISpritesheetMeta;
|
||||||
|
frames: { [index: string]: ISpritesheetFrame };
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
import { IAssetVisualAnimation } from './animation/IAssetVisualAnimation';
|
import { IAssetVisualAnimation } from './animation';
|
||||||
import { IAssetColor } from './color/IAssetColor';
|
import { IAssetColor } from './color';
|
||||||
import { IAssetGesture } from './gestures/IAssetGesture';
|
import { IAssetGesture } from './gestures';
|
||||||
import { IAssetVisualizationDirection } from './IAssetVisualizationDirection';
|
import { IAssetVisualizationDirection } from './IAssetVisualizationDirection';
|
||||||
import { IAssetVisualizationLayer } from './IAssetVisualizationLayer';
|
import { IAssetVisualizationLayer } from './IAssetVisualizationLayer';
|
||||||
import { IAssetPosture } from './postures/IAssetPosture';
|
import { IAssetPosture } from './postures/IAssetPosture';
|
@ -1,7 +1,7 @@
|
|||||||
export * from './animation';
|
|
||||||
export * from './color';
|
|
||||||
export * from './gestures';
|
|
||||||
export * from './IAssetVisualizationData';
|
export * from './IAssetVisualizationData';
|
||||||
export * from './IAssetVisualizationDirection';
|
export * from './IAssetVisualizationDirection';
|
||||||
export * from './IAssetVisualizationLayer';
|
export * from './IAssetVisualizationLayer';
|
||||||
|
export * from './animation';
|
||||||
|
export * from './color';
|
||||||
|
export * from './gestures';
|
||||||
export * from './postures';
|
export * from './postures';
|
6
packages/api/src/common/IUpdateReceiver.ts
Normal file
6
packages/api/src/common/IUpdateReceiver.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { Ticker } from 'pixi.js';
|
||||||
|
|
||||||
|
export interface IUpdateReceiver
|
||||||
|
{
|
||||||
|
update(ticker: Ticker): void;
|
||||||
|
}
|
@ -4,4 +4,3 @@ export * from './ILinkEventTracker';
|
|||||||
export * from './INitroEvent';
|
export * from './INitroEvent';
|
||||||
export * from './INitroManager';
|
export * from './INitroManager';
|
||||||
export * from './IUpdateReceiver';
|
export * from './IUpdateReceiver';
|
||||||
export * from './NitroLogger';
|
|
@ -1,4 +1,4 @@
|
|||||||
import { IBinaryWriter } from '../../utils';
|
import { IBinaryWriter } from '../utils';
|
||||||
import { IConnection } from './IConnection';
|
import { IConnection } from './IConnection';
|
||||||
import { IMessageDataWrapper } from './IMessageDataWrapper';
|
import { IMessageDataWrapper } from './IMessageDataWrapper';
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
import { IBinaryReader } from '../../utils';
|
import { IBinaryReader } from '../utils';
|
||||||
|
|
||||||
export interface IMessageDataWrapper
|
export interface IMessageDataWrapper
|
||||||
{
|
{
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user