@@ -64,12 +64,12 @@ func Gontage(sprite_source_folder string, hframes *int) {
64
64
decoded_images_to_draw_chunked := sliceChunk (all_decoded_images , * hframes )
65
65
66
66
var make_spritesheet_wg sync.WaitGroup
67
- for count_vertical_frames , sprite_chunk := range decoded_images_to_draw_chunked {
67
+ for vertical_frames_count , sprite_chunk := range decoded_images_to_draw_chunked {
68
68
make_spritesheet_wg .Add (1 )
69
- go func (count_vertical_frames int , sprite_chunk []image.Image ) {
69
+ go func (vertical_frames_count int , sprite_chunk []image.Image ) {
70
70
defer make_spritesheet_wg .Done ()
71
- drawSpritesheet (sprite_chunk , * hframes , int (vframes ), count_vertical_frames , spritesheet )
72
- }(count_vertical_frames , sprite_chunk )
71
+ drawSpritesheet (sprite_chunk , * hframes , int (vframes ), vertical_frames_count , spritesheet )
72
+ }(vertical_frames_count , sprite_chunk )
73
73
}
74
74
make_spritesheet_wg .Wait ()
75
75
spritesheet_name := fmt .Sprintf ("%v_f%v_v%v.png" , sprite_source_folder , len (all_decoded_images ), vframes )
@@ -101,12 +101,15 @@ func decodeImages(sprites_folder []fs.DirEntry, targetFolder string, pwd string,
101
101
return sprites_array
102
102
}
103
103
104
- func drawSpritesheet (sprites []image.Image , hframes int , vframes int , count_vertical_frames int , spritesheet draw.Image ) {
105
- for count_horizontal_frames , sprite_image := range sprites {
104
+ func drawSpritesheet (sprites []image.Image , hframes int , vframes int , vertical_frames_count int , spritesheet draw.Image ) {
105
+ for horizontal_frames_count , sprite_image := range sprites {
106
106
bounds := sprite_image .Bounds ()
107
107
width := bounds .Dx ()
108
108
height := bounds .Dy ()
109
- draw .Draw (spritesheet , image .Rect (count_horizontal_frames * height , count_vertical_frames * width , width * hframes , height * vframes ), sprite_image , image.Point {}, draw .Over )
109
+ r := image .Rect (
110
+ horizontal_frames_count * height , vertical_frames_count * width , width * hframes , height * vframes ,
111
+ )
112
+ draw .Draw (spritesheet , r , sprite_image , image.Point {}, draw .Over )
110
113
}
111
114
}
112
115
0 commit comments