Added pixel texture element
This commit is contained in:
+11
-3
@@ -20,7 +20,9 @@ rect = ElementRect.new 100, 25, 0xFF0000, position: {x: 50, y: 50}, z: 0, rotati
|
||||
|
||||
image_element = ElementImage.new bg_animation, position: {x: 0, y: 0}, z: -1, click_mode: :block, alpha: 1
|
||||
|
||||
pp text, rect, image_element
|
||||
script_element = ElementScript.new 100, 100, position: {x: 200, y: 200}, z: 2, click_mode: :block, alpha: 1
|
||||
|
||||
pp text, rect, image_element, script_element
|
||||
|
||||
end_scene = Scene.new
|
||||
end_scene << rect
|
||||
@@ -56,9 +58,15 @@ App.update do |delta_time|
|
||||
c_ += delta_time
|
||||
c_c += 1
|
||||
|
||||
# commented out to avoid spamming the console, but you can uncomment to see the delta time being printed every frame
|
||||
# puts "Delta time: #{delta_time}s"
|
||||
|
||||
|
||||
red_pixel = [0xFF, 0, 0, 255] # ARGB
|
||||
green_pixel = [0xFF, 0, 255, 0] # ARGB
|
||||
c_p = c_c % 2 == 0 ? red_pixel : green_pixel
|
||||
raw_bytes = (c_p * (50 * 50)).pack('C*')
|
||||
script_element.update(0, 0, 50, 50, raw_bytes)
|
||||
|
||||
el = App.scene.elements_at(App.mouse_position)
|
||||
|
||||
pp App.text_input if App.text_input != ""
|
||||
@@ -82,7 +90,7 @@ end
|
||||
main_scene << text
|
||||
main_scene << rect
|
||||
main_scene << image_element
|
||||
|
||||
main_scene << script_element
|
||||
App.start main_scene
|
||||
|
||||
time = Time.now - start
|
||||
|
||||
Reference in New Issue
Block a user