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 Troubles

Author
Message
Digital Scribe
19
Years of Service
User Offline
Joined: 16th Sep 2005
Location:
Posted: 6th Jan 2006 18:55
I've got several game ideas that need a custom cursor. But I can't find a DarkSDK function to change the cursor. Would it be possible to create a cursor image and manual read the input from the mouse and the adjust the mouse's position to match? I would be grateful if someone could give me some ideas.
Miguel Melo
19
Years of Service
User Offline
Joined: 8th Aug 2005
Location:
Posted: 7th Jan 2006 12:09
I believe you can hide the mouse and then blit a sprite or something every frame where the mouse is. I think that Nick (Stinky Stoat or whatever ehehe) has done that in Atomz, I believe he released the source for that.
Vlad
19
Years of Service
User Offline
Joined: 5th Oct 2005
Location:
Posted: 7th Jan 2006 13:04
There is a dbChangeMouse command:

dbChangeMouse ( iCursor )

Quote: "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. "


When I read the description I thought that appart from iCursor = 0 or 1 we could use any loaded image to it, but I'm missing something since the mouse simply disappeared when I used 2, a texture jpg I had around.

How can we define the project media for this to work or is this a copy-paste of the DBPro maybe and the function is useful only to get the normal and the hourglass mouse pointers?

V

p.s.: hey Miguel, portuguese here too.

I'm pretty sure I know everything. Doubts are something rare in me and I am never wrong, as this signature can prove.
Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 7th Jan 2006 14:24
Hi,

As Miguel suggests, I'd use a combo of dbHideMouse(), dbMouseX(), dbMouseY() and dbPasteImage to achieve that. Something like this, dbPasteImage(image_no,dbMouseX(),dbMouseY()) etc.

Hope it helps,
Cheers
Miguel Melo
19
Years of Service
User Offline
Joined: 8th Aug 2005
Location:
Posted: 7th Jan 2006 19:01
Quote: "p.s.: hey Miguel, portuguese here too."


Well, well.... seems like we're taking over the world these days. First we'll get the World Cup and then the Internet BAHAHAH

Ahem, I'll get me coat....
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Jan 2006 23:42
Some of the code I use for mouse replacement using sprites includes-
Header:

Implementation:

My pointer class only uses two types, at the moment, a hand and a ball.

The taImages class (myImages), loads images and makes them accessable by name. Replace those bits with whatever you want to load you pointers.

Somewhere in the main loop, you call the CheckForMouseAction() function to update the mouse.

I've been porting my DBPro code and haven't gotten to where the CheckForMouseAction() changes which image is used. I haven't finished the port yet, but this gives the basics for using a sprite for your mouse. The header includes functions for switching between the two types.

You can easily change this to have an array of image ideas and use an index to pick the one that is active.

Just some sample code that currently works.

Cheers,
Ancient Lady
Atreides
21
Years of Service
User Offline
Joined: 11th Oct 2003
Location: Switzerland (but NOT on a mountain !)
Posted: 8th Jan 2006 12:23
Quote: "When I read the description I thought that appart from iCursor = 0 or 1 we could use any loaded image to it, but I'm missing something since the mouse simply disappeared when I used 2, a texture jpg I had around.

How can we define the project media for this to work or is this a copy-paste of the DBPro maybe and the function is useful only to get the normal and the hourglass mouse pointers?"


In the IDE for DBP, there's a tab called "Cursors", there you can load cursors and use them. They aren't images, you can load them from "C:\WINDOWS\Cursors\"

The sleeper must awaken !

Login to post a reply

Server time is: 2024-11-19 03:38:05
Your offset time is: 2024-11-19 03:38:05