...
This commit is contained in:
parent
9ab3b9bb4d
commit
4fdb569bca
4 changed files with 12 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/omnipunk/gg"
|
"github.com/di4f/gg"
|
||||||
"github.com/hajimehoshi/ebiten/v2/examples/resources/images"
|
"github.com/hajimehoshi/ebiten/v2/examples/resources/images"
|
||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -239,7 +239,7 @@ func (p *Player) Event(e *gg.Engine, ev any) {
|
||||||
switch ec := ev.(type) {
|
switch ec := ev.(type) {
|
||||||
case *gg.KeyDown:
|
case *gg.KeyDown:
|
||||||
switch {
|
switch {
|
||||||
case ec.Key == gg.KeyB :
|
case ec.Key == gg.KeyB:
|
||||||
if p.Layer != PlayerL {
|
if p.Layer != PlayerL {
|
||||||
p.Layer = PlayerL
|
p.Layer = PlayerL
|
||||||
} else {
|
} else {
|
||||||
|
@ -258,6 +258,10 @@ func (d *Debug) Draw(
|
||||||
keyStrs = append(keyStrs, k.String())
|
keyStrs = append(keyStrs, k.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rectMove.ContainsPoint(e.AbsCursorPosition()) {
|
||||||
|
keyStrs = append(keyStrs, "contains cursor")
|
||||||
|
}
|
||||||
|
|
||||||
if rectMove.Vertices().Contained(rect).Len() > 0 ||
|
if rectMove.Vertices().Contained(rect).Len() > 0 ||
|
||||||
rect.Vertices().Contained(rectMove).Len() > 0 {
|
rect.Vertices().Contained(rectMove).Len() > 0 {
|
||||||
keyStrs = append(keyStrs, "THIS IS SHIT")
|
keyStrs = append(keyStrs, "THIS IS SHIT")
|
||||||
|
|
|
@ -4,7 +4,7 @@ package gg
|
||||||
// the engine to work faster about
|
// the engine to work faster about
|
||||||
// collisions because it first checks
|
// collisions because it first checks
|
||||||
// if the the bigger collider that
|
// if the the bigger collider that
|
||||||
// contain more complicated structure
|
// contains more complicated (accurate) structure
|
||||||
// do collide.
|
// do collide.
|
||||||
type ColliderSimplifier interface {
|
type ColliderSimplifier interface {
|
||||||
ColliderSimplify() Triangle
|
ColliderSimplify() Triangle
|
||||||
|
@ -16,6 +16,10 @@ type Collision struct {
|
||||||
Current, With any
|
Current, With any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PointContainer interface {
|
||||||
|
ContainsPoint(Point) bool
|
||||||
|
}
|
||||||
|
|
||||||
// Implementing the interface lets the engine
|
// Implementing the interface lets the engine
|
||||||
// to determine if the object collides with anything.
|
// to determine if the object collides with anything.
|
||||||
// Mostly will use the Collide function with some
|
// Mostly will use the Collide function with some
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module github.com/omnipunk/gg
|
module github.com/di4f/gg
|
||||||
|
|
||||||
go 1.21
|
go 1.21
|
||||||
|
|
||||||
|
|
1
line.go
1
line.go
|
@ -142,7 +142,6 @@ func (what LineSegments) Cross(with LineSegments) ([][2]int, Points) {
|
||||||
for j := range with {
|
for j := range with {
|
||||||
p, cross := LinersCross(what[i], with[j])
|
p, cross := LinersCross(what[i], with[j])
|
||||||
if cross {
|
if cross {
|
||||||
fmt.Println("in")
|
|
||||||
points = append(points, p)
|
points = append(points, p)
|
||||||
indexes = append(indexes, [2]int{i, j})
|
indexes = append(indexes, [2]int{i, j})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue