UNPKG

@knopkem/little-game-engine-ts

Version:

LittleGameEngineTS - Tiny and Fast HTML5 Game Engine typescript port of LittleJS

148 lines (147 loc) 5.03 kB
import { Vector2 } from "./index"; /** * LittleJS Engine Settings * @namespace Settings */ /** The max width of the canvas, centered if window is larger * @default * @memberof Settings */ export declare const maxWidth = 1920; /** The max height of the canvas, centered if window is larger * @default * @memberof Settings */ export declare const maxHeight = 1200; /** Fixed witdh, if enabled cavnvas size never changes * @default * @memberof Settings */ export declare const fixedWidth = 0; /** Fixed height, if enabled cavnvas size never changes * @default * @memberof Settings */ export declare const fixedHeight = 0; /** Fit to canvas to window by adding space on top or bottom if necessary * @default * @memberof Settings */ export declare const fixedFitToWindow = 1; /** Default font used for text rendering * @default * @memberof Settings */ export declare const defaultFont = "arial"; /** Default size of tiles in pixels * @type {Vector2} * @default * @memberof Settings */ export declare const defaultTileSize: Vector2; /** Prevent tile bleeding from neighbors in pixels * @default * @memberof Settings */ export declare const tileBleedShrinkFix = 0.3; /** Use crisp pixels for pixel art if true * @default * @memberof Settings */ export declare const pixelated = 1; /** Default size of objects * @type {Vector2} * @default * @memberof Settings */ export declare const defaultObjectSize: Vector2; /** Default object mass for collison calcuations (how heavy objects are) * @default * @memberof Settings */ export declare const defaultObjectMass = 1; /** How much to slow velocity by each frame (0-1) * @default * @memberof Settings */ export declare const defaultObjectDamping = 0.99; /** How much to slow angular velocity each frame (0-1) * @default * @memberof Settings */ export declare const defaultObjectAngleDamping = 0.99; /** How much to bounce when a collision occurs (0-1) * @default * @memberof Settings */ export declare const defaultObjectElasticity = 0; /** How much to slow when touching (0-1) * @default * @memberof Settings */ export declare const defaultObjectFriction = 0.8; /** Clamp max speed to avoid fast objects missing collisions * @default * @memberof Settings */ export declare const maxObjectSpeed = 1; /** How much gravity to apply to objects along the Y axis, negative is down * @default * @memberof Settings */ export declare let gravity: number; export declare function setGravity(grav: number): number; /** Position of camera in world space * @type {Vector2} * @default * @memberof Settings */ export declare let cameraPos: Vector2; export declare function setCameraPos(pos: Vector2): Vector2; /** Scale of camera in world space * @default * @memberof Settings */ export declare let cameraScale: number; export declare function setCameraScale(scale: any): any; /** Enable webgl rendering, webgl can be disabled and removed from build (with some features disabled) * @default * @memberof Settings */ export declare const glEnable = 1; /** Fixes slow rendering in some browsers by not compositing the WebGL canvas * @default * @memberof Settings */ export declare const glOverlay = 1; /** Should gamepads be allowed * @default * @memberof Settings */ export declare const gamepadsEnable = 1; /** If true touch input is routed to mouse functions * @default * @memberof Settings */ export declare const touchInputEnable = 1; /** Allow players to use dpad as analog stick * @default * @memberof Settings */ export declare const copyGamepadDirectionToStick = 1; /** allow players to use WASD as direction keys * @default * @memberof Settings */ export declare const copyWASDToDpad = 1; /** All audio code can be disabled and removed from build * @default * @memberof Settings */ export declare const soundEnable = 1; /** Volume scale to apply to all sound, music and speech * @default * @memberof Settings */ export declare const audioVolume = 0.5; /** Default range where sound no longer plays * @default * @memberof Settings */ export declare const defaultSoundRange = 30; /** Default range percent to start tapering off sound (0-1) * @default * @memberof Settings */ export declare const defaultSoundTaper = 0.7; /** How long to show medals for in seconds * @default * @memberof Settings */ export declare const medalDisplayTime = 5; /** How quickly to slide on/off medals in seconds * @default * @memberof Settings */ export declare const medalDisplaySlideTime = 0.5; /** Width of medal display * @default * @memberof Settings */ export declare const medalDisplayWidth = 640; /** Height of medal display * @default * @memberof Settings */ export declare const medalDisplayHeight = 99; /** Size of icon in medal display * @default * @memberof Settings */ export declare const medalDisplayIconSize = 80;