void iArmyListEx::BeginDrag(sint8 fromCell, iCreatGroup& cGroup, const iPoint& pos) { check(!m_pDragItem); m_pDragItem = new iDragItem(this, fromCell, (m_bSplit || (m_pSplitBtn && m_pSplitBtn->IsChecked())), cGroup, pos, iSize(m_itemW,m_Rect.h), m_bCanDismiss || m_pArmy->GroupCount() > 1); m_pMgr->SetDragGlyph(m_pDragItem); Drag(pos); }
void ScrollBar::MouseMove(Point p, dword) { if(HasCapture() && push == 2) Drag(p); else if(light != GetMousePart()) Refresh(); }
void ScrollBar::LeftDown(Point p, dword) { push = GetMousePart(); LLOG("ScrollBar::LeftDown(" << p << ")"); LLOG("MousePos = " << GetMousePos() << ", ScreenView = " << GetScreenView() << ", rel. pos = " << (GetMousePos() - GetScreenView().TopLeft())); LLOG("GetWorkArea = " << GetWorkArea()); LLOG("VisibleScreenView = " << GetVisibleScreenView()); LLOG("PartRect(0) = " << GetPartRect(0)); LLOG("PartRect(1) = " << GetPartRect(1)); LLOG("PartRect(2) = " << GetPartRect(2)); LLOG("ScrollBar::LeftDown: mousepart = " << (int)push << ", rect = " << GetPartRect(push) << ", overthumb = " << style->overthumb << ", slider = " << Slider()); LLOG("thumbpos = " << thumbpos << ", thumbsize = " << thumbsize); if(push == 2) delta = GetHV(p.x, p.y) - thumbpos; else { if(jump) { delta = thumbsize / 2; Drag(p); } else if(push == 0) PrevPage(); else NextPage(); } SetCapture(); Refresh(); WhenLeftClick(); }
int CParticle::UpdateDrift (int t, int nThread) { m_vPos += m_vDrift * t; //(I2X (t) / 1000); #if DBG CFixVector vDrift = m_vDrift; CFixVector::Normalize (vDrift); if (CFixVector::Dot (vDrift, m_vDir) < 0) t = t; #endif if ((m_nType <= SMOKE_PARTICLES) || (m_nType == FIRE_PARTICLES)) { m_vDrift [X] = ChangeDir (m_vDrift [X]); m_vDrift [Y] = ChangeDir (m_vDrift [Y]); m_vDrift [Z] = ChangeDir (m_vDrift [Z]); } if (m_bHaveDir) { CFixVector vi = m_vDrift, vj = m_vDir; CFixVector::Normalize (vi); CFixVector::Normalize (vj); fix drag = Drag (); if (CFixVector::Dot (vi, vj) < 0) drag = -drag; m_vPos += m_vDir * drag; } int nSegment = FindSegByPos (m_vPos, m_nSegment, m_nSegment < 0, 1, (m_nType == BUBBLE_PARTICLES) ? 0 : fix (m_nRad), nThread); if ((0 > nSegment) && ((m_nType != WATERFALL_PARTICLES) || m_bChecked)) { if (m_nType == BUBBLE_PARTICLES) { if (SEGMENTS [nSegment].m_nType != SEGMENT_IS_WATER) { m_nLife = -1; return 0; } } else if (m_nType == WATERFALL_PARTICLES) { CFixVector vDir = m_vPos - m_vStartPos; if ((CFixVector::Normalize (vDir) >= I2X (1)) && (CFixVector::Dot (vDir, m_vDir) < I2X (1) / 2)) { m_nLife = -1; return 0; } if (SEGMENTS [nSegment].m_nType == SEGMENT_IS_WATER) { m_bChecked = 1; m_nLife = 500; } } else if (m_nTTL - m_nLife > 500) { m_nLife = -1; return 0; } } m_nSegment = nSegment; if (!Bounce (nThread)) return 0; return 1; }
void iArmyListEx::OnMouseTrack(const iPoint& pos) { if (m_pDragItem) { Drag(pos); } else if (m_pArmy && pos.GetSqDelta(m_dragAnchor) > DRAG_DELTA && m_dCell != -1 && m_pArmy->At(m_dCell).IsValid()) { BeginDrag(m_dCell, m_pArmy->At(m_dCell), pos); m_dCell = -1; } }
void GBRobot::Move() { friendlyCollisions = 0; enemyCollisions = 0; foodCollisions = 0; shotCollisions = 0; wallCollisions = 0; GBObject::Move(); Drag(kFriction, kLinearDragFactor, kQuadraticDragFactor); }
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { //Touch(10,10);' Drag(300,300); }
void EditableLabel::Update(float deltaSecond, Vector2& mousePosition) { //ResizeBox(); m_currentStateProperty = m_forStates[m_currentState]; Vector2 offset = GetOffSet(); if (m_isTyping) { StartTyping(); if (m_isFixingSize) { ResizeBox(); } } m_timeCheck += deltaSecond; Vector2 maxs; GetValueInCurrentState("maxs", maxs); Vector2 mins; GetValueInCurrentState("mins", mins); AABB2D box(mins + offset, maxs + offset); ////////////////////////////////////////////////////////////////////////// if (s_theInputSystem->IsMouseButtonDown(VK_LBUTTON) && s_theInputSystem->IsKeyDown('C')) { if (box.IsPointInside(mousePosition)) { SetDragable(true); } } else SetDragable(false); if (m_enableDrag) { Drag(mousePosition); return; } if (s_theInputSystem->WasMouseButtonJustDown(VK_LBUTTON)) { if (box.IsPointInside(mousePosition)) { m_isTyping = true; m_currentState = WIDGET_STATE_SELECT_; } else { m_currentState = WIDGET_STATE_ENABLE_; m_isTyping = false; } } }
GUI::EEventStatus::Enum GEventLogWindow::OnMouseDown(const GEventData & in_EventData, GBaseObject* in_pCaller) { if(in_EventData.Mouse.Actor.Bits.Left == in_EventData.Mouse.Down.Bits.Left) { if(!in_pCaller) { HideOverlay(); Drag(); } } return GUI::EEventStatus::Handled; }
GUI::EEventStatus::Enum GSaveConfirmationWindow::OnMouseDown(const SDK::GUI::GEventData & in_EventData, GUI::GBaseObject * in_pCaller) { if(in_EventData.Mouse.Actor.Bits.Left || in_EventData.Mouse.Down.Bits.Left) { GBaseObject* l_pClicked = g_Joshua.GUIManager()->MouseDownTarget(); if(l_pClicked->Name() == L"Save_Confirmation_Window" || l_pClicked->Name() == L"lblText1" || l_pClicked->Name() == L"lblText2" || l_pClicked->Name() == L"picExclamation" || l_pClicked->Name() == L"lblText3") { Drag(); } } return EEventStatus::Handled; }
bool GboxInstance::HandleMouse(const pp::MouseInputEvent& event) { PP_InputEvent_MouseButton button = event.GetButton(); int32_t clicks = event.GetClickCount(); pp::Point pt = event.GetPosition(); int32_t type = event.GetType(); if (sca() == 0x3) theLog.info("+Mouse: ty:%d at:%d,%d but:%d clicks:%d", type, pt.x(), pt.y(), button, clicks); if (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN && button == 0) { m_mouse_down0 = pt; m_time_at_mouse_down0 = m_core->GetTimeTicks(); } if (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN && button == 2) { m_mouse_down2 = pt; m_time_at_mouse_down2 = m_core->GetTimeTicks(); } if (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEMOVE) { if (m_time_at_mouse_down0) { // drag dynamics logic PP_TimeTicks now = m_core->GetTimeTicks(); bool is_drag = false; double dx = pt.x() - m_mouse_down0.x(); double dy = pt.y() - m_mouse_down0.y(); if (sqrt(dx * dx + dy * dy) > 30) is_drag = true; if (now - m_time_at_mouse_down0 > 0.2) is_drag = true; if (is_drag) { Drag(m_mouse_down0.x(), m_mouse_down0.y(), m_mouse_down0.x() - pt.x(), m_mouse_down0.y() - pt.y(), sca()); m_mouse_down0 = pt; } } } if (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEUP) { PP_TimeTicks now = m_core->GetTimeTicks(); double diff = now - (button == 0 ? m_time_at_mouse_down0 : m_time_at_mouse_down2); Click(pt.x(), pt.y(), button, sca(), diff); if (button == 0) m_time_at_mouse_down0 = 0; else m_time_at_mouse_down2 = 0; } return true; }
void CDragger::Tick() { if (Server()->Tick()%int(Server()->TickSpeed()*0.15f)==0) { int Flags; m_EvalTick=Server()->Tick(); int index = GameServer()->Collision()->IsMover(m_Pos.x,m_Pos.y, &Flags); if (index) { m_Core=GameServer()->Collision()->CpSpeed(index, Flags); } m_Pos+=m_Core; Move(); } Drag(); return; }
void TapCamera::Update() { if( momentum_ ) { float momenttum_steps = momemtum_steps_; //Momentum rotation Vec2 v = vec_drag_delta_; BeginDrag( Vec2() ); //NOTE:This call reset _VDragDelta Drag( v * vec_flip_ ); //Momentum shift vec_offset_ += vec_offset_delta_; BallUpdate(); EndDrag(); //Decrease deltas vec_drag_delta_ = v * MOMENTUM_FACTOR_DECREASE; vec_offset_delta_ = vec_offset_delta_ * MOMENTUM_FACTOR_DECREASE_SHIFT; //Count steps momemtum_steps_ = momenttum_steps * MOMENTUM_FACTOR_DECREASE; if( momemtum_steps_ < MOMENTUM_FACTOR_THRESHOLD ) { momentum_ = false; } } else { vec_drag_delta_ *= MOMENTUM_FACTOR; vec_offset_delta_ = vec_offset_delta_ * MOMENTUM_FACTOR; BallUpdate(); } Vec3 vec = vec_offset_ + vec_offset_now_; Vec3 vec_tmp( TRANSFORM_FACTOR, -TRANSFORM_FACTOR, TRANSFORM_FACTORZ ); vec *= vec_tmp * vec_pinch_transform_factor_; mat_transform_ = Mat4::Translation( vec ); }
void CDragger::Tick() { if (((CGameControllerDDRace*) GameServer()->m_pController)->m_Teams.GetTeamState( m_CaughtTeam) == CGameTeams::TEAMSTATE_EMPTY) return; if (Server()->Tick() % int(Server()->TickSpeed() * 0.15f) == 0) { int Flags; m_EvalTick = Server()->Tick(); int index = GameServer()->Collision()->IsMover(m_Pos.x, m_Pos.y, &Flags); if (index) { m_Core = GameServer()->Collision()->CpSpeed(index, Flags); } m_Pos += m_Core; Move(); } Drag(); return; }
void Gizmo3D::Use() { if (gizmo_.Null() || !gizmo_->IsEnabled() || editMode_ == EDIT_SELECT) { //StoreGizmoEditActions(); //previousGizmoDrag = false; return; } ResourceCache* cache = GetSubsystem<ResourceCache>(); Input* input = GetSubsystem<Input>(); Ray cameraRay = view3D_->GetCameraRay(); float scale = gizmoNode_->GetScale().x_; // Recalculate axes only when not left-dragging bool drag = input->GetMouseButtonDown(MOUSEB_LEFT);// && (Abs(input->GetMouseMoveX()) > 3 || Abs(input->GetMouseMoveY()) > 3); if (!drag) CalculateGizmoAxes(); gizmoAxisX_.Update(cameraRay, scale, drag, camera_->GetNode()); gizmoAxisY_.Update(cameraRay, scale, drag, camera_->GetNode()); gizmoAxisZ_.Update(cameraRay, scale, drag, camera_->GetNode()); if (!editNodes_->Size() || editNodes_->At(0) == scene_) { gizmoAxisX_.selected_ = gizmoAxisY_.selected_ = gizmoAxisZ_.selected_ = false; // this just forces an update gizmoAxisX_.lastSelected_ = gizmoAxisY_.lastSelected_ = gizmoAxisZ_.lastSelected_ = true; } if (gizmoAxisX_.selected_ != gizmoAxisX_.lastSelected_) { gizmo_->SetMaterial(0, cache->GetResource<Material>( gizmoAxisX_.selected_ ? "AtomicEditor/Materials/BrightRedUnlit.xml" : "AtomicEditor/Materials/RedUnlit.xml")); gizmoAxisX_.lastSelected_ = gizmoAxisX_.selected_; } if (gizmoAxisY_.selected_ != gizmoAxisY_.lastSelected_) { gizmo_->SetMaterial(1, cache->GetResource<Material>( gizmoAxisY_.selected_ ? "AtomicEditor/Materials/BrightGreenUnlit.xml" : "AtomicEditor/Materials/GreenUnlit.xml")); gizmoAxisY_.lastSelected_ = gizmoAxisY_.selected_; } if (gizmoAxisZ_.selected_ != gizmoAxisZ_.lastSelected_) { gizmo_->SetMaterial(2, cache->GetResource<Material>( gizmoAxisZ_.selected_ ? "AtomicEditor/Materials/BrightBlueUnlit.xml" : "AtomicEditor/Materials/BlueUnlit.xml")); gizmoAxisZ_.lastSelected_ = gizmoAxisZ_.selected_; } if (drag) Drag(); }
int Sequence_Region::handle ( int m ) { static enum trim_e trimming; int X = Fl::event_x(); int Y = Fl::event_y(); Logger _log( this ); switch ( m ) { case FL_PUSH: { /* trimming */ if ( Fl::event_shift() && ! Fl::event_ctrl() ) { switch ( Fl::event_button() ) { case 1: trim( trimming = LEFT, X ); begin_drag( Drag( x() - X, y() - Y ) ); _log.hold(); break; case 3: trim( trimming = RIGHT, X ); begin_drag( Drag( x() - X, y() - Y ) ); _log.hold(); break; default: return 0; break; } fl_cursor( FL_CURSOR_WE ); return 1; } else if ( test_press( FL_BUTTON2 ) ) { if ( Sequence_Widget::current() == this ) { if ( selected() ) deselect(); else select(); } redraw(); return 1; } /* else if ( test_press( FL_CTRL + FL_BUTTON1 ) ) */ /* { */ /* /\* duplication *\/ */ /* fl_cursor( FL_CURSOR_MOVE ); */ /* return 1; */ /* } */ else return Sequence_Widget::handle( m ); } case FL_RELEASE: { Sequence_Widget::handle( m ); if ( trimming != NO ) trimming = NO; return 1; } case FL_DRAG: { if ( ! _drag ) { begin_drag( Drag( x() - X, y() - Y, x_to_offset( X ) ) ); _log.hold(); } /* trimming */ if ( Fl::event_shift() ) { if ( trimming ) { trim( trimming, X ); return 1; } else return 0; } return Sequence_Widget::handle( m ); } default: return Sequence_Widget::handle( m ); break; } return 0; }