Testing out JmonkeyEngine to make a game in Scala with Akka Actors within a pure FP layer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. package com.jme3.input
  2. /**
  3. * Created by Brandon Barker on 6/19/17.
  4. */
  5. package object controls {
  6. implicit final class ActionListenerWrap(private val uval: ActionListener)
  7. extends AnyVal {
  8. /**
  9. * Called when an input to which this listener is registered to is invoked.
  10. *
  11. * @param action The action (name) of the mapping that was invoked
  12. * @param isPressed True if the action is "pressed", false otherwise
  13. * @param tpf The time per frame value.
  14. */
  15. def onAction(action: Action, keyPressed: Boolean, tpf: Float): Unit =
  16. uval.onAction(action.name, keyPressed, tpf)
  17. }
  18. implicit final class AnalogListenerWrap(private val uval: AnalogListener)
  19. extends AnyVal {
  20. /**
  21. * Called to notify the implementation that an analog event has occurred.
  22. *
  23. * The results of KeyTrigger and MouseButtonTrigger events will have tpf
  24. * == value.
  25. *
  26. * @param action The action (name) of the mapping that was invoked
  27. * @param value Value of the axis, from 0 to 1.
  28. * @param tpf The time per frame value.
  29. */
  30. def onAnalog(action: Action, value: Float, tpf: Float): Unit =
  31. uval.onAnalog(action.name, value, tpf)
  32. }
  33. }