@@ -122,6 +122,18 @@ pub struct GliumDisplay {
122
122
scale_factor : f64 ,
123
123
}
124
124
125
+ impl GliumDisplay {
126
+ fn set_matrix ( & mut self ) {
127
+ let ( ui_x, ui_y) = Config :: ui_size ( ) ;
128
+ self . matrix = [
129
+ [ 2.0 / ui_x as f32 , 0.0 , 0.0 , 0.0 ] ,
130
+ [ 0.0 , 2.0 / ui_y as f32 , 0.0 , 0.0 ] ,
131
+ [ 0.0 , 0.0 , 1.0 , 0.0 ] ,
132
+ [ -1.0 , -1.0 , 0.0 , 1.0f32 ] ,
133
+ ] ;
134
+ }
135
+ }
136
+
125
137
struct GliumTexture {
126
138
texture : Texture2d ,
127
139
sampler_fn : Box < dyn Fn ( Sampler < Texture2d > ) -> Sampler < Texture2d > > ,
@@ -403,6 +415,8 @@ fn try_get_display(
403
415
let ( res_x, res_y) = Config :: display_resolution ( ) ;
404
416
let vsync = Config :: vsync_enabled ( ) ;
405
417
418
+ log:: info!( "Creating display {res_x} by {res_y}" ) ;
419
+
406
420
let dims = LogicalSize :: new ( res_x as f64 , res_y as f64 ) ;
407
421
408
422
let attrs = Window :: default_attributes ( )
@@ -542,23 +556,19 @@ impl GliumDisplay {
542
556
543
557
window. set_cursor_visible ( false ) ;
544
558
545
- let ( ui_x, ui_y) = Config :: ui_size ( ) ;
546
-
547
- Ok ( ( GliumDisplay {
559
+ let mut glium_display = GliumDisplay {
548
560
display,
549
561
window,
550
562
monitor,
551
563
base_program,
552
564
swap_program,
553
- matrix : [
554
- [ 2.0 / ui_x as f32 , 0.0 , 0.0 , 0.0 ] ,
555
- [ 0.0 , 2.0 / ui_y as f32 , 0.0 , 0.0 ] ,
556
- [ 0.0 , 0.0 , 1.0 , 0.0 ] ,
557
- [ -1.0 , -1.0 , 0.0 , 1.0f32 ] ,
558
- ] ,
565
+ matrix : [ [ 0.0 ; 4 ] ; 4 ] ,
559
566
textures : HashMap :: new ( ) ,
560
567
scale_factor,
561
- } , event_loop) )
568
+ } ;
569
+ glium_display. set_matrix ( ) ;
570
+
571
+ Ok ( ( glium_display, event_loop) )
562
572
}
563
573
564
574
pub ( crate ) fn get_display_configurations ( & self ) -> Vec < DisplayConfiguration > {
@@ -722,6 +732,11 @@ impl ApplicationHandler for GliumApp {
722
732
if self . updater . is_exit ( ) {
723
733
event_loop. exit ( ) ;
724
734
} else if self . updater . recreate_window ( ) {
735
+ self . ui_x = Config :: ui_width ( ) ;
736
+ self . ui_y = Config :: ui_height ( ) ;
737
+ self . io . set_matrix ( ) ;
738
+ Cursor :: update_max ( ) ;
739
+
725
740
let window = & self . io . window ;
726
741
let ( res_x, res_y) = Config :: display_resolution ( ) ;
727
742
let ( fullscreen, decorations) = configured_fullscreen ( res_x, res_y, self . io . monitor . clone ( ) ) ;
0 commit comments