Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  mouse control (hiding + resetting cursor)?  (Read 1362 times)
0 Members and 1 Guest are viewing this topic.
Offline Usul

Senior Newbie




I hunt bugs


« Posted 2005-08-06 19:23:33 »

hi,

what is the best way for a typical fps mouse control? 

The problems would be: 

1. Hiding the cursor.
2. Resetting the cursor.
3. Getting the cursor position in my behavior

OK, I know I could set the cursor to a transparent image.  And yes I know I can set the cursor postition with the robot class.  But since we have a fency 3D API, I wondering if a standard request like that is already implemented?  I mean the Robot class is not really a perfect solution. 

I hope there is a standard solution.

To problem 3:  I have a behavior which awakes every 30 milliseconds.  Then I need to get the cursor position.  How do I do that without a mouse event?

thanx,

Usul

It's times like this that I wish I'd listened to what my dad used to tell me.
Yeah? What was that?
I don't know. I never listened. 
- Dr. Venkman and Mr. Zeddemore
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2005-08-07 04:39:49 »

To read the mouse (not cursor, what you want is raw mosue input) look at JInput.

Don't ty to count on synchronizing behaviros with render, they are inherently asyncrhonous.

You want all your game logic to be based on WakeOnFrame(0)

You might want to download JNWN (my current project) for an example of how to build a
usable game framework around.within J3D.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Usul

Senior Newbie




I hunt bugs


« Reply #2 - Posted 2005-08-07 09:31:48 »

You want all your game logic to be based on WakeOnFrame(0)

In the API it says
Quote from: Java3d API
In general, applications cannot count on behavior execution being synchronized with rendering. Behaviors that use WakeupOnElapsedFrames with a frame count of 0 are an exception to this general rule. Such behaviors will be executed every frame. Further, all modifications to scene graph objects (not including geometry by-reference or texture by-reference) made from the processStimulus methods of such behaviors are guaranteed to take effect in the same rendering frame.

But what if I want to wake up only every 20th frame?  Because I want to safe computing time and only compute my game logic every 20th frame (for example).  Is this then still synchronized with rendering, or is really only WakeupOnElapsedFrames(0) synchronised?

Edit: OK, forget it, it I realised that was a stupid question. 


So with pure Java3d a fps - like mouse look is not implemented or possible without the robot class?

It's times like this that I wish I'd listened to what my dad used to tell me.
Yeah? What was that?
I don't know. I never listened. 
- Dr. Venkman and Mr. Zeddemore
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2005-08-09 01:03:03 »

You want all your game logic to be based on WakeOnFrame(0)

In the API it says
Quote from: Java3d API
In general, applications cannot count on behavior execution being synchronized with rendering. Behaviors that use WakeupOnElapsedFrames with a frame count of 0 are an exception to this general rule. Such behaviors will be executed every frame. Further, all modifications to scene graph objects (not including geometry by-reference or texture by-reference) made from the processStimulus methods of such behaviors are guaranteed to take effect in the same rendering frame.

But what if I want to wake up only every 20th frame?  Because I want to safe computing time and only compute my game logic every 20th frame (for example).  Is this then still synchronized with rendering, or is really only WakeupOnElapsedFrames(0) synchronised?

Edit: OK, forget it, it I realised that was a stupid question. 


So with pure Java3d a fps - like mouse look is not implemented or possible without the robot class?

Quite possible, and not with robot.  Use JInput to read the mouse.  I forget how to hide the cursor but there is a way.  (of al lelse you could just set
the cursor to a custom cursor thats nil, but there may be a better way.)

ON the first question, yo uwake every frame, and you do whatevre yo uwant.  That might be increment a rame counter and exit unelss its
20.

But I wouldnt time anythign based on render rate because that varies all over the palce and you willget uneven results, Do it based on real elapsed clock time.
 

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Usul

Senior Newbie




I hunt bugs


« Reply #4 - Posted 2005-08-09 08:50:33 »

thank you.  I use robot now and I'll change it to JInput in the future.

It's times like this that I wish I'd listened to what my dad used to tell me.
Yeah? What was that?
I don't know. I never listened. 
- Dr. Venkman and Mr. Zeddemore
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (29 views)
2014-11-22 12:13:56

xFryIx (71 views)
2014-11-13 12:34:49

digdugdiggy (50 views)
2014-11-12 21:11:50

digdugdiggy (44 views)
2014-11-12 21:10:15

digdugdiggy (38 views)
2014-11-12 21:09:33

kovacsa (62 views)
2014-11-07 19:57:14

TehJavaDev (67 views)
2014-11-03 22:04:50

BurntPizza (65 views)
2014-11-03 18:54:52

moogie (80 views)
2014-11-03 06:22:04

CopyableCougar4 (80 views)
2014-11-01 23:36:41
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!