Quellcode durchsuchen

Fix resizing on linux

Pabloader vor 5 Jahren
Ursprung
Commit
897b51181c
3 geänderte Dateien mit 21 neuen und 1 gelöschten Zeilen
  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 Datei anzeigen

@@ -14,6 +14,17 @@
14 14
             "cStandard": "c11",
15 15
             "cppStandard": "c++17",
16 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 30
     "version": 4

+ 2
- 1
include/olcPixelGameEngine.h Datei anzeigen

@@ -133,7 +133,7 @@
133 133
 
134 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,6 +574,7 @@ namespace olc // All OneLoneCoder stuff will now exist in the "olc" namespace
574 574
 		XVisualInfo*            olc_VisualInfo;
575 575
 		Colormap                olc_ColourMap;
576 576
 		XSetWindowAttributes    olc_SetWindowAttribs;
577
+		XSizeHints			    olc_SizeHints;
577 578
 		Display*				olc_WindowCreate();
578 579
 #endif
579 580
 

+ 8
- 0
src/olcPixelGameEngine.cpp Datei anzeigen

@@ -1632,6 +1632,14 @@ namespace olc
1632 1632
 			nWindowWidth = gwa.width;
1633 1633
 			nWindowHeight = gwa.height;
1634 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 1645
 		// Create Keyboard Mapping

Laden…
Abbrechen
Speichern