コード例 #1
0
ファイル: events.c プロジェクト: DavidKnight247/xash3d
int SDLash_EventFilter( SDL_Event* event)
{
	switch ( event->type )
	{
		case SDL_MOUSEMOTION:
			IN_MouseEvent(0);
			break;
		case SDL_QUIT:
			Host_Shutdown();
			break;

		case SDL_KEYDOWN:
		case SDL_KEYUP:
			SDLash_KeyEvent(event->key);
			break;

		case SDL_MOUSEWHEEL:
			SDLash_WheelEvent(event->wheel);
			break;

		case SDL_MOUSEBUTTONUP:
		case SDL_MOUSEBUTTONDOWN:
			SDLash_MouseEvent(event->button);
			break;

		case SDL_TEXTEDITING:
			MsgDev(D_INFO, "Caught a text edit: %s %n %n\n", event->edit.text, event->edit.start, event->edit.length);
			break;

		case SDL_TEXTINPUT:
			SDLash_InputEvent(event->text);
			break;

		case SDL_WINDOWEVENT:
			if( host.state == HOST_SHUTDOWN )
				break; // no need to activate
			if( host.state != HOST_RESTART )
			{
				switch( event->window.type )
				{
				case SDL_WINDOWEVENT_MINIMIZED:
					host.state = HOST_SLEEP;
					break;
				case SDL_WINDOWEVENT_FOCUS_LOST:
					host.state = HOST_NOFOCUS;
					IN_DeactivateMouse();
					break;
				default:
					host.state = HOST_FRAME;
					IN_ActivateMouse(true);
				}
			}
	}
	VGUI_SurfaceWndProc(event);
	return 0;
}
コード例 #2
0
ファイル: events.c プロジェクト: gitter-badger/xash3d
int SDLash_EventFilter( SDL_Event* event)
{
#ifdef XASH_VGUI
    //if( !host.mouse_visible || !VGUI_SurfaceWndProc(event))
    // switch ....
    // CEnginePanel is visible by default, why?
    VGUI_SurfaceWndProc(event);
#endif
    switch ( event->type )
    {
    case SDL_MOUSEMOTION:
        if(!host.mouse_visible)
            IN_MouseEvent(0);
        break;
    case SDL_QUIT:
        Host_Shutdown();
        break;

    case SDL_KEYDOWN:
    case SDL_KEYUP:
        SDLash_KeyEvent(event->key);
        break;

    case SDL_MOUSEWHEEL:
        SDLash_WheelEvent(event->wheel);
        break;

    case SDL_FINGERMOTION:
    case SDL_FINGERUP:
    case SDL_FINGERDOWN:
        // Pass all touch events to client library
        //clgame.dllFuncs.pfnIN_TouchEvent(event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, event->tfinger.dx, event->tfinger.dy );
        break;

    case SDL_MOUSEBUTTONUP:
    case SDL_MOUSEBUTTONDOWN:
        //if(!host.mouse_visible)
        SDLash_MouseEvent(event->button);
        break;

    case SDL_TEXTEDITING:
        //MsgDev(D_INFO, "Caught a text edit: %s %n %n\n", event->edit.text, event->edit.start, event->edit.length);
        break;

    case SDL_TEXTINPUT:
        SDLash_InputEvent(event->text);
        break;

    case SDL_WINDOWEVENT:
        if( host.state == HOST_SHUTDOWN )
            break; // no need to activate
        if( host.state != HOST_RESTART )
        {
            switch( event->window.event )
            {
            case SDL_WINDOWEVENT_MINIMIZED:
                host.state = HOST_SLEEP;
                break;
            case SDL_WINDOWEVENT_FOCUS_LOST:
            case SDL_WINDOWEVENT_LEAVE:
                host.state = HOST_NOFOCUS;
                IN_DeactivateMouse();
                break;
            default:
                host.state = HOST_FRAME;
                IN_ActivateMouse(true);
            }
        }
    }
    return 0;
}