.{Vec2} := @use("../../../../libraries/stn/src/lib.hb").math render := @use("../../../../libraries/render/src/lib.hb") /* expected result: a cute image bounces around the screen */ bmp_1 := @embed("./able.bmp") bmp_2 := @embed("./mini.bmp") example := fn(): void { screen := render.init(true) images := [render.Surface; 2].( render.image.surface_from_bmp(@bitcast(&bmp_1)), render.image.surface_from_bmp(@bitcast(&bmp_2)), ) vel := Vec2(int).(1, 1) pos := Vec2(int).(100, 100) n := -1 loop { image := images[n] render.put_surface(screen, image, pos) render.sync(screen) render.clear(screen, render.black) if pos.x == 0 | pos.x == screen.width - image.width { vel.x = -vel.x n = -1 - n } if pos.y == 0 | pos.y == screen.height - image.height { vel.y = -vel.y n = -1 - n } pos += vel } return }