From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id BF94EBBAF for ; Sun, 21 Mar 2010 22:26:52 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjICAAIspkvRVdvhkGdsb2JhbACDCY4VihQIFQEBAQEJCQwHEwMfqGs3gWOEGS6ISwEBAwWBJ4JnagQ X-IronPort-AV: E=Sophos;i="4.51,284,1267398000"; d="scan'208";a="47241466" Received: from mail-ew0-f225.google.com ([209.85.219.225]) by mail3-smtp-sop.national.inria.fr with ESMTP; 21 Mar 2010 22:26:52 +0100 Received: by ewy25 with SMTP id 25so1365780ewy.7 for ; Sun, 21 Mar 2010 14:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=CskfUzBj+qXW/x69XQY6OSUmHxKHrvnU/LSN6n1uDiQ=; b=fseUxCVy+IDsYdOkwtAXiSzWpjf8IUi4WNzznAlmPsqtfAYBwSVez3bJR1GiQW+3x7 iJa4mY/gtmcTvP5c/F0lFwacZwhjnA03YosGz2SFVW8IuXBm7UkMfCDqTu7HfCpy7gkP OQ2DCgialoUmElHLvwgtcDeKTReDKNGfeRojY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=iivJNs4KMQEaseWh8TSUeTXh6n62plz8HEuQv+lFE4NptKSwt/aCzKiXsWPV3Xh5cd O1RWSqsNf3ZTcoV6UyrhxPkfJzRo2ricz+LFUbZPYMkLiIfr5KSV9vQ1NLi+bCYDBLq7 Baw7RKa3YHY0s5jl6gUbOHdP9xfRnNihX1ZGA= MIME-Version: 1.0 Received: by 10.213.34.5 with HTTP; Sun, 21 Mar 2010 14:26:51 -0700 (PDT) In-Reply-To: <4ba68bb6.1090cc0a.4f26.ffffcf74@mx.google.com> References: <4ba68bb6.1090cc0a.4f26.ffffcf74@mx.google.com> Date: Sun, 21 Mar 2010 23:26:51 +0200 Received: by 10.213.1.215 with SMTP id 23mr2417568ebg.52.1269206811442; Sun, 21 Mar 2010 14:26:51 -0700 (PDT) Message-ID: <36ae71be1003211426h1aab13f7oc76b4e1ae8d7b386@mail.gmail.com> Subject: Re: [Caml-list] Building a game loop (sort of) From: Stas Miasnikou To: "C. Fr" Cc: caml-list@yquem.inria.fr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; ocaml:01 'q':01 'o':01 'l':01 'u':01 10,:98 wrote:01 caml-list:01 mid:98 mid:98 behaves:02 match:02 graphics:02 raise:03 'd':04 On 3/21/10, C. Fr wrote: > I=E2=80=99m building a small fractal visualisation app in ocaml, but I en= counter > many problems with the graphics package. > > First, plot (size_x / 2) (size_y / 2) doesn=E2=80=99t actually plot in th= e middle of > the screen=E2=80=A6 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 :=3D !scale *. 2. > | 'i' -> scale :=3D !scale /. 2. > | 'l' -> mid_x :=3D !mid_x + 100 > | 'r' -> mid_x :=3D !mid_x - 100 > | 'u' -> mid_y :=3D !mid_y + 100 > | 'd' -> mid_y :=3D !mid_y - 100 > | _ -> () > end > done; > > in a while true loop behaves randomly, ignoring some key presses, and > repeating some=E2=80=A6 Is there something that I did wrong? Stas