Commit af69650b authored by Baptiste HEYRENDT's avatar Baptiste HEYRENDT
Browse files

Basic CLI

parent f0b81094
src/project-particles
\ No newline at end of file
project-particles
project-particles.exe
\ No newline at end of file
{
"WindowTitle": "Default",
"WindowSizeX": 800,
"WindowSizeY": 600,
"ParticleImage": "assets/particle.png",
"Debug": true,
"InitNumParticles": 10,
"RandomSpawn": true,
"SpawnX": 400,
"SpawnY": 400,
"SpawnRate": 0,
"SpeedLimit": [0,20,0,0],
"Colors": [1,1,1,1,1,1]
}
......@@ -6,7 +6,7 @@ require (
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be // indirect
github.com/hajimehoshi/ebiten/v2 v2.2.2
github.com/jezek/xgb v0.0.0-20210312150743-0e0f116e1240 // indirect
github.com/urfave/cli v1.22.5 // indirect
github.com/urfave/cli v1.22.5
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 // indirect
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
golang.org/x/mobile v0.0.0-20210902104108-5d9a33257ab5 // indirect
......
package main
import (
"github.com/hajimehoshi/ebiten/v2"
"log"
"project-particles/assets"
"project-particles/config"
"project-particles/particles"
"fmt"
"github.com/hajimehoshi/ebiten/v2"
"os"
"github.com/urfave/cli"
)
......@@ -24,21 +25,35 @@ var app = cli.NewApp()
func info() {
app.Name = "Particules"
app.Usage = "A CLI app to generate particle"
app.Author = "Léo Tranchet, Mathys Meunier, Lana Heyrendt"
app.Author = "Léo Tranchet, Mathys Meunier, Lana Heyrendt"
app.Version = "0.0.1"
}
func SelectConf() (string) {
return "yes"
func commands() {
app.Commands = []cli.Command{
{
Name: "Default",
Aliases: []string{"d"},
Usage: "Use the default config file",
Action: func(c *cli.Context) {
ExecPart("config.json")
},
},
{
Name: "Wesh",
Aliases: []string{"w"},
Usage: "Use the default config file",
Action: func(c *cli.Context) {
ExecPart("./Extension/Wesh.json")
},
},
}
}
func main() {
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
func ExecPart(cfg string) {
config.Get("config.json")
config.Get(cfg)
assets.Get()
ebiten.SetWindowTitle(config.General.WindowTitle)
......@@ -51,3 +66,12 @@ func main() {
log.Print(err)
}
}
func main() {
info()
commands()
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment