Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

jsilConfig

Katelyn Gadd edited this page Nov 23, 2015 · 20 revisions

The JSIL script loader (contained in JSIL.js) is responsible for loading the scripts necessary to run a JSIL game or application. The script loader (and other parts of JSIL) read configuration settings from a global variable named jsilConfig.

jsilConfig format

The jsilConfig object is a JSON-style dictionary. The following keys can be provided:

Key Type Default Value Description
manifests Array [] A list of manifests to load. You typically want to include the name of your application in this list ("Foo.exe") along with any other assemblies or content projects you want to load ("Content /FooContent.contentproj").
Search Paths
Key Type Default Value Description
libraryRoot String "../Libraries/" Where JSIL looks for libraries (like JSIL.Bootstrap).
manifestRoot String "" Where JSIL looks for manifests (like MyApp.manifest.js).
scriptRoot String "" Where JSIL looks for application scripts.
fileRoot String "" Where JSIL looks for raw files included with your application.
assetRoot String ""
contentRoot String "Content/" Where JSIL looks for XNA content (.xnb files and the like)
fileVirtualRoot String fileRoot or "" If readOnlyStorage is enabled, this controls the root directory where all your files are available. You may need to fiddle with this to reproduce the way your application is normally laid out on disk.
Default UI
Key Type Default Value Description
showProgressBar Boolean false If true, shows a basic progress bar while loading.
showFullscreenButton Boolean false If true, shows a button to allow the user to enter HTML5 Full Screen mode, if available.
showStats Boolean false If true, shows basic performance statistics in an element with id="stats".
graphicalStats Boolean false If true, replaces the textual stats display with a simplified graphical display.
Optional Features
Key Type Default Value Description
CORS Boolean false If true, turns on required support for Cross Origin Resource Sharing. You will need this to load assets (like images or sounds) from a server different than the one hosting your game. Note that many browsers still do not support this.
printStackTrace Boolean false If true, printStackTrace.js will be loaded to provide more detailed stack traces for errors in your application. This can be useful for debugging but comes with a performance penalty.
webgl2d Boolean false If true, webgl-2d will be loaded and used if available to accelerate graphics rendering (instead of HTML5 Canvas). WebGL-2D provides superior performance for games that use lots of color multiplication.
xml Boolean false Enables partial System.Xml support.
gamepad Boolean false If true, gamepad.js will be loaded to provide support for XBox 360 controllers in compatible browsers on compatible PCs.
winForms Boolean false If true, the JSIL support libraries for System.Windows.Forms and System.Drawing will be loaded.
xna Integer If an XNA version is specified, JSIL support libraries for that version of XNA will be loaded. Supported versions are 3 and 4.
readOnlyStorage Boolean false If true, the JSIL support libraries for read-only filesystem emulation will be loaded. Read-only filesystem emulation exposes all your application's files in a virtual filesystem that you can access with the standard .NET File APIs.
localStorage Boolean false If true, the JSIL support libraries for localStorage filesystem emulation will be loaded. localStorage filesystem emulation provides a writable filesystem that you can access with the standard .NET File APIs that is automatically saved by the user's browser in localStorage. The XNA StorageDevice / StorageContainer APIs will also utilize this to save games.
interpreter Boolean false If true, the JSIL support libraries for LINQ Expressions interpretation will be loaded (about 2Mb). It will provide support for LambdaExpression and Expression Compile method, but will work only if System.Colocal assembly was translated with BCL proxies.
Extension Hooks
Key Arguments Description
getScreenDimensions void If provided, this function should return an array containing the width and height of the screen. This allows you to control the screen dimensions seen by consumers of the Windows Forms and XNA APIs.
reportFps drawsPerSecond, updatesPerSecond, cacheSize, isWebGL If provided, this function is called once per second with information on the current performance of the running game.
updateProgressBar prefix, suffix, bytesLoaded, bytesTotal If provided, this function is called to update the loading progress bar. Prefix and suffix are strings that provide more information on the state of the loading process. bytesLoaded and bytesTotal represent the progress of the load. Note that loads currently have multiple stages so you will see progress go from 0 to 100% at least twice.
onLoadFailure path, errorText If provided, this function is called once each time a file fails to load.
onLoadFailed loadFailures If provided, this function is called once at the end of the loading process if any part of the load failed. The loadFailures argument is an array containing information on all of the failures. You can use this callback to present simple information to the user informing them that the load failed and suggesting solutions.