Nice :-)

On 10.04.2016 12:05, Ronie Salgado wrote:
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 p...@highoctane.be <mailto:p...@highoctane.be> <p...@highoctane.be <mailto:p...@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
    <step...@stack.nl <mailto:step...@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








Reply via email to