<html> <head><title>ClanLib Reference: CL_Rect</title></head> <body text=black link=blue vlink=#800080 bgcolor=white topmargin=0 leftmargin=0> <table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td><img border=0 src="../images/eyeheader-main-purple-a.gif" alt="ClanSoft logo" width=525 height=96></td></tr> <tr bgcolor=#dadada><td align=left valign=top><img border=0 src="../images/eyeheader-main-purple-b.gif" alt="ClanSoft logo" width=190 height=14></td><td align=right valign=top><img border=0 src="../images/clanlib_light.gif" width=42 height=14></td></tr></table> <table align=center border=0 cellspacing=10> <tr> <td><a href="entire_class_index.html">Entire Class Index</a></td> <td><a href="class_index.html">Main Class Index</a></td> <td><a href="cross_index.html">Cross Index</a></td> <td><a href="global_index.html">Global Index</a></td> </table><h1 align=center>Class CL_Rect</h1><p> <b> Rect Class</b><br> Contained in: <a href="global_index.html">global</a><br> Derived from: <i>none</i> <br> Derived by: <i>none</i> <br>Group: Core (Math) <p> #include <ClanLib/core.h> <p> <hr noshade> <table border=0> <tr><td colspan=3><h3>public function member index:</h3></td> <tr valign=top><td align=left><h3>Construction:</h3></td> <tr valign=top><td align=right><tt></tt> </td><td align=right><a href="CL_Rect.html#753"><tt><font color=blue><b>CL_Rect</b></font></tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>nx1</font></tt> = 0, <tt><font color=purple>int</font></tt> <tt><font color=blue>ny1</font></tt> = 0, <tt><font color=purple>int</font></tt> <tt><font color=blue>nx2</font></tt> = 0, <tt><font color=purple>int</font></tt> <tt><font color=blue>ny2</font></tt> = 0)</tt>;</td> <tr valign=top><td align=right><tt></tt> </td><td align=right><a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a></td><td><tt>(<tt>const</tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a>& <tt><font color=blue>rect</font></tt>)</tt>;</td> <tr valign=top><td align=left><h3>Operations:</h3></td> <tr valign=top><td align=right><tt><tt>static</tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a></tt> </td><td align=right><a href="CL_Rect.html#755"><tt><font color=blue><b>center</b></font></tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>center_x</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>center_y</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>width</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>height</font></tt>)</tt>;</td> <tr valign=top><td align=right><tt><tt>static</tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a></tt> </td><td align=right><a href="CL_Rect.html#756"><tt><font color=blue><b>left</b></font></tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>x</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>y</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>width</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>height</font></tt>, <tt><font color=purple>bool</font></tt> <tt><font color=blue>center_vert</font></tt> = true)</tt>;</td> <tr valign=top><td align=right><tt><tt>static</tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a></tt> </td><td align=right><a href="CL_Rect.html#757"><tt><font color=blue><b>right</b></font></tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>x</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>y</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>width</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>height</font></tt>, <tt><font color=purple>bool</font></tt> <tt><font color=blue>center_vert</font></tt> = true)</tt>;</td> <tr valign=top><td align=right><tt><tt><font color=purple>void</font></tt></tt> </td><td align=right><a href="CL_Rect.html#758"><tt><font color=blue><b>move</b></font></tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>delta_x</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>delta_y</font></tt>)</tt>;</td> <tr valign=top><td align=right><tt><tt><font color=purple>void</font></tt></tt> </td><td align=right><a href="CL_Rect.html#759"><tt><font color=blue><b>normalize</b></font></tt></a></td><td><tt>()</tt>;</td> <tr valign=top><td align=left><h3>Attributes:</h3></td> <tr valign=top><td align=right><tt><tt><font color=purple>bool</font></tt></tt> </td><td align=right><a href="CL_Rect.html#760"><tt><font color=blue><b>inside</b></font></tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>x</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>y</font></tt>) <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Rect.html#761"><tt><font color=blue><b>get_width</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Rect.html#762"><tt><font color=blue><b>get_height</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt><font color=purple>void</font></tt></tt> </td><td align=right><a href="CL_Rect.html#763"><tt><font color=blue><b>clear</b></font></tt></a></td><td><tt>()</tt>;</td> <tr valign=top><td align=left><h3>Operators:</h3></td> <tr valign=top><td align=right><tt><tt><font color=purple>bool</font></tt></tt> </td><td align=right><a href="CL_Rect.html#764"><tt><font color=black><b>operator</b></font></tt><tt> == </tt></a></td><td><tt>(<tt>const</tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a>& <tt><font color=blue>rect</font></tt>) <tt>const</tt></tt>;</td> <tr><td> </td></table> <hr noshade> <h2>Description:</h2> <p> <hr noshade> <h2>Function Member Descriptions:</h2> <a name="753"><font size=+1><b>CL_Rect::CL_Rect</b></font></a> - Rect Constructor<br><tt></tt> <a href="CL_Rect.html#753"><tt><font color=blue><b>CL_Rect</b></font></tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>nx1</font></tt> = 0, <tt><font color=purple>int</font></tt> <tt><font color=blue>ny1</font></tt> = 0, <tt><font color=purple>int</font></tt> <tt><font color=blue>nx2</font></tt> = 0, <tt><font color=purple>int</font></tt> <tt><font color=blue>ny2</font></tt> = 0)</tt>;<br><blockquote> nx1 - right constraint<br> ny1 - bottom constraint<br> nx2 - left constraint<br> ny2 - top constraint</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="754"><font size=+1><b>CL_Rect::CL_Rect</b></font></a> - Rect Copy Constructor<br><tt></tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a><tt>(<tt>const</tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a>& <tt><font color=blue>rect</font></tt>)</tt>;<br><blockquote> rect - The rectangle to copy</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="755"><font size=+1><b>CL_Rect::center</b></font></a> - Creates a rectangle around the given centre<br><tt><tt>static</tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a></tt> <a href="CL_Rect.html#755"><tt><font color=blue><b>center</b></font></tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>center_x</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>center_y</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>width</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>height</font></tt>)</tt>;<br><blockquote> center_x - The x coord of the centre<br> center_y - the y coord of the centre<br> width - The width of the rectangle<br> height - The height of the rectangle<br> Returns - The centred rectangle</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="763"><font size=+1><b>CL_Rect::clear</b></font></a> - Sets all rectangle dimensions/points to 0.<br><tt><tt><font color=purple>void</font></tt></tt> <a href="CL_Rect.html#763"><tt><font color=blue><b>clear</b></font></tt></a><tt>()</tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="762"><font size=+1><b>CL_Rect::get_height</b></font></a> - Get Height<br><tt><tt><font color=purple>int</font></tt></tt> <a href="CL_Rect.html#762"><tt><font color=blue><b>get_height</b></font></tt></a><tt>() <tt>const</tt></tt>;<br><blockquote> Returns - Height of rectangle</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="761"><font size=+1><b>CL_Rect::get_width</b></font></a> - Get Width<br><tt><tt><font color=purple>int</font></tt></tt> <a href="CL_Rect.html#761"><tt><font color=blue><b>get_width</b></font></tt></a><tt>() <tt>const</tt></tt>;<br><blockquote> Returns - Width of rectangle</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="760"><font size=+1><b>CL_Rect::inside</b></font></a> - Determine if a point is inside the rectangle<br><tt><tt><font color=purple>bool</font></tt></tt> <a href="CL_Rect.html#760"><tt><font color=blue><b>inside</b></font></tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>x</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>y</font></tt>) <tt>const</tt></tt>;<br><blockquote> x - the x coord of the point<br> y - the y coord of the point<br> Returns - True if the point is in the rectangle or on it's border.</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="756"><font size=+1><b>CL_Rect::left</b></font></a> - Align the rectangle left<br><tt><tt>static</tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a></tt> <a href="CL_Rect.html#756"><tt><font color=blue><b>left</b></font></tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>x</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>y</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>width</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>height</font></tt>, <tt><font color=purple>bool</font></tt> <tt><font color=blue>center_vert</font></tt> = true)</tt>;<br><blockquote> x - the left edge of the rectangle<br> y - the bottom of the rectangle<br> width - the width of the rectangle<br> height - the height of the rectangle<br> centre_vert - centre the rectangle around the y coord<br> Returns - Left aligned rectangle </blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="758"><font size=+1><b>CL_Rect::move</b></font></a> - Move the rectangle<br><tt><tt><font color=purple>void</font></tt></tt> <a href="CL_Rect.html#758"><tt><font color=blue><b>move</b></font></tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>delta_x</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>delta_y</font></tt>)</tt>;<br><blockquote> delta_x - Distance to move rectangle on x-axis<br> delta_y - Distance to move rectangle on y-axis</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="759"><font size=+1><b>CL_Rect::normalize</b></font></a> - Normalize rectangle. Ensures that x1<x2 and y1<y2.<br><tt><tt><font color=purple>void</font></tt></tt> <a href="CL_Rect.html#759"><tt><font color=blue><b>normalize</b></font></tt></a><tt>()</tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="764"><font size=+1><b>CL_Rect::operator == </b></font></a> - Equivalancy operator<br><tt><tt><font color=purple>bool</font></tt></tt> <a href="CL_Rect.html#764"><tt><font color=black><b>operator</b></font></tt><tt> == </tt></a><tt>(<tt>const</tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a>& <tt><font color=blue>rect</font></tt>) <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="757"><font size=+1><b>CL_Rect::right</b></font></a> - Align the rectangle right<br><tt><tt>static</tt> <a href="CL_Rect.html#754"><tt><font color=blue><b>CL_Rect</b></font></tt></a></tt> <a href="CL_Rect.html#757"><tt><font color=blue><b>right</b></font></tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>x</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>y</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>width</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>height</font></tt>, <tt><font color=purple>bool</font></tt> <tt><font color=blue>center_vert</font></tt> = true)</tt>;<br><blockquote> x - the right edge of the rectangle<br> y - the bottom of the rectangle<br> width - the width of the rectangle<br> height - the height of the rectangle<br> centre_vert - centre the rectangle around the y coord<br> Returns - Right aligned rectangle </blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <hr noshade> <h2>Variable Member Descriptions:</h2> <a name="749"><font size=+1><b>CL_Rect::x1</b></font></a> - Left x coord<br> <tt><tt><font color=purple>int</font></tt> </tt> <tt><a href="CL_Rect.html#749"><tt><font color=blue>x1</font></tt></a>;</tt><hr size="1" width="70%" align="left" noshade="noshade"><br> <a name="751"><font size=+1><b>CL_Rect::x2</b></font></a> - Right x coord<br> <tt><tt><font color=purple>int</font></tt> </tt> <tt><a href="CL_Rect.html#751"><tt><font color=blue>x2</font></tt></a>;</tt><hr size="1" width="70%" align="left" noshade="noshade"><br> <a name="750"><font size=+1><b>CL_Rect::y1</b></font></a> - Bottom y coord<br> <tt><tt><font color=purple>int</font></tt> </tt> <tt><a href="CL_Rect.html#750"><tt><font color=blue>y1</font></tt></a>;</tt><hr size="1" width="70%" align="left" noshade="noshade"><br> <a name="752"><font size=+1><b>CL_Rect::y2</b></font></a> - Top y coord<br> <tt><tt><font color=purple>int</font></tt> </tt> <tt><a href="CL_Rect.html#752"><tt><font color=blue>y2</font></tt></a>;</tt><hr size="1" width="70%" align="left" noshade="noshade"><br> <hr noshade> </body> </html>