void UIManager::motionEvent( int x, int y ) { if ( is_mode_change_pending() ) { // Don't process events until mode change occurs return; } // Reverse y coordinate y = getparam_y_resolution() - y; std::list<pp::Widget*>::iterator it; for(it=widgets.begin();it!=widgets.end();it++){ (*it)->mouseMotion(x,y); } pp::Vec2d oldPos = cursorPos; cursorPos = pp::Vec2d(x,y); if ( oldPos.x != x || oldPos.y != y ) { // Update UI snow if ( getparam_ui_snow() ) { if ( rightMouseButtonDown ) { make_ui_snow( cursorPos ); reset_ui_snow_cursor_pos( cursorPos ); } else if ( middleMouseButtonDown ) { make_ui_snow( cursorPos ); push_ui_snow( cursorPos ); } else { push_ui_snow( cursorPos ); } } // Need to redraw cursor setDirty(); checkDirty(); } }
void loop_mouse_motion_func(ppogl::Vec2i position) { if(cursorPos != position){ // Update UI snow if(PPConfig.getBool("ui_snow")){ if(rightMouseButtonDown){ make_ui_snow(cursorPos); reset_ui_snow_cursor_pos(cursorPos); }else if(middleMouseButtonDown){ make_ui_snow(cursorPos); push_ui_snow(cursorPos); }else{ push_ui_snow(cursorPos); } } } cursorPos = position; // Reverse y coordinate position.y() = GameMode::resolution.y() - position.y(); ppogl::UIManager::getInstance().mouseEvent(position); }
/*! callback for mouse motion events \return None \author jfpatry \date Created: 2000-09-16 \date Modified: 2000-09-16 */ void ui_event_motion_func( int x, int y ) { point2d_t old_pos; if ( is_mode_change_pending() ) { /* Don't process events until mode change occurs */ return; } /* Reverse y coordinate */ y = getparam_y_resolution() - y; trigger_mouse_motion_cbs( mouse_motion_cbs, x, y ); old_pos = cursor_pos; cursor_pos = make_point2d( x, y ); if ( old_pos.x != x || old_pos.y != y ) { /* Update UI snow */ if ( getparam_ui_snow() ) { if ( right_mouse_button_down ) { make_ui_snow( cursor_pos ); reset_ui_snow_cursor_pos( cursor_pos ); } else if ( middle_mouse_button_down ) { make_ui_snow( cursor_pos ); push_ui_snow( cursor_pos ); } else { push_ui_snow( cursor_pos ); } } /* Need to redraw cursor */ ui_set_dirty(); ui_check_dirty(); } }