Subversion Repositories Kolibri OS

Rev

Rev 6613 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6613 Rev 7597
Line 1... Line 1...
1
(*
1
(*
2
    Copyright 2016 Anton Krotov
2
    Copyright 2016, 2018 Anton Krotov
Line 3... Line 3...
3
 
3
 
4
    This program is free software: you can redistribute it and/or modify
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
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
6
    the Free Software Foundation, either version 3 of the License, or
Line 15... Line 15...
15
    along with this program.  If not, see .
15
    along with this program.  If not, see .
16
*)
16
*)
Line 17... Line 17...
17
 
17
 
Line 18... Line 18...
18
MODULE Console;
18
MODULE Console;
-
 
19
 
Line 19... Line 20...
19
 
20
IMPORT ConsoleLib, In, Out;
Line 20... Line 21...
20
IMPORT ConsoleLib;
21
 
21
 
22
 
22
CONST
23
CONST
23
 
24
 
Line -... Line 25...
-
 
25
    Black* = 0;      Blue* = 1;           Green* = 2;        Cyan* = 3;
24
  Black* = 0;     Blue* = 1;          Green* = 2;       Cyan* = 3;
26
    Red* = 4;        Magenta* = 5;        Brown* = 6;        LightGray* = 7;
25
  Red* = 4;       Magenta* = 5;       Brown* = 6;       LightGray* = 7;
27
    DarkGray* = 8;   LightBlue* = 9;      LightGreen* = 10;  LightCyan* = 11;
26
  DarkGray* = 8;  LightBlue* = 9;     LightGreen* = 10; LightCyan* = 11;
28
    LightRed* = 12;  LightMagenta* = 13;  Yellow* = 14;      White* = 15;
27
  LightRed* = 12; LightMagenta* = 13; Yellow* = 14;     White* = 15;
29
 
Line -... Line 30...
-
 
30
 
28
 
31
PROCEDURE SetCursor* (X, Y: INTEGER);
29
PROCEDURE SetCursor*(X, Y: INTEGER);
32
BEGIN
30
BEGIN
33
    ConsoleLib.set_cursor_pos(X, Y)
31
  ConsoleLib.set_cursor_pos(X, Y)
34
END SetCursor;
Line -... Line 35...
-
 
35
 
32
END SetCursor;
36
 
33
 
37
PROCEDURE GetCursor* (VAR X, Y: INTEGER);
34
PROCEDURE GetCursor*(VAR X, Y: INTEGER);
38
BEGIN
35
BEGIN
39
    ConsoleLib.get_cursor_pos(X, Y)
Line -... Line 40...
-
 
40
END GetCursor;
36
  ConsoleLib.get_cursor_pos(X, Y)
41
 
-
 
42
 
37
END GetCursor;
43
PROCEDURE Cls*;
-
 
44
BEGIN
38
 
45
    ConsoleLib.cls
39
PROCEDURE Cls*;
46
END Cls;
40
BEGIN
47
 
41
  ConsoleLib.cls
48
 
42
END Cls;
49
PROCEDURE SetColor* (FColor, BColor: INTEGER);
Line -... Line 50...
-
 
50
VAR
43
 
51
    res: INTEGER;
-
 
52
 
44
PROCEDURE SetColor*(FColor, BColor: INTEGER);
53
BEGIN
-
 
54
    IF (FColor IN {0..15}) & (BColor IN {0..15}) THEN
45
VAR res: INTEGER;
55
        res := ConsoleLib.set_flags(LSL(BColor, 4) + FColor)
46
BEGIN
56
    END
47
  IF (FColor IN {0..15}) & (BColor IN {0..15}) THEN
57
END SetColor;
48
    res := ConsoleLib.set_flags(LSL(BColor, 4) + FColor)
58
 
Line -... Line 59...
-
 
59
 
49
  END
60
PROCEDURE GetCursorX* (): INTEGER;
-
 
61
VAR
50
END SetColor;
62
    x, y: INTEGER;
-
 
63
 
51
 
64
BEGIN
52
PROCEDURE GetCursorX*(): INTEGER;
65
    ConsoleLib.get_cursor_pos(x, y)
53
VAR x, y: INTEGER;
66
    RETURN x
54
BEGIN
67
END GetCursorX;
Line -... Line 68...
-
 
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, "");
55
  ConsoleLib.get_cursor_pos(x, y)
83
    In.Open;