September 2018
Intermediate to advanced
328 pages
9h 10m
English
The code containing the definitions and declarations sections is shown as follows:
typedef struct Bounds { int width; int height;} Bounds;// We're using the term "Rect" to represent the rectangle the// image occupies:typedef struct Rect { int x; int y; int width; int height; // Horizontal direction of travel (L/R): char horizDir; // Vertical direction of travel (U/D): char vertDir;} Rect;struct Bounds bounds;struct Rect rect;
New properties were added to the existing Rect definition to accommodate for flexible sizing and tracking movement in the x and y directions. We defined a new struct, Bounds, and removed the existing #define statements because the <canvas> element is no longer a square with static dimensions. ...
Read now
Unlock full access