The purpose of this guide is to make creating your own button button "skin" as easy as possible. Since a skin's settings are formatted in a LUA table, this guide will require at least a basic understanding of LUA syntax. If you have no experience with LUA, you can always do some reading. It's also recommended that you read this image guide, as you'll need that information when creating your images.
Tip: You can download the ButtonFacade: Developer package when it's available to help with getting started.
Now that you have the tools, it's time to move on to what makes up a skin.
A skin is composed of "layers" of textures, colors and text overlays. A layer is simply a container for whatever object happens to reside in it. Each layer has a specific set of attributes that define how the game draws that layer and its contents.
As was mentioned previously, a skin is simply a LUA table that defines the layers and their contents. The format is quite simple when broken down to its basic components, as you can see in the following example.
LibButtonFacade:AddSkin("Skin Name", { -- Skin data start. Layer = { Attribute = value, }, -- Skin data end. }, true)
The :AddSkin() function does all the work once the appropriate layers and their attributes are set. The first argument is the name of the skin, the second argument is the table containing the skin data and the third argument is a boolean of whether or not to overwrite an existing skin of the same name.
There are three types of layer that make up a skin:
Displays a texture using the given attributes. All textures layers must have a texture path set.
Displays a predefined animation. In most cases, the texture path should never be changed from the default Blizzard animation.
Displays text overlays such as item count, macro name, etc.
ButtonFacade uses predefined layers to apply skins. The following is a list of all available layers in order from bottom (first) to top (last):
Texture Layer
The bottom-most layer. Uses standard texture attributes.
Texture Layer
Spell or skill icon for the button.
Texture layer
Combat/attack indicator.
Model Layer
Cool-down animation.
Model Layer
Auto-cast animation. Only used on square buttons.
Texture Layer
The "border" or "normal" texture for the button.
Texture Layer
Texture for the "pushed" state. Replaces the "normal" texture unless the "Static" attribute is set to "true".
Texture Layer
Layer for the "equipped" state.
Texture Layer
Texture for the "disabled" state. Replaces the "normal" texture unless the "Static" attribute is set to "true".
Texture Layer
Highlight layer for active skills, stances, etc.
Texture Layer
Texture marking its auto-cast property.
Texture Layer
Highlight layer for mouse-overs.
Texture Layer
"Gloss" or "glaze" layer.
Text Layer
Text for the hot key.
Text Layer
Text for the item count.
Text Layer
Text for the macro name.
A layer's attributes define how that layer is drawn on the screen. The following is a list of available attributes.
Whether or not the layer is hidden. Available for all layers. If a layer is to be unused, this should be the only attribute that should be set (to "true") for that layer.
The width of the layer in pixels. Available for all layers.
The height of the layer in pixels. Available for all layers.
The scale of the layer. Available for all layers.
Horizontal offset in pixels. Available for all layers.
Vertical offset in pixels. Available for all layers.
The amount of red affecting the layer. Only available for the Normal layer. Defaults to 1.0.
The amount of red affecting the layer. Only available for the Normal layer. Defaults to 1.0.
The amount of red affecting the layer. Only available for the Normal layer. Defaults to 1.0.
The amount of red affecting the layer. Only available for the Normal layer. Defaults to 1.0.
The path to the texture. Available for texture layers only. Required.
Texture coorinates. Availabe for texture layers only. Defaults to {0,1,0,1}
The blending mode of the layer. Available for texture layers only. Modes are:
When set to "true", prevents the Normal layer from being replaced by the Checked and Disabled layers. Only available for the Normal layer.
[[path/to/file]].
Skin authors can specify an existing skin to use as a template. This "copy" will retain all the settings of the copied skin except for those specified in the skin data. For example:
Template = "Sample", Normal = { Texture = [[Path/To/New/Texture]] },
Would copy the "Sample" skin and replace its "Normal" texture with the new one.
Note: The replacement is done at the layer level so one has to specify all of the attributes for that layer, even if unchanged.
© 2008-2009 Curse Inc.