Game Controllers in BlitzMax NG on Mac?


👉 BlitzCoder will be building a new platform and other plans to preserve and continue the Blitz legacy.

To be able to achieve this goal, we need your support by becoming a Patreon Paid Member 👈

 

Tweet
ParkProductions

I'm creating a Mac version of my PC game, the game plays great when compiled of Mac BlitzMax NG except for game controller input.
It looks like I need to use either the tjoystickdriver or the third-party module sdlgamecontroller, is their a guide for game controllers on Mac BlitzMax NG?

markcwm commented:

Well, there's the docs https://github.com/bmx-ng/sdl.mod/blob/master/sdlgamecontroller.mod/doc/intro.bbdoc

and there's docs for all the functions https://github.com/bmx-ng/sdl.mod/blob/master/sdlgamecontroller.mod/sdlgamecontroller.bmx

Is that enough?

Otherwise maybe read a non-Blitz SDL2 tutorial like this https://lazyfoo.net/tutorials/SDL/20_force_feedback/index.php

Blitzmax SDL worked nicely on my Catalina Mac.

ParkProductions commented:

Thanks Mark, plenty docs to read through for me - my Blitz is a bit rusty.

Would TJoystickDriver allow the use of JoyHit/JoyDown etc or is the SDLGameController the best way to go?

markcwm commented:

Yes of course, I think you're supposed to use pub.Freejoy not pub.Joystick which it imports.

According to this https://github.com/bmx-ng/pub.mod/issues/43 there is a bug with pub.Freejoy on MacOS, so for now you should use the sdl.Gamecontroller.

ParkProductions commented:

Now able to read the joypad by using:

Framework SDL.sdlgamecontroller
Import sdl.gl2sdlmax2d
Import brl.retro

However, when placing the above into my game it no longer runs - the framework command means that no other modules are imported?

ParkProductions commented:

Seems that the brl.timer and sdl framework can not be run together causing the CreateTimer commands not to work. I removed Timers from my game for the moment and the game ran and the sdlgamecontroller was able to read the xbox 360 pad - however it appears the "JoyHit" command does not work.

RasterRon commented:

Seems that the brl.timer and sdl framework can not be run together causing the CreateTimer commands not to work.

Try using the BRL.Timerdefault as this now succeeds BRL.Timer
or perhaps just use SDL.Timer instead as mentioned also in this issue: https://github.com/bmx-ng/brl.mod/issues/110

Reply To Topic (minimum 10 characters)

Please log in to reply