Make a menu after a right click on the mouse

Started by
2 comments, last by gaurav khanduja 19 years ago
Hi, I am making a 3D chess using WIN32 and OpenGL I have already my menu that I made using openGL square. But I would like a menu when the user click right on the mouse. like (enable view ...) I would like the piece of code to show how add the menu entity after a right clcik. Thanks Gazzall
Advertisement
I don't know exactly, but such menus are called 'context menus'. Perhaps you can google on that term and find out more.

Greetz (again),

Illco
Yes, there should be plenty of info available on text menu's. What you basically should do is receiving the WM_RBUTTONDOWN message (or WM_CONTEXTMENU). In both cases you should get the current mouse cursor position and convert that to screen coordinates. Then there is a windows function, can't recall its name that will display the menu (TrackPopupMenu or something like that).

Hope this helps a bit.

Crafter 2D: the open source 2D game framework

?Github: https://github.com/crafter2d/crafter2d
Twitter: [twitter]crafter_2d[/twitter]

Hey


Probably you can use this thing

glutCreateMenu(quit_menu);
glutAddMenuEntry("quit",1);
glutAttachMenu(GLUT_RIGHT_BUTTON);

And then something like

void quit_menu(int id)
{
if(id ==1) exit (0);
}

Hope this helps you.

GK

This topic is closed to new replies.

Advertisement