1
0
Fork 0
forked from AbleOS/ableos

use able image

This commit is contained in:
koniifer 2024-10-13 23:41:17 +01:00
parent 96c2bd5cd5
commit 3af28f1666
2 changed files with 6 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View file

@ -1,27 +1,27 @@
.{Vec2} := @use("../../../../libraries/stn/src/lib.hb").math; .{Vec2} := @use("../../../../libraries/stn/src/lib.hb").math
render := @use("../../../../libraries/render/src/lib.hb") render := @use("../../../../libraries/render/src/lib.hb")
/* expected result: /* expected result:
a cute image bounces around the screen */ a cute image bounces around the screen */
mini_bmp := @embed("./mini.bmp") bmp := @embed("./able.bmp")
example := fn(): void { example := fn(): void {
render.init() render.init()
mini := render.image.from_bmp(@bitcast(&mini_bmp)) image := render.image.from_bmp(@bitcast(&bmp))
vel := Vec2(int).(1, 1) vel := Vec2(int).(1, 1)
pos := Vec2(int).(100, 100) pos := Vec2(int).(100, 100)
width := render.width() width := render.width()
height := render.height() height := render.height()
loop { loop {
render.put_image(mini, pos) render.put_image(image, pos)
render.sync() render.sync()
render.clear(render.black) render.clear(render.black)
if pos.x == 0 | pos.x == width - mini.width { if pos.x == 0 | pos.x == width - image.width {
vel.x = -vel.x vel.x = -vel.x
} }
if pos.y == 0 | pos.y == height - mini.height { if pos.y == 0 | pos.y == height - image.height {
vel.y = -vel.y vel.y = -vel.y
} }