Skip to content

Commit 5b562bb

Browse files
GetLocalPlayerFrotty
authored andcommitted
Mouse functions for Framhandle package (#316)
1 parent 03a3334 commit 5b562bb

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

wurst/_handles/Framehandle.wurst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,3 +385,33 @@ public function showOriginFrames()
385385
/** Loads a toc file from the given path, to include custom fdf files from, returns true on success */
386386
public function loadTOCFile(string tocFile) returns bool
387387
return BlzLoadTOCFile(tocFile)
388+
389+
let mouseCage = createFrame("FRAME", "SetMousePositionCage", GAME_UI, null, 0)
390+
..setSize(0.0001, 0.0001)
391+
392+
/** Places the mouse cursor at the given point of the screen. Uses the same coodinate system as framehandles. */
393+
public function setMousePos(vec2 pos)
394+
mouseCage..clearAllPoints()
395+
..setPoint(FRAMEPOINT_BOTTOMLEFT, GAME_UI, FRAMEPOINT_BOTTOMLEFT, pos)
396+
..cageMouse(true)
397+
..cageMouse(false)
398+
399+
/** Places the mouse cursor in the center of the frame. */
400+
public function framehandle.setMousePos()
401+
mouseCage..clearAllPoints()
402+
..setPoint(FRAMEPOINT_CENTER, this, FRAMEPOINT_CENTER)
403+
..cageMouse(true)
404+
..cageMouse(false)
405+
406+
/** Places the mouse cursor at the given point of the screen. Uses the window's coordinate system (in pixels) where (0, 0) is top-left corner of the window and positive direction of Y axis is "down". */
407+
public function setMousePos(integer x, integer y)
408+
BlzSetMousePos(x, y)
409+
410+
public function enableCursor()
411+
BlzEnableCursor(true)
412+
413+
public function disableCursor()
414+
BlzEnableCursor(false)
415+
416+
public function setCursorEnabled(bool flag)
417+
BlzEnableCursor(flag)

0 commit comments

Comments
 (0)