Ejemplo n.º 1
0
bool CPanelActionListener::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa)
{
	switch(ea.getEventType())
	{
	case GUIEventAdapter::KEYDOWN:
		KeyDownEvent(ea,aa);
		break;
	case GUIEventAdapter::PUSH:
		//MousePressEvent(ea,aa);
		break;
	case GUIEventAdapter::DRAG:
		//MouseDragEvent(ea,aa);
		break;
	case GUIEventAdapter::DOUBLECLICK:
		MouseClickEvent(ea,aa);
		break;
	case GUIEventAdapter::MOVE:
		//MouseMoveEvent(ea,aa);
		break;
	//case GUIEventAdapter::FRAME:
		//displayEachLine();
		//break;
	default:
		break;
	}
	return false;
}
Ejemplo n.º 2
0
int HandleWsEvent(_THIS, const TWsEvent& aWsEvent)
{
    switch (aWsEvent.Type())
		{    
		case EEventSwitchOff:
			SDL_PrivateQuit();
			return 0;
    	case EEventPointerBufferReady:
    	    return PointerBufferReadyEvent(_this/*, aWsEvent.Time()*/);
        case EEventPointer: /* Mouse pointer events */
            return PointerEvent(_this, aWsEvent);
        case EEventKeyDown: /* Key events */
            return KeyDownEvent(_this, aWsEvent);
        case EEventKeyUp: /* Key events */
            return KeyUpEvent(_this, aWsEvent);
        case EEventFocusGained: /* SDL window got focus */
            return FocusGainedEvent(_this);	   
        case EEventFocusLost: /* SDL window lost focus */
        	return FocusLostEvent(_this);
        case EEventModifiersChanged: 
            return ModifiersChangedEvent(aWsEvent);         
    	case EEventScreenDeviceChanged:
    	    return ScreenDeviceChanged();
    	case ESDLWsEvent:
    	    return InternalEvent(aWsEvent);
        default:            
            return 0;
		} 
    }
Ejemplo n.º 3
0
void EventLoop::processSystemEvents()
{
	sf::Event ev;
	EventPtr evtWrapper;
	while (m_system.m_appWindow.GetEvent(ev))  {
		switch (ev.Type)  {
		case sf::Event::Closed:
			handleEvent(CloseEvent(ev));
		break;
		case sf::Event::MouseButtonPressed:
			handleEvent(MouseDownEvent(ev));
		break;
		case sf::Event::MouseButtonReleased:
			handleEvent(MouseUpEvent(ev));
		break;
		case sf::Event::MouseWheelMoved:
			handleEvent(MouseWheelEvent(ev));
		break;
		case sf::Event::KeyPressed:
			handleEvent(KeyDownEvent(ev));
		break;
		case sf::Event::KeyReleased:
			handleEvent(KeyUpEvent(ev));
		break;
		}
	}
}
Ejemplo n.º 4
0
//--------------------------------------------------------------------------------------
// Called every time the application receives a message
//--------------------------------------------------------------------------------------
LRESULT CALLBACK CScene::WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
	PAINTSTRUCT ps;
	HDC hdc;
	if( TwEventWin( hWnd, message, wParam, lParam ) ) // send event message to AntTweakBar
		return 0; // event has been handled by AntTweakBar
	switch( message )
	{
		case WM_PAINT:
			hdc = BeginPaint( hWnd, &ps );
			EndPaint( hWnd, &ps );
			break;

		case WM_DESTROY:
			PostQuitMessage( 0 );
			break;

		// These windows messages (WM_KEYXXXX) can be used to get keyboard input to the window
		// This application has added some simple functions (not DirectX) to process these messages (all in Input.cpp/h)
		case WM_KEYDOWN:
			KeyDownEvent( static_cast<EKeyState>(wParam) );
			break;

		case WM_KEYUP:
			KeyUpEvent( static_cast<EKeyState>(wParam) );
			break;
		// catch window resize
		case WM_SIZE:
			RECT rc;
			GetClientRect( hWnd, &rc );
			mViewportWidth = rc.right - rc.left;
			mViewportHeight = rc.bottom - rc.top;
			// pass to camera
			CCamera::SetViewport( mViewportWidth, mViewportHeight );
			break;
		default:
			return DefWindowProc( hWnd, message, wParam, lParam );
	}

	return 0;
}
Ejemplo n.º 5
0
/*
==============
ProcessEvent
==============
*/
bool	idConsoleLocal::ProcessEvent( const sysEvent_t* event, bool forceAccept )
{
	const bool consoleKey = event->evType == SE_KEY && event->evValue == K_GRAVE && com_allowConsole.GetBool();
	
	// we always catch the console key event
	if( !forceAccept && consoleKey )
	{
		// ignore up events
		if( event->evValue2 == 0 )
		{
			return true;
		}
		
		consoleField.ClearAutoComplete();
		
		// a down event will toggle the destination lines
		if( keyCatching )
		{
			Close();
			Sys_GrabMouseCursor( true );
		}
		else
		{
			consoleField.Clear();
			keyCatching = true;
			if( idKeyInput::IsDown( K_LSHIFT ) || idKeyInput::IsDown( K_RSHIFT ) )
			{
				// if the shift key is down, don't open the console as much
				SetDisplayFraction( 0.2f );
			}
			else
			{
				SetDisplayFraction( 0.5f );
			}
		}
		return true;
	}
	
	// if we aren't key catching, dump all the other events
	if( !forceAccept && !keyCatching )
	{
		return false;
	}
	
	// handle key and character events
	if( event->evType == SE_CHAR )
	{
		// never send the console key as a character
		if( event->evValue != '`' && event->evValue != '~' )
		{
			consoleField.CharEvent( event->evValue );
		}
		return true;
	}
	
	if( event->evType == SE_KEY )
	{
		// ignore up key events
		if( event->evValue2 == 0 )
		{
			return true;
		}
		
		KeyDownEvent( event->evValue );
		return true;
	}
	
	// we don't handle things like mouse, joystick, and network packets
	return false;
}