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 / Mouse Cursor

Author
Message
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 27th Apr 2009 02:41
I want to be able to use custom mouse cursors in my game. How would I do this? I am using Visual C++ 2008 Express Edition and Dark GDK.

I do not wish to use dbSprite(), dbMouseX(), dbMouseY(), etc to make my custom cursors appear on screen.

Please explain very clearly, very simply, and very exactly what I would do to achieve exactly what I want. Thank you.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 27th Apr 2009 02:44
Ummm why do you not want to use dbSprite(), dbMouseX(), dbMouseY()?

WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 27th Apr 2009 02:49 Edited at: 27th Apr 2009 02:50
Because I have dbWait()'s in my program and because I just want to make custom cursors appear in a different manner.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 27th Apr 2009 02:51
Try this:

dbChangeMouse
Quote: "dbChangeMouse
This command will change the cursor that belongs to the mouse pointer. A value of zero uses the applications arrow cursor and a value of one will use the hourglass cursor. Values 2 to 31 are custom cursors that can be specified in the project media section and selected with this command.

Syntax
void dbChangeMouse ( int iCursor ) "


WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 27th Apr 2009 03:00
I am aware of that function. I don't know how to use it. How to exactly use it is not written in the Documentation. I searched for dbChangeMouse() in the DarkGDK forum. I am unsure how to use the function.

I was hoping that someone would suggest that I use the Windows functions to do what I want to do.
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 27th Apr 2009 05:43
Ok. I tried to use the Windows functions. I got this far:



I don't know what to put in the brackets. The function accepts two arguments. I am uncertain exactly what I am supposed to put in the brackets.

Can anyone please tell me what I should insert? Please tell me exactly what to insert. Please do not be too general in your answer. Thank you.
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 27th Apr 2009 09:18
It would be a heck of a lot easier to use cursors without having to use GDK sprite functions and mouse x y positions....

I too want to find out a way to use the existing windows functions to use/alter cursors, and allow windows to handle the movement etc.
If you find out how """please""" post it on this thread

Regards Steve

AMD Athlon64x2 3.1Ghz - Ram 4Gb DDR2 800Mhz - 500Gb HD
Ndivia 9600GT SLI - 24in LCD - WIN 7 - 64 bit BETA
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 27th Apr 2009 20:01
Add an mouse cursor icon to the resource file then load it using the windows api

WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 28th Apr 2009 02:08
I don't think I know how to do that AlexI. Could you please tell me?
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 28th Apr 2009 02:54 Edited at: 28th Apr 2009 02:56
I actually do not want to have the cursor file in the .exe file. I want to have it as a file that is outside of the .exe. I tried the following to change the mouse cursor:



It does not work. I don't really understand why. Can anyone tell me very clearly and exactly what I should do to change the mouse cursor? Please do not be general in your answer.

If I find out how to change the mouse cursor using the Windows functions, I will post it in this thread stevebrit.
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 28th Apr 2009 03:17 Edited at: 28th Apr 2009 03:25
What is odd is that the code that I typed above is correct and should work, but it doesn't for some strange reason.
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 28th Apr 2009 05:01
I tried. I don't know how to do it.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 28th Apr 2009 06:26
Quote: "It does not work. I don't really understand why."


During the testing phase try giving a fully qualified path to the file rather than a relative path. If it works then it means that you're not specifying the appropriate path relative to where the system things your default is.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 28th Apr 2009 22:35
I tried that before and I just tried it again. It still does not work.
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 1st May 2009 05:26 Edited at: 1st May 2009 05:30
Is there anyway for me to use dbChangeMouse()? The Documentation tells me that the custom cursors are to be specified in the project media section. I believe that Dark GDK and Visual C++ 2008 Express Edition do not have a project media section. Is there a way for me to use dbChangeMouse()? If not, please suggest and explain other methods that I can use to set custom cursors. Please do not suggest that I should set custom cursors by hiding the mouse cursor and replacing it with a sprite or with sprites. If you suggest that I use the windows functions, please give a very detailed and very clear explanation of how exactly do I use the windows functions in order to accomplish what I want. One more thing. Please do not be general in your answer. Please give a very clear and detailed answer.
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 1st May 2009 18:37
I haven't tried changing the cursor using DarkGDK but it is very easy to do with the windows api. See attached demo. Move your mouse over / out of the cube and the cursor will change

Attachments

Login to view attachments
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 3rd May 2009 01:31
It would be nice if you had some code!
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 3rd May 2009 23:53
Could you show me how to do it please? Don't just say it is easy and show me that it can be done. Show me how to do it. When I try it it doesn't work. It is as though the Windows functions are not even being called.
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 7th May 2009 02:44 Edited at: 7th May 2009 04:06
I know what is causing my problem. I just don't know how to solve it.

Does anyone happen to know the class name for any Dark GDK program window? If the name is not known, could you please tell me how I could obtain the class name of any window?

The problem that I am having right now is that when SetCursor() sets the cursor to the one I want, the cursor gets reset to the default one that is specified for the window. I need the class name of the window in order to stop the resetting from happening. The biggest problem now is that I don't know the class name of the window. I don't know what the Dark GDK creators set it to.

Note: I don't understand this stuff too well. My use of terms and my wording might be incorrect.
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 7th May 2009 20:08
Hello WH8

I tried to do the same thing and had the same problem, the cursor gets reset to the original cursor .... I have tried to find a solution, hunted atound on the internet for what seems to be hours.

Someone out there must know the answer to this problem, i am sure a lot of people would be able to make good use of what you are wanting to do including myself ...

PLEASE you guys help out here

Regards :- Steve

AMD Athlon64x2 3.1Ghz - Ram 4Gb DDR2 800Mhz - 500Gb HD
Ndivia 9600GT SLI - 24in LCD - WIN 7 - 64 bit BETA
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 10th May 2009 07:55 Edited at: 10th May 2009 07:55
I want to use SetClassLong() and LoadCursor(). Can anyone tell me the HWND required for SetClassLong() and the HINSTANCE required for LoadCursor()? Please give me a specific answer.
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 10th May 2009 22:26
Ok I decided to make another demo for you, see attached. Move cursor over cube and see it change.

Attachments

Login to view attachments
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 11th May 2009 00:21 Edited at: 11th May 2009 00:28
Don't make me swear at you AlexI. How is showing me that it can be done going to help me do it? I already know that it can be done. No need for you to show me twice or even once that it can be done. I need you to show me how to do it. You clearly know how to do it. You just won't show me how. If that makes you feel better about yourself, go ahead and send me more proofs that it can be done.
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 11th May 2009 06:09 Edited at: 11th May 2009 06:44
I searched the forum. hWnd seems to be the correct handle to the DarkGDK window. I used this handle before. I just recently realized that it doesn't work. The following code doesn't work:



It should work. The reason it doesn't work is because the handle to the window is, I believe, wrong. I don't know why it is wrong. It is supposed to be right.

EDIT: Nevermind. The handle is correct. It is something else that is causing my problem. I don't know how to fix it.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 11th May 2009 22:37
Have you tried providing a fully qualified path to the cursor file?

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 11th May 2009 23:06 Edited at: 12th May 2009 21:29
It has nothing to do with that. The cursor keeps getting reset to the default cursor everytime I move the mouse. I don't know how to stop that from happening.

I heard people talking about responding to WM_SETCURSOR. I don't know how to respond to WM_SETCURSOR.

I tried to change the class cursor. The class cursor did change, but the cursor still gets reset to the default cursor every single time I move my mouse. I don't know what to do.

People just won't come in here and show me some code!
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 12th May 2009 21:37
Ok here is the code:



WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 12th May 2009 22:04 Edited at: 12th May 2009 22:15
You see what kind of an imbecile he is? He thinks this is a joke! Remember that if I figure it out, I get my chance to laugh at you, so don't get carried away.

AlexI, you are also not using Dark GDK. I can tell by looking at your executable files. What you are doing I can learn too. Don't be full of yourself.

You are lucky that I am nice and that I did not flag your post as abusive. Your post is abusive.

One more thing. Don't act smart. Your comment is not code and it has no code in it.
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 12th May 2009 22:18
That's what he always does. And how can you tell it's not GDK? I looked through his exe is ResHacker to check and could find no evidence either way, but it looks a lot like GDK.
What he isn't doing is loading his own cursor, he is just changing the windows one to the "help" cursor.

WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 12th May 2009 22:46 Edited at: 12th May 2009 22:58
It isn't Dark GDK because the executable is too small. When I created very small programs with Dark GDK, the .exe files are around 1990KB in size. His .exe files are only around 600KB in size. This is good proof that he is not using Dark GDK and that he is only using Windows API.

There is proof in The Game Creators website.

http://gdk.thegamecreators.com/?f=darksdkvsdbpro

Look for the words: "Final EXE build size is only 1.8 MB"

Since my .exe files are aound 1990KB in size, it shows that my code could be around 200KB in size since Dark GDK is around 1800KB in size. His .exe files are less than the minimum, which is 1800KB; therefore, he is not using Dark GDK.
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 13th May 2009 00:14
I think he used raw DirectX with the Windows API, to tell you the truth.

#ifdef _DEBUG
FixBugs(All);
#endif
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 13th May 2009 01:23 Edited at: 13th May 2009 01:33
Quote: "I think he used raw DirectX with the Windows API, to tell you the truth."


LOL

Quote: "AlexI, you are also not using Dark GDK. I can tell by looking at your executable files."

Quote: "It isn't Dark GDK because the executable is too small. When I created very small programs with Dark GDK, the .exe files are around 1990KB in size. His .exe files are only around 600KB in size."


Oh dear....

Try compiling a blank DarkGDK program in release mode...

WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 13th May 2009 03:26 Edited at: 13th May 2009 03:27
Ok. So you have proved that you may be able to do it with Dark GDK. What else does that prove? Don't make me go on and argue with you. If you are just trying to find ways to entertain yourself, please do something else somewhere else and excuse yourself from this thread, or else I will ask someone else to excuse you.

By the way; how old are you? Learn to be more respectful and grow up.
SmK
15
Years of Service
User Offline
Joined: 19th May 2009
Location:
Posted: 19th May 2009 22:53
I found how to use custom cursor.
Documentation for DarkGDK very poor and there are no full information about dbChangeMouse(). But if we look into function, we found next code:

I have no idea what is g_Glob+398h. But address 60D808h should be static and next code allow to use custom cursor.

At least it's works for me
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 21st May 2009 04:57 Edited at: 21st May 2009 06:40
Doesn't work for me. I get an unhandled exception.

Quote: "Unhandled exception at 0x004cd109 in Tic Tac Toe.exe: 0xC0000005: Access violation writing location 0x0060d808."


The above is the unhandled exception that I get.

SmK. Just to let you know. You are the first person who has posted helpful code in this thread! Good job and thank you!
SmK
15
Years of Service
User Offline
Joined: 19th May 2009
Location:
Posted: 21st May 2009 09:39
2WH8 Thx ^_^
Quote: "Doesn't work for me. I get an unhandled exception."

Hm... probably this hack-like code don't work for you because our DarkGDK versions differs... but there are more elegant solution
Variable g_ActiveCursor declared in DarkGDK *.cpp files, we have no sources DarkGDK, but if we define it as extern... we can change native DarkGDK variable

I hope it works for anyone
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 21st May 2009 21:34 Edited at: 21st May 2009 22:07
Oh my goodness it works! It is a miracle! Thank you very much SmK! You are definitely nicer and more helpful than that AlexI who was and still is so unwilling to show anyone how he does it.

I have to complement you SmK. You really know what you are doing.

Login to post a reply

Server time is: 2024-11-25 10:25:20
Your offset time is: 2024-11-25 10:25:20