Difference between revisions of "Rect t"

From Valve Developer Community
Jump to: navigation, search
m
 
Line 1: Line 1:
{{wrongtitle|title=Rect_t}}
+
{{DISPLAYTITLE:Rect_t}}
 
A rectangle with a two-int point location (the upper-left-hand corner) and an int width and height.
 
A rectangle with a two-int point location (the upper-left-hand corner) and an int width and height.
 
  struct Rect_t
 
  struct Rect_t

Latest revision as of 08:15, 30 November 2011

A rectangle with a two-int point location (the upper-left-hand corner) and an int width and height.

struct Rect_t
{
	int x, y;
	int width, height;
};

Example

A rectangle whose upper-left-hand corner is at (3, 4) and whose bottom-right-hand corner is 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 and height 2 would be constructed like this:

Rect_t rect = { 3, 4, 2, 2 };