Hello,

Thanks for your answers ! I have multiple remarks here :

1) I know that SDL2 should not be used "as is" in Pharo and I should use OSWindow instead, that's why I won't use SDL2 directly anymore.

2) But for the moment OSWindow uses SDL2 anyway so for experimentation purposes I will try to see what's wrong with my code.
The example you linked Nicolai is working indeed and this is more or less what I did too. I included my code with this e-mail so maybe you can have a better understanding (I am sorry but I didn't comment it :s). Note that for it to work you need to add the SDL_image library and all its plugins (for handling jpeg, png etc.) and add the following method to the image :

SDL_Renderer >> createTextureFromFile: file
������ <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode>
������ ^ self
������ ������ nbCall: #( SDL_Texture IMG_LoadTexture ( self , String file ) )
������ ������ module: 'SDL_Image.dll'������

You can launch the game by executing "MyGame new startGame"

On my computer (which is probably not the fastest I must admit) running it with a fork slows the whole operating system.

3) Another problem I had lately : I tried to use Pharo with linux (ubuntu 14.04.2 LTS) and Pharo just can't find the SDL library.
I downloaded SDL source code and compiled it so i got the libSDL2-2.0.so.0.2.1 exactly as in the SDL2 class >> findSDL2 method.
I tried to put it everywhere (in the "shared" and "bin" folder of Pharo and even at the root. I tried in /usr/lib/, in /usr/lib32/, in /usr/lib/x86_64-linux-gnu etc. and Pharo can never find it.
Could it be that I compiled it for 64bits (my ubuntu is 64 bits) and Pharo does not support it so I should recompile it for 32 bits ?

Thanks you all !

Matthieu


2015-04-20 1:57 GMT+02:00 Alexandre Bergel <alexandre.bergel@me.com>:
Hi Matthieu,

This is important: Binding SDL with Pharo will help Roassal to get better.
Please, let us know how it goes

Alexandre


> On Apr 9, 2015, at 12:54 PM, Matthieu Lacaton <matthieu.lacaton@gmail.com> wrote:
>
> Hello everyone,
>
> I tried to use the SDL2 binding to Pharo to create a very basic 2D application (just some sprites and events) and it worked great.
> The issue I have is that when I start my application, as long as I have an active SDL window, I can't use my Pharo image anymore (it freezes).
> To solve this problem I tried opening my application in another thread by doing so :
> [ (MyApplication new) start. ] forkAt: Processor lowestPriority. (If I don't chose a low priority it changes nothing)
>
> The problem is that even if it kind of works, it is really slow and it slows my whole operating system as well (I use windows XP)
>
> How can I fork more efficiently or open a SDL window without losing control of my image ?
>
> Thanks,
>
> Matthieu

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel�� http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.