web_entry_template.odin 479 B

12345678910111213141516171819202122
  1. // This file is a just a wrapper that takes care of context setup and provides an entry for the
  2. // javascript Odin runtime to call into. `main` will run on start and then `step` will run for each
  3. // frame.
  4. package karl2d_web_entry
  5. import ex "../.."
  6. import "base:runtime"
  7. import "core:log"
  8. ctx: runtime.Context
  9. main :: proc() {
  10. context.logger = log.create_console_logger()
  11. ctx = context
  12. ex.init()
  13. }
  14. @export
  15. step :: proc(dt: f64) -> bool {
  16. context = ctx
  17. return ex.step()
  18. }