Rect t: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (→Example) |
||
Line 9: | Line 9: | ||
A rectangle starting at (3, 4) and ending at (5, 6) would be constructed like this: | A rectangle starting at (3, 4) and ending at (5, 6) would be constructed like this: | ||
Rect_t rect = { 3, 4, 5-3, 6-4 }; | Rect_t rect = { 3, 4, 5-3, 6-4 }; | ||
Similarly, a rectangle starting at (3, 4) with width (2, 2) would be constructed like this: | |||
Rect_t rect = { 3, 4, 2, 2 }; | |||
[[Category:Helpers]] | [[Category:Helpers]] |
Revision as of 16:56, 11 October 2006
Template:Wrongtitle This helper represents a rectangle with a specified top left point and shift down and right to the bottom right corner.
struct Rect_t { int x, y; int width, height; };
Example
A rectangle starting at (3, 4) and ending at (5, 6) would be constructed like this:
Rect_t rect = { 3, 4, 5-3, 6-4 };
Similarly, a rectangle starting at (3, 4) with width (2, 2) would be constructed like this:
Rect_t rect = { 3, 4, 2, 2 };