Remove clutter
This commit is contained in:
parent
78b1d648ee
commit
c21025caf6
13 changed files with 39 additions and 62 deletions
|
|
@ -1,5 +0,0 @@
|
|||
Dockerfile
|
||||
node_modules
|
||||
dist
|
||||
package-lock.json
|
||||
.*
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Command } from '../../commands/command';
|
||||
import { Command } from './command';
|
||||
|
||||
export class MoveToCommand extends Command {
|
||||
public constructor(public readonly position?: vec2) {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { Renderer } from 'sdf-2d';
|
||||
import { Command } from '../../commands/command';
|
||||
import { Command } from './command';
|
||||
|
||||
export class RenderCommand extends Command {
|
||||
public constructor(public readonly renderer?: Renderer) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { Command } from '../../commands/command';
|
||||
import { Command } from './command';
|
||||
|
||||
export class StepCommand extends Command {
|
||||
public constructor(public readonly deltaTimeInMiliseconds?: DOMHighResTimeStamp) {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Command } from '../../commands/command';
|
||||
import { Command } from './command';
|
||||
|
||||
export class TeleportToCommand extends Command {
|
||||
public constructor(public readonly position?: vec2) {
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { CircleLight, compile, Flashlight, InvertedTunnel, Renderer } from 'sdf-2d';
|
||||
import { CommandBroadcaster } from './commands/command-broadcaster';
|
||||
import { RenderCommand } from './graphics/commands/render';
|
||||
import { MoveToCommand } from './commands/move-to';
|
||||
import { RenderCommand } from './commands/render';
|
||||
import { StepCommand } from './commands/step';
|
||||
import { TeleportToCommand } from './commands/teleport-to';
|
||||
import { DeltaTimeCalculator } from './helper/delta-time-calculator';
|
||||
import { prettyPrint } from './helper/pretty-print';
|
||||
import { rgb } from './helper/rgb';
|
||||
|
|
@ -14,12 +17,9 @@ import { Camera } from './objects/types/camera';
|
|||
import { Character } from './objects/types/character';
|
||||
import { createDungeon } from './objects/world/create-dungeon';
|
||||
import { BoundingBoxBase } from './physics/bounds/bounding-box-base';
|
||||
import { MoveToCommand } from './physics/commands/move-to';
|
||||
import { StepCommand } from './physics/commands/step';
|
||||
import { TeleportToCommand } from './physics/commands/teleport-to';
|
||||
import { Physics } from './physics/physics';
|
||||
import { settings } from './settings';
|
||||
import { BlobShape } from './shapes/types/blob-shape';
|
||||
import { BlobShape } from './shapes/blob-shape';
|
||||
|
||||
export class Game implements IGame {
|
||||
public readonly objects = new Objects();
|
||||
|
|
@ -45,10 +45,22 @@ export class Game implements IGame {
|
|||
this.rendererPromise = compile(
|
||||
canvas,
|
||||
[
|
||||
InvertedTunnel.descriptor,
|
||||
Flashlight.descriptor,
|
||||
BlobShape.descriptor,
|
||||
CircleLight.descriptor,
|
||||
{
|
||||
...InvertedTunnel.descriptor,
|
||||
shaderCombinationSteps: [0, 2, 4, 8, 16],
|
||||
},
|
||||
{
|
||||
...Flashlight.descriptor,
|
||||
shaderCombinationSteps: [0, 1],
|
||||
},
|
||||
{
|
||||
...BlobShape.descriptor,
|
||||
shaderCombinationSteps: [0, 1],
|
||||
},
|
||||
{
|
||||
...CircleLight.descriptor,
|
||||
shaderCombinationSteps: [0, 1, 2, 4, 8, 16],
|
||||
},
|
||||
],
|
||||
{
|
||||
shadowTraceCount: 12,
|
||||
|
|
@ -90,7 +102,9 @@ export class Game implements IGame {
|
|||
|
||||
private initializeScene() {
|
||||
createDungeon(this.objects, this.physics);
|
||||
//createDungeon(this.objects, this.physics);
|
||||
createDungeon(this.objects, this.physics);
|
||||
createDungeon(this.objects, this.physics);
|
||||
createDungeon(this.objects, this.physics);
|
||||
|
||||
this.character = new Character(this.physics, this);
|
||||
this.objects.addObject(this.character);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { RenderCommand } from '../../graphics/commands/render';
|
||||
import { MoveToCommand } from '../../commands/move-to';
|
||||
import { RenderCommand } from '../../commands/render';
|
||||
import { CursorMoveCommand } from '../../input/commands/cursor-move-command';
|
||||
import { ZoomCommand } from '../../input/commands/zoom';
|
||||
import { BoundingBox } from '../../physics/bounds/bounding-box';
|
||||
import { MoveToCommand } from '../../physics/commands/move-to';
|
||||
import { GameObject } from '../game-object';
|
||||
|
||||
export class Camera extends GameObject {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { vec2, vec3 } from 'gl-matrix';
|
||||
import { CircleLight } from 'sdf-2d';
|
||||
import { RenderCommand } from '../../graphics/commands/render';
|
||||
import { MoveToCommand } from '../../commands/move-to';
|
||||
import { RenderCommand } from '../../commands/render';
|
||||
import { BoundingBoxBase } from '../../physics/bounds/bounding-box-base';
|
||||
import { ImmutableBoundingBox } from '../../physics/bounds/immutable-bounding-box';
|
||||
import { MoveToCommand } from '../../physics/commands/move-to';
|
||||
import { PhysicalObject } from '../../physics/physical-object';
|
||||
import { Physics } from '../../physics/physics';
|
||||
import { settings } from '../../settings';
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { RenderCommand } from '../../graphics/commands/render';
|
||||
import { InvertedTunnel } from 'sdf-2d';
|
||||
import { RenderCommand } from '../../commands/render';
|
||||
import { BoundingBoxBase } from '../../physics/bounds/bounding-box-base';
|
||||
import { ImmutableBoundingBox } from '../../physics/bounds/immutable-bounding-box';
|
||||
import { Physics } from '../../physics/physics';
|
||||
import { StaticPhysicalObject } from '../../physics/static-physical-object';
|
||||
import { TunnelShape } from '../../shapes/types/tunnel-shape';
|
||||
|
||||
export class Tunnel extends StaticPhysicalObject {
|
||||
private shape: TunnelShape;
|
||||
private shape: InvertedTunnel;
|
||||
|
||||
constructor(
|
||||
physics: Physics,
|
||||
|
|
@ -17,7 +17,7 @@ export class Tunnel extends StaticPhysicalObject {
|
|||
toRadius: number
|
||||
) {
|
||||
super(physics, true);
|
||||
this.shape = new TunnelShape(from, to, fromRadius, toRadius);
|
||||
this.shape = new InvertedTunnel(from, to, fromRadius, toRadius);
|
||||
this.addToPhysics();
|
||||
|
||||
this.addCommandExecutor(RenderCommand, this.draw.bind(this));
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
export const settings = {
|
||||
lightCutoffDistance: 600,
|
||||
hitDetectionCirclePointCount: 8,
|
||||
hitDetectionMaxOverlap: 0.01,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { mat2d, vec2 } from 'gl-matrix';
|
||||
import { Drawable, DrawableDescriptor } from 'sdf-2d';
|
||||
import { BoundingCircle } from '../../physics/bounds/bounding-circle';
|
||||
import { BoundingCircle } from '../physics/bounds/bounding-circle';
|
||||
|
||||
export class BlobShape extends Drawable {
|
||||
public static descriptor: DrawableDescriptor = {
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Circle } from 'sdf-2d';
|
||||
import { GameObject } from '../../objects/game-object';
|
||||
|
||||
export class CircleShape extends Circle {
|
||||
public constructor(
|
||||
center = vec2.create(),
|
||||
radius = 0,
|
||||
public readonly gameObject: GameObject = null
|
||||
) {
|
||||
super(center, radius);
|
||||
}
|
||||
|
||||
public clone(): CircleShape {
|
||||
return new CircleShape(vec2.clone(this.center), this.radius, this.gameObject);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { InvertedTunnel } from 'sdf-2d';
|
||||
|
||||
export class TunnelShape extends InvertedTunnel {
|
||||
constructor(from: vec2, to: vec2, fromRadius: number, toRadius: number) {
|
||||
super(from, to, fromRadius, toRadius);
|
||||
}
|
||||
|
||||
public clone(): TunnelShape {
|
||||
return new TunnelShape(
|
||||
vec2.clone(this.from),
|
||||
vec2.clone(this.to),
|
||||
this.fromRadius,
|
||||
this.toRadius
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue