events.h File Reference

#include "CrabClaw/types.h"

Data Structures

struct  cc_event
 An event to be passed to the user program. More...

Typedefs

typedef struct cc_event cc_event_t
 An event to be passed to the user program.

Enumerations

enum  cc_event_type_t {
  CC_KEY_DOWN_EVENT = 1,
  CC_KEY_UP_EVENT,
  CC_MOUSE_BUTTON_DOWN_EVENT,
  CC_MOUSE_BUTTON_UP_EVENT,
  CC_MOUSE_DRAGGED_EVENT,
  CC_JOYSTICK_BUTTON_DOWN_EVENT,
  CC_JOYSTICK_BUTTON_UP_EVENT,
  CC_JOYSTICK_AXIS_MOTION_EVENT,
  CC_QUIT_EVENT = 0xFFFFFFFE,
  CC_INVALID_EVENT = 0xFFFFFFFF
}
 Event Types. More...

Functions

int cc_event_peek (cc_event_t *event)
 Copy the top event on the queue into the passed structure.
int cc_event_pop (cc_event_t *event)
 Pop the top event on the queue into the passed structure.
int cc_event_push (cc_event_t *event)
 Push an event onto the bottom of the queue.
char cc_event_translate_key (cc_event_t *event)
 Translate a key up or down event into a character.

Typedef Documentation

typedef struct cc_event cc_event_t

An event to be passed to the user program.

An event is a small amount of data that is passed to the user program from the operating system below. Various types of events exist. For a reference of these events, consult the cc_event_type_t documentation

Since:
1.0.0


Enumeration Type Documentation

Event Types.

Each Event queued must be of one of these types.

Since:
1.0.0
Enumerator:
CC_KEY_DOWN_EVENT  Keyboard Key Down.

Since:
1.0.0
CC_KEY_UP_EVENT  Keyboard Key Up.

Since:
1.0.0
CC_MOUSE_BUTTON_DOWN_EVENT  Mouse Button Down.

Since:
1.0.0
CC_MOUSE_BUTTON_UP_EVENT  Mouse Button Up.

Since:
1.0.0
CC_MOUSE_DRAGGED_EVENT  Mouse Dragged.

Since:
1.0.0
CC_JOYSTICK_BUTTON_DOWN_EVENT  Joystick Button Down.

Since:
1.0.0
CC_JOYSTICK_BUTTON_UP_EVENT  Joystick Button Up.

Since:
1.0.0
CC_JOYSTICK_AXIS_MOTION_EVENT  Joystick Axis Movement.

Since:
1.0.0
CC_QUIT_EVENT  Program Is Exiting.

Since:
1.0.0
CC_INVALID_EVENT  Invalid Event.

Since:
1.0.0


Function Documentation

int cc_event_peek ( cc_event_t event  ) 

Copy the top event on the queue into the passed structure.

This function copies the top event from the event queue into the passed pointer, without removing it from the queue.

Since:
1.0.0
Parameters:
event The destination for the top event in the queue.
Returns:
1 on success, 0 on failure.

int cc_event_pop ( cc_event_t event  ) 

Pop the top event on the queue into the passed structure.

This function pops the top event from the event queue into the passed pointer, removing it from the queue.

Since:
1.0.0
Parameters:
event The destination for the top event in the queue.
Returns:
1 on success, 0 on failure.

int cc_event_push ( cc_event_t event  ) 

Push an event onto the bottom of the queue.

This function is generally used only internally in order to push operating system level events onto the event queue. It can however be used by a user program, if the programmer desires to simulate events.

Since:
1.0.0
Parameters:
event The event to be added to the queue.
Returns:
1 on success, 0 on failure.

char cc_event_translate_key ( cc_event_t event  ) 

Translate a key up or down event into a character.

This function translates a key up or key down event into its printable (if applicable) character, taking into account the shift modifier if it is being asserted in the event. This function has no effect if the type field of the event is not CC_KEY_DOWN_EVENT or CC_KEY_UP_EVENT.

Since:
1.0.0
Parameters:
event The event to be translated.
Returns:
The character that the event refers to, modified as applicable, or 0 if the event is not a key up or down event.

SourceForge.net Logo