OpenEnroth 631fe01
|
Functions | |
static int | roundIntDown (int a, int b) |
static int | divIntDown (int a, int b) |
int | itemOffset (int dimension) |
Calculate offsets for placing items in inventory grid. More... | |
Pointi | mapToInventoryGrid (Pointi mousePos, Pointi inventoryTopLeft) |
|
static |
int itemOffset | ( | int | dimension | ) |
Calculate offsets for placing items in inventory grid.
Inventory grid have 32x32 pixels cells. Items don't exactly fit into the grid, but are slightly smaller or larger. The function calculates offsets for the item to be centered. Calculations are the same for height and width.
dimension | Width or height of the item. |
mousePos | Mouse position. |
inventoryTopLeft | Top left position of the inventory grid. |
|
static |