DoubleControl.cs 843 B

12345678910111213141516171819202122232425262728293031
  1. using UnityEngine.InputSystem.LowLevel;
  2. namespace UnityEngine.InputSystem.Controls
  3. {
  4. /// <summary>
  5. /// A control reading a <see cref="double"/>.
  6. /// </summary>
  7. [Scripting.Preserve]
  8. public class DoubleControl : InputControl<double>
  9. {
  10. /// <summary>
  11. /// Default-initialize the control.
  12. /// </summary>
  13. public DoubleControl()
  14. {
  15. m_StateBlock.format = InputStateBlock.FormatDouble;
  16. }
  17. /// <inheritdoc/>
  18. public override unsafe double ReadUnprocessedValueFromState(void* statePtr)
  19. {
  20. return m_StateBlock.ReadDouble(statePtr);
  21. }
  22. /// <inheritdoc/>
  23. public override unsafe void WriteValueIntoState(double value, void* statePtr)
  24. {
  25. m_StateBlock.WriteDouble(statePtr, value);
  26. }
  27. }
  28. }