void CWindow::WinProc (unsigned int msg, WPARAM wParam, LPARAM lParam) #endif { switch (msg) { case WM_CREATE: OnCreate (m_hWnd, wParam, lParam); break; case WM_INITDIALOG: OnInitDialog (wParam, lParam); break; case WM_ACTIVATEAPP: OnActivateApp (wParam, lParam); break; case WM_SIZE: OnSize (wParam, lParam); break; case WM_MOVE: OnMove (wParam, lParam); break; case WM_PAINT: OnPaint (wParam, lParam); break; case WM_KEYDOWN: OnKeyDown (wParam, lParam); break; case WM_KEYUP: OnKeyUp (wParam, lParam); break; case WM_COMMAND: OnCommand (wParam, lParam); break; case WM_SYSCOMMAND: OnSysCommand (wParam, lParam); break; case WM_CLOSE: OnClose (wParam, lParam); break; case WM_DESTROY: OnDestroy (wParam, lParam); break; #ifndef WIN32 case SDL_JOYAXISMOTION: OnJoystickAxis(wParam, lParam); break; case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: OnJoystickButton(wParam, lParam); break; #endif } #ifdef WIN32 return DefWindowProc (m_hWnd, msg, wParam, lParam); #else return; #endif }
void CSpikefall::OnLoop() { // horizontal distance from player float X_dist = (this->X + (this->Width/2) - CEntity::EntityList[0]->X + (CEntity::EntityList[0]->Width/2)); // vertical distance from player float Y_dist = (this->Y - CEntity::EntityList[0]->Y); // If player comes within a 64 px "pillar" area, and player is underneath... if (X_dist < 64 && Y_dist < 0) { Flags |= ENTITY_FLAG_GRAVITY; } if (Flags & ENTITY_FLAG_GRAVITY) { AccelY = 0.75f; } SpeedY += AccelY * CFPS::FPSControl.GetSpeedFactor(); // Make sure we're not overstepping our boundaries, // so to speak... if (SpeedY > MaxSpeedY) SpeedY = MaxSpeedY; if (SpeedY < -MaxSpeedY) SpeedY = -MaxSpeedY; OnAnimate(); if ((Flags & ENTITY_FLAG_GRAVITY) && !OnMove(0.0, SpeedY)) Dead = true; }
void CEntity::OnLoop() { //We’re not Moving if (MoveLeft == false && MoveRight == false) { StopMove(); } if (MoveLeft) { AccelX = -0.5; } else if (MoveRight) { AccelX = 0.5; } if (Flags & ENTITY_FLAG_GRAVITY) { AccelY = 0.75f; } SpeedX += AccelX * CFPS::FPSControl.GetSpeedFactor(); SpeedY += AccelY * CFPS::FPSControl.GetSpeedFactor(); if (SpeedX > MaxSpeedX) SpeedX = MaxSpeedX; if (SpeedX < -MaxSpeedX) SpeedX = -MaxSpeedX; if (SpeedY > MaxSpeedY) SpeedY = MaxSpeedY; if (SpeedY < -MaxSpeedY) SpeedY = -MaxSpeedY; OnAnimate(); OnMove(SpeedX, SpeedY); }
int Main::OnExecute(CL_ParamList* pCL_Params) { if(!OnInit(pCL_Params)) return -1; SDL_Event Event; Uint32 t1,t2; float fTime = 0.0f; while(Running) { t1 = SDL_GetTicks(); while(SDL_PollEvent(&Event)) { if(Event.type == SDL_QUIT) Running = false; else OnEvent(&Event); } OnMove(fTime); OnRender(); t2 = SDL_GetTicks(); fTime = (float)(t2-t1)/1000.0f; } OnExit(); return 1; }
void CVideoShop2View::OnRecordPrev() { // TODO: Add your command handler code here if(m_pSet->IsBOF()) { m_flagFirst = TRUE; return; } OnMove(ID_RECORD_PREV); m_flagLast = FALSE; }
void CEntityAudioProxy::Initialize(SComponentInitializer const& init) { m_pEntity = static_cast<CEntity*>(init.m_pEntity); assert(m_mapAuxAudioProxies.empty()); // Creating the default AudioProxy. CreateAuxAudioProxy(); m_bHide = m_pEntity->IsHidden(); SetObstructionCalcType(eAOOCT_IGNORE); OnMove(); }
void CAreaProxy::SetBox( const Vec3& min,const Vec3& max, const bool* const pabSoundObstructionSides, size_t const nSideCount ) { m_localPoints.clear(); m_abObstructSound.clear(); // Here we pack the data again! (1 byte*nSideCount to 1 bit*nSideCount) for(size_t i = 0; i < nSideCount; ++i) m_abObstructSound.push_back(pabSoundObstructionSides[i]); m_pArea->SetBox(min,max,m_pEntity->GetWorldTM()); m_pArea->SetAreaType( ENTITY_AREA_TYPE_BOX ); OnMove(); }
void CVideoShop2View::OnRecordLast() { // TODO: Add your command handler code here if(m_pSet->IsEOF()) { //레코드의 처음이면 처음으로 이동시키는 버튼을 비활성화 m_flagLast = TRUE; return; } //OnMove함수 호출 OnMove(ID_RECORD_LAST); //레코드 처음으로 이동했기 때문에 마지막이동버튼을 활성화 m_flagFirst = FALSE; }
void KUiWndFrameTabControl::OnButtonClick(int nBtnId) { switch(nBtnId) { case IDC_WND_FRAME_FOCUS_ADD_LIST: OnSelWnd(); break; case IDC_WND_FRAME_FOCUS_DEL_LIST: OnDel(); break; case IDC_WND_FRAME_FOCUS_MOVE_UP: OnMove(true); break; case IDC_WND_FRAME_FOCUS_MOVE_DOWN: OnMove(false); break; case IDC_WND_FRAME_TAB_CHANGE_FOCUS: { int nValue = (::IsDlgButtonChecked(m_hWnd, IDC_WND_FRAME_TAB_CHANGE_FOCUS) == BST_CHECKED); g_Ui.GetIni()->WriteInteger(m_szName, "EnableTabChangeFocus", nValue); g_ClientManager.UpDataWndInClient(g_Ui.GetIni(true)); ShowErrorInformation(); } break; case IDC_WND_FRAME_TAB_CHANGE_FOCUS_MOUSE_FOLLOW: { int nValue = (::IsDlgButtonChecked(m_hWnd, IDC_WND_FRAME_TAB_CHANGE_FOCUS_MOUSE_FOLLOW) == BST_CHECKED); g_Ui.GetIni()->WriteInteger(m_szName, "MouseFollowFocus", nValue); g_ClientManager.UpDataWndInClient(g_Ui.GetIni(true)); ShowErrorInformation(); } break; default: break; } }
void CEntityAudioProxy::Initialize(SComponentInitializer const& init) { m_pEntity = static_cast<CEntity*>(init.m_pEntity); assert(m_mapAuxAudioProxies.empty()); if ((m_pEntity->GetFlagsExtended() & ENTITY_FLAG_EXTENDED_AUDIO_LISTENER) > 0) { m_nFlags &= ~eEAPF_CAN_MOVE_WITH_ENTITY; } // Creating the default AudioProxy. CreateAuxAudioProxy(); SetObstructionCalcType(eAOOCT_Ignore); OnMove(); }
void Object::OnLoop() { if(Flags & OBJECT_FLAG_GRAVITY) { AccelY = 0.75f; } SpeedX += AccelX * FPS::FPSControl.GetSpeedFactor(); SpeedY += AccelY * FPS::FPSControl.GetSpeedFactor(); if(SpeedX > MaxSpeedX) SpeedX = MaxSpeedX; if(SpeedX < -MaxSpeedX) SpeedX = -MaxSpeedX; if(SpeedY > MaxSpeedY) SpeedY = MaxSpeedY; if(SpeedY < -MaxSpeedY) SpeedY = -MaxSpeedY; OnMove(SpeedX, SpeedY); }
void CTriggerProxy::Serialize( TSerialize ser ) { if (ser.GetSerializationTarget() != eST_Network) { if (ser.BeginOptionalGroup("TriggerProxy",true)) { ser.Value("BoxMin",m_aabb.min); ser.Value("BoxMax",m_aabb.max); ser.EndGroup(); } if (ser.IsReading()) OnMove(); } }
void CAreaProxy::SetPoints( const Vec3* const vPoints, const bool* const pabSoundObstructionSegments, int const nPointsCount, float const fHeight ) { m_localPoints.resize(nPointsCount); m_abObstructSound.resize(nPointsCount); if (nPointsCount > 0) { memcpy( &m_localPoints[0],vPoints,nPointsCount*sizeof(Vec3) ); // Here we pack the data again! (1 byte*nPointsCount to 1 bit*nPointsCount) for(int i = 0; i < nPointsCount; ++i) m_abObstructSound[i] = pabSoundObstructionSegments[i]; } m_pArea->SetAreaType( ENTITY_AREA_TYPE_SHAPE ); m_pArea->SetHeight(fHeight); OnMove(); }
void GizmoBar::OnNodeSelect() { switch (Gizmo::Instance()->GetOperator()) { case Gizmo::OP_MOVE: OnMove(NULL); break; case Gizmo::OP_ROTATE: OnRotate(NULL); break; case Gizmo::OP_SCALE: OnScale(NULL); break; } }
int Visor::cQMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: OnLayout(); break; case 1: OnSliderMoved((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: OnRotate(); break; case 3: OnMove(); break; case 4: OnWatchTimer(); break; case 5: OnShot(); break; default: ; } _id -= 6; } return _id; }
LRESULT CALLBACK SystemWindow::LocalWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch(msg) { case WM_SIZE: OnResize(static_cast<u32>(LOWORD(lparam)), static_cast<u32>(HIWORD(lparam)), static_cast<window::WINDOW_RESIZE_STATE>(wparam)); break; case WM_MOVE: OnMove(static_cast<u32>(LOWORD(lparam)), static_cast<u32>(HIWORD(lparam))); break; case WM_CLOSE: OnClose(); break; case WM_DESTROY: OnDestroy(); break; default: //We don't handle the message so let the Default Window Proc handle it return DefWindowProcW(hwnd, msg, wparam, lparam); } return 0; }
LRESULT CMenuWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch( uMsg ) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_KILLFOCUS: lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break; case WM_KEYDOWN: lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEWHEEL: break; case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_MOVE: lRes = OnMove(uMsg, wParam, lParam, bHandled); break; default: bHandled = FALSE; } if( bHandled ) return lRes; if( m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes; return CWindowWnd::HandleMessage(uMsg, wParam, lParam); }
int CDataScope::MsgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: OnCommand(wParam, lParam); break; case WM_CREATE: OnCreate(wParam, lParam); break; case WM_DESTROY: OnDestroy(wParam, lParam); break; case WM_PAINT: OnPaint(wParam, lParam); break; case WM_MOUSEMOVE: OnMouseMove(wParam, lParam); break; case WM_SIZE: OnSize(wParam, lParam); break; case WM_MOVE: OnMove(wParam, lParam); break; case WM_MOUSEWHEEL: OnMouseWheel(wParam, lParam); break; case WM_KEYDOWN: OnKeyDown(wParam, lParam); break; case WM_ERASEBKGND: return TRUE; } return DefMDIChildProc(m_hWnd, uMsg, wParam, lParam); }
void CTriggerProxy::ProcessEvent( SEntityEvent &event ) { switch (event.event) { case ENTITY_EVENT_XFORM: OnMove(); break; case ENTITY_EVENT_ENTERAREA: case ENTITY_EVENT_LEAVEAREA: if (m_forwardingEntity) { IEntity * pEntity = gEnv->pEntitySystem->GetEntity(m_forwardingEntity); if (pEntity && (pEntity != this->GetEntity())) { pEntity->SendEvent( event ); } } break; case ENTITY_EVENT_PRE_SERIALIZE: break; case ENTITY_EVENT_POST_SERIALIZE: break; } }
void CEntityAudioProxy::Reload(IEntity* pEntity, SEntitySpawnParams& params) { m_pEntity = static_cast<CEntity*>(pEntity); m_bHide = m_pEntity->IsHidden(); m_fFadeDistance = 0.0f; m_fEnvironmentFadeDistance = 0.0f; m_nBoneHead = -1; m_nAttachmentIndex = -1; m_nAudioEnvironmentID = INVALID_AUDIO_ENVIRONMENT_ID; std::for_each(m_mapAuxAudioProxies.begin(), m_mapAuxAudioProxies.end(), SResetAudioProxy()); #if defined(INCLUDE_ENTITYSYSTEM_PRODUCTION_CODE) std::for_each(m_mapAuxAudioProxies.begin(), m_mapAuxAudioProxies.end(), SInitializeAudioProxy(m_pEntity->GetName())); #else std::for_each(m_mapAuxAudioProxies.begin(), m_mapAuxAudioProxies.end(), SInitializeAudioProxy(NULL)); #endif // INCLUDE_ENTITYSYSTEM_PRODUCTION_CODE SetObstructionCalcType(eAOOCT_IGNORE); OnMove(); REINST("needs voice attachement placement"); //PrecacheHeadBone(); }
int XWindow::RunModal() { Prepare(); // Trap XWindows "WM_DELETE_WINDOW" message Atom wmDeleteMessage = XInternAtom(windowDisplay, "WM_DELETE_WINDOW", false); XSetWMProtocols(windowDisplay, window, &wmDeleteMessage, 1); XkbEvent event; do { // Gets the new event int res = XNextEvent(windowDisplay, &event.core); if (window != event.core.xany.window) continue; // Processes the events if (event.type == ButtonPress) { WindowEventMouseButton e(&event.core.xbutton); OnMouseDown(&e); } else if (event.type == ButtonRelease) { WindowEventMouseButton e(&event.core.xbutton); OnMouseUp(&e); } else if (event.type == MotionNotify) { WindowEventMouseMove e(&event.core.xmotion); OnMouseMove(&e); } else if (event.type == EnterNotify) { WindowEventEnterLeave e(&event.core.xcrossing); OnMouseEnterLeave(&e); } else if (event.type == LeaveNotify) { WindowEventEnterLeave e(&event.core.xcrossing); OnMouseEnterLeave(&e); } else if (event.type == FocusIn) { WindowEventFocus e(&event.core.xfocus); OnFocus(&e); } else if (event.type == FocusOut) { WindowEventFocus e(&event.core.xfocus); OnFocus(&e); } else if (event.type == Expose && event.core.xexpose.count == 0) { WindowEventDraw e(gc, &event.core.xexpose); OnDraw(&e); } else if (event.type == VisibilityNotify) { WindowEventVisible e(&event.core.xvisibility); OnVisible(&e); } else if (event.type == UnmapNotify) { WindowEventShow e(false); OnShow(&e); } else if (event.type == MapNotify) { WindowEventShow e(true); OnShow(&e); } else if (event.type == ConfigureNotify) { bool generateWindowMoveEvent = area->GetX() != event.core.xconfigure.x || area->GetY() != event.core.xconfigure.y; bool generateWindowResizeEvent = area->GetWidth() != event.core.xconfigure.width || area->GetHeight() != event.core.xconfigure.height; *area = NRectangle( event.core.xconfigure.x, event.core.xconfigure.y, event.core.xconfigure.width, event.core.xconfigure.height); borderwidth = event.core.xconfigure.border_width; if (generateWindowMoveEvent) { WindowEventMove e(&event.core.xconfigure); OnMove(&e); } if (generateWindowResizeEvent) { gc->Resize(area->GetWidth(), area->GetHeight()); // Resize XWindowGraphics WindowEventResize e(&event.core.xconfigure); OnResize(&e); } } else if (event.type == ColormapNotify) { WindowEventColormap e(&event.core.xcolormap); OnColormap(&e); } else if (event.type == KeyPress) { WindowEventKey e(&event.core.xkey); OnKeyPress(&e); } else if (event.type == KeyRelease) { WindowEventKey e(&event.core.xkey); OnKeyRelease(&e); } else if (event.type == XDisplay::Default().XkbBaseEvent() + XkbEventCode) { // XkbEvents if (event.any.xkb_type == XkbMapNotify) { WindowEventKeymap e(&event.map); OnKeymap(&e); } else if (event.any.xkb_type == XkbNewKeyboardNotify) { WindowEventKeyboardMapping e(&event.new_kbd); OnKeyboardMapping(&e); } else if (event.any.xkb_type == XkbStateNotifyMask) { int kk = 1; } } else if (event.type == ClientMessage) { if (event.core.xclient.data.l[0] == wmDeleteMessage) break; } else if (event.type != 28 && event.type != 21) { int kk = 1; } // Locks the collection of delegations windowMutex->Lock(); for (int i=0; i<delegationsToExecute->Count(); i++) { // Retrieve delegation and parameters void **item = (void **)(*delegationsToExecute)[i]; NDelegation *d = (NDelegation *)item[0]; void *params = item[1]; // Execute delegation try { d->Execute(params); } catch (Exception *e) { delete e; } // Deletes delegation and item array delete d; delete item; } // Clear delegations collection and unlocks the mutex delegationsToExecute->Clear(); windowMutex->Unlock(); } while (true); Dispose(); }
HRESULT WpdObjectManagement::DispatchWpdMessage( const PROPERTYKEY& Command, IPortableDeviceValues* pParams, IPortableDeviceValues* pResults) { HRESULT hr = S_OK; if (hr == S_OK) { if (Command.fmtid != WPD_CATEGORY_OBJECT_MANAGEMENT) { hr = E_INVALIDARG; CHECK_HR(hr, "This object does not support this command category %ws",CComBSTR(Command.fmtid)); } } if (hr == S_OK) { if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_DELETE_OBJECTS.pid) { hr = OnDelete(pParams, pResults); CHECK_HR(hr, "Failed to delete object"); } else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_ONLY.pid) { hr = OnCreateObjectWithPropertiesOnly(pParams, pResults); CHECK_HR(hr, "Failed to create object"); } else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_AND_DATA.pid) { hr = OnCreateObjectWithPropertiesAndData(pParams, pResults); CHECK_HR(hr, "Failed to create object"); } else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_WRITE_OBJECT_DATA.pid) { hr = OnWriteObjectData(pParams, pResults); CHECK_HR(hr, "Failed to write object data"); } else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_COMMIT_OBJECT.pid) { hr = OnCommit(pParams, pResults); CHECK_HR(hr, "Failed to commit object"); } else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_REVERT_OBJECT.pid) { hr = OnRevert(pParams, pResults); CHECK_HR(hr, "Failed to revert object"); } else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_MOVE_OBJECTS.pid) { hr = OnMove(pParams, pResults); CHECK_HR(hr, "Failed to Move objects"); } else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_COPY_OBJECTS.pid) { hr = OnCopy(pParams, pResults); CHECK_HR(hr, "Failed to Copy objects"); } else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_UPDATE_OBJECT_WITH_PROPERTIES_AND_DATA.pid) { hr = OnUpdateObjectWithPropertiesAndData(pParams, pResults); CHECK_HR(hr, "Failed to update object"); } else { hr = E_NOTIMPL; CHECK_HR(hr, "This object does not support this command id %d", Command.pid); } } return hr; }
// Track mouse bool CMouseTracker::Track(HWND hWnd, POINT& pt) { // Capture mouse SetCapture(hWnd); // Constrain to bounds SnapMouse(pt); ConstrainMouse(pt); // Store attributes m_hWnd=hWnd; m_ptStart=pt; if (m_bLockWindowUpdate) { // Update the window RedrawWindow(hWnd, NULL, NULL, RDW_UPDATENOW|RDW_ALLCHILDREN); LockWindowUpdate(m_hWnd); } // Call start handler OnStarting(m_ptStart); if (m_bAutoScroll) { m_dwLastScrollAt=GetTickCount(); SetTimer(m_hWnd, AUTOSCROLL_TIMER_ID, AUTOSCROLL_TIMER_PERIOD, NULL); } if (m_bHoverDetect) { m_dwHoverStart=GetTickCount(); SetTimer(m_hWnd, HOVER_TIMER_ID, HOVER_TIMER_PERIOD, NULL); } // Spin message loop bool bCancelled=true; bool bMoved=false; while (true) { // Get a message MSG msg; if (!GetMessage(&msg, NULL, 0, 0)) break; // Dispatch all non-input messages if (!IsInputMessage(msg.message) && !(msg.message==WM_TIMER && (msg.wParam==AUTOSCROLL_TIMER_ID || msg.wParam==HOVER_TIMER_ID))) { DispatchMessage(&msg); continue; } // Quit if lost capture if (GetCapture()!=m_hWnd) break; // Handle message switch (msg.message) { case WM_TIMER: if (m_bHoverDetect && m_dwHoverStart && msg.wParam==HOVER_TIMER_ID) { if (GetTickCount() > m_dwHoverStart+HOVER_TIMEOUT) { POINT pt; GetCursorPos(&pt); ScreenToClient(m_hWnd, &pt); m_dwHoverStart=0; OnHover(pt); } break; } if (msg.wParam!=AUTOSCROLL_TIMER_ID) break; { POINT pt; GetCursorPos(&pt); ScreenToClient(m_hWnd, &pt); msg.lParam=MAKELPARAM(pt.x, pt.y); // Fall throught to fake a WM_MOUSEMOVE } case WM_MOUSEMOVE: { // Get new point POINT ptNew; ptNew.x=(int)(short)LOWORD(msg.lParam); ptNew.y=(int)(short)HIWORD(msg.lParam); if (ptNew.x!=m_ptStart.x || ptNew.y!=m_ptStart.y) bMoved=true; // Get client rectangle if (m_bAutoScroll) { // Outside client area? RECT rcClient; GetClientRect(m_hWnd, &rcClient); if (!PtInRect(&rcClient, ptNew) && GetTickCount()>m_dwLastScrollAt + AUTOSCROLL_FREQUENCY) { // Kill old feedback DrawFeedback(); // Release DC if (m_bLockWindowUpdate) { LockWindowUpdate(NULL); } // Do scrolling if (ptNew.x<rcClient.left) SendMessage(m_hWnd, WM_HSCROLL, SB_LINEUP, 0); if (ptNew.x>rcClient.right) SendMessage(m_hWnd, WM_HSCROLL, SB_LINEDOWN, 0); if (ptNew.y<rcClient.top) SendMessage(m_hWnd, WM_VSCROLL, SB_LINEUP, 0); if (ptNew.y>rcClient.bottom) SendMessage(m_hWnd, WM_VSCROLL, SB_LINEDOWN, 0); UpdateWindow(m_hWnd); // Get a newly clipped DC if (m_bLockWindowUpdate) { RedrawWindow(hWnd, NULL, NULL, RDW_UPDATENOW|RDW_ALLCHILDREN); LockWindowUpdate(m_hWnd); } // Redraw feedback DrawFeedback(); m_dwLastScrollAt=GetTickCount(); } } // Adjust for scrolling POINT ptScrollOffset=GetScrollOffset(); ptNew.x+=ptScrollOffset.x; ptNew.y+=ptScrollOffset.y; // Constrain to bounds SnapMouse(ptNew); ConstrainMouse(ptNew); // Only handle if still moved after constraining if (ptNew.x!=pt.x || ptNew.y!=pt.y || msg.message==WM_TIMER) { if (msg.message!=WM_TIMER) { m_dwHoverStart=GetTickCount(); } // Call handler OnMove(pt, ptNew); // Store new point pt=ptNew; } } break; case WM_LBUTTONUP: case WM_RBUTTONUP: bCancelled=false; ReleaseCapture(); break; case WM_RBUTTONDOWN: ReleaseCapture(); break; case WM_KEYDOWN: if (msg.wParam==VK_ESCAPE) { ReleaseCapture(); break; } // Fall through case WM_KEYUP: case WM_SYSKEYDOWN: case WM_SYSKEYUP: // Call handler OnMove(pt, pt); break; } // Quit if lost capture if (GetCapture()!=m_hWnd) break; } if (m_bAutoScroll) { KillTimer(m_hWnd, AUTOSCROLL_TIMER_ID); } if (m_bHoverDetect) { KillTimer(m_hWnd, HOVER_TIMER_ID); } // Finished OnFinished(pt, bCancelled); // Clean up if (m_bLockWindowUpdate) { LockWindowUpdate(NULL); } return bMoved && !bCancelled; }
//----------------------------------------------------------------------------- void CPlayer::OnLoop() { // If left or right button is not pressed anymore, stop player movement if(MoveLeft == false && MoveRight == false) { StopMoveX(); } // If up or down button is not pressed anymore, stop player movement if(MoveUp == false && MoveDown == false) { StopMoveY(); } // Variables that determine if player has reached left or right end // of the screen and thus isn't allowed to move farther to same direction bool leftScreenCrossed = false; bool rightScreenCrossed = false; // If player is at the left end of the screen. Camera is on the screen // locally at point 0,0 so comparing to player's location is easy if (X < CCamera::CameraControl.GetX()) { leftScreenCrossed = true; } // Same thing here with the right end of the screen with little adjustment else if ((X+PLAYER_SPRITE_WIDTH) > (CCamera::CameraControl.GetX()+WWIDTH)) { rightScreenCrossed = true; } // Player is not at the left end and can move to left freely if(MoveLeft && !leftScreenCrossed) { AccelX = PLAYER_ACCEL_LEFT; } // Player is not at the right end and can move to right freely else if(MoveRight && !rightScreenCrossed) { AccelX = PLAYER_ACCEL_RIGHT; } // Bottom and top sides of the screen are blocked with blocking tiles // so there is no need to check if player has vertically crossed the line if(MoveUp) { AccelY = PLAYER_ACCEL_UP; } else if(MoveDown) { AccelY = PLAYER_ACCEL_DOWN; } // Automatic speed adjusting calculations SpeedX += AccelX * CFPS::FPSControl.GetSpeedFactor(); SpeedY += AccelY * CFPS::FPSControl.GetSpeedFactor(); // Don't let player's speed go over maximum definitions if(SpeedX > MaxSpeedX) SpeedX = MaxSpeedX; if(SpeedX < -MaxSpeedX) SpeedX = -MaxSpeedX; if(SpeedY > MaxSpeedY) SpeedY = MaxSpeedY; if(SpeedY < -MaxSpeedY) SpeedY = -MaxSpeedY; // Do player's animations OnAnimate(); /* Move player */ // If player is not touching horizontal borders, move normally if (!leftScreenCrossed && !rightScreenCrossed) { OnMove(SpeedX, SpeedY); } // If player is touching one but his speed is not too slow (left border) // or too fast (right border) to go off the screen, move normally else if (leftScreenCrossed && SpeedX >= CCamera::CameraControl.speed || rightScreenCrossed && SpeedX <= CCamera::CameraControl.speed) { OnMove(SpeedX, SpeedY); } // Otherwise force player to move same speed as the camera (or the // rolling play area) else { // Might also want to check player X won't get off screen (level objects can "push" player) OnMove(CCamera::CameraControl.speed, SpeedY); } /* After has been moved */ Gun.OnLoop(); Afterburner.OnLoop(); Afterburner.X = X-20; Afterburner.Y = Y+PLAYER_SPRITE_HEIGHT/2-7; // Reset level after death scene is complete if ( MakeDeathScene && (SDL_GetTicks() > (unsigned int)(DeathMoment + 3000)) ) { MakeDeathScene = false; CAppStateGame::Instance.ResetLevelNow(); } }
//--------------------------------------------------------------------- // ClientWindowProc(): //--------------------------------------------------------------------- LRESULT WPNOTEBOOK::ClientWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { // Process window message. switch (uMsg) { case WM_CREATE: // Store the window handle for use later. SetHandle(hWnd); // Let notebook object know that create message is being processed. // NOTE: Here is where folder objects have a chance to animate // the zoom effect for window creation. OnCreate(); // Return success so we can continue with the creation of window. return ((LRESULT)0); case WM_ACTIVATE: OnActivate(((wParam==WA_INACTIVE)? TRUE : FALSE)); return (TRUE); // We don't want the client area to have the focus, since it // doesn't accept input. When it gets the focus, which it will // when the window is restored from a minimized state, for // instance, post a user message to ourselves to reset the // focus to the notebook. Posting the message is necessary // because the focus shouldn't be tampered with when processing // a WM_SETFOCUS or WM_KILLFOCUS message. case WM_SETFOCUS: PostMessage(hWnd,WM_WPS_NOTEBOOK_SETFOCUS,0,0L); break; case WM_WPS_NOTEBOOK_SETFOCUS: // Give focus to notebook control in our client area. SetFocus(GetDlgItem(hWnd,IDC_NOTEBOOK)); break; case WM_COMMAND: if (wParam==IDC_NOTEBOOK) OnCommand((HWND)LOWORD(lParam),HIWORD(lParam)); break; case WM_SYSCOMMAND: // A system command has been requested. OnSysCommand((WORD)wParam,lParam); break; case WM_SETTEXT: // Set new window caption text. DefWindowProc(hWnd,uMsg,wParam,lParam); // Update window caption. OnNCPaint(); break; case WM_QUERYDRAGICON: return (OnQueryDragIcon()); case WM_ERASEBKGND: OnEraseBackground((HDC)wParam); break; case WM_NCACTIVATE: // Handle this message ONLY if the non-client area is becoming active OR // the window becoming active or inactive is not a notebook page (modeless dialog). // else, do not update non-client area to prevent flickering effect with // notebook window caption. if ((((BOOL)wParam)==TRUE)||(IsPageWindow((HWND)LOWORD(lParam))==FALSE)) OnNCActivate((BOOL)wParam); return (TRUE); case WM_NCPAINT: OnNCPaint(); return (NULL); case WM_NCMOUSEMOVE: OnNCMouseMove((WORD)wParam,MAKEPOINT(lParam)); break; case WM_NCLBUTTONUP: case WM_NCLBUTTONDOWN: OnNCLButton(uMsg,(WORD)wParam,MAKEPOINT(lParam)); break; case WM_MOUSEMOVE: OnMouseMove(); break; case WM_MOVE: OnMove(MAKEPOINT(lParam)); break; case WM_SIZE: OnSize((WORD)wParam,LOWORD(lParam),HIWORD(lParam)); break; case WM_CLOSE: OnClose(); break; default: // Call the default window procedure. return (DefWindowProc(hWnd,uMsg,wParam,lParam)); } // We are done processing the window message... return (NULL); }
//--------------------------------------------------------------------- // ClientWindowProc(): //--------------------------------------------------------------------- LRESULT WPPALLETE::ClientWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { // Process window message. switch (uMsg) { case WM_CREATE: // Store the window handle for use later. SetHandle(hWnd); // Let notebook object know that create message is being processed. // NOTE: Here is where folder objects have a chance to animate // the zoom effect for window creation. OnCreate(); // Return success so we can continue with the creation of window. return ((LRESULT)0); case WM_ACTIVATE: OnActivate(((wParam==WA_INACTIVE)? TRUE : FALSE)); return (TRUE); case WM_COMMAND: OnCommand((HWND)LOWORD(lParam),HIWORD(lParam)); break; case WM_SYSCOMMAND: // A system command has been requested. OnSysCommand((WORD)wParam,lParam); break; case WM_SETTEXT: // Set new window caption text. DefWindowProc(hWnd,uMsg,wParam,lParam); // Update window caption. OnNCPaint(); break; case WM_QUERYDRAGICON: return (OnQueryDragIcon()); case WM_ERASEBKGND: OnEraseBackground((HDC)wParam); break; case WM_PAINT: OnPaint(); break; case WM_NCACTIVATE: // Handle this message ONLY if the non-client area is becoming active OR // the window becoming active or inactive is not a notebook page (modeless dialog). // else, do not update non-client area to prevent flickering effect with // notebook window caption. OnNCActivate((BOOL)wParam); return (TRUE); case WM_NCPAINT: OnNCPaint(); return (NULL); case WM_NCMOUSEMOVE: OnNCMouseMove((WORD)wParam,MAKEPOINT(lParam)); break; case WM_NCLBUTTONUP: case WM_NCLBUTTONDOWN: OnNCLButton(uMsg,(WORD)wParam,MAKEPOINT(lParam)); break; case WM_MOUSEMOVE: OnMouseMove(); break; case WM_MOVE: OnMove(MAKEPOINT(lParam)); break; case WM_SIZE: OnSize((WORD)wParam,LOWORD(lParam),HIWORD(lParam)); break; case WM_CLOSE: OnClose(); break; default: // Call the default window procedure. return (DefWindowProc(hWnd,uMsg,wParam,lParam)); } // We are done processing the window message... return (NULL); }
void CAreaProxy::SerializeXML( XmlNodeRef &entityNode,bool bLoading ) { if (m_nFlags & FLAG_NOT_SERIALIZE) return; if (bLoading) { XmlNodeRef areaNode = entityNode->findChild( "Area" ); if (!areaNode) return; int nId=0,nGroup=0,nPriority=0; float fProximity = 0; float fHeight = 0; areaNode->getAttr( "Id",nId ); areaNode->getAttr( "Group",nGroup ); areaNode->getAttr( "Proximity",fProximity ); areaNode->getAttr( "Priority",nPriority ); m_pArea->SetID(nId); m_pArea->SetGroup(nGroup); m_pArea->SetProximity(fProximity); m_pArea->SetPriority(nPriority); const char* token(0); XmlNodeRef pointsNode = areaNode->findChild( "Points" ); if (pointsNode) { for (int i = 0; i < pointsNode->getChildCount(); i++) { XmlNodeRef pntNode = pointsNode->getChild(i); Vec3 pos; if (pntNode->getAttr( "Pos",pos )) m_localPoints.push_back(pos); // Get sound obstruction bool bObstructSound = 0; pntNode->getAttr("ObstructSound", bObstructSound); m_abObstructSound.push_back(bObstructSound); } m_pArea->SetAreaType( ENTITY_AREA_TYPE_SHAPE ); areaNode->getAttr( "Height",fHeight ); m_pArea->SetHeight(fHeight); // Set points. OnMove(); } else if (areaNode->getAttr("SphereRadius",m_fRadius)) { // Sphere. areaNode->getAttr("SphereCenter",m_vCenter); m_pArea->SetSphere( m_pEntity->GetWorldTM().TransformPoint(m_vCenter),m_fRadius ); } else if (areaNode->getAttr("VolumeRadius",m_fRadius)) { areaNode->getAttr("Gravity",m_fGravity); areaNode->getAttr("DontDisableInvisible", m_bDontDisableInvisible); AABB box; box.Reset(); // Bezier Volume. pointsNode = areaNode->findChild( "BezierPoints" ); if (pointsNode) { for (int i = 0; i < pointsNode->getChildCount(); i++) { XmlNodeRef pntNode = pointsNode->getChild(i); Vec3 pt; if (pntNode->getAttr( "Pos",pt)) { m_bezierPoints.push_back(pt); box.Add( pt ); } } } m_pArea->SetAreaType( ENTITY_AREA_TYPE_GRAVITYVOLUME ); if (!m_pEntity->GetRenderProxy()) { IEntityRenderProxyPtr pRenderProxy = crycomponent_cast<IEntityRenderProxyPtr>(m_pEntity->CreateProxy( ENTITY_PROXY_RENDER )); m_pEntity->SetFlags(m_pEntity->GetFlags() | ENTITY_FLAG_SEND_RENDER_EVENT); if (box.min.x > box.max.x) box.min = box.max = Vec3(0,0,0); box.min-=Vec3(m_fRadius, m_fRadius, m_fRadius); box.max+=Vec3(m_fRadius, m_fRadius, m_fRadius); Matrix34 tm = m_pEntity->GetWorldTM_Fast(); box.SetTransformedAABB( m_pEntity->GetWorldTM_Fast().GetInverted(),box ); pRenderProxy->SetLocalBounds(box, true); } OnEnable(m_bIsEnable); } else if (areaNode->getAttr("AreaSolidFileName",&token)) { CCryFile file; int nAliasLen = sizeof("%level%")-1; const char* areaSolidFileName; if (strncmp(token,"%level%",nAliasLen) == 0) areaSolidFileName = GetIEntitySystem()->GetSystem()->GetI3DEngine()->GetLevelFilePath(token+nAliasLen); else areaSolidFileName = token; if( file.Open(areaSolidFileName,"rb") ) { int numberOfClosedPolygon = 0; int numberOfOpenPolygon = 0; m_pArea->BeginSettingSolid(m_pEntity->GetWorldTM()); file.ReadType(&numberOfClosedPolygon); file.ReadType(&numberOfOpenPolygon); ReadPolygonsForAreaSolid( file, numberOfClosedPolygon, true ); ReadPolygonsForAreaSolid( file, numberOfOpenPolygon, false ); m_pArea->EndSettingSolid(); } } else { // Box. Vec3 bmin(0,0,0),bmax(0,0,0); areaNode->getAttr("BoxMin",bmin); areaNode->getAttr("BoxMax",bmax); m_pArea->SetBox( bmin,bmax,m_pEntity->GetWorldTM() ); // Get sound obstruction XmlNodeRef const pNodeSoundData = areaNode->findChild("SoundData"); if (pNodeSoundData) { assert(m_abObstructSound.size() == 0); for (int i = 0; i < pNodeSoundData->getChildCount(); ++i) { XmlNodeRef const pNodeSide = pNodeSoundData->getChild(i); if (pNodeSide) { bool bObstructSound = false; pNodeSide->getAttr("ObstructSound", bObstructSound); m_abObstructSound.push_back(bObstructSound); } } } OnMove(); } m_pArea->ClearEntities(); XmlNodeRef entitiesNode = areaNode->findChild( "Entities" ); // Export Entities. if (entitiesNode) { for (int i = 0; i < entitiesNode->getChildCount(); i++) { XmlNodeRef entNode = entitiesNode->getChild(i); EntityId entityId; EntityGUID entityGuid; if(gEnv->pEntitySystem->EntitiesUseGUIDs()) { if (entNode->getAttr( "Guid",entityGuid )) m_pArea->AddEntity( entityGuid ); } else { if (entNode->getAttr( "Id",entityId )) m_pArea->AddEntity( entityId ); } } } } else { // Save points. XmlNodeRef areaNode = entityNode->newChild( "Area" ); areaNode->setAttr( "Id",m_pArea->GetID() ); areaNode->setAttr( "Group",m_pArea->GetGroup() ); areaNode->setAttr( "Proximity",m_pArea->GetProximity() ); areaNode->setAttr( "Priority", m_pArea->GetPriority() ); EEntityAreaType type = m_pArea->GetAreaType(); if (type == ENTITY_AREA_TYPE_SHAPE) { XmlNodeRef pointsNode = areaNode->newChild( "Points" ); for (unsigned int i = 0; i < m_localPoints.size(); i++) { XmlNodeRef pntNode = pointsNode->newChild("Point"); pntNode->setAttr( "Pos",m_localPoints[i] ); pntNode->setAttr("ObstructSound", m_abObstructSound[i]); } areaNode->setAttr( "Height",m_pArea->GetHeight() ); } else if (type == ENTITY_AREA_TYPE_SPHERE) { // Box. areaNode->setAttr("SphereCenter",m_vCenter); areaNode->setAttr("SphereRadius",m_fRadius); } else if (type == ENTITY_AREA_TYPE_BOX) { // Box. Vec3 bmin,bmax; m_pArea->GetBox(bmin,bmax); areaNode->setAttr("BoxMin",bmin); areaNode->setAttr("BoxMax",bmax); // Set sound obstruction XmlNodeRef const pNodeSoundData = areaNode->newChild("SoundData"); if (pNodeSoundData) { assert(m_abObstructSound.size() == 6); size_t nIndex = 0; tSoundObstructionIterConst const ItEnd = m_abObstructSound.end(); for (tSoundObstructionIterConst It = m_abObstructSound.begin(); It != ItEnd ; ++It) { bool const bObstructed = (bool)(*It); stack_string sTemp; sTemp.Format("Side%d", ++nIndex); XmlNodeRef const pNodeSide = pNodeSoundData->newChild(sTemp.c_str()); pNodeSide->setAttr("ObstructSound", bObstructed); } } } else if (type == ENTITY_AREA_TYPE_GRAVITYVOLUME) { areaNode->setAttr("VolumeRadius",m_fRadius); areaNode->setAttr("Gravity",m_fGravity); areaNode->setAttr("DontDisableInvisible", m_bDontDisableInvisible); XmlNodeRef pointsNode = areaNode->newChild( "BezierPoints" ); for (unsigned int i = 0; i < m_bezierPoints.size(); i++) { XmlNodeRef pntNode = pointsNode->newChild("Point"); pntNode->setAttr( "Pos",m_bezierPoints[i] ); } } #ifdef SW_ENTITY_ID_USE_GUID const std::vector<EntityGUID>& entGUIDs=*m_pArea->GetEntitiesGuid(); // Export Entities. if (!entGUIDs.empty()) { XmlNodeRef nodes = areaNode->newChild( "Entities" ); for (uint32 i = 0; i < entGUIDs.size(); i++) { EntityGUID guid = entGUIDs[i]; XmlNodeRef entNode = nodes->newChild( "Entity" ); entNode->setAttr( "Guid",guid ); entNode->setAttr( "Id",gEnv->pEntitySystem->GenerateEntityIdFromGuid(guid) ); } } #else const std::vector<EntityId>& entIDs=*m_pArea->GetEntities(); // Export Entities. if (!entIDs.empty()) { XmlNodeRef nodes = areaNode->newChild( "Entities" ); for (uint32 i = 0; i < entIDs.size(); i++) { int entityId = entIDs[i]; XmlNodeRef entNode = nodes->newChild( "Entity" ); entNode->setAttr( "Id",entityId ); } } #endif } }
/* Message handler for dialog box. */ static INT_PTR CALLBACK TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static const WCHAR wszTaskmgr[] = {'t','a','s','k','m','g','r',0}; HDC hdc; PAINTSTRUCT ps; LPRECT pRC; RECT rc; LPNMHDR pnmh; WINDOWPLACEMENT wp; switch (message) { case WM_INITDIALOG: hMainWnd = hDlg; return OnCreate(hDlg); case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } /* Process menu commands */ switch (LOWORD(wParam)) { case ID_FILE_NEW: TaskManager_OnFileNew(); break; case ID_OPTIONS_ALWAYSONTOP: TaskManager_OnOptionsAlwaysOnTop(); break; case ID_OPTIONS_MINIMIZEONUSE: TaskManager_OnOptionsMinimizeOnUse(); break; case ID_OPTIONS_HIDEWHENMINIMIZED: TaskManager_OnOptionsHideWhenMinimized(); break; case ID_OPTIONS_SHOW16BITTASKS: TaskManager_OnOptionsShow16BitTasks(); break; case ID_RESTORE: TaskManager_OnRestoreMainWindow(); break; case ID_VIEW_LARGE: ApplicationPage_OnViewLargeIcons(); break; case ID_VIEW_SMALL: ApplicationPage_OnViewSmallIcons(); break; case ID_VIEW_DETAILS: ApplicationPage_OnViewDetails(); break; case ID_VIEW_SHOWKERNELTIMES: PerformancePage_OnViewShowKernelTimes(); break; case ID_VIEW_CPUHISTORY_ONEGRAPHALL: PerformancePage_OnViewCPUHistoryOneGraphAll(); break; case ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU: PerformancePage_OnViewCPUHistoryOneGraphPerCPU(); break; case ID_VIEW_UPDATESPEED_HIGH: TaskManager_OnViewUpdateSpeedHigh(); break; case ID_VIEW_UPDATESPEED_NORMAL: TaskManager_OnViewUpdateSpeedNormal(); break; case ID_VIEW_UPDATESPEED_LOW: TaskManager_OnViewUpdateSpeedLow(); break; case ID_VIEW_UPDATESPEED_PAUSED: TaskManager_OnViewUpdateSpeedPaused(); break; case ID_VIEW_SELECTCOLUMNS: ProcessPage_OnViewSelectColumns(); break; case ID_VIEW_REFRESH: PostMessageW(hDlg, WM_TIMER, 0, 0); break; case ID_WINDOWS_TILEHORIZONTALLY: ApplicationPage_OnWindowsTileHorizontally(); break; case ID_WINDOWS_TILEVERTICALLY: ApplicationPage_OnWindowsTileVertically(); break; case ID_WINDOWS_MINIMIZE: ApplicationPage_OnWindowsMinimize(); break; case ID_WINDOWS_MAXIMIZE: ApplicationPage_OnWindowsMaximize(); break; case ID_WINDOWS_CASCADE: ApplicationPage_OnWindowsCascade(); break; case ID_WINDOWS_BRINGTOFRONT: ApplicationPage_OnWindowsBringToFront(); break; case ID_APPLICATION_PAGE_SWITCHTO: ApplicationPage_OnSwitchTo(); break; case ID_APPLICATION_PAGE_ENDTASK: ApplicationPage_OnEndTask(); break; case ID_APPLICATION_PAGE_GOTOPROCESS: ApplicationPage_OnGotoProcess(); break; case ID_PROCESS_PAGE_ENDPROCESS: ProcessPage_OnEndProcess(); break; case ID_PROCESS_PAGE_ENDPROCESSTREE: ProcessPage_OnEndProcessTree(); break; case ID_PROCESS_PAGE_DEBUG: ProcessPage_OnDebug(); break; case ID_PROCESS_PAGE_SETAFFINITY: ProcessPage_OnSetAffinity(); break; case ID_PROCESS_PAGE_SETPRIORITY_REALTIME: ProcessPage_OnSetPriorityRealTime(); break; case ID_PROCESS_PAGE_SETPRIORITY_HIGH: ProcessPage_OnSetPriorityHigh(); break; case ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL: ProcessPage_OnSetPriorityAboveNormal(); break; case ID_PROCESS_PAGE_SETPRIORITY_NORMAL: ProcessPage_OnSetPriorityNormal(); break; case ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL: ProcessPage_OnSetPriorityBelowNormal(); break; case ID_PROCESS_PAGE_SETPRIORITY_LOW: ProcessPage_OnSetPriorityLow(); break; case ID_PROCESS_PAGE_DEBUGCHANNELS: ProcessPage_OnDebugChannels(); break; case ID_HELP_TOPICS: WinHelpW(hDlg, wszTaskmgr, HELP_FINDER, 0); break; case ID_HELP_ABOUT: OnAbout(); break; case ID_FILE_EXIT: EndDialog(hDlg, IDOK); break; } break; case WM_ONTRAYICON: switch(lParam) { case WM_RBUTTONDOWN: { POINT pt; BOOL OnTop; HMENU hMenu, hPopupMenu; GetCursorPos(&pt); OnTop = (GetWindowLongW(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0; hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_TRAY_POPUP)); hPopupMenu = GetSubMenu(hMenu, 0); if(IsWindowVisible(hMainWnd)) { DeleteMenu(hPopupMenu, ID_RESTORE, MF_BYCOMMAND); } else { SetMenuDefaultItem(hPopupMenu, ID_RESTORE, FALSE); } if(OnTop) { CheckMenuItem(hPopupMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND | MF_CHECKED); } SetForegroundWindow(hMainWnd); TrackPopupMenuEx(hPopupMenu, 0, pt.x, pt.y, hMainWnd, NULL); DestroyMenu(hMenu); break; } case WM_LBUTTONDBLCLK: TaskManager_OnRestoreMainWindow(); break; } break; case WM_NOTIFY: pnmh = (LPNMHDR)lParam; if ((pnmh->hwndFrom == hTabWnd) && (pnmh->idFrom == IDC_TAB) && (pnmh->code == TCN_SELCHANGE)) { TaskManager_OnTabWndSelChange(); } break; case WM_NCPAINT: hdc = GetDC(hDlg); GetClientRect(hDlg, &rc); Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT)); ReleaseDC(hDlg, hdc); break; case WM_PAINT: hdc = BeginPaint(hDlg, &ps); GetClientRect(hDlg, &rc); Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT)); EndPaint(hDlg, &ps); break; case WM_SIZING: /* Make sure the user is sizing the dialog */ /* in an acceptable range */ pRC = (LPRECT)lParam; if ((wParam == WMSZ_LEFT) || (wParam == WMSZ_TOPLEFT) || (wParam == WMSZ_BOTTOMLEFT)) { /* If the width is too small enlarge it to the minimum */ if (nMinimumWidth > (pRC->right - pRC->left)) pRC->left = pRC->right - nMinimumWidth; } else { /* If the width is too small enlarge it to the minimum */ if (nMinimumWidth > (pRC->right - pRC->left)) pRC->right = pRC->left + nMinimumWidth; } if ((wParam == WMSZ_TOP) || (wParam == WMSZ_TOPLEFT) || (wParam == WMSZ_TOPRIGHT)) { /* If the height is too small enlarge it to the minimum */ if (nMinimumHeight > (pRC->bottom - pRC->top)) pRC->top = pRC->bottom - nMinimumHeight; } else { /* If the height is too small enlarge it to the minimum */ if (nMinimumHeight > (pRC->bottom - pRC->top)) pRC->bottom = pRC->top + nMinimumHeight; } return TRUE; case WM_SIZE: /* Handle the window sizing in it's own function */ OnSize(wParam, LOWORD(lParam), HIWORD(lParam)); break; case WM_MOVE: /* Handle the window moving in it's own function */ OnMove(wParam, LOWORD(lParam), HIWORD(lParam)); break; case WM_DESTROY: ShowWindow(hDlg, SW_HIDE); TrayIcon_ShellRemoveTrayIcon(); wp.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(hDlg, &wp); TaskManagerSettings.Left = wp.rcNormalPosition.left; TaskManagerSettings.Top = wp.rcNormalPosition.top; TaskManagerSettings.Right = wp.rcNormalPosition.right; TaskManagerSettings.Bottom = wp.rcNormalPosition.bottom; if (IsZoomed(hDlg) || (wp.flags & WPF_RESTORETOMAXIMIZED)) TaskManagerSettings.Maximized = TRUE; else TaskManagerSettings.Maximized = FALSE; return DefWindowProcW(hDlg, message, wParam, lParam); case WM_TIMER: /* Refresh the performance data */ PerfDataRefresh(); RefreshApplicationPage(); RefreshProcessPage(); RefreshPerformancePage(); TrayIcon_ShellUpdateTrayIcon(); break; case WM_ENTERMENULOOP: TaskManager_OnEnterMenuLoop(hDlg); break; case WM_EXITMENULOOP: TaskManager_OnExitMenuLoop(hDlg); break; case WM_MENUSELECT: TaskManager_OnMenuSelect(hDlg, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam); break; } return 0; }
//-------------------------------------------------------------------------------------- // Desc: //-------------------------------------------------------------------------------------- LRESULT CD3DArcBall::HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { // Current mouse position int iMouseX = ( short )LOWORD( lParam ); int iMouseY = ( short )HIWORD( lParam ); switch( uMsg ) { case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: SetCapture( hWnd ); OnBegin( iMouseX, iMouseY ); return TRUE; case WM_LBUTTONUP: ReleaseCapture(); OnEnd(); return TRUE; case WM_CAPTURECHANGED: if( ( HWND )lParam != hWnd ) { ReleaseCapture(); OnEnd(); } return TRUE; case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK: SetCapture( hWnd ); // Store off the position of the cursor when the button is pressed m_ptLastMouse.x = iMouseX; m_ptLastMouse.y = iMouseY; return TRUE; case WM_RBUTTONUP: case WM_MBUTTONUP: ReleaseCapture(); return TRUE; case WM_MOUSEMOVE: if( MK_LBUTTON & wParam ) { OnMove( iMouseX, iMouseY ); } else if( ( MK_RBUTTON & wParam ) || ( MK_MBUTTON & wParam ) ) { // Normalize based on size of window and bounding sphere radius FLOAT fDeltaX = ( m_ptLastMouse.x - iMouseX ) * m_fRadiusTranslation / m_nWidth; FLOAT fDeltaY = ( m_ptLastMouse.y - iMouseY ) * m_fRadiusTranslation / m_nHeight; if( wParam & MK_RBUTTON ) { D3DXMatrixTranslation( &m_mTranslationDelta, -2 * fDeltaX, 2 * fDeltaY, 0.0f ); D3DXMatrixMultiply( &m_mTranslation, &m_mTranslation, &m_mTranslationDelta ); } else // wParam & MK_MBUTTON { D3DXMatrixTranslation( &m_mTranslationDelta, 0.0f, 0.0f, 5 * fDeltaY ); D3DXMatrixMultiply( &m_mTranslation, &m_mTranslation, &m_mTranslationDelta ); } // Store mouse coordinate m_ptLastMouse.x = iMouseX; m_ptLastMouse.y = iMouseY; } return TRUE; } return FALSE; }
void CAreaProxy::ProcessEvent( SEntityEvent &event ) { switch(event.event) { case ENTITY_EVENT_XFORM: OnMove(); break; case ENTITY_EVENT_SCRIPT_EVENT: { const char * pName = (const char*)event.nParam[0]; if(!stricmp(pName, "Enable")) OnEnable(true); else if(!stricmp(pName, "Disable")) OnEnable(false); } break; case ENTITY_EVENT_RENDER: { if(m_pArea->GetAreaType()==ENTITY_AREA_TYPE_GRAVITYVOLUME) { if(!m_bDontDisableInvisible) { m_lastFrameTime = gEnv->pTimer->GetCurrTime(); } if(!m_bIsEnableInternal) { m_bIsEnableInternal = true; OnEnable(m_bIsEnable, false); m_pEntity->SetTimer(0, 11000); } } } break; case ENTITY_EVENT_TIMER: { if(m_pArea->GetAreaType()==ENTITY_AREA_TYPE_GRAVITYVOLUME) { if(!m_bDontDisableInvisible) { bool bOff=false; if(gEnv->pTimer->GetCurrTime() - m_lastFrameTime > 10.0f) { bOff=true; IEntityRenderProxy * pEntPr = (IEntityRenderProxy *)m_pEntity->GetProxy(ENTITY_PROXY_RENDER); if(pEntPr) { IRenderNode * pRendNode = pEntPr->GetRenderNode(); if(pRendNode) { if(pEntPr->IsRenderProxyVisAreaVisible()) bOff = false; } } if(bOff) { m_bIsEnableInternal = false; OnEnable(m_bIsEnable, false); } } if(!bOff) m_pEntity->SetTimer(0, 11000); } } } break; } }