Esempio n. 1
0
func drawacceleration(entity *physics.Entity, drawable *gdk.Drawable, gc *gdk.GC) {
	startx := utils.RoundInt(entity.Position.X)
	starty := utils.RoundInt(entity.Position.Y)
	endx := utils.RoundInt(entity.Position.X + entity.Acceleration.X)
	endy := utils.RoundInt(entity.Position.Y + entity.Acceleration.Y)
	drawable.DrawLine(gc, centerx(startx), centery(starty), centerx(endx), centery(endy))
}
Esempio n. 2
0
func drawposition(entity *physics.Entity, drawable *gdk.Drawable, gc *gdk.GC) {
	radius := math.Sqrt(entity.Mass)
	startx := utils.RoundInt(centerfloatx(entity.Position.X) - (radius / 2))
	starty := utils.RoundInt(centerfloaty(entity.Position.Y) - (radius / 2))

	// Draw at least 1 pixel for position
	if radius < 1 {
		radius = 1
	}

	drawable.DrawArc(gc, true, startx, starty, int(utils.Round(radius)), int(radius), 0, 360*64)
}