@@ -19,7 +19,7 @@ pub fn set_color(state: &mut State, args: &[Value]) -> Result {
1919
2020pub fn change_r ( state : & mut State , args : & [ Value ] ) -> Result {
2121 if let [ Value :: Number ( amount) ] = args {
22- state. sprite . draw_color . x = ( state. sprite . draw_color . x + * amount / 255.0 ) . clamp ( 0.0 , 1.0 ) ;
22+ state. sprite . draw_color . x = ( state. sprite . draw_color . x + * amount / 255.0 ) . clamp ( 0.0 , 1.0 ) ;
2323 Ok ( Value :: Null )
2424 } else {
2525 Err ( "change_r() requires a single number argument" . to_string ( ) )
@@ -360,13 +360,16 @@ pub fn textured_tri(state: &State, args: &[Value]) -> Result {
360360 Value :: List ( ys) ,
361361 Value :: List ( us) ,
362362 Value :: List ( vs) ,
363- ] = args {
363+ ] = args
364+ {
364365 if let [
365366 Value :: Number ( width) ,
366367 Value :: Number ( height) ,
367368 Value :: List ( pixels) ,
368- ] = parse_image_result. as_slice ( ) {
369- if xs. len ( ) != ys. len ( ) || xs. len ( ) != us. len ( ) || xs. len ( ) != vs. len ( ) || xs. len ( ) != 3 {
369+ ] = parse_image_result. as_slice ( )
370+ {
371+ if xs. len ( ) != ys. len ( ) || xs. len ( ) != us. len ( ) || xs. len ( ) != vs. len ( ) || xs. len ( ) != 3
372+ {
370373 return Err (
371374 "textured_tri() requires three lists of equal length: x, y, u, v coordinates"
372375 . to_string ( ) ,
@@ -377,7 +380,12 @@ pub fn textured_tri(state: &State, args: &[Value]) -> Result {
377380 . chunks ( 4 )
378381 . map ( |c| {
379382 if c. len ( ) == 4 {
380- U8Vec4 :: new ( c[ 0 ] . to_number ( ) as u8 , c[ 1 ] . to_number ( ) as u8 , c[ 2 ] . to_number ( ) as u8 , c[ 3 ] . to_number ( ) as u8 )
383+ U8Vec4 :: new (
384+ c[ 0 ] . to_number ( ) as u8 ,
385+ c[ 1 ] . to_number ( ) as u8 ,
386+ c[ 2 ] . to_number ( ) as u8 ,
387+ c[ 3 ] . to_number ( ) as u8 ,
388+ )
381389 } else {
382390 U8Vec4 :: new ( 0 , 0 , 0 , 0 )
383391 }
@@ -415,10 +423,14 @@ pub fn textured_tri(state: &State, args: &[Value]) -> Result {
415423 mesh. draw ( ) ;
416424 Ok ( Value :: Null )
417425 } else {
418- return Err ( "textured_tri() requires an image with width, height, and pixel data" . to_string ( ) ) ;
426+ return Err (
427+ "textured_tri() requires an image with width, height, and pixel data" . to_string ( ) ,
428+ ) ;
419429 }
420430 } else {
421- return Err ( "textured_tri() requires an image and lists of x, y, u, v coordinates" . to_string ( ) ) ;
431+ return Err (
432+ "textured_tri() requires an image and lists of x, y, u, v coordinates" . to_string ( ) ,
433+ ) ;
422434 }
423435}
424436
0 commit comments