PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

ViewSizeY

Mouse

int

The ViewSizeY property describes the vertical component of the game window’s size in pixels. This length includes the space used by the topbar.


Code Samples


Normalized Mouse Position

This code sample shows how you can create a DataType/Vector2 representing the Mouse object’s position on screen (Mouse/X|X and Mouse/Y|Y) and the size of the screen itself (Mouse/ViewSizeX|ViewSizeX and Mouse/ViewSizeY|ViewSizeY). Using these, you can normalize the position of the mouse on-screen such that the top-left just under the topbar maps to (0, 0) and the bottom-right maps to (1, 1). This normalized position is calculated and printed as the mouse moves using the Mouse/Move|Move event.