Exemplo n.º 1
0
InputDeviceFeatureSet RevolverTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
	{
	/* Paranoia: Check if the forwarded feature is on the transformed device: */
	if(forwardedFeature.getDevice()!=transformedDevice)
		Misc::throwStdErr("RevolverTool::getSourceFeatures: Forwarded feature is not on transformed device");
	
	/* Create an empty feature set: */
	InputDeviceFeatureSet result;
	
	if(forwardedFeature.isButton())
		{
		/* Find the source button slot index: */
		int buttonSlotIndex=forwardedFeature.getIndex()/factory->numChambers+1;
		
		/* Add the button slot's feature to the result set: */
		result.push_back(input.getButtonSlotFeature(buttonSlotIndex));
		}
	
	if(forwardedFeature.isValuator())
		{
		/* Find the source valuator slot index: */
		int valuatorSlotIndex=forwardedFeature.getIndex()/factory->numChambers;
		
		/* Add the valuator slot's feature to the result set: */
		result.push_back(input.getValuatorSlotFeature(valuatorSlotIndex));
		}
	
	return result;
	}
InputDeviceFeatureSet WandNavigationTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
	{
	/* Paranoia: Check if the forwarded feature is on the transformed device: */
	if(forwardedFeature.getDevice()!=buttonDevice)
		Misc::throwStdErr("WandNavigationTool::getSourceFeatures: Forwarded feature is not on transformed device");
	
	/* Return the source feature: */
	InputDeviceFeatureSet result;
	result.push_back(input.getButtonSlotFeature(1));
	return result;
	}
Exemplo n.º 3
0
InputDeviceFeatureSet WidgetTool::getForwardedFeatures(const InputDeviceFeature& sourceFeature)
	{
	/* Paranoia: Check if the source feature belongs to this tool: */
	if(input.findFeature(sourceFeature)!=0)
		Misc::throwStdErr("WidgetTool::getForwardedFeatures: Source feature is not part of tool's input assignment");
	
	/* Return the forwarded feature: */
	InputDeviceFeatureSet result;
	result.push_back(InputDeviceFeature(buttonDevice,InputDevice::BUTTON,0));
	return result;
	}
Exemplo n.º 4
0
InputDeviceFeatureSet ScrollTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
	{
	/* Paranoia: Check if the forwarded feature is on the transformed device: */
	if(forwardedFeature.getDevice()!=valuatorDevice)
		Misc::throwStdErr("ScrollTool::getSourceFeatures: Forwarded feature is not on transformed device");
	
	/* Return the source feature: */
	InputDeviceFeatureSet result;
	result.push_back(input.getValuatorSlotFeature(0));
	return result;
	}
Exemplo n.º 5
0
InputDeviceFeatureSet ValuatorToButtonTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
	{
	/* Paranoia: Check if the forwarded feature is on the transformed device: */
	if(forwardedFeature.getDevice()!=transformedDevice)
		Misc::throwStdErr("ValuatorToButtonTool::getSourceFeatures: Forwarded feature is not on transformed device");
	
	/* Return the valuator slot feeding the forwarded button slot: */
	InputDeviceFeatureSet result;
	result.push_back(input.getValuatorSlotFeature(forwardedFeature.getIndex()/2));
	
	return result;
	}
InputDeviceFeatureSet ButtonToValuatorTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
	{
	/* Paranoia: Check if the forwarded feature is on the transformed device: */
	if(forwardedFeature.getDevice()!=transformedDevice)
		Misc::throwStdErr("ButtonToValuatorTool::getSourceFeatures: Forwarded feature is not on transformed device");
	
	/* The source features are all button slots: */
	InputDeviceFeatureSet result;
	for(int i=0;i<input.getNumButtonSlots();++i)
		result.push_back(input.getButtonSlotFeature(i));
	
	return result;
	}
InputDeviceFeatureSet WandNavigationTool::getForwardedFeatures(const InputDeviceFeature& sourceFeature)
	{
	/* Get the source feature's assignment slot index: */
	int slotIndex=input.findFeature(sourceFeature);
	
	/* Paranoia: Check if the source feature belongs to this tool: */
	if(slotIndex<0)
		Misc::throwStdErr("WandNavigationTool::getForwardedFeatures: Source feature is not part of tool's input assignment");
	
	/* Return the forwarded feature: */
	InputDeviceFeatureSet result;
	if(slotIndex==1)
		result.push_back(InputDeviceFeature(buttonDevice,InputDevice::BUTTON,0));
	return result;
	}
InputDeviceFeatureSet ButtonToValuatorTool::getForwardedFeatures(const InputDeviceFeature& sourceFeature)
	{
	/* Find the input assignment slot for the given feature: */
	int slotIndex=input.findFeature(sourceFeature);
	
	/* Check if the source feature belongs to this tool: */
	if(slotIndex<0)
		Misc::throwStdErr("ButtonToValuatorTool::getForwardedFeatures: Source feature is not part of tool's input assignment");
	
	/* The only forwarded feature is the valuator slot: */
	InputDeviceFeatureSet result;
	result.push_back(InputDeviceFeature(transformedDevice,InputDevice::VALUATOR,0));
	
	return result;
	}
Exemplo n.º 9
0
InputDeviceFeatureSet ValuatorToButtonTool::getForwardedFeatures(const InputDeviceFeature& sourceFeature)
	{
	/* Find the input assignment slot for the given feature: */
	int slotIndex=input.findFeature(sourceFeature);
	
	/* Check if the source feature belongs to this tool: */
	if(slotIndex<0)
		Misc::throwStdErr("ValuatorToButtonTool::getForwardedFeatures: Source feature is not part of tool's input assignment");
	
	/* Get the slot's valuator slot index: */
	int valuatorSlotIndex=input.getValuatorSlotIndex(slotIndex);
	
	/* Return the two button slots fed by the source valuator slot: */
	InputDeviceFeatureSet result;
	for(int i=0;i<2;++i)
		result.push_back(InputDeviceFeature(transformedDevice,InputDevice::BUTTON,valuatorSlotIndex*2+i));
	
	return result;
	}
Exemplo n.º 10
0
InputDeviceFeatureSet TransformTool::getForwardedFeatures(const InputDeviceFeature& sourceFeature)
{
    /* Find the input assignment slot for the given feature: */
    int slotIndex=input.findFeature(sourceFeature);

    /* Check if the source feature belongs to this tool: */
    if(slotIndex<0)
        Misc::throwStdErr("TransformTool::getForwardedFeatures: Source feature is not part of tool's input assignment");

    /* Create an empty feature set: */
    InputDeviceFeatureSet result;

    /* Check if the feature is a button or valuator: */
    if(sourceFeature.isButton())
    {
        /* Get the slot's button slot index: */
        int buttonSlotIndex=input.getButtonSlotIndex(slotIndex);

        /* Check if the button is part of the forwarded subset: */
        if(buttonSlotIndex>=numPrivateButtons)
        {
            /* Add the forwarded feature to the result set: */
            result.push_back(InputDeviceFeature(transformedDevice,InputDevice::BUTTON,buttonSlotIndex-numPrivateButtons));
        }
    }

    if(sourceFeature.isValuator())
    {
        /* Get the slot's valuator slot index: */
        int valuatorSlotIndex=input.getValuatorSlotIndex(slotIndex);

        /* Check if the valuator is part of the forwarded subset: */
        if(valuatorSlotIndex>=numPrivateValuators)
        {
            /* Add the forwarded feature to the result set: */
            result.push_back(InputDeviceFeature(transformedDevice,InputDevice::VALUATOR,valuatorSlotIndex-numPrivateValuators));
        }
    }

    return result;
}
Exemplo n.º 11
0
InputDeviceFeatureSet RevolverTool::getForwardedFeatures(const InputDeviceFeature& sourceFeature)
	{
	/* Find the input assignment slot for the given feature: */
	int slotIndex=input.findFeature(sourceFeature);
	
	/* Check if the source feature belongs to this tool: */
	if(slotIndex<0)
		Misc::throwStdErr("RevolverTool::getForwardedFeatures: Source feature is not part of tool's input assignment");
	
	/* Create an empty feature set: */
	InputDeviceFeatureSet result;
	
	/* Check if the feature is a button or valuator: */
	if(sourceFeature.isButton())
		{
		/* Get the slot's button slot index: */
		int buttonSlotIndex=input.getButtonSlotIndex(slotIndex);
		
		/* Check if the button is part of the forwarded subset: */
		if(buttonSlotIndex>=1)
			{
			/* Add the forwarded feature for the current chamber to the result set: */
			int baseButtonIndex=(buttonSlotIndex-1)*factory->numChambers;
			result.push_back(InputDeviceFeature(transformedDevice,InputDevice::BUTTON,baseButtonIndex+currentChamber));
			}
		}
	
	if(sourceFeature.isValuator())
		{
		/* Get the slot's valuator slot index: */
		int valuatorSlotIndex=input.getValuatorSlotIndex(slotIndex);
		
		/* Add the forwarded feature for the current chamber to the result set: */
		int baseValuatorIndex=valuatorSlotIndex*factory->numChambers;
		result.push_back(InputDeviceFeature(transformedDevice,InputDevice::VALUATOR,baseValuatorIndex+currentChamber));
		}
	
	return result;
	}
Exemplo n.º 12
0
InputDeviceFeatureSet TransformTool::getSourceFeatures(const InputDeviceFeature& forwardedFeature)
{
    /* Paranoia: Check if the forwarded feature is on the transformed device: */
    if(forwardedFeature.getDevice()!=transformedDevice)
        Misc::throwStdErr("TransformTool::getSourceFeatures: Forwarded feature is not on transformed device");

    /* Create an empty feature set: */
    InputDeviceFeatureSet result;

    if(forwardedFeature.isButton())
    {
        /* Add the slot's feature to the result set: */
        result.push_back(input.getButtonSlotFeature(forwardedFeature.getIndex()+numPrivateButtons));
    }

    if(forwardedFeature.isValuator())
    {
        /* Add the slot's feature to the result set: */
        result.push_back(input.getValuatorSlotFeature(forwardedFeature.getIndex()+numPrivateValuators));
    }

    return result;
}