void DynamicWorldObject::HandleMove (const Vector2& offset) { WorldObject::HandleMove (offset); triggerBoundingBoxes_.Move (offset); sourceBoundingBoxes_.Move (offset); OnMoved (*this, offset); }
void HorizontalSlider::OnMouseClickLeft(int x, int y, bool is_down) { // Convert the mosue coordinates. Gwen::Point point = Gwen::Point(x, y); point = CanvasPositionToLocal(point); _bar->MoveTo(point._x - _bar->Width() / 2, _bar->Y()); _bar->OnMouseClickLeft(x, y, is_down); OnMoved(_bar); }
bool BaseCellContainer::Move( BaseContainer *srcCon, TypeSet::IDType objID, long pos ) { if( GetCellStatus( pos ) != Cell::EMPTY ) return false; GI::Object *obj = AgentGet( srcCon, objID ); if( !obj ) return false; AgentRemove( srcCon, obj ); ObjVisitor::SetPos( obj, pos ); Add( obj ); NOTIFY_LISTENER( OnMoved( srcCon, this, obj ) ); return true; }
LRESULT WndProcFunc::WndProc(HWND wnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { auto app = Application::InstancePtr(); POINT pt; RECT rt; int key = 0; Vec2I size, pos; GetCursorPos(&pt); ScreenToClient(wnd, &pt); Vec2F cursorPos = Vec2F((float)pt.x, (float)-pt.y); if (app->mRender) cursorPos -= Vec2F(Math::Round(app->mRender->mResolution.x*0.5f), Math::Round(-app->mRender->mResolution.y*0.5f)); float wheelDelta; if (app->IsReady()) { switch (uMsg) { case WM_LBUTTONDOWN: SetCapture(app->mHWnd); app->mInput->OnCursorPressed(cursorPos); break; case WM_LBUTTONUP: app->mInput->OnCursorReleased(); ReleaseCapture(); break; case WM_RBUTTONDOWN: SetCapture(app->mHWnd); app->mInput->OnAltCursorPressed(cursorPos); break; case WM_RBUTTONUP: app->mInput->OnAltCursorReleased(); ReleaseCapture(); break; case WM_MBUTTONDOWN: SetCapture(app->mHWnd); app->mInput->OnAlt2CursorPressed(cursorPos); break; case WM_MBUTTONUP: app->mInput->OnAlt2CursorReleased(); ReleaseCapture(); break; case WM_KEYDOWN: key = (int)wParam; app->mInput->OnKeyPressed(key); break; case WM_KEYUP: app->mInput->OnKeyReleased((int)wParam); break; case WM_MOUSEMOVE: app->mInput->OnCursorMoved(cursorPos, 0); app->mInput->GetCursor()->delta -= app->mCursorCorrectionDelta; app->mCursorCorrectionDelta = Vec2F(); break; case WM_MOUSEWHEEL: wheelDelta = GET_WHEEL_DELTA_WPARAM(wParam); app->mInput->OnMouseWheel(wheelDelta); break; case WM_ACTIVATEAPP: case WM_ENABLE: if (wParam == TRUE) { app->mActive = true; app->OnActivated(); app->onActivated.Invoke(); o2Events.OnApplicationActivated(); } else { app->mActive = false; app->OnDeactivated(); app->onDeactivated.Invoke(); o2Events.OnApplicationDeactivated(); } break; case WM_SIZE: GetWindowRect(app->mHWnd, &rt); size.x = rt.right - rt.left; size.y = rt.bottom - rt.top; if (size.x > 0 && size.y > 0 && size != app->mWindowedSize) { app->mWindowedSize = size; app->mRender->OnFrameResized(); app->onResizing.Invoke(); app->OnResizing(); o2Events.OnApplicationSized(); } app->ProcessFrame(); break; case WM_MOVE: GetWindowRect(app->mHWnd, &rt); pos.x = rt.left; pos.y = rt.top; if (pos.x < 10000 && pos.y < 10000 && pos != app->mWindowedPos) { app->mWindowedPos = pos; app->OnMoved(); app->onMoving.Invoke(); } break; case WM_DESTROY: PostQuitMessage(0); return 0; break; } } return DefWindowProc(wnd, uMsg, wParam, lParam); }
func EditCursorMoved(int old_x, int old_y) { return OnMoved(); }