Scrolling
This commit is contained in:
parent
3afa3e7e87
commit
7670c78cba
Binary file not shown.
Binary file not shown.
|
@ -130,7 +130,7 @@ let draw_line_bresenham mat cls origin x1 y1 x2 y2 cutoff =
|
|||
done;;
|
||||
|
||||
let display mat cls =
|
||||
let colors = [|"\027[40m"; "\027[41m"; "\027[42m"; "\027[43m"; "\027[44m"; "\027[45m"; "\027[46m"; "\027[47m"; "\027[100m"; "\027[101m"; "\027[102m"; "\027[103m"; "\027[104m"; "\027[105m"; "\027[106m"; "\027[107m"|] in
|
||||
let colors = [|"\027[0m"; "\027[41m"; "\027[42m"; "\027[43m"; "\027[44m"; "\027[45m"; "\027[46m"; "\027[47m"; "\027[100m"; "\027[101m"; "\027[102m"; "\027[103m"; "\027[104m"; "\027[105m"; "\027[106m"; "\027[107m"|] in
|
||||
for i = 0 to (Array.length mat -1) do
|
||||
for j = 0 to (Array.length mat.(i) -1) do
|
||||
if cls.(i).(j) = 0 then
|
||||
|
@ -223,18 +223,35 @@ let extremely_fancy_graph_printing g size wmult mode =
|
|||
(* show the image *)
|
||||
ignore (Sys.command "clear");
|
||||
if mode = "SPECIFIC" then begin
|
||||
Printf.printf "Enter the node you want to highlight (type -1 to show all; or -2 to exit)\n";
|
||||
ignore (Sys.command "clear");
|
||||
let halt = ref false in
|
||||
while !halt = false do
|
||||
|
||||
Stdlib.print_endline "Enter the node you want to highlight (type -1 to show all; -2 to exit; -3 to stream all)";
|
||||
let nd = ref (-2) in
|
||||
|
||||
nd := Scanf.bscanf Scanf.Scanning.stdin "%d\n" identity;
|
||||
ignore (Sys.command "clear");
|
||||
|
||||
if !nd >= 0 && !nd < Array.length g then
|
||||
display_specific px cls (!nd+1)
|
||||
else if !nd = -1 then
|
||||
display px cls
|
||||
else if !nd = -2 then
|
||||
halt := true
|
||||
else if !nd = -3 then begin
|
||||
for i = 0 to (Array.length g -1) do
|
||||
ignore (Sys.command "clear");
|
||||
display_specific px cls (i+1);
|
||||
Stdlib.print_endline "_";
|
||||
ignore (Sys.command "sleep 1");
|
||||
done;
|
||||
display px cls;
|
||||
Stdlib.print_endline "_";
|
||||
ignore (Sys.command "sleep 1");
|
||||
end
|
||||
else
|
||||
()
|
||||
done
|
||||
end
|
||||
else
|
||||
display px cls ;;
|
||||
|
@ -244,6 +261,6 @@ let gr = [|[|3; 5; 7|]; [|0|]; [|1; 7; 8|]; [|2; 6|]; [|0; 1; 3|]; [|6; 7|]; [|0
|
|||
|
||||
(*print_mat gr ;;*)
|
||||
|
||||
extremely_fancy_graph_printing gr 44 4 "EVERYTHING" ;
|
||||
extremely_fancy_graph_printing gr 44 4 "SPECIFIC" ;
|
||||
|
||||
(* ocamlfind ocamlc -linkpkg -package unix pretty_printing.ml *)
|
Loading…
Reference in New Issue