예제 #1
0
void THFrame::FrameUp(const THVector2& p)
{
	OnTouchUp(p);

	unsigned int i=buttonList.num;
	THButton* btn;

	while(i)
	{
		--i;
		btn=buttonList.arr[i];

		if(btn->enable && btn->HitTest(p))
		{
			if(m_buttondown==btn)
			{
				if(btn->m_callback){btn->m_callback->OnRelease(p,btn);}
				break;
			}
			
		}
	}

	if(m_buttondown)
	{
		m_buttondown->Swap();
		m_buttondown=0;
	}		
}
예제 #2
0
//==============================
// OvrSliderComponent::OnEvent_Impl
eMsgStatus OvrSliderComponent::OnEvent_Impl( OvrGuiSys & guiSys, VrFrame const & vrFrame, 
		VRMenuObject * self, VRMenuEvent const & event )
{
	switch ( event.EventType )
	{
		case VRMENU_EVENT_INIT:
			return OnInit( guiSys, vrFrame, self, event );
		case VRMENU_EVENT_FRAME_UPDATE:
			return OnFrameUpdate( guiSys, vrFrame, self, event );
		case VRMENU_EVENT_TOUCH_DOWN:
			return OnTouchDown( guiSys, vrFrame, self, event );
		case VRMENU_EVENT_TOUCH_UP:
			if ( OnReleaseFunction )
			{
				( *OnReleaseFunction )( this, OnReleaseObject, SliderFrac );
			}
			TouchDown = false;
			return OnTouchUp( guiSys, vrFrame, self, event );
		case VRMENU_EVENT_TOUCH_RELATIVE:
			return OnTouchRelative( guiSys, vrFrame, self, event );
		default:
			OVR_ASSERT( false );
			return MSG_STATUS_ALIVE;
	}
    return MSG_STATUS_CONSUMED;
}
예제 #3
0
//==============================
// OvrSliderComponent::OnEvent_Impl
eMsgStatus OvrSliderComponent::OnEvent_Impl( App * app, VrFrame const & vrFrame, OvrVRMenuMgr & menuMgr, 
		VRMenuObject * self, VRMenuEvent const & event )
{
	switch ( event.EventType )
	{
		case VRMENU_EVENT_INIT:
			return OnInit( app, vrFrame, menuMgr, self, event );
		case VRMENU_EVENT_FRAME_UPDATE:
			return OnFrameUpdate( app, vrFrame, menuMgr, self, event );
		case VRMENU_EVENT_TOUCH_DOWN:
			return OnTouchDown( app, vrFrame, menuMgr, self, event );
		case VRMENU_EVENT_TOUCH_UP:
			return OnTouchUp( app, vrFrame, menuMgr, self, event );
			TouchDown = false;
		case VRMENU_EVENT_TOUCH_RELATIVE:
			return OnTouchRelative( app, vrFrame, menuMgr, self, event );
		default:
			OVR_ASSERT( false );
			return MSG_STATUS_ALIVE;
	}
    return MSG_STATUS_CONSUMED;
}
예제 #4
0
LRESULT ofTouch::processTouch(HWND hWnd, WPARAM wParam, LPARAM lParam) {
	//return DefWindowProc(hWnd, WM_TOUCH, wParam, lParam);
	BOOL bHandled = FALSE;
	UINT cInputs = LOWORD(wParam);
	PTOUCHINPUT pInputs = new TOUCHINPUT[cInputs];
	if (pInputs){
		if (GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs, sizeof(TOUCHINPUT))){
			for (UINT i=0; i < cInputs; i++){
				TOUCHINPUT ti = pInputs[i];
				//do something with each touch input entry
				if (ti.dwFlags & TOUCHEVENTF_DOWN){
					OnTouchDown(ti.dwID, TOUCH_COORD_TO_PIXEL(ti.x)-ofGetWindowPositionX(), TOUCH_COORD_TO_PIXEL(ti.y)-ofGetWindowPositionY());
				}
				else if (ti.dwFlags & TOUCHEVENTF_MOVE){
					OnTouchMove(ti.dwID, TOUCH_COORD_TO_PIXEL(ti.x)-ofGetWindowPositionX(), TOUCH_COORD_TO_PIXEL(ti.y)-ofGetWindowPositionY());
				}
				if (ti.dwFlags & TOUCHEVENTF_UP){
					OnTouchUp(ti.dwID, TOUCH_COORD_TO_PIXEL(ti.x)-ofGetWindowPositionX(), TOUCH_COORD_TO_PIXEL(ti.y)-ofGetWindowPositionY());
				}
			}
			bHandled = TRUE;
		}else{
			/* handle the error here */
		}
		delete [] pInputs;
	}else{
		/* handle the error here, probably out of memory */
	}
	if (bHandled){
		// if you handled the message, close the touch input handle and return
		CloseTouchInputHandle((HTOUCHINPUT)lParam);
		return 0;
	}else{
		// if you didn't handle the message, let DefWindowProc handle it
		return DefWindowProc(hWnd, WM_TOUCH, wParam, lParam);
	}
}