summaryrefslogtreecommitdiffhomepage
path: root/dragon/directional_input_helper_methods.rb
diff options
context:
space:
mode:
author_Tradam <[email protected]>2021-12-16 19:22:26 -0500
committerGitHub <[email protected]>2021-12-16 19:22:26 -0500
commit5954b9beb4d4a3b4f248d72d1851195f030558a8 (patch)
treefecd8aa840a25afdb502915b0fdb4d03b7ed339a /dragon/directional_input_helper_methods.rb
parent2f845281f133849256b57bb08fd3e9ae57600784 (diff)
parenteaa29e72939f5edf61735ccbb73c36ee89369f65 (diff)
downloaddragonruby-game-toolkit-contrib-master.tar.gz
dragonruby-game-toolkit-contrib-master.zip
Merge branch 'DragonRuby:master' into masterHEADmaster
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_")