User Tools

Site Tools


crpl:docs:getmousescreenpixelposition

<- CRPL reference <- Input Commands

GetMouseScreenPixelPosition

ArgumentsResultNotation
X and Y relative coordinates of mouse – f1 f2

Description

Pushes the X then the Y pixel coordinate of the mouse relative to the screen to the stack. 0,0 corresponds to the lower left corner of the screen, and ScreenWidth, ScreenHeight to the upper right corner of the screen. Note that the results can lie outside of this range if the mouse is outside the game window.

Note that the command GetMousePosition is similar, but measures from the lower left corner of the map in map pixels, which get smaller as the player zooms out. Unlike GetMousePosition, the results of this command won't change as the player zooms or pans.

The outputs of this command are the outputs of GetMouseScreenPosition multiplied by ScreenWidth and ScreenHeight respectively.

Added in 1.7.1.

Examples

# A CRPL core which moves to the cursor on click, and maintains its position on the screen
once
  SetScreenMode(TRUE)
endonce
if(GetMouseButtonDown(0))
  SetScreenPixelCoords(GetMouseScreenPixelPosition)
endif
crpl/docs/getmousescreenpixelposition.txt · Last modified: 2021/02/05 11:44 by Karsten75