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.

37 lines
1.1 KiB

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 class ActionListenerWrap(val uval: ActionListener) extends AnyVal {
  7. /**
  8. * Called when an input to which this listener is registered to is invoked.
  9. *
  10. * @param action The action (name) of the mapping that was invoked
  11. * @param isPressed True if the action is "pressed", false otherwise
  12. * @param tpf The time per frame value.
  13. */
  14. def onAction(action: Action, keyPressed: Boolean, tpf: Float): Unit =
  15. uval.onAction(action.name, keyPressed, tpf)
  16. }
  17. implicit class AnalogListenerWrap(val uval: AnalogListener) extends AnyVal {
  18. /**
  19. * Called to notify the implementation that an analog event has occurred.
  20. *
  21. * The results of KeyTrigger and MouseButtonTrigger events will have tpf
  22. * == value.
  23. *
  24. * @param action The action (name) of the mapping that was invoked
  25. * @param value Value of the axis, from 0 to 1.
  26. * @param tpf The time per frame value.
  27. */
  28. def onAnalog(action: Action, value: Float, tpf: Float): Unit =
  29. uval.onAnalog(action.name, value, tpf)
  30. }
  31. }