Add better click through semantics
This commit is contained in:
+6
-6
@@ -1,4 +1,4 @@
|
||||
App.run 720, 480, "Button Test", fps: 24
|
||||
App.run 720, 480, "Button Test", fps: 60
|
||||
|
||||
main_scene = Scene.new
|
||||
|
||||
@@ -12,11 +12,11 @@ bg_animation = Animation.new [bg_image1, bg_image2], fps: 5
|
||||
App.language = :en
|
||||
App.localize(:en, :btn_text, "Click %{name}!")
|
||||
|
||||
text = ElementText.new :btn_text, default_font, 0xFFFF00, {name: "Me"}, position: {x: 50, y: 50}, z: 1, click_through: true, alpha: 1
|
||||
text = ElementText.new :btn_text, default_font, 0xFFFF00, {name: "Me"}, position: {x: 50, y: 50}, z: 1, click_mode: :pass, alpha: 1
|
||||
|
||||
rect = ElementRect.new 100, 25, 0xFF0000, position: {x: 50, y: 50}, z: 0, rotation: 60, scale: { x: 1, y: 1 }, alpha: 0.4
|
||||
|
||||
image_element = ElementImage.new bg_animation, position: {x: 0, y: 0}, z: -1, click_through: true, alpha: 1
|
||||
image_element = ElementImage.new bg_animation, position: {x: 0, y: 0}, z: -1, click_mode: :ignore, alpha: 1
|
||||
|
||||
pp text, rect, image_element
|
||||
|
||||
@@ -31,7 +31,7 @@ rect.on_click do
|
||||
text.params!
|
||||
end
|
||||
|
||||
App.map_key :mouse_left, :press
|
||||
App.map_key :mouse_left, :action_name
|
||||
|
||||
start = Time.now
|
||||
c_ = 0.0
|
||||
@@ -49,9 +49,9 @@ main_scene.on_update do |delta_time|
|
||||
|
||||
pp App.text_input if App.text_input != ""
|
||||
|
||||
next unless App.pressed?(:press)
|
||||
next unless App.pressed?(:action_name)
|
||||
|
||||
pp "#{App.pressed?(:press)}, #{App.down?(:press)}, #{App.released?(:press)}"
|
||||
pp "#{App.pressed?(:action_name)}, #{App.down?(:action_name)}, #{App.released?(:action_name)}"
|
||||
|
||||
for elem in el
|
||||
if elem == image_element
|
||||
|
||||
Reference in New Issue
Block a user