Commit 69a96f9f authored by Benoit Barbot's avatar Benoit Barbot
Browse files

progress

parent 2612be73
......@@ -13,11 +13,32 @@ let init_def () = ()
let state_id = ref 0
let init_state () = incr state_id;
("s"^(string_of_int !state_id), [])
let draw_state (s,_) p = [
`RoundedRectangle (p,10.0,0.75,5.0);
(*`Rectangle (p,0.5,10.0,0.3);*)
let is_prefix s t =
let n = String.length t in
if String.length s >= n then
if String.sub s 0 n = t then Some (String.sub s n (String.length s-n))
else None
else None
let draw_state (s,at) p =
let draw = ref false
and shape = ref (`Rectangle (p,0.75,7.0,0.0))
and color = ref "black"
and fill = ref "black" in
List.iter (function
"draw" -> draw := true
| "circle" -> shape := `Circle (p,10.0)
| "rounded corners" -> shape := `RoundedRectangle (p,10.0,0.75,5.0)
| at ->
(match is_prefix at "color=" with Some x -> color:=x; |_ ->());
(match is_prefix at "fill=" with Some x -> fill:=x; |_ ->());
) at;
if not !draw then shape := `Circle (p,1.2);
(*`RoundedRectangle (p,10.0,0.75,5.0);*)
[ !shape;
(*`Circle (p,10.0);*)
`Colors ("black","black");
`Colors ("black",!color);
`Text(p,s);
`Colors ("black","white");
]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment