The Mother Board
C++/openGL/Mouse

 
Post new topic   Reply to topic    The Mother Board Forum Index -> Programming
View previous topic :: View next topic  
Author Message
SkReaP
Brown Belt
Brown Belt


Joined: 11 Feb 2004
Posts: 266
Location: Anyplace with internet

PostPosted: Mon Sep 20, 2004 7:11 am    Post subject: C++/openGL/Mouse Reply with quote

I feel kinda stupid asking this, but how do you code for the mouse in C++ (preferably in the .net environment)

I realize this is a pretty general question so I'll try to specify:


say I have a mouse class for a 3 button mouse w/wheel:
class Mouse
{
GLfloat XLocation;
GLfloat YLocaiton;
bool Mbutton1(); //LMB pressed down
bool Mbutton2(); //RMB pressed down
bool Mbutton3(); //MMB pressed down
int MWheel() //0=still, 1=up, 2=down
};


and in my code I want to close my program if someone clicks the RMB, so I have this...
Mouse User;
...
if(User.Mbutton2())
{
exit(0);
}
...


what code would I put in:
bool Mouse::Mbuton2()
{
<<HERE>>
};

also, what headers do I need to include?


thx!
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
SkReaP
Brown Belt
Brown Belt


Joined: 11 Feb 2004
Posts: 266
Location: Anyplace with internet

PostPosted: Mon Sep 27, 2004 7:30 am    Post subject: Reply with quote

wow...didn't think my question was that complicated....
oops eye roll lol

let me tone it down a bit...


Let's say I'm writting a C++ application, and I want the program to exit if I click the RMB, IE:

...
if(RMB())
{
exit(0);
}
...

What goes in function RMB()?


Is that simpler?
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
ksog23
Pilgrim
Pilgrim


Joined: 18 Sep 2004
Posts: 11

PostPosted: Fri Oct 01, 2004 1:59 pm    Post subject: Reply with quote

you should probably create 3 private bool variables for each button, and return each one whenever the Mbutton() is called

example

private bool button1;

bool Mbutton1()
{
return button1;
}

somewhere in your program you'll probably need to initialize and set the value for button also.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The Mother Board Forum Index -> Programming All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group