twitchapon-anim

Basic Twitchapon Receiver/Visuals
git clone git://bsandro.tech/twitchapon-anim
Log | Files | Refs | README | LICENSE

commit d6f1a48a90db2b4638617ea3bdc52103705dca46
parent 5d3a8550f6aa5a7a97a9b3a351d7839bd299ae49
Author: bsandro <brian.drosan@gmail.com>
Date:   Wed, 18 Nov 2020 00:39:38 +0300

sprites number as a command line argument

Diffstat:
Mebitest.go | 14++++++++++++--
Minit.go | 4++--
2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/ebitest.go b/ebitest.go @@ -12,12 +12,18 @@ import ( "log" "math" "math/rand" + "os" + "strconv" "time" + //"net/http" + //_ "net/http/pprof" ) const S_FRAMERATE = 60 const S_SPEED = 200.0 +var NumSprites int = 1 + var ScreenSize struct { width, height int } @@ -138,9 +144,8 @@ func (g *Game) init() { fmt.Println("Game::init()") rand.Seed(time.Now().UnixNano()) - numSprites := 1 - for i := 0; i < numSprites; i++ { + for i := 0; i < NumSprites; i++ { x := float64(ScreenSize.width) / 2.0 y := float64(ScreenSize.height) / 2.0 angle := rand.Float64() * math.Pi * 2.0 @@ -152,10 +157,15 @@ func (g *Game) init() { func main() { fmt.Println("ebiten subgame") + if len(os.Args) > 1 { + NumSprites, _ = strconv.Atoi(os.Args[1]) + } + game := &Game{} ebiten.SetWindowSize(ScreenSize.width, ScreenSize.height) ebiten.SetWindowTitle("ebiten subgame") ebiten.SetMaxTPS(S_FRAMERATE) + //go func() { http.ListenAndServe("localhost:8080", nil) }() if err := ebiten.RunGame(game); err != nil { log.Fatal(err) } diff --git a/init.go b/init.go @@ -35,6 +35,6 @@ func init() { Images[name] = image } - ScreenSize.width = 800 - ScreenSize.height = 480 + ScreenSize.width = 1280 + ScreenSize.height = 800 }