BlitzMax NG MacOS Getting Game Controllers Input?

Started by ParkProductions, October 21, 2023, 18:37:44

Previous topic - Next topic

ParkProductions

I'm able to compile my PC game on Mac with BlitzMax NG, the game runs great but it won't read Game Controller input with the usual JoyHit/JoyDown etc.

There is TJoystickDriver and SDLGameController commands in the doc's - would these read the controller inputs? Which of these would be the best or is their a way to use my games existing JoyHit/JoyDown/JoyDir code?

Derron

There is "pub.mod/joystick.mod" - this is an abstract driver. This is similar to the "graphics driver". It defines an interface (class of methods so to say).
It has no real "connection" to joysticks hardware.

Then there is pub.mod/freejoy.mod - which you might already be using / trying to use.

An example for the module can be found there:
https://raw.githubusercontent.com/bmx-ng/pub.mod/38f25c9060cbacc90dfff2b8fd1c17df602f66a8/freejoy.mod/doc/joycount.bmx


If you want to use sdl.mod/sdljoystick.mod then you need to use the "framework" command and utilize the SDL-modules.

(unchecked)

Framework Sdl.SDL
Import SDL.SDLJoystick
...and then use parts of the example above 


bye
Ron

ParkProductions

Now able to read the joypad using testjoy.bmx and adding:-

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

Though placing above into my game causes it to no longer run. Framework command means that no other modules are imported?

Derron

Yes, Framework leads to no longer autoimporting all "brl.mod" and "pub.mod" modules. So you need to find out what you need to import.


bye
Ron

ParkProductions

Sorted through the brl and pub mods needed but it seems that the brl.timer is not working with sdl framework. Removed Timers from my game for the moment and the game ran with the sdlgamecontroller now reading the xbox 360 pad - however it appears the "JoyHit" command does not work.

markcwm

Em... I don't think you want to use any old module with Framework, you should always use an appropriate driver like sdl.gl2sdlmax2d or something that imports the driver, I see people using Framework sdl.sdl so that must work too.

Finding out the missing Blitzmax dependencies was always a bit of a guessing game, although maybe the NG debugger can help, but it doesn't take long to figure out.

Derron

sdl.sdltimer is the counterpart to brl.timer


bye
Ron