Update to git.wisellama.rocks, fix some linter issues
parent
343a43bed3
commit
387384eaca
4
go.mod
4
go.mod
|
@ -1,9 +1,9 @@
|
||||||
module gitea.wisellama.rocks/Wisellama/carpy-breakout
|
module git.wisellama.rocks/Wisellama/carpy-breakout
|
||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
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/gl v0.0.0-20211025173605-bda47ffaa784
|
||||||
github.com/go-gl/mathgl v1.0.0
|
github.com/go-gl/mathgl v1.0.0
|
||||||
github.com/veandco/go-sdl2 v0.4.10
|
github.com/veandco/go-sdl2 v0.4.10
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1,5 +1,5 @@
|
||||||
gitea.wisellama.rocks/Wisellama/gosimpleconf v0.0.3 h1:g4hcc7TjodjMNrSEQ3UO96HXvltHc2EOiudS+Wfle60=
|
git.wisellama.rocks/Wisellama/gosimpleconf v0.1.0 h1:Z2FAzARct8ShV4NSueC/y+PyuSQVcyo4WnW7GoZ9L10=
|
||||||
gitea.wisellama.rocks/Wisellama/gosimpleconf v0.0.3/go.mod h1:kY9gQL8laVTe+tW0ue5bYb6QThw78d7mx6AHwQ5CIzc=
|
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 h1:1Zi56D0LNfvkzM+BdoxKryvUEdyWO7LP8oRT+oSYJW0=
|
||||||
github.com/go-gl/gl v0.0.0-20211025173605-bda47ffaa784/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw=
|
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=
|
github.com/go-gl/mathgl v1.0.0 h1:t9DznWJlXxxjeeKLIdovCOVJQk/GzDEL7h/h+Ro2B68=
|
||||||
|
|
9
main.go
9
main.go
|
@ -5,9 +5,9 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
|
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/game"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/game"
|
||||||
"gitea.wisellama.rocks/Wisellama/gosimpleconf"
|
"git.wisellama.rocks/Wisellama/gosimpleconf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -26,7 +26,8 @@ func main() {
|
||||||
// Setup cpu profiling if configured
|
// Setup cpu profiling if configured
|
||||||
cpuProfile := gosimpleconf.Bool(configMap["cpuprofile.enabled"])
|
cpuProfile := gosimpleconf.Bool(configMap["cpuprofile.enabled"])
|
||||||
if cpuProfile {
|
if cpuProfile {
|
||||||
f, err := os.Create(configMap["cpuprofile.file"])
|
var f *os.File
|
||||||
|
f, err = os.Create(configMap["cpuprofile.file"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("error creating file for cpuprofile: %v", err)
|
log.Fatalf("error creating file for cpuprofile: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package breakout
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package breakout
|
package breakout
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package breakout
|
package breakout
|
||||||
|
|
||||||
import "gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
import "git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
||||||
|
|
||||||
type Paddle struct {
|
type Paddle struct {
|
||||||
Box *globject.Box
|
Box *globject.Box
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package breakout
|
package breakout
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package breakout
|
package breakout
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Targets struct {
|
type Targets struct {
|
||||||
Rows int
|
|
||||||
Columns int
|
|
||||||
Bricks []*Brick
|
Bricks []*Brick
|
||||||
TopRight mgl32.Vec3
|
TopRight mgl32.Vec3
|
||||||
BottomLeft mgl32.Vec3
|
BottomLeft mgl32.Vec3
|
||||||
|
Rows int
|
||||||
|
Columns int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTargets(numRows, numColumns int, adjustPos mgl32.Vec3) *Targets {
|
func NewTargets(numRows, numColumns int, adjustPos mgl32.Vec3) *Targets {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.wisellama.rocks/Wisellama/gosimpleconf"
|
"git.wisellama.rocks/Wisellama/gosimpleconf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Configure() (gosimpleconf.ConfigMap, error) {
|
func Configure() (gosimpleconf.ConfigMap, error) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"gitea.wisellama.rocks/Wisellama/gosimpleconf"
|
"git.wisellama.rocks/Wisellama/gosimpleconf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SetupLogging(configMap gosimpleconf.ConfigMap) error {
|
func SetupLogging(configMap gosimpleconf.ConfigMap) error {
|
||||||
|
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/breakout"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/breakout"
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
||||||
"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"
|
gl "github.com/go-gl/gl/v3.1/gles2"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
"github.com/veandco/go-sdl2/sdl"
|
"github.com/veandco/go-sdl2/sdl"
|
||||||
|
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/breakout"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/breakout"
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/config"
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/globject"
|
||||||
"gitea.wisellama.rocks/Wisellama/gosimpleconf"
|
"git.wisellama.rocks/Wisellama/gosimpleconf"
|
||||||
gl "github.com/go-gl/gl/v3.1/gles2"
|
gl "github.com/go-gl/gl/v3.1/gles2"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
"github.com/veandco/go-sdl2/sdl"
|
"github.com/veandco/go-sdl2/sdl"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package globject
|
package globject
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/math"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/math"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
package globject
|
package globject
|
||||||
|
|
||||||
import (
|
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"
|
gl "github.com/go-gl/gl/v3.1/gles2"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Box struct {
|
type Box struct {
|
||||||
Size int32
|
baseAABB *AABB
|
||||||
Width float32
|
|
||||||
Height float32
|
Material *Material
|
||||||
Depth float32
|
|
||||||
Faces []*Face
|
Faces []*Face
|
||||||
|
VertexArray []float32
|
||||||
Translation mgl32.Vec3
|
Translation mgl32.Vec3
|
||||||
Velocity mgl32.Vec3
|
Velocity mgl32.Vec3
|
||||||
Rotation mgl32.Vec3
|
Rotation mgl32.Vec3
|
||||||
RotationVelocity mgl32.Vec3
|
RotationVelocity mgl32.Vec3
|
||||||
VertexArray []float32
|
Size int32
|
||||||
Material *Material
|
Width float32
|
||||||
|
Height float32
|
||||||
|
Depth float32
|
||||||
GLProgram uint32
|
GLProgram uint32
|
||||||
GLVertexArrayID uint32
|
GLVertexArrayID uint32
|
||||||
GLVertexBufferID uint32
|
GLVertexBufferID uint32
|
||||||
Wireframe bool
|
Wireframe bool
|
||||||
|
|
||||||
baseAABB *AABB
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBox(
|
func NewBox(
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package globject
|
package globject
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package globject
|
package globject
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,18 +3,18 @@ package globject
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/math"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/math"
|
||||||
gl "github.com/go-gl/gl/v3.1/gles2"
|
gl "github.com/go-gl/gl/v3.1/gles2"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Face struct {
|
type Face struct {
|
||||||
|
Material *Material
|
||||||
Triangles []*Triangle
|
Triangles []*Triangle
|
||||||
LineLoopVertexArray []float32
|
LineLoopVertexArray []float32
|
||||||
GLLineLoopVertexArrayID uint32
|
GLLineLoopVertexArrayID uint32
|
||||||
GLLineLoopVertexBufferID uint32
|
GLLineLoopVertexBufferID uint32
|
||||||
Material *Material
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFace(
|
func NewFace(
|
||||||
|
@ -101,10 +101,15 @@ func newFaceVertex(
|
||||||
|
|
||||||
func (f *Face) GetVertexArray() []float32 {
|
func (f *Face) GetVertexArray() []float32 {
|
||||||
a := make([]float32, 2*3*VertexSize)
|
a := make([]float32, 2*3*VertexSize)
|
||||||
|
i := 0
|
||||||
|
|
||||||
for _, triangle := range f.Triangles {
|
for _, triangle := range f.Triangles {
|
||||||
for _, vertex := range triangle.Vertices {
|
for _, vertex := range triangle.Vertices {
|
||||||
a = append(a, vertex.GetVertexArray()...)
|
va := vertex.GetVertexArray()
|
||||||
|
for _, v := range va {
|
||||||
|
a[i] = v
|
||||||
|
i++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package globject
|
package globject
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package globject
|
package globject
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
|
"git.wisellama.rocks/Wisellama/carpy-breakout/pkg/glshader"
|
||||||
"github.com/go-gl/mathgl/mgl32"
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,14 @@ func NewTriangle(a, b, c *Vertex) *Triangle {
|
||||||
|
|
||||||
func (t *Triangle) GetVertexArray() []float32 {
|
func (t *Triangle) GetVertexArray() []float32 {
|
||||||
a := make([]float32, 3*VertexSize)
|
a := make([]float32, 3*VertexSize)
|
||||||
|
i := 0
|
||||||
|
|
||||||
for _, vertex := range t.Vertices {
|
for _, vertex := range t.Vertices {
|
||||||
a = append(a, vertex.GetVertexArray()...)
|
va := vertex.GetVertexArray()
|
||||||
|
for _, v := range va {
|
||||||
|
a[i] = v
|
||||||
|
i++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return a
|
return a
|
||||||
|
|
|
@ -86,7 +86,7 @@ func compileShader(source string, shaderType uint32) (uint32, error) {
|
||||||
func NewTexture(file string) (uint32, error) {
|
func NewTexture(file string) (uint32, error) {
|
||||||
imgFile, err := os.Open(file)
|
imgFile, err := os.Open(file)
|
||||||
if err != nil {
|
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)
|
img, _, err := image.Decode(imgFile)
|
||||||
|
|
Loading…
Reference in New Issue