summaryrefslogtreecommitdiffhomepage
path: root/dragon/directional_input_helper_methods.rb
diff options
context:
space:
mode:
Diffstat (limited to 'dragon/directional_input_helper_methods.rb')
-rw-r--r--dragon/directional_input_helper_methods.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/dragon/directional_input_helper_methods.rb b/dragon/directional_input_helper_methods.rb
index a587212..0a15c70 100644
--- a/dragon/directional_input_helper_methods.rb
+++ b/dragon/directional_input_helper_methods.rb
@@ -13,7 +13,7 @@ module GTK
error_message = <<-S
* ERROR
-The GTK::DirectionalKeys module should only be included in objects that respond to the following api heirarchy:
+The GTK::DirectionalKeys module should only be included in objects that respond to the following api hierarchy:
- (#{ directional_methods.join("|") })
- key_held.(#{ directional_methods.join("|") })
@@ -70,6 +70,12 @@ S
end
end
+ def directional_angle
+ return nil unless directional_vector
+
+ Math.atan2(up_down, left_right).to_degrees
+ end
+
def method_missing m, *args
# combine the key with ctrl_
if m.to_s.start_with?("ctrl_")