Hey master of Love !
here comes an easy question, did you tought about the use of wiimote in LOVE ?
if NOT any ideas of how to load an aditional arbitrary ? there are some nice implementations of wiimote support
Im using a port of http://www.wiiuse.net/ to Java and works very well
peace and lots ot LOVE !!
wiimote or arbitrary external library load
- athanazio
- Citizen
- Posts: 96
- Joined: Fri Apr 10, 2009 3:12 am
- Location: Rio de Janeiro - Brazil
- Contact:
wiimote or arbitrary external library load
Nothing is simple but everything is possible.
Re: wiimote or arbitrary external library load
I'm not sure, but just off the top of my head I know that Love has a joystick implementation. As of this writing, you might be able to write a driver that registers the wiimote as a joystick instead of a mouse device. Then what you do is something along these lines:
If the wiimote is moving up and down, you simulate Analog Stick 1's Y axial tilt.
If the wiimote is moving left to right, you simulate Analog Stick 1's X axial tilt.
If you want to support tilting:
If the wiimote is tilting forward and back, you simulate Analog Stick 2's Y axial tilt.
If the wiimote is tilting left and right, you simulate Analog Stick 2's X axial tilt.
Then you register the nunchuck as a third analog stick. (Bear in mind Love allows you to check the number of analog sticks)
Then you have the various buttons report in as numbered buttons. A = 0, B = 1, Home = 2, Minus = 3, Plus = 4, Trigger = 5 etc.
That's just off the top of my head, though. I'm not the most knowledgeable resource on the subject. I could be very wrong but I'm speaking from the little bit of experience I have with joysticks and programming. Hope this at least helps point you in the right direction.
If the wiimote is moving up and down, you simulate Analog Stick 1's Y axial tilt.
If the wiimote is moving left to right, you simulate Analog Stick 1's X axial tilt.
If you want to support tilting:
If the wiimote is tilting forward and back, you simulate Analog Stick 2's Y axial tilt.
If the wiimote is tilting left and right, you simulate Analog Stick 2's X axial tilt.
Then you register the nunchuck as a third analog stick. (Bear in mind Love allows you to check the number of analog sticks)
Then you have the various buttons report in as numbered buttons. A = 0, B = 1, Home = 2, Minus = 3, Plus = 4, Trigger = 5 etc.
That's just off the top of my head, though. I'm not the most knowledgeable resource on the subject. I could be very wrong but I'm speaking from the little bit of experience I have with joysticks and programming. Hope this at least helps point you in the right direction.
We don't borrow, we don't read, we don't rent, we don't lease, we take the minds!
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: wiimote or arbitrary external library load
Put one binary module for every supported platform in the .love and use require to load them.athanazio wrote:if NOT any ideas of how to load an aditional arbitrary ?
EDIT: Keep in mind you still need lua modules for this
- athanazio
- Citizen
- Posts: 96
- Joined: Fri Apr 10, 2009 3:12 am
- Location: Rio de Janeiro - Brazil
- Contact:
Re: wiimote or arbitrary external library load
so lets see if I understood,
if I build an dll of some C code with the name "bla.dll",
I just can use require() to load it ?
hummm not clear to me how it will make call to the functions in the dll,
does the require make the link, or the lua modules that you refer to make the link ?
thanks for the tip will research something about it.
*EDIT
from the programming in Lua 8.2 topic
if I build an dll of some C code with the name "bla.dll",
I just can use require() to load it ?
hummm not clear to me how it will make call to the functions in the dll,
does the require make the link, or the lua modules that you refer to make the link ?
thanks for the tip will research something about it.
*EDIT
from the programming in Lua 8.2 topic
I tried to run print(loadlib()) but it says that is a nil function, is this available in the LOVE distribution ?The standard implementation offers this support for Windows (DLL), Linux, FreeBSD, Solaris, and some other Unix implementations. It should not be difficult to extend this facility to other platforms; check your distribution. (To check it, run print(loadlib()) from the Lua prompt and see the result. If it complains about bad arguments, then you have dynamic linking facility. Otherwise, the error message indicates that this facility is not supported or not installed.)
Nothing is simple but everything is possible.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: wiimote or arbitrary external library load
You've got yourself an old document, let me walk you through it.
Just as a hint why that didn't work, in 5.1 it's package.loadlib, but I'll let you use require.
Just as a hint why that didn't work, in 5.1 it's package.loadlib, but I'll let you use require.
- Get yourself the official lua package
- Use the interactive interpreter (WAY FASTER than using LÖVE everytime)
- Create yourself a dll/so (I'd suggest pure c/c++ so it's cross-platform)
- Export the function int luaopen_<libname>(lua_State *L) (replace <libname> with the libname, and yes, you need the lua headers and the lib)
- Export every function you want to use in lua to lua from within that luaopen function
- Every function should have the prototype: int (lua_State *L), these are exactly the same as you'd normally use with the lua API, check the reference manual for that
- athanazio
- Citizen
- Posts: 96
- Joined: Fri Apr 10, 2009 3:12 am
- Location: Rio de Janeiro - Brazil
- Contact:
Re: wiimote or arbitrary external library load
Nothing is simple but everything is possible.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests