Repos / shark / 553b352027
commit 553b3520270413e16a4f887a73d0a92468170b92
Author: Bùi Thành Nhân <hi@imnhan.com>
Date: Sat Jul 2 13:38:32 2022 +0700
make size configurable via cli arg
diff --git a/README.md b/README.md
index 93c4287..1e4d662 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,16 @@ # Download
Sourcehut doesn't have macOS builds though.
+# Usage
+
+Simply run the provided binary for your OS. Mac & Linux users may need to first
+make the file executable with `chmod +x <file-name>`.
+
+If run from a terminal, use the `-h` argument to see available options.
+Currently there's only a `-size` argument which changes how big your shark will
+be rendered. Windows users can create a shortcut which lets you specify your
+desired arguments.
+
# Compile from source
- Follow [ebitengine's install guide][6]
diff --git a/main.go b/main.go
index 12192f0..cc66e0a 100644
--- a/main.go
+++ b/main.go
@@ -3,6 +3,7 @@
import (
"bytes"
"embed"
+ "flag"
_ "image/png"
"log"
@@ -160,18 +161,24 @@ func init() {
}
func main() {
+ var sizeFlag int
+ flag.IntVar(
+ &sizeFlag, "size", 2, "Size multiplier: make Gura as big as you want.",
+ )
+ flag.Parse()
+
var game Game
game.CurrentAnim = Idle
- ebiten.SetWindowSize(SPRITE_X*2, SPRITE_Y*2)
+ ebiten.SetWindowSize(SPRITE_X*sizeFlag, SPRITE_Y*sizeFlag)
ebiten.SetWindowTitle("Shark!")
ebiten.SetWindowDecorated(false)
ebiten.SetScreenTransparent(true)
ebiten.SetWindowPosition(9999, 9999)
ebiten.SetWindowFloating(true)
- if err := ebiten.RunGame(&game); err != nil {
- log.Fatal(err)
- }
+
+ err := ebiten.RunGame(&game)
+ PanicIfErr(err)
}
func PanicIfErr(err error) {