Tutorial: Draw and perform vsync operations using windows

This simple sample application uses three windows to illustrate a basic drawing and vsync operation. The sample provides reusable functions that are called in the application to create and initialize windows. The sample also includes a complete event loop that you can use in your own application.

In the sample application, an hourglass is placed in the top-left corner of an application window while a vertical bar sweeps from left to right across the screen. The background window is of type SCREEN_APPLICATION_WINDOW, while the hourglass and the bar are implemented as windows of type SCREEN_CHILD_WINDOW. The application is shown below:

Figure 1. The sample vsync application

Each window in the application is given an ID at creation time. The ID is used at runtime to determine which window dispatched the event.

Note: This sample application is used throughout this documentation to illustrate different ways to perform basic drawing and windowing tasks. The complete sample application is included below. You can copy and paste the complete application into a new project, or you can follow along with the tutorial below.