void SQRScrollBar::SetPos( int32 nPos, bool bMouseWheel ) { if(abs(m_fCurPos - (float)nPos) < 0.00001) return; m_fCurPos = (float)nPos; ProcessMove(true, bMouseWheel); }
void Fire::Process() { auto enm = GetMap()->GetEnemyHolder()->GetNearest(this->pixel_x(), this->pixel_y(), 7, [this](Enemy* e) /*I AM KING OF SPACES*/ { return !e->IsRocketFriend() && e != this; }); ++length_; if (enm != nullptr) { ProcessSpeed(enm->pixel_x(), enm->pixel_y(), 1); if ((abs(enm->pixel_x() - pixel_x()) + abs(enm->pixel_y() - pixel_y())) < 48) { enm->Hit(1); } } ProcessMove(); state_w_ = (length_ / 5) % 6; if (length_ > 30) GetMap()->GetEnemyHolder()->AddToDelete(this); }
void SQRScrollBar::SetPage( int32 fPage ) { if(m_fPageSize == (float)fPage) return; m_fPageSize = (float)fPage; ProcessMove( true ); RefreshThumbState(); }
void Enemy::Process() { auto obj = GetMap()->GetNearest(pixel_x(), pixel_y()); if (obj != nullptr) ProcessSpeed(obj->posx() * 32, obj->posy() * 32); ProcessMove(); ProcessHealth(); }
//---------------------------------------------------------------------------------------------- void CInputControllerEdImpl::ProcessInputMouse(const MouseMoveInputData &InputData) { if (!ProcessMoveControllers(InputData)) { if (!ProcessMove(InputData)) { } } }
void SQRScrollBar::OnCtrlmsg( SQRWnd* pChild, uint32 uMsgID, uint32 uParam1, uint32 uParam2 ) { int32 nPrePos = (int32)m_fCurPos; int32 nCtrl = SM_SC_BAR; if( uMsgID == BUTTON_CLICKDOWN || uMsgID == BUTTON_CLICKCONT ) { if( pChild == m_pPressButton1 ) m_fCurPos--; if( pChild == m_pPressButton2 ) m_fCurPos++; nCtrl = pChild == m_pPressButton1 ? SM_SC_P1 : SM_SC_P2; ProcessMove( true , true); } else if( uMsgID == BUTTON_DRAG && pChild == m_pScrollBar ) { CPos HeldPoint( ( (short*)&uParam1 )[0], ( (short*)&uParam1 )[1] ); CPos CurPoint( ( (short*)&uParam2 )[0], ( (short*)&uParam2 )[1] ); CFRect rt1, rt2, rt3; m_pPressButton1->GetWndRect( rt1 ); m_pPressButton2->GetWndRect( rt2 ); m_pScrollBar->GetWndRect( rt3 ); if( GetStyle()&SS_HSCROLL ) { float fStart = rt1.right; float fEnd = rt2.left - ( rt3.right - rt3.left ); m_fCurPos += ( CurPoint.x - HeldPoint.x )*( m_fRange - m_fPageSize ) / (fEnd - fStart); } else { float fStart = rt1.bottom; float fEnd = rt2.top - ( rt3.bottom - rt3.top ); m_fCurPos += ( CurPoint.y - HeldPoint.y )*( m_fRange - m_fPageSize ) / (fEnd - fStart); } ProcessMove( true , true); } else if( uMsgID == BUTTON_CLICKUP ) { SQRControl::SendCtrlMsg( SCROLL_RELEASE, nCtrl, nPrePos ); } }
void KMovableObject::OnFree(int nCurLoop) { assert(m_eMoveType == mosFree); if (m_nVelocityX == 0 && m_nVelocityY == 0 && m_nVelocityZ == 0 && !IsInAir()) { TurnToMoveType(mosIdle); OnTurnedToIdle(); goto Exit0; } ProcessMove(); Exit0: return; }
void SQRScrollBar::OnLButtonDown( uint32 nFlags, int32 x, int32 y ) { CPos Point( x, y ); CFRect rt1, rt2, rt3; m_pPressButton1->GetWndRect( rt1 ); m_pPressButton2->GetWndRect( rt2 ); m_pScrollBar->GetWndRect( rt3 ); ScreenToWnd( rt1 ); ScreenToWnd( rt2 ); float fPos = -1; if( GetStyle()&SS_HSCROLL ) { float fStart = rt1.right; float fEnd = rt2.left - ( rt3.right - rt3.left ); if( Point.x > rt1.right && Point.x < rt2.left ) fPos = ( Point.x - rt1.right )*( m_fRange - m_fPageSize ) / ( fEnd - fStart ); } else { float fStart = rt1.bottom; float fEnd = rt2.top - ( rt3.bottom - rt3.top ); if( Point.y > rt1.bottom && Point.y < rt2.top ) fPos = ( Point.y - rt1.bottom )*( m_fRange - m_fPageSize ) / ( fEnd - fStart ); } if( fPos >= 0 ) { if( fPos > m_fCurPos ) { fPos = min( fPos, m_fRange ); m_fCurPos += m_fPageSize; if( m_fCurPos > fPos ) m_fCurPos = fPos; } else { fPos = max( fPos, 0 ); m_fCurPos -= m_fPageSize; if( m_fCurPos < fPos ) m_fCurPos = fPos; } ProcessMove( true, true ); } }
void Rocket::Process() { auto enm = GetMap()->GetEnemyHolder()->GetNearest(this->pixel_x(), this->pixel_y(), 7, [this](Enemy* e) /*I AM KING OF SPACES*/ { return !e->IsRocketFriend() && e != this; }); ++length_; if (enm != nullptr) { speed_.x += rand() % 2 - 1; speed_.y += rand() % 2 - 1; ProcessSpeed(enm->pixel_x(), enm->pixel_y(), 2); if ((abs(enm->pixel_x() - pixel_x()) + abs(enm->pixel_y() - pixel_y())) < 48) { GetMap()->GetEnemyHolder()->AddToDelete(this); getEffectOf<Explosion>()->SetPos(pixel_x(), pixel_y(), angle())->Start(); GetMap()->GetEnemyHolder()->ForEach([](Enemy* enm) { enm->Hit(11); }, pixel_x(), pixel_y(), 64 * 64); } } ProcessMove(); state_w_ = (length_ / 2) % 4; if (length_ > 80) { GetMap()->GetEnemyHolder()->AddToDelete(this); getEffectOf<Explosion>()->SetPos(pixel_x(), pixel_y(), angle())->Start(); } }
// Main function of this class decodes gesture information // in: // hWnd window handle // wParam message parameter (message-specific) // lParam message parameter (message-specific) bool CGestures::ProcessGestureMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult) { if ((uMsg != WM_GESTURENOTIFY) && (uMsg != WM_GESTURE)) return false; if (!_isGestures) { _ASSERTE(_isGestures); gpConEmu->LogString(L"Gesture message received but not allowed, skipping"); return false; } if (uMsg == WM_GESTURENOTIFY) { // This is the right place to define the list of gestures that this // application will support. By populating GESTURECONFIG structure // and calling SetGestureConfig function. We can choose gestures // that we want to handle in our application. In this app we // decide to handle all gestures. GESTURECONFIG gc[] = { {GID_ZOOM, GC_ZOOM}, {GID_ROTATE, GC_ROTATE}, {GID_PAN, GC_PAN|GC_PAN_WITH_GUTTER|GC_PAN_WITH_INERTIA, GC_PAN_WITH_SINGLE_FINGER_VERTICALLY|GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY }, {GID_PRESSANDTAP, GC_PRESSANDTAP}, {GID_TWOFINGERTAP, GC_TWOFINGERTAP}, }; BOOL bResult = _SetGestureConfig(hWnd, 0, countof(gc), gc, sizeof(GESTURECONFIG)); DWORD dwErr = GetLastError(); if (gpSetCls->isAdvLogging) { wchar_t szNotify[60]; _wsprintf(szNotify, SKIPLEN(countof(szNotify)) L"SetGestureConfig -> %u,%u", bResult, dwErr); gpConEmu->LogString(szNotify); } if (!bResult) { DisplayLastError(L"Error in execution of SetGestureConfig", dwErr); } lResult = ::DefWindowProc(hWnd, WM_GESTURENOTIFY, wParam, lParam); return true; } // Остался только WM_GESTURE Assert(uMsg==WM_GESTURE); // helper variables POINT ptZoomCenter; double k; GESTUREINFO gi = {sizeof(gi)}; // Checking for compiler alignment errors if (gi.cbSize != WIN3264TEST(48,56)) { // Struct member alignment must be 8bytes even on x86 Assert(sizeof(GESTUREINFO)==WIN3264TEST(48,56)); _isGestures = false; return false; } BOOL bResult = _GetGestureInfo((HGESTUREINFO)lParam, &gi); if (!bResult) { //_ASSERT(L"_GetGestureInfo failed!" && 0); DWORD dwErr = GetLastError(); DisplayLastError(L"Error in execution of _GetGestureInfo", dwErr); return FALSE; } #ifdef USE_DUMPGEST bool bLog = (gpSetCls->isAdvLogging >= 2); UNREFERENCED_PARAMETER(bLog); bLog = true; #endif #define DUMPGEST(tp) DumpGesture(tp, gi) //#ifdef USE_DUMPGEST // wchar_t szDump[256]; // #define DUMPGEST(tp) // _wsprintf(szDump, SKIPLEN(countof(szDump)) // L"Gesture(x%08X {%i,%i} %s", // (DWORD)gi.hwndTarget, gi.ptsLocation.x, gi.ptsLocation.y, // tp); // if (gi.dwID==GID_PRESSANDTAP) { // DWORD h = LODWORD(gi.ullArguments); _wsprintf(szDump+_tcslen(szDump), SKIPLEN(32) // L" Dist={%i,%i}", (int)(short)LOWORD(h), (int)(short)HIWORD(h)); } // if (gi.dwID==GID_ROTATE) { // DWORD h = LODWORD(gi.ullArguments); _wsprintf(szDump+_tcslen(szDump), SKIPLEN(32) // L" %i", (int)LOWORD(h)); } // if (gi.dwFlags&GF_BEGIN) wcscat_c(szDump, L" GF_BEGIN"); // if (gi.dwFlags&GF_END) wcscat_c(szDump, L" GF_END"); // if (gi.dwFlags&GF_INERTIA) { wcscat_c(szDump, L" GF_INERTIA"); // DWORD h = HIDWORD(gi.ullArguments); _wsprintf(szDump+_tcslen(szDump), SKIPLEN(32) // L" {%i,%i}", (int)(short)LOWORD(h), (int)(short)HIWORD(h)); } // wcscat_c(szDump, L")\n"); // DEBUGSTR(szDump) //#else //#define DUMPGEST(s) //#endif switch (gi.dwID) { case GID_BEGIN: DUMPGEST(L"GID_BEGIN"); break; case GID_END: DUMPGEST(L"GID_END"); break; case GID_ZOOM: DUMPGEST(L"GID_ZOOM"); if (gi.dwFlags & GF_BEGIN) { _dwArguments = LODWORD(gi.ullArguments); _ptFirst.x = gi.ptsLocation.x; _ptFirst.y = gi.ptsLocation.y; ScreenToClient(hWnd,&_ptFirst); } else { // We read here the second point of the gesture. This is middle point between // fingers in this new position. _ptSecond.x = gi.ptsLocation.x; _ptSecond.y = gi.ptsLocation.y; ScreenToClient(hWnd,&_ptSecond); // We have to calculate zoom center point ptZoomCenter.x = (_ptFirst.x + _ptSecond.x)/2; ptZoomCenter.y = (_ptFirst.y + _ptSecond.y)/2; // The zoom factor is the ratio between the new and the old distance. // The new distance between two fingers is stored in gi.ullArguments // (lower DWORD) and the old distance is stored in _dwArguments. k = (double)(LODWORD(gi.ullArguments))/(double)(_dwArguments); // Now we process zooming in/out of the object ProcessZoom(hWnd, k, ptZoomCenter.x, ptZoomCenter.y); // Now we have to store new information as a starting information // for the next step in this gesture. _ptFirst = _ptSecond; _dwArguments = LODWORD(gi.ullArguments); } break; case GID_PAN: DUMPGEST(L"GID_PAN"); if (gi.dwFlags & GF_BEGIN) { _ptFirst.x = gi.ptsLocation.x; _ptFirst.y = gi.ptsLocation.y; _ptBegin.x = gi.ptsLocation.x; _ptBegin.y = gi.ptsLocation.y; ScreenToClient(hWnd, &_ptFirst); } else { // We read the second point of this gesture. It is a middle point // between fingers in this new position _ptSecond.x = gi.ptsLocation.x; _ptSecond.y = gi.ptsLocation.y; ScreenToClient(hWnd, &_ptSecond); if (!(gi.dwFlags & (GF_END/*|GF_INERTIA*/))) { // We apply move operation of the object if (ProcessMove(hWnd, _ptSecond.x-_ptFirst.x, _ptSecond.y-_ptFirst.y)) { // We have to copy second point into first one to prepare // for the next step of this gesture. _ptFirst = _ptSecond; } } } break; case GID_ROTATE: DUMPGEST(L"GID_ROTATE"); if (gi.dwFlags & GF_BEGIN) { _inRotate = false; _dwArguments = LODWORD(gi.ullArguments); // Запомним начальный угол } else { _ptFirst.x = gi.ptsLocation.x; _ptFirst.y = gi.ptsLocation.y; ScreenToClient(hWnd, &_ptFirst); // Пока угол не станет достаточным для смены таба - игнорируем if (ProcessRotate(hWnd, LODWORD(gi.ullArguments) - _dwArguments, _ptFirst.x,_ptFirst.y, ((gi.dwFlags & GF_END) == GF_END))) { _dwArguments = LODWORD(gi.ullArguments); } } break; case GID_TWOFINGERTAP: DUMPGEST(L"GID_TWOFINGERTAP"); _ptFirst.x = gi.ptsLocation.x; _ptFirst.y = gi.ptsLocation.y; ScreenToClient(hWnd,&_ptFirst); ProcessTwoFingerTap(hWnd, _ptFirst.x, _ptFirst.y, LODWORD(gi.ullArguments)); break; case GID_PRESSANDTAP: DUMPGEST(L"GID_PRESSANDTAP"); if (gi.dwFlags & GF_BEGIN) { _ptFirst.x = gi.ptsLocation.x; _ptFirst.y = gi.ptsLocation.y; ScreenToClient(hWnd,&_ptFirst); DWORD nDelta = LODWORD(gi.ullArguments); short nDeltaX = (short)LOWORD(nDelta); short nDeltaY = (short)HIWORD(nDelta); ProcessPressAndTap(hWnd, _ptFirst.x, _ptFirst.y, nDeltaX, nDeltaY); } break; default: DUMPGEST(L"GID_<UNKNOWN>"); } _CloseGestureInfoHandle((HGESTUREINFO)lParam); return TRUE; }
void SQRScrollBar::_ResizeRect( const CFRect& rt, bool refreshbak ) { SQRWnd::_ResizeRect( rt, refreshbak ); ProcessMove( false ); }
void SQRScrollBar::_SetWndRect( const CFRect& rt ) { SQRWnd::_SetWndRect( rt ); ProcessMove( false ); }
//--------------------------------------------------------------------------- //Summary: // leave crosswalk and release the crosswalk //-------------------------------------------------------------------------- void CFreeMovingLogic::ReleaseCrossWalk(CCrossWalkInSim* pCrossWalkInSim, const ElapsedTime& time ) { pCrossWalkInSim->ReleasePaxOccupied(this); pCrossWalkInSim->NoticefyVehicle(time); ProcessMove(time); }