@@ -78,15 +78,7 @@ TDisplay = class
7878
7979 Cursor_Update: boolean;
8080
81- Console_Draw: boolean;
82- Console_ScrollOffset: integer;
8381 procedure DrawDebugInformation ;
84- procedure DrawDebugConsole ;
85-
86- { Handles parsing of inputs when console is opened. Called from ParseInput }
87- function ConsoleParseInput (PressedKey: cardinal; CharCode: UCS4Char; PressedDown : boolean): boolean;
88- { Handles parsing of inputs when console is opened. Called from ParseMouse }
89- function ConsoleParseMouse (MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean;
9082
9183 { called by MoveCursor and OnMouseButton to update last move and start fade in }
9284 procedure UpdateCursorFade ;
@@ -109,8 +101,6 @@ TDisplay = class
109101
110102 procedure InitFadeTextures ();
111103
112- procedure ToggleConsole ;
113-
114104 procedure SaveScreenShot ;
115105
116106 function Draw : boolean;
@@ -455,12 +445,6 @@ function TDisplay.Draw: boolean;
455445 if ((Ini.Debug = 1 ) or (Params.Debug)) and (S = 1 ) then
456446 begin
457447 DrawDebugInformation;
458- if Console_Draw then DrawDebugConsole;
459- end else if Console_Draw then
460- begin
461- // clear flag to prevent drawing console when toggling debug
462- // TODO: considers using event in ScreenOptions for clearing debug
463- Console_Draw := false;
464448 end ;
465449
466450 if not BlackScreen then
@@ -643,13 +627,6 @@ procedure TDisplay.DrawCursor;
643627
644628function TDisplay.ShouldHandleInput (PressedKey: cardinal; CharCode: UCS4Char; PressedDown : boolean; out SuppressKey: boolean): boolean;
645629begin
646- if Console_Draw then
647- begin
648- Result := true;
649- SuppressKey := true;
650- Exit;
651- end ;
652-
653630 if (assigned(NextScreen)) then
654631 Result := NextScreen^.ShouldHandleInput(PressedKey, CharCode, PressedDown, SuppressKey)
655632 else if (assigned(CurrentScreen)) then
@@ -660,8 +637,6 @@ function TDisplay.ShouldHandleInput(PressedKey: cardinal; CharCode: UCS4Char; Pr
660637
661638function TDisplay.ParseInput (PressedKey: cardinal; CharCode: UCS4Char; PressedDown : boolean): boolean;
662639begin
663- if Console_Draw and ConsoleParseInput(PressedKey, CharCode, PressedDown) then Exit;
664-
665640 if (assigned(NextScreen)) then
666641 Result := NextScreen^.ParseInput(PressedKey, CharCode, PressedDown)
667642 else if (assigned(CurrentScreen)) then
@@ -672,8 +647,6 @@ function TDisplay.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDo
672647
673648function TDisplay.ParseMouse (MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean;
674649begin
675- if Console_Draw and ConsoleParseMouse(MouseButton, BtnDown, X, Y) then Exit;
676-
677650 if (assigned(NextScreen)) then
678651 Result := NextScreen^.ParseMouse(MouseButton, BtnDown, X, Y)
679652 else
@@ -845,142 +818,4 @@ procedure TDisplay.DrawDebugInformation;
845818 glColor4f(1 , 1 , 1 , 1 );
846819end ;
847820
848- procedure TDisplay.ToggleConsole ;
849- begin
850- Console_Draw := not Console_Draw;
851- Console_ScrollOffset := 0 ;
852- end ;
853-
854- function TDisplay.ConsoleParseInput (PressedKey: cardinal; CharCode: UCS4Char; PressedDown : boolean): boolean;
855- var
856- SDL_ModState: word;
857- begin
858- Result := false;
859-
860- if (PressedDown) then
861- begin // Key Down
862- Result := true;
863- SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
864- + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT);
865-
866- case PressedKey of
867- SDLK_PAGEUP: Console_ScrollOffset := Min(Console_ScrollOffset+3 , Log.ConsoleCount-1 );
868- SDLK_PAGEDOWN: Console_ScrollOffset := Max(Console_ScrollOffset-3 , 0 );
869- SDLK_HOME: Console_ScrollOffset := Log.ConsoleCount-1 ;
870- SDLK_END: Console_ScrollOffset := 0 ;
871- SDLK_DELETE: if SDL_ModState and KMOD_CTRL <> 0 then Log.ClearConsoleLog;
872- otherwise Result := false;
873- end ;
874- end ;
875- end ;
876-
877- function TDisplay.ConsoleParseMouse (MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean;
878- begin
879- Result := false;
880-
881- if (BtnDown) then
882- begin // button Down
883- Result := true;
884- case MouseButton of
885- SDL_BUTTON_WHEELUP: Console_ScrollOffset := Min(Console_ScrollOffset+3 , Log.ConsoleCount-1 );
886- SDL_BUTTON_WHEELDOWN: Console_ScrollOffset := Max(Console_ScrollOffset-3 , 0 );
887- otherwise Result := false;
888- end ;
889- end ;
890- end ;
891-
892- // ------------
893- // DrawDebugInformation - procedure draw fps and some other informations on screen
894- // ------------
895- procedure TDisplay.DrawDebugConsole ;
896- var
897- I, LineCount: integer;
898- YOffset, ScaleF, FontSize: real;
899- PosY: real;
900- W, H: real;
901- ScrollPad, ScrollW: real;
902- OldStretch: real;
903- begin
904- FontSize := 16.0 ;
905- W := 800.0 ;
906- H := 400.0 ;
907- ScrollPad := 5.0 ;
908- ScrollW := 10.0 ;
909-
910- // Some black background
911- glEnable(GL_BLEND);
912- glDisable(GL_TEXTURE_2D);
913- glColor4f(0 , 0 , 0 , 0.85 );
914- glBegin(GL_QUADS);
915- glVertex2f(0 , 0 );
916- glVertex2f(0 , H);
917- glVertex2f(W, H);
918- glVertex2f(W, 0 );
919- glEnd;
920- glDisable(GL_BLEND);
921-
922- // scale sizes to DPI/aspect
923- ScaleF := (1.0 *ScreenH)/(1.0 *ScreenW);
924- FontSize := FontSize * 600.0 /(1.0 *ScreenH);
925- ScrollW := ScrollW * 800.0 /(1.0 *ScreenW);
926- ScrollPad := ScrollPad * ScaleF;
927-
928- // set font specs
929- SetFontFamily(0 );
930- SetFontStyle(ftRegular);
931- SetFontSize(FontSize);
932- SetFontItalic(false);
933- SetFontReflection(false, 0 );
934- glColor4f(1 , 1 , 1 , 1 );
935-
936- OldStretch := Fonts[CurrentFont.FontFamily][CurrentFont.FontStyle].Font.Stretch;
937- Fonts[CurrentFont.FontFamily][CurrentFont.FontStyle].Font.Stretch := 1.4 *ScaleF * Min(1.3 , Max(0.8 , power((1.0 *ScreenW)/800.0 , 1.2 )));
938-
939- // don't draw anything else if nothing's logged
940- if Log.ConsoleCount < 1 then Exit;
941-
942-
943- // draw log buffer
944- YOffset := H; // start at bottom
945- LineCount := 0 ;
946- I := Log.ConsoleCount-1 - Console_ScrollOffset;
947- while (I >= 0 ) and (YOffset > 0 ) do
948- begin
949- YOffset := YOffset - FontSize;
950- SetFontPos(5 , YOffset);
951- glPrint(Log.GetConsole(i));
952-
953- Dec(i);
954- Inc(LineCount);
955- end ;
956-
957- // draw scoll bar
958- glEnable(GL_BLEND);
959- glDisable(GL_TEXTURE_2D);
960- glColor4f(0.33 , 0.33 , 0.33 , 1 );
961- glBegin(GL_QUADS);
962- glVertex2f(W-ScrollPad-ScrollW, ScrollPad); // top left
963- glVertex2f(W-ScrollPad, ScrollPad); // top right
964- glVertex2f(W-ScrollPad, H-ScrollPad); // bottom right
965- glVertex2f(W-ScrollPad-ScrollW, H-ScrollPad); // bottom left
966- glEnd;
967-
968- // visible height bar + offset
969- YOffset := H * ((1.0 *LineCount)/(1.0 *Log.ConsoleCount));
970- PosY := 0 ;
971- if I > 0 then PosY := (H-2.0 *ScrollPad) * Max(0.0 , I)/(1.0 *Log.ConsoleCount);
972-
973- glColor4f(1 , 1 , 1 , 1 );
974- glBegin(GL_QUADS);
975- glVertex2f(W-ScrollPad-ScrollW, ScrollPad + PosY); // top left
976- glVertex2f(W-ScrollPad, ScrollPad + PosY); // top right
977- glVertex2f(W-ScrollPad, ScrollPad + PosY + YOffset); // bottom right
978- glVertex2f(W-ScrollPad-ScrollW, ScrollPad + PosY + YOffset); // bottom left
979- glEnd;
980- glDisable(GL_BLEND);
981-
982- Fonts[CurrentFont.FontFamily][CurrentFont.FontStyle].Font.Stretch := OldStretch;
983- glColor4f(1 , 1 , 1 , 1 );
984- end ;
985-
986821end .
0 commit comments