//it imports a texture to the ball and defines it initial coordinates
it imports a texture to the ball and defines it initial coordinates
// it imports a texture to the ball and defines it initial coordinates
func newBall(renderer *sdl.Renderer, x, y int32) (bal ball, err error) {
	img.Init(img.INIT_JPG | img.INIT_PNG)
	sdl.SetHint(sdl.HINT_RENDER_SCALE_QUALITY, "1")
	BallImg, err := img.Load("Ball.png")
	if err != nil {
		fmt.Println(err)
		return ball{}, fmt.Errorf("%v", err)
	}
	defer BallImg.Free()
	bal.Tex, err = renderer.CreateTextureFromSurface(BallImg)
	if err != nil {
		fmt.Println(err)
		return ball{}, fmt.Errorf("%v", err)
	}
	bal.X = float64(x)
	bal.Y = float64(y)
	bal.Radius = radius
	bal.Xv = BallSpeedX
	bal.Yv = BallSpeedY
	return bal, nil
}
func newBall ( renderer * sdl . Renderer , x , y int32 ) ( bal ball , err error ) { img . Init ( img . INIT_JPG | img . INIT_PNG ) sdl . SetHint ( sdl . HINT_RENDER_SCALE_QUALITY , " " ) BallImg , err := img . Load ( " " ) if err != nil { fmt . Println ( err ) return ball { } , fmt . Errorf ( " " , err ) } defer BallImg . Free ( ) bal . Tex , err = renderer . CreateTextureFromSurface ( BallImg ) if err != nil { fmt . Println ( err ) return ball { } , fmt . Errorf ( " " , err ) } bal . X = float64 ( x ) bal . Y = float64 ( y ) bal . Radius = radius bal . Xv = BallSpeedX bal . Yv = BallSpeedY return bal , nil }
it imports a texture to the ball and defines it initial coordinates
it imports a texture to the ball and defines it initial coordinates