Skip to content

1681-engine / index / gridPlacement

Function: gridPlacement() ​

ts
function gridPlacement(
   originX, 
   originY, 
   zoom, 
   resolution, 
   screenWidth, 
   screenHeight
): GridPlacement;

Defined in: src/core/gridPlacement.ts:20

The pixel grid's arithmetic (PixelGrid). originX/Y is where the camera put the world's origin on screen (the scroll, plus any shake), zoom screen pixels a world pixel, resolution backing pixels a screen pixel. The texture starts on the whole world pixel at the screen's corner and is moved by what is left over, rounded to a backing pixel, so a world pixel never lands between two.

Parameters ​

ParameterType
originXnumber
originYnumber
zoomnumber
resolutionnumber
screenWidthnumber
screenHeightnumber

Returns ​

GridPlacement

Released under the MIT License.