can anyone help me with mouse handling in c++. espcially on how to check mouse clicking. i am making a game connect four so if anyone could help me with the code and explaining a couple of functions i would really appreciate it. help required urgently.

Recommended Answers

All 5 Replies

If you don't ask an actual question, you're not likely to get any help.

It depends what platform your building your game for. C++ doesn't know about 'mice'

If you're creating your game for Windows, you need to look at the Win32 API. Particularly the message loop or 'pump' as it's sometimes called. Windows will send mouse event msgs with parameters to this function within your C++ program where you can then decide how to handle them.

So Google for some of the terms I've mentioned and you can come back when your problem's a little more specific.

> and explaining a couple of functions i would really appreciate it
OK,

int main ( ) {
  // your code goes here
  return 0;
}

All C and C++ programs begin with this function. When the function returns 0, this indicates that the program has successfully run to completion. Other values you can return are specified using the EXIT_SUCCESS and EXIT_FAILURE macro constants.

Further, int main ( int argc, char *argv[] ) introduce the mechanism by which you can specify command line parameters to the program.

> can anyone help me with mouse handling in c++
Standard C++ knows nothing about mice, or any other kind of rodentae. You need to tell us which operating system, compiler, graphics library etc you're using.

> help required urgently.
I'm sure it is, but that isn't my problem.
http://www.catb.org/~esr/faqs/smart-questions.html#urgent

You need to make use of MFC apis. Just create an application in VC++ environment and use the mouse operation apis.

i am using windows xp OS and not sure about the version but i have borlandc++.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.