add .desktop file, fix opening images from file explorer
This commit is contained in:
parent
3042fcb8cd
commit
7a1de9d871
3 changed files with 16 additions and 3 deletions
2
README.md
Normal file
2
README.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
# showimage
|
||||
very basic image viewer that doesn't blur images when zoomed in
|
7
showimage.desktop
Normal file
7
showimage.desktop
Normal file
|
@ -0,0 +1,7 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=showimage
|
||||
Exec=/bin/env showimage %u
|
||||
Categories=Other;
|
||||
MimeType=image/svg+xml
|
||||
Terminal=false
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue