Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Games Center / Archived Projects / Re: Java Fighter on: 2008-08-25 18:03:17
I hear what you're saying Smiley I have used Webstart before, just thought I would run out of time when trying to make it work with JInput (more specifically, the natives...). Yes I know JInput supports multiple OS; a bit uncertain though about the old (very: 2004) version I'm using in my code?

This and above are my reasons for creating my game this way....it's a first try and I thought I'd get away with it  Cool Thanks for your advice! I will surely look into the JWS detail soon.

/ Anders
2  Games Center / Archived Projects / Re: Java Fighter on: 2008-08-25 14:53:35
1. Keyboard is currently not supported because the overall feel (if I managed to achieve any) when moving/attacking would be lost. Much smoother imo when playing with gamepad. Again, I know I might have shot myself in the shot in doing so; not all have gamepads (or Windows Wink). My main focus was to challenge myself: I wanted to create a functional game with gamepad support, nothing more. Bear with me as I have not done this before....

2. The JAR is inside the installer. The "Win-only" restriction is because I have only taken advantage of the Win part of JInput. This fact is mostly due to time issues, and also because it was the easy (lazy?) way out to accomplish what I set out to do Smiley

Future projects will not just be an experiment like this one; then I'd know more what to do. And why. Thanks for your replies, anyone got it to run? Smiley

/ Anders
 
3  Games Center / Archived Projects / Re: Java Fighter on: 2008-08-24 15:32:21
Ok!

I get that this could be insulting to non-Win users. But: I wanted to create a *complete* game, which was never intended for all platforms; the challenge for me was to make it work at all. Since I'm on Windows I took that simple route. That said, I still hope for some constructive feedback from Win users, being my first game and all  Smiley I want to improve in future projects and getting help/comments from you all would be great.

Btw, I used JInput for gamepad support, other than that it's std Java.

/ Anders
4  Games Center / Archived Projects / Java Fighter on: 2008-08-23 17:35:48


My first attempt, except for some simpler board games. Made merely as a programming challenge for me Smiley No more time to work on this project since school is starting again. Yes there are things missing and the code is a bit messy at places...just glad for completing it (almost anyway).

Lack of time made me skip the JWS part (which I know is ideal)...instead it comes as a simple installer. Windows required aswell as a gamepad with 2 analog sticks and JRE 1.5+ installed. Tested on Windows XP SP2 with Logitech Dual Action 11 buttons + 2 analogs, aswell as on Windows Vista with unknown (my memory..) gamepad. Works as expected.

If you have some time, please try it out Smiley Thanks!

http://hem.bredband.net/b255555/javafighter_v1.0.rar


/ Anders
5  Games Center / Showcase / Re: Legend of the Chambered on: 2008-07-29 23:22:36
Fantastiskt trevligt, mkt bra gjort  Smiley
6  Games Center / Featured Games / Re: Project X (Applet Game) on: 2008-07-29 23:16:11
Just tried the Training feature now. Impressive work! The grenade launcher recoil feeling is very nice Smiley

/ Anders
7  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-29 21:36:29
Yes I get that, was a deliberate decision. I want only the gamepad functionality, that's it Smiley At least in this project. I have not put a great deal of time into finding the cause of why running with JRE 1.6 would throw AIOoB exception. I was just thrilled to see my first attempt (uncommenting) do the trick for me. As I said before: it's a blessing to be able to use the old Axis class, instead of the newer counterparts. At least the way I have written my code (which could be improved a LOT I'm sure  Cool). In future projects I will of course use latest version from the start. Just felt a little short on time and wanted to complete this project. Unfinished projects are not acceptable in my book Smiley

Thanks all for your help!

/ Anders
8  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-27 10:53:43
Thanks, I got it working though Smiley

Running created JAR (compiled with JDK 1.5 or 1.6) with JRE 1.6, no problems. At last!

/ Anders
9  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-26 13:50:10
I actually got my little example above (ControllerExample.java) to work now, no matter what JRE version used to run the code Smiley No more ArrayIndexOutOfBoundsException: 223, no exceptions at all. Compiled with jdk1.6.0_07. I must learn to always use latest version...

What I did was just to comment out 1 loc in DirectInputEnvironmentPlugin.java.....

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
private void addDevice(...)
{
    ...

    if(category == 19) {
        //c = DirectInputKeyboard.createKeyboard(lpDevice, subtype, productName, instanceName);
    }

    ...
}


This is great news for me; been struggling with this for too long. I might even be able to enjoy the Iron Maiden concert tonight, now  Cool

/ Anders
10  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-25 12:09:30
OK:

How do I make my old JInput version work with Java 1.6, currently the only way to avoid the above exception is to run JAR with Java 1.5 (which it was compiled with).... Undecided

If my only option now is to modify the old JInput sources and recompile them to get rid of the bug, which classes are of interest? How much work am I looking at? Clues and hints provided by Endolf?  Tongue

The easy way is not an option for me, I'm too ignorant for that.

/ Anders

*EDIT*

I'm digging in CVS as we speak; which CVS revision # applies to my ancient JInput version? 1.1.2.1? Looking at DirectInputEnvironmentPlugin.java right now, trying to spot changes. Can you please point me in a direction where I will have a chance to fix this issue? Naturally it takes some time for me to learn how  the different classes/methods work. Need I modify more classes?

I really appreciate your patience with me, desperately clinging on to the past... looks like a fun challenge though Smiley

Have a great evening!

/ Anders

11  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-24 23:19:38
Oh God....

I tried it ONE last time just now, seeing that the manifest file was created by "1.5.0_08-b03 (Sun Microsystems Inc.)". I then used java -jar jarfile.jar command of my jre1.5.0_08 installation.

It worked Grin

Which of course could mean a bad thing that I'm too tired to think of right now......ups and downs.

/ Anders
12  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-24 22:39:15
My one and only main class:

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  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
package com.example;

import net.java.games.input.Axis;
import net.java.games.input.Controller;
import net.java.games.input.ControllerEnvironment;

public class ControllerExample
{  
    static {
        try {
            System.setProperty("java.library.path", "C:/TEST/NativeDebug/lib/native/dxinput.dll");
            System.setProperty("jinput.plugins", "net.java.games.input.DirectInputEnvironmentPlugin");            
        }
        catch(Exception e) {
            System.out.println("Some error: " + e);
        }
    }
   
    public ControllerExample()
    {
    }
   
    private void showControllers()
    {  
        System.out.println("Java Lib Path: " + System.getProperty("java.library.path"));
        System.out.println("Java Class Path: " + System.getProperty("java.class.path"));
        try {
            // accesses the default controller environment which contains all identified controllers                
            ControllerEnvironment ce = ControllerEnvironment.getDefaultEnvironment();
            // retrieve the available controllers
            Controller[] controllers = ce.getControllers();
                                       
            for(int i = 0; i < controllers.length; i++) {                
                System.out.println("Index: " + i + " - Controller type: " + controllers[i].getType() + " - Controller name: " + controllers[i].getName());
            }
        }
        catch(Exception e) {
            System.out.println("An error occurred: " + e);
            e.printStackTrace();
        }        
    }
   
    public static void main(String[] args)
    {
        new ControllerExample().showControllers();
    }
}


- Classpath value above, when running in NB, is:

Java Class Path: C:\TEST\NativeDebug\lib\runtime\jinput.jar;C:\TEST\NativeDebug\lib\runtime\jutils.jar;C:\TEST\NativeDebug\lib\plugin\linux-eventinterface-jinput-plugin-0.1.jar;C:\TEST\NativeDebug\lib\plugin\linux.jar;C:\TEST\NativeDebug\lib\plugin\win32-x86-directinput-plugin.jar;C:\TEST\NativeDebug\build\classes;C:\TEST\NativeDebug\src

- And when running created JAR from command line, it is:

jarfile.jar (name of my JAR...)

Have also tried setting java.class.path to the above (in ControllerExample.java) and some other values, but no luck...

- Run command used:

java -jar jarfile.jar

THANK YOU very much Smiley

/ Anders
13  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-24 22:38:19
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  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
<?xml version="1.0" encoding="UTF-8"?>
<project name="NativeDebug" default="default" basedir=".">
    <description>Builds, tests, and runs the project NativeDebug.</description>
    <import file="nbproject/build-impl.xml"/>

    <!-- ===================== Property Definitions =========================== -->
   
    <property name="controllerexample.mainclass" value="com.example.ControllerExample"/>

    <property name="app.name"     value="NativeDebug"/>

    <!-- Load the property app.version from the file which is itself specified by the property app.version
    The version number is used for various output files. -->
    <property file="version"/>

    <!-- This is the working directory for the compilation and jar file generation. -->
    <property name="build.home"   value="build"/>  

    <!-- This is the target directory for the class files -->
    <property name="classes.home" value="${build.home}/classes"/>
 
    <!-- This is the directory to be used for certain tasks which need a temporary directory. -->
    <property name="scratch.home" value="${build.home}/scratch"/>

    <property name="dist.home"     value="dist"/>

    <!-- This is the directory where all kinds of supporting libraries reside. -->
    <property name="lib.home"    value="lib"/>  
   
    <!-- This is the directory where all external libraries reside which are neccessary when compiling or running the app. -->
    <property name="runtime.lib.home"     value="${lib.home}/runtime"/>

    <!-- Specifies the directory where the JInput plugins (jar files) reside. -->
    <property name="plugin.lib.home"     value="${lib.home}/plugin"/>

    <!-- Specifies the directory where the unpacked native libraries are. The unpacked native libraries are needed to run the app. -->
    <property name="native.lib.home" value="${lib.home}/native"/>
 
    <!-- This is the directory which contains the app's source code. -->
    <property name="src.home"      value="src"/>

    <!-- name of the output .jar file -->
    <property name="jar.name" value="jarfile.jar" />    

    <!-- The filename of the jar file which contains the classes. -->
    <property name="classes.jar.name" value="${app.name}-${app.version}.jar"/>

    <!-- The filename of the Jar file containing the resources. -->
    <property name="resources.jar.name" value="${app.name}-resources.jar"/>
 
    <!-- The file name of the source distribution. -->
    <property name="srcdist.file.name" value="${app.name}-${app.version}-src.zip"/>

    <!-- The top folder name inside the source distribution. -->
    <property name="srcdist.dir.name" value="${app.name}-${app.version}-src"/>

    <!-- ===================== End Property Definitions ======================= -->

    <!-- ==================== External Dependencies =========================== -->

    <!-- The fileset containing everything which selects everything that is needed to form the source distribution. -->
    <fileset id="srcdist.files" dir="${basedir}" >
    <include name="*.*"/>
   
    <!-- do not copy own build.properties -->
    <exclude name="build.properties"/>
   
    <include name="${lib.home}/**/*.*"/>
   
    <include name="${src.home}/**/*.*"/>
   
    <!-- Exclude any class files which may have been generated in the source code directory.  
           This happens when NetBeans is used as IDE. -->
    <exclude name="${src.home}/**/*.class"/>
    </fileset>  

    <!-- This fileset contains everything that is needed to run the application. -->
    <fileset id="runtime.lib.files" dir="${runtime.lib.home}">
       <include name="*.jar"/>
    </fileset>
   
    <!-- This fileset contains the JInput plugins -->
    <fileset id="plugin.lib.files" dir="${plugin.lib.home}">
       <include name="*.jar"/>
    </fileset>
   
    <!-- ==================== Init Target ================================== -->

    <!-- Init creates the timestamp. -->
    <target name="init">
       <tstamp/>
       <mkdir dir="${scratch.home}"/>
    </target>
   
    <!-- ==================== Compilation Classpath =========================== -->

    <!-- This builds the classpath which is needed when the source gets compiled. -->

    <path id="compile.classpath">
       <fileset refid="runtime.lib.files"/>
    </path>

    <!-- This builds the classpath containing the JInput plugins. -->
    <path id="plugin.classpath">
       <fileset refid="plugin.lib.files"/>
    </path>

    <!-- ==================== Compile Target ================================== -->
   
    <target name="compile" depends="init" description="Compiles the sourcecode.">
     
      <mkdir  dir="${classes.home}"/>

      <!-- compile with given parameters -->
      <javac srcdir="${src.home}"
          destdir="${classes.home}">          
          <classpath refid="compile.classpath"/>
      </javac>
    </target>
   
    <!-- ==================== Create JAR ================================== -->  
       
    <target name="jar" depends="compile,-pre-jar" description="Create jar and MANIFEST.MF">

      <!-- create a property containing all .jar files, prefix lib/, and seperated with a space -->
      <pathconvert property="libs.project" pathsep=" ">
        <mapper>
          <chainedmapper>
            <!-- remove absolute path -->
            <flattenmapper />
            <!-- add lib/ prefix -->
            <globmapper from="*" to="lib/*" />
          </chainedmapper>
        </mapper>

        <path>
          <!-- lib.home contains all jar files, in several subdirectories -->
          <fileset dir="${lib.home}">
            <include name="**/*.jar" />
          </fileset>
        </path>
     </pathconvert>

     <!-- create the jar -->
     <jar jarfile="${build.home}/${jar.name}" basedir="${build.home}/classes">

       <!-- define MANIFEST.MF -->
       <manifest>
         <attribute name="Built-By" value="Anders" />
         <attribute name="Main-Class" value="com.example.ControllerExample" />
     
         <attribute name="Class-Path" value="${libs.project}" />
       </manifest>
     </jar>  

     <!-- ==================== Create JAR Dist ================================== -->
   
     <delete dir="${dist.home}" />

     <!-- contains all library dependencies -->
     <mkdir dir="${dist.home}/lib" />

     <copy todir="${dist.home}" file="${build.home}/${jar.name}" />
     <copy todir="${dist.home}/lib" filtering="off">

     <!-- remove the directory hierarchy: lib contains no subdirectories -->
     <flattenmapper />
     <fileset dir="${lib.home}" includes="**/*.jar" />
     </copy>
   
    </target>

    <!-- ======================== Run Target ================================= -->

    <target name="run" depends="compile, -determinePlugin">        
       <java fork="true" classname="${controllerexample.mainclass}" taskname="">
         <classpath>
   <path refid="compile.classpath"/>
                <path refid="plugin.classpath"/>
   <pathelement path="${classes.home}"/>
                <pathelement path="${src.home}"/>
        </classpath>
        <!-- TEMP these are set in java class..... -->
        <!-- <sysproperty key="java.library.path" value="${basedir}/${native.lib.home}"/> -->            
        <!-- <sysproperty key="jinput.plugins" value="${jinput.plugins}"/>  -->
      </java>
    </target>
 
    <target name="-determinePlugin">
      <condition property="jinput.plugins" value="net.java.games.input.DirectInputEnvironmentPlugin">
                <os family="windows"/>
      </condition>
      <condition property="jinput.plugins" value="net.java.games.input.OSXEnvironmentPlugin">
   <os family="mac"/>
      </condition>
      <condition property="jinput.plugins" value="de.bitecode.input.linux.LinuxInputEnvironmentPlugin">
   <and>
                    <os name="Linux"/>
                    <isset property="altplugin"/>
   </and>
      </condition>
      <condition property="jinput.plugins" value="net.java.games.input.LinuxEnvironmentPlugin">
   <os name="Linux"/>
      </condition>      
    </target>

    <target name="ControllerExample"
   description="starts example application">
               <property name="mainclass" value="${controllerexample.mainclass}"/>      
          <antcall target="run"/>
     </target>
</project>
14  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-24 22:37:47
Wish I could say problem solved, but this one is just  i n s a n e  Angry

As mentioned I use NetBeans but I wanted to try the JAR creating in Eclipse, so I made a small JInput test project there. After importing/adding all the needed jars, jinput.jar jutils.jar etc etc, I tried to run the project. Then I get the same exception as above, which I also got from my created JAR in NetBeans.

So I have the following results when trying to run this project:

* NetBeans 5.5.1

- running inside IDE: perfect result, no problems at all
- running created JAR: causing the exception above

* Eclipse

- running inside IDE: causing the exception above

SO what the heck is the problem? Been trying to figure out exactly how NetBeans compiles/loads/runs a project to maybe gets some clues, but it's confusing. And so unbelievably annoying. The days go by. It's not an appealing thought to give up on this when it IS actually working, running in NB. Don't really know which way to go from here, but I want to post my simple code + the Ant build file NB uses....if anyone could take a look at this I would be grateful, perhaps I missed something obvious. Last try. Sorry if I'm a bit off topic.

NetBeans build.xml (works when running in NB, not working correct when running created JAR):
15  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-23 16:15:53
Your last comment is encouraging, plus it's only logical that it should work in both cases (if first one is true). That said, I would have been up for some code digging if that was my only option.

Will go at it again after a nutrious pizza, thanks for your replies Smiley

/ Anders
16  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-23 13:01:34
So the bug reveals itself when trying to run app as a JAR? Forget what I said about never seeing "....polling = false...". This + all my connected devices shows up when running my app in NetBeans (everythings works Smiley) so no bug there(?).

This error first comes to surface when running my created JAR. Is this "JAR/older JInput version" issue a known bug? Sorry for asking the same thing over and over, I just can't accept (well) that the older JInput version(s) are only runnable in an IDE?

Correct me if I'm wrong, and if you can, cheer me up some  Cool

/ Anders
17  Java Game APIs & Engines / JInput / Re: error starting jinput on: 2008-07-22 21:10:27
I know this topic is old, however, the exception thrown is identical to mine so I'm on topic imo  Roll Eyes

I refuse to give up the great functionality of the older JInput I'm using (yes I start to sound repetetive...). The version including dxinput.dll that is (only one .dll in that version).

My application works, as mentioned several times before, perfect in NetBeans with my gamepad being recognized and behaving as it should. I've also semi-solved the loading of the .dll (which was my main issue in earlier posts here, so BIG smile Smiley). Turned out it wasn't any problems with the loading part at all! I totally forgot (did not know this) to set the "jinput.plugins" System property to point at the DirectInputEnvironmentPlugin. After doing this, I could run my created JAR, containing my class files, and then receive the exception above. In the folder next to my JAR I have a lib folder containing jinput.jar, jutils.jar and some other JInput jars. Before adding the "jinput.plugins" property I did not see the "Creating Dell USB Keyboard Hub polling = false" part at all.

So now I feel I've gotten much closer to a solution; this MUST be possible?! It works great in NetBeans so why wouldn't it work when running as a JAR? 

(I gave up on the latest JInput version, had to make non-trivial changes in my code (which I don't mind in general) but never got the wanted result. Perhaps its just the way I developed my app; I feel it works much much smoother / simpler when using the old Axis class.)

Please, any help would be much appreciated, I can't be far off now  Smiley

Here is the code I use at the top of the application's main class:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
static {
        try {
            System.setProperty("java.library.path", "C:/TEST/NativeDebug/lib/native/dxinput.dll");
            System.setProperty("jinput.plugins", "net.java.games.input.DirectInputEnvironmentPlugin");
            System.load("C:/TEST/NativeDebug/lib/native/dxinput.dll");            
        }
        catch(Exception e) {
            System.out.println("Error loading library: " + e);
        }
}


Thanks!

/ Anders
18  Java Game APIs & Engines / JInput / Re: Polling two components simultaneously? on: 2008-07-18 16:44:50
Aha! Then I know what to do, good news thanks.

/ Anders
19  Java Game APIs & Engines / JInput / Re: Polling two components simultaneously? on: 2008-07-18 00:58:18
I'm using the Event class the way it is described in "Getting started...". What I meant was this:

If I push the, say left, analog stick max to the left and keep it there, I would expect to get -1.0 on Identifier.Axis.X. But more often I instead get for example -0.11035 on Identifier.Axis.Y, replacing(?) the registered X value (at least it seems I can no longer check its value..). Of course it's fully logical that the stick is not held clean to the left, with no value (=0.0) on the Y axis. But I somehow fail to check both those values (X and Y) only one at a time, thus making it very difficult to manage which way my characters should move . That's the reason I asked if polling two components (Axix.X and Axis.Y = 2 components? Smiley) at the same time is possible. I admit I have not yet given it enough time; still a bit frustrated over my JAR/dll issue hehe...

Haven't got a grip of EventQueue either yet. Good to hear it's fully possible, I can sleep good tonight then.

/ Anders
20  Java Game APIs & Engines / JInput / Re: Load DLL outside or inside JAR? on: 2008-07-17 20:30:17
For now I think I have to give up, after 4 days of struggling. I will have to work on modifying my code to suit the latest JInput instead, which for some reason  d o e s  work when executing my app as a JAR. So that's a good thing of course, it's just hard to let go when it *should* be SO simple...

Endolf: if you read this, I would like some help with my other post "Polling two components...". After testing some it feels like the Event class among others, forces me to change the code quite a bit. I'm struggling to poll two components at the same time; gamepad button press + polling left/right on an analog stick for example? Surely this must be possible?

If you or anyone else has some info on this, the above mentioned thread is available Smiley

Good night!

/ Anders
21  Java Game APIs & Engines / JInput / Re: Load DLL outside or inside JAR? on: 2008-07-17 16:15:42
Thanks for clearing things up Smiley

With the risk of sounding like a complete moron now  Shocked :

If I still would like to use the older JInput version I have in my current code (where everything runs/works great in NetBeans with gamepad), can your code above accomplish the same thing, in the case of loading dxinput.dll (the only DLL in this version)?? THAT would be excellent.

You may not have read my other recent posts, but I have got gamepad support working with an executable JAR, together with the latest JInput version.  This might sound offensive to some Wink ; what's the problem if he's already got it working?? Well, I really really would like to work with the old Axis class I have in my current code. It's just a question of loading the DLL for that version....

Many thanks for your input!! I will try your code + some other workarounds I might not have tested yet.

/ Anders


22  Java Game APIs & Engines / JInput / Re: Load DLL outside or inside JAR? on: 2008-07-17 12:38:28
Thanks for taking the time to answer, feeling better already Smiley

However, the application IS running perfectly in NetBeans with JInput and the above files; my characters move as expected when using my gamepad. The very annoying issue is regarding the deployment of the app - I want to run it as a JAR, with all files included in it. But the gamepad don't get registered somehow; the missing link is dxinput.dll.

So, I don't care anymore if the DLL gets loaded from within the JAR - I just need for it to get loaded at all, at any cost almost  Cool Could you (or someone else ) please explain generally how you would do the following:

1. Bundle the app's files (.class, images, sounds etc) as a JAR. This I know how to do Smiley A bit unsure though on how the manifest file *should* be?
2. Get the app's main class inside the JAR to load a native lib (dxinput.dll in my case), from outside the JAR. Would be satisfied just to create a deployment folder that includes the JAR + the native library, and distribute this folder to anyone who might be interested.

This is all I want to do, getting somewhat desperate now as I feel that this really is a trivial matter? I would be extremely happy if I could make this work, thanks for listening Smiley

/ Anders


23  Java Game APIs & Engines / JInput / Load DLL outside or inside JAR? on: 2008-07-16 23:10:05
First of all: the return of endolf gives me hope, I'm hoping for some guidance Smiley

I just couldnt let the old JInput version be... I like the way the Axis class work and i.e. how the game characters move based on this, so:

Been trying for 3 days to load a native library file, dxinput.dll (yes from an older JInput version), to make my game work with gamepad support.
That is, when running the app as a JAR; in NetBeans all functionality is there. I've totally given up on loading the dll from within the JAR (from a "lib" folder), but I even fail to load it in any way; with an absolut path, say "C:/Test/dxinput.dll" using the System.load() or System.loadLibrary().

The files I'm using are these:

jinput.jar
jutils.jar
win32-x86-directinput-plugin.jar
linux.jar
linux-eventinterface-jinput-plugin-0.1.jar
dxinput.dll
libjinput.so
libLinuxEventInterface-i386.so

Please, I NEED help with this, how do I make this work??   Undecided

Thanks in advance!

/ Anders

24  Java Game APIs & Engines / JInput / Re: Polling two components simultaneously? on: 2008-07-14 19:11:36
I would love some input on this matter  Tongue

Is it for example possible (on a gamepad) to press a button while polling right/left on any of the analog sticks? This I was able to do with the older version (that included Axis class), worked great. I hope I can get that functionality from the latest version aswell.

Sorry for being impatient but I'm dying to finish the job. Have a nice evening all.

/ Anders
25  Java Game APIs & Engines / JInput / Polling two components simultaneously? on: 2008-07-14 10:28:38
After solving the JAR/dll problem in my last (and first Smiley) thread, I'm moving on...

I'm using a Logitech USB gamepad, and its left analog stick to move a character left/right. In a method for processing poll data I check event.getComponent().getIdentifier() to find out which component was polled. In the case above I look for Component.Identifier.Axis.X (left analog is polled) and then call methods to update character position and animation. However, more often than not, the event registered is coming from Component.Identifier.Axis.Y instead of X; for example when polling max to the left (X axis) its hard to avoid polling some small value on the Y axis aswell. I would be fine if BOTH X and Y values were registered, but it seems one is replacing the other?  Huh

I could look for that small Y axis value too, but this gets confusing when the character is moving to the right (max right on left analog); if only ONE component at a time is registered, my character behaves unexpectedly to say the least  Cool

In comparison: when using the older JInput version (with dxinput.dll; see my JAR problem thread..) with the Axis class, I had no problem with moving characters or controlling their animations. So I was aaalmost ready...then I had to do it all over again, to make it work running my app as a JAR with this new version Grin Well well.

I need some advice; are there other components (than X / Y) to use when checking the analog sticks?

Thanks for listening.
 
26  Java Game APIs & Engines / JInput / Re: Problem with JAR + dxinput.dll on: 2008-07-13 21:50:20
Ok, it seems like a solution has arrived Smiley

The best part is that the native files are actually located and loaded from within the JAR (which I didn't think was easily doable). Not been setting a single java.library.path. I have yet to work out all the details, but I successfully managed to interact with my app (executed by JAR) through a gamepad.

First of all I have been using an old version of JInput (just used the same files I found in a tutorial ("jinputTutorialOne" I think). That version included only one dll file, dxinput.dll. I got the latest via link in "Getting started..." Smiley. Found out that the Axis class (of older version) was removed so I had to modify (in the process of doing this Smiley) some methods in my app to make it work. Great relief to see the gamepad responding at last, when running my app-jar!

/ Anders
27  Java Game APIs & Engines / JInput / Re: Problem with JAR + dxinput.dll on: 2008-07-13 16:36:15
Been looking around some more in this forum and it seems like many of you actually got this to work; being able to deploy through JWS etc, suggests that you either never had this problem, or have overcome it.

Looking forward to hearing your solutions Smiley Want to get this up and running....so many hours..

/ Anders
28  Java Game APIs & Engines / JInput / Problem with JAR + dxinput.dll on: 2008-07-13 14:10:53
Hello

I was hoping for some input on a very annoying problem of mine. Feeling is it must have a simple solution... I did some searching this forum before posting, didn't find any tip, so...:

I've made a simple game which uses JInput, more specifically I use a gamepad to play it. Everythings works as expected in my IDE (NetBeans) so no problem here. However, I'm trying to bundle everything in an executable JAR (in the unlikely event that someone actually wants to try it Smiley). This works almost as expected; code, images and sound are all OK, but the most important piece is missing, the gamepad functionality...

Both the plugins and native files are included in JAR (lib/native, lib/plugin, lib/runtime). Im using a class loader (http://www.jdotsoft.com/JarClassLoader.php) which handles the JAR creation. The docs concerning this loader states that all files, including native ones, can be placed at any location within the JAR; the loader will find them. But somehow the gamepad functionality is not there when running the JAR hmmm.

I have tried to manually set the java library path (absolute), to point at dxinput.dll, as follows:

1  
2  
3  
4  
5  
6  
7  
8  
try {
    System.setProperty("java.library.path", "c:/MinAppFolder/MinApp/");
    System.load("c:/MinAppFolder/MinApp/dxinput.dll");
    // also tried System.loadLibrary("dxinput.dll") here...
}
catch(UnsatisfiedLinkError e) {
    System.out.println(e);
}


The above code being placed first in the program main-method. It's of course not ideal, but I did this just to test if I could get it to work at all...
No luck with this option either :/ (I'm never getting UnsatisfiedLinkError though)

Have any of you experienced this problem aswell? I would really appreciate some help with this, feels like I've tried all options. What am I doing wrong?

/ Anders
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (33 views)
2014-12-15 09:26:44

Mr.CodeIt (24 views)
2014-12-14 19:50:38

BurntPizza (51 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (46 views)
2014-12-05 12:39:02

SHC (60 views)
2014-12-03 16:27:13

CopyableCougar4 (61 views)
2014-11-29 21:32:03

toopeicgaming1999 (124 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!