41 lines
729 B
Go
41 lines
729 B
Go
|
|
package objects
|
||
|
|
|
||
|
|
import (
|
||
|
|
"image/color"
|
||
|
|
p "loading/point"
|
||
|
|
"math/rand"
|
||
|
|
"strconv"
|
||
|
|
)
|
||
|
|
|
||
|
|
const (
|
||
|
|
defaultRadius = 20
|
||
|
|
)
|
||
|
|
|
||
|
|
type Bobble struct {
|
||
|
|
Radius float32
|
||
|
|
Pose p.Point
|
||
|
|
Id string
|
||
|
|
Color color.RGBA
|
||
|
|
Bordercolor color.RGBA
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewBobble() Bobble {
|
||
|
|
//default bobble values, with white center and black border
|
||
|
|
return Bobble{
|
||
|
|
Radius: defaultRadius,
|
||
|
|
Pose: p.Point{X: 0, Y: 0},
|
||
|
|
Color: color.RGBA{0xFF, 0xFF, 0xFF, 0xFF},
|
||
|
|
Bordercolor: color.RGBA{0x00, 0x00, 0x00, 0xFF},
|
||
|
|
Id: "ID-" + strconv.Itoa(rand.Intn(100)),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func GetDefaultRadius() float32 {
|
||
|
|
return float32(defaultRadius)
|
||
|
|
}
|
||
|
|
|
||
|
|
func (b *Bobble) SetPose(x float32, y float32) {
|
||
|
|
b.Pose.X = x
|
||
|
|
b.Pose.Y = y
|
||
|
|
}
|