comp.lang.ada
 help / color / mirror / Atom feed
* SDL Bindings?
@ 2013-09-21  4:30 krfkeith
  2013-09-21 16:51 ` Oliver Kleinke
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: krfkeith @ 2013-09-21  4:30 UTC (permalink / raw)


I've done some searches for SDL bindings, however they all seem to be somewhat incomplete. Moreover, they all appear to be of the thin variety. How involved would writing a set of thick bindings for SDL be?

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2013-09-21  4:30 SDL Bindings? krfkeith
@ 2013-09-21 16:51 ` Oliver Kleinke
  2013-09-21 21:59 ` Luke A. Guest
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 24+ messages in thread
From: Oliver Kleinke @ 2013-09-21 16:51 UTC (permalink / raw)


Am Fri, 20 Sep 2013 21:30:07 -0700 (PDT)
schrieb krfkeith@gmail.com:

> I've done some searches for SDL bindings, however they all seem to be
> somewhat incomplete. Moreover, they all appear to be of the thin
> variety. How involved would writing a set of thick bindings for SDL
> be?

Pro tip: Start with a thin binding, you can use that code in your thick
binding later on ...


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2013-09-21  4:30 SDL Bindings? krfkeith
  2013-09-21 16:51 ` Oliver Kleinke
@ 2013-09-21 21:59 ` Luke A. Guest
  2013-09-21 23:24 ` gautier_niouzes
  2013-09-25  0:39 ` krfkeith
  3 siblings, 0 replies; 24+ messages in thread
From: Luke A. Guest @ 2013-09-21 21:59 UTC (permalink / raw)


<krfkeith@gmail.com> wrote:
> I've done some searches for SDL bindings, however they all seem to be
> somewhat incomplete. Moreover, they all appear to be of the thin variety.
> How involved would writing a set of thick bindings for SDL be?

I've bee n thinking about doing this again for a while so I started binding
SDL 2.0 yesterday. It'll be a variable thickness binding.

Luke

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2013-09-21  4:30 SDL Bindings? krfkeith
  2013-09-21 16:51 ` Oliver Kleinke
  2013-09-21 21:59 ` Luke A. Guest
@ 2013-09-21 23:24 ` gautier_niouzes
  2013-09-22  0:29   ` Luke A. Guest
  2013-09-23  5:59   ` krfkeith
  2013-09-25  0:39 ` krfkeith
  3 siblings, 2 replies; 24+ messages in thread
From: gautier_niouzes @ 2013-09-21 23:24 UTC (permalink / raw)


If you are using GNAT, did you consider the SDL bindings that they provide ?
HTH, Gautier


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2013-09-21 23:24 ` gautier_niouzes
@ 2013-09-22  0:29   ` Luke A. Guest
  2013-09-23  5:59   ` krfkeith
  1 sibling, 0 replies; 24+ messages in thread
From: Luke A. Guest @ 2013-09-22  0:29 UTC (permalink / raw)


<gautier_niouzes@hotmail.com> wrote:
> If you are using GNAT, did you consider the SDL bindings that they provide ?
> HTH, Gautier

1) I didn't realise AdaCore provided any, and
2) I wouldn't touch then with yours given their propensity for slapping
pure GPL licences on their libraries.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2013-09-21 23:24 ` gautier_niouzes
  2013-09-22  0:29   ` Luke A. Guest
@ 2013-09-23  5:59   ` krfkeith
  2013-09-24  9:25     ` Marius Amado-Alves
  1 sibling, 1 reply; 24+ messages in thread
From: krfkeith @ 2013-09-23  5:59 UTC (permalink / raw)


Th SDL bindings in GNAT are just cleaned up auto-generated thin bindings.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2013-09-23  5:59   ` krfkeith
@ 2013-09-24  9:25     ` Marius Amado-Alves
  2013-09-25  5:38       ` Thomas Løcke
  0 siblings, 1 reply; 24+ messages in thread
From: Marius Amado-Alves @ 2013-09-24  9:25 UTC (permalink / raw)


On Monday, 23 September 2013 06:59:34 UTC+1, krfk...@gmail.com  wrote:
> Th SDL bindings in GNAT are just cleaned up auto-generated thin bindings.

And they work? If so that's great news for me. I've been looking for a development setup for complex game-like apps with the requirements:

1. main program written in Ada
2. cross platform, from desktop to mobile

From this thread and the web it seems that GNAT + SDL + Agar could be it.

I have considered Qt but the Ada bindings don't seem good enough. They are either at Qt 4, only old desktop GUI style, no mobile style interface, or Qt 5 only for Windows.

I have considered Gtk but it does not seem cross platform enough, and also only old desktop GUI style, no mobile style interface.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2013-09-21  4:30 SDL Bindings? krfkeith
                   ` (2 preceding siblings ...)
  2013-09-21 23:24 ` gautier_niouzes
@ 2013-09-25  0:39 ` krfkeith
  3 siblings, 0 replies; 24+ messages in thread
From: krfkeith @ 2013-09-25  0:39 UTC (permalink / raw)


Marius,

That's an excellent question actually, and I'm not sure. I'd have to do some more research. I *believe* the package is gnat-sdl.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2013-09-24  9:25     ` Marius Amado-Alves
@ 2013-09-25  5:38       ` Thomas Løcke
  2014-01-02 14:32         ` Marius Amado-Alves
  0 siblings, 1 reply; 24+ messages in thread
From: Thomas Løcke @ 2013-09-25  5:38 UTC (permalink / raw)


On 09/24/2013 11:25 AM, Marius Amado-Alves wrote:
>  From this thread and the web it seems that GNAT + SDL + Agar could be it.


I would love to hear from you about your Ada + Agar experience.

Please don't forget to tell the community about how things pan out.  :o)


-- 
Thomas Løcke | thomas@12boo.net | http://12boo.net

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2013-09-25  5:38       ` Thomas Løcke
@ 2014-01-02 14:32         ` Marius Amado-Alves
  2014-01-02 18:29           ` Marius Amado-Alves
  0 siblings, 1 reply; 24+ messages in thread
From: Marius Amado-Alves @ 2014-01-02 14:32 UTC (permalink / raw)


SDL does not have audio input!
Neither does OpenAL or so it seems.
So I'm putting SDL aside for now.
Trying to chose the next thing to try (for audio input):
- RtAudio (pros: is mantained, OO, has audio input; cons: is in C++)
- PortAudio (pros: is in C; cons: not sure it has audio input, unmantained?)
- Gtk (pros: has binding, mantained, OO; cons: not sure it has audio input)
- ...
Any tips appreciated.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-02 14:32         ` Marius Amado-Alves
@ 2014-01-02 18:29           ` Marius Amado-Alves
  2014-01-02 19:04             ` Oliver Kleinke
  0 siblings, 1 reply; 24+ messages in thread
From: Marius Amado-Alves @ 2014-01-02 18:29 UTC (permalink / raw)


Trying RtAudio.
First step is build a C++ test program on the command line.
After many hours joggling the respective black arts, succeeded on Windows with a g++ command and many options. Now theoretically this can be transposed to gnatmake... My plan is to make a C wrapper (around the C++ RtAudio code) that we can bind from Ada using Interfaces.C and company (Ada does not talk to C++, or does she?)

/*
This is not programming:-(
The code, the libraries are there.
Why is it so difficult to integrate these things?
Indeed we still have not met the principal challenge of computer science viz. "How not to make a mess of it" (Dijkstra)
*/


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-02 18:29           ` Marius Amado-Alves
@ 2014-01-02 19:04             ` Oliver Kleinke
  2014-01-03 11:30               ` Marius Amado-Alves
  2014-01-03 12:05               ` Marius Amado-Alves
  0 siblings, 2 replies; 24+ messages in thread
From: Oliver Kleinke @ 2014-01-02 19:04 UTC (permalink / raw)


Am Thu, 2 Jan 2014 10:29:26 -0800 (PST)
schrieb Marius Amado-Alves <amado.alves@gmail.com>:

> Trying RtAudio.
> First step is build a C++ test program on the command line.
> After many hours joggling the respective black arts, succeeded on
> Windows with a g++ command and many options. Now theoretically this
> can be transposed to gnatmake... My plan is to make a C wrapper
> (around the C++ RtAudio code) that we can bind from Ada using
> Interfaces.C and company (Ada does not talk to C++, or does she?)
> 
> /*
> This is not programming:-(
> The code, the libraries are there.
> Why is it so difficult to integrate these things?
> Indeed we still have not met the principal challenge of computer
> science viz. "How not to make a mess of it" (Dijkstra) */

It is indeed possible to bind to C++. Here is a "gem" - [1] - from ACT
that covers the subject. The main issue that makes binding to C++ so
ugly is the name-mangling. Also the difference in the OOP design
(tagged types / packages vs. classes) can make it un-intuitive at times.
Plus, you'll probably need a compiler that supports it. I've only
worked with GNAT, I don't know which other compilers can do it.

If binding is a such a major problem, then honestly, why not just
write your audio-related code in C/C++ and bind to a small set of
functions that you then call from Ada.

--
[1] -
http://www.adacore.com/adaanswers/gems/gem-60-generating-ada-bindings-for-c-headers/

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-02 19:04             ` Oliver Kleinke
@ 2014-01-03 11:30               ` Marius Amado-Alves
  2014-01-03 12:05               ` Marius Amado-Alves
  1 sibling, 0 replies; 24+ messages in thread
From: Marius Amado-Alves @ 2014-01-03 11:30 UTC (permalink / raw)


> It is indeed possible to bind to C++. Here is a "gem" - [1] - from ACT
> that covers the subject...

Thanks. Tried that. Generates illegal code. And skips important entities. Might be usefull to discover some mangled names.

> If binding is a such a major problem, then honestly, why not just
> write your audio-related code in C/C++ and bind to a small set of
> functions that you then call from Ada.

That would be my C around C++ wrapper... Binding is not a problem with the excelent Ada support of C. The black arts is linking, dependencies, compiler options... So if we discover the right incantation, we might as well use that to stay on the Ada side as much as possible.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-02 19:04             ` Oliver Kleinke
  2014-01-03 11:30               ` Marius Amado-Alves
@ 2014-01-03 12:05               ` Marius Amado-Alves
  2014-01-03 13:06                 ` Marius Amado-Alves
  1 sibling, 1 reply; 24+ messages in thread
From: Marius Amado-Alves @ 2014-01-03 12:05 UTC (permalink / raw)


> It is indeed possible to bind to C++. Here is a "gem" - [1] - from ACT 
> that covers the subject... 

Yes, the dump-ada-spec function. Trying that now. Seems to work. 134 packages generated. The main compiles, but seems to be missing a few entities, at least an enum. Will check further.

> If binding is a such a major problem, then honestly, why not just 
> write your audio-related code in C/C++ and bind to a small set of 
> functions that you then call from Ada. 

That would be my C around C++ wrapper... Binding is not a problem with the excelent Ada support of C. The black arts is linking, dependencies, compiler options... So if we discover the right incantation, we might as well use that to stay on the Ada side as much as possible. 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-03 12:05               ` Marius Amado-Alves
@ 2014-01-03 13:06                 ` Marius Amado-Alves
  2014-01-04 11:02                   ` Oliver Kleinke
  0 siblings, 1 reply; 24+ messages in thread
From: Marius Amado-Alves @ 2014-01-03 13:06 UTC (permalink / raw)


> Yes, the dump-ada-spec function. Trying that now. Seems to work.

It doesn't. The result does not compile (I was tricked into thinking it did by GPS somehow). The generated code is illegal. A few faults I could solve by hand. But there are circular dependencies (winnt <--> windef) and other hard or impossible to solve faults.

It might be useful for discovering the mangled names.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-03 13:06                 ` Marius Amado-Alves
@ 2014-01-04 11:02                   ` Oliver Kleinke
  2014-01-04 18:16                     ` Luke A. Guest
  0 siblings, 1 reply; 24+ messages in thread
From: Oliver Kleinke @ 2014-01-04 11:02 UTC (permalink / raw)


Am Fri, 3 Jan 2014 05:06:39 -0800 (PST)
schrieb Marius Amado-Alves <amado.alves@gmail.com>:

> > Yes, the dump-ada-spec function. Trying that now. Seems to work.
> 
> It doesn't. The result does not compile (I was tricked into thinking
> it did by GPS somehow). The generated code is illegal. A few faults I
> could solve by hand. But there are circular dependencies (winnt <-->
> windef) and other hard or impossible to solve faults.
> 
> It might be useful for discovering the mangled names.

Sure it's not a magic bullet. Even for C code -fdump-ada-spec does at
times generate sub-optimal code. You always have to - at the least -
check the generated code or clean it by hand. I Just wanted to give you
a pointer to some example code that shows how the Ada code for binding
to C++ looks like.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-04 11:02                   ` Oliver Kleinke
@ 2014-01-04 18:16                     ` Luke A. Guest
  2014-01-04 18:32                       ` Marius Amado-Alves
  0 siblings, 1 reply; 24+ messages in thread
From: Luke A. Guest @ 2014-01-04 18:16 UTC (permalink / raw)


Oliver Kleinke <oliver.kleinke@c-01a.de> wrote:
> Am Fri, 3 Jan 2014 05:06:39 -0800 (PST)
> schrieb Marius Amado-Alves <amado.alves@gmail.com>:
> 
>>> Yes, the dump-ada-spec function. Trying that now. Seems to work.
>> 
>> It doesn't. The result does not compile (I was tricked into thinking
>> it did by GPS somehow). The generated code is illegal. A few faults I
>> could solve by hand. But there are circular dependencies (winnt <-->
>> windef) and other hard or impossible to solve faults.
>> 
>> It might be useful for discovering the mangled names.
> 
> Sure it's not a magic bullet. Even for C code -fdump-ada-spec does at
> times generate sub-optimal code. You always have to - at the least -
> check the generated code or clean it by hand. I Just wanted to give you
> a pointer to some example code that shows how the Ada code for binding
> to C++ looks like.

You'll never be able to write decent bindings to c++ from Ada due to the
fact that most c++ programmers keep inlining constructors meaning you
either have to reclass everything yourself or know which class' constructor
to call.

It's better to wrap in C and bind to that.

Luke

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-04 18:16                     ` Luke A. Guest
@ 2014-01-04 18:32                       ` Marius Amado-Alves
  2014-01-04 22:12                         ` Luke A. Guest
  2018-08-01 12:54                         ` Marius Amado-Alves
  0 siblings, 2 replies; 24+ messages in thread
From: Marius Amado-Alves @ 2014-01-04 18:32 UTC (permalink / raw)


> It's better to wrap in C and bind to that. (Luke)

Yes, that's what I'm doing. With success:-)

The spec dump is useful to find the mangled names. Oliver I rethank you for reminding us of that tool.

/* I think the mangled names are necessary because the C wrapper around C++ is still C++.  What I do is write free functions with a C signature (prototype) but that inside access the C++ entities.  Then I bind the free functions. */

Thanks all.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-04 18:32                       ` Marius Amado-Alves
@ 2014-01-04 22:12                         ` Luke A. Guest
  2014-01-06  4:10                           ` Lucretia
  2018-08-01 12:54                         ` Marius Amado-Alves
  1 sibling, 1 reply; 24+ messages in thread
From: Luke A. Guest @ 2014-01-04 22:12 UTC (permalink / raw)


Marius Amado-Alves <amado.alves@gmail.com> wrote:
>> It's better to wrap in C and bind to that. (Luke)
> 
> Yes, that's what I'm doing. With success:-)
> 
> The spec dump is useful to find the mangled names. Oliver I rethank you
> for reminding us of that tool.
> 
> /* I think the mangled names are necessary because the C wrapper around
> C++ is still C++.  What I do is write free functions with a C signature
> (prototype) but that inside access the C++ entities.  Then I bind the free functions. */
> 
> Thanks all.

External "c" {}


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-04 22:12                         ` Luke A. Guest
@ 2014-01-06  4:10                           ` Lucretia
  0 siblings, 0 replies; 24+ messages in thread
From: Lucretia @ 2014-01-06  4:10 UTC (permalink / raw)


> External "c" {}


That should've been:

extern "C" {
  ... C++ as C functions crap in here ...
};

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2014-01-04 18:32                       ` Marius Amado-Alves
  2014-01-04 22:12                         ` Luke A. Guest
@ 2018-08-01 12:54                         ` Marius Amado-Alves
  2018-08-01 15:11                           ` Jacob Sparre Andersen
  2018-08-01 21:49                           ` Lucretia
  1 sibling, 2 replies; 24+ messages in thread
From: Marius Amado-Alves @ 2018-08-01 12:54 UTC (permalink / raw)


I wish I could replicate my own purported success binding quirky audio libraries four years ago. Different project, different company now.

Anyway, has there by any chance appeared a new Ada-friendly audio library in the meantime? Thanks.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2018-08-01 12:54                         ` Marius Amado-Alves
@ 2018-08-01 15:11                           ` Jacob Sparre Andersen
  2018-08-01 21:49                           ` Lucretia
  1 sibling, 0 replies; 24+ messages in thread
From: Jacob Sparre Andersen @ 2018-08-01 15:11 UTC (permalink / raw)


Marius Amado-Alves <amado.alves@gmail.com> writes:

> Anyway, has there by any chance appeared a new Ada-friendly audio
> library in the meantime? Thanks.

What do you need?  There's a bit here:

   https://bitbucket.org/sparre/alsa-binding

Greetings,

Jacob
-- 
"It's not a question of whose habitat it is,
 it's a question of how fast you hit it."


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2018-08-01 12:54                         ` Marius Amado-Alves
  2018-08-01 15:11                           ` Jacob Sparre Andersen
@ 2018-08-01 21:49                           ` Lucretia
  2018-08-02 14:44                             ` Marius Amado-Alves
  1 sibling, 1 reply; 24+ messages in thread
From: Lucretia @ 2018-08-01 21:49 UTC (permalink / raw)


On Wednesday, 1 August 2018 13:54:25 UTC+1, Marius Amado-Alves  wrote:
> I wish I could replicate my own purported success binding quirky audio libraries four years ago. Different project, different company now.
> 
> Anyway, has there by any chance appeared a new Ada-friendly audio library in the meantime? Thanks.

Do you mean something like FMOD or WWise?

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: SDL Bindings?
  2018-08-01 21:49                           ` Lucretia
@ 2018-08-02 14:44                             ` Marius Amado-Alves
  0 siblings, 0 replies; 24+ messages in thread
From: Marius Amado-Alves @ 2018-08-02 14:44 UTC (permalink / raw)


Looking for an Ada library/binding for sound input/output on a desktop computer. Multiplatform ideal (RTaudio), but only Windows OK too (so, it can be based on win32). But the thicker the better.
Thanks.

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2018-08-02 14:44 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-21  4:30 SDL Bindings? krfkeith
2013-09-21 16:51 ` Oliver Kleinke
2013-09-21 21:59 ` Luke A. Guest
2013-09-21 23:24 ` gautier_niouzes
2013-09-22  0:29   ` Luke A. Guest
2013-09-23  5:59   ` krfkeith
2013-09-24  9:25     ` Marius Amado-Alves
2013-09-25  5:38       ` Thomas Løcke
2014-01-02 14:32         ` Marius Amado-Alves
2014-01-02 18:29           ` Marius Amado-Alves
2014-01-02 19:04             ` Oliver Kleinke
2014-01-03 11:30               ` Marius Amado-Alves
2014-01-03 12:05               ` Marius Amado-Alves
2014-01-03 13:06                 ` Marius Amado-Alves
2014-01-04 11:02                   ` Oliver Kleinke
2014-01-04 18:16                     ` Luke A. Guest
2014-01-04 18:32                       ` Marius Amado-Alves
2014-01-04 22:12                         ` Luke A. Guest
2014-01-06  4:10                           ` Lucretia
2018-08-01 12:54                         ` Marius Amado-Alves
2018-08-01 15:11                           ` Jacob Sparre Andersen
2018-08-01 21:49                           ` Lucretia
2018-08-02 14:44                             ` Marius Amado-Alves
2013-09-25  0:39 ` krfkeith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox