示例#1
0
void VGUI_SurfaceWndProc( Xash_Event *event )
{
#ifdef XASH_SDL
/* When false returned, event passed to engine, else only to vgui*/
/* NOTE: this disabled because VGUI shows its cursor on engine start*/
	if( !vgui.initialized )
		return /*false*/;

	switch( event->type )
	{
	/*case :
		VGUI_ActivateCurrentCursor();
		break;*/
	case SDL_MOUSEMOTION:
		vgui.MouseMove(event->motion.x, event->motion.y);
		//return false;
		break;
	case SDL_MOUSEBUTTONDOWN:
		//if(event->button.clicks == 1)
		vgui.Mouse(MA_PRESSED, VGUI_MapMouseButton(event->button.button));
	//	else
	//	vgui.Mouse(MA_DOUBLE, VGUI_MapMouseButton(event->button.button));
		//return true;
		break;
	case SDL_MOUSEBUTTONUP:
		vgui.Mouse(MA_RELEASED, VGUI_MapMouseButton(event->button.button));
		//return true;
		break;
	case SDL_MOUSEWHEEL:
		vgui.Mouse(MA_WHEEL, event->wheel.y);
		//return true;
		break;
	case SDL_KEYDOWN:
		if(!( event->key.keysym.sym & ( 1 << 30 )))
			vgui.Key( KA_PRESSED, VGUI_MapKey( event->key.keysym.sym ));
		vgui.Key( KA_TYPED, VGUI_MapKey( event->key.keysym.sym ));
		//return false;
		break;
	case SDL_KEYUP:
		vgui.Key( KA_RELEASED, VGUI_MapKey( event->key.keysym.sym ) );
		//return false;
		break;
	}
	
#endif
	//return false;
}
示例#2
0
long VGUI_SurfaceWndProc( SDL_Event *event )
{
	SurfaceBase *surface = NULL;
	CEnginePanel *panel = NULL;
	App *pApp= NULL;

	if( !VGui_GetPanel( ))
		return 0;

	panel = (CEnginePanel *)VGui_GetPanel();
	surface = panel->getSurfaceBase();
	pApp = panel->getApp();

	ASSERT( pApp != NULL );
	ASSERT( surface != NULL );

	switch( event->type )
	{
	/*case :
		VGUI_ActivateCurrentCursor();
		break;*/
	case SDL_MOUSEMOTION:
		pApp->internalCursorMoved(event->motion.x, event->motion.y, surface );
		break;
	case SDL_MOUSEBUTTONDOWN:
		if(event->button.clicks == 1)
			pApp->internalMousePressed( VGUI_MapMouseButton( event->button.button ), surface );
		else pApp->internalMouseDoublePressed( VGUI_MapMouseButton( event->button.button ), surface );
		break;
	case SDL_MOUSEBUTTONUP:
		pApp->internalMouseReleased( VGUI_MapMouseButton( event->button.button ), surface );
		break;
	case SDL_MOUSEWHEEL:
		pApp->internalMouseWheeled(event->wheel.x, surface );
		break;
	case SDL_KEYDOWN:
		if(!( event->key.keysym.sym & ( 1 << 30 )))
			pApp->internalKeyPressed( VGUI_MapKey( event->key.keysym.sym ), surface );
		pApp->internalKeyTyped( VGUI_MapKey( event->key.keysym.sym ), surface );
		break;
	case SDL_KEYUP:
		pApp->internalKeyReleased( VGUI_MapKey( event->key.keysym.sym ), surface );
		break;
	}
	return 1;
}
示例#3
0
long VGUI_SurfaceWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    SurfaceBase *surface = NULL;
    CEnginePanel *panel = NULL;
    App *pApp= NULL;

    if( !VGui_GetPanel( ))
        return 0;

    panel = (CEnginePanel *)VGui_GetPanel();
    surface = panel->getSurfaceBase();
    pApp = panel->getApp();

    ASSERT( pApp != NULL );
    ASSERT( surface != NULL );

    switch( uMsg )
    {
    case WM_SETCURSOR:
        VGUI_ActivateCurrentCursor();
        break;
    case WM_MOUSEMOVE:
        pApp->internalCursorMoved((short)LOWORD( lParam ), (short)HIWORD( lParam ), surface );
        break;
    case WM_LBUTTONDOWN:
        pApp->internalMousePressed( MOUSE_LEFT, surface );
        break;
    case WM_RBUTTONDOWN:
        pApp->internalMousePressed( MOUSE_RIGHT, surface );
        break;
    case WM_MBUTTONDOWN:
        pApp->internalMousePressed( MOUSE_MIDDLE, surface );
        break;
    case WM_LBUTTONUP:
        pApp->internalMouseReleased( MOUSE_LEFT, surface );
        break;
    case WM_RBUTTONUP:
        pApp->internalMouseReleased( MOUSE_RIGHT, surface );
        break;
    case WM_MBUTTONUP:
        pApp->internalMouseReleased( MOUSE_MIDDLE, surface );
        break;
    case WM_LBUTTONDBLCLK:
        pApp->internalMouseDoublePressed( MOUSE_LEFT, surface );
        break;
    case WM_RBUTTONDBLCLK:
        pApp->internalMouseDoublePressed( MOUSE_RIGHT, surface );
        break;
    case WM_MBUTTONDBLCLK:
        pApp->internalMouseDoublePressed( MOUSE_MIDDLE, surface );
        break;
    case WM_MOUSEWHEEL:
        pApp->internalMouseWheeled(((short)HIWORD( wParam )) / 120, surface );
        break;
    case WM_KEYDOWN:
    case WM_SYSKEYDOWN:
        if(!( lParam & ( 1 << 30 )))
            pApp->internalKeyPressed( VGUI_MapKey( wParam ), surface );
        pApp->internalKeyTyped( VGUI_MapKey( wParam ), surface );
        break;
    case WM_CHAR:
    case WM_SYSCHAR:
        // already handled in Key_Event
        break;
    case WM_KEYUP:
    case WM_SYSKEYUP:
        pApp->internalKeyReleased( VGUI_MapKey( wParam ), surface );
        break;
    }
    return 1;
}