Subversion Repositories Kolibri OS

Rev

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

  1. (*
  2.     Copyright 2016 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;
  21.  
  22. CONST
  23.  
  24.   Black* = 0;     Blue* = 1;          Green* = 2;       Cyan* = 3;
  25.   Red* = 4;       Magenta* = 5;       Brown* = 6;       LightGray* = 7;
  26.   DarkGray* = 8;  LightBlue* = 9;     LightGreen* = 10; LightCyan* = 11;
  27.   LightRed* = 12; LightMagenta* = 13; Yellow* = 14;     White* = 15;
  28.  
  29. PROCEDURE SetCursor*(X, Y: INTEGER);
  30. BEGIN
  31.   ConsoleLib.set_cursor_pos(X, Y)
  32. END SetCursor;
  33.  
  34. PROCEDURE GetCursor*(VAR X, Y: INTEGER);
  35. BEGIN
  36.   ConsoleLib.get_cursor_pos(X, Y)
  37. END GetCursor;
  38.  
  39. PROCEDURE Cls*;
  40. BEGIN
  41.   ConsoleLib.cls
  42. END Cls;
  43.  
  44. PROCEDURE SetColor*(FColor, BColor: INTEGER);
  45. VAR res: INTEGER;
  46. BEGIN
  47.   IF (FColor IN {0..15}) & (BColor IN {0..15}) THEN
  48.     res := ConsoleLib.set_flags(LSL(BColor, 4) + FColor)
  49.   END
  50. END SetColor;
  51.  
  52. PROCEDURE GetCursorX*(): INTEGER;
  53. VAR x, y: INTEGER;
  54. BEGIN
  55.   ConsoleLib.get_cursor_pos(x, y)
  56.   RETURN x
  57. END GetCursorX;
  58.  
  59. PROCEDURE GetCursorY*(): INTEGER;
  60. VAR x, y: INTEGER;
  61. BEGIN
  62.   ConsoleLib.get_cursor_pos(x, y)
  63.   RETURN y
  64. END GetCursorY;
  65.  
  66. END Console.
  67.