LittleJS Engine Settings
- All settings for the engine are here
- Source
Members
(static) cameraPos :Vector2
Position of camera in world space
- Default Value
- Vector2()
- Source
(static) cameraScale :Number
Scale of camera in world space
- Number
- Default Value
- 32
- Source
(static) canvasFixedSize :Vector2
Fixed size of the canvas, if enabled canvas size never changes
- you may also need to set mainCanvasSize if using screen space coords in startup
- Default Value
- Vector2()
- Source
(static) canvasMaxSize :Vector2
The max size of the canvas, centered if window is larger
- Default Value
- Vector2(1920,1080)
- Source
(static) canvasPixelated :Boolean
Use nearest neighbor scaling algorithm for canvas for more pixelated look
- Boolean
- Default Value
- true
- Source
(static) enablePhysicsSolver :Boolean
Enable physics solver for collisions between objects
- Boolean
- Default Value
- true
- Source
(static) fontDefault :String
Default font used for text rendering
- String
- Default Value
- arial
- Source
(static) gamepadDirectionEmulateStick :Boolean
If true, the dpad input is also routed to the left analog stick (for better accessability)
- Boolean
- Default Value
- true
- Source
(static) gamepadsEnable :Boolean
Should gamepads be allowed
- Boolean
- Default Value
- true
- Source
(static) glEnable :Boolean
Enable webgl rendering, webgl can be disabled and removed from build (with some features disabled)
- Boolean
- Default Value
- true
- Source
(static) glOverlay :Boolean
Fixes slow rendering in some browsers by not compositing the WebGL canvas
- Boolean
- Default Value
- true
- Source
(static) gravity :Number
How much gravity to apply to objects along the Y axis, negative is down
- Number
- Source
(static) headlessMode :Boolean
Disables all rendering, audio, and input for servers
- Boolean
- Source
(static) inputWASDEmulateDirection :Boolean
If true the WASD keys are also routed to the direction keys (for better accessability)
- Boolean
- Default Value
- true
- Source
(static) medalDisplayIconSize :Number
Size of icon in medal display
- Number
- Default Value
- 50
- Source
(static) medalDisplaySize :Vector2
Size of medal display
- Default Value
- Vector2(640,80)
- Source
(static) medalDisplaySlideTime :Number
How quickly to slide on/off medals in seconds
- Number
- Default Value
- 0.5
- Source
(static) medalDisplayTime :Number
How long to show medals for in seconds
- Number
- Default Value
- 5
- Source
(static) medalsPreventUnlock :Boolean
Set to stop medals from being unlockable (like if cheats are enabled)
- Boolean
- Source
(static) objectDefaultAngleDamping :Number
How much to slow angular velocity each frame (0-1)
- Number
- Default Value
- 1
- Source
(static) objectDefaultDamping :Number
How much to slow velocity by each frame (0-1)
- Number
- Default Value
- 1
- Source
(static) objectDefaultElasticity :Number
How much to bounce when a collision occurs (0-1)
- Number
- Source
(static) objectDefaultFriction :Number
How much to slow when touching (0-1)
- Number
- Default Value
- 0.8
- Source
(static) objectDefaultMass :Number
Default object mass for collision calcuations (how heavy objects are)
- Number
- Default Value
- 1
- Source
(static) objectMaxSpeed :Number
Clamp max speed to avoid fast objects missing collisions
- Number
- Default Value
- 1
- Source
(static) particleEmitRateScale :Number
Scales emit rate of particles, useful for low graphics mode (0 disables particle emitters)
- Number
- Default Value
- 1
- Source
(static) showSplashScreen :Boolean
Enable to show the LittleJS splash screen be shown on startup
- Boolean
- Source
(static) soundDefaultRange :Number
Default range where sound no longer plays
- Number
- Default Value
- 40
- Source
(static) soundDefaultTaper :Number
Default range percent to start tapering off sound (0-1)
- Number
- Default Value
- 0.7
- Source
(static) soundEnable :Boolean
All audio code can be disabled and removed from build
- Boolean
- Default Value
- true
- Source
(static) soundVolume :Number
Volume scale to apply to all sound, music and speech
- Number
- Default Value
- 0.3
- Source
(static) tileFixBleedScale :Number
How many pixels smaller to draw tiles to prevent bleeding from neighbors
- Number
- Source
(static) tileSizeDefault :Vector2
Default size of tiles in pixels
- Default Value
- Vector2(16,16)
- Source
(static) tilesPixelated :Boolean
Disables texture filtering for crisper pixel art
- Boolean
- Default Value
- true
- Source
(static) touchGamepadAlpha :Number
Transparency of touch gamepad overlay
- Number
- Default Value
- 0.3
- Source
(static) touchGamepadAnalog :Boolean
True if touch gamepad should be analog stick or false to use if 8 way dpad
- Boolean
- Default Value
- true
- Source
(static) touchGamepadEnable :Boolean
True if touch gamepad should appear on mobile devices
- Supports left analog stick, 4 face buttons and start button (button 9)
- Must be set by end of gameInit to be activated
- Boolean
- Source
(static) touchGamepadSize :Number
Size of virtual gamepad for touch devices in pixels
- Number
- Default Value
- 99
- Source
(static) touchInputEnable :Boolean
True if touch input is enabled for mobile devices
- Touch events will be routed to mouse events
- Boolean
- Default Value
- true
- Source
(static) vibrateEnable :Boolean
Allow vibration hardware if it exists
- Boolean
- Default Value
- true
- Source
Methods
(static) setCameraPos(pos)
Set position of camera in world space
Name | Type | Description |
---|---|---|
pos | Vector2 |
- Source
(static) setCameraScale(scale)
Set scale of camera in world space
Name | Type | Description |
---|---|---|
scale | Number |
- Source
(static) setCanvasFixedSize(size)
Set fixed size of the canvas
Name | Type | Description |
---|---|---|
size | Vector2 |
- Source
(static) setCanvasMaxSize(size)
Set max size of the canvas
Name | Type | Description |
---|---|---|
size | Vector2 |
- Source
(static) setCanvasPixelated(pixelated)
Use nearest neighbor scaling algorithm for canvas for more pixelated look
Name | Type | Description |
---|---|---|
pixelated | Boolean |
- Source
(static) setEnablePhysicsSolver(enable)
Set if collisions between objects are enabled
Name | Type | Description |
---|---|---|
enable | Boolean |
- Source
(static) setFontDefault(font)
Set default font used for text rendering
Name | Type | Description |
---|---|---|
font | String |
- Source
(static) setGamepadDirectionEmulateStick(enable)
Set if the dpad input is also routed to the left analog stick
Name | Type | Description |
---|---|---|
enable | Boolean |
- Source
(static) setGamepadsEnable(enable)
Set if gamepads are enabled
Name | Type | Description |
---|---|---|
enable | Boolean |
- Source
(static) setGlEnable(enable)
Set if webgl rendering is enabled
Name | Type | Description |
---|---|---|
enable | Boolean |
- Source
(static) setGlOverlay(overlay)
Set to not composite the WebGL canvas
Name | Type | Description |
---|---|---|
overlay | Boolean |
- Source
(static) setGravity(newGravity)
Set how much gravity to apply to objects along the Y axis
Name | Type | Description |
---|---|---|
newGravity | Number |
- Source
(static) setHeadlessMode(headless)
Set to disalbe rendering, audio, and input for servers
Name | Type | Description |
---|---|---|
headless | Boolean |
- Source
(static) setInputWASDEmulateDirection(enable)
Set if true the WASD keys are also routed to the direction keys
Name | Type | Description |
---|---|---|
enable | Boolean |
- Source
(static) setMedalDisplayIconSize(size)
Set size of icon in medal display
Name | Type | Description |
---|---|---|
size | Number |
- Source
(static) setMedalDisplaySize(size)
Set size of medal display
Name | Type | Description |
---|---|---|
size | Vector2 |
- Source
(static) setMedalDisplaySlideTime(time)
Set how quickly to slide on/off medals in seconds
Name | Type | Description |
---|---|---|
time | Number |
- Source
(static) setMedalDisplayTime(time)
Set how long to show medals for in seconds
Name | Type | Description |
---|---|---|
time | Number |
- Source
(static) setMedalsPreventUnlock(preventUnlock)
Set to stop medals from being unlockable
Name | Type | Description |
---|---|---|
preventUnlock | Boolean |
- Source
(static) setObjectDefaultAngleDamping(damp)
Set how much to slow angular velocity each frame
Name | Type | Description |
---|---|---|
damp | Number |
- Source
(static) setObjectDefaultDamping(damp)
Set how much to slow velocity by each frame
Name | Type | Description |
---|---|---|
damp | Number |
- Source
(static) setObjectDefaultElasticity(elasticity)
Set how much to bounce when a collision occur
Name | Type | Description |
---|---|---|
elasticity | Number |
- Source
(static) setObjectDefaultFriction(friction)
Set how much to slow when touching
Name | Type | Description |
---|---|---|
friction | Number |
- Source
(static) setObjectDefaultMass(mass)
Set default object mass for collison calcuations
Name | Type | Description |
---|---|---|
mass | Number |
- Source
(static) setObjectMaxSpeed(speed)
Set max speed to avoid fast objects missing collisions
Name | Type | Description |
---|---|---|
speed | Number |
- Source
(static) setParticleEmitRateScale(scale)
Set to scales emit rate of particles
Name | Type | Description |
---|---|---|
scale | Number |
- Source
(static) setShowSplashScreen(show)
Set if the LittleJS splash screen be shown on startup
Name | Type | Description |
---|---|---|
show | Boolean |
- Source
(static) setSoundDefaultRange(range)
Set default range where sound no longer plays
Name | Type | Description |
---|---|---|
range | Number |
- Source
(static) setSoundDefaultTaper(taper)
Set default range percent to start tapering off sound
Name | Type | Description |
---|---|---|
taper | Number |
- Source
(static) setSoundEnable(enable)
Set to disable all audio code
Name | Type | Description |
---|---|---|
enable | Boolean |
- Source
(static) setSoundVolume(volume)
Set volume scale to apply to all sound, music and speech
Name | Type | Description |
---|---|---|
volume | Number |
- Source
(static) setTileFixBleedScale(scale)
Set to prevent tile bleeding from neighbors in pixels
Name | Type | Description |
---|---|---|
scale | Number |
- Source
(static) setTileSizeDefault(size)
Set default size of tiles in pixels
Name | Type | Description |
---|---|---|
size | Vector2 |
- Source
(static) setTilesPixelated(pixelated)
Disables texture filtering for crisper pixel art
Name | Type | Description |
---|---|---|
pixelated | Boolean |
- Source
(static) setTouchGamepadAlpha(alpha)
Set transparency of touch gamepad overlay
Name | Type | Description |
---|---|---|
alpha | Number |
- Source
(static) setTouchGamepadAnalog(analog)
Set if touch gamepad should be analog stick or 8 way dpad
Name | Type | Description |
---|---|---|
analog | Boolean |
- Source
(static) setTouchGamepadEnable(enable)
Set if touch gamepad should appear on mobile devices
Name | Type | Description |
---|---|---|
enable | Boolean |
- Source
(static) setTouchGamepadSize(size)
Set size of virutal gamepad for touch devices in pixels
Name | Type | Description |
---|---|---|
size | Number |
- Source
(static) setTouchInputEnable(enable)
Set if touch input is allowed
Name | Type | Description |
---|---|---|
enable | Boolean |
- Source
(static) setVibrateEnable(enable)
Set to allow vibration hardware if it exists
Name | Type | Description |
---|---|---|
enable | Boolean |
- Source