boot.lua 581 B

1234567891011121314151617181920212223242526272829
  1. world = world or nil
  2. camera = camera or nil
  3. function init()
  4. -- Create world and camera
  5. world = Device.create_world()
  6. local camera_unit = World.spawn_unit(world, "camera")
  7. camera = World.camera_instances(world, camera_unit)
  8. end
  9. function update(dt)
  10. -- Advance the simulation
  11. World.update(world, dt)
  12. -- Stop the engine when the 'ESC' key is released
  13. if Keyboard.released(Keyboard.button_id("escape")) then
  14. Device.quit()
  15. end
  16. end
  17. function render(dt)
  18. -- Render the world
  19. Device.render(world, camera)
  20. end
  21. function shutdown()
  22. -- Cleanup
  23. Device.destroy_world(world)
  24. end