RuleSource

ldtk.rules.RuleSource (Interface) → ArrayRuleSource

Read access to the IntGrid layer a rule pattern is matched against. Implemented by the LDtk editor layer instance and by ArrayRuleSource.

Instance Members

getWidth(): Int
Returns
Int

getHeight(): Int
Returns
Int

getIntGrid(cx: Int, cy: Int): Int

IntGrid value at given coord (0 = empty). Only called with in-bounds coords.

Name Type
cx Int
cy Int
Returns
Int

getGroupUidOfValue(v: Int): Int

IntGrid group uid of given IntGrid value, or -1 if the value is unknown or 0

Name Type
v Int
Returns
Int

containsIntGridValueOrGroup(v: Int): Bool

Prefilter: TRUE if given IntGrid value (or group rule value, see RuleConst) exists anywhere in the layer. May over-approximate (return TRUE when unsure) but must never under-approximate.

Name Type
v Int
Returns
Bool

hasIntGridValueInArea(v: Int, cx: Int, cy: Int): Bool

Prefilter: TRUE if given IntGrid value (or group rule value) exists in the RuleConst.AREA_SIZE square area containing given coord. Same over-approximation rule as above. Coords may be out of bounds.

Name Type
v Int
cx Int
cy Int
Returns
Bool