diff --git a/README.md b/README.md new file mode 100644 index 0000000..331b740 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# showimage +very basic image viewer that doesn't blur images when zoomed in diff --git a/showimage.desktop b/showimage.desktop new file mode 100644 index 0000000..387748d --- /dev/null +++ b/showimage.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=showimage +Exec=/bin/env showimage %u +Categories=Other; +MimeType=image/svg+xml +Terminal=false diff --git a/showimage.odin b/showimage.odin index 5fc4cdd..b3c5463 100644 --- a/showimage.odin +++ b/showimage.odin @@ -14,8 +14,12 @@ main :: proc() { rl.SetTargetFPS(60) if len(os.args) > 1 { - path := strings.clone_to_cstring(os.args[1]) - tex = new_clone(rl.LoadTexture(path)) + path := os.args[1] + if strings.has_prefix(path, "file://") { + path, _ = strings.substring_from(path, 7) + } + tex = new_clone(rl.LoadTexture(strings.clone_to_cstring(path))) + if tex.id <= 0 { return } reset_zoom() } @@ -44,7 +48,7 @@ main :: proc() { } zoom_to_power :: proc(size: i32, max: i32) -> i32 { - fit: i32 = 1 + fit: i32 = 2 for fit * size < max { fit *= 2 }