neon_crisp / Modules / utils/cardScreenUtils
Module: utils/cardScreenUtils
Table of contents
Functions
Functions
createGridPlacer
▸ createGridPlacer(objectWidth, objectHeight, rows, cols, objectWidthOffset?, objectHeightOffset?, padding?, anchor?): (index: number) => { x: number ; y: number }
Creates a function to determine the (x, y) position of an object in a grid.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
objectWidth | number | undefined | The width of each object in the grid. |
objectHeight | number | undefined | The height of each object in the grid. |
rows | number | undefined | The number of rows in the grid. |
cols | number | undefined | The number of columns in the grid. |
objectWidthOffset | number | 0 | The width offset to make the anchor of the object bottom left of each object in the grid. |
objectHeightOffset | number | 0 | The height offset to make the anchor of the object bottom left of each object in the grid. |
padding | number | 0 | padding in the grid. |
anchor | Anchor | "center" | The anchor point determining how the object is positioned within its cell. |
Returns
fn
A function that takes an index and returns the (x, y) position.
▸ (index): Object
Parameters
| Name | Type |
|---|---|
index | number |
Returns
Object
| Name | Type |
|---|---|
x | number |
y | number |
Defined in
getCardScale
▸ getCardScale(handSize, windowX): number
Parameters
| Name | Type |
|---|---|
handSize | number |
windowX | number |
Returns
number
Defined in
getRealNodeSize
▸ getRealNodeSize(guiNode, scaledNode, newScale?): vector3
Parameters
| Name | Type |
|---|---|
guiNode | node |
scaledNode | node |
newScale? | vector3 |
Returns
vector3
Defined in
getScreenPOSForIndex
▸ getScreenPOSForIndex(index, windowX, windowY, topOfCenter, handLength?, cardScale?): vector3
Parameters
| Name | Type | Default value |
|---|---|---|
index | number | undefined |
windowX | number | undefined |
windowY | number | undefined |
topOfCenter | boolean | undefined |
handLength | number | 4 |
cardScale | number | 1 |
Returns
vector3
Defined in
posForGridOfCards
▸ posForGridOfCards(index, bottomOffset?, cardWidth?, cardHeight?, screenWidth?): vector3
Parameters
| Name | Type | Default value |
|---|---|---|
index | number | undefined |
bottomOffset | number | 0 |
cardWidth | number | 150 |
cardHeight | number | 225 |
screenWidth | number | 640 |
Returns
vector3