File tree 6 files changed +15
-25
lines changed
6 files changed +15
-25
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ pub fn camera_system<T: CameraProjection + Component>(
78
78
for ( entity, mut camera, mut camera_projection) in queries. q0_mut ( ) . iter_mut ( ) {
79
79
if let Some ( window) = windows. get ( camera. window ) {
80
80
if changed_window_ids. contains ( & window. id ( ) ) || added_cameras. contains ( & entity) {
81
- camera_projection. update ( window. logical_width ( ) , window. logical_height ( ) ) ;
81
+ camera_projection. update ( window. width ( ) , window. height ( ) ) ;
82
82
camera. projection_matrix = camera_projection. get_projection_matrix ( ) ;
83
83
camera. depth_calculation = camera_projection. depth_calculation ( ) ;
84
84
}
Original file line number Diff line number Diff line change @@ -116,8 +116,8 @@ impl FlexSurface {
116
116
* node,
117
117
stretch:: style:: Style {
118
118
size : stretch:: geometry:: Size {
119
- width : stretch:: style:: Dimension :: Points ( window. logical_width ( ) ) ,
120
- height : stretch:: style:: Dimension :: Points ( window. logical_height ( ) ) ,
119
+ width : stretch:: style:: Dimension :: Points ( window. width ( ) ) ,
120
+ height : stretch:: style:: Dimension :: Points ( window. height ( ) ) ,
121
121
} ,
122
122
..Default :: default ( )
123
123
} ,
Original file line number Diff line number Diff line change @@ -126,22 +126,12 @@ impl Window {
126
126
}
127
127
128
128
#[ inline]
129
- pub fn width ( & self ) -> u32 {
130
- self . logical_width ( ) as u32
131
- }
132
-
133
- #[ inline]
134
- pub fn height ( & self ) -> u32 {
135
- self . logical_height ( ) as u32
136
- }
137
-
138
- #[ inline]
139
- pub fn logical_width ( & self ) -> f32 {
129
+ pub fn width ( & self ) -> f32 {
140
130
( self . physical_width as f64 / self . scale_factor ) as f32
141
131
}
142
132
143
133
#[ inline]
144
- pub fn logical_height ( & self ) -> f32 {
134
+ pub fn height ( & self ) -> f32 {
145
135
( self . physical_height as f64 / self . scale_factor ) as f32
146
136
}
147
137
@@ -161,7 +151,7 @@ impl Window {
161
151
. push ( WindowCommand :: SetMaximized { maximized } ) ;
162
152
}
163
153
164
- pub fn set_resolution ( & mut self , width : u32 , height : u32 ) {
154
+ pub fn set_resolution ( & mut self , width : f32 , height : f32 ) {
165
155
self . physical_width = ( width as f64 * self . scale_factor ) as u32 ;
166
156
self . physical_height = ( height as f64 * self . scale_factor ) as u32 ;
167
157
self . command_queue . push ( WindowCommand :: SetResolution {
Original file line number Diff line number Diff line change @@ -210,8 +210,8 @@ pub fn winit_runner(mut app: App) {
210
210
app. resources . get_mut :: < Events < WindowResized > > ( ) . unwrap ( ) ;
211
211
resize_events. send ( WindowResized {
212
212
id : window_id,
213
- height : window. logical_height ( ) ,
214
- width : window. logical_width ( ) ,
213
+ height : window. height ( ) ,
214
+ width : window. width ( ) ,
215
215
} ) ;
216
216
}
217
217
WindowEvent :: CloseRequested => {
@@ -309,7 +309,7 @@ pub fn winit_runner(mut app: App) {
309
309
310
310
// FIXME?: On Android window start is top while on PC/Linux/OSX on bottom
311
311
if cfg ! ( target_os = "android" ) {
312
- let window_height = windows. get_primary ( ) . unwrap ( ) . logical_height ( ) ;
312
+ let window_height = windows. get_primary ( ) . unwrap ( ) . height ( ) ;
313
313
location. y = window_height - location. y ;
314
314
}
315
315
touch_input_events. send ( converters:: convert_touch_input ( touch, location) ) ;
Original file line number Diff line number Diff line change @@ -237,11 +237,11 @@ fn collision_system(
237
237
238
238
let win = wins. get_primary ( ) . unwrap ( ) ;
239
239
240
- let ceiling = win. logical_height ( ) / 2. ;
241
- let ground = -( win. logical_height ( ) / 2. ) ;
240
+ let ceiling = win. height ( ) / 2. ;
241
+ let ground = -( win. height ( ) / 2. ) ;
242
242
243
- let wall_left = -( win. logical_width ( ) / 2. ) ;
244
- let wall_right = win. logical_width ( ) / 2. ;
243
+ let wall_left = -( win. width ( ) / 2. ) ;
244
+ let wall_right = win. width ( ) / 2. ;
245
245
246
246
for ( mut v, mut t) in q. iter_mut ( ) {
247
247
let left = t. translation . x - SPRITE_SIZE / 2.0 ;
Original file line number Diff line number Diff line change @@ -48,8 +48,8 @@ fn bounce_system(
48
48
mut sprites : Query < ( & Transform , & mut Velocity ) > ,
49
49
) {
50
50
let window = windows. get_primary ( ) . expect ( "No primary window." ) ;
51
- let width = window. logical_width ( ) ;
52
- let height = window. logical_height ( ) ;
51
+ let width = window. width ( ) ;
52
+ let height = window. height ( ) ;
53
53
let left = width / -2.0 ;
54
54
let right = width / 2.0 ;
55
55
let bottom = height / -2.0 ;
You can’t perform that action at this time.
0 commit comments