Chili: Difference between revisions

From Spring
Jump to navigationJump to search
m move examples
mNo edit summary
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Main_Page|Wiki]] < {{FULLPAGENAME}}
== Chili UI ==
== Chili UI ==


Chili is Springs very own GUI framework. It's a flexible, class based framework which allows you to create great looking GUIs very quickly.  
Chili is Springs very own GUI framework. It's a flexible, class based framework which allows you to create great looking GUIs very quickly. See [[Chili:ScreenShots| Screenshots]].
=== Learning Chili ===


Before working with Chili, it is strongly recommended to be familiar with using [[Lua_Scripting| Lua in Spring]]. See [[Chili/Chili_Adding_To_Game|this page]] for instructions on how to include the Chili library into your game.
* [[Chili:Tutorial| Chili Tutorial]]
* [[Chili:Examples| Examples of Chili widgets]]


[[Chili/Chili_Tutorial| Chili Tutorial]]
Before working with Chili, it is strongly recommended to be familiar with using [[Lua_Scripting| Lua in Spring]], in particular with writing simple widgets.


[[Chili/Chili_Examples| Examples of Chili widgets]]
=== Including Chili ===


[[Chili/Chili_Screen| Screenshots]] (TODO!)
* [[Chili:Adding_To_Game|Adding Chili to a game]]
* [[Chili:Hiding_The_Default_GUI|Hiding Springs default GUI]]


== Chili Component Hierarchy ==
== Documentation: Chili Component Hierarchy ==


The Chili framework is object orientated, and each different component is a class. The hierarchy of components, which is documented [http://gajop.github.io/chiliui/index.html here],  is as follows:
The Chili framework is object orientated, and each different component is a class. The hierarchy of components, which is documented [https://gajop.github.io/chiliui/index.html here],  is as follows:


  [http://gajop.github.io/chiliui/modules/controls.object.html Object]
  [https://gajop.github.io/chiliui/modules/controls.object.html Object]
  |_ [http://gajop.github.io/chiliui/modules/controls.screen.html Screen]
  |_ [https://gajop.github.io/chiliui/modules/controls.screen.html Screen]
  |_ [http://gajop.github.io/chiliui/modules/controls.control.html Control]
  |_ [https://gajop.github.io/chiliui/modules/controls.control.html Control]
   |_ [http://gajop.github.io/chiliui/modules/controls.button.html Button]
   |_ [https://gajop.github.io/chiliui/modules/controls.button.html Button]
   |_ [http://gajop.github.io/chiliui/modules/controls.checkbox.html Checkbox]
   |_ [https://gajop.github.io/chiliui/modules/controls.checkbox.html Checkbox]
   |_ [http://gajop.github.io/chiliui/modules/controls.checkbox.html ColorBars]
   |_ [https://gajop.github.io/chiliui/modules/controls.checkbox.html ColorBars]
   |_ [http://gajop.github.io/chiliui/modules/controls.combobox.html ComboBox]
   |_ [https://gajop.github.io/chiliui/modules/controls.combobox.html ComboBox]
   |_ [http://gajop.github.io/chiliui/modules/controls.editbox.html EditBox]
   |_ [https://gajop.github.io/chiliui/modules/controls.editbox.html EditBox]
   |_ [http://gajop.github.io/chiliui/modules/controls.font.html Font]
   |_ [https://gajop.github.io/chiliui/modules/controls.font.html Font]
   |_ [http://gajop.github.io/chiliui/modules/controls.label.html Label]
   |_ [https://gajop.github.io/chiliui/modules/controls.label.html Label]
   |_ [http://gajop.github.io/chiliui/modules/controls.layoutpanel.html LayoutPanel]
   |_ [https://gajop.github.io/chiliui/modules/controls.layoutpanel.html LayoutPanel]
     |_ [http://gajop.github.io/chiliui/modules/controls.imagelistview.html ImageListView]
     |_ [https://gajop.github.io/chiliui/modules/controls.imagelistview.html ImageListView]
     |_ [http://gajop.github.io/chiliui/modules/controls.grid.html Grid]
     |_ [https://gajop.github.io/chiliui/modules/controls.grid.html Grid]
     |_ [http://gajop.github.io/chiliui/modules/controls.stackpanel.html StackPanel]
     |_ [https://gajop.github.io/chiliui/modules/controls.stackpanel.html StackPanel]
     |_ [http://gajop.github.io/chiliui/modules/controls.tabpanel.html TabPanel]
     |_ [https://gajop.github.io/chiliui/modules/controls.tabpanel.html TabPanel]
   |_ [http://gajop.github.io/chiliui/modules/controls.line.html Line]
   |_ [https://gajop.github.io/chiliui/modules/controls.line.html Line]
   |_ [http://gajop.github.io/chiliui/modules/controls.image.html Image]
   |_ [https://gajop.github.io/chiliui/modules/controls.image.html Image]
   |_ [http://gajop.github.io/chiliui/modules/controls.multiprogressbar.html MultiProgressBar]
   |_ [https://gajop.github.io/chiliui/modules/controls.multiprogressbar.html MultiProgressBar]
   |_ [http://gajop.github.io/chiliui/modules/controls.panel.html Panel]
   |_ [https://gajop.github.io/chiliui/modules/controls.panel.html Panel]
   |_ [http://gajop.github.io/chiliui/modules/controls.progressbar.html ProgressBar]
   |_ [https://gajop.github.io/chiliui/modules/controls.progressbar.html ProgressBar]
   |_ [http://gajop.github.io/chiliui/modules/controls.scale.html Scale]
   |_ [https://gajop.github.io/chiliui/modules/controls.scale.html Scale]
   |_ [http://gajop.github.io/chiliui/modules/controls.scrollpanel.html ScrollPanel]
   |_ [https://gajop.github.io/chiliui/modules/controls.scrollpanel.html ScrollPanel]
   |_ [http://gajop.github.io/chiliui/modules/controls.textbox.html TextBox]
   |_ [https://gajop.github.io/chiliui/modules/controls.textbox.html TextBox]
   |_ [http://gajop.github.io/chiliui/modules/controls.trackbar.html TrackBar]
   |_ [https://gajop.github.io/chiliui/modules/controls.trackbar.html TrackBar]
   |_ [http://gajop.github.io/chiliui/modules/controls.treeview.html TreeView]
   |_ [https://gajop.github.io/chiliui/modules/controls.treeview.html TreeView]
   |_ TreeViewNode
   |_ TreeViewNode
   |_ [http://gajop.github.io/chiliui/modules/controls.window.html Window]
   |_ [https://gajop.github.io/chiliui/modules/controls.window.html Window]


Viewing the diagram as a tree, each component inherits from its parent in the tree. In practice, this means each component has the properties/functionality of its own type, and also of all components found upwards from it in the tree. For example, a Grid has it's own properties, but also has those of a LayoutPanel, Control and Object.
Viewing the diagram as a tree, each component inherits from its parent in the tree. In practice, this means each component has the properties/functionality of its own type, and also of all components found upwards from it in the tree. For example, a Grid has it's own properties, but also has those of a LayoutPanel, Control and Object.
== Skinning Chili ==
Start with your desired <code>skin.lua</code>.
An example button skin will look like this:
<syntaxhighlight lang="lua">
skin.positive_button = {
  clone    = "window";
  TileImageBK = ":cl:tech_button_bright_small_bk.png",
  TileImageFG = ":cl:tech_button_bright_small_fg.png",
  tiles = {40, 40, 40, 40}, --// tile widths: left,top,right,bottom
  padding = {10, 10, 10, 10},
  backgroundColor = {0.50, 0.50, 0.50, 0.65},
  focusColor  = {0.50, 0.50, 0.50, 0.9},
  borderColor = {0.50, 0.50, 0.50, 0.15},
  DrawControl = DrawButton,
}
</syntaxhighlight>
* <code>TileImageBK</code> - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with <code>backgroundColor</code>
* <code>TileImageFG</code> - This image will be the foreground (drawn over background) of your control. Alpha values indicate transparency, and color values you will be multiplied with <code>borderColor</code>
* <code>tiles</code> - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with <code>backgroundColor</code>
* <code>padding</code> - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with <code>backgroundColor</code>
* <code>backgroundColor</code> - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with <code>backgroundColor</code>
* <code>focusColor</code> - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with <code>backgroundColor</code>
* <code>borderColor</code> - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with <code>backgroundColor</code>
[[Category:Libraries]]

Latest revision as of 12:32, 7 February 2021

Wiki < Chili

Chili UI

Chili is Springs very own GUI framework. It's a flexible, class based framework which allows you to create great looking GUIs very quickly. See Screenshots.

Learning Chili

Before working with Chili, it is strongly recommended to be familiar with using Lua in Spring, in particular with writing simple widgets.

Including Chili

Documentation: Chili Component Hierarchy

The Chili framework is object orientated, and each different component is a class. The hierarchy of components, which is documented here, is as follows:

Object
|_ Screen
|_ Control
 |_ Button
 |_ Checkbox
 |_ ColorBars
 |_ ComboBox
 |_ EditBox
 |_ Font
 |_ Label
 |_ LayoutPanel
   |_ ImageListView
   |_ Grid
   |_ StackPanel
   |_ TabPanel
 |_ Line
 |_ Image
 |_ MultiProgressBar
 |_ Panel
 |_ ProgressBar
 |_ Scale
 |_ ScrollPanel
 |_ TextBox
 |_ TrackBar
 |_ TreeView
  |_ TreeViewNode
 |_ Window

Viewing the diagram as a tree, each component inherits from its parent in the tree. In practice, this means each component has the properties/functionality of its own type, and also of all components found upwards from it in the tree. For example, a Grid has it's own properties, but also has those of a LayoutPanel, Control and Object.

Skinning Chili

Start with your desired skin.lua.

An example button skin will look like this:

<syntaxhighlight lang="lua"> skin.positive_button = {

 clone     = "window";
 TileImageBK = ":cl:tech_button_bright_small_bk.png",
 TileImageFG = ":cl:tech_button_bright_small_fg.png",
 tiles = {40, 40, 40, 40}, --// tile widths: left,top,right,bottom
 padding = {10, 10, 10, 10},
 backgroundColor = {0.50, 0.50, 0.50, 0.65},
 focusColor  = {0.50, 0.50, 0.50, 0.9},
 borderColor = {0.50, 0.50, 0.50, 0.15},
 DrawControl = DrawButton,

} </syntaxhighlight>


  • TileImageBK - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with backgroundColor
  • TileImageFG - This image will be the foreground (drawn over background) of your control. Alpha values indicate transparency, and color values you will be multiplied with borderColor
  • tiles - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with backgroundColor
  • padding - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with backgroundColor
  • backgroundColor - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with backgroundColor
  • focusColor - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with backgroundColor
  • borderColor - This image will be the background of your control. Alpha values indicate transparency, and color values you will be multiplied with backgroundColor