Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {$codepage utf-8}
- {$H+}
- program test_cursor;
- uses
- BearLibTerminal, sysutils, dateutils;
- var
- cx, cy: Integer;
- const
- CURSOR_LAYER = 2;
- ANIMATION_DELAY = 25;
- procedure on_animation();
- var
- previous_layer: Integer;
- begin
- previous_layer := terminal_state(TK_LAYER);
- terminal_layer(CURSOR_LAYER);
- terminal_clear_area(0, 0, terminal_state(TK_WIDTH), terminal_state(TK_HEIGHT));
- if MillisecondOfTheDay(Now) mod 1000 > 500 then
- terminal_put(cx, cy, '_')
- else
- terminal_put(cx, cy, 0);
- terminal_layer(previous_layer);
- end;
- function terminal_read_animated(): Integer;
- begin
- while not terminal_has_input() do begin
- on_animation();
- terminal_refresh();
- terminal_delay(ANIMATION_DELAY);
- end;
- terminal_read_animated := terminal_read();
- end;
- begin
- terminal_open();
- terminal_set('input.filter = keyboard, close');
- cx := 2; cy := 1;
- cx := cx + terminal_print(cx, cy, 'Whatever');
- repeat
- terminal_refresh();
- until (terminal_read_animated() = TK_CLOSE);
- terminal_close();
- end.
Advertisement
Add Comment
Please, Sign In to add comment