From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA00164; Wed, 28 Aug 2002 22:54:24 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA00122 for caml-list@pauillac.inria.fr; Wed, 28 Aug 2002 22:54:23 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA08838 for ; Wed, 28 Aug 2002 08:04:51 +0200 (MET DST) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g7S64oT28044 for ; Wed, 28 Aug 2002 08:04:50 +0200 (MET DST) Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 17jvvH-0006LB-00 for ; Wed, 28 Aug 2002 08:03:23 +0200 To: caml-list@inria.fr X-Injected-Via-Gmane: http://gmane.org/ Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 17jvvG-0006Km-00 for ; Wed, 28 Aug 2002 08:03:22 +0200 Path: not-for-mail From: "=?iso-8859-15?q?Micha=EBl_Gr=FCnewald?=" Newsgroups: gmane.comp.lang.caml.inria Subject: [Caml-list] Re: Two severe limitations in Graphics module Date: 28 Aug 2002 08:06:42 +0200 Organization: (none) Message-ID: <87u1lfikjx.fsf@ketanu.dyndns.org> References: <20020827203437.GA326@gogol> NNTP-Posting-Host: amontpellier-203-1-1-168.abo.wanadoo.fr Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1030514602 15335 80.13.70.168 (28 Aug 2002 06:03:22 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 28 Aug 2002 06:03:22 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Berke Durak writes: > Hello everyone, > > I was wondering how many hours would coding Tetris using the Graphics > module require when I noticed that the Graphics module lacks two > important constructs : > > 1) The Graphics.wait_next_event doesn't allow you to wait for an event > with a timeout, à la select(). Since in Tetris things might happen > even if you don't press any key, you can't wait indefinitely. > > Workarounds include : > -- continuously calling wait_next_event [Poll;...] and doing a > small delay between each call. I think I will do this. Not very > efficient, since the delay must be of the order of the screen refresh > interval. > -- do a horrible hack by getting the X11 file descriptor -- but > then how will Microsoft-sequestrated people enjoy your delightful > MLtris ? 1/You may have two threads, the first will watch the keyboard (wait_next_event), the second will update puzzle tiles positions, both will send events to your main loop, that will process these events. 2/Why don't use alarm signam or something like ? > 2) There is no way to get the cursor keys. Sure that's no problem to > h,j,k,l-people. Might I suggest the following bindings : > > -- left : '\002' (Ctrl-b) > -- right : '\006' (Ctrl-f) > -- up : '\011' (Ctrl-k) > -- down : '\010' (Ctrl-j) > > or a supplementary keysym type like > > type keysym = Latin1 of char | Left | Right | Up | Down | ... > > 3) It would further be nice to be able to select() another FD plus > the graphical interface, portably if possible. I know, under UNIX, > simply adding a function to the Graphics module that returns the > descriptor of the X11 connection would solve problems 1 and 3. > That would be non portable. > > Has anyone managed to solve these issues cleanly (i.e. without > patching the compiler) ? > -- > Berke > ------------------- > To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr > Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > -- Michaël Grünewald - RSA PGP Key ID: 0x20D90C12 ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners