MouseYSpeed.htm 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>MouseYSpeed()</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. None.
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. Often you'd like to find the difference between where the mouse WAS to where it is NOW. You can use this command and MouseYSpeed() in pairs to find out the changes in the mouse location between calls. <br />
  21. <br />
  22. You really have to use these commands TWICE to get anything out of them. Each call you make returns the difference in location since the LAST time you called it. <br />
  23. <br />
  24. In this example it's called every loop and therefore allows you to have infinite mouse movement without the screen size restrictions.
  25. <br>
  26. <br>
  27. See also: <a class=small href=MouseXSpeed.htm>MouseXSpeed</a>.
  28. </td>
  29. </tr>
  30. </table>
  31. <h1><a href=../2d_examples/MouseYSpeed.bb>Example</a></h1>
  32. <table>
  33. <tr>
  34. <td>
  35. Graphics 640,480 <br />
  36. <br />
  37. SetBuffer BackBuffer() <br />
  38. <br />
  39. x=320 <br />
  40. y=240 <br />
  41. <br />
  42. ; infinite mouse movement <br />
  43. <br />
  44. Repeat <br />
  45. Cls <br />
  46. <br />
  47. xs=MouseXSpeed() ; see how far the mouse has been moved <br />
  48. ys=MouseYSpeed() <br />
  49. MoveMouse 320,240 ;put the mouse back in the middle of the screen <br />
  50. <br />
  51. x=x+xs ;adjust mouse co-ords <br />
  52. y=y+ys <br />
  53. <br />
  54. If x>GraphicsWidth()-1 Then x=x-GraphicsWidth() ;wrap screen <br />
  55. If x<0 Then x=x+GraphicsWidth() <br />
  56. If y<0 Then y=y+GraphicsHeight() <br />
  57. If y>GraphicsHeight()-1 Then y=y-GraphicsHeight() <br />
  58. <br />
  59. Text x,y,"X",True,True <br />
  60. <br />
  61. Flip <br />
  62. <br />
  63. Until KeyHit(1) <br />
  64. <br />
  65. End
  66. </td>
  67. </tr>
  68. </table>
  69. <br>
  70. <a target=_top href=../index.htm>Index</a><br>
  71. <br>
  72. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=MouseYSpeed&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  73. </html>