bx-lib : the Basic X11 Library tuned for C beginners  1.0
Typedefs | Functions
Being Passively notified of state changes by events
Input Control (how to deal with mouse and keyboard)

More advanced programmers in C can be notified of events such as a change of the state of the mouse and the keyboard by making some of their own functions be automatically called by the bx-lib. This requires the knowledge that functions may be passed as arguments to other functions. The notifications occur when the bx-lib "has the hand" on the system, that is, during the execution of functions such as bx_wait(), bx_loop() and bx_show_canvas(). More...

Typedefs

typedef void(* bx_mouse_function )(bx_window window, bx_mouse mouse)
typedef void(* bx_key_function )(bx_window window, unsigned char keycode)

Functions

void bx_on_mouse_press (bx_window window, bx_mouse_function function)
void bx_on_mouse_release (bx_window window, bx_mouse_function function)
void bx_on_mouse_move (bx_window window, bx_mouse_function function)
void bx_on_key_press (bx_window window, bx_key_function function)
void bx_on_key_release (bx_window window, bx_key_function function)

Detailed Description

More advanced programmers in C can be notified of events such as a change of the state of the mouse and the keyboard by making some of their own functions be automatically called by the bx-lib. This requires the knowledge that functions may be passed as arguments to other functions. The notifications occur when the bx-lib "has the hand" on the system, that is, during the execution of functions such as bx_wait(), bx_loop() and bx_show_canvas().

Typedef Documentation

typedef void(* bx_mouse_function)(bx_window window, bx_mouse mouse)

bx_mouse_function is the prototype for functions wanting to be notified on mouse motion, mouse button press, and mouse button release.

typedef void(* bx_key_function)(bx_window window, unsigned char keycode)

bx_key_function is the prototype for functions wanting to be notified on key press, and key release.

Function Documentation

void bx_on_mouse_press ( bx_window  window,
bx_mouse_function  function 
)

How to notify a function that a mouse button is pressed over a given window.

void bx_on_mouse_release ( bx_window  window,
bx_mouse_function  function 
)

How to notify a function that a mouse button is released over a given window.

void bx_on_mouse_move ( bx_window  window,
bx_mouse_function  function 
)

How to notify a function that the mouse is moving over a given window.

void bx_on_key_press ( bx_window  window,
bx_key_function  function 
)

How to notify a function that a key of the keyboard is pressed while a given window owns the keyboard focus.

void bx_on_key_release ( bx_window  window,
bx_key_function  function 
)

How to notify a function that a key of the keyboard is released while a given window owns the keyboard focus.