Return to previous page | Return to menu | Go to next page


10-7. Event usage example

The sample program “sample_10” (Listing 10-1 and 10-2) is an example of actually performing plumbing using event processing. The program uses events to control and execute the display / non-display of the cube.

The program is roughly divided into two parts: Listing 10-1 “main.c” initializes the system and executes the event, and Listing 10-2 “sample.c” initializes the event and defines and registers the event contents. Is doing.

List 10-1 sample_10: Event processing (main.c)

Flow 10-2 sample_10: Main loop

Listing 10-2 shows the part of “sample10” where event registration and event execution details are defined. In addition, the contents of the event list are changed (added / deleted) in the user-defined function “disp_cube”.

List 10-2 sample_10: Event processing (sample.c)

List 10-2 sample_10: Event processing (sample.c) [Continued]

The following flow chart summarizes the event execution.
The event execution contents differ between the first loop and the second and subsequent loops.
In the figure, the left is the first event execution content, and the right is the second and subsequent execution content.

Flow 10-3 samp_10: Event execution content

Note: SGL library functions that appeared in this chapter

In this chapter, the functions in the following table were explained.

Table 10-1 SGL library functions that appeared in this chapter


Return to previous page | Return to menu | Go to next page