Mouse tutorials
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
fox_astron

Where would I find a good tutorial for using the mouse in Verge? Or at the very least a demo with very well Commented code?

Posted on 2005-08-02 20:35:40

CrazyAznGamer

Quote:Originally posted by Fox Astron

Where would I find a good tutorial for using the mouse in Verge? Or at the very least a demo with very well Commented code?

In your mind. Ready to release to the community.
Or somewhere in the docs, but I don't think I ever saw one.

Posted on 2005-08-02 20:40:31

fox_astron

I was afraid of that...

Posted on 2005-08-02 20:48:39

Overkill

All you gotta do is utilize the following builtin variables:

int mouse.x, mouse.y; // The mouse's location on screen.
int mouse.l, mouse.m, mouse.r; // The button states, updated on ShowPage().
int mouse.w; // The wheel mouse, seems that scrolls are in offsets of 120.


Then use the following code to tell if the mouse is inside a rectangular area:


// Check for mouse within rectangular area
int DetectMouseCollision(int x1, int y1, int x2, int y2)
// Pass: the top left x1,y1 and bottom right x2,y2 coords of the rectangle
// Return: True if the mouse is within the rectangle, false if it is not
// Credit: Overkill
{
return (mouse.x >= x1 && mouse.x <= x2 && mouse.y >= y1 && mouse.y <= y2);
}


Then do something fun like:


if (DetectMouseCollision(30, 30, 60, 60))
{
DrawHoverButton(30, 30, 60, 60);
if (mouse.l)
{
PRESBUTANLOL()
}
}
else
{
DrawButton(30, 30, 60, 60);
}

Posted on 2005-08-03 12:32:04

mcgrue

The mouse stuff may seem daunting at first, but just try Hookrendering a function that TBlits a mouse pointer image to the coordinates (mouse.x, mouse.y), and you should see a bit of the confusion disappear.

Posted on 2005-08-03 15:58:27


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.