Andy Gilbert Posted January 10, 2012 Share Posted January 10, 2012 Hi, just wondering if anyone has managed to get the lua joystick module to work? Ive downloaded but just receive the Joystick 0 Not found => EXITnotification despite having a PC gamepad plugged in a working. I find it so fustrating theres no way of having a joystick working with lua?? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
diedir Posted January 10, 2012 Share Posted January 10, 2012 Hi Andy if it is my demo lua, you need an XBox pad 360 plugged in your windows pc to work with sorry for your frustration, but it's working very well for me Quote AMD Ryzen 5900HX - Nvidia RTX 3070 - 32 Go - 1To SSD - W11 Link to comment Share on other sites More sharing options...
Andy Gilbert Posted January 10, 2012 Author Share Posted January 10, 2012 HI Diedir. yes its your demo, so this will only work with a Xbox gamepad? Any chace it could be modified to see any gamepad/joystick? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Rick Posted January 10, 2012 Share Posted January 10, 2012 If you could find a C library that works with any joystick then I could port it to Lua. Quote Link to comment Share on other sites More sharing options...
Andy Gilbert Posted January 10, 2012 Author Share Posted January 10, 2012 Ahh thanks Rick, ok ill have a look. I dont quite understand how to "port" to lua else i would do it, ive tried looking into it but struggled to find out good info about doing so or even how i go about making extensions for lua? Any good resources on this? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Rick Posted January 10, 2012 Share Posted January 10, 2012 The way I started was by looking at how to call DLL's made in C from Lua. Did some google searches on that and it showed me what was required. Then you can carry that over to mostly any library. I only currently know how to do it with C functions and not C++ classes. It gets more confusing when trying to port classes over. I've done a RakNet port (not complete) and this joystick port so far. The basic idea is to write a DLL that exposes the functionality you require. Then Lua can load that DLL and make calls to it. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted January 10, 2012 Share Posted January 10, 2012 You probably saw the one I uploaded as well. It works with any joystick or gamepad but it uses DirectInput so it's Windows only. Quote Link to comment Share on other sites More sharing options...
Andy Gilbert Posted January 10, 2012 Author Share Posted January 10, 2012 Hi, I've not seen that and windows is fine but is this for lua? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
gamecreator Posted January 11, 2012 Share Posted January 11, 2012 No, it's C so far. Not sure if it can be converted to LUA. I don't know if LUA and DirectX play together. Edit: I should probably post the code in the description. It's not that long. Quote Link to comment Share on other sites More sharing options...
Rick Posted January 11, 2012 Share Posted January 11, 2012 I can give it a try if you like Andy. If it's pretty short it should be fairly easy. So basically after I create the basic open/close/poll I can make methods to get each of the data elements in the structure. Shouldn't be to bad. Also am I right in assuming you can only have 4 controllers? That's what the last library did, and I notice gamecreator's example has an array of Joysticks that is set to 4 also. It'll just be easier if that's a known hardware limitation. I can actually structure this much like diedir's gamepad lib he was using. http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.dijoystate2(v=vs.85).aspx Quote Link to comment Share on other sites More sharing options...
Andy Gilbert Posted January 11, 2012 Author Share Posted January 11, 2012 Hi rick, that would really appreciated. I dont mind a limit, I'm happy with just 1 working. if there is anything I can do to help then let me know. Thanks rick, keep me updated on how u get on. And thanks gamecreator for making your code available. Andy. Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
gamecreator Posted January 11, 2012 Share Posted January 11, 2012 And thanks gamecreator for making your code available. Thanks for the thanks but I just wrote a quick Leadwerks example using Jon Parise's wrapper. It's his code that does all the work and I'm happy that he made it public. Quote Link to comment Share on other sites More sharing options...
Rick Posted January 11, 2012 Share Posted January 11, 2012 Thanks rick, keep me updated on how u get on.[ Will do. Probably get to it tonight or tomorrow. I'll just hardcode it for 4 controllers as I just seem to remember that being a limitation of Windows anyway. I'm going to make it look similar to the other port I did, but I'll have functions to get groups of data since Lua can return more than 1 parameter from functions. Below is the result of polling the joystick. So I'll do something like GetXYZ() which will return the first 3 variables, then GetRXYZ() which will return the others, etc. For the arrays I'll say like GetButton(index) and you can pass in 1-128 for button numbers that you want to check. typedef struct DIJOYSTATE2 { LONG lX; LONG lY; LONG lZ; LONG lRx; LONG lRy; LONG lRz; LONG rglSlider[2]; DWORD rgdwPOV[4]; BYTE rgbButtons[128]; LONG lVX; LONG lVY; LONG lVZ; LONG lVRx; LONG lVRy; LONG lVRz; LONG rglVSlider[2]; LONG lAX; LONG lAY; LONG lAZ; LONG lARx; LONG lARy; LONG lARz; LONG rglASlider[2]; LONG lFX; LONG lFY; LONG lFZ; LONG lFRx; LONG lFRy; LONG lFRz; LONG rglFSlider[2]; } DIJOYSTATE2, *LPDIJOYSTATE2; Quote Link to comment Share on other sites More sharing options...
Andy Gilbert Posted January 11, 2012 Author Share Posted January 11, 2012 Rick this sounds spot on, cant thank you enough for giving this a go. Much appriciated. Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Andy Gilbert Posted January 17, 2012 Author Share Posted January 17, 2012 Just wondering if you have had any luck Rick? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Rick Posted January 17, 2012 Share Posted January 17, 2012 Hey, sorry haven't been able to get to this yet. I still plan on it though. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 2, 2015 Share Posted January 2, 2015 It is some Jostick support possible in Lua with LE3 ? No matter what is the library used, does someone know a working solution for common Xbox 360 joystick plugged onto PC ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.