Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (547)
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  Java Game APIs & Engines / JInput / Re: Mouse support - OSX on: 2006-03-10 06:48:04
I just want to thank you for putting so much work into this library, Elias.  I know we all keep asking, "are we there yet, are we there yet?"  We must be driving you nuts.
2  Java Game APIs & Engines / JInput / Re: Mouse support - OSX on: 2006-02-28 04:42:45
Quote
When polling the system mouse seems to rember the last polls casuing the mouse poll to report movement even though I'm not moving the mouse.

I've been having this problem, too, on Panther.  But not always.  Can anyone tell me why the attached class does not suffer from this bug?
3  Java Game APIs & Engines / JInput / Re: Quake-like Mouse Control on: 2006-02-26 20:43:28
Quote
This works perfectly for me (with jogl)

Hiding the cursor is easy.  What we want is to immobilize the cursor.
4  Java Game APIs & Engines / JInput / Re: Quake-like Mouse Control on: 2006-02-20 03:39:06
Sweet!  It works!  My cursor freeze doesn't block JInput!
5  Java Game APIs & Engines / JInput / Re: Quake-like Mouse Control on: 2006-02-20 02:33:35
I think this cursor locking function is something that only game developers really need.  So it doesn't belong in a graphics API or an input API.  It belongs in a game API.  Problem is, there's no catch-all framework like SDL on the Java platform -- yet -- except for LWJGL.

So... maybe the thing to do is write another library that makes use of JInput, but can lock and unlock the cursor -- or use java.awt.Robot.mouseMove() on platforms where this is unavailable.  Then I wrap JInput's mouse functionality in my own Mouse class, and use everything else in JInput as is.  Since the Mac is the main platform on which the Robot approach causes problems, this would be a portable and environmentally friendly approach.

No need to pollute.
6  Java Game APIs & Engines / JInput / Re: Quake-like Mouse Control on: 2006-02-19 23:46:49
Quote
You can use JOGL's OpenGL bindings with LWJGL (and vice versa). To use JOGL with LWJGL's OpenGL context, call GLDrawableFactory.createExternalGLContext() when LWJGL's OpenGL context is current, and call GLContext.getGL() on the resulting GLContext object when you want to draw. LWJGL has similar functionality.

Thank you.  I'll try that.

Here's another question: for the time being, if I used my own native library to surpress cursor movement, would JInput still report mouse motion?
7  Java Game APIs & Engines / JInput / Re: Quake-like Mouse Control on: 2006-02-19 19:12:16
I'd much rather let someone else handle the headache of writing JNI code.

Here's the thing: this mouse input issue is the one thing that might discourage me from using Java for my game.

So JInput is wonderful.  It does everything I need as far as user input goes except that it doesn't allow you to unplug the cursor from the mouse.

I've tried LWJGL for this, and it works great, but I dislike their OpenGL bindings.  It is particularly obnoxious that gluUnProject wants double-scripted projection arrays (where OpenGL uses single-scripted arrays as a rule) whereas glGetDouble gives you a DoubleBuffer.  So if I went with LWJGL, I'd need a way to use JOGL in place of LWJGL's own GL.

I've had good experiences with Simple DirectMedia Layer in C, and I know that there is a project to bind SDL to Java (http://sdljava.sourceforge.net/).  Unfortunatley, sdljava is incomplete and still missing most of OpenGL.

And I'm not satisfied with my little native library.

So what's a poor Java programmer like me supposed to do?
8  Java Game APIs & Engines / JInput / Re: Quake-like Mouse Control on: 2006-02-18 02:17:32
I know that the mouse reading functionality is available in JInput.  It's just that learning how to use somebody else's JARs always takes time and I sometimes get lazy.  That's why I wrote JNI calls.  Besides, JInput is using JNI itself.

Jake2 runs at an acceptable rate on my machine, except if you try to use the mouse.
9  Java Game APIs & Engines / JInput / Re: Quake-like Mouse Control on: 2006-02-13 01:46:34
I tried using java.awt.Robot to warp the cursor.  It worked, but very slowly: it could take upwards of a hundred milliseconds to read the mouse position once on Mac OS X.  Windows performed significantly better, but was still sluggish.  I also tried outsourcing the cursor warping to a native C method, but that increased the lag to more than one second for some reason.

I finally wound up using the approach mentioned in this forum of freezing the cursor and reading the mouse deltas.

For freezing the cursor, use the following Carbon function (if you're on Mac OS X):
CGAssociateMouseAndMouseCursorPosition(false);

Reading the mouse deltas is a little bit more obnoxious, just because JNI can be very tempermental.

CGMouseDelta x, y;
CGGetLastMouseDelta(&x,&y);

Then x and y represent the amount by which the mouse position changed the last time the application received a mouse event.  By application, I mean the parent process that contains the JVM.  Whenever you launch a Java application on Mac OS X it seems like the JVM gets wrapped up inside a Cocoa application.  So I cannot guarantee that my techniques would work in an applet.

Now, of course my native library only works on OS X.  But I think that this behavior would not be too hard to port to other platforms.  It's obviously been done before.

If you still have any interest in using JOGL, I would be happy to post my Java and C source files, as well as my shared libraries and JARs.
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.

atombrot (23 views)
2014-08-19 09:29:53

Tekkerue (22 views)
2014-08-16 06:45:27

Tekkerue (21 views)
2014-08-16 06:22:17

Tekkerue (12 views)
2014-08-16 06:20:21

Tekkerue (19 views)
2014-08-16 06:12:11

Rayexar (57 views)
2014-08-11 02:49:23

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (29 views)
2014-08-08 02:01:56

Norakomi (36 views)
2014-08-06 19:49:38

BurntPizza (66 views)
2014-08-03 02:57:17
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!