diff --git a/crystal/src/main.cr b/crystal/src/main.cr index 4b6f00e..409e381 100644 --- a/crystal/src/main.cr +++ b/crystal/src/main.cr @@ -3,7 +3,6 @@ require "sdl/image" begin SDL.init(SDL::Init::VIDEO) - at_exit { SDL.quit } window = SDL::Window.new("Hello, World!", 620, 387) @@ -14,17 +13,16 @@ begin png = SDL::IMG.load(File.join("..", "img", "grumpy-cat.png")) png = png.convert(window.surface) - start_time = Time.utc + start_time = Time.monotonic loop do png.blit(window.surface) window.update - if (Time.utc - start_time).seconds > 2 + if (Time.monotonic - start_time).total_seconds > 2 break end end rescue ex - puts "Error: " + ex.message.to_s - exit 1 + abort "Error: #{ex.message}" end