The Mother Board

Motherboards.org forums. Free tech support, motherboard ID, and more.
It is currently Sat Aug 18, 2018 8:24 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: C++/openGL/Mouse
PostPosted: Mon Sep 20, 2004 7:11 am 
Offline
Brown Belt
Brown Belt

Joined: Wed Feb 11, 2004 3:01 pm
Posts: 266
Location: Anyplace with internet
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!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 27, 2004 7:30 am 
Offline
Brown Belt
Brown Belt

Joined: Wed Feb 11, 2004 3:01 pm
Posts: 266
Location: Anyplace with internet
wow...didn't think my question was that complicated....
:oops: :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?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Oct 01, 2004 1:59 pm 
Offline
Pilgrim
Pilgrim

Joined: Sat Sep 18, 2004 1:51 am
Posts: 11
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group