caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Anthony Tavener <anthony.tavener@gmail.com>
To: Erkki Seppala <flux@modeemi.cs.tut.fi>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] SDL2 bindings, testers and feedback welcome
Date: Wed, 18 Dec 2013 01:05:47 -0700	[thread overview]
Message-ID: <CAN=ouMRri6DU_gpHok+VbaZg=nRJYdjiQwAQrsVX3WKt9H9qJQ@mail.gmail.com> (raw)
In-Reply-To: <m49vbymlkdd.fsf@coffee.modeemi.fi>

[-- Attachment #1: Type: text/plain, Size: 1842 bytes --]

On Tue, Dec 17, 2013 at 11:54 PM, Erkki Seppala <flux@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 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.
:)

[-- Attachment #2: Type: text/html, Size: 2859 bytes --]

  reply	other threads:[~2013-12-18  8:05 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 [this message]
2013-12-18  9:24       ` Daniel Bünzli
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='CAN=ouMRri6DU_gpHok+VbaZg=nRJYdjiQwAQrsVX3WKt9H9qJQ@mail.gmail.com' \
    --to=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).