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 crosshairs

Author
Message
Goonj
15
Years of Service
User Offline
Joined: 21st Sep 2009
Location:
Posted: 10th Nov 2009 23:42
I have to make a program that tracks the movement of the mouse cursor with a set of cross hairs.As the user moves the pointer, the crosshairs should move with it.

goonj
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 11th Nov 2009 00:18
Okay...

Track the mouse with dbMouseX() and dbMouseY, and draw a circle or something every frame to those coordinates.
Goonj
15
Years of Service
User Offline
Joined: 21st Sep 2009
Location:
Posted: 11th Nov 2009 00:27
okay... i will make a code..and post it here if something does not work...

goonj
Goonj
15
Years of Service
User Offline
Joined: 21st Sep 2009
Location:
Posted: 11th Nov 2009 02:43
how to i track the mouse location without its click?

goonj
Cuddle Bunniezzz 12
15
Years of Service
User Offline
Joined: 14th Jan 2009
Location: Buffalo, NY
Posted: 11th Nov 2009 02:58
Here, this should work



I'm away from my computer right now, so I can't test it, If someone could see if it works, that would be great.

http://twewy-fan.com/ <-- The first ever fansite for "The World Ends With You"
Goonj
15
Years of Service
User Offline
Joined: 21st Sep 2009
Location:
Posted: 11th Nov 2009 03:07
i tried running it but u can not see the lines ....

goonj
Ultimate_H
15
Years of Service
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 11th Nov 2009 03:10
try moving dbCLS() before drawCrosshair(), otherwise everything drawn will just be cleared.

Goonj
15
Years of Service
User Offline
Joined: 21st Sep 2009
Location:
Posted: 11th Nov 2009 03:18
hey thank you much... that worked.. i also need help with a mouse rollover program if you can help me out.I have done it mostly..i just need to change some things in it.Actually i need to change the image with the detection of the cursor...if its on the image,it should change to second image and when the pointer goes away from the image i.e., the second one, the image should change back to first image.. i did it with fullclick function but that it is not right.

goonj
Goonj
15
Years of Service
User Offline
Joined: 21st Sep 2009
Location:
Posted: 11th Nov 2009 03:21
do you have any ID or email address?If you dont mind telling...I really need help with some of my other programs too... I would be very thank ful if you can give ...

goonj
Ultimate_H
15
Years of Service
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 11th Nov 2009 03:54
Although I will probably never consider myself the best source for good coding practices, I will probably just as much never mind giving what help I can. I have updated my profile so that my email is public. Whether you send me your queries, or post them here(if you put them here more than just me can help), I will give what advice I know.

As for the changing image, what you can do is check the mouse position(e.g. dbMouseX(), dbMouseY()) with the bounds of the image/sprite. meaning:
dbSpriteY() -Top
dbSpriteX() -Left
dbSpriteY()+dbSpriteHeight()-Bottom
dbSpriteX()+dbSpriteWidth() -Right

if it is in those, change the sprite from one to the other. and when it is out of those, change it back.

another method would be to make a single pixel sprite, and check to see if it is colliding with the image, if it is, make it the changed image, if it is not, then make it the original. I think this way would be easier than the first.
Hope that helps.

-H

Cuddle Bunniezzz 12
15
Years of Service
User Offline
Joined: 14th Jan 2009
Location: Buffalo, NY
Posted: 11th Nov 2009 04:46
You can contact me at xadrieth@aol.com.

also, here's a bit more cleaned up version of the code above:


With the sprite rollover thingy, other then the one that Ultimate_H stated, could could use dbSpriteHit() or dbPoint().

If you use dbSpriteHit(), you would though need to to load up an image file for the cursor, but if you can do some fancy artwork, you could make a nice looking cursor

http://twewy-fan.com/ <-- The first ever fansite for "The World Ends With You"
Goonj
15
Years of Service
User Offline
Joined: 21st Sep 2009
Location:
Posted: 11th Nov 2009 04:52
i can not use dbspritehit according to my syllabus being covered til nw...and how can i use dbpoint()? i have already used upperx,uppery,lowerx,lowery.... but i need to check if the mouse is over or off the image?what should do for that?Have a look at my code snippet under the "mouse rollover" topic... and plz tell me a way to fix it

goonj
Goonj
15
Years of Service
User Offline
Joined: 21st Sep 2009
Location:
Posted: 11th Nov 2009 04:53
this is my code for mouse rollover

goonj

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-20 11:46:00
Your offset time is: 2024-11-20 11:46:00