Version française
Home     About     Download     Resources     Contact us    
Browse thread
Building a game loop (sort of)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stas Miasnikou <stas.miasnikou@g...>
Subject: Re: [Caml-list] Building a game loop (sort of)
On 3/21/10, C. Fr <newsgroups.fr@gmail.com> wrote:
> 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?

What are size_x and size_y, what you got, and what you are supposed to get?

> 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?

Stas