Advertisement
icuurd12b42

is_mouse_outside

Sep 22nd, 2015
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///is_mouse_outside()
  2. var app_pos;
  3. if(window_get_fullscreen())
  4. {
  5.     app_pos = application_get_position();    
  6. }
  7. else
  8. {
  9.     app_pos[0] = window_get_x();
  10.     app_pos[1] = window_get_y();
  11.     app_pos[2] = app_pos[0] + window_get_width();
  12.     app_pos[3] = app_pos[1] + window_get_height();  
  13. }
  14.  
  15. var mouse_pos;
  16. mouse_pos[0] = display_mouse_get_x();
  17. mouse_pos[1] = display_mouse_get_y();
  18.  
  19. var outside = mouse_pos[0]<app_pos[0]
  20.     or mouse_pos[0]>app_pos[2]
  21.     or mouse_pos[1]<app_pos[1]
  22.     or mouse_pos[1]>app_pos[3];
  23.    
  24. /*
  25. var debug_out;
  26. debug_out[0] = app_pos;
  27. debug_out[1] = mouse_pos;
  28. debug_out[2] = outside;
  29.  
  30. show_debug_message(debug_out);
  31. */
  32. return outside;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement