Skip to content

Commit

Permalink
make size configurable via cli arg
Browse files Browse the repository at this point in the history
  • Loading branch information
nhanb committed Jul 2, 2022
1 parent 032caac commit 553b352
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ GitHub and sourcehut:

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]
Expand Down
15 changes: 11 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"bytes"
"embed"
"flag"
_ "image/png"
"log"

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 553b352

Please sign in to comment.