diff --git a/.goreleaser.yaml b/.goreleaser.yaml deleted file mode 100644 index f33df43..0000000 --- a/.goreleaser.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# vim: set ts=2 sw=2 tw=0 fo=cnqoj - -version: 2 - -before: - hooks: - - go mod tidy - -gitea_urls: - api: https://codeberg.org/api/v1 - download: https://codeberg.org - -builds: - - env: - - CGO_ENABLED=0 - goos: - - linux - - freebsd - -archives: - - formats: [tar.gz] - # this name template makes the OS and Arch compatible with the results of `uname`. - name_template: >- - {{ .ProjectName }}_ - {{- title .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 - {{- else if eq .Arch "386" }}i386 - {{- else }}{{ .Arch }}{{ end }} - {{- if .Arm }}v{{ .Arm }}{{ end }}_{{ .Tag }} - # use zip for windows archives - format_overrides: - - goos: windows - formats: [zip] - - goos: linux - formats: [tar.gz,binary] - files: - - src: "*.md" - strip_parent: true - - src: Makefile.dist - dst: Makefile - wrap_in_directory: true - -changelog: - sort: asc - filters: - exclude: - - "^docs:" - - "^test:" - groups: - - title: Improved - regexp: '^.*?(feat|add|new)(\([[:word:]]+\))??!?:.+$' - order: 0 - - title: Fixed - regexp: '^.*?(bug|fix)(\([[:word:]]+\))??!?:.+$' - order: 1 - - title: Changed - order: 999 - -release: - header: "# Release Notes" - footer: >- - - --- - - Full Changelog: [{{ .PreviousTag }}...{{ .Tag }}](https://codeberg.org/scip/kageviewer/compare/{{ .PreviousTag }}...{{ .Tag }}) diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml deleted file mode 100644 index b09e907..0000000 --- a/.woodpecker/build.yaml +++ /dev/null @@ -1,31 +0,0 @@ -matrix: - platform: - - linux/amd64 - goversion: - - 1.24 - -labels: - platform: ${platform} - -steps: - build: - when: - event: [push] - image: golang:${goversion} - commands: - - apt-get update - - apt-get install -y libasound2-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev - - go get - - go build - - linter: - when: - event: [push] - image: golang:${goversion} - commands: - - apt-get update - - apt-get install -y libasound2-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev - - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0 - - golangci-lint --version - - golangci-lint run ./... - depends_on: [build] diff --git a/.woodpecker/release.yaml b/.woodpecker/release.yaml deleted file mode 100644 index 916c008..0000000 --- a/.woodpecker/release.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# build release - -labels: - platform: linux/amd64 - -steps: - goreleaser: - image: goreleaser/goreleaser - when: - event: [tag] - environment: - GITEA_TOKEN: - from_secret: DEPLOY_TOKEN - commands: - - goreleaser release --clean --verbose diff --git a/Makefile b/Makefile deleted file mode 100644 index 2ba5ac1..0000000 --- a/Makefile +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright © 2024 Thomas von Dein - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -# -# no need to modify anything below -tool = kageviewer -VERSION = $(shell grep VERSION config.go | head -1 | cut -d '"' -f2) -archs = darwin freebsd linux windows -PREFIX = /usr/local -UID = root -GID = 0 -HAVE_POD := $(shell pod2text -h 2>/dev/null) - -all: buildlocal - -# doesn't build -#CGO_LDFLAGS='-static' go build -tags osusergo,netgo -ldflags "-extldflags=-static" -o $(tool) -buildlocal: - go build - -install: buildlocal - install -d -o $(UID) -g $(GID) $(PREFIX)/bin - install -d -o $(UID) -g $(GID) $(PREFIX)/man/man1 - install -o $(UID) -g $(GID) -m 555 $(tool) $(PREFIX)/sbin/ - install -o $(UID) -g $(GID) -m 444 $(tool).1 $(PREFIX)/man/man1/ - -clean: - rm -rf $(tool) coverage.out testdata t/out - -shader-destruct: buildlocal - ./$(tool) -g 32x32 -i example/wall.png -i example/damage.png --map-ticks Time -s example/destruct.kage - -shader-ebiten: buildlocal - ./$(tool) -g 640x480 --map-mouse Cursor -s example/ebiten.kage - -test: clean - mkdir -p t/out - go test ./... $(ARGS) - -testlint: test lint - -lint: - golangci-lint run - -lint-full: - golangci-lint run --enable-all --exclude-use-default --disable exhaustivestruct,exhaustruct,depguard,interfacer,deadcode,golint,structcheck,scopelint,varcheck,ifshort,maligned,nosnakecase,godot,funlen,gofumpt,cyclop,noctx,gochecknoglobals,paralleltest - -testfuzzy: clean - go test -fuzz ./... $(ARGS) - -singletest: - @echo "Call like this: make singletest TEST=TestPrepareColumns ARGS=-v" - go test -run $(TEST) $(ARGS) - -cover-report: - go test ./... -cover -coverprofile=coverage.out - go tool cover -html=coverage.out - -goupdate: - go get -t -u=patch ./... - -release: - gh release create v$(VERSION) --generate-notes - -show-versions: buildlocal - @echo "### kageviewer version:" - @./kageviewer -V - - @echo - @echo "### go module versions:" - @go list -m all - - @echo - @echo "### go version used for building:" - @grep -m 1 go go.mod - -# lint: -# golangci-lint run -p bugs -p unused diff --git a/Makefile.dist b/Makefile.dist deleted file mode 100644 index 55d2f38..0000000 --- a/Makefile.dist +++ /dev/null @@ -1,18 +0,0 @@ -# -*-make-*- - -.PHONY: install all - -tool = rpn -PREFIX = /usr/local -UID = root -GID = 0 - -all: - @echo "Type 'sudo make install' to install the tool." - @echo "To change prefix, type 'sudo make install PREFIX=/opt'" - -install: - install -d -o $(UID) -g $(GID) $(PREFIX)/bin - install -d -o $(UID) -g $(GID) $(PREFIX)/share/doc - install -o $(UID) -g $(GID) -m 555 $(tool) $(PREFIX)/sbin/ - install -o $(UID) -g $(GID) -m 444 *.md $(PREFIX)/share/doc/ diff --git a/README.md b/README.md index be9ba7d..bba40ec 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,9 @@ [![Go Report Card](https://goreportcard.com/badge/codeberg.org/scip/kageviewer)](https://goreportcard.com/report/codeberg.org/scip/kageviewer) [![status-badge](https://ci.codeberg.org/api/badges/15617/status.svg)](https://ci.codeberg.org/repos/15617) +> [!CAUTION] +> This software is now being maintained on [Codeberg](https://codeberg.org/scip/kageviewer/). + This little tool can be used to test shaders written in [Kage](https://ebitengine.org/en/documents/shader.html), a shader meta language for diff --git a/config.go b/config.go deleted file mode 100644 index 427c98f..0000000 --- a/config.go +++ /dev/null @@ -1,197 +0,0 @@ -/* -Copyright © 2024 Thomas von Dein - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -package main - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "strconv" - "strings" - - "github.com/knadh/koanf/parsers/toml" - "github.com/knadh/koanf/providers/file" - "github.com/knadh/koanf/providers/posflag" - "github.com/knadh/koanf/v2" - flag "github.com/spf13/pflag" -) - -const ( - VERSION string = "0.0.6" - Usage string = `This is kageviewer, a shader viewer. - -Usage: kageviewer [-vd] [-c ] [-g geom] [-p geom] \ - -i -i -s - -Options: --c --config Config file to use (optional) --i --image Image to load (multiple times allowed, up to 4) --s --shader Shader to run --g --geometry Window size --p --position Position of image0 --b --background Image to load as background --t --tps At how many ticks per second to run - --map-flag Map Flag uniform to - --map-ticks Map Ticks uniform to - --map-time Map Time uniform to - --map-slider Map Slider uniform to - --map-mouse Map Mouse uniform to --d --debug Show debugging output --v --version Show program version` -) - -type Config struct { - Showversion bool `koanf:"version"` // -v - Debug bool `koanf:"debug"` // -d - Config string `koanf:"config"` // -c - Image []string `koanf:"image"` // -i - Shader string `koanf:"shader"` // -s - Background string `koanf:"background"` // -b - TPS int `koanf:"tps"` // -t - Geo string `koanf:"geometry"` // -g - Posision string `koanf:"position"` // -p - Flag string `koanf:"map-flag"` - Ticks string `koanf:"map-ticks"` - Mouse string `koanf:"map-mouse"` - Slider string `koanf:"map-slider"` - Time string `koanf:"map-time"` - - X, Y, Width, Height int // feed from -g + -p -} - -func InitConfig() (*Config, error) { - var kloader = koanf.New(".") - - // setup custom usage - flagset := flag.NewFlagSet("config", flag.ContinueOnError) - flagset.Usage = func() { - _, _ = fmt.Println(Usage) - os.Exit(0) - } - - // parse commandline flags - flagset.BoolP("version", "v", false, "show program version") - flagset.BoolP("debug", "d", false, "enable debug output") - flagset.StringP("config", "c", "", "config file") - flagset.StringP("geometry", "g", "256x256", "window geometry") - flagset.StringP("position", "p", "0x0", "position of shader") - flagset.StringArrayP("image", "i", nil, "image file") - flagset.StringP("shader", "s", "", "shader file") - flagset.StringP("map-flag", "", "Flag", "map flag uniform") - flagset.StringP("map-ticks", "", "Ticks", "map ticks uniform") - flagset.StringP("map-time", "", "Time", "map time uniform") - flagset.StringP("map-mouse", "", "Mouse", "map mouse uniform") - flagset.StringP("map-slider", "", "Slider", "map slider uniform") - flagset.StringP("background", "b", "", "background image") - flagset.IntP("tps", "t", 60, "ticks per second") - - if err := flagset.Parse(os.Args[1:]); err != nil { - return nil, fmt.Errorf("failed to parse program arguments: %w", err) - } - - // generate a list of config files to try to load, including the - // one provided via -c, if any - var configfiles []string - - configfile, _ := flagset.GetString("config") - home, _ := os.UserHomeDir() - - if configfile != "" { - configfiles = []string{configfile} - } else { - configfiles = []string{ - "/etc/kageviewer.conf", "/usr/local/etc/kageviewer.conf", // unix variants - filepath.Join(home, ".config", "kageviewer", "config"), - filepath.Join(home, ".kageviewer"), - "kageviewer.conf", - } - } - - // Load the config file[s] - for _, cfgfile := range configfiles { - if path, err := os.Stat(cfgfile); !os.IsNotExist(err) { - if !path.IsDir() { - if err := kloader.Load(file.Provider(cfgfile), toml.Parser()); err != nil { - return nil, fmt.Errorf("error loading config file: %w", err) - } - } - } // else: we ignore the file if it doesn't exists - } - - // command line setup - if err := kloader.Load(posflag.Provider(flagset, ".", kloader), nil); err != nil { - return nil, fmt.Errorf("error loading flags: %w", err) - } - - // fetch values - conf := &Config{} - if err := kloader.Unmarshal("", &conf); err != nil { - return nil, fmt.Errorf("error unmarshalling: %w", err) - } - - if err := SanitiyCheck(conf); err != nil { - return nil, err - } - - return conf, nil -} - -func SanitiyCheck(conf *Config) error { - if len(conf.Image) > 4 { - return fmt.Errorf("only 4 images can be specified") - } - - if conf.Shader == "" { - return fmt.Errorf("shader file must be specified") - } - - geoerr := "window geometry must be specified as NUMBERxNUMBER, e.g. 32x32" - - geo := strings.Split(conf.Geo, "x") - if len(geo) != 2 { - return errors.New(geoerr) - } - - w, errw := strconv.Atoi(geo[0]) - h, errh := strconv.Atoi(geo[1]) - if errw != nil || errh != nil { - return errors.New(geoerr) - } - - conf.Width = w - conf.Height = h - - poserr := "shader position must be specified as NUMBERxNUMBER, e.g. 32x32" - - pos := strings.Split(conf.Posision, "x") - if len(geo) != 2 { - return errors.New(poserr) - } - - x, errx := strconv.Atoi(pos[0]) - y, erry := strconv.Atoi(pos[1]) - if errx != nil || erry != nil { - return errors.New(poserr) - } - - conf.X = x - conf.Y = y - - return nil -} diff --git a/example/damage.png b/example/damage.png deleted file mode 100644 index ad7e4c8..0000000 Binary files a/example/damage.png and /dev/null differ diff --git a/example/destruct.kage b/example/destruct.kage deleted file mode 100644 index c2cd3b4..0000000 --- a/example/destruct.kage +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2020 The Ebiten Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build ignore - -//kage:unit pixels - -package main - -var Flag int -var Slider float -var Time float -var Mouse vec2 - -func Fragment(_ vec4, texCoord vec2, _ vec4) vec4 { - wallpx := imageSrc0At(texCoord) // A pixel from the wall tile - mask := imageSrc1At(texCoord) // A pixel from the damage mask image - - if Flag == 1 && (wallpx.a != 0.0 && mask.a != 0.0) { - alpha := clamp(Slider+(1.0-mask.a), 0.0, 1.0) - // Create a darker pixel if it's inside a damage mask. - return vec4(wallpx.r*alpha, wallpx.g*alpha, wallpx.b*alpha, wallpx.a) - } - - return wallpx // Otherwise, leave a pixel color as is -} diff --git a/example/ebiten.kage b/example/ebiten.kage deleted file mode 100644 index 1c7f701..0000000 --- a/example/ebiten.kage +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2020 The Ebiten Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build ignore - -//kage:unit pixels - -package main - -var Time float -var Cursor vec2 - -func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 { - pos := (dstPos.xy - imageDstOrigin()) / imageDstSize() - pos += Cursor / imageDstSize() / 4 - clr := 0.0 - clr += sin(pos.x*cos(Time/15)*80) + cos(pos.y*cos(Time/15)*10) - clr += sin(pos.y*sin(Time/10)*40) + cos(pos.x*sin(Time/25)*40) - clr += sin(pos.x*sin(Time/5)*10) + sin(pos.y*sin(Time/35)*80) - clr *= sin(Time/10) * 0.5 - return vec4(clr, clr*0.5, sin(clr+Time/3)*0.75, 1) -} diff --git a/example/wall.png b/example/wall.png deleted file mode 100644 index 7154616..0000000 Binary files a/example/wall.png and /dev/null differ diff --git a/game.go b/game.go deleted file mode 100644 index bd48608..0000000 --- a/game.go +++ /dev/null @@ -1,227 +0,0 @@ -/* -Copyright © 2024 Thomas von Dein - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -package main - -import ( - "fmt" - "image" - _ "image/png" - "log/slog" - "os" - - "github.com/Zyko0/Ebiary/asset" - "github.com/hajimehoshi/ebiten/v2" - "github.com/hajimehoshi/ebiten/v2/inpututil" -) - -type Game struct { - Conf *Config - Images []*asset.LiveAsset[*ebiten.Image] - Shader *asset.LiveAsset[*ebiten.Shader] - ShaderBounds image.Rectangle - Cursor []float64 - Ticks float64 - Slider float64 - Flag int - Background *asset.LiveAsset[*ebiten.Image] -} - -func LoadImage(name string) (*ebiten.Image, error) { - fd, err := os.Open(name) - if err != nil { - return nil, err - } - defer func() { - _ = fd.Close() - }() - - img, _, err := image.Decode(fd) - if err != nil { - return nil, fmt.Errorf("failed to load image %s: %s", name, err) - } - - return ebiten.NewImageFromImage(img), nil -} - -func (game *Game) Init() error { - // preload images - for _, image := range game.Conf.Image { - slog.Debug("Loading images", "image", image) - //img, err := LoadImage(image) - img, err := asset.NewLiveAsset[*ebiten.Image](image) - if err != nil { - return fmt.Errorf("failed to load image %s: %s", image, err) - } - - game.Images = append(game.Images, img) - } - - // preload shader - shader, err := asset.NewLiveAsset[*ebiten.Shader](game.Conf.Shader) - if err != nil { - return fmt.Errorf("failed to load shader %s: %s", game.Conf.Shader, err) - } - - if game.Conf.Background != "" { - slog.Debug("Loading background", "image", game.Conf.Background) - - img, err := asset.NewLiveAsset[*ebiten.Image](game.Conf.Background) - if err != nil { - return fmt.Errorf("failed to load image %s: %s", game.Conf.Background, err) - } - - game.Background = img - } - - game.Shader = shader - - // user can customize TPS - ebiten.SetTPS(game.Conf.TPS) - - // setup shader bounds, by default we use window size - game.ShaderBounds = image.Rect(0, 0, game.Conf.Width, game.Conf.Height) - - if len(game.Images) > 0 { - if game.Conf.Width < game.Images[0].Value().Bounds().Max.X { - // setup geom. Shader might be smaller than window, we use the - // first image - if any - to determine its size. We also enlarge - // the window if the first image is larger than the window. - game.Conf.Width = game.Images[0].Value().Bounds().Max.X - game.Conf.Height = game.Images[0].Value().Bounds().Max.Y - } - - // adjust shader size by first image as well - game.ShaderBounds = game.Images[0].Value().Bounds() - } else { - // there might be no shader image but a background image, check it - if game.Background != nil { - game.Conf.Width = game.Background.Value().Bounds().Max.X - game.Conf.Height = game.Background.Value().Bounds().Max.Y - } - } - - return nil -} - -func (g *Game) CheckInput() bool { - pressed := false - - switch { - case inpututil.IsMouseButtonJustPressed(ebiten.MouseButton0): - fallthrough - case inpututil.IsKeyJustPressed(ebiten.KeySpace): - g.Toggle() - pressed = true - case inpututil.IsKeyJustPressed(ebiten.KeyUp): - g.Up() - pressed = true - case inpututil.IsKeyJustPressed(ebiten.KeyDown): - g.Down() - pressed = true - case inpututil.IsKeyJustPressed(ebiten.KeyQ): - os.Exit(0) - } - - return pressed -} - -func (g *Game) Toggle() { - g.Flag = 1 - g.Flag -} - -func (g *Game) Up() { - g.Slider += 0.1 - if g.Slider > 1.0 { - g.Slider = 1.0 - } -} - -func (g *Game) Down() { - g.Slider -= 0.1 - - if g.Slider < 0 { - g.Slider = 0.0 - } -} - -func (game *Game) Update() error { - for _, image := range game.Images { - if image.Error() != nil { - fmt.Println("warn: image reloading error:", image.Error()) - } - } - - if game.Shader.Error() != nil { - fmt.Println("warn: shader reloading error:", game.Shader.Error()) - } - - if game.Background != nil { - if game.Background.Error() != nil { - fmt.Println("warn: background image reloading error:", game.Background.Error()) - } - } - - if game.CheckInput() { - slog.Debug("Key pressed", - game.Conf.Flag, game.Flag, - game.Conf.Slider, game.Slider, - game.Conf.Ticks, fmt.Sprintf("%.02f", float64(game.Ticks)/60), - game.Conf.Mouse, fmt.Sprintf("%.02f, %.02f", game.Cursor[0], game.Cursor[1]), - ) - } - - mousex, mousey := ebiten.CursorPosition() - game.Cursor = []float64{float64(mousex), float64(mousey)} - - game.Ticks++ - - return nil -} - -func (game *Game) Draw(screen *ebiten.Image) { - if game.Background != nil { - op := &ebiten.DrawImageOptions{} - screen.DrawImage(game.Background.Value(), op) - } - - op := &ebiten.DrawRectShaderOptions{} - - op.Uniforms = map[string]any{ - game.Conf.Flag: game.Flag, - game.Conf.Slider: game.Slider, - game.Conf.Time: game.Ticks / float64(ebiten.TPS()), - game.Conf.Mouse: game.Cursor, - game.Conf.Ticks: game.Ticks, - } - - for idx, image := range game.Images { - op.Images[idx] = image.Value() - } - - op.GeoM.Translate(float64(game.Conf.X), float64(game.Conf.Y)) - - screen.DrawRectShader( - game.ShaderBounds.Dx(), - game.ShaderBounds.Dy(), - game.Shader.Value(), - op) -} - -func (game *Game) Layout(outsideWidth, outsideHeight int) (int, int) { - return game.Conf.Width, game.Conf.Height -} diff --git a/go.mod b/go.mod deleted file mode 100644 index 755e160..0000000 --- a/go.mod +++ /dev/null @@ -1,32 +0,0 @@ -module codeberg.org/scip/kageviewer - -go 1.22 - -require ( - github.com/Zyko0/Ebiary/asset v0.0.0-20240304185439-be56fe8a2a6a // indirect - github.com/ebitengine/purego v0.6.0 // indirect - github.com/fatih/color v1.16.0 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect - github.com/hajimehoshi/ebiten/v2 v2.6.7 // indirect - github.com/jezek/xgb v1.1.0 // indirect - github.com/knadh/koanf/maps v0.1.1 // indirect - github.com/knadh/koanf/parsers/toml v0.1.0 // indirect - github.com/knadh/koanf/providers/confmap v0.1.0 // indirect - github.com/knadh/koanf/providers/file v0.1.0 // indirect - github.com/knadh/koanf/providers/posflag v0.1.0 // indirect - github.com/knadh/koanf/v2 v2.1.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/reflectwalk v1.0.2 // indirect - github.com/pelletier/go-toml v1.9.5 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/tlinden/yadu v0.1.3 // indirect - golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 // indirect - golang.org/x/image v0.12.0 // indirect - golang.org/x/mobile v0.0.0-20230922142353-e2f452493d57 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.14.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/go.sum b/go.sum deleted file mode 100644 index cc99059..0000000 --- a/go.sum +++ /dev/null @@ -1,92 +0,0 @@ -github.com/Zyko0/Ebiary/asset v0.0.0-20240304185439-be56fe8a2a6a h1:kn4fhGvVA6T1lK7qWujIj3m7e9imCZe4MHBuBeflKgU= -github.com/Zyko0/Ebiary/asset v0.0.0-20240304185439-be56fe8a2a6a/go.mod h1:4CqqwHRUbvGBpBd5ye4MxDA4k/XtZqrAD1sg9uxmcYI= -github.com/ebitengine/purego v0.6.0 h1:Yo9uBc1x+ETQbfEaf6wcBsjrQfCEnh/gaGUg7lguEJY= -github.com/ebitengine/purego v0.6.0/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 h1:TQcrn6Wq+sKGkpyPvppOz99zsMBaUOKXq6HSv655U1c= -github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/hajimehoshi/ebiten/v2 v2.6.7 h1:rxlMxu487wZN/JteykmuGdO1qotOolL8vJDU85lPh7A= -github.com/hajimehoshi/ebiten/v2 v2.6.7/go.mod h1:gKgQI26zfoSb6j5QbrEz2L6nuHMbAYwrsXa5qsGrQKo= -github.com/jezek/xgb v1.1.0 h1:wnpxJzP1+rkbGclEkmwpVFQWpuE2PUGNUzP8SbfFobk= -github.com/jezek/xgb v1.1.0/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk= -github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= -github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= -github.com/knadh/koanf/parsers/toml v0.1.0 h1:S2hLqS4TgWZYj4/7mI5m1CQQcWurxUz6ODgOub/6LCI= -github.com/knadh/koanf/parsers/toml v0.1.0/go.mod h1:yUprhq6eo3GbyVXFFMdbfZSo928ksS+uo0FFqNMnO18= -github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU= -github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= -github.com/knadh/koanf/providers/file v0.1.0 h1:fs6U7nrV58d3CFAFh8VTde8TM262ObYf3ODrc//Lp+c= -github.com/knadh/koanf/providers/file v0.1.0/go.mod h1:rjJ/nHQl64iYCtAW2QQnF0eSmDEX/YZ/eNFj5yR6BvA= -github.com/knadh/koanf/providers/posflag v0.1.0 h1:mKJlLrKPcAP7Ootf4pBZWJ6J+4wHYujwipe7Ie3qW6U= -github.com/knadh/koanf/providers/posflag v0.1.0/go.mod h1:SYg03v/t8ISBNrMBRMlojH8OsKowbkXV7giIbBVgbz0= -github.com/knadh/koanf/v2 v2.1.0 h1:eh4QmHHBuU8BybfIJ8mB8K8gsGCD/AUQTdwGq/GzId8= -github.com/knadh/koanf/v2 v2.1.0/go.mod h1:4mnTRbZCK+ALuBXHZMjDfG9y714L7TykVnZkXbMU3Es= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= -github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= -github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/tlinden/yadu v0.1.3 h1:5cRCUmj+l5yvlM2irtpFBIJwVV2DPEgYSaWvF19FtcY= -github.com/tlinden/yadu v0.1.3/go.mod h1:l3bRmHKL9zGAR6pnBHY2HRPxBecf7L74BoBgOOpTcUA= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 h1:3AGKexOYqL+ztdWdkB1bDwXgPBuTS/S8A4WzuTvJ8Cg= -golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63/go.mod h1:UH99kUObWAZkDnWqppdQe5ZhPYESUw8I0zVV1uWBR+0= -golang.org/x/image v0.12.0 h1:w13vZbU4o5rKOFFR8y7M+c4A5jXDC0uXTdHYRP8X2DQ= -golang.org/x/image v0.12.0/go.mod h1:Lu90jvHG7GfemOIcldsh9A2hS01ocl6oNO7ype5mEnk= -golang.org/x/mobile v0.0.0-20230922142353-e2f452493d57 h1:Q6NT8ckDYNcwmi/bmxe+XbiDMXqMRW1xFBtJ+bIpie4= -golang.org/x/mobile v0.0.0-20230922142353-e2f452493d57/go.mod h1:wEyOn6VvNW7tcf+bW/wBz1sehi2s2BZ4TimyR7qZen4= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go deleted file mode 100644 index a86b4cb..0000000 --- a/main.go +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright © 2024 Thomas von Dein - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -package main - -import ( - "fmt" - "log" - "os" - - "log/slog" - - "github.com/hajimehoshi/ebiten/v2" - "github.com/tlinden/yadu" -) - -func main() { - // parse config file and command line parameters, if any - conf, err := InitConfig() - if err != nil { - log.Fatal(err) - } - - if conf.Showversion { - fmt.Printf("This is kageviewer version %s\n", VERSION) - return - } - - // enable debugging, if needed. We only use log/slog for - // debugging, so there's no need to configure it outside debugging - if conf.Debug { - logLevel := &slog.LevelVar{} - // we're using a more verbose logger in debug mode - opts := &yadu.Options{ - Level: logLevel, - AddSource: true, - } - - logLevel.Set(slog.LevelDebug) - - handler := yadu.NewHandler(os.Stdout, opts) - debuglogger := slog.New(handler) - slog.SetDefault(debuglogger) - } - - game := &Game{Conf: conf} - if err := game.Init(); err != nil { - log.Fatal(err) - } - - ebiten.SetWindowSize(game.Conf.Width, game.Conf.Height) - ebiten.SetWindowTitle("Kage shader viewer") - ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled) - - if err := ebiten.RunGame(game); err != nil { - log.Fatal(err) - } - -}