I forgot to ask, will this work with a PS2 joystick? We have one available in the robotics lab that we can use for that.

On Apr 12, 2016, at 02:41, Carolina Hern��ndez <carola.hp@gmail.com> wrote:

Hi Ronnie, that's is really nice!

I'm talking to you in private 

2016-04-10 7:05 GMT-03:00 Ronie Salgado <roniesalg@gmail.com>:
Ok, I made a cleanup on the OSWindow joystick support. I also added the OSWindowGenericRenderer interface which is implemented by a thin wrapper around the SDL2 renderer interface. I have tested this on Linux using a XBox 360 controller (using SDL2 GameController interface) and a PS2 controller via an USB adapter (using SDL2 Joystick interface). Later I will test it on Windows and Mac.

=============================
Here is the demo: https://www.youtube.com/watch?v=lABfEmToHLQ&feature=youtu.be

OSWindowJoystickExample new open.

Xbox 360/mapped controls
Left stick: move character
X button: shoot
Start: reset

=============================

I also added a simple examples using the OSWindowGenericRenderer:

OSWindowGenericRendererDrawingExample new open.

=============================

I also modified the OSSDL2Driver >> #isSuitable method to not call the hasPlugin method. The plugin seems to be unnecessary according to several posts, and I am too lazy for fixing it. I guess that this should be eventually integrated into Pharo 5 after some reviewing. Before that, the latest version of OSWindow should be loaded manually. For that, the packages should be loaded in the following order:

OSWindow-Core
OSWindow-SDL2
OSWindow-SDL2-Examples

After that, the following doIt is required in a playground to start receiving events:

SDL2Constants initialize.
SDL_Event initialize

Best regards,
Ronie

2016-04-10 3:15 GMT-03:00 phil@highoctane.be <phil@highoctane.be>:
There is joystick support in 4.0, but not in Unix (plugin looks pretty empty).

Smalltalk vm listBuiltinModules select: [ :each | each beginsWith: 'Joystick' ].

JoystickTabletPlugin VMMaker-oscog-nice13154.314

So, it is all in the InputEventSensor

Check for senders of primReadJoystick:

--> joystickXY:, joystickButtons: ...

Phil


On Sun, Apr 10, 2016 at 1:18 AM, Stephan Eggermont <stephan@stack.nl> wrote:
On 09-04-16 15:24, Carolina Hern��ndez wrote:
I couldn't find any direct way to use a joystick in Pharo, if someone knows
about one, I'd like to integrate it to my code.
https://github.com/Geal/Squeak-VM/tree/master/platforms/Mac%20OS/plugins/JoystickTabletPlugin

Refers to a joystick plugin for squeak. I don't know if that is in the current distribution
(it doesn't seem to be), so you might ask on the vm-dev list about it. I haven't looked
at it, so it could be for a RS-232 based joystick instead of something more useful with
a modern pc.

Can't SDL2 be used with a joystick?

Stephan











---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile