Skip to content

Commit

Permalink
add examples/hid/mouse-cursor.ck
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Nov 22, 2024
1 parent b776a3b commit 72202e0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions examples/hid/mouse-cursor.ck
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//-----------------------------------------------------------------------------
// name: mouse-cursor.ck
// desc: quickly access the current Mouse cursor coordinates
// (for full access to mouse input, see the Hid class)
//-----------------------------------------------------------------------------
// ALSO SEE mouse-abs.ck for absolute screen position
// ALSO SEE mouse.ck for relative X Y deltas
//
// requires: chuck-1.5.4.2 or higher
//-----------------------------------------------------------------------------

// time loop
while( true )
{
// get current XY mouse cursor absolute coordinates
// as well as scaled coordinates (in [0,1])
// .xy() could return negative values for multi-monitor
// .scaled() will always return values in [0,1]
<<< MouseCursor.xy(), MouseCursor.scaled() >>>;

// advance time
25::ms => now;
}

0 comments on commit 72202e0

Please sign in to comment.