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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 60795BBAF for ; Mon, 22 Mar 2010 01:05:00 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoEIAM9QpktKfVM0kWdsb2JhbACBFo4SLYFJghOIAQgVAQEBAQkJDAcRJKoBgWOEE4h5AQEDBYR4BIMciRk X-IronPort-AV: E=Sophos;i="4.51,284,1267398000"; d="scan'208";a="55662123" Received: from mail-gw0-f52.google.com ([74.125.83.52]) by mail1-smtp-roc.national.inria.fr with ESMTP; 22 Mar 2010 01:04:59 +0100 Received: by gwb17 with SMTP id 17so491935gwb.39 for ; Sun, 21 Mar 2010 17:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to :content-type; bh=NMXFau1cLn5aXP+JxtU5Z/nxw+mEnjD4iZtwOKmtx4g=; b=a3PjNPeRrPprhkgwrKiFwMG5pFSseQKQ/5WCKB3Fbil16UYPyV4sOtAZ9/9lH4IPpn 2rco0syy+/QcUOH+lmMNQlcfkUxCdpA3Dgl9tZ1KjKRETIoHErxuBikIFtZo8kK0oyEm ubx39YCtkXlzYYg4gdN7Zs4OIUFF4jgXpvYDU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=bT3Ef/fO3xtI4xPSC1XSqkOU0CZjoQm8455kQRoI/VsTfwc4l5FT/kxjCCf/VFAdLu XM23vtVe/ls2pLubc7Tsp0hbDfbN2zkSAM3em0M4oRaGlLWDcnNEDJjNAFDfCVuM1ygC quWxTbPI8UsQblGlOLBENqS1onstam+RFEMPg= MIME-Version: 1.0 Sender: leafyoung@gmail.com Received: by 10.100.20.12 with SMTP id 12mr14199193ant.188.1269216297156; Sun, 21 Mar 2010 17:04:57 -0700 (PDT) In-Reply-To: <36ae71be1003211426h1aab13f7oc76b4e1ae8d7b386@mail.gmail.com> References: <4ba68bb6.1090cc0a.4f26.ffffcf74@mx.google.com> <36ae71be1003211426h1aab13f7oc76b4e1ae8d7b386@mail.gmail.com> From: Yang Ye Date: Mon, 22 Mar 2010 08:04:37 +0800 X-Google-Sender-Auth: 051088e8f4231a83 Message-ID: <1b3c3eeb1003211704w535a4b66x5fff8109fa80772e@mail.gmail.com> Subject: Re: [Caml-list] Building a game loop (sort of) To: caml-list@yquem.inria.fr Content-Type: multipart/alternative; boundary=0016e6470c8288ff4b04825872a8 X-Spam: no; 0.00; skipping:01 keypresses:01 ocaml:01 'q':01 'o':01 'l':01 'u':01 beginner's:01 ocaml:01 bug:01 skipping:01 keypresses:01 'q':01 'o':01 'l':01 --0016e6470c8288ff4b04825872a8 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable For 2nd question, skipping the outer if? Because read_key is waiting and queuing they keypresses already. On Mon, Mar 22, 2010 at 5:26 AM, Stas Miasnikou w= rote: > On 3/21/10, C. Fr wrote: > > I=92m building a small fractal visualisation app in ocaml, but I encoun= ter > > many problems with the graphics package. > > > > First, plot (size_x / 2) (size_y / 2) doesn=92t actually plot in the mi= ddle > of > > the screen=85 Any idea why? > > What are size_x and size_y, what you got, and what you are supposed to ge= t? > > > 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=85 Is there something that I did wrong? > > Stas > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --=20 Regards, Yang Ye --0016e6470c8288ff4b04825872a8 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable For 2nd question, skipping the outer if? Because read_key is waiting and qu= euing they keypresses already.

On Mon, Ma= r 22, 2010 at 5:26 AM, Stas Miasnikou <stas.miasnikou@gmail.com= > wrote:
On 3/21/10, = C. Fr <newsgroups.fr<= /a>@gmail.com> wrote:=
> I=92m building a small fractal visualisation app in ocaml, but I encou= nter
> many problems with the graphics package.
>
> First, plot (size_x / 2) (size_y / 2) doesn=92t actually plot in the m= iddle of
> the screen=85 Any idea why?

What are size_x and size_y, what you got, and what you are supposed t= o get?

> Then, using the following code
>
> if key_pressed () then
> =A0 =A0 =A0 =A0 begin
> =A0 =A0 =A0 =A0 =A0 =A0 match read_key () with
> =A0 =A0 =A0 =A0 =A0 =A0 | 'q' -> raise Exit
> =A0 =A0 =A0 =A0 =A0 =A0 | 'o' -> scale :=3D !scale *. 2. > =A0 =A0 =A0 =A0 =A0 =A0 | 'i' -> scale :=3D !scale /. 2. > =A0 =A0 =A0 =A0 =A0 =A0 | 'l' -> mid_x :=3D !mid_x + 100 > =A0 =A0 =A0 =A0 =A0 =A0 | 'r' -> mid_x :=3D !mid_x - 100 > =A0 =A0 =A0 =A0 =A0 =A0 | 'u' -> mid_y :=3D !mid_y + 100 > =A0 =A0 =A0 =A0 =A0 =A0 | 'd' -> mid_y :=3D !mid_y - 100 > =A0 =A0 =A0 =A0 =A0 =A0 | _ -> ()
> =A0 =A0 =A0 =A0 end
> =A0 =A0 done;
>
> in a while true loop behaves randomly, ignoring some key presses, and<= br> > repeating some=85 Is there something that I did wrong?

Stas

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



--
Regards,
Yang Ye
--0016e6470c8288ff4b04825872a8--