forked from AbleOS/ableos
koniifer
6a8d92d2c2
refactor image loader for multiple filetypes port some broken math stuff make logger more readable
29 lines
921 B
Plaintext
29 lines
921 B
Plaintext
.{log} := @use("../../../../libraries/stn/src/lib.hb")
|
|
render := @use("../../../../libraries/render/src/lib.hb")
|
|
|
|
/* expected result:
|
|
a cute qoi image and a cute bmp image */
|
|
|
|
qoi := @embed("./assets/mini.qoi")
|
|
bmp := @embed("./assets/mini.bmp")
|
|
|
|
example := fn(): void {
|
|
screen := render.init(true)
|
|
image_qoi := render.image.from(@bitcast(&qoi))
|
|
image_bmp := render.image.from(@bitcast(&bmp))
|
|
|
|
if image_qoi == null {
|
|
log.error("failed to load qoi image for whatever reason\0")
|
|
return
|
|
}
|
|
if image_bmp == null {
|
|
log.error("failed to load bmp image for whatever reason\0")
|
|
return
|
|
}
|
|
|
|
render.clear(screen, render.black)
|
|
render.put_surface(screen, image_bmp, .((screen.width - image_bmp.width * 3) / 2, (screen.height - image_bmp.height) / 2), false)
|
|
render.put_surface(screen, image_qoi, .((screen.width + image_qoi.width) / 2, (screen.height - image_qoi.height) / 2), false)
|
|
render.sync(screen)
|
|
return
|
|
} |