iDevGames Forums
GLUT using modifier keys alone - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: GLUT using modifier keys alone (/thread-6012.html)



GLUT using modifier keys alone - n00bprogrammer - Dec 25, 2004 01:23 AM

Hi, I'm currently using GLUT keyboard funcs and i ran into a small problem. Is there a way to detect the modifier keys such as "ALT", "SHIFT", "CTRL" but without having to detect a normal key? Basically, is there a way to use only alt, shift or ctrl without having to press it with another key?


GLUT using modifier keys alone - DanLab - Dec 25, 2004 08:11 AM

http://www.lighthouse3d.com/opengl/glut/index.php3?5


GLUT using modifier keys alone - n00bprogrammer - Dec 25, 2004 10:48 AM

I have seen that page already, but as i said, the only way to actually process modifier keys is if it's detected to be pressed with a normal key such as "r" or something like that. Is it possible to just detect the alt key pressed by itself and make it a case?

Is something sorta like this possible:

void keyboardfunc(unsigned char, int x, int y){
int r=glutGetModifiers();
if (r==GLUT_ACTIVE_ALT)
do something;
}

so basically, i'm checking if only the alt is pressed, is it possible?


GLUT using modifier keys alone - OneSadCookie - Dec 25, 2004 02:47 PM

Congratulations, you've outgrown GLUT. Time to move on.


GLUT using modifier keys alone - n00bprogrammer - Dec 25, 2004 05:23 PM

eh? move on?


GLUT using modifier keys alone - Josh - Dec 25, 2004 07:48 PM

Indeed. Try SDL.


GLUT using modifier keys alone - Tobi - Dec 26, 2004 01:37 AM

You can stick to glut but handle your keyboard input with GetKeys() (assuming you are working in Carbon). This will allow you to check for any key state on the keyboard. Check out developer.apple.com for the iGetKeys sample code.


GLUT using modifier keys alone - FCCovett - Dec 26, 2004 02:06 AM

There's an example of how to use Carbon events on the source code at http://webpages.charter.net/utopiaplanetia/BasicCarbonStruct.dmg