From 3d1d31538d30a7f161f9f2b6d5e075ec69d3b860 Mon Sep 17 00:00:00 2001 From: iamcheeseman <[hidden email]> Date: Tue, 3 Feb 2026 22:25:00 -0500 Subject: ditch raylib (icky, and for loser BEGINNERS) --- src/resources.odin | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'src/resources.odin') 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) - } - - img_res.texture = rl.LoadTextureFromImage(rl_img) - rl.UnloadImage(rl_img) + if img_res.texture.handle == 0 { + img, qoi_err := qoi.load_from_bytes(img_res.data) + defer image.destroy(img) + + img_res.texture = fw.create_texture_from_image(img) + log.debug(img_res.texture.size) } return img_res.texture -- cgit v1.3-2-g0d8e