new GOWN.ThemeParser(jsonPath, global)
Load a theme from a .json file.
Name | Type | Default | Description |
---|---|---|---|
jsonPath |
String | The path to the .json file | |
global |
bool | true | optional Set theme as the global GOWN.theme |
Extends
Members
-
hoverSkinbool
-
Desktop themes have a hover skin if the mouse moves over the button
- Default Value:
- true
-
skinComponentsObject
-
Components that show something and can be used as skin
- See:
-
- GOWN.shapes
-
textStyleGOWN.ThemeFont
-
The default font for all labels (e.g. button label)
-
textureCacheArray.<PIXI.Texture>
-
The cache for the theme textures
-
thumbSkinbool
-
Use an own skin for scroll/slider track (uses the default button skin otherwise)
- Default Value:
- true
Methods
-
inherited addImage(jsonPath)
-
Set up the asset loader and load files
Name Type Description jsonPath
String The path to the json file -
addThemeData(jsonPath)
-
Adds the theme data located at the specified path
Name Type Description jsonPath
The path the .json file -
applyTheme()
-
Apply the theme to the controls (normally executed only once after the texture has been loaded)
-
inherited getImage(name){function}
-
Create a new Sprite from an image name
Name Type Description name
String Id defined in the asset loader Returns:
Type Description function -
getScale9(scale){PIXI.Rectangle}
-
Get the scale9 grid data from the theme data
Name Type Description scale
Array.<Number> Rectangle position and size Returns:
Type Description PIXI.Rectangle -
inherited getScaleContainer(name, grid, middleWidth, centerHeight){function}
-
Create a new Scalable Container
Name Type Description name
String Id defined in the asset loader grid
PIXI.Rectangle Grid defining the inner square of the scalable container middleWidth
Number optional The alternative width to crop the center piece (only needed if we want to scale the image smaller than the original) centerHeight
Number optional The alternative height to crop the center piece (only needed if we want to scale the image smaller than the original) Returns:
Type Description function -
inherited getSkin(comp, state){PIXI.DisplayObject}
-
Get a skin by a component name and state (or type)
Name Type Description comp
String Name of the component (e.g. button) state
String State or type of the skin (e.g. "up") Returns:
Type Description PIXI.DisplayObject -
getSkinComponents()
-
Get the component classes that can create skins (in general all GOWN.shapes). Note that image textures are not components
Returns:
Object -
getSkinData(stateName, skinData, data)
-
Create a dictionary containing the skin data (including default values)
Name Type Description stateName
String The name of the current state (e.g. GOWN.Button.UP) skinData
String The data gathered from previous runs data
Object The new data that will be copied into skinData -
loadComplete(loader, resources)
-
Executed when the image has been loaded. Sets cache and and applies the theme.
Name Type Description loader
Loader The loader resources
Object The loaded resources - See:
-
- addImage
- resource-loader https://github.com/englercj/resource-loader
-
parseData(data)
-
Parse the theme data
Name Type Description data
Object The theme data -
inherited setCache(resources)
-
Set the texture cache (normally called when loading is complete)
Name Type Description resources
Object The loaded resources -
inherited setSkin(comp, id, skin)
-
Set the skin for a UI component
Name Type Description comp
String UI component that we want to skin, e.g. "button" id
String Id for the skin (e.g. state when the skinning function will be applied skin
function skin-function that will executed once the component gets updated -
skinFromData(skinData, data){function}
-
Create a new skin from the theme data
Name Type Description skinData
Object The skin data data
Object The theme data Returns:
Type Description function the skin function