From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 6C5DC7EC6E for ; Wed, 18 Dec 2013 09:05:48 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of anthony.tavener@gmail.com) identity=pra; client-ip=209.85.215.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="anthony.tavener@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of anthony.tavener@gmail.com designates 209.85.215.173 as permitted sender) identity=mailfrom; client-ip=209.85.215.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="anthony.tavener@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ea0-f173.google.com) identity=helo; client-ip=209.85.215.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="postmaster@mail-ea0-f173.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AswBAFFWsVLRVdetm2dsb2JhbABZhBe4cIELCBYOAQEBAQEGCxQUKIIlAQEBAwEnGQEbHQEDDAYFBAcDOCIBEQEFARwGE4dvAQMJCKRfjFqDCY1GChknDWSGGBEBBQyPBgeENgSJQ45TkCcYKYR3HA X-IPAS-Result: AswBAFFWsVLRVdetm2dsb2JhbABZhBe4cIELCBYOAQEBAQEGCxQUKIIlAQEBAwEnGQEbHQEDDAYFBAcDOCIBEQEFARwGE4dvAQMJCKRfjFqDCY1GChknDWSGGBEBBQyPBgeENgSJQ45TkCcYKYR3HA X-IronPort-AV: E=Sophos;i="4.95,506,1384297200"; d="scan'208";a="49488298" Received: from mail-ea0-f173.google.com ([209.85.215.173]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 18 Dec 2013 09:05:48 +0100 Received: by mail-ea0-f173.google.com with SMTP id o10so3354563eaj.32 for ; Wed, 18 Dec 2013 00:05:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ADvKMtWham8lxHta2g/jieXgiy7WVqPbkhBiJYva9wk=; b=R7co8EGvUBDHotP+IWw76P3rLEB6AHmyREbjVb6JIYCNRfqXMZh5VY3AC54E0FqQka siqfsjUgShzh80pYKbxd6ZPUeSoZv0/rHA1MwI6rpeK/3/hwDQGsrW2Gu0RfIvO9R2t7 67g4SouDFW50zz/XAWXMudLjjX7jeN7clM/+AKLSg6XoxZC7Qty5eA3dFMEzKOpQf0df n0+nC+Pkp7+QV8pZqVAhF8BraDczj+jJNNVhLI8tI4xzRiI6GbiaBCMQDJBsuWsjoKRe ZVhujqIejijaG6C42dUiIf2y3KlabBwj06rl6oEoFCWdCI9fwQoxLBAd0LDBXo/IhNIi 3/cw== MIME-Version: 1.0 X-Received: by 10.15.74.200 with SMTP id j48mr18993603eey.102.1387353947472; Wed, 18 Dec 2013 00:05:47 -0800 (PST) Received: by 10.15.90.202 with HTTP; Wed, 18 Dec 2013 00:05:47 -0800 (PST) In-Reply-To: References: <4DDEBB7487B641C0834F09D522EA9918@erratique.ch> Date: Wed, 18 Dec 2013 01:05:47 -0700 Message-ID: From: Anthony Tavener To: Erkki Seppala Cc: caml-list@yquem.inria.fr Content-Type: multipart/alternative; boundary=001a11c37d383785ec04edca83fd Subject: Re: [Caml-list] SDL2 bindings, testers and feedback welcome --001a11c37d383785ec04edca83fd Content-Type: text/plain; charset=ISO-8859-1 On Tue, Dec 17, 2013 at 11:54 PM, Erkki Seppala wrote: > > Well, I think that it may be a bit unrealistic to expect this kind of > fork to get very popular. I think in most common SDL use cases people > just don't care much about errors :(. (Ie. games: either work or they > don't.) > I care about errors, but in practice the only functions I use which have errors of concern are during initialization. Once system resources are acquired, I'm mostly reading events and swapping buffers. I'm translating a smaller project (mostly works, but for some reason my controller is not detected, so far -- works with sdlcaml/SDL1.2). Admittedly, dealing with `Error | `Ok was a bit annoying. A lot of functions I really don't care much (getting device names), so an abstraction which assigns on `Ok, or defaults on `Error is fine. 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. 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. Summary of parts tested and working for me: -window with opengl context -event handling: mouse and keyboard -grabbing and hiding cursor, also release and show 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. :) --001a11c37d383785ec04edca83fd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Tue, Dec 17, 2013 at 11:54 PM, Erkki Seppala <fl= ux@modeemi.cs.tut.fi> wrote:

Well, I think that it may be a= bit unrealistic to expect this kind of
fork to get very popular. I think in most common SDL use cases people
just don't care much about errors :(. (Ie. games: either work or they don't.)

I care about errors, = but in practice the only functions I use which have errors
= of concern are during initialization. Once system resources are acquired, I= 'm
mostly reading events and swapping buffers.

=
I'm translating a smaller project (mostly works, but f= or some reason my controller
is not detected, so far -- wor= ks with sdlcaml/SDL1.2). Admittedly, dealing with
`Error | `Ok was a bit annoying. A lot of functions I really don= 't care much (getting
device names), so an abstraction = which assigns on `Ok, or defaults on `Error is
fine.

Something I'm not so keen on is that ev= ent types and event values aren't
constants I can patte= rn match on, so I have a lot of "| t when t =3D "...

=A0 method process_event ev =3D
=A0 =A0= match Sdl.Event.(get ev typ) with=A0
=A0 =A0 | t when t =3D Sdl.= Event.key_down ->
=A0 =A0 =A0 begin match Sdl.Event.(get ev ke= yboard_scancode) with
=A0 =A0 =A0 =A0 | t when t =3D Sdl.Scancode.s -> thrustp <- {thr= ustp with z =3D 1.}; true
=A0 =A0 =A0 =A0 | t when t =3D Sdl.Scan= code.w -> thrustn <- {thrustn with z =3D 1.}; true

These are matchable constants in sdlcaml. With Tsdl, the const= ants 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.


Summary of parts te= sted and working for me:
=A0-window with opengl context
=A0-event handlin= g: mouse and keyboard
=A0-grabbing and hiding cursor, also = release and show

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 s= ome sleep. :)

--001a11c37d383785ec04edca83fd--