Screen Locations

A coordinate system needs two values (a horizontal and a vertical position) to describe the location of a point on the screen. There are times, however, when it is more convenient to use one variable instead of two.

Some graphics functions require you to pass the location of a point on the screen. Others return a value that represents a location. The GRAPH.H file defines two structures that allow you to refer to a point with a single variable.

An _xycoord structure contains two short integers called xcoord and ycoord for use in viewport graphics.

A _wxycoord structure contains two doubles called wx and wy for use in window-coordinate graphics.

For example, you pass four doubles to the _rectangle_w function: an x and y position for the upper-left corner of the window and an x and y position for the lower-right corner. The _rectangle_wxy function takes two _wxycoord structures.