Joypad not working

Monkey Forums/Monkey Programming/Joypad not working

Oddball(Posted 2012) [#1]
HI, I decided to give Monkey a go, but I have immediately hit a stumbling block. I don't seem to be able to get any data from my joypad. It's a Xbox 360 pad, and I'm using the GLFW target on a Mac. Here's some code to highlight my problem.
Strict

Import Mojo

Class Game Extends App
	Method OnCreate:Int()
		SetUpdateRate 60
		Return 0
	End


	Method OnUpdate:Int()
		Return 0
	End


	Method OnRender:int()
		Cls
		DrawText(JoyX(0,0)+" "+JoyY(0,0),100,100)
		Return 0
	End


End

Function Main:Int()
	New Game
	Return 0
End
What am I doing wrong?


MikeHart(Posted 2012) [#2]
Make sure you check for a button be pressed upfront!


Oddball(Posted 2012) [#3]
Upfront of what? I've tried all axis and all button, and tried changing the unit number just in case, but nothing works. I've checked that the controller is working, and BlitzMax detects it fine. Does anyone have a simple example that they know works so I can test it?


AdamRedwoods(Posted 2012) [#4]
I'd also try putting JoyX() in the OnUpdate routine instead of OnRender just in case.


Oddball(Posted 2012) [#5]
Is anyone trying the code I posted or are you just randomly suggesting things? All the Joy commands were in the OnUpdate when I first tried it. I only put them in the OnRender function to demonstrate my issue visually and give people some code to work with when helping me out. Has anyone successfully used a JoyPad in Monkey on a Mac yet?


AdamRedwoods(Posted 2012) [#6]
I just tried the joypad on my mac, and it isn't working either. (OSX 10.7.3)
If you tap into the mojo source, mojo->native->mojo.glfw.cpp uncomment line 1204 and it will give you direct glfw joy data.

I don't have a working test case, so I need to check if its the logitech or glfw.


Oddball(Posted 2012) [#7]
I've just started using monkey today so I have no idea what any of those things are you just said. Are you saying that the joypad functions are borked on Mac? I don't think I'll use monkey if that's the case. I can't use a dev environment where no one has noticed something that major as I can't be sure what else is borked too.


AdamRedwoods(Posted 2012) [#8]
I can't be sure what else is borked too.

very true. there are a lot of things still getting hashed out.

my test case in blitzmax worked, so it is the glfw target. my guess is that it may never have supported it in the past. Not sure if Mark checked that or not, i'll ask.
It looks like the latest GLFW now has joystick support, so i'm trying that now.


MikeHart(Posted 2012) [#9]
@Oddball: Nothing works at all. Monkey is just a myth. Seriously, chill down and I am sure things will be settled. Post a bug report and Mark will look at it. The reason that it wasn't discover before could be that either noone used a joypad in GLFW on the MAC before or maybe this pad needs different handling in the native section. I know that RAZ created at least on XBOX game with Monkey and there the JOY.. fucntions work. What pad are you using btw?


Oddball(Posted 2012) [#10]
Hold the phone! Are you say that functions aren't implemented on all possible target before they are added? How am I supposed to know what functions I can use on my current target? The only target specific considerations the joypad docs mention are about the xna needing a button press first. I have to say my first impressions of monkey have been absolutely dreadful. I don't even mean just this issue. First thing I did was read the tutorials and found that half of the code in them was wrong and didn't work. I had to rewrite them as I went through them. I'm currently imagining a nightmare dev process if I switched over to monkey. I think I'm done here.


MikeHart(Posted 2012) [#11]
Bye :-)


AdamRedwoods(Posted 2012) [#12]
How am I supposed to know what functions I can use on my current target?

I think this has been the only undocumented function failure so far. Other things (like no opengl on certain targets, no mojo with opengl2.0) are documented.

I'm currently imagining a nightmare dev process if I switched over to monkey.

yes, i had a rough time too at the beginning, but now i can't stay away. i was frustrated at how slow android turned out to be, and lack of pixel access. over time, these things have been improved. we now have pixel access and i approach android differently than other targets (because its android, not because of monkey).

EDIT:
glfw was the problem, the latest will fix that, but i found other errors in glfw.


Tri|Ga|De(Posted 2012) [#13]
Well I also had a few problems when I started, but now I have my first game released and i'm working on the second one.

I used this forum a lot while making my first game (and will properly also do it on the second one) and people are very helpful. Just don't give up so quickly.


skid(Posted 2012) [#14]
The fact is OSX doesn't support plug and play of xbox controller.

To get XBox controller working on Mac for BlitzMax I had to install this driver:

http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver


Oddball(Posted 2012) [#15]
I already have the tattiebogle driver installed. I did state above that the controller is setup and works fine in everything except monkey. Skid are you saying the code above works for you? Adam gave me the impression that it doesn't work, and Mike gave me the impression that no one has ever tried to use a joypad in monkey on OS X.


skid(Posted 2012) [#16]
Sorry, missed your BlitzMax reference. I'm not having much luck with GLFW target on Mac this morning, will reboot and try again.


Oddball(Posted 2012) [#17]
Ok Skid, thanks for clarifying.


skid(Posted 2012) [#18]
I've had more luck running GLFW on my Mac with MonkeyPro64b.

As there is no Mac joystick supported in GLFW I have grafted my freejoy implementation into the target and it seems to be working quite well. Email me if you want a version to test.


marksibly(Posted 2012) [#19]
Hi,

Mac Joypad support is apparently in the latest version of GLFW - will upgrade Monkey soon.