diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/draw/animation.odin | 6 | ||||
| -rw-r--r-- | src/draw/draw.odin | 16 | ||||
| -rw-r--r-- | src/draw/sprite.odin | 7 |
3 files changed, 8 insertions, 21 deletions
diff --git a/src/draw/animation.odin b/src/draw/animation.odin index ac947fb..e6b50d1 100644 --- a/src/draw/animation.odin +++ b/src/draw/animation.odin @@ -1,7 +1,7 @@ package draw +import "core:log" import "core:encoding/json" -import "core:fmt" import "core:os" import "core:path/filepath" import "core:strings" @@ -46,7 +46,7 @@ init_anim_data :: proc(anim: ^Animation, path: string) -> bool { json_err := json.unmarshal(data, anim) if json_err != nil { - fmt.println("could not unmarshal data") + log.error("could not unmarshal data") return false } @@ -61,6 +61,8 @@ init_anim_data :: proc(anim: ^Animation, path: string) -> bool { anim.image_path = strings.concatenate({anim_dir, "/", partial_img_path}) + log.debugf("loaded animation '%v'", path) + return true } diff --git a/src/draw/draw.odin b/src/draw/draw.odin index 2e7eaaf..1bc24d1 100644 --- a/src/draw/draw.odin +++ b/src/draw/draw.odin @@ -25,12 +25,10 @@ SCREEN_HEIGHT :: 256 Renderer :: struct { screen: struct { framebuffer: Framebuffer, - vertex_buffer: sg.Buffer, }, display: struct { pass_action: sg.Pass_Action, pipe: sg.Pipeline, - binds: sg.Bindings, }, view: sg.View, @@ -77,22 +75,9 @@ init :: proc(r: ^Renderer) { Color{0.2, 0.2, 0.2, 1.0}, ) - r.screen.vertex_buffer = sg.make_buffer({ - size = size_of(Vertex) * 6, - usage = { - vertex_buffer = true, - immutable = false, - stream_update = true, - }, - }) - r.view = sg.alloc_view() r.sampler = sg.make_sampler({}) - r.display.binds.vertex_buffers[0] = r.screen.vertex_buffer - r.display.binds.views[VIEW_tex] = r.screen.framebuffer.view - r.display.binds.samplers[SMP_tex_samp] = r.sampler - r.tint = {1, 1, 1, 1} } @@ -105,7 +90,6 @@ deinit :: proc(r: ^Renderer) { sg.destroy_view(r.view) sg.destroy_sampler(r.sampler) - sg.destroy_buffer(r.screen.vertex_buffer) destroy_framebuffer(&r.screen.framebuffer) } diff --git a/src/draw/sprite.odin b/src/draw/sprite.odin index e62f650..e2f2639 100644 --- a/src/draw/sprite.odin +++ b/src/draw/sprite.odin @@ -1,6 +1,6 @@ package draw -import "core:fmt" +import "core:log" import "core:image" import "core:image/qoi" @@ -19,10 +19,9 @@ init_sprite :: proc( path: string, anim: Animation = {}, ) -> bool { - fmt.println(path) img, img_err := qoi.load_from_file(path) if img_err != nil { - fmt.println("could not load image") + log.error("could not load image") return false } defer image.destroy(img) @@ -38,6 +37,8 @@ init_sprite :: proc( }) sprite.anim = anim + log.debugf("loaded sprite '%v'", path) + return true } |
