当前位置: 首页>>代码示例>>C#>>正文


C# IController.GetFloat方法代码示例

本文整理汇总了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;
			}
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:9,代码来源:VirtualPadAnalogButton.cs

示例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);
			}
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:15,代码来源:BkmControllerAdapter.cs

示例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;
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:23,代码来源:VirtualPadTargetScreen.cs

示例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"));
		}
开发者ID:CadeLaRen,项目名称:BizHawk,代码行数:9,代码来源:Atari7800Control.cs

示例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);
		}
开发者ID:CadeLaRen,项目名称:BizHawk,代码行数:9,代码来源:Atari7800Control.cs

示例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"));
			}
		}
开发者ID:CadeLaRen,项目名称:BizHawk,代码行数:11,代码来源:Atari7800Control.cs

示例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 "!";
		}
开发者ID:Hathor86,项目名称:BizHawk,代码行数:16,代码来源:TasMovie.cs

示例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));
				}
			}
开发者ID:ddugovic,项目名称:RASuite,代码行数:17,代码来源:LibsnesCore.cs

示例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;
			}
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:40,代码来源:Bk2ControllerAdapter.cs

示例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);
			}
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:15,代码来源:MovieZone.cs

示例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));
			}
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:12,代码来源:MovieZone.cs

示例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);
			}
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:10,代码来源:AnalogSticklPanel.cs

示例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;
				}
			}
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:67,代码来源:ControllerBinding.cs

示例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);
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:33,代码来源:ControllerBinding.cs


注:本文中的IController.GetFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。