InputEventKey.xml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="InputEventKey" inherits="InputEventWithModifiers" version="3.2">
  3. <brief_description>
  4. Input event type for keyboard events.
  5. </brief_description>
  6. <description>
  7. Stores key presses on the keyboard. Supports key presses, key releases and [member echo] events.
  8. </description>
  9. <tutorials>
  10. <link>https://docs.godotengine.org/en/latest/tutorials/inputs/inputevent.html</link>
  11. </tutorials>
  12. <methods>
  13. <method name="get_scancode_with_modifiers" qualifiers="const">
  14. <return type="int">
  15. </return>
  16. <description>
  17. Returns the scancode combined with modifier keys such as [code]Shift[/code] or [code]Alt[/code]. See also [InputEventWithModifiers].
  18. To get a human-readable representation of the [InputEventKey] with modifiers, use [code]OS.get_scancode_string(event.get_scancode_with_modifiers())[/code] where [code]event[/code] is the [InputEventKey].
  19. </description>
  20. </method>
  21. </methods>
  22. <members>
  23. <member name="echo" type="bool" setter="set_echo" getter="is_echo" default="false">
  24. If [code]true[/code], the key was already pressed before this event. It means the user is holding the key down.
  25. </member>
  26. <member name="pressed" type="bool" setter="set_pressed" getter="is_pressed" default="false">
  27. If [code]true[/code], the key's state is pressed. If [code]false[/code], the key's state is released.
  28. </member>
  29. <member name="scancode" type="int" setter="set_scancode" getter="get_scancode" default="0">
  30. The key scancode, which corresponds to one of the [enum KeyList] constants.
  31. To get a human-readable representation of the [InputEventKey], use [code]OS.get_scancode_string(event.scancode)[/code] where [code]event[/code] is the [InputEventKey].
  32. </member>
  33. <member name="unicode" type="int" setter="set_unicode" getter="get_unicode" default="0">
  34. The key Unicode identifier (when relevant). Unicode identifiers for the composite characters and complex scripts may not be available unless IME input mode is active. See [method OS.set_ime_active] for more information.
  35. </member>
  36. </members>
  37. <constants>
  38. </constants>
  39. </class>