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