mirror of
https://github.com/FullScreenShenanigans/QuadsKeepr.git
synced 2026-08-12 02:18:20 -07:00
(v0.7.0) Used shenanigans-manager@0.2 instead of Gulp
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "7"
|
||||
- "node"
|
||||
- "5"
|
||||
|
||||
script:
|
||||
node_modules/gulp/bin/gulp.js
|
||||
npm run verify
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"editor.tabSize": 4,
|
||||
"editor.trimAutoWhitespace": true,
|
||||
"tslint.alwaysShowRuleFailuresAsWarnings": true,
|
||||
"tslint.autoFixOnSave": true,
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
require("gulp-shenanigans").initialize(require("gulp"));
|
||||
+66
-27
@@ -1,29 +1,68 @@
|
||||
{
|
||||
"name": "quadskeepr",
|
||||
"description": "Adjustable quadrant-based collision detection.",
|
||||
"version": "0.6.2",
|
||||
"author": {
|
||||
"name": "Josh Goldberg",
|
||||
"email": "joshuakgoldberg@outlook.com"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@github.com:FullScreenShenanigans/QuadsKeepr.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/FullScreenShenanigans/QuadsKeepr/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-shenanigans": "^0.6.17"
|
||||
},
|
||||
"scripts": {
|
||||
"gulp": "gulp",
|
||||
"test": "gulp test"
|
||||
},
|
||||
"shenanigans": {
|
||||
"name": "QuadsKeepr"
|
||||
},
|
||||
"dependencies": {}
|
||||
"author": {
|
||||
"email": "joshuakgoldberg@outlook.com",
|
||||
"name": "Josh Goldberg"
|
||||
},
|
||||
"browser": "./lib/index.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/FullScreenShenanigans/QuadsKeepr/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"description": "Adjustable quadrant-based collision detection.",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.0.4",
|
||||
"@types/lolex": "^1.5.32",
|
||||
"@types/mocha": "^2.2.44",
|
||||
"@types/sinon": "^4.0.0",
|
||||
"@types/sinon-chai": "^2.7.29",
|
||||
"chai": "^4.1.2",
|
||||
"glob": "^7.1.2",
|
||||
"lolex": "^2.3.0",
|
||||
"mocha": "^4.0.1",
|
||||
"mocha-headless-chrome": "^1.7.1",
|
||||
"requirejs": "^2.3.5",
|
||||
"run-for-every-file": "^1.1.0",
|
||||
"shenanigans-manager": "^0.2.0",
|
||||
"sinon": "^4.1.2",
|
||||
"sinon-chai": "^2.14.0",
|
||||
"tslint": "5.8.0",
|
||||
"typedoc": "^0.9.0",
|
||||
"typescript": "^2.6.2",
|
||||
"webpack": "^3.10.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"name": "quadskeepr",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@github.com:FullScreenShenanigans/QuadsKeepr.git"
|
||||
},
|
||||
"scripts": {
|
||||
"dist": "npm run dist:webpack",
|
||||
"dist:webpack": "webpack --config webpack.config.js",
|
||||
"docs": "npm run docs:typedoc",
|
||||
"docs:typedoc": "typedoc src/ --out docs/generated",
|
||||
"init": "npm install && npm run setup && npm run verify",
|
||||
"setup": "npm run setup:copy && npm run setup:package",
|
||||
"setup:copy": "npm run setup:copy:default",
|
||||
"setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/default/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\" --only-files",
|
||||
"setup:package": "shenanigans-manager hydrate-package-json",
|
||||
"src": "npm run src:tsc && npm run src:tslint",
|
||||
"src:tsc": "tsc -p .",
|
||||
"src:tslint": "tslint -c tslint.json --exclude ./node_modules/**/*.ts* -p tsconfig.json -t stylish",
|
||||
"test": "npm run test:setup && npm run test:run",
|
||||
"test:run": "mocha-headless-chrome --file test/index.html",
|
||||
"test:setup": "npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc",
|
||||
"test:setup:copy": "npm run test:setup:copy:default",
|
||||
"test:setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/test/\" --file \"**/*\" --run \"mustache package.json {{src-file}} ./test/{{file}}\" --dest \".\" --only-files",
|
||||
"test:setup:html": "shenanigans-manager generate-test-html",
|
||||
"test:setup:tsc": "tsc -p test",
|
||||
"verify": "npm run src && npm run test && npm run dist && npm run docs",
|
||||
"watch": "run-p \"tsc -p . -w\" \"echo sup\""
|
||||
},
|
||||
"shenanigans": {
|
||||
"name": "QuadsKeepr"
|
||||
},
|
||||
"types": "./src/index.d.ts",
|
||||
"version": "0.7.0"
|
||||
}
|
||||
+10
-14
@@ -1,12 +1,10 @@
|
||||
/**
|
||||
* Creates new Quadrants.
|
||||
*
|
||||
* @type TThing Type of Things in the Quadrant.
|
||||
* @template TThing Type of Things in the Quadrant.
|
||||
* @returns A new Quadrant.
|
||||
*/
|
||||
export interface IQuadrantFactory<TThing extends IThing> {
|
||||
(): IQuadrant<TThing>;
|
||||
}
|
||||
export type IQuadrantFactory<TThing extends IThing> = () => IQuadrant<TThing>;
|
||||
|
||||
/**
|
||||
* Any rectangular bounding box.
|
||||
@@ -71,7 +69,7 @@ export interface IThing extends IBoundingBox {
|
||||
/**
|
||||
* Some collection of Thing groups, keyed by group name.
|
||||
*
|
||||
* @type T The type of Thing.
|
||||
* @template T The type of Thing.
|
||||
*/
|
||||
export interface IThingsCollection<T extends IThing> {
|
||||
[i: string]: T[];
|
||||
@@ -90,7 +88,7 @@ export interface IThingsCounter {
|
||||
/**
|
||||
* A single cell in a grid structure containing any number of Things.
|
||||
*
|
||||
* @type T The type of Thing.
|
||||
* @template T The type of Thing.
|
||||
*/
|
||||
export interface IQuadrant<T extends IThing> extends IBoundingBox {
|
||||
/**
|
||||
@@ -107,7 +105,7 @@ export interface IQuadrant<T extends IThing> extends IBoundingBox {
|
||||
/**
|
||||
* A straight line of Quadrants, border-to-border.
|
||||
*
|
||||
* @type T The type of Thing.
|
||||
* @template T The type of Thing.
|
||||
*/
|
||||
export interface IQuadrantCollection<T extends IThing> {
|
||||
/**
|
||||
@@ -129,7 +127,7 @@ export interface IQuadrantCollection<T extends IThing> {
|
||||
/**
|
||||
* A complete row of Quadrants, border-to-border.
|
||||
*
|
||||
* @type T The type of Thing.
|
||||
* @template T The type of Thing.
|
||||
*/
|
||||
export interface IQuadrantRow<T extends IThing> extends IQuadrantCollection<T> {
|
||||
/**
|
||||
@@ -141,7 +139,7 @@ export interface IQuadrantRow<T extends IThing> extends IQuadrantCollection<T> {
|
||||
/**
|
||||
* A complete column of Quadrants, border-to-border.
|
||||
*
|
||||
* @type T The type of Thing.
|
||||
* @template T The type of Thing.
|
||||
*/
|
||||
export interface IQuadrantCol<T extends IThing> extends IQuadrantCollection<T> {
|
||||
/**
|
||||
@@ -159,14 +157,12 @@ export interface IQuadrantCol<T extends IThing> extends IQuadrantCollection<T> {
|
||||
* @param bottom The bottom border of the new area.
|
||||
* @param left The left border of the new area.
|
||||
*/
|
||||
export interface IQuadrantChangeCallback {
|
||||
(direction: string, top: number, right: number, bottom: number, left: number): void;
|
||||
}
|
||||
export type IQuadrantChangeCallback = (direction: string, top: number, right: number, bottom: number, left: number) => void;
|
||||
|
||||
/**
|
||||
* Settings to initialize a new IQuadsKeepr.
|
||||
*
|
||||
* @type TThing Type of Things in the Quadrants.
|
||||
* @template TThing Type of Things in the Quadrants.
|
||||
*/
|
||||
export interface IQuadsKeeprSettings<TThing extends IThing> {
|
||||
/**
|
||||
@@ -233,7 +229,7 @@ export interface IQuadsKeeprSettings<TThing extends IThing> {
|
||||
/**
|
||||
* Adjustable quadrant-based collision detection.
|
||||
*
|
||||
* @type T The type of Thing contained in the quadrants.
|
||||
* @template T The type of Thing contained in the quadrants.
|
||||
*/
|
||||
export interface IQuadsKeepr<T extends IThing> {
|
||||
/**
|
||||
|
||||
+31
-31
@@ -1,12 +1,12 @@
|
||||
import {
|
||||
IQuadrant, IQuadrantChangeCallback, IQuadrantCol, IQuadrantFactory,
|
||||
IQuadrantRow, IQuadsKeepr, IQuadsKeeprSettings, IThing
|
||||
IQuadrantRow, IQuadsKeepr, IQuadsKeeprSettings, IThing,
|
||||
} from "./IQuadsKeepr";
|
||||
|
||||
/**
|
||||
* Adjustable quadrant-based collision detection.
|
||||
*
|
||||
* @type TThing The type of Thing contained in the quadrants.
|
||||
* @template TThing The type of Thing contained in the quadrants.
|
||||
*/
|
||||
export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
/**
|
||||
@@ -199,32 +199,32 @@ export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
|
||||
let top: number = this.startTop;
|
||||
|
||||
for (let i: number = 0; i < this.numRows; i += 1) {
|
||||
for (let i = 0; i < this.numRows; i += 1) {
|
||||
this.quadrantRows.push({
|
||||
"left": this.startLeft,
|
||||
"top": top,
|
||||
"quadrants": []
|
||||
left: this.startLeft,
|
||||
top,
|
||||
quadrants: [],
|
||||
});
|
||||
top += this.quadrantHeight;
|
||||
}
|
||||
|
||||
let left: number = this.startLeft;
|
||||
|
||||
for (let j: number = 0; j < this.numCols; j += 1) {
|
||||
for (let j = 0; j < this.numCols; j += 1) {
|
||||
this.quadrantCols.push({
|
||||
"left": left,
|
||||
"top": this.startTop,
|
||||
"quadrants": []
|
||||
left,
|
||||
top: this.startTop,
|
||||
quadrants: [],
|
||||
});
|
||||
left += this.quadrantWidth;
|
||||
}
|
||||
|
||||
top = this.startTop;
|
||||
|
||||
for (let i: number = 0; i < this.numRows; i += 1) {
|
||||
for (let i = 0; i < this.numRows; i += 1) {
|
||||
left = this.startLeft;
|
||||
|
||||
for (let j: number = 0; j < this.numCols; j += 1) {
|
||||
for (let j = 0; j < this.numCols; j += 1) {
|
||||
const quadrant: IQuadrant<TThing> = this.createQuadrant(left, top);
|
||||
this.quadrantRows[i].quadrants.push(quadrant);
|
||||
this.quadrantCols[j].quadrants.push(quadrant);
|
||||
@@ -259,18 +259,18 @@ export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
this.bottom += dy;
|
||||
this.left += dx;
|
||||
|
||||
for (let row: number = 0; row < this.numRows; row += 1) {
|
||||
for (let row = 0; row < this.numRows; row += 1) {
|
||||
this.quadrantRows[row].left += dx;
|
||||
this.quadrantRows[row].top += dy;
|
||||
}
|
||||
|
||||
for (let col: number = 0; col < this.numCols; col += 1) {
|
||||
for (let col = 0; col < this.numCols; col += 1) {
|
||||
this.quadrantCols[col].left += dx;
|
||||
this.quadrantCols[col].top += dy;
|
||||
}
|
||||
|
||||
for (let row: number = 0; row < this.numRows; row += 1) {
|
||||
for (let col: number = 0; col < this.numCols; col += 1) {
|
||||
for (let row = 0; row < this.numRows; row += 1) {
|
||||
for (let col = 0; col < this.numCols; col += 1) {
|
||||
this.shiftQuadrant(this.quadrantRows[row].quadrants[col], dx, dy);
|
||||
}
|
||||
}
|
||||
@@ -291,7 +291,7 @@ export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
this.numRows += 1;
|
||||
this.quadrantRows.push(row);
|
||||
|
||||
for (let i: number = 0; i < this.quadrantCols.length; i += 1) {
|
||||
for (let i = 0; i < this.quadrantCols.length; i += 1) {
|
||||
this.quadrantCols[i].quadrants.push(row.quadrants[i]);
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
this.numCols += 1;
|
||||
this.quadrantCols.push(col);
|
||||
|
||||
for (let i: number = 0; i < this.quadrantRows.length; i += 1) {
|
||||
for (let i = 0; i < this.quadrantRows.length; i += 1) {
|
||||
this.quadrantRows[i].quadrants.push(col.quadrants[i]);
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
this.numRows += 1;
|
||||
this.quadrantRows.unshift(row);
|
||||
|
||||
for (let i: number = 0; i < this.quadrantCols.length; i += 1) {
|
||||
for (let i = 0; i < this.quadrantCols.length; i += 1) {
|
||||
this.quadrantCols[i].quadrants.unshift(row.quadrants[i]);
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
this.numCols += 1;
|
||||
this.quadrantCols.unshift(col);
|
||||
|
||||
for (let i: number = 0; i < this.quadrantRows.length; i += 1) {
|
||||
for (let i = 0; i < this.quadrantRows.length; i += 1) {
|
||||
this.quadrantRows[i].quadrants.unshift(col.quadrants[i]);
|
||||
}
|
||||
|
||||
@@ -476,8 +476,8 @@ export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
* @param things The listing of Things in that group.
|
||||
*/
|
||||
public determineAllQuadrants(group: string, things: TThing[]): void {
|
||||
for (let row: number = 0; row < this.numRows; row += 1) {
|
||||
for (let col: number = 0; col < this.numCols; col += 1) {
|
||||
for (let row = 0; row < this.numRows; row += 1) {
|
||||
for (let col = 0; col < this.numCols; col += 1) {
|
||||
this.quadrantRows[row].quadrants[col].numthings[group] = 0;
|
||||
}
|
||||
}
|
||||
@@ -630,12 +630,12 @@ export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
*/
|
||||
private createQuadrantRow(left: number = 0, top: number = 0): IQuadrantRow<TThing> {
|
||||
const row: IQuadrantRow<TThing> = {
|
||||
left: left,
|
||||
top: top,
|
||||
quadrants: []
|
||||
left,
|
||||
top,
|
||||
quadrants: [],
|
||||
};
|
||||
|
||||
for (let i: number = 0; i < this.numCols; i += 1) {
|
||||
for (let i = 0; i < this.numCols; i += 1) {
|
||||
row.quadrants.push(this.createQuadrant(left, top));
|
||||
// tslint:disable-next-line:no-parameter-reassignment
|
||||
left += this.quadrantWidth;
|
||||
@@ -653,12 +653,12 @@ export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
*/
|
||||
private createQuadrantCol(left: number, top: number): IQuadrantCol<TThing> {
|
||||
const col: IQuadrantCol<TThing> = {
|
||||
left: left,
|
||||
top: top,
|
||||
quadrants: []
|
||||
left,
|
||||
top,
|
||||
quadrants: [],
|
||||
};
|
||||
|
||||
for (let i: number = 0; i < this.numRows; i += 1) {
|
||||
for (let i = 0; i < this.numRows; i += 1) {
|
||||
col.quadrants.push(this.createQuadrant(left, top));
|
||||
// tslint:disable-next-line:no-parameter-reassignment
|
||||
top += this.quadrantHeight;
|
||||
@@ -723,7 +723,7 @@ export class QuadsKeepr<TThing extends IThing> implements IQuadsKeepr<TThing> {
|
||||
* Marks all Quadrants a Thig is contained within as changed.
|
||||
*/
|
||||
private markThingQuadrantsChanged(thing: TThing): void {
|
||||
for (let i: number = 0; i < thing.numQuadrants; i += 1) {
|
||||
for (let i = 0; i < thing.numQuadrants; i += 1) {
|
||||
thing.quadrants[i].changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./IQuadsKeepr";
|
||||
export * from "./QuadsKeepr";
|
||||
@@ -1,3 +0,0 @@
|
||||
import { mochaLoader } from "../main";
|
||||
|
||||
mochaLoader.it("_", (): void => { });
|
||||
+2
-17
@@ -1,19 +1,4 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "es5"
|
||||
},
|
||||
"include": [
|
||||
"./**/*.ts"
|
||||
]
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { IQuadsKeepr, IQuadsKeeprSettings, IThing } from "../../src/IQuadsKeepr";
|
||||
import { QuadsKeepr } from "../../src/QuadsKeepr";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export function stubQuadsKeepr(settings: IQuadsKeeprSettings<IThing>): IQuadsKeepr<IThing> {
|
||||
return new QuadsKeepr(settings);
|
||||
}
|
||||
+9
-3
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"experimentalDecorators": true,
|
||||
"jsx": "react",
|
||||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
@@ -8,12 +10,16 @@
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"pretty": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "es5"
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules"
|
||||
],
|
||||
"include": [
|
||||
"./src/**/*.ts"
|
||||
"./src/**/*.ts",
|
||||
"./src/**/*.tsx"
|
||||
]
|
||||
}
|
||||
|
||||
+6
-52
@@ -1,56 +1,10 @@
|
||||
{
|
||||
"extends": "tslint:all",
|
||||
"extends": "./node_modules/shenanigans-manager/setup/tslint.json",
|
||||
"rules": {
|
||||
"array-type": [false],
|
||||
"arrow-return-shorthand": [false],
|
||||
"ban-types": [false],
|
||||
"callable-types": [false],
|
||||
"comment-format": [false],
|
||||
"completed-docs": [false],
|
||||
"cyclomatic-complexity": [false],
|
||||
"forin": [false],
|
||||
"linebreak-style": [false],
|
||||
"max-file-line-count": [false],
|
||||
"max-line-length": [true, 140],
|
||||
"member-ordering": [
|
||||
true,
|
||||
"public-before-private",
|
||||
"static-before-instance",
|
||||
"variables-before-functions"
|
||||
],
|
||||
"newline-before-return": [false],
|
||||
"no-any": [false],
|
||||
"no-bitwise": [false],
|
||||
"no-console": [false],
|
||||
"no-default-export": [false],
|
||||
"no-inferrable-types": [false],
|
||||
"no-magic-numbers": [false],
|
||||
"no-redundant-jsdoc": [false],
|
||||
"no-non-null-assertion": [false],
|
||||
"no-object-literal-type-assertion": [false],
|
||||
"no-submodule-imports": [false],
|
||||
"no-require-imports": false,
|
||||
"no-unbound-method": [false],
|
||||
"no-unsafe-any": [false],
|
||||
"no-unused-variable": [false],
|
||||
"no-void-expression": [false],
|
||||
"number-literal-format": [false],
|
||||
"object-literal-key-quotes": [false],
|
||||
"object-literal-shorthand": [false],
|
||||
"object-literal-sort-keys": [false],
|
||||
"only-arrow-functions": [false],
|
||||
"prefer-function-over-method": [false],
|
||||
"prefer-method-signature": [false],
|
||||
"prefer-switch": [false],
|
||||
"prefer-conditional-expression": [false],
|
||||
"prefer-template": [false],
|
||||
"restrict-plus-operands": [false],
|
||||
"space-before-function-paren": [false],
|
||||
"strict-boolean-expressions": [false],
|
||||
"strict-type-predicates": [false],
|
||||
"switch-final-break": [false],
|
||||
"trailing-comma": [false],
|
||||
"typedef": [false],
|
||||
"variable-name": [false]
|
||||
"completed-docs": false,
|
||||
"no-bitwise": false,
|
||||
"no-non-null-assertion": false,
|
||||
"prefer-function-over-method": false,
|
||||
"strict-boolean-expressions": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user