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
Hi Matthieu 2015-04-09 17:54 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com>:
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
This is a simple example based on the existing SDL2Example>>simpleDrawDisplay simpleDrawDisplay2 " self new simpleDrawDisplay2 " | window renderer texture | "Create the window and the renderer." SDL2 initVideo. window := SDL2 createWindow: 'Test Window' x: SDL_WINDOWPOS_UNDEFINED y: SDL_WINDOWPOS_UNDEFINED width: Display extent x height: Display extent y flags: SDL_WINDOW_SHOWN. renderer := window createDefaultRenderer. "Create the texture" texture := renderer createTextureFormat: SDL_PIXELFORMAT_XRGB8888 access: SDL_TEXTUREACCESS_STREAMING width: Display width height: Display height. 1000 timesRepeat: [ texture updateTexturePixels: Display bits pitch: Display width * 4. "Render" renderer copy: texture; present. 20 milliSeconds wait ]. "Quit" texture destroy. renderer destroy. window destroy Note, there is no call to SDL "delay" You can start this example with [SDL2Example simpleDrawDisplay2] fork Before you start this example, change the main window to half of your display screen, that way you can see both screens, the main vm and the "mirror" with SDL. nicolai
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 ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
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 ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com>:
Hello, ... 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 ?
Yes.
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 ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com>:
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.
On windows there is currently an issue if you use OSWindow instead of directly use SDL. If you create a window with OSWindow, (like in the SDL2Example>>osWindow) you will loose all "keystroke" events in the main pharo window. I don't know yet why this happens. nicolai
Hello, We donât lose all keystroke events, but they are replaced by keydown events. Merwan De : Nicolai Hess Envoyé : âlundiâ â20â âavrilâ â2015 â09â:â36 à : Any question about pharo is welcome; Esteban Lorenzano 2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com>: 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. On windows there is currently an issue if you use OSWindow instead of directly use SDL. If you create a window with OSWindow, (like in the SDL2Example>>osWindow) you will loose all "keystroke" events in the main pharo window. I don't know yet why this happens. nicolai
2015-04-20 13:13 GMT+02:00 <merwanouddane@gmail.com>:
Hello,
We donât lose all keystroke events, but they are replaced by keydown events.
Yes, KeyDown/KeyUp are working and instead of a keystroke event another keydown is sent. This is strange, I don't know exactly how the SDL event processing can influence the main window events. Maybe this has something to do how we look for new events in the SDL2DisplayPlugin. For me the call to SDL_PumpEvents looks unnecessary, maybe this is the cause? nicolai
Merwan
*De :* Nicolai Hess *Envoyé :* âlundiâ â20â âavrilâ â2015 â09â:â36 *à :* Any question about pharo is welcome; Esteban Lorenzano
2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com>:
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.
On windows there is currently an issue if you use OSWindow instead of directly use SDL. If you create a window with OSWindow, (like in the SDL2Example>>osWindow) you will loose all "keystroke" events in the main pharo window. I don't know yet why this happens.
nicolai
Hi, I just committed my prototype/experiment for windows with OSWindow, SDL2 and Athens. to check them: Gofer it smalltalkhubUser: 'Pharo' project: 'OSWindow'; package: 'OSWindow-Core'; package: 'OSWindow-SDL2'; package: 'OSWindow-SDL2-Canvases'; load. and check the examples at: OSSDLAthensWindow OSSDLMorphWindow cheers, Esteban
On 20 Apr 2015, at 13:55, Nicolai Hess <nicolaihess@web.de> wrote:
2015-04-20 13:13 GMT+02:00 <merwanouddane@gmail.com <mailto:merwanouddane@gmail.com>>: Hello,
We donât lose all keystroke events, but they are replaced by keydown events.
Yes, KeyDown/KeyUp are working and instead of a keystroke event another keydown is sent. This is strange, I don't know exactly how the SDL event processing can influence the main window events. Maybe this has something to do how we look for new events in the SDL2DisplayPlugin. For me the call to SDL_PumpEvents looks unnecessary, maybe this is the cause?
nicolai
Merwan
De : Nicolai Hess Envoyé : âlundiâ â20â âavrilâ â2015 â09â:â36 à : Any question about pharo is welcome; Esteban Lorenzano
2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com <mailto:matthieu.lacaton@gmail.com>>: 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.
On windows there is currently an issue if you use OSWindow instead of directly use SDL. If you create a window with OSWindow, (like in the SDL2Example>>osWindow) you will loose all "keystroke" events in the main pharo window. I don't know yet why this happens.
nicolai
2015-04-20 14:20 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
Hi,
I just committed my prototype/experiment for windows with OSWindow, SDL2 and Athens. to check them:
Gofer it smalltalkhubUser: 'Pharo' project: 'OSWindow'; package: 'OSWindow-Core'; package: 'OSWindow-SDL2'; package: 'OSWindow-SDL2-Canvases'; load.
and check the examples at:
OSSDLAthensWindow OSSDLMorphWindow
Great! Although the VM crashes sometimes (after closing the SDL-Window) And I know found out why the window is partly out of the screen (on Windows7, don't think this happens on linux/mac): If you open a SDL window with SDL createWindow: title x: 0 y: 0 .... The window opens at 0@0 but this is the upper left corner of the window rectangle *without* window decoration. If you open the window with SDL createWindow: title x: SDL_WINDOWPOS_UNDEFINED .... -> the full window is visible nicolai
cheers, Esteban
On 20 Apr 2015, at 13:55, Nicolai Hess <nicolaihess@web.de> wrote:
2015-04-20 13:13 GMT+02:00 <merwanouddane@gmail.com>:
Hello,
We donât lose all keystroke events, but they are replaced by keydown events.
Yes, KeyDown/KeyUp are working and instead of a keystroke event another keydown is sent. This is strange, I don't know exactly how the SDL event processing can influence the main window events. Maybe this has something to do how we look for new events in the SDL2DisplayPlugin. For me the call to SDL_PumpEvents looks unnecessary, maybe this is the cause?
nicolai
Merwan
*De :* Nicolai Hess *Envoyé :* âlundiâ â20â âavrilâ â2015 â09â:â36 *à :* Any question about pharo is welcome; Esteban Lorenzano
2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com>:
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.
On windows there is currently an issue if you use OSWindow instead of directly use SDL. If you create a window with OSWindow, (like in the SDL2Example>>osWindow) you will loose all "keystroke" events in the main pharo window. I don't know yet why this happens.
nicolai
On 20 Apr 2015, at 23:30, Nicolai Hess <nicolaihess@web.de> wrote:
2015-04-20 14:20 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com <mailto:estebanlm@gmail.com>>: Hi,
I just committed my prototype/experiment for windows with OSWindow, SDL2 and Athens. to check them:
Gofer it smalltalkhubUser: 'Pharo' project: 'OSWindow'; package: 'OSWindow-Core'; package: 'OSWindow-SDL2'; package: 'OSWindow-SDL2-Canvases'; load.
and check the examples at:
OSSDLAthensWindow OSSDLMorphWindow
Great!
Although the VM crashes sometimes (after closing the SDL-Window) well⦠I said is still a prototype :P
And I know found out why the window is partly out of the screen (on Windows7, don't think this happens on linux/mac): If you open a SDL window with
SDL createWindow: title x: 0 y: 0 .... The window opens at 0@0 but this is the upper left corner of the window rectangle *without* window decoration.
If you open the window with SDL createWindow: title x: SDL_WINDOWPOS_UNDEFINED .... -> the full window is visible
Yeah, Iâm not a windows user and this kind of stupid errors will arise time to time.. But I will try to fix them as they come :) cheers, Esteban
nicolai
cheers, Esteban
On 20 Apr 2015, at 13:55, Nicolai Hess <nicolaihess@web.de <mailto:nicolaihess@web.de>> wrote:
2015-04-20 13:13 GMT+02:00 <merwanouddane@gmail.com <mailto:merwanouddane@gmail.com>>: Hello,
We donât lose all keystroke events, but they are replaced by keydown events.
Yes, KeyDown/KeyUp are working and instead of a keystroke event another keydown is sent. This is strange, I don't know exactly how the SDL event processing can influence the main window events. Maybe this has something to do how we look for new events in the SDL2DisplayPlugin. For me the call to SDL_PumpEvents looks unnecessary, maybe this is the cause?
nicolai
Merwan
De : Nicolai Hess Envoyé : âlundiâ â20â âavrilâ â2015 â09â:â36 à : Any question about pharo is welcome; Esteban Lorenzano
2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com <mailto:matthieu.lacaton@gmail.com>>: 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.
On windows there is currently an issue if you use OSWindow instead of directly use SDL. If you create a window with OSWindow, (like in the SDL2Example>>osWindow) you will loose all "keystroke" events in the main pharo window. I don't know yet why this happens.
nicolai
EstebanLM wrote
I just committed my prototype/experiment for windows with OSWindow, SDL2 and Athens.
I got an error because my VM (via Launcher 0.2.4 - I can't upgrade due to a previously-reported error) doesn't have SDL2. I guess Launcher is using stable from 9/2014. How stable is VM latest? If I inject it into my current Launcher, will it be okay for general use? ----- Cheers, Sean -- View this message in context: http://forum.world.st/SDL2-and-fork-tp4818623p4820732.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Sean P. DeNigris wrote
VM latest
That's odd... I opened the image with the latest VM and still got "Error: Failed to find SDL2 library" even though I can see libSDL2-2.0.0.dylib in the Plugins folder ----- Cheers, Sean -- View this message in context: http://forum.world.st/SDL2-and-fork-tp4818623p4820733.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 21 Apr 2015, at 02:12, Sean P. DeNigris <sean@clipperadams.com> wrote:
Sean P. DeNigris wrote
VM latest
That's odd... I opened the image with the latest VM and still got "Error: Failed to find SDL2 library" even though I can see libSDL2-2.0.0.dylib in the Plugins folder
it should be ok⦠at least is ok in my mac with stable vm (stable vm is from march 25 so it will be no difference between stable and latest right now). maybe something to do with launcher? cheers, Esteban
----- Cheers, Sean -- View this message in context: http://forum.world.st/SDL2-and-fork-tp4818623p4820733.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
#40609 + latest VM + 40 sources - works on OS X 10.9.5 - can't find SDL2 library on OS X 10.8.5 ----- Cheers, Sean -- View this message in context: http://forum.world.st/SDL2-and-fork-tp4818623p4820797.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
EstebanLM wrote
stable vm is from march 25 so it will be no difference between stable and latest right now
In http://files.pharo.org/vm/pharo/mac/ : Stable: 1. stable.zip 9/2014 2. stable-20150325.zip 3/2015 3. stable-20150403.zip 4/15 4. Pharo-VM-mac-stable.zip one day earlier than #1 Latest: luckly things are a bit more straightforward here. Only Pharo-VM-mac-latest.zip and latest.zip, both with 4/9/2015, but not matching any of the dates from stable. ----- Cheers, Sean -- View this message in context: http://forum.world.st/SDL2-and-fork-tp4818623p4820798.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 21 Apr 2015, at 13:22, Sean P. DeNigris <sean@clipperadams.com> wrote:
EstebanLM wrote
stable vm is from march 25 so it will be no difference between stable and latest right now
In http://files.pharo.org/vm/pharo/mac/ :
Stable: 1. stable.zip 9/2014 2. stable-20150325.zip 3/2015 3. stable-20150403.zip 4/15 4. Pharo-VM-mac-stable.zip one day earlier than #1
you are taking wrong folders :) check at /get-files/50 /get-files/40 that points to the âblessedâ ones. also⦠âstableâ does not has sense anymore, they are there for backward compatibility. Now we use âstable-YYYYMMDDâ format meaning we declared it stable that day⦠and then we point consolidated versions (/get-files/etc.) to the appropriate one. Esteban
Latest: luckly things are a bit more straightforward here. Only Pharo-VM-mac-latest.zip and latest.zip, both with 4/9/2015, but not matching any of the dates from stable.
----- Cheers, Sean -- View this message in context: http://forum.world.st/SDL2-and-fork-tp4818623p4820798.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Cool work...!.. * The x: 50 y: 50 initial point, on windows enables display of the title bar, otherwise hidden * The VM crashes on exampleTiger demo with Athens, resize and click close... sometimes in other scenario's. On Mon, Apr 20, 2015 at 5:50 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
Hi,
I just committed my prototype/experiment for windows with OSWindow, SDL2 and Athens. to check them:
Gofer it smalltalkhubUser: 'Pharo' project: 'OSWindow'; package: 'OSWindow-Core'; package: 'OSWindow-SDL2'; package: 'OSWindow-SDL2-Canvases'; load.
and check the examples at:
OSSDLAthensWindow OSSDLMorphWindow
cheers, Esteban
On 20 Apr 2015, at 13:55, Nicolai Hess <nicolaihess@web.de> wrote:
2015-04-20 13:13 GMT+02:00 <merwanouddane@gmail.com>:
Hello,
We donât lose all keystroke events, but they are replaced by keydown events.
Yes, KeyDown/KeyUp are working and instead of a keystroke event another keydown is sent. This is strange, I don't know exactly how the SDL event processing can influence the main window events. Maybe this has something to do how we look for new events in the SDL2DisplayPlugin. For me the call to SDL_PumpEvents looks unnecessary, maybe this is the cause?
nicolai
Merwan
*De :* Nicolai Hess *Envoyé :* âlundiâ â20â âavrilâ â2015 â09â:â36 *à :* Any question about pharo is welcome; Esteban Lorenzano
2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com>:
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.
On windows there is currently an issue if you use OSWindow instead of directly use SDL. If you create a window with OSWindow, (like in the SDL2Example>>osWindow) you will loose all "keystroke" events in the main pharo window. I don't know yet why this happens.
nicolai
Hello, Okay for me the problem was indeed that I had 64bits librairies. After recompiling them for 32bits it worked fine. Also when I use any of Esteban's examples even after I close the window I still have a SDL2 event loop processs active in the process browser. And sometimes (but i have not been able to reproduce it everytime) I have an Oswindow renderer loop staying active too. Le 21 avr. 2015 05:26, "S Krish" <krishnamachari.sudhakar@gmail.com> a écrit :
Cool work...!..
* The x: 50 y: 50 initial point, on windows enables display of the title
bar, otherwise hidden
* The VM crashes on exampleTiger demo with Athens, resize and click
close... sometimes in other scenario's.
On Mon, Apr 20, 2015 at 5:50 PM, Esteban Lorenzano <estebanlm@gmail.com>
wrote:
Hi,
I just committed my prototype/experiment for windows with OSWindow, SDL2
and Athens.
to check them:
Gofer it smalltalkhubUser: 'Pharo' project: 'OSWindow'; package: 'OSWindow-Core'; package: 'OSWindow-SDL2'; package: 'OSWindow-SDL2-Canvases'; load.
and check the examples at:
OSSDLAthensWindow OSSDLMorphWindow
cheers, Esteban
On 20 Apr 2015, at 13:55, Nicolai Hess <nicolaihess@web.de> wrote:
2015-04-20 13:13 GMT+02:00 <merwanouddane@gmail.com>:
Hello,
We donât lose all keystroke events, but they are replaced by keydown
events.
Yes, KeyDown/KeyUp are working and instead of a keystroke event another keydown is sent. This is strange, I don't know exactly how the SDL event processing can influence the main window events. Maybe this has something to do how we look for new events in the SDL2DisplayPlugin. For me the call to SDL_PumpEvents looks unnecessary, maybe this is the cause?
nicolai
Merwan
De : Nicolai Hess Envoyé : âlundiâ â20â âavrilâ â2015 â09â:â36 à : Any question about pharo is welcome; Esteban Lorenzano
2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com
:
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.
On windows there is currently an issue if you use OSWindow instead of directly use SDL. If you create a window with OSWindow, (like in the SDL2Example>>osWindow) you will loose all "keystroke" events in the main pharo window. I don't know yet why this happens.
nicolai
2015-04-20 13:55 GMT+02:00 Nicolai Hess <nicolaihess@web.de>:
2015-04-20 13:13 GMT+02:00 <merwanouddane@gmail.com>:
Hello,
We donât lose all keystroke events, but they are replaced by keydown events.
Yes, KeyDown/KeyUp are working and instead of a keystroke event another keydown is sent. This is strange, I don't know exactly how the SDL event processing can influence the main window events. Maybe this has something to do how we look for new events in the SDL2DisplayPlugin. For me the call to SDL_PumpEvents looks unnecessary, maybe this is the cause?
So, I removed the call to SDL_PumpEvents, and now keystroke events are still working in the main window after opening an OSWindow. @Esteban Can you check if this is working on other platforms too.
nicolai
Merwan
*De :* Nicolai Hess *Envoyé :* âlundiâ â20â âavrilâ â2015 â09â:â36 *à :* Any question about pharo is welcome; Esteban Lorenzano
2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com>:
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.
On windows there is currently an issue if you use OSWindow instead of directly use SDL. If you create a window with OSWindow, (like in the SDL2Example>>osWindow) you will loose all "keystroke" events in the main pharo window. I don't know yet why this happens.
nicolai
2015-04-20 8:38 GMT+02:00 Matthieu Lacaton <matthieu.lacaton@gmail.com>:
Hello,
Thanks for your answers ! I have multiple remarks here :
On my computer (which is probably not the fastest I must admit) running it with a fork slows the whole operating system.
What you could do, add a wait time in your event proccessing loop stop := false. [ stop ] whileFalse: [ .... 20 milliSeconds wait. ]. So, it does not constantly checks for new events. The better, cleaner way of course is, don't use your own sdl event processing loop, but use OSWindow (as soon as this is working :) ) best nicolai 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 ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Alex Just to make sure we are clear on this: pay attention NOBODY should directly use SDL. OSWindow is the API, SDL is a BACKEND. Athens is the API, CAIRO a BACKEND Stef Le 20/4/15 02:57, Alexandre Bergel a écrit :
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
I see the point, but SDL seems to be pretty stable isnât it? Only two versions are reported on their website (1.2 and 2.0). Maybe it would be better to directly talk to SDL. Just wondering... Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Apr 20, 2015, at 4:18 AM, stepharo <stepharo@free.fr> wrote:
Alex Just to make sure we are clear on this: pay attention NOBODY should directly use SDL. OSWindow is the API, SDL is a BACKEND.
Athens is the API, CAIRO a BACKEND
Stef
Le 20/4/15 02:57, Alexandre Bergel a écrit :
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
2015-04-20 16:56 GMT+02:00 Alexandre Bergel <alexandre.bergel@me.com>:
I see the point, but SDL seems to be pretty stable isnât it? Only two versions are reported on their website (1.2 and 2.0). Maybe it would be better to directly talk to SDL. Just wondering...
Alexandre
If you use SDL directly -> you will have to create your own event loop (and other stuff) If you use the OSWindow layer -> you will get a nice API that is already integrated with the main window / main window eventloop.
On 20 Apr 2015, at 22:47, Nicolai Hess <nicolaihess@web.de> wrote:
2015-04-20 16:56 GMT+02:00 Alexandre Bergel <alexandre.bergel@me.com <mailto:alexandre.bergel@me.com>>: I see the point, but SDL seems to be pretty stable isnât it? Only two versions are reported on their website (1.2 and 2.0). Maybe it would be better to directly talk to SDL. Just wondering...
Alexandre
If you use SDL directly -> you will have to create your own event loop (and other stuff) If you use the OSWindow layer -> you will get a nice API that is already integrated with the main window / main window eventloop.
+1
Le 20/4/15 17:56, Alexandre Bergel a écrit :
I see the point, but SDL seems to be pretty stable isnât it?
This has nothing to do with stability of SDL. It has to do with layering software.
Only two versions are reported on their website (1.2 and 2.0). Maybe it would be better to directly talk to SDL. Just wondering...
Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Apr 20, 2015, at 4:18 AM, stepharo <stepharo@free.fr <mailto:stepharo@free.fr>> wrote:
Alex Just to make sure we are clear on this: pay attention NOBODY should directly use SDL. OSWindow is the API, SDL is a BACKEND.
Athens is the API, CAIRO a BACKEND
Stef
Le 20/4/15 02:57, Alexandre Bergel a écrit :
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 <mailto: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
participants (8)
-
Alexandre Bergel -
Esteban Lorenzano -
Matthieu Lacaton -
merwanouddane@gmail.com -
Nicolai Hess -
S Krish -
Sean P. DeNigris -
stepharo