Make localization parameters better, and add a single frame animation helper

This commit is contained in:
2026-05-21 19:01:44 +01:00
parent e1d18743b5
commit 582b2fcd9e
5 changed files with 122 additions and 50 deletions
+5 -4
View File
@@ -1,4 +1,4 @@
App.run 720, 480, "Button Test", fps: 60
App.run 720, 480, "Button Test", fps: 240
main_scene = Scene.new
@@ -9,6 +9,8 @@ bg_image2 = Image.new "assets/images/game_over_dead_bg.png", pixel_art: true
bg_animation = Animation.new [bg_image1, bg_image2], fps: 5
bg_image1_a = Animation.from(bg_image1)
App.language = :en
App.localize(:en, :btn_text, "Click %{name}!")
@@ -38,10 +40,10 @@ rect.click do
0x00FF00 :
0xFF0000
pp text.params[:name]
text.params[:name] = text.params[:name] == "Me" ?
"You" :
"Me"
text.params!
end
App.map_key :mouse_left, :action_name
@@ -54,9 +56,8 @@ App.update do |delta_time|
c_ += delta_time
c_c += 1
# puts "Delta time: #{delta_time}s"
# commented out to avoid spamming the console, but you can uncomment to see the delta time being printed every frame
# runs at 60fps, so you should see around 16-17ms being printed
# puts "Delta time: #{delta_time}s"
el = App.scene.elements_at(App.mouse_position)