Huge refactor

This commit is contained in:
billsonnn 2024-03-19 21:53:17 -04:00
parent d12306cda7
commit 815f1cd6c9
2744 changed files with 7565 additions and 8623 deletions

View File

@ -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

View File

@ -6,9 +6,9 @@
"typescript.format.placeOpenBraceOnNewLineForFunctions": true,
"editor.wordWrap": "on",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.sortJSON": false,
"source.organizeImports": true
"source.fixAll.eslint": "explicit",
"source.fixAll.sortJSON": "never",
"source.organizeImports": "explicit"
},
"editor.formatOnSave": false,
"git.ignoreLimitWarning": true,

View File

@ -1,20 +1,24 @@
{
"name": "@nitrots/nitro-renderer",
"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": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://git.krews.org/nitro/nitro-renderer.git"
"url": "https://github.com/billsonnn/nitro-renderer.git"
},
"license": "GPL-3.0",
"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",
"type": "module",
"homepage": "https://github.com/billsonnn/nitro-renderer",
"scripts": {
"build": "vite build",
"compile": "tsc --project ./tsconfig.json --noEmit false",
@ -22,44 +26,20 @@
},
"main": "./index",
"dependencies": {
"@pixi/app": "~7.2.4",
"@pixi/assets": "^7.2.4",
"@pixi/basis": "~7.2.4",
"@pixi/canvas-display": "~7.2.4",
"@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"
"howler": "^2.2.4",
"pako": "^2.1.0",
"pixi-filters": "^6.0.0",
"pixi.js": "~8.0.1"
},
"devDependencies": {
"@rollup/plugin-typescript": "^10.0.1",
"@types/howler": "^2.2.7",
"@types/pako": "^1.0.3",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"eslint": "^8.20.0",
"@rollup/plugin-typescript": "^11.1.6",
"@types/howler": "^2.2.11",
"@types/pako": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint": "^8.57.0",
"tslib": "^2.3.1",
"typescript": "~4.4.4",
"vite": "^4.0.2"
"typescript": "~5.4.2",
"vite": "^5.1.3"
}
}

51
packages/api/.gitignore vendored Normal file
View 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
View File

@ -0,0 +1 @@
export * from './src';

22
packages/api/package.json Normal file
View 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"
}
}

View File

@ -1,18 +1,18 @@
import { Resource, Texture } from '@pixi/core';
import { Spritesheet } from '@pixi/spritesheet';
import { Spritesheet, Texture } from 'pixi.js';
import { IAssetData } from './IAssetData';
import { IGraphicAsset } from './IGraphicAsset';
import { IGraphicAssetCollection } from './IGraphicAssetCollection';
export interface IAssetManager
{
getTexture(name: string): Texture<Resource>;
setTexture(name: string, texture: Texture<Resource>): void;
getTexture(name: string): Texture;
setTexture(name: string, texture: Texture): void;
addAssetToCollection(collectionName: string, assetName: string, texture: Texture, override?: boolean): boolean;
getAsset(name: string): IGraphicAsset;
getCollection(name: string): IGraphicAssetCollection;
createCollection(data: IAssetData, spritesheet: Spritesheet): IGraphicAssetCollection;
downloadAssets(urls: string[]): Promise<boolean>;
downloadAsset(url: string): Promise<boolean>;
collections: Map<string, IGraphicAssetCollection>;
readonly collections: Map<string, IGraphicAssetCollection>;
}

View 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;
}

View File

@ -1,4 +1,4 @@
import { BaseTexture, Resource, Texture } from '@pixi/core';
import { Texture, TextureSource } from 'pixi.js';
import { IAssetData } from './IAssetData';
import { IGraphicAsset } from './IGraphicAsset';
import { IGraphicAssetPalette } from './IGraphicAssetPalette';
@ -11,15 +11,14 @@ export interface IGraphicAssetCollection
define(data: IAssetData): void;
getAsset(name: string): IGraphicAsset;
getAssetWithPalette(name: string, paletteName: string): IGraphicAsset;
getTexture(name: string): Texture<Resource>;
getTexture(name: string): Texture;
getPaletteNames(): string[];
getPaletteColors(paletteName: string): number[];
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;
referenceCount: number;
referenceTimestamp: number;
name: string;
baseTexture: BaseTexture;
textureSource: TextureSource;
data: IAssetData;
}

View File

@ -0,0 +1,8 @@
import { Texture } from 'pixi.js';
export interface IGraphicAssetPalette
{
applyPalette(texture: Texture): Texture;
primaryColor: number;
secondaryColor: number;
}

View File

@ -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 './IAssetAlias';
export * from './IAssetData';
@ -12,8 +5,8 @@ export * from './IAssetManager';
export * from './IAssetPalette';
export * from './IGraphicAsset';
export * from './IGraphicAssetCollection';
export * from './IGraphicAssetGifCollection';
export * from './IGraphicAssetPalette';
export * from './animation';
export * from './logic';
export * from './logic/model';
export * from './logic/particlesystem';

View 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 };
}

View File

@ -1,6 +1,6 @@
import { IAssetVisualAnimation } from './animation/IAssetVisualAnimation';
import { IAssetColor } from './color/IAssetColor';
import { IAssetGesture } from './gestures/IAssetGesture';
import { IAssetVisualAnimation } from './animation';
import { IAssetColor } from './color';
import { IAssetGesture } from './gestures';
import { IAssetVisualizationDirection } from './IAssetVisualizationDirection';
import { IAssetVisualizationLayer } from './IAssetVisualizationLayer';
import { IAssetPosture } from './postures/IAssetPosture';

View File

@ -1,7 +1,7 @@
export * from './animation';
export * from './color';
export * from './gestures';
export * from './IAssetVisualizationData';
export * from './IAssetVisualizationDirection';
export * from './IAssetVisualizationLayer';
export * from './animation';
export * from './color';
export * from './gestures';
export * from './postures';

View File

@ -0,0 +1,6 @@
import { Ticker } from 'pixi.js';
export interface IUpdateReceiver
{
update(ticker: Ticker): void;
}

View File

@ -4,4 +4,3 @@ export * from './ILinkEventTracker';
export * from './INitroEvent';
export * from './INitroManager';
export * from './IUpdateReceiver';
export * from './NitroLogger';

View File

@ -1,4 +1,4 @@
import { IBinaryWriter } from '../../utils';
import { IBinaryWriter } from '../utils';
import { IConnection } from './IConnection';
import { IMessageDataWrapper } from './IMessageDataWrapper';

View File

@ -1,4 +1,4 @@
import { IBinaryReader } from '../../utils';
import { IBinaryReader } from '../utils';
export interface IMessageDataWrapper
{

Some files were not shown because too many files have changed in this diff Show More