Why no GLUT_KEY_HELP?
I find these, but nothing like GLUT_KEY_HELP. Even spotlight didn't
find anything. Is this a compatibility issue with older keyboards or PC keyboards?
#if (GLUT_API_VERSION >= 2)
/* function keys */
#define GLUT_KEY_F1 1
#define GLUT_KEY_F2 2
etc.
#define GLUT_KEY_HOME 106
#define GLUT_KEY_END 107
#define GLUT_KEY_INSERT 108
#endif
Interesting, I set a breakpoint in the function below, thinking I could trap
the value and defind the HELP key for myself. But when I do this, the
cursor just changes to a ? mark and nothing happens. Seems like
glut will not even let me use the HELP key.
void Special( int key, int /*x*/, int /*y*/ )
{
static double delta = .01; // by default use .01
static int granularity = 3;
switch ( key )
{
case GLUT_KEY_UP:
find anything. Is this a compatibility issue with older keyboards or PC keyboards?
#if (GLUT_API_VERSION >= 2)
/* function keys */
#define GLUT_KEY_F1 1
#define GLUT_KEY_F2 2
etc.
#define GLUT_KEY_HOME 106
#define GLUT_KEY_END 107
#define GLUT_KEY_INSERT 108
#endif
Interesting, I set a breakpoint in the function below, thinking I could trap
the value and defind the HELP key for myself. But when I do this, the
cursor just changes to a ? mark and nothing happens. Seems like
glut will not even let me use the HELP key.
void Special( int key, int /*x*/, int /*y*/ )
{
static double delta = .01; // by default use .01
static int granularity = 3;
switch ( key )
{
case GLUT_KEY_UP:
GLUT_KEY_INSERT should be the help key, but if it's being caught earlier (by cocoa or something) then you're probably out of luck.
I don't know about Cocoa, but with Carbon you could probably return an eventNotHandledErr in your keyDown event handler... then again, you'd be removing the cross-platformness of GLUT. Then again, you could just add that small bit in, it'd be pretty simple. Although I have no guarentees this would work, it seems like a legitimate approach, give it a try.
Thanks, but I don't even know what an eventNotHandledErr is and I don't use an
event handler
I assume I'm just 100% GLUT and I want to keep the KISS principal (for me).
For now, I'll just make my F1 key help.
event handler
I assume I'm just 100% GLUT and I want to keep the KISS principal (for me). For now, I'll just make my F1 key help.
Initialize...
Define it..
That is keeping it pretty simple.
Give it a try, if nothing else, you can figure out if it works.
Code:
pascal OSStatus KeyDown(EventHandlerCallRef inCallRef, EventRef inEvent, void* inUser);
void initKeyboardCallback()
{
WindowRef ontoThisWindow = FrontWindow();
EventTypeSpec keyEventType;
keyEventType.eventClass = kEventClassKeyboard;
keyEventType.eventKind = kEventRawKeyDown;
InstallWindowEventHandler(ontoThisWindow,
NewEventHandlerUPP(KeyDown),
1,
&keyEventType,
NULL,
NULL);
}Define it..
Code:
pascal OSStatus KeyDown(EventHandlerCallRef inCallRef, EventRef inEvent, void* inUser)
{
#pragma unused(inCallRef, inEvent, inUser)
return eventNotHandledErr;
}That is keeping it pretty simple.
Give it a try, if nothing else, you can figure out if it works.
GLUT is Cocoa, it seems unlikely that adding a Carbon event handler will work at all, let alone do what's wanted.

