Hi, C# in VS2008 using Tao.Freeglut and Tao.OpenGl
I am required to create a 3d Tetris game.
I have a menu named BuildMenu
private static void BuildMenu(){
submenu1 = Glut.glutCreateMenu(selectMessage);
Glut.glutAddMenuEntry("New Game(N)", 1);
Glut.glutAddMenuEntry("Reset(R)", 2);
Glut.glutAddMenuEntry("Quit(Q)", 3);
Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);
}
using these code I can make a menu pop when I click right mouse button at once
now my real problem is that
I want to use the right button for rotating my game board
while holding the right mouse the game will rotate
that is why I want to make the menu pop up "AFTER" releasing the right mouse button
but I dont know how with glutAttachMenu()
because when I click the right mouse it pops up immediately
here is my code for mouse button
private static void MouseButton(int button, int state, int x, int y)
{
if (button == Glut.GLUT_LEFT_BUTTON)
{
if (state == Glut.GLUT_DOWN)
{
lmd = 1;
}
else
{
lmd = 0;
}
}
if (button == Glut.GLUT_RIGHT_BUTTON)
{
if (state == Glut.GLUT_DOWN)
{
rmd = 1;
}
else
{
rmd = 0;
}
}
if (button == Glut.GLUT_MIDDLE_BUTTON)
{
if (state == Glut.GLUT_DOWN)
{
mmd = 1;
}
else
{
mmd = 0;
}
}
}
rmd means right mouse down
mmd middle mouse down and
lmd left mouse down
left mouse rotates the game on x-axis
right = z-axis
middle mouse = y-axis