//imports image and attaches it with the player , coordinates are passed into this function for initialization
imports image and attaches it with the player , coordinates are passed into this function for initialization
// imports image and attaches it with the player coordinates are passed into this function for initialization
func newplayer(renderer *sdl.Renderer, x, y, teamid int32) (p Player, err error) {
	img.Init(img.INIT_JPG | img.INIT_PNG)
	sdl.SetHint(sdl.HINT_RENDER_SCALE_QUALITY, "1")
	playerImg, err := img.Load("Player_Red.png")
	if teamid == 2 {
		playerImg, err = img.Load("Player_Blue.png")
	}
	if err != nil {
		fmt.Println(err)
		return Player{}, fmt.Errorf("%v", err)
	}
	defer playerImg.Free()
	p.Tex, err = renderer.CreateTextureFromSurface(playerImg)
	if err != nil {
		fmt.Println(err)
		return Player{}, fmt.Errorf("%v", err)
	}
	p.X = float64(x + playerWidth/2)
	p.Y = float64(y + playerHeight/2)
	p.Radius = 13
	return p, nil
}
func newplayer ( renderer * sdl . Renderer , x , y , teamid int32 ) ( p Player , err error ) { img . Init ( img . INIT_JPG | img . INIT_PNG ) sdl . SetHint ( sdl . HINT_RENDER_SCALE_QUALITY , " " ) playerImg , err := img . Load ( " " ) if teamid == 2 { playerImg , err = img . Load ( " " ) } if err != nil { fmt . Println ( err ) return Player { } , fmt . Errorf ( " " , err ) } defer playerImg . Free ( ) p . Tex , err = renderer . CreateTextureFromSurface ( playerImg ) if err != nil { fmt . Println ( err ) return Player { } , fmt . Errorf ( " " , err ) } p . X = float64 ( x + playerWidth / 2 ) p . Y = float64 ( y + playerHeight / 2 ) p . Radius = 13 return p , nil }
imports image and attaches it with the player , coordinates are passed into this function for initialization
imports image and attaches it with the player coordinates are passed into this function for initialization