Menu

#5 x-like event generation

open
Qutey
None
5
2007-02-06
2007-02-06
No

this approach was proposed by Qutey, instead of parsing chars in
the file descriptor,
these functions will be added :
+ int dgtnixHasPendingEvent()
+ dgtnix_event_t dgtnixGetNextEvent()
+ int dgtnixGetFileDescriptor()

dgtnix_event_t is an union with a 'type' field, types of events are, for
the moment :
+ piece add
+ piece remove
+ time

in the case of a "piece add" or a "piece remove" event, the square and
piece are available as fields in the returned union. In case of a "time
event", the time left to the players and the current player flag are
available. The file descriptor is used only to do polling if needed (
i.e. select(...) ).

This mechanism is strongly inspired by the Xlib event management scheme.

We think that the main advantages are :
+ elegance
+ no more threading in the lib
+++> ease of use for the library user (who does not have to parse the FD
anymore)
+ reentrant functions, allowing multiple board to be connected to the PC

A priori, compatibility will be kept with good old time message parsing
on the FD.

Discussion


Log in to post a comment.