diff options
| author | _Tradam <[email protected]> | 2021-12-16 19:22:26 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-16 19:22:26 -0500 |
| commit | 5954b9beb4d4a3b4f248d72d1851195f030558a8 (patch) | |
| tree | fecd8aa840a25afdb502915b0fdb4d03b7ed339a /dragon/directional_input_helper_methods.rb | |
| parent | 2f845281f133849256b57bb08fd3e9ae57600784 (diff) | |
| parent | eaa29e72939f5edf61735ccbb73c36ee89369f65 (diff) | |
| download | dragonruby-game-toolkit-contrib-master.tar.gz dragonruby-game-toolkit-contrib-master.zip | |
Diffstat (limited to 'dragon/directional_input_helper_methods.rb')
| -rw-r--r-- | dragon/directional_input_helper_methods.rb | 8 |
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_") |
