caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
To: Anthony Tavener <anthony.tavener@gmail.com>
Cc: Erkki Seppala <flux@modeemi.cs.tut.fi>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] SDL2 bindings, testers and feedback welcome
Date: Wed, 18 Dec 2013 10:24:19 +0100	[thread overview]
Message-ID: <24E11676189B4F25A051C7EB1F4E6B6B@erratique.ch> (raw)
In-Reply-To: <CAN=ouMRri6DU_gpHok+VbaZg=nRJYdjiQwAQrsVX3WKt9H9qJQ@mail.gmail.com>

Le mercredi, 18 décembre 2013 à 09:05, Anthony Tavener a écrit :
> Something I'm not so keen on is that event types and event values aren't
> constants I can pattern match on, so I have a lot of "| t when t = "...
>  
> method process_event ev =
> match Sdl.Event.(get ev typ) with  
> | t when t = Sdl.Event.key_down ->
> begin match Sdl.Event.(get ev keyboard_scancode) with
> | t when t = Sdl.Scancode.s -> thrustp <- {thrustp with z = 1.}; true
> | t when t = Sdl.Scancode.w -> thrustn <- {thrustn with z = 1.}; true
>  
> These are matchable constants in sdlcaml.  
Actually that's something in the TODO:

https://github.com/dbuenzli/tsdl/blob/master/TODO.md

I don't think it's useful to convert let's say Sdl.Init enumerants to variants as those are mainly used for setting up state and less likely to be pattern matched upon. But at least functions from Sdl.{scancode,keycode} to an polymorphic variant will be added. Feel free to make your desire more precise in the issue tracker.  

> With Tsdl, the constants are brought in  
> as let-bindings... looks like Daniel has something nifty to make this a lot easier
> but I haven't looked into it yet.

Not so nifty, you still have to enumerate them. A C program outputs them, that's here:

https://github.com/dbuenzli/tsdl/blob/master/support/consts_stub.c
  
> Next is figuring out why my game controller isn't detected, and maybe plugging in
> a joystick and another kind of controller too. First, time for some sleep. :)

Just want to mention that if you are not sure whether the problem lies in the binding or in SDL itself there's a minimal C example with compilation instructions that you can use to try to reproduce the problem in: cd `opam config var tsdl:doc`

Best,

Daniel  



  reply	other threads:[~2013-12-18  9:24 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17  6:11 Daniel Bünzli
2013-12-17  7:02 ` Anthony Tavener
2013-12-17 14:17 ` Florent Monnier
2013-12-17 15:14   ` Daniel Bünzli
2013-12-18  6:54   ` Erkki Seppala
2013-12-18  8:05     ` Anthony Tavener
2013-12-18  9:24       ` Daniel Bünzli [this message]
2013-12-18  8:18     ` Florent Monnier
2013-12-22 10:01       ` Kakadu
2013-12-30 13:28         ` Vu Ngoc San
2013-12-17 17:05 ` Ashish Agarwal
2013-12-17 17:47   ` Daniel Bünzli
2013-12-17 18:57     ` Ashish Agarwal
2013-12-17 19:45       ` Anthony Tavener
2013-12-18 15:40         ` Ashish Agarwal
2013-12-18 18:02           ` Yotam Barnoy
2013-12-18 19:53             ` Daniel Bünzli
2013-12-18 22:29               ` Ashish Agarwal
2013-12-18 22:45                 ` Daniel Bünzli
2013-12-17 20:26       ` Daniel Bünzli
2013-12-18  1:13         ` Francois Berenger
2013-12-18  6:44           ` Erkki Seppala
2013-12-18  9:21           ` Daniel Bünzli
2013-12-19  1:11             ` Florent Monnier
2013-12-19  6:39       ` Florent Monnier
2013-12-17 19:29     ` Erkki Seppala
2013-12-19  5:20 ` Florent Monnier
2013-12-19  5:27   ` Florent Monnier
2013-12-19  7:13   ` Daniel Bünzli
2013-12-19 12:38     ` Florent Monnier
2014-02-12 10:43 ` Daniel Bünzli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24E11676189B4F25A051C7EB1F4E6B6B@erratique.ch \
    --to=daniel.buenzli@erratique.ch \
    --cc=anthony.tavener@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=flux@modeemi.cs.tut.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).