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

jsilConfig

kevingadd edited this page Sep 11, 2012 · 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:

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 ""
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.
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.
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.