本文整理汇总了C#中IController.GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C# IController.GetFloat方法的具体用法?C# IController.GetFloat怎么用?C# IController.GetFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IController
的用法示例。
在下文中一共展示了IController.GetFloat方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Set
public void Set(IController controller)
{
var newVal = (int)controller.GetFloat(Name);
var changed = AnalogTrackBar.Value != newVal;
if (changed)
{
CurrentValue = newVal;
}
}
示例2: LatchFromSource
/// <summary>
/// latches all buttons from the provided source
/// </summary>
public void LatchFromSource(IController source)
{
foreach (var button in Type.BoolButtons)
{
MyBoolButtons[button] = source[button];
}
foreach (var name in Type.FloatControls)
{
MyFloatControls[name] = source.GetFloat(name);
}
}
示例3: Set
public void Set(IController controller)
{
var newX = controller.GetFloat(XName) / MultiplierX;
var newY = controller.GetFloat(YName) / MultiplierY;
var oldX = X / MultiplierX;
var oldY = Y / MultiplierY;
var changed = newX != oldX && newY != oldY;
XNumeric.Value = (int)newX;
YNumeric.Value = (int)newY;
_overrideX = (int)newX;
_overrideY = (int)newY;
if (changed)
{
Refresh();
}
_isSet = true;
}
示例4: ConvertLightgun
static void ConvertLightgun(IController c, InputState s)
{
s.ClearAllInput();
ConvertConsoleButtons7800(c, s);
ConvertTrigger(c, s, 0);
ConvertTrigger(c, s, 1);
s.RaiseLightgunPos(0, (int)c.GetFloat("P1 VPos"), (int)c.GetFloat("P1 HPos"));
s.RaiseLightgunPos(1, (int)c.GetFloat("P2 VPos"), (int)c.GetFloat("P2 HPos"));
}
示例5: ConvertDriving
static void ConvertDriving(IController c, InputState s)
{
s.ClearAllInput();
ConvertConsoleButtons(c, s);
ConvertTrigger(c, s, 0);
ConvertTrigger(c, s, 1);
s.RaiseInput(0, drvlut[(int)c.GetFloat("P1 Driving")], true);
s.RaiseInput(1, drvlut[(int)c.GetFloat("P2 Driving")], true);
}
示例6: ConvertPaddles
static void ConvertPaddles(IController c, InputState s)
{
s.ClearAllInput();
ConvertConsoleButtons(c, s);
for (int i = 0; i < 4; i++)
{
string ps = string.Format("P{0} ", i + 1);
ConvertTrigger(c, s, i);
s.RaisePaddleInput(i, 700000, (int)c.GetFloat(ps + "Trigger"));
}
}
示例7: CreateDisplayValueForButton
public string CreateDisplayValueForButton(IController adapter, string buttonName)
{
if (adapter.Type.BoolButtons.Contains(buttonName))
{
return adapter.IsPressed(buttonName) ?
Mnemonics[buttonName].ToString() :
string.Empty;
}
if (adapter.Type.FloatControls.Contains(buttonName))
{
return adapter.GetFloat(buttonName).ToString();
}
return "!";
}
示例8: CopyFrom
/// <summary>
/// this controller's definition changes to that of source
/// </summary>
/// <param name="source"></param>
public void CopyFrom(IController source)
{
this.def = source.Type;
buttons.Clear();
foreach (var k in def.BoolButtons)
buttons.Add(k, source.IsPressed(k) ? 1.0f : 0);
foreach (var k in def.FloatControls)
{
if (buttons.Keys.Contains(k))
throw new Exception("name collision between bool and float lists!");
buttons.Add(k, source.GetFloat(k));
}
}
示例9: LatchPlayerFromSource
/// <summary>
/// latches one player from the source
/// </summary>
public void LatchPlayerFromSource(IController playerSource, int playerNum)
{
foreach (var button in playerSource.Type.BoolButtons)
{
var bnp = ButtonNameParser.Parse(button);
if (bnp == null)
{
continue;
}
if (bnp.PlayerNum != playerNum)
{
continue;
}
var val = playerSource[button];
MyBoolButtons[button] = val;
}
foreach (var button in Type.FloatControls)
{
var bnp = ButtonNameParser.Parse(button);
if (bnp == null)
{
continue;
}
if (bnp.PlayerNum != playerNum)
{
continue;
}
var val = playerSource.GetFloat(button);
MyFloatControls[button] = val;
}
}
示例10: ORLatchFromSource
private void ORLatchFromSource(Bk2ControllerAdapter latching, IController source)
{
foreach (string button in latching.Type.BoolButtons)
{
latching[button] |= source.IsPressed(button);
}
foreach (string name in latching.Type.FloatControls)
{
float sFloat = source.GetFloat(name);
int indexRange = source.Type.FloatControls.IndexOf(name);
if (sFloat == source.Type.FloatRanges[indexRange].Mid)
latching.SetFloat(name, sFloat);
}
}
示例11: LatchFromSourceButtons
public void LatchFromSourceButtons(Bk2ControllerAdapter latching, IController source)
{
foreach (string button in source.Type.BoolButtons)
{
latching[button] = source.IsPressed(button);
}
foreach (string name in source.Type.FloatControls)
{
latching.SetFloat(name, source.GetFloat(name));
}
}
示例12: Set
public void Set(IController controller)
{
var newX = (int)controller.GetFloat(XName);
var newY = (int)controller.GetFloat(YName);
var changed = newX != X || newY != Y;
if (changed)
{
SetPosition(newX, newY);
}
}
示例13: LatchFromPhysical
/// <summary>
/// uses the bindings to latch our own logical button state from the source controller's button state (which are assumed to be the physical side of the binding).
/// this will clobber any existing data (use OR_* or other functions to layer in additional input sources)
/// </summary>
public void LatchFromPhysical(IController controller)
{
_buttons.Clear();
foreach (var kvp in _bindings)
{
_buttons[kvp.Key] = false;
foreach (var bound_button in kvp.Value)
{
if (controller[bound_button])
{
_buttons[kvp.Key] = true;
}
}
}
foreach (var kvp in _floatBinds)
{
var input = controller.GetFloat(kvp.Value.Value);
string outkey = kvp.Key;
float multiplier = kvp.Value.Mult;
float deadzone = kvp.Value.Deadzone;
ControllerDefinition.FloatRange range;
if (_floatRanges.TryGetValue(outkey, out range))
{
// input range is assumed to be -10000,0,10000
// first, modify for deadzone
{
float absinput = Math.Abs(input);
float zeropoint = deadzone * 10000.0f;
if (absinput < zeropoint)
{
input = 0.0f;
}
else
{
absinput -= zeropoint;
absinput *= 10000.0f;
absinput /= 10000.0f - zeropoint;
input = absinput * Math.Sign(input);
}
}
var output = (input * multiplier + 10000.0f) * (range.Max - range.Min) / 20000.0f + range.Min;
float lbound = Math.Min(range.Min, range.Max);
float ubound = Math.Max(range.Min, range.Max);
if (output < lbound)
{
output = lbound;
}
if (output > ubound)
{
output = ubound;
}
_floatButtons[outkey] = output;
}
}
}
示例14: LatchFromPhysical
/// <summary>
/// uses the bindings to latch our own logical button state from the source controller's button state (which are assumed to be the physical side of the binding).
/// this will clobber any existing data (use OR_* or other functions to layer in additional input sources)
/// </summary>
public void LatchFromPhysical(IController controller)
{
_buttons.Clear();
foreach (var kvp in _bindings)
{
_buttons[kvp.Key] = false;
foreach (var bound_button in kvp.Value)
{
if (controller[bound_button])
{
_buttons[kvp.Key] = true;
}
}
}
foreach (var kvp in _floatBinds)
{
var input = controller.GetFloat(kvp.Value.Value);
string outkey = kvp.Key;
if (_floatRanges.ContainsKey(outkey))
{
_floatButtons[outkey] = input;
}
}
//it's not sure where this should happen, so for backwards compatibility.. do it every time
NormalizeFloats(controller);
}