Hello everyone,

 

I’m building a small fractal visualisation app in ocaml, but I encounter many problems with the graphics package.

 

First, plot (size_x / 2) (size_y / 2) doesn’t actually plot in the middle of the screen… Any idea why?

 

Then, using the following code

 

if key_pressed () then

        begin

            match read_key () with

            | 'q' -> raise Exit

            | 'o' -> scale := !scale *. 2.

            | 'i' -> scale := !scale /. 2.

            | 'l' -> mid_x := !mid_x + 100

            | 'r' -> mid_x := !mid_x - 100

            | 'u' -> mid_y := !mid_y + 100

            | 'd' -> mid_y := !mid_y - 100

            | _ -> ()

        end

    done;

in a while true loop behaves randomly, ignoring some key presses, and repeating some… Is there something that I did wrong?

 

Thanks a lot,

Andrea.