Login  Register

Re: mouse handling on AWT and also NEWT

Posted by gouessej on Nov 24, 2010; 3:36pm
URL: https://forum.jogamp.org/mouse-handling-on-AWT-and-also-NEWT-tp1960775p1961298.html

Hi!

Look at the source code of TUER, especially the alpha branch that uses JOGL 1.1.1a, it should work with JOGL 2 too, it uses AWT, not NEWT.

Look at this class for the mouse control:
http://tuer.svn.sourceforge.net/viewvc/tuer/alpha/main/GameMouseMotionController.java?revision=269&view=markup

http://tuer.svn.sourceforge.net/viewvc/tuer/alpha/main/GameController.java?revision=269&content-type=text%2Fplain
//builds a transparent cursor
BufferedImage cursor=new BufferedImage(1,1,BufferedImage.TYPE_INT_ARGB);
cursor.setRGB(0,0,0);
frame.setCursor(Toolkit.getDefaultToolkit().createCustomCursor(cursor,new Point(0,0),"empty cursor"));

The crosshair is drawn in this class somewhere:
http://tuer.svn.sourceforge.net/viewvc/tuer/alpha/main/GameGLView.java?revision=269&content-type=text%2Fplain

I hope it will be helpful.

N.B: The source code is under GPL version 2.

I know only a very few open source Java first person shooters using OpenGL. Tesseract is an open source Java first person shooter but it uses software rendering. Resistance Force uses LWJGL and is not open source. Sorry :(
Julien Gouesse | Personal blog | Website