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. :)