Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Fullscreen is 60 fps but my custom cursor is very slow.

Author
Message
AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 24th Feb 2011 09:28
Hello. Now i have another strange problem. I compiled the exe file on my home computer. Everything is fine everything runs exectly i want. I need to use custom animated cursor. I hided the mouse and created animated sprite with dbCreateAnimatedSprite(); function and pleacing it using dbSprite(CursorID, dbMouseX(); dbMouseY(), CursorID); But when I execute the program on diferent computer this custom cursor sprite moves with a delay. I move mouse and this sprite moves with a delay((( FPS is 60 and more but the sprite moves with a delay. Could enyone help me to understand what is thw problem and how to solve it. Thanks!

Dark GDK IS THE BEST!!!!
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 24th Feb 2011 10:44
What method are you using to track the real cursor position?



Support a charitable indie game project!
AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 24th Feb 2011 11:03
I am using dbMouseX(); dbMouseY(); Oh and one more question in full screen mode when i move the mouse cursor at the top on the screen the system cursor become visible again.

Dark GDK IS THE BEST!!!!
latarka19
13
Years of Service
User Offline
Joined: 5th May 2011
Location:
Posted: 6th May 2011 02:07
Hi, I have exactly the same problem. At the begining of my game loop I draw a sprite using dbSprite(1,dbMouseX(), dbMouseY(),1); and this sprite moves with a delay - following the mouse cursor, not becomeing the cursor itself what I like to do. FPS is stable and high - 60. Whats the problem here, anyone help?
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 6th May 2011 03:35
While I've not actually had this problem myself, I'd be interested in seeing your code (snippet) that illustrates this.


My personal approach is to do something like this:


The thinking behind this is that we only poll the mouse state once each frame. Additionally, with the exception of the first poll (before the while-loop), we will poll *after* the current environment is displayed to the screen (after dbSync()) because any response that the user makes is in response to what they see on screen (which doesn't happen until a dbSync() call).

Does it really matter? Probably not. I'm not sure that anyone can respond in the brief sub-millisecond time frame between the end of dbSync() and the beginning of dbMouseX/Y() - but it helps me to keep in mind that whatever the mouse/keyboard state represents (ie: user-reactions) occurs *after* the user sees the effects of their previous actions...

Notice, however, how I Hide the sprite and then repaste it in the new position (as opposed to calling dbSprite() as the original post at the top shows. In the case of an animated cursor, I would simply call the dbSetSpriteFrame() prior to calling the dbPasteSprite()...

I hope this helps,

JTK

Login to post a reply

Server time is: 2024-11-19 10:41:54
Your offset time is: 2024-11-19 10:41:54