ALT key

Hello! So I am trying to get this function to work by using the 'ALT' key instead of 'a'. I've tried several things and nothings worked, ay one know how to do this?

The windows code for alt is VK_MENU

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
void UKeyboard(unsigned char key, GLint x, GLint y)
{
    switch(key)
    {
	case 'a':
	    if(currentKey == key)
            {
		currentKey = 0;
	    }
	    else
	    {
		currentKey = key;
	    }
		break;

	default:
		if (currentKey == 'a')
		{
		    cout << "Press 'a' to stop orbiting the table" << endl;
		}
		else
		{
		    cout << "Press 'a' to orbit the table" << endl;
		}
	}
}
IIRC, glut does not offer this functionality. You will need the GLFW stuff to get it without using OS-specific code.

It is typically a bad idea to use the Alt/Menu/Meta/whatever key for stuff. The WM typically has serious hooks on it that will get in your user's way at some point, and takes more programming effort than it is worth to get around it.

To start/stop any kind of animation, use the spacebar.
Topic archived. No new replies allowed.