OpenGLEAN
OpenGLEAN User Support
Home page | Introduction | Documentation | Files | Examples | Proposals | Authors | Links


OpenGLEAN Development
Summary | CVS | (discussion via home page) | (contact via home page) | (suggestion box) | License | Todo | Bugs

Input Callbacks
[OpenGLEAN API Reference]

Collaboration diagram for Input Callbacks:


Functions

void glutEntryFunc (void(*callback)(int state))
void glutKeyboardFunc (void(*callback)(unsigned char key, int x, int y))
void glutKeyboardUpFunc (void(*callback)(unsigned char key, int x, int y))
void glutMotionFunc (void(*callback)(int x, int y))
void glutMouseFunc (void(*callback)(int button, int state, int x, int y))
void glutPassiveMotionFunc (void(*callback)(int x, int y))
void glutSpecialFunc (void(*callback)(int key, int x, int y))
void glutSpecialUpFunc (void(*callback)(int key, int x, int y))

Function Documentation

void glutEntryFunc void(*)(int state)  callback  ) 
 

Window mouse entry/leave callback.

Parameters:
callback Client window-entry hook.
When the mouse enters or exits a window (or sub-window), OpenGLEAN can report this transition via the Entry callback. state is one of GLUT_LEFT or GLUT_ENTERED respective of whether the mouse left or entered the window.

This callback is bound to the current window.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

See also:
glutPassiveMotionFunc()

void glutKeyboardFunc void(*)(unsigned char key, int x, int y)  callback  ) 
 

Sets the Keyboard callback for the current window.

Parameters:
callback Client function for keyboard event.
This callback registration allows you to handle traditional ASCII keyboard input. A general rule of thumb is that if a key has a common ASCII code, then OpenGLEAN assigns that code to the key and calls the Keyboard callback with the ASCII code in the key parameter. For other keys, you must use glutSpecialFunc(). Not all keys can be reported by OpenGLEAN.

As a convenience, the mouse coordinates, relative to your window, are also returned.

This callback is bound to the current window.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

Note:
This function is not very international-friendly.

Windows created via glutCreateMenuWindow() always cascade keyboard and mouse events to their parent.

See also:
glutKeyboardUpFunc(), glutSpecialFunc()

void glutKeyboardUpFunc void(*)(unsigned char key, int x, int y)  callback  ) 
 

Sets the keyboard key release callback for the current window.

Parameters:
callback Client hook for ASCII key releases.
This function provides a way to detect the release of a keyboard key. The keys are reported exactly as with glutKeyboardFunc(), save that the callback registered via this function is used to report the event.

This callback is bound to the current window.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

Note:
Windows created via glutCreateMenuWindow() always cascade keyboard and mouse events to their parent.
See also:
glutKeyboardFunc(), glutSpecialUpFunc()

void glutMotionFunc void(*)(int x, int y)  callback  ) 
 

Reports mouse-motion while a button is held.

Parameters:
callback Client hook for dragging mouse.
This function reports the mouse position when the mouse is dragged starting from within your window. (``Dragging'' occurs when you press one or more mouse buttons in one of your OpenGLEAN windows, and then move the mouse around.)

This callback is bound to the current window.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

Note:
Events are reported until the mouse button is released, even if the mouse leaves the window.

Windows created via glutCreateMenuWindow() always cascade keyboard and mouse events to their parent.

See also:
glutMouseFunc(), glutPassiveMotion()

void glutMouseFunc void(*)(int button, int state, int x, int y)  callback  ) 
 

Sets the mouse-button callback for the current window.

Parameters:
callback Client hook for mouse-buttons.
Whenever a mouse button is pressed or released in an OpenGLEAN window, OpenGLEAN checks if that window has a mouse-button (Mouse) callback registered. If so, OpenGLEAN gives the event to the handler. button is the button number, starting from 0. state is GLUT_UP or GLUT_DOWN to indicate the button's new state. The other parameters are the mouse coordinates.

Mouse wheel motion can be reported as buttons. If you do not request otherwise, a wheel spun forward will act like a button clicking down, immediately followed by clicking up. Spinning the same wheel backward will act like a different button clicking. Mouse wheel pseudo-buttons are added after all real buttons.

While the button is held and the mouse is dragged, you receive mouse-motion events (glutMotionFunc()), even if the mouse is dragged out of the window.

This callback is bound to the current window.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

Note:
Reporting the wheel as buttons is actually inherited from X. freeglut added code to support this on WIN32. OpenGLEAN inherited that support from freeglut.

Old GLUT defines the symbols GLUT_LEFT_BUTTON, GLUT_RIGHT_BUTTON, and GLUT_MIDDLE_BUTTON. However, mice can have more than 3 buttons, so these symbols are deprecated.

Windows created via glutCreateMenuWindow() always cascade keyboard and mouse events to their parent.

See also:
glutMotionFunc(), glutPassiveMotionFunc(), glutMouseWheelFunc()

void glutPassiveMotionFunc void(*)(int x, int y)  callback  ) 
 

Sets the non-dragging (gliding?) mouse-motion callback.

Parameters:
callback Client mouse-glide hook.
If you set this callback on a window, then every time that OpenGLEAN detects a change in the mouse position inside that window, with no buttons pressed on that mouse, OpenGLEAN will invoke callback with the window coordinates of the mouse.

This callback is bound to the current window.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

Note:
Windows created via glutCreateMenuWindow() always cascade keyboard and mouse events to their parent.
See also:
glutMotionFunc(), glutMouseFunc(), glutEntryFunc()

void glutSpecialFunc void(*)(int key, int x, int y)  callback  ) 
 

Sets the Special callback for the current window.

Parameters:
callback Client function for keyboard event.
Registers a callback for OpenGLEAN to call when the user presses "special" keys on the keyboard.

The special callback handles some additional keys that are not covered under plain "keyboard" events. The key that is passed to the callback is one of an enumerated set. The association to keys on your keyboard should be obvious. Their GLUT symbol names are:

  • GLUT_KEY_F1
  • GLUT_KEY_F2
  • GLUT_KEY_F3
  • GLUT_KEY_F4
  • GLUT_KEY_F5
  • GLUT_KEY_F6
  • GLUT_KEY_F7
  • GLUT_KEY_F8
  • GLUT_KEY_F9
  • GLUT_KEY_F10
  • GLUT_KEY_F11
  • GLUT_KEY_F12
  • GLUT_KEY_LEFT
  • GLUT_KEY_UP
  • GLUT_KEY_RIGHT
  • GLUT_KEY_DOWN
  • GLUT_KEY_PAGE_UP
  • GLUT_KEY_PAGE_DOWN
  • GLUT_KEY_HOME
  • GLUT_KEY_END
  • GLUT_KEY_INSERT

To receive other keys, see glutKeyboardFunc().

This callback is bound to the current window.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

Note:
Many keys are not included; nor is it possible to apply qualifiers such as the Shift or Ctrl key to these keys.

Windows created via glutCreateMenuWindow() always cascade keyboard and mouse events to their parent.

See also:
glutSpecialUpFunc(), glutKeyboardFunc()

void glutSpecialUpFunc void(*)(int key, int x, int y)  callback  ) 
 

Sets the special key release callback for the current window.

Parameters:
callback Client hook for special key releases.
This function provides a way to detect the release of a keyboard key. The keys are reported exactly as with glutSpecialFunc(), save that the callback registered via this function is used to report the event.

This callback is bound to the current window.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

Note:
Windows created via glutCreateMenuWindow() always cascade keyboard and mouse events to their parent.
See also:
glutSpecialFunc(), glutKeyboardUpFunc()




SourceForge.net Logo Supported in part by SourceForge.net.

Generated on Fri Sep 16 20:15:35 2005 for OpenGLEAN by doxygen 1.4.3
The OpenGLEAN project is hosted by olib.org and SourceForge.