inventory
| Function Name | Parameter | Return | Explain |
| getBackColor | None | dword | Retrieves the background color of inventory area. |
| setBackColor | dword | None | Sets the background color of inventory area. |
| getBackImage | None | number nTexture | Retrieves the background image of inventory area. |
| setBackImage | number nTexture | None | Sets the background image of inventory area. |
| getCoverImage | None | number nTexture | Retrieves the cover image. See Remark1. |
| setCoverImage | number nTexture | None | Sets the cover image. |
| isRelativeCoordMode | None | boolean | Retrieves the state of relative coordinate mode. See Remark2. |
| setRelativeCoordMode | boolean | None | Sets the state of relative coordinate mode. |
| getArea | None | rect | Retrieves the coordinates of inventory area. |
| setArea | rect | None | Sets the coordinates of inventory area. |
| getCoverArea | None | rect | Retrieves the area coordinates of cover image view. |
| setCoverArea | rect | None | Sets the area coordinates of cover image view. |
| getItemOffset | None | number ofsx, ofsy | Retrieves the offset of item area ( relative to top left of inventory window ). |
| setItemOffset | number ofsx, ofsy | None | Sets the offset of item area ( relative to top left of inventory window ). |
| isShow | None | boolean | Determines whether the inventory window is show. |
| show | boolean | None | Show / Hide the inventory window. |
| draw | draw2d | None | Draw the inventory window. See Remark3. |
| onSize | number type, x, y | None | Should be called when the window size has changed. |
| onMouseMove | number x, y | boolean | Should be called when the mouse cursor has moved. |
| onLButtonDown | number x, y | boolean | Should be called when the mouse left button down. |
| onLButtonUp | number x, y | boolean | Should be called when the mouse left button up. |
| getSelectedItem | None | item | Retrieves the current selected item. |
| addItem | item | None | Appends a item to the inventory window. |
| deleteItem | string id | None | Removes a item from the inventory window. |
| findItem | string id | item | Finds item by ID string. |
| getItemList | None | array | Retrieves the item list, you can traverse all items by the list. See Remark4. |
| Lib Function | Parameter | Return | Explain |
| new | None | inventory |
Remark1:
A cover image will be top front view in viewport, this feature usually for
showing notepaper, etc. You can use setCoverArea
function to change view area.
Remark2:
In relative coordinate mode, the coordinate numbers means
rate to the viewport's width/height; (0,0) means top left point, and (1,1) means
bottom right point.
In absolute coordinate mode, the coordinate numbers means pixel position.
The relative coordinate mode only affect inventory window area and cover
image area.
Remark3:
For the default inventory instance g_inv,
the draw and events
responding functions
( onSize, etc ) already be
called in the game.lua file.
Remark4:
The item list is an array of
item.