Difference between revisions of "AddIconToken"

From King Arthur's Gold Wiki
Jump to: navigation, search
(Created page with "<onlyinclude> Not really sure - think this places an icon marker on the minimap </onlyinclude> There are two variants, one of which will also accept a color (SColor). <syntax...")
 
Line 1: Line 1:
 
<onlyinclude>
 
<onlyinclude>
Not really sure - think this places an icon marker on the minimap
+
This defines an token (e.g. $EmptyShop$) for icon replacement in menus and suchlike.
 
</onlyinclude>
 
</onlyinclude>
 +
 
There are two variants, one of which will also accept a color ([[SColor]]).
 
There are two variants, one of which will also accept a color ([[SColor]]).
 
<syntaxhighlight lang="cpp">void AddIconMarker( const string &marker, const string &texture, dimension2di frameDimension, int frame, [[SColor]] color )</syntaxhighlight>
 
<syntaxhighlight lang="cpp">void AddIconMarker( const string &marker, const string &texture, dimension2di frameDimension, int frame, [[SColor]] color )</syntaxhighlight>
Line 12: Line 13:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
This icon marker means that whenever $EmptyShop$ is included in menu text, the first frame of the WorkshopIcons.png spritesheet will be substituted in.
  
 
[[Category:Scripting]]
 
[[Category:Scripting]]
 
[[Category:Global Functions]]
 
[[Category:Global Functions]]

Revision as of 15:11, 15 August 2012

This defines an token (e.g. $EmptyShop$) for icon replacement in menus and suchlike.


There are two variants, one of which will also accept a color (SColor).

void AddIconMarker( const string &marker, const string &texture, dimension2di frameDimension, int frame, [[SColor]] color )

Example from Entities/Characters/Scripts/BuilderInventory.as:

void [[onInit]]( [[CInventory]]@ this )
{
  AddIconMarker( "$EmptyShop$", "Entities/Workshops/Sprites/WorkshopIcons.png", dimension2di(16,16), 0 );
}

This icon marker means that whenever $EmptyShop$ is included in menu text, the first frame of the WorkshopIcons.png spritesheet will be substituted in.