Thread: Pick up mouse movements and clicks

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    37

    Pick up mouse movements and clicks

    Hi peeps,

    i want my draughts game to be mouse enabled. I have this tutorial, but i would like some clarification if its the right way to go.

    I want to be able to select which draught to move and the click on the destination square, and i cant think how this will be done, any help would be welcomed, thanks alot.

    tutorial link:

    http://www.lighthouse3d.com/opengl/glut/index.php?9

    Thanks peeps!

  2. #2
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Just peeked at that tutorial and I noticed that void main() is used. I could be mistaken, but programs that use void main are usually very out-dated and use functions that only old compilers understand, like turboC++ ect.

    I would find a more recent one. Perhaps you would have more luck posting this on the windows or game programming board
    Double Helix STL

  3. #3

    Join Date
    May 2005
    Posts
    1,042
    That tutorial is a perfectly valid way to go. The void main, in this case, doesn't really matter, although it's bad practice. It provides the functionality for using GLUT to accomplish what you are looking for. I've implemented the same type of functionality using Windows API, but then therefore it won't port over to Mac OS, Linux, etc, so using GLUT is a good idea.

    Is there anything about the tutorial you are confused about? The glutMouseFunc(void*) means that you are telling GLUT which function to call to handle the input, and it must take as parameters two ints (which denotes the current mouse position, at the time of the function call, in screen coordinates). Therefore, the function that you implement must also take 2 ints as parameters, etc.
    I'm not immature, I'm refined in the opposite direction.

  4. #4
    Registered User
    Join Date
    Mar 2007
    Posts
    37
    I havnt really tried it out, but i was making sure i didnt get set off in hte wrong direction. Im using openGL n GLUT to make the 3D draught game, but im a little stuck on my forced move section, always messes up, so im kinda stuck on that, i wanted to move on to this. Ill have a go later on tonight hopefully.

Popular pages Recent additions subscribe to a feed