Subversion Repositories Kolibri OS

Rev

Rev 6613 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. (*
  2.     Copyright 2016, 2018 Anton Krotov
  3.  
  4.     This program is free software: you can redistribute it and/or modify
  5.     it under the terms of the GNU Lesser General Public License as published by
  6.     the Free Software Foundation, either version 3 of the License, or
  7.     (at your option) any later version.
  8.  
  9.     This program is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU Lesser General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Lesser General Public License
  15.     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. *)
  17.  
  18. MODULE Console;
  19.  
  20. IMPORT ConsoleLib, In, Out;
  21.  
  22.  
  23. CONST
  24.  
  25.     Black* = 0;      Blue* = 1;           Green* = 2;        Cyan* = 3;
  26.     Red* = 4;        Magenta* = 5;        Brown* = 6;        LightGray* = 7;
  27.     DarkGray* = 8;   LightBlue* = 9;      LightGreen* = 10;  LightCyan* = 11;
  28.     LightRed* = 12;  LightMagenta* = 13;  Yellow* = 14;      White* = 15;
  29.  
  30.  
  31. PROCEDURE SetCursor* (X, Y: INTEGER);
  32. BEGIN
  33.     ConsoleLib.set_cursor_pos(X, Y)
  34. END SetCursor;
  35.  
  36.  
  37. PROCEDURE GetCursor* (VAR X, Y: INTEGER);
  38. BEGIN
  39.     ConsoleLib.get_cursor_pos(X, Y)
  40. END GetCursor;
  41.  
  42.  
  43. PROCEDURE Cls*;
  44. BEGIN
  45.     ConsoleLib.cls
  46. END Cls;
  47.  
  48.  
  49. PROCEDURE SetColor* (FColor, BColor: INTEGER);
  50. VAR
  51.     res: INTEGER;
  52.  
  53. BEGIN
  54.     IF (FColor IN {0..15}) & (BColor IN {0..15}) THEN
  55.         res := ConsoleLib.set_flags(LSL(BColor, 4) + FColor)
  56.     END
  57. END SetColor;
  58.  
  59.  
  60. PROCEDURE GetCursorX* (): INTEGER;
  61. VAR
  62.     x, y: INTEGER;
  63.  
  64. BEGIN
  65.     ConsoleLib.get_cursor_pos(x, y)
  66.     RETURN x
  67. END GetCursorX;
  68.  
  69.  
  70. PROCEDURE GetCursorY* (): INTEGER;
  71. VAR
  72.     x, y: INTEGER;
  73.  
  74. BEGIN
  75.     ConsoleLib.get_cursor_pos(x, y)
  76.     RETURN y
  77. END GetCursorY;
  78.  
  79.  
  80. PROCEDURE open*;
  81. BEGIN
  82.     ConsoleLib.open(-1, -1, -1, -1, "");
  83.     In.Open;
  84.     Out.Open
  85. END open;
  86.  
  87.  
  88. PROCEDURE exit* (bCloseWindow: BOOLEAN);
  89. BEGIN
  90.     ConsoleLib.exit(bCloseWindow)
  91. END exit;
  92.  
  93.  
  94. END Console.
  95.