JuddMan
|
 |
«
Posted
2003-10-21 20:40:07 » |
|
This is just jinput thrown into my tetris game. its not finished, and im not sure i will finish it, i just wanted to try out jinput in a game. it even makes the keyboard control feel nicer than how i'd done it using AWT key refresh but i think i need to play with the speed to get it just right, it's a little touchy. i tested it with keyboard input, and analog joystick input. differentiating between x or y axis + or - was one thing that caught me... you'll find with the way i've done it that you can't set right to left and vice versa on an analog controller. digital axes may not work at all, but that's my fault. and buttons do work. to fix this i need to do some more work, but i never have much time. http://www.adam.com.au/kellyjones/java/InputAlpha.zipJust unzip it somewhere, and run JMTetris.jar in the usual way. i included the jinput binaries. (i havent tested it without them in the same directory though). can someone who has jinput1.1 properly installed try running it on its own and let me know if that works too?
|
|
|
|
|
swpalmer
|
 |
«
Reply #1 - Posted
2003-10-22 05:11:58 » |
|
*cough* Web Start *cough*  (now that the WebStart/JInput plugin issues are resolved)
|
|
|
|
JuddMan
|
 |
«
Reply #2 - Posted
2003-10-23 21:30:03 » |
|
ran into this problem:
Use of native libraries requires unrestricted access to system
i have <all-permissions> set
|
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Jeff
|
 |
«
Reply #3 - Posted
2003-10-24 05:14:44 » |
|
Very cool! I'm glad you're seeing positive results. if you find issues with either the APi or the plug-in(s) while working on this be sure to post them here 
|
|
|
|
endolf
|
 |
«
Reply #4 - Posted
2003-10-24 07:52:52 » |
|
NOO!!!, don't post issues here, i'm trying to get back into coding my own stuff, don't post them anywhere, wait a few months  Seriously, post them here, and/or raise an issue over on the jinput.dev.java.net page. Cheers Endolf.
|
|
|
|
Jeff
|
 |
«
Reply #5 - Posted
2003-10-25 06:10:26 » |
|
ran into this problem:
Use of native libraries requires unrestricted access to system
i have <all-permissions> set You need to decalre the native libs properly in the jnlp file. Folks here have done it maybe one can give you an example...
|
|
|
|
JuddMan
|
 |
«
Reply #6 - Posted
2003-10-25 21:03:25 » |
|
this is my first Webstart experience ever
ok, i messed up with some signing. fixed that, so it all loads and runs but the plugin isn't found, i'll look into it more later.
i noticed that my high scores file was being saved to the location i run the JNLP file from, and i dont know what happens when it's run from the net as my ISP hasnt got it set up for JNLP. what's the best solution in the case you want to save hi scores etc for the user?
Strangely enough it works if the controller folder is in the same location the jnlp file is launched from, but that's of no real use when it comes to web deployment.
|
|
|
|
|
Jeff
|
 |
«
Reply #7 - Posted
2003-10-25 23:44:56 » |
|
Do you want individual user's high scores or competitive high scores across all users? If the former I believ you should just be able to open a file on the local system as long as the user has given you permissions. If you want it to be a competitive high scroe board across users, you'll need to connect back to soem kind of server. Typically this is done with a servlet.
As for your jnlp, I'm going to post a seperate thread asking for people to contribute their working examples.
|
|
|
|
JuddMan
|
 |
«
Reply #8 - Posted
2003-10-26 18:43:38 » |
|
thanks. meanwhile i fixed it so that the game knows which way the axis was pressed when the controls are being set so that left and right digital axes work correctly. so now you can make it more challenging by setting right to left and left to right. single jar if you have jinput installed into JRE: http://www.adam.com.au/kellyjones/java/proto/jinput.jarwebstart that wont work due to ISP: http://www.adam.com.au/kellyjones/java/proto/JMTetris.jnlp(open it from addy line in webstart, works if jinput is installed to JRE) ZIP with everything combined: http://www.adam.com.au/kellyjones/java/InputAlpha.zip Do you want individual user's high scores or competitive high scores across all users? If the former I believ you should just be able to open a file on the local system as long as the user has given you permissions. If you want it to be a competitive high scroe board across users, you'll need to connect back to soem kind of server. Typically this is done with a servlet.
i dont want a hi score server as i dont have a permanent connection or an isp willing to host a hi-score servlet.
|
|
|
|
|
swpalmer
|
 |
«
Reply #9 - Posted
2003-10-26 21:19:56 » |
|
There is a major problem with how you are bundling JInput.
Loading Tiles Loading Graphics Graphics Loading Done Scanning jar: dxinput.jar Examining file : META-INF/ Examining file : META-INF/MANIFEST.MF Examining file : net/ Examining file : net/java/ Examining file : net/java/games/ Examining file : net/java/games/input/ Examining file : net/java/games/input/DirectInputAxis.class Examining file : net/java/games/input/DirectInputDevice.class Examining file : net/java/games/input/DirectInputEnvironmentPlugin.class Found candidate class: net/java/games/input/DirectInputEnvironmentPlugin.class Adding class to plugins:net.java.games.input.DirectInputEnvironmentPlugin Examining file : net/java/games/input/DirectInputKeyboard.class Examining file : net/java/games/input/DirectInputMouse$BallAxis.class Examining file : net/java/games/input/DirectInputMouse$BallImpl.class Examining file : net/java/games/input/DirectInputMouse$ButtonImpl.class Examining file : net/java/games/input/DirectInputMouse$ButtonsImpl.class Examining file : net/java/games/input/DirectInputMouse.class Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load /Users/scottpalmer/Desktop/InputAlpha Test/controller/libdxinput.jnilib at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1384) at java.lang.Runtime.loadLibrary0(Runtime.java:788) at java.lang.System.loadLibrary(System.java:832) at net.java.games.input.DirectInputEnvironmentPlugin.<clinit>(DirectInputEnvironmentPlugin.java:62) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at java.lang.Class.newInstance0(Class.java:306) at java.lang.Class.newInstance(Class.java:259) at net.java.games.input.DefaultControllerEnvironment.scanControllersAt(DefaultControllerEnvironment.java:183) at net.java.games.input.DefaultControllerEnvironment.scanControllers(DefaultControllerEnvironment.java:164) at net.java.games.input.DefaultControllerEnvironment.access$000(DefaultControllerEnvironment.java:57) at net.java.games.input.DefaultControllerEnvironment$1.run(DefaultControllerEnvironment.java:108) at java.security.AccessController.doPrivileged(Native Method) at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:106) at InputManager.<init>(InputManager.java:20) at JMTetris.<init>(JMTetris.java:78) at JMTetris.main(JMTetris.java:637)
You see, I'm trying this on a Mac - and because of the way the windows JInput is bundled it simply doesn't work.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
JuddMan
|
 |
«
Reply #10 - Posted
2003-10-27 00:04:41 » |
|
i dont have a mac, so didnt know how to bundle it. the jmtetris jar on it's own will work as long as jinput is installed in the JRE... at least it does on windows.
is it possible to make a jinput bundled app that has jinput working on any OS like this? or does there need to be 3 separate downloads? it looks like the JARs from the other OS's would conflict.
i have never tested if the first situation is possible, but the best case scenario is to get webstart working so that it's all downloaded as needed, so im just waiting for now. i cant take any active part in the project, time's short recently.
|
|
|
|
|
Jeff
|
 |
«
Reply #11 - Posted
2003-10-27 19:57:51 » |
|
It *should* be possible with the JNLP to specify different configurations for different operating systems.
At worst you could make seperate JNLP files, but I don't think thats necessary...
JK
|
|
|
|
|
|
Jeff
|
 |
«
Reply #13 - Posted
2003-10-28 08:22:50 » |
|
If you are zipping then you might need seperate zips.
We *could* theoretically make the plug-ins OS aware and have them default to empty controller sets if they are on the wrong platform.
Arguments for or against?
JK
|
|
|
|
endolf
|
 |
«
Reply #14 - Posted
2003-10-28 09:31:06 » |
|
For: It makes some sence, you can bundle all built plugins in one app and not worry about what platform it's on that way, larger download, less customisation. Against: The linux plugin was broken again last time I played (joystick hat axes reversed and no hat working on my logiteck gamepad), it's broken enough, are you really wanting me to break it more?  Endolf P.S. the linux plugin is in my list of things to fix, but unless someone other than me reports it, it can stay fairly low on said list. This is a vote for yes 
|
|
|
|
JuddMan
|
 |
«
Reply #15 - Posted
2003-11-03 07:22:16 » |
|
trying to make my code more adaptable by using an interface that specifies booleans for the 6 keys or buttons that i want to use, and generic methods (setKey (int keyNumber 1-6) and such), it's becoming quite complicated. though i never imagined i'd be replacing the input, let alone have the user able to choose which method to use at startup (awt or jinput). about half way done but not working on it a heck of a lot. the game i posted here was a big hack. it didnt even make use of the original set keys dialog, just painted that over the top. i used serialization with the awt input method, and it will be interesting to see what happens when i try to load or serialize stuff from jinput. as long i make sure there's a catch for when the device is no longer plugged in etc. i'm assuming it should work OK. but we'll find out soon enough. here's my interface, any suggestions welcome: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| abstract class InputInterface { boolean up = false, down = false, left = false, right = false, a = false, b = false; JMTetris owner; public InputInterface() { } public void setOwner(JMTetris in) { owner = in; } abstract String setKey(int keyNum); } |
|
|
|
|
|
Jeff
|
 |
«
Reply #16 - Posted
2003-11-03 21:07:25 » |
|
So this confuses me some...
What necessitated you put in AWT input as a backup? If theres something we need to fix about JInput I'd like to get clear on what it is.
Thanks
JK
|
|
|
|
JuddMan
|
 |
«
Reply #17 - Posted
2003-11-03 23:54:34 » |
|
the game originally had AWT for the input, and it's a 'just in case'
also i really dont think i'd like to see any kind of AWTKeyboard becoming a part of jinput, this basically shows that they can both be used when needed.
for example im still going to use awt input for the keys such as the F1 - F8 that do certain things and escape for the menu in case diferent keyboard layouts result in jinput reporting diferent button numbers or names.
|
|
|
|
|
endolf
|
 |
«
Reply #18 - Posted
2003-11-04 05:47:23 » |
|
Hi ESC and the F keys should be ok, it's things like @ # and " that all go funny, some of the letters are in different places if I recall on french/german keyboards too, but it's been a while since I saw one, all I remeber is that they were a pain to use  . But the point is ESC and F1-F8 are safe. I believe under windows that the keyboard layout is handled under directx so it's not a worry on windows, under linux it is a problem, I'm not sure about OSx. Cheers Endolf
|
|
|
|
|