From: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
To: caml list <caml-list@inria.fr>
Subject: [Caml-list] SDL2 bindings, testers and feedback welcome
Date: Tue, 17 Dec 2013 07:11:56 +0100 [thread overview]
Message-ID: <4DDEBB7487B641C0834F09D522EA9918@erratique.ch> (raw)
Hello,
I have written thin bindings to SDL 2 using ocaml-ctypes. The binding
is finished but should be considered unstable: it was not thoroughly
tested and may still change as it has not been *used* yet. The purpose
of this unstable release is to:
1) Iron out the install procedure and test on a variety of platforms.
2) Get feedback about the design of the binding (see below).
More precisely, apart from the eventual bugs, I'm interested in
getting feedback in the following areas:
* I used an 'a result = [ `Error | `Ok of 'a ] rather than an exception
for functions that return error codes/null is error. I tend to lean
on exceptionless designs but I'm still unsure whether it is a good
idea that case. One of the problems is that SDL doesn't make a clear
distinction (at the signature level *and* in the documentation)
between programming errors (invalid_arg), exceptional errors
(e.g. out of memory) and non-exceptional errors (e.g. could not
access/setup a resource).
* The signature/approach of certain binding functions may be disputable
or may need change to achieve reasonable performance.
* Testing the binding to the joystick/game controller/force feedback api,
I have none of these things in my hands.
I welcome discussions/ideas about these points and the general design
of the binding on github's issue tracker (http://github.com/dbuenzli/tsdl)
Note that the philosophy of the binding is to be "thin", that is a
mostly type-safe(r), minimal, hopefully efficient, one-to-one
binding. This means that I'm not interested in prettyfing the C API
like OCamlSDL does. I expect tsdl code to look like C SDL code
(including the inconsistent naming schemes) and the binding to be used
by programmers to build higher-level, more OCaml friendly, abstractions.
To install (only tested on osx and linux so far) you'll need at least SDL 2.0.1
installed on your system. Then:
opam repo add erratique-u http://erratique.ch/software/opam/unreleased
opam update && opam install tsdl
On osx 10.8.5 with OCaml 4.01.0 there's a heisenbug I couldn't track so far
(see [1] for more info). Use 4.00.1 instead for now but note that the binding
takes a long time to compile (~8 min on my machine) with that.
If you want to hack the sources:
git clone http://github.com/dbuenzli/tsdl
cd tsdl && ./build test.native && ./test.native
The documentation of the binding is here:
http://erratique.ch/software/tsdl/doc/Tsdl
Best,
Daniel
[1] http://lists.ocaml.org/pipermail/ctypes/2013-December/000027.html
P.S. If anyone wonders, the existing OCamlSDL is a very good binding
to SDL 1.X, but SDL 2.0 is an entirely new, incompatible, API. Besides
SDL 2.0 changed to a zlib license, tsdl is under BSD3, OCamlSDL is
LGPL.
next reply other threads:[~2013-12-17 6:12 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 6:11 Daniel Bünzli [this message]
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
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=4DDEBB7487B641C0834F09D522EA9918@erratique.ch \
--to=daniel.buenzli@erratique.ch \
--cc=caml-list@inria.fr \
/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).