| 1 |
/*! |
| 2 |
|
| 3 |
\page Game_Controller Game Controller |
| 4 |
\brief **Used to display a game controller, with optional effects.** |
| 5 |
|
| 6 |
\tableofcontents |
| 7 |
|
| 8 |
The game controller control is used for displaying a game controller, such as |
| 9 |
joysticks, keyboards, mice, lightguns, etc. |
| 10 |
|
| 11 |
In v21 Omega, the control was expanded to give skinners more control over how |
| 12 |
it behaves, including manually specifying a controller to show, allowing for |
| 13 |
a fallback image, and applying a highlighting diffuse effect when the underlying |
| 14 |
controller is active. |
| 15 |
|
| 16 |
|
| 17 |
-------------------------------------------------------------------------------- |
| 18 |
\section Game_Controller_sect1 Example |
| 19 |
|
| 20 |
~~~~~~~~~~~~~ |
| 21 |
<control type="gamecontroller"> |
| 22 |
<description>My first game controller</description> |
| 23 |
<posx>80</posx> |
| 24 |
<posy>60</posy> |
| 25 |
<width>250</width> |
| 26 |
<height>200</height> |
| 27 |
<controllerid>game.controller.snes</controllerid> |
| 28 |
</control> |
| 29 |
~~~~~~~~~~~~~ |
| 30 |
|
| 31 |
|
| 32 |
-------------------------------------------------------------------------------- |
| 33 |
\section Game_Controller_sect2 Available tags |
| 34 |
|
| 35 |
The [default control](http://kodi.wiki/view/Default_Control_Tags) tags are |
| 36 |
applicable to this control. Note that each tag is lower case only. This is |
| 37 |
important, as xml tags are case-sensitive. |
| 38 |
|
| 39 |
In v21 and above, the control derives from an \ref Image_Control "Image Control" |
| 40 |
to allow for a fallback texture. All tags and attributes for images can be used, |
| 41 |
and any game-specific tags will cause the texture to be overridden. |
| 42 |
|
| 43 |
The game-specific tags added in v21 are: |
| 44 |
|
| 45 |
| Tag | Description | |
| 46 |
|-------------------:|:--------------------------------------------------------------| |
| 47 |
| controllerid | The add-on ID of the controller profile to render, e.g. <b>`game.controller.snes`</b>. |
| 48 |
| controllerdiffuse | A diffuse color used to highlight the controller when activity is detected on the in-game port or on the underlying peripheral held by the user. |
| 49 |
| controlleraddress | The in-game "address" of the controller, e.g. <b>`/1/game.controller.snes`</b> for a SNES controller connected to console port 1. Used to highlight the controller on port activity. Overrides <b>`<controllerid>`</b> and <b>`<portaddress>`</b>. |
| 50 |
| portaddress | The in-game "address" of the port the controller is connected to, e.g. <b>`/1`</b> for port 1 of a SNES emulator. Used to highlight the controller on port activity. |
| 51 |
| peripherallocation | The location of the underlying peripheral providing input, e.g. <b>`/joystick/0`</b> for the first physical controller held by the user. Used to hightlight the controller on peripheral activity. |
| 52 |
|
| 53 |
@skinning_v21 The control has been greatly expanded to allow for more use cases in the new Player Viewer (<b>`GameAgents`</b>) dialog. |
| 54 |
|
| 55 |
|
| 56 |
-------------------------------------------------------------------------------- |
| 57 |
\section Game_Controller_sect3 Controller address |
| 58 |
|
| 59 |
The controller address is connected to the in-game input. It's formed by the |
| 60 |
emulated console's port, followed by the controller ID. |
| 61 |
|
| 62 |
For example, on SNES controllers, the address of the first port is <b>`/1`</b>. |
| 63 |
The address of a SNES controller connected to that port is |
| 64 |
<b>`/1/game.controller.snes`</b>. |
| 65 |
|
| 66 |
Old consoles used multitaps (controller hubs) to allow for more players than |
| 67 |
console ports. A multitap connected to port <b>`/2`</b> would have the address |
| 68 |
<b>`/2/game.controller.snes.multitap`</b>. |
| 69 |
|
| 70 |
A SNES controller connected to port 1 on a multitap would then have the address |
| 71 |
<b>`/2/game.controller.snes.multitap/1/game.controller.snes`</b>. |
| 72 |
|
| 73 |
|
| 74 |
-------------------------------------------------------------------------------- |
| 75 |
\section Game_Controller_sect4 Peripheral location |
| 76 |
|
| 77 |
Peripherals are located by their driver and peripheral index. For example, the |
| 78 |
first controller connected via the peripheral.joystick add-on (<b>`joystick`</b> |
| 79 |
driver) would be <b>`/joystick/0`</b>. |
| 80 |
|
| 81 |
|
| 82 |
-------------------------------------------------------------------------------- |
| 83 |
\section Game_Controller_sect5 List item info |
| 84 |
|
| 85 |
List item info can be used for all tag values. For example, if the control defintion looks like: |
| 86 |
|
| 87 |
~~~~~~~~~~~~~ |
| 88 |
<itemlayout width="96" height="96"> |
| 89 |
<control type="gamecontroller"> |
| 90 |
<texture>$INFO[ListItem.Icon]</texture> |
| 91 |
<controllerid>$INFO[ListItem.Property(controllerid)]</controllerid> |
| 92 |
</control> |
| 93 |
</itemlayout> |
| 94 |
~~~~~~~~~~~~~ |
| 95 |
|
| 96 |
Static list items can be provided and each control will inherit the properties: |
| 97 |
|
| 98 |
~~~~~~~~~~~~~ |
| 99 |
<content> |
| 100 |
<item> |
| 101 |
<icon>DefaultAddonNone.png</icon> |
| 102 |
</item> |
| 103 |
<item> |
| 104 |
<property name="controllerid">game.controller.snes</property> |
| 105 |
</item> |
| 106 |
</content> |
| 107 |
~~~~~~~~~~~~~ |
| 108 |
|
| 109 |
The in-game dialogs that highlight game controllers on button presses (<b>`GamePorts`</b> and <b>`GameAgents`</b>) use a similar strategy with list items populated by core. |
| 110 |
|
| 111 |
|
| 112 |
-------------------------------------------------------------------------------- |
| 113 |
\section Game_Controller_sect6 See also |
| 114 |
|
| 115 |
#### Development: |
| 116 |
|
| 117 |
- [Add-on development](http://kodi.wiki/view/Add-on_development) |
| 118 |
- [Skinning](http://kodi.wiki/view/Skinning) |
| 119 |
|
| 120 |
*/ |