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 {
82
82
let change = velocity * delta;
83
83
let position = owner. global_position ( ) + change;
84
84
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 ) ,
87
87
) ;
88
88
owner. set_global_position ( position) ;
89
89
}
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ impl SceneCreate {
59
59
Ok ( spatial) => {
60
60
// Here is how you rename the child...
61
61
let key_str = format ! ( "child_{}" , self . children_spawned) ;
62
- spatial. set_name ( & key_str) ;
62
+ spatial. set_name ( key_str) ;
63
63
64
64
let x = ( self . children_spawned % 10 ) as f32 ;
65
65
let z = ( self . children_spawned / 10 ) as f32 ;
Original file line number Diff line number Diff line change @@ -103,6 +103,12 @@ impl Transform {
103
103
This method will be renamed to translated_local in gdnative 0.12."]
104
104
#[ inline]
105
105
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 {
106
112
Self {
107
113
basis : self . basis ,
108
114
origin : self . origin + translation,
@@ -365,7 +371,7 @@ mod tests {
365
371
#[ test]
366
372
fn translation_is_sane ( ) {
367
373
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) ;
369
375
assert ! ( t. basis. elements[ 0 ] == Vector3 :: new( 1.0 , 0.0 , 0.0 ) ) ;
370
376
assert ! ( t. basis. elements[ 1 ] == Vector3 :: new( 0.0 , 1.0 , 0.0 ) ) ;
371
377
assert ! ( t. basis. elements[ 2 ] == Vector3 :: new( 0.0 , 0.0 , 1.0 ) ) ;
Original file line number Diff line number Diff line change 25
25
clippy:: missing_safety_doc,
26
26
clippy:: non_send_fields_in_send_ty
27
27
) ]
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
+ ) ]
29
32
30
33
#[ doc( hidden) ]
31
34
pub 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 ) ]
2
2
#![ allow( deprecated) ]
3
3
4
4
use gdnative:: prelude:: * ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ pub(crate) fn run_tests() -> bool {
9
9
10
10
thread_local ! {
11
11
static EXECUTOR : & ' static SharedLocalPool = {
12
- Box :: leak( Box :: new ( SharedLocalPool :: default ( ) ) )
12
+ Box :: leak( Box :: default ( ) )
13
13
} ;
14
14
}
15
15
You can’t perform that action at this time.
0 commit comments