2021-08-03 14:56:53 +10:00
|
|
|
package engine
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/gob"
|
2021-09-08 20:08:57 +10:00
|
|
|
|
|
|
|
"drjosh.dev/gurgle/geom"
|
2021-08-03 14:56:53 +10:00
|
|
|
)
|
|
|
|
|
2021-08-18 16:34:51 +10:00
|
|
|
var _ Collider = SolidRect{}
|
|
|
|
|
2021-08-03 14:56:53 +10:00
|
|
|
func init() {
|
2021-08-25 15:04:38 +10:00
|
|
|
gob.Register(&SolidRect{})
|
2021-08-03 14:56:53 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
type SolidRect struct {
|
2021-08-03 16:48:21 +10:00
|
|
|
ID
|
2021-09-08 20:08:57 +10:00
|
|
|
geom.Box
|
2021-08-03 14:56:53 +10:00
|
|
|
}
|
|
|
|
|
2021-09-08 20:08:57 +10:00
|
|
|
func (s SolidRect) CollidesWith(r geom.Box) bool {
|
2021-09-02 20:17:45 +10:00
|
|
|
return s.Box.Overlaps(r)
|
2021-09-01 09:17:08 +10:00
|
|
|
}
|