//LoadPicture load a picture and return a pixels byte of the picture

LoadPicture load a picture and return a pixels byte of the picture
// LoadPicture load a picture and return a pixels byte of the picture
func LoadPicture() []Texture{
	balloonsPath := []string{"balloon_blue.png","balloon_red.png","balloon_green.png"}
	ballonTexture := make([]Texture, len(balloonsPath))
	for i, path := range balloonsPath {
		file, err := os.Open("balloons/"+path)
		if err != nil {
			panic(err)
		}
		defer file.Close()
		img, err := png.Decode(file)
		if err != nil {
			panic(err)
		}
		width := img.Bounds().Max.X
		heigth := img.Bounds().Max.Y
		pixels := make([]byte,width*heigth*4)
		pIndex := 0
		for y := 0; y < heigth; y++{
			for x := 0; x < width; x++ {
				r,g,b,a := img.At(x,y).RGBA()
				pixels[pIndex] = byte(r / 256)
				pIndex++
				pixels[pIndex] = byte(g / 256)
				pIndex++
				pixels[pIndex] = byte(b / 256)
				pIndex++
				pixels[pIndex] = byte(a / 256)
				pIndex++
			}
		}
		ballonTexture[i] = Texture{pixels,width,heigth, width*4, Pos{0,0}}
	}
	return ballonTexture
}
func LoadPicture ( ) [ ] Texture { balloonsPath := [ ] string { " " , " " , " " } ballonTexture := make ( [ ] Texture , len ( balloonsPath ) ) for i , path := range balloonsPath { file , err := os . Open ( " " + path ) if err != nil { panic ( err ) } defer file . Close ( ) img , err := png . Decode ( file ) if err != nil { panic ( err ) } width := img . Bounds ( ) . Max . X heigth := img . Bounds ( ) . Max . Y pixels := make ( [ ] byte , width * heigth * 4 ) pIndex := 0 for y := 0 ; y < heigth ; y ++ { for x := 0 ; x < width ; x ++ { r , g , b , a := img . At ( x , y ) . RGBA ( ) pixels [ pIndex ] = byte ( r / 256 ) pIndex ++ pixels [ pIndex ] = byte ( g / 256 ) pIndex ++ pixels [ pIndex ] = byte ( b / 256 ) pIndex ++ pixels [ pIndex ] = byte ( a / 256 ) pIndex ++ } } ballonTexture [ i ] = Texture { pixels , width , heigth , width * 4 , Pos { 0 , 0 } } } return ballonTexture }
LoadPicture load a picture and return a pixels byte of the picture
LoadPicture load a picture and return a pixels byte of the picture