OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Functions
ItemGrid.cpp File Reference
#include "ItemGrid.h"
#include <cassert>

Functions

static int roundIntDownToBase (int i, int base)
 
int itemOffset (int widthOrHeight)
 itemOffset Calculate offsets for placing items on a grid. More...
 

Function Documentation

◆ itemOffset()

int itemOffset ( int  dimension)

itemOffset Calculate offsets for placing items on a grid.

Parameters
dimensionwidth or height of the item

Inventory grid have 32x32 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 length and width.

Returns
offset in pixels

◆ roundIntDownToBase()

static int roundIntDownToBase ( int  i,
int  base 
)
inlinestatic