Game Development Reference
In-Depth Information
glutKeyboardFunc/glutKeyboardUpFunc
The
glutKeyboardFunc
and
glutKeyboardUpFunc
functions are called when
FreeGLUT detects that a keyboard key has been pressed down or up, respectively.
These functions only work for keyboard characters that can be represented by
a
char
data type (
glutSpecialFunc
and
glutSpecialUpFunc
handle other
types).
Some applications and game engines may only call the input function once the key is
pressed down, and only sends another signal when the key is released, but nothing
in-between. Meanwhile, others may buffer the inputs allowing you to poll it at later
times to check the current state of any key or input control, while others may provide
a combination of both methods allowing you to choose which method works best for
you.
By default, FreeGLUT calls this function repeatedly while a key is held down,
but this behavior can be toggled globally with the
glutSetKeyRepeat()
and
glutIgnoreKeyRepeat()
commands.
glutSpecialFunc/glutSpecialUpFunc
The
glutSpecialFunc
and
glutSpecialUpFunc
functions are similar to the pre-
vious keyboard commands, but called for special keys such as
Home
,
Insert
, the ar-
row keys, and so on.
glutMouseFunc
The
glutMouseFunc
function is called when mouse button input is detected. This
applies to both button up and button down events, which can be distinguished from
the
state
parameter it sends.
glutMotionFunc/glutPassiveMotionFunc
The
glutMotionFunc
and
glutPassiveMotionFunc
functions are called when
mouse movement is detected. The
glutMotionFunc()
function is used when any
mouse button is currently held down, while the
glutPassiveMotionFunc()
func-
tion is used when no mouse buttons are pressed.
Search WWH ::
Custom Search