File tree Expand file tree Collapse file tree 6 files changed +16
-7
lines changed Expand file tree Collapse file tree 6 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -82,8 +82,8 @@ impl Player {
8282 let change = velocity * delta;
8383 let position = owner. global_position ( ) + change;
8484 let position = Vector2 :: new (
85- position. x . max ( 0.0 ) . min ( self . screen_size . x ) ,
86- position. y . max ( 0.0 ) . min ( self . screen_size . y ) ,
85+ position. x . clamp ( 0.0 , self . screen_size . x ) ,
86+ position. y . clamp ( 0.0 , self . screen_size . y ) ,
8787 ) ;
8888 owner. set_global_position ( position) ;
8989 }
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ impl SceneCreate {
5959 Ok ( spatial) => {
6060 // Here is how you rename the child...
6161 let key_str = format ! ( "child_{}" , self . children_spawned) ;
62- spatial. set_name ( & key_str) ;
62+ spatial. set_name ( key_str) ;
6363
6464 let x = ( self . children_spawned % 10 ) as f32 ;
6565 let z = ( self . children_spawned / 10 ) as f32 ;
Original file line number Diff line number Diff line change @@ -103,6 +103,12 @@ impl Transform {
103103 This method will be renamed to translated_local in gdnative 0.12."]
104104 #[ inline]
105105 pub fn translated ( & self , translation : Vector3 ) -> Self {
106+ self . translated_local ( translation)
107+ }
108+
109+ /// Returns this transform, with its origin moved by a certain `translation`
110+ #[ inline]
111+ pub fn translated_local ( & self , translation : Vector3 ) -> Self {
106112 Self {
107113 basis : self . basis ,
108114 origin : self . origin + translation,
@@ -365,7 +371,7 @@ mod tests {
365371 #[ test]
366372 fn translation_is_sane ( ) {
367373 let translation = Vector3 :: new ( 1.0 , 2.0 , 3.0 ) ;
368- let t = Transform :: default ( ) . translated ( translation) ;
374+ let t = Transform :: default ( ) . translated_local ( translation) ;
369375 assert ! ( t. basis. elements[ 0 ] == Vector3 :: new( 1.0 , 0.0 , 0.0 ) ) ;
370376 assert ! ( t. basis. elements[ 1 ] == Vector3 :: new( 0.0 , 1.0 , 0.0 ) ) ;
371377 assert ! ( t. basis. elements[ 2 ] == Vector3 :: new( 0.0 , 0.0 , 1.0 ) ) ;
Original file line number Diff line number Diff line change 2525 clippy:: missing_safety_doc,
2626 clippy:: non_send_fields_in_send_ty
2727) ]
28- #![ cfg_attr( feature = "gd-test" , allow( clippy:: blacklisted_name) ) ]
28+ #![ cfg_attr(
29+ any( test, feature = "gd-test" ) ,
30+ allow( clippy:: excessive_precision, clippy:: disallowed_names)
31+ ) ]
2932
3033#[ doc( hidden) ]
3134pub extern crate gdnative_sys as sys;
Original file line number Diff line number Diff line change 1- #![ allow( clippy:: blacklisted_name ) ]
1+ #![ allow( clippy:: disallowed_names ) ]
22#![ allow( deprecated) ]
33
44use gdnative:: prelude:: * ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ pub(crate) fn run_tests() -> bool {
99
1010thread_local ! {
1111 static EXECUTOR : & ' static SharedLocalPool = {
12- Box :: leak( Box :: new ( SharedLocalPool :: default ( ) ) )
12+ Box :: leak( Box :: default ( ) )
1313 } ;
1414}
1515
You can’t perform that action at this time.
0 commit comments