Socket
Socket
Sign inDemoInstall

aura

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.0 to 0.10.0

2

package.json
{
"name": "aura",
"version": "0.9.0",
"version": "0.10.0",
"author": "optionallychained",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -10,3 +10,3 @@ import { Game } from '../../core';

readonly dimensions: Vec2;
readonly onCollision: (game: Game, other: Entity) => void;
readonly onCollision?: ((game: Game, self: Entity, other: Entity) => void) | undefined;
/**

@@ -17,5 +17,5 @@ * Constructor. Take and store the box's dimensions and collision handling function, and provide the name 'BoxCollider2D' to the

* @param dimensions the dimensions of this collision box, expressed as a Vec2
* @param onCollision the collision handling method, receiving the Game instance and the other Entity
* @param onCollision the collision handling method, receiving the Game instance and the two Entities involved in the collision
*/
constructor(dimensions: Vec2, onCollision: (game: Game, other: Entity) => void);
constructor(dimensions?: Vec2, onCollision?: ((game: Game, self: Entity, other: Entity) => void) | undefined);
}

@@ -31,3 +31,3 @@ "use strict";

* @param dimensions the dimensions of this collision box, expressed as a Vec2
* @param onCollision the collision handling method, receiving the Game instance and the other Entity
* @param onCollision the collision handling method, receiving the Game instance and the two Entities involved in the collision
*/

@@ -34,0 +34,0 @@ function BoxCollider2D(dimensions, onCollision) {

@@ -9,4 +9,8 @@ import { Font2DConfig } from '../../font/2d';

export interface Game2DConfig extends GameConfig {
/** 2D World configuration; world size is defaulted to the Canvas size */
readonly world?: Partial<Omit<World2DConfig, 'renderer'>>;
/** 2D World configuration. A little hacky maybe? */
readonly world?: {
dimensions?: World2DConfig['dimensions'];
camera?: Partial<World2DConfig['camera']>;
textureAtlas?: World2DConfig['textureAtlas'];
};
/** 2D UI configuration */

@@ -13,0 +17,0 @@ readonly ui?: Omit<UI2DConfig, 'renderer'>;

@@ -49,3 +49,3 @@ "use strict";

function Game2D(config) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
var _this = _super.call(this, config) || this;

@@ -73,3 +73,9 @@ /** Concrete mapping of 2D States */

textureAtlas: (_k = config === null || config === void 0 ? void 0 : config.world) === null || _k === void 0 ? void 0 : _k.textureAtlas,
camera: (_l = config === null || config === void 0 ? void 0 : config.world) === null || _l === void 0 ? void 0 : _l.camera
camera: {
offset: (_m = (_l = config === null || config === void 0 ? void 0 : config.world) === null || _l === void 0 ? void 0 : _l.camera) === null || _m === void 0 ? void 0 : _m.offset,
projection: (_q = (_p = (_o = config === null || config === void 0 ? void 0 : config.world) === null || _o === void 0 ? void 0 : _o.camera) === null || _p === void 0 ? void 0 : _p.projection) !== null && _q !== void 0 ? _q : {
width: _this.canvas.width,
height: _this.canvas.height
}
}
});

@@ -76,0 +82,0 @@ // configure the Renderer

@@ -9,4 +9,8 @@ import { Font3DConfig } from '../../font/3d';

export interface Game3DConfig extends GameConfig {
/** 3D World configuration; world size is defaulted to the Canvas size, with a z size of 1000 */
readonly world?: Partial<Omit<World3DConfig, 'renderer'>>;
/** 3D World configuration; A little hacky maybe? */
readonly world?: {
dimensions?: World3DConfig['dimensions'];
camera?: Partial<World3DConfig['camera']>;
textureAtlas?: World3DConfig['textureAtlas'];
};
/** 3D UI configuration */

@@ -13,0 +17,0 @@ readonly ui?: Omit<UI3DConfig, 'renderer'>;

@@ -49,3 +49,3 @@ "use strict";

function Game3D(config) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
var _this = _super.call(this, config) || this;

@@ -73,3 +73,15 @@ /** Concrete mapping of 3D States */

textureAtlas: (_k = config === null || config === void 0 ? void 0 : config.world) === null || _k === void 0 ? void 0 : _k.textureAtlas,
camera: (_l = config === null || config === void 0 ? void 0 : config.world) === null || _l === void 0 ? void 0 : _l.camera
camera: {
offset: (_m = (_l = config === null || config === void 0 ? void 0 : config.world) === null || _l === void 0 ? void 0 : _l.camera) === null || _m === void 0 ? void 0 : _m.offset,
// TODO instance of destroy() being annoying; canvas optional; see TODO/general
projection: (_q = (_p = (_o = config === null || config === void 0 ? void 0 : config.world) === null || _o === void 0 ? void 0 : _o.camera) === null || _p === void 0 ? void 0 : _p.projection) !== null && _q !== void 0 ? _q : {
mode: 'perspective',
fov: 90,
near: 0.1,
far: 1000000,
width: _this.canvas.width,
height: _this.canvas.height
}
}
// camera: config?.world?.camera
});

@@ -76,0 +88,0 @@ // configure the Renderer

@@ -20,3 +20,3 @@ import { Game2D } from '../../core/2d';

*/
tick(game: Game2D, frameDelta: number): void;
tick(game: Game2D): void;
/**

@@ -23,0 +23,0 @@ * Actual collision detection method. Just checks whether the BoxColliders of the two entities, positioned correctly, overlap

@@ -42,3 +42,4 @@ "use strict";

*/
Collision2D.prototype.tick = function (game, frameDelta) {
Collision2D.prototype.tick = function (game) {
var _a, _b, _c, _d;
var collidables = game.world.filterEntitiesByComponentNames('Transform2D', 'BoxCollider2D');

@@ -48,4 +49,4 @@ for (var i = 0; i < collidables.length; i++) {

if (this.collides(collidables[i], collidables[j])) {
(collidables[i].getComponent('BoxCollider2D')).onCollision(game, collidables[j]);
(collidables[j].getComponent('BoxCollider2D')).onCollision(game, collidables[i]);
(_b = (_a = (collidables[i].getComponent('BoxCollider2D'))).onCollision) === null || _b === void 0 ? void 0 : _b.call(_a, game, collidables[i], collidables[j]);
(_d = (_c = (collidables[j].getComponent('BoxCollider2D'))).onCollision) === null || _d === void 0 ? void 0 : _d.call(_c, game, collidables[j], collidables[i]);
}

@@ -52,0 +53,0 @@ }

@@ -10,3 +10,3 @@ import { Camera2DConfig } from '../../camera/2d';

dimensions: Vec2;
camera?: Partial<Omit<Camera2DConfig, 'name'>>;
camera: Omit<Camera2DConfig, 'name'>;
}

@@ -38,3 +38,2 @@ "use strict";

function World2D(config) {
var _a, _b, _c;
var _this = _super.call(this, config) || this;

@@ -46,7 +45,4 @@ /** Concrete mapping of 2D Cameras */

name: 'default',
offset: (_a = config.camera) === null || _a === void 0 ? void 0 : _a.offset,
projection: (_c = (_b = config.camera) === null || _b === void 0 ? void 0 : _b.projection) !== null && _c !== void 0 ? _c : {
width: config.dimensions.x,
height: config.dimensions.y
}
offset: config.camera.offset,
projection: config.camera.projection
});

@@ -53,0 +49,0 @@ _this.addCamera(defaultCamera);

@@ -10,3 +10,3 @@ import { Camera3DConfig } from '../../camera/3d';

dimensions: Vec3;
camera?: Partial<Omit<Camera3DConfig, 'name'>>;
camera: Omit<Camera3DConfig, 'name'>;
}

@@ -40,3 +40,2 @@ "use strict";

function World3D(config) {
var _a, _b, _c;
var _this = _super.call(this, config) || this;

@@ -48,11 +47,4 @@ /** Concrete mapping of 3D Cameras */

name: 'default',
offset: (_a = config.camera) === null || _a === void 0 ? void 0 : _a.offset,
projection: (_c = (_b = config.camera) === null || _b === void 0 ? void 0 : _b.projection) !== null && _c !== void 0 ? _c : {
mode: 'perspective',
fov: 90,
near: 0.1,
far: 1000000,
width: config.dimensions.x,
height: config.dimensions.y
}
offset: config.camera.offset,
projection: config.camera.projection
});

@@ -59,0 +51,0 @@ _this.addCamera(defaultCamera);

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc