diff options
| author | iamcheeseman <[hidden email]> | 2026-02-03 22:25:00 -0500 |
|---|---|---|
| committer | iamcheeseman <[hidden email]> | 2026-02-03 22:25:00 -0500 |
| commit | 3d1d31538d30a7f161f9f2b6d5e075ec69d3b860 (patch) | |
| tree | 8b0deceb38c288dbef361bb4f77bb681b5566525 /src/resources.odin | |
| parent | 1c605da3ff8dc4295d2f9a85f5b7c8891ca84464 (diff) | |
ditch raylib (icky, and for loser BEGINNERS)
Diffstat (limited to 'src/resources.odin')
| -rw-r--r-- | src/resources.odin | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/resources.odin b/src/resources.odin index 1bd567e..22fed57 100644 --- a/src/resources.odin +++ b/src/resources.odin @@ -1,8 +1,10 @@ package demonchime +import "core:image" +import "core:image/qoi" import "core:log" -import rl "vendor:raylib" +import "fw" Tiled_Property :: union { string, @@ -12,7 +14,7 @@ Tiled_Property :: union { } Image_Resource :: struct { - texture: rl.Texture2D, + texture: fw.Texture, anim: Animation_Id, data: []u8, } @@ -73,21 +75,15 @@ Room_Position_Resource :: struct { height: i32, } -get_image :: proc(id: Image_Id) -> rl.Texture2D { +get_image :: proc(id: Image_Id) -> fw.Texture { img_res := &images[id] - if !rl.IsTextureValid(img_res.texture) { - rl_img := rl.LoadImageFromMemory( - ".qoi", - raw_data(img_res.data), - i32(len(img_res.data)), - ) - if !rl.IsImageValid(rl_img) { - log.warnf("Could not load asset %v", id) - } + if img_res.texture.handle == 0 { + img, qoi_err := qoi.load_from_bytes(img_res.data) + defer image.destroy(img) - img_res.texture = rl.LoadTextureFromImage(rl_img) - rl.UnloadImage(rl_img) + img_res.texture = fw.create_texture_from_image(img) + log.debug(img_res.texture.size) } return img_res.texture |
