Update to git.wisellama.rocks, fix some linter issues

main
Sean Hickey 2023-02-25 23:35:40 -08:00
parent 343a43bed3
commit 387384eaca
21 changed files with 56 additions and 45 deletions

4
go.mod
View File

@ -1,9 +1,9 @@
module gitea.wisellama.rocks/Wisellama/carpy-breakout
module git.wisellama.rocks/Wisellama/carpy-breakout
go 1.17
require (
gitea.wisellama.rocks/Wisellama/gosimpleconf v0.0.3
git.wisellama.rocks/Wisellama/gosimpleconf v0.1.0
github.com/go-gl/gl v0.0.0-20211025173605-bda47ffaa784
github.com/go-gl/mathgl v1.0.0
github.com/veandco/go-sdl2 v0.4.10

4
go.sum
View File

@ -1,5 +1,5 @@
gitea.wisellama.rocks/Wisellama/gosimpleconf v0.0.3 h1:g4hcc7TjodjMNrSEQ3UO96HXvltHc2EOiudS+Wfle60=
gitea.wisellama.rocks/Wisellama/gosimpleconf v0.0.3/go.mod h1:kY9gQL8laVTe+tW0ue5bYb6QThw78d7mx6AHwQ5CIzc=
git.wisellama.rocks/Wisellama/gosimpleconf v0.1.0 h1:Z2FAzARct8ShV4NSueC/y+PyuSQVcyo4WnW7GoZ9L10=
git.wisellama.rocks/Wisellama/gosimpleconf v0.1.0/go.mod h1:Gg1vUTBRZD7qcXvdF8L50PsnL9coLt/XbWa5BwSDN/M=
github.com/go-gl/gl v0.0.0-20211025173605-bda47ffaa784 h1:1Zi56D0LNfvkzM+BdoxKryvUEdyWO7LP8oRT+oSYJW0=
github.com/go-gl/gl v0.0.0-20211025173605-bda47ffaa784/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw=
github.com/go-gl/mathgl v1.0.0 h1:t9DznWJlXxxjeeKLIdovCOVJQk/GzDEL7h/h+Ro2B68=

View File

@ -5,9 +5,9 @@ import (
"os"
"runtime/pprof"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/game"
"gitea.wisellama.rocks/Wisellama/gosimpleconf"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/game"
"git.wisellama.rocks/Wisellama/gosimpleconf"
)
func main() {
@ -26,7 +26,8 @@ func main() {
// Setup cpu profiling if configured
cpuProfile := gosimpleconf.Bool(configMap["cpuprofile.enabled"])
if cpuProfile {
f, err := os.Create(configMap["cpuprofile.file"])
var f *os.File
f, err = os.Create(configMap["cpuprofile.file"])
if err != nil {
log.Fatalf("error creating file for cpuprofile: %v", err)
}

View File

@ -3,7 +3,7 @@ package breakout
import (
"log"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"github.com/go-gl/mathgl/mgl32"
)

View File

@ -1,7 +1,7 @@
package breakout
import (
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"github.com/go-gl/mathgl/mgl32"
)

View File

@ -1,6 +1,6 @@
package breakout
import "gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
import "git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
type Paddle struct {
Box *globject.Box

View File

@ -1,7 +1,7 @@
package breakout
import (
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"github.com/go-gl/mathgl/mgl32"
)

View File

@ -1,16 +1,16 @@
package breakout
import (
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"github.com/go-gl/mathgl/mgl32"
)
type Targets struct {
Rows int
Columns int
Bricks []*Brick
TopRight mgl32.Vec3
BottomLeft mgl32.Vec3
Rows int
Columns int
}
func NewTargets(numRows, numColumns int, adjustPos mgl32.Vec3) *Targets {

View File

@ -1,7 +1,7 @@
package config
import (
"gitea.wisellama.rocks/Wisellama/gosimpleconf"
"git.wisellama.rocks/Wisellama/gosimpleconf"
)
func Configure() (gosimpleconf.ConfigMap, error) {

View File

@ -4,7 +4,7 @@ import (
"log"
"os"
"gitea.wisellama.rocks/Wisellama/gosimpleconf"
"git.wisellama.rocks/Wisellama/gosimpleconf"
)
func SetupLogging(configMap gosimpleconf.ConfigMap) error {

View File

@ -4,10 +4,10 @@ import (
"fmt"
"log"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/breakout"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/breakout"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
gl "github.com/go-gl/gl/v3.1/gles2"
"github.com/go-gl/mathgl/mgl32"
"github.com/veandco/go-sdl2/sdl"

View File

@ -4,10 +4,10 @@ import (
"log"
"runtime"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/breakout"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"gitea.wisellama.rocks/Wisellama/gosimpleconf"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/breakout"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
"git.wisellama.rocks/Wisellama/gosimpleconf"
gl "github.com/go-gl/gl/v3.1/gles2"
"github.com/go-gl/mathgl/mgl32"
"github.com/veandco/go-sdl2/sdl"

View File

@ -1,7 +1,7 @@
package globject
import (
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/math"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/math"
"github.com/go-gl/mathgl/mgl32"
)

View File

@ -1,29 +1,29 @@
package globject
import (
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
gl "github.com/go-gl/gl/v3.1/gles2"
"github.com/go-gl/mathgl/mgl32"
)
type Box struct {
Size int32
Width float32
Height float32
Depth float32
baseAABB *AABB
Material *Material
Faces []*Face
VertexArray []float32
Translation mgl32.Vec3
Velocity mgl32.Vec3
Rotation mgl32.Vec3
RotationVelocity mgl32.Vec3
VertexArray []float32
Material *Material
Size int32
Width float32
Height float32
Depth float32
GLProgram uint32
GLVertexArrayID uint32
GLVertexBufferID uint32
Wireframe bool
baseAABB *AABB
}
func NewBox(

View File

@ -1,7 +1,7 @@
package globject
import (
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"github.com/go-gl/mathgl/mgl32"
)

View File

@ -1,7 +1,7 @@
package globject
import (
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"github.com/go-gl/mathgl/mgl32"
)

View File

@ -3,18 +3,18 @@ package globject
import (
"log"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/math"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/math"
gl "github.com/go-gl/gl/v3.1/gles2"
"github.com/go-gl/mathgl/mgl32"
)
type Face struct {
Material *Material
Triangles []*Triangle
LineLoopVertexArray []float32
GLLineLoopVertexArrayID uint32
GLLineLoopVertexBufferID uint32
Material *Material
}
func NewFace(
@ -101,10 +101,15 @@ func newFaceVertex(
func (f *Face) GetVertexArray() []float32 {
a := make([]float32, 2*3*VertexSize)
i := 0
for _, triangle := range f.Triangles {
for _, vertex := range triangle.Vertices {
a = append(a, vertex.GetVertexArray()...)
va := vertex.GetVertexArray()
for _, v := range va {
a[i] = v
i++
}
}
}

View File

@ -1,7 +1,7 @@
package globject
import (
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"github.com/go-gl/mathgl/mgl32"
)

View File

@ -1,7 +1,7 @@
package globject
import (
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
"github.com/go-gl/mathgl/mgl32"
)

View File

@ -14,9 +14,14 @@ func NewTriangle(a, b, c *Vertex) *Triangle {
func (t *Triangle) GetVertexArray() []float32 {
a := make([]float32, 3*VertexSize)
i := 0
for _, vertex := range t.Vertices {
a = append(a, vertex.GetVertexArray()...)
va := vertex.GetVertexArray()
for _, v := range va {
a[i] = v
i++
}
}
return a

View File

@ -86,7 +86,7 @@ func compileShader(source string, shaderType uint32) (uint32, error) {
func NewTexture(file string) (uint32, error) {
imgFile, err := os.Open(file)
if err != nil {
return 0, fmt.Errorf("texture %q file not found found: %v", file, err)
return 0, fmt.Errorf("texture %q file not found found: %w", file, err)
}
img, _, err := image.Decode(imgFile)