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 jsonPathString The path to the json file -
addThemeData(jsonPath)
-
Adds the theme data located at the specified path
Name Type Description jsonPathThe 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 nameString 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 scaleArray.<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 nameString Id defined in the asset loader gridPIXI.Rectangle Grid defining the inner square of the scalable container middleWidthNumber optional The alternative width to crop the center piece (only needed if we want to scale the image smaller than the original) centerHeightNumber 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 compString Name of the component (e.g. button) stateString 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 stateNameString The name of the current state (e.g. GOWN.Button.UP) skinDataString The data gathered from previous runs dataObject 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 loaderLoader The loader resourcesObject The loaded resources - See:
-
- addImage
- resource-loader https://github.com/englercj/resource-loader
-
parseData(data)
-
Parse the theme data
Name Type Description dataObject The theme data -
inherited setCache(resources)
-
Set the texture cache (normally called when loading is complete)
Name Type Description resourcesObject The loaded resources -
inherited setSkin(comp, id, skin)
-
Set the skin for a UI component
Name Type Description compString UI component that we want to skin, e.g. "button" idString Id for the skin (e.g. state when the skinning function will be applied skinfunction 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 skinDataObject The skin data dataObject The theme data Returns:
Type Description function the skin function