Classes:InventoryBarState
InventoryBarState is a UI-scoped ZScript class normally utilized by ZScript HUDs (classes based on BaseStatusBar) to draw the inventory bar. The drawing itself is usually done with the DrawInventoryBar function.
This class is normally initiated in BaseStatusBar's Init function, and stores all information about the items that must be shown in the bar (which, at the minimum, requires that the item has the Inventory.INVBAR flag).
Methods
Static
InventoryBarState Create(HUDFont indexfont = null, int cr = Font.CR_UNTRANSLATED, double itemalpha = 1., String boxgfx = "ARTIBOX", String selgfx = "SELECTBO", Vector2 innersize = (0, 0), String leftgfx = "INVGEML1", String rightgfx = "INVGEMR1", Vector2 arrowoffs = (0, 0), int flags = 0)
- Initializes this class.
- HUDFont indexfont
- The HUDFont class to be used as the font to draw item amount numbers. Defaults to "indexfont" if left unspecified.
- int cr
- The color of the font to be used. Contains a text color value as defined in the Font struct. If the font wasn't specified, the font will default to "indexfont", and this will be set to Font.CR_Gold.
- double itemalpha
- Translucency of the item icons.
- String boxgfx
- Name of the texture to be used as an item bar's box.
- String selgfx
- Name of the texture to be used as the selector.
- Vector2 innersize
- The inner size of the box where the item is drawn.
- String leftgfx
- Name of the texture for the arrow pointing left (when there are some more item icons to the left that don't fit in the currently drawn bar).
- String rightgfx
- Name of the texture for the arrow pointing right (when there are some more item icons to the right that don't fit in the currently drawn bar).
- Vector2 arrowoffs
- Determines the offset of the arrow that appears if there are too many icons to fit into the bar. (Need more info)
- int flags
- Flags that determine the position of the bar. Multiple flags can be combined with
|
. The following are available: - The DI_SCREEN* flags will change the origin point of the coordinates where the element is drawn (essentially, moving where the (0, 0) point is located.
- DI_SCREEN_LEFT_TOP - The coordinates begin at the top left corner of the screen
- DI_SCREEN_CENTER_TOP - The coordinates begin at the top center of the screen
- DI_SCREEN_RIGHT_TOP - The coordinates begin at the top right corner of the screen
- DI_SCREEN_LEFT_CENTER - The coordinates begin at the center left side of the screen
- DI_SCREEN_CENTER - The coordinates begin at the center of the screen
- DI_SCREEN_RIGHT_CENTER - The coordinates begin at the center right side of the screen
- DI_SCREEN_LEFT_BOTTOM - The coordinates begin at the bottom left corner of the screen
- DI_SCREEN_CENTER_BOTTOM - The coordinates begin at the bottom center of the screen
- DI_SCREEN_RIGHT_BOTTOM - The coordinates begin at the bottom right corner of the screen
- Note, these flags do not change the orientation of coordinates. Regardless of where the element is drawn, positive X moves it to the right, positive Y moves it down.
- More flags are defined in the StatusBarCore class, but they're mostly aliases of the above ones.
InventoryBarState CreateNoBox(HUDFont indexfont = null, int cr = Font.CR_UNTRANSLATED, double itemalpha = 1., Vector2 boxsize = (32, 32), String selgfx = "SELECTBO", Vector2 innersize = (0, 0), String leftgfx = "INVGEML1", String rightgfx = "INVGEMR1", Vector2 arrowoffs = (0, 0), int flags = 0)
- Same as Create(), but doesn't draw any boxes behind the items: only item icons and a selector are drawn. The arguments are the same with the exception of the boxgfx argument, which is not used.
Variables
These variables are readable and modifiable, but primarily they're meant to be set with the Create() method (documented above) rather than directly.
- TextureID box
- TextureID of an item bar's box.
- TextureID selector
- TextureID of the selector.
- Vector2 boxsize
- The size of the item icon box.
- Vector2 boxofs
- (Need more info)
- Vector2 selectofs
- Selector position offsets.
- Vector2 innersize
- Inner size of the item's box.
- TextureID left
- Left arrow texture.
- TextureID right
- Right arrow texture.
- Vector2 arrowoffset
- Arrow offsets.
- double itemalpha
- Translucency of the item icons.
- HUDFont amountfont
- HUDFont used to display the numbers.
- int cr
- Font color as defined in the Font struct.
- int flags
- DI* flags.