@@ -36,31 +36,31 @@ public class ConsoleEngine {
36
36
/// <param name="fontH">Target font height.</param>
37
37
public ConsoleEngine ( int width , int height , int fontW , int fontH ) {
38
38
if ( width < 1 || height < 1 ) throw new ArgumentOutOfRangeException ( ) ;
39
- if ( fontW < 2 || fontH < 2 ) throw new ArgumentOutOfRangeException ( ) ;
39
+ if ( fontW < 1 || fontH < 1 ) throw new ArgumentOutOfRangeException ( ) ;
40
40
41
- Console . Title = "Untitled application" ;
41
+ Console . Title = "Untitled console application" ;
42
42
Console . CursorVisible = false ;
43
+ Console . SetBufferSize ( width , height ) ;
43
44
44
45
ConsoleBuffer = new ConsoleBuffer ( width , height ) ;
45
46
46
47
WindowSize = new Point ( width , height ) ;
47
48
FontSize = new Point ( fontW , fontH ) ;
48
49
49
- // Stänger av alla standard ConsoleInput metoder (Quick-edit etc)
50
- NativeMethods . SetConsoleMode ( stdInputHandle , 0x0080 ) ;
51
- // Sätter fontstorlek och tvingar Consolas
52
- ConsoleFont . SetFont ( stdOutputHandle , ( short ) fontW , ( short ) fontH ) ;
53
-
54
- Console . SetWindowSize ( width , height ) ;
55
- Console . SetBufferSize ( width , height ) ;
56
-
57
50
CharBuffer = new char [ width , height ] ;
58
51
ColorBuffer = new int [ width , height ] ;
59
52
60
53
SetBackground ( 0 ) ;
61
54
SetPalette ( Palettes . Default ) ;
62
55
63
- // sätter igen, idk men det behövs
56
+ // Stänger av alla standard ConsoleInput metoder (Quick-edit etc)
57
+ NativeMethods . SetConsoleMode ( stdInputHandle , 0x0080 ) ;
58
+
59
+ // Sätter fontstorlek och tvingar Raster (Terminal)
60
+ // Detta måste göras efter SetBufferSize, annars ger den en IOException
61
+ ConsoleFont . SetFont ( stdOutputHandle , ( short ) fontW , ( short ) fontH ) ;
62
+ // sätter storleken på fönstret, måste ske efter SetBufferSize för annars
63
+ // blir fönstret 1 px större (?)
64
64
Console . SetWindowSize ( width , height ) ;
65
65
}
66
66
0 commit comments