boot.lua 548 B

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