// Henjin Mouse Demo // (c) 2008, Notequalsoft Games // http://www.notequalsoft.com/games/henjin/ // This demo demonstrates the capture and use of mouse coordinates. // setup system System.Size 640 480 System.CreateTextBox TextBox 0 0 640 480 TextBox.DisplayAtOnce true // react every tenth of a second label REACT ondelaygoto 100 DISPLAYCOORDS react // display mouse coordinates every tenth of a second label DISPLAYCOORDS // display current mouse coordinates first set inrange = false set x = System.MouseX set y = System.MouseY if x >= 0 if x <= System.Width if y >= 0 if y <= System.Height set inrange = true endif endif endif endif if inrange = true TextBox.Text "CURRENT: {x},{y}" else TextBox.Text "CURRENT: (outside range)" endif // display last mouse click coordinates last set inrange = false set x = System.MouseClickX set y = System.MouseClickY if x >= 0 if x <= System.Width if y >= 0 if y <= System.Height set inrange = true endif endif endif endif if inrange = true TextBox.AddText "\nLAST CLICK: {x},{y}" else TextBox.AddText "\nLAST CLICK: (outside range)" endif // set up next reaction goto REACT