From 4fdb569bcaae6161b4cfefb02dbe6d539c17b18c Mon Sep 17 00:00:00 2001 From: surdeus Date: Thu, 14 Dec 2023 22:01:07 +0300 Subject: [PATCH] ... --- cmd/test/main.go | 8 ++++++-- collider.go | 6 +++++- go.mod | 2 +- line.go | 1 - 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmd/test/main.go b/cmd/test/main.go index 807edd3..c1323a0 100644 --- a/cmd/test/main.go +++ b/cmd/test/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/omnipunk/gg" + "github.com/di4f/gg" "github.com/hajimehoshi/ebiten/v2/examples/resources/images" "github.com/hajimehoshi/ebiten/v2" "bytes" @@ -239,7 +239,7 @@ func (p *Player) Event(e *gg.Engine, ev any) { switch ec := ev.(type) { case *gg.KeyDown: switch { - case ec.Key == gg.KeyB : + case ec.Key == gg.KeyB: if p.Layer != PlayerL { p.Layer = PlayerL } else { @@ -258,6 +258,10 @@ func (d *Debug) Draw( keyStrs = append(keyStrs, k.String()) } + if rectMove.ContainsPoint(e.AbsCursorPosition()) { + keyStrs = append(keyStrs, "contains cursor") + } + if rectMove.Vertices().Contained(rect).Len() > 0 || rect.Vertices().Contained(rectMove).Len() > 0 { keyStrs = append(keyStrs, "THIS IS SHIT") diff --git a/collider.go b/collider.go index 2e3704c..d2f33b2 100644 --- a/collider.go +++ b/collider.go @@ -4,7 +4,7 @@ package gg // the engine to work faster about // collisions because it first checks // if the the bigger collider that -// contain more complicated structure +// contains more complicated (accurate) structure // do collide. type ColliderSimplifier interface { ColliderSimplify() Triangle @@ -16,6 +16,10 @@ type Collision struct { Current, With any } +type PointContainer interface { + ContainsPoint(Point) bool +} + // Implementing the interface lets the engine // to determine if the object collides with anything. // Mostly will use the Collide function with some diff --git a/go.mod b/go.mod index d4cec7f..ad78b1f 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/omnipunk/gg +module github.com/di4f/gg go 1.21 diff --git a/line.go b/line.go index 3b058ed..35b793a 100644 --- a/line.go +++ b/line.go @@ -142,7 +142,6 @@ func (what LineSegments) Cross(with LineSegments) ([][2]int, Points) { for j := range with { p, cross := LinersCross(what[i], with[j]) if cross { - fmt.Println("in") points = append(points, p) indexes = append(indexes, [2]int{i, j}) }