Browse Source

Fix resizing on linux

Pabloader 5 years ago
parent
commit
897b51181c
3 changed files with 21 additions and 1 deletions
  1. 11
    0
      .vscode/c_cpp_properties.json
  2. 2
    1
      include/olcPixelGameEngine.h
  3. 8
    0
      src/olcPixelGameEngine.cpp

+ 11
- 0
.vscode/c_cpp_properties.json View File

14
             "cStandard": "c11",
14
             "cStandard": "c11",
15
             "cppStandard": "c++17",
15
             "cppStandard": "c++17",
16
             "intelliSenseMode": "gcc-x64"
16
             "intelliSenseMode": "gcc-x64"
17
+        },
18
+        {
19
+            "name": "Linux",
20
+            "includePath": [
21
+                "${workspaceFolder}/**"
22
+            ],
23
+            "defines": [],
24
+            "compilerPath": "/usr/bin/gcc",
25
+            "cStandard": "c11",
26
+            "cppStandard": "c++17",
27
+            "intelliSenseMode": "gcc-x64"
17
         }
28
         }
18
     ],
29
     ],
19
     "version": 4
30
     "version": 4

+ 2
- 1
include/olcPixelGameEngine.h View File

133
 
133
 
134
 	Author
134
 	Author
135
 	~~~~~~
135
 	~~~~~~
136
-	David Barr, aka javidx9, OneLoneCoder 2018, 2019
136
+	David Barr, aka javidx9, ©OneLoneCoder 2018, 2019
137
 */
137
 */
138
 
138
 
139
 //////////////////////////////////////////////////////////////////////////////////////////
139
 //////////////////////////////////////////////////////////////////////////////////////////
574
 		XVisualInfo*            olc_VisualInfo;
574
 		XVisualInfo*            olc_VisualInfo;
575
 		Colormap                olc_ColourMap;
575
 		Colormap                olc_ColourMap;
576
 		XSetWindowAttributes    olc_SetWindowAttribs;
576
 		XSetWindowAttributes    olc_SetWindowAttribs;
577
+		XSizeHints			    olc_SizeHints;
577
 		Display*				olc_WindowCreate();
578
 		Display*				olc_WindowCreate();
578
 #endif
579
 #endif
579
 
580
 

+ 8
- 0
src/olcPixelGameEngine.cpp View File

1632
 			nWindowWidth = gwa.width;
1632
 			nWindowWidth = gwa.width;
1633
 			nWindowHeight = gwa.height;
1633
 			nWindowHeight = gwa.height;
1634
 			olc_UpdateViewport();
1634
 			olc_UpdateViewport();
1635
+		} else {
1636
+			olc_SizeHints.flags = PMaxSize | PMinSize;
1637
+			olc_SizeHints.max_width = nScreenWidth * nPixelWidth;
1638
+			olc_SizeHints.max_height = nScreenHeight * nPixelHeight;
1639
+			olc_SizeHints.min_width = nScreenWidth * nPixelWidth;
1640
+			olc_SizeHints.min_height = nScreenHeight * nPixelHeight;
1641
+
1642
+			XSetWMNormalHints(olc_Display, olc_Window, &olc_SizeHints);
1635
 		}
1643
 		}
1636
 
1644
 
1637
 		// Create Keyboard Mapping
1645
 		// Create Keyboard Mapping

Loading…
Cancel
Save