Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
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  
  Changing the Mouse Cursor  (Read 3446 times)
0 Members and 1 Guest are viewing this topic.
Offline psiegel

Junior Devvie




Adamant about gaming.


« Posted 2003-05-10 12:47:31 »

How do you change the mouse cursor in lwjgl?  I can't seem to find it in the docs, and honestly I'm not even sure which object I should be looking through.  (Mouse?  GL?  Display?)

Paul Siegel
Adamant Games, Inc.
http://www.adamantgames.com
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #1 - Posted 2003-05-10 14:27:07 »

I think you're supposed to draw your own. If your using active rendering (I'm guessing yes Smiley) you'd simply draw your cursor texture last. This is actually pretty flexible since such a cursor could also be controlled by a joystick or game controller. (SimCity for the SNES anyone?)

Java Game Console Project
Last Journal Entry: 12/17/04
Offline elias

Senior Devvie





« Reply #2 - Posted 2003-05-10 15:50:02 »

I'm currently looking into enabling the hw cursor and using a custom (animated) icon for it.  It's worth the trouble, because mouse movement is much more sensitive to fps than the rest of a 3d game. I hope it can be done on MasOSX too.

I've seen C&C Generals and NWN do it, the latter having the linux users disgruntled exactly because the cursor is OpenGL rendered in the linux port - locking it to the frame rate.

- elias

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline psiegel

Junior Devvie




Adamant about gaming.


« Reply #3 - Posted 2003-05-11 01:04:11 »

So currently I'll have to render my own, but keep an eye out of Elias to have a stroke of brilliance?  Sounds fair.  

Paul Siegel
Adamant Games, Inc.
http://www.adamantgames.com
Online princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2003-05-12 21:31:10 »

I have a feeling hardware cursors will turn out to be a major can of worms.

I also have a feeling that if you're not running at monitor refresh rate you're not running on a powerful enough system...

Cas Smiley

Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #5 - Posted 2003-05-12 22:01:51 »

I think he means that the software cursor is too fast/slow, not that it's inconsistent on a time basis. People are used to their mice moving a certain speed and won't like it if it suddenly starts zipping around like a mad-man or moving at a dog-slow rate.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline rreyelts

Junior Devvie




There is nothing Nu under the sun


« Reply #6 - Posted 2003-05-13 00:12:17 »

I also have a feeling that if you're not running at monitor refresh rate you're not running on a powerful enough system...

I'm confused here. Why must a game run at refresh rate? Shouldn't it be acceptable for it to run at a nice multiple?. For example, for the game I'm working on, 30/35fps should be a perfectly acceptable frame rate, and so I'd imagine we'd try to get a refresh rate of 60hz or 70hz.

Would a mouse cursor at 30fps be too slow?

God bless,
-Toby Reyelts


About me: http://jroller.com/page/rreyelts
Jace - Easier JNI: http://jace.reyelts.com/jace
Retroweaver - Compile on JDK1.5, and deploy on 1.4: http://retroweaver.sf.net.
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #7 - Posted 2003-05-13 00:16:39 »

well... if u need the cursor only in your menus it shouldnt be a prob (as long as the menus arent tooooo flashy) :>

afair unreal tournament had used a s/w cursor wich moved quite jerkily(fps locked). dunno why it wasnt smooft - the ui itself was quite plain and unspecial.

games like C&C Generals and NWN, wich need a responsible interface would benefit from a h/w cursor for sure.

right now i don't really need that but i think it would be a nice feature Wink

弾幕 ☆ @mahonnaiseblog
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #8 - Posted 2003-05-13 00:42:39 »

>Would a mouse cursor at 30fps be too slow?

imo yes.

-40hz(com) is really painfull (yes. even clicking around in the browser get's an annoying task)
-60hz(ps2-default) is somewhat better. fortunatelly u can overclock the ps2 port(eg. 80,100 and 200hz).
-125hz(usb) is ok.

i use a logitech mx300 mouse... plugged into the ps2 port @200hz. that's really nice this way. the mouse movement is pretty accurate and smooft. sure my screen doesnt run at 200hz but it's nice to have the latest available position for the next screen refresh.

if i play a game running at 85fps@85hz i would get ~2.35 coords per frame. i can either use the latest (most up to date position) or interpolate the last 2 positions.

high cursor fps are a good thing if u want to correct your cursor position/your cursor movement. eg your cursor is 400 pixels away from 20x20pixel thingy u want to click on. if u now move the mouse within one second (that's really slow) to the spot the cursor will make 10 pixel jumps. with 125hz the jumps are just bout 3-4 pixels; therefore the 20x20 pixel box is much easier to hit.

in addition a higher cursor fps rate delivers more data for the users brain. this way he/she/it will be able to get faster used to the mouse sensitivity of your game. after a short warmup time the user will be able to know how far he/she/it has to move the mouse to get to the desired position.

once the distracting factors (=getting used to something) are gone u can get into the zone Smiley

弾幕 ☆ @mahonnaiseblog
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #9 - Posted 2003-05-13 09:49:53 »

I think it doesn't really matter if a cursor is hw or sw as long as it's polled at vsync.
I believe the reason why the windows mouse pointer is a bit jerky is because it's polled at a low rate (iirc it was 25 or 30hz) and (more importantly) independant of the screen refresh rate or whatever connection you use to plug your mouse. Maybe things have changed in winxp, but I'm pretty shure this was still the case in win9x/nt.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #10 - Posted 2003-05-13 10:14:56 »

Why must a game run at refresh rate?

It's difficult to put forward a concrete case for it but it's easy to give a very nice illustration.

In the Alien Flux alpha there's a checkbox in the options screen to run the display at 30Hz. Try it and see the difference! I believe running at half refresh rate is a last-ditch attempt to get a game running on a computer that's just plain too slow to do what you want to do, and it shows, right down to the mouse movement. A hardware mouse cursor is a kind of hack workaround to pretend you're not stretching things a bit too much. I've got the checkbox in there just to let people with terribly slow computers play it but it's not how it's meant to look.

Cas Smiley

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #11 - Posted 2003-05-13 12:02:57 »

Bearing in mind that its much more noticable on a 2d game compared to a 3d one - 60hz is glassy smooth for a 2d game, but if i ever ran windows at 60hz i'd be ill Tongue

On the other hand, playing Black & White is pretty much perfectly acceptable at 30fps (which uses a game-drawn cursor) and still pretty playable at the 10 to 20fps my rig gets me on the later levels. (Whether you still find the game playable on later levels is a whole 'nother can o worms though..)

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline elias

Senior Devvie





« Reply #12 - Posted 2003-05-13 12:35:58 »

In any case I don't think it can hurt to make the feature possible, and speaking of which - the linux implementation is done with full ARGB colors and animation but I'm having trouble finding the relevant cursor code for win32. Could someone more proficient with the win32 api show me the code? I far as I can tell, animated cursors are supported but I have yet to find a function to create one. And it also seems like full translucency isn't supported (like on linux - hah), is that true? The C&C Generals cursor doesn't seem to be alpha blended in any case.

- elias

Offline rreyelts

Junior Devvie




There is nothing Nu under the sun


« Reply #13 - Posted 2003-05-13 12:38:09 »

In the Alien Flux alpha there's a checkbox in the options screen to run the display at 30Hz. Try it and see the difference!

First, when you say "run the display at 30Hz" you're really setting the refresh rate to 60Hz and locking your frame rate to 30Hz right?

I tried the 30Hz option, and after a few minutes, the biggest difference I could tell was that things seemed less reactive. Not so much moving the mouse, but just the game in general.

I believe running at half refresh rate is a last-ditch attempt

I guess I'm just going to have to disagree right now. That may be truthful for a certain class of games - i.e. shooters like AF, but in my team's case, we're developing a turn-based strategy game. It just doesn't require the same kind of responsiveness as a shooter. This has always been my stance before, but these postings about hardware cursors had me concerned.

A hardware mouse cursor is a kind of hack workaround to pretend you're not stretching things a bit too much.

Well, the only reason I was considering a hardware mouse was if the mouse responsiveness was a problem. But, after playing AF at 30Hz, I'm almost positive it's not.

God bless,
-Toby Reyelts


About me: http://jroller.com/page/rreyelts
Jace - Easier JNI: http://jace.reyelts.com/jace
Retroweaver - Compile on JDK1.5, and deploy on 1.4: http://retroweaver.sf.net.
Offline rreyelts

Junior Devvie




There is nothing Nu under the sun


« Reply #14 - Posted 2003-05-13 13:01:44 »

I believe running at half refresh rate is a last-ditch attempt

Let's be precise about this. In reality, we're dealing with absolute numbers that aren't going to change, based on human physiology. If all of the sudden video adapters and monitors started supporting refresh rates at 350Hz, you would still lock your frame rate at something well below that (i.e. 80fps), because their would be no perceived benefit of running a higher frame rate.

So, the real issue at hand is what hard-constant frame rates and what hard-constant refresh rates are necessary for what kinds of applications (i.e. class of games). For example, I would guess that

a) you should run the refresh rate of a monitor at at least 60Hz regardless of application. The important part being that the minimal refresh rate will prevent flicker.

b) fmv should run at 10fps minimally This is the generally accepted number for the minimal frame rate required for humans to perceive smooth animation.

c) turn-based games should run at 30fps minimally

d) shooter games should run at 60fps minimally

God bless,
-Toby Reyelts


About me: http://jroller.com/page/rreyelts
Jace - Easier JNI: http://jace.reyelts.com/jace
Retroweaver - Compile on JDK1.5, and deploy on 1.4: http://retroweaver.sf.net.
Online princec

« JGO Spiffy Duke »


Medals: 429
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #15 - Posted 2003-05-13 14:05:10 »

Well, absolutely, yes.

You probably don't even notice but the animation is actually running at 30Hz or less on A.F. even at 60Hz refresh rate, although sprite positions and scrolling are still being updated at 60Hz.

For a turn-based strategy game I think you could get away with running the animation at 15Hz or even 10Hz and no-one would notice, simply because it's probable that your sprite animations will be at that frequency anyway. The hardware mouse cursor would make it all feel really smooth though.

Our next game is a probably going to be a turn-based RPG, but everything is animated in between turns, and I think we can get away with it for sure.

Cas Smiley

Offline rreyelts

Junior Devvie




There is nothing Nu under the sun


« Reply #16 - Posted 2003-05-13 14:34:21 »

For a turn-based strategy game I think you could get away with running the animation at 15Hz or even 10Hz and no-one would notice, simply because it's probable that your sprite animations will be at that frequency anyway.

That may be the case if you're using sprites, but when you're using 3D models, you interpolate the animation between keyframes, so higher frame rates result in smoother animation.

The hardware mouse cursor would make it all feel really smooth though.

My question here is really what is the minimum acceptable frame rate that a cursor can be done in software. From playing AF, I would have said that 30fps seems to be fine.

Our next game is a probably going to be a turn-based RPG, but everything is animated in between turns, and I think we can get away with it for sure.

Sounds like you're planning on using sprites too. Smiley

God bless,
-Toby Reyelts


About me: http://jroller.com/page/rreyelts
Jace - Easier JNI: http://jace.reyelts.com/jace
Retroweaver - Compile on JDK1.5, and deploy on 1.4: http://retroweaver.sf.net.
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #17 - Posted 2003-05-13 15:14:16 »

30hz for the mouse, yak Shocked

reminds me of when I didn't know any better, and used a Serial mouse Embarrassed

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #18 - Posted 2003-05-13 15:51:23 »

Quote
30hz for the mouse, yak Shocked

reminds me of when I didn't know any better, and used a Serial mouse Embarrassed


serial is 40hz and it's still painfull (as i already said) :>

弾幕 ☆ @mahonnaiseblog
Offline gregorypierce

Senior Devvie




I come upon thee like the blue screen of death....


« Reply #19 - Posted 2003-05-13 18:28:17 »

Animated mouse cursor isn't going to happen on OSX. You can get a hardware one, but it would be the standard system cursor. No biggie doing that - I just wouldn't hide it. The HID system makes no distinction between a game or a word processor so the mouse pointer would be the same ol' mouse pointer with the same performance.

Is there a real problem that's leading to hardware cursors or is it 'well there might be a case where' that's leading to that feature?

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline elias

Senior Devvie





« Reply #20 - Posted 2003-05-13 18:47:07 »

A system mouse is exactly what I want - because the system mouse usually runs at a high fps. The only other thing feature is to be able to specify custom images in ARGB for a cursor animation. I can do that on linux, and I'm now working on win32.

- elias

Offline gregorypierce

Senior Devvie




I come upon thee like the blue screen of death....


« Reply #21 - Posted 2003-05-13 19:16:26 »

Take that back - you can, but not with the rendering library that LWJGL uses.

And if you are going to use the hardware cursor - aren't you pretty much back to using the mouse cursor that Java provides. Don't know about other platforms but on OSX the mouse pointer is the system cursor.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
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.

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

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

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

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

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

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

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

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

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

toopeicgaming1999 (30 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!