Superpowers Game fText plugin
This plugin brings a generic text asset of type
fText to the
Superpowers Game system for Superpowers, the extensible HTML5 2D+3D game engine.
- Download the latest release,
- unzip it then rename the folder to
- delete the
projectfolder if you want,
- move it inside
- then restart your server.
Creating a new asset
When creating a new asset in Superpowers' client, select the
Editor features and settings
The editor's theme, tab size and some other settings can be set through the "Text Editor" settings.
fText introduce some other settings :
|Setting||Action / Effect|
|Auto close brackets||Automatically add the closing character when writing the following characters
- active line: Makes the current line stand out.
- trailing spaces: in red.
- matching tags: in languages that have pairs of tags -like HTML- having the mouse cursor over one will highlight the other one.
- matching words: when a word is selected, this highlight all other occurrences in the document.
|Linting||Enable/disable linting of the syntaxes (not all syntaxes can be linted)|
Syntactic coloration and linting
The syntactic coloration and linting kicks in when the asset's extension is recognized.
The asset's extension can be any of CodeMirror's loaded modes or MIME type, some having standard short version.
Supported modes and extensions are :
|Mode||Short extension||is linted|
json (application/json MIME type)
|clike||shader (x-shader/x-fragment MIME type)|
Examples of asset name :
changelog.md data.cson template.pug
You can include a text asset's content into another with the
Just write in your asset :
path/to/the/asset by the path to the asset to include inside this one.
The specified asset content will then be included when the asset is parsed with the
Since assets are usually parsed before the inclusion is performed, it is best to have comment characters immediately before the command.
fText is the type of the text assets inside your game's code. Get an asset like this:
let asset = Sup.get( "My Text Asset", fText ); // or let asset = Sup.get( "My Text Asset" ) as fText;
You can access the raw text content of the asset via the
getText() method :
let asset = Sup.get( "My Text Asset", fText ); let data = asset.getText();
You can parse the asset's content with the
parse() method as well as access all parsers through the static property
let asset = Sup.get( "My Jade Asset", fText ); let html = asset.parse(); let elt = fText.parsers.domify( html ); document.body.appendChild( elt ); // note that document is not accessible inside your game's code // without the DOM plugin you can find at: // https://github.com/florentpoujol/superpowers-dom-plugin
ymlare parsed to JS object.
md> HTML string
html> DOM object
styl> CSS string
project folder contains a test/demo project.
To run it, put the project's
fText folder in Superpowers' projects folder, and (re)start the server.