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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id BA717BBAF for ; Sun, 21 Mar 2010 22:12:39 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwFAAAppkvRVdrhkGdsb2JhbACBQo9cgSNwiAEIFQEBAQEJCQwHEwMfqRiBY4QZLohLAQEDBYR4BA X-IronPort-AV: E=Sophos;i="4.51,284,1267398000"; d="scan'208,217";a="59457290" Received: from mail-bw0-f225.google.com ([209.85.218.225]) by mail4-smtp-sop.national.inria.fr with ESMTP; 21 Mar 2010 22:12:25 +0100 Received: by bwz25 with SMTP id 25so3271309bwz.8 for ; Sun, 21 Mar 2010 14:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:mime-version:content-type:x-mailer:thread-index :content-language; bh=ejvOhg9HSgISeAugUe7FsTCBPNG6tZuQGKN4Jb0y7kM=; b=FMcyFcZWD0txmB826NomwAh28kw/XAVH5qkcI8jRatw66uGc4eFHO6mXPW2EJarpP/ 7bUylMmu2NwCSdVFQvlds8y/HpmuYOL7cziWv8aO5Y/TbBx5KthK83xkUKWIkGiAFIjr 59kyoPbJn96uEk1iyzZjRGnNw2ETLL/xgC/Dk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:mime-version:content-type:x-mailer :thread-index:content-language; b=vlXYBy8BWB8GI/0TwogRGIUnI6oT6UnwsnBM0ZjOWZOLi13Cd150JkjHvGq4taxIU/ LbrNGqMZV/bvbbd4ZtNoG5tifssYepj0TyHYE/gCXWGIbgsntR0ejGI2/hDew0Nf9we7 7coeg1PTPv/anCdnX9v1X58MNjUn9MgCxlnbg= Received: by 10.204.131.85 with SMTP id w21mr3909752bks.174.1269205944369; Sun, 21 Mar 2010 14:12:24 -0700 (PDT) Received: from Blabla (ip-247.net-81-220-136.rev.numericable.fr [81.220.136.247]) by mx.google.com with ESMTPS id x16sm16362216bku.5.2010.03.21.14.12.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 21 Mar 2010 14:12:22 -0700 (PDT) From: "C. Fr" To: Subject: Building a game loop (sort of) Date: Sun, 21 Mar 2010 22:12:20 +0100 Message-ID: <4ba68bb6.1090cc0a.4f26.ffffcf74@mx.google.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0004_01CAC943.94794DD0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcrJOzGgNd58C1FwTYa34RF+IQAXjw== Content-Language: fr X-Spam: no; 0.00; ocaml:01 'q':01 'o':01 'l':01 'u':01 ocaml:01 'q':01 'o':01 'l':01 'u':01 iym:98 mid:98 mid:98 behaves:02 behaves:02 This is a multi-part message in MIME format. ------=_NextPart_000_0004_01CAC943.94794DD0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello everyone, =20 I=92m building a small fractal visualisation app in ocaml, but I = encounter many problems with the graphics package. =20 First, plot (size_x / 2) (size_y / 2) doesn=92t actually plot in the = middle of the screen=85 Any idea why? =20 Then, using the following code =20 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? =20 Thanks a lot, Andrea. =20 =20 =20 =20 ------=_NextPart_000_0004_01CAC943.94794DD0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hello everyone,

 <= /o:p>

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

 <= /o:p>

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

 <= /o:p>

Then, using the following code

 <= /o:p>

if key_pressed () then

=A0=A0=A0=A0=A0=A0=A0 begin

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 match read_key () with

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 | 'q' = -> raise Exit

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

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

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 | 'l' -> mid_x :=3D !mid_x + 100

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 | 'r' -> mid_x :=3D !mid_x - 100

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 | 'u' -> mid_y :=3D !mid_y + 100

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 | 'd' -> mid_y :=3D !mid_y - 100

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 | _ -> ()

=A0=A0=A0=A0=A0=A0=A0 end

=A0=A0=A0 done;

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

 <= /o:p>

Thanks a lot,

Andrea.=

 <= /o:p>

 <= /o:p>

 <= /o:p>

 

------=_NextPart_000_0004_01CAC943.94794DD0-- 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 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--