<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>sdlmm_srect.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.8.1 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>sdlmm_srect.h</h1><a href="sdlmm__srect_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/*</font> 00002 <font class="comment"> * SDLmm - a C++ wrapper for SDL and related libraries</font> 00003 <font class="comment"> * Copyright © 2001 David Hedbor <david@hedbor.org></font> 00004 <font class="comment"> * </font> 00005 <font class="comment"> * This program is free software; you can redistribute it and/or</font> 00006 <font class="comment"> * modify it under the terms of the GNU General Public License as</font> 00007 <font class="comment"> * published by the Free Software Foundation; either version 2 of the</font> 00008 <font class="comment"> * License, or (at your option) any later version.</font> 00009 <font class="comment"> * </font> 00010 <font class="comment"> * This program is distributed in the hope that it will be useful, but</font> 00011 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00012 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> 00013 <font class="comment"> * General Public License for more details.</font> 00014 <font class="comment"> * </font> 00015 <font class="comment"> * You should have received a copy of the GNU General Public License</font> 00016 <font class="comment"> * along with this program; if not, write to the Free Software</font> 00017 <font class="comment"> * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</font> 00018 <font class="comment"> *</font> 00019 <font class="comment"> */</font> 00020 00028 <font class="preprocessor">#ifndef SDLMM_SRECT_H</font> 00029 <font class="preprocessor"></font><font class="preprocessor">#define SDLMM_SRECT_H</font> 00030 <font class="preprocessor"></font><font class="preprocessor">#include "<a class="code" href="sdlmm__spoint_8h.html">sdlmm_spoint.h</a>"</font> 00031 00032 <font class="keyword">namespace </font>SDLmm { <a name="l00043"></a><a class="code" href="classSDLmm_1_1SRect.html">00043</a> <font class="keyword">class </font>SRect : <font class="keyword">public</font> <a class="code" href="structSDL__Rect.html">SDL_Rect</a> { 00044 <font class="keyword">public</font>: 00047 <a class="code" href="classSDLmm_1_1SRect.html#a0">SRect</a>(); 00048 00051 00052 <a class="code" href="classSDLmm_1_1SRect.html#a0">SRect</a>(<font class="keyword">const</font> SRect& rect); 00053 00055 00056 <a class="code" href="classSDLmm_1_1SRect.html#a0">SRect</a>(<font class="keyword">const</font> <a class="code" href="structSDL__Rect.html">SDL_Rect</a>& rect); 00057 00059 00063 <a class="code" href="classSDLmm_1_1SRect.html#a0">SRect</a>(<font class="keyword">const</font> SPoint& point); 00064 00067 00071 <a class="code" href="classSDLmm_1_1SRect.html#a0">SRect</a>(<font class="keyword">const</font> SPoint &upper_left_point, 00072 <font class="keyword">const</font> SPoint &bottom_right_point); 00073 00076 00083 <a class="code" href="classSDLmm_1_1SRect.html#a0">SRect</a>(<font class="keyword">const</font> SPoint &point, Uint16 nw, Uint16 nh); 00084 00086 00090 <a class="code" href="classSDLmm_1_1SRect.html#a0">SRect</a>(Sint16 nx, Sint16 ny, Uint16 nw, Uint16 nh); 00091 00093 00097 <a class="code" href="classSDLmm_1_1SRect.html#a0">SRect</a>(Uint16 nw, Uint16 nh); 00098 <a name="l00100"></a><a class="code" href="classSDLmm_1_1SRect.html#a8">00100</a> SRect& <a class="code" href="classSDLmm_1_1SRect.html#a8">operator=</a>(<font class="keyword">const</font> <a class="code" href="structSDL__Rect.html">SDL_Rect</a>& rect)<font class="keyword"> </font>{ 00101 <font class="keywordflow">if</font>(<font class="keyword">this</font> == &rect) <font class="keywordflow">return</font> *<font class="keyword">this</font>; 00102 x = rect.x; y = rect.y; 00103 w = rect.w; h = rect.h; 00104 <font class="keywordflow">return</font> *<font class="keyword">this</font>; 00105 } 00106 00108 <a name="l00111"></a><a class="code" href="classSDLmm_1_1SRect.html#a9">00111</a> <font class="keywordtype">bool</font> <a class="code" href="classSDLmm_1_1SRect.html#a9">operator==</a>(<font class="keyword">const</font> <a class="code" href="structSDL__Rect.html">SDL_Rect</a>& rect)<font class="keyword"> const </font>{ 00112 <font class="keywordflow">return</font> ((x == rect.x) && (y == rect.y) && 00113 (w == rect.w) && (h == rect.h)); 00114 } 00115 00117 <a name="l00118"></a><a class="code" href="classSDLmm_1_1SRect.html#a10">00118</a> SPoint <a class="code" href="classSDLmm_1_1SRect.html#a10">GetUpperLeft</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> SPoint(x, y); } 00120 <a name="l00121"></a><a class="code" href="classSDLmm_1_1SRect.html#a11">00121</a> SPoint <a class="code" href="classSDLmm_1_1SRect.html#a11">GetUpperRight</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> SPoint(x+w, y); } 00123 <a name="l00124"></a><a class="code" href="classSDLmm_1_1SRect.html#a12">00124</a> SPoint <a class="code" href="classSDLmm_1_1SRect.html#a12">GetBottomLeft</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> SPoint(x, y+h); } 00126 <a name="l00127"></a><a class="code" href="classSDLmm_1_1SRect.html#a13">00127</a> SPoint <a class="code" href="classSDLmm_1_1SRect.html#a13">GetBottomRight</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> SPoint(x+w, y+h); } 00128 00129 }; 00130 } 00131 00132 <font class="preprocessor">#endif // SDLMM_SRECT_H</font> 00133 <font class="preprocessor"></font> </pre></div><hr> <table cellspacing=10 cellpadding=0 border=0 width=100%> <tr valign=middle><td><font size=-1>Documentation automatically generated by <a href="http://www.stack.nl/~dimitri/doxygen/"><img border=0 align=center src="doxygen.gif" alt="doxygen"></a> written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>.</font></td> <td align=right><font size=-1>Project hosted at <br><a href="http://sourceforge.net"><img align=middle src="http://sourceforge.net/sflogo.php?group_id=25445&type=1" width="88" height="31" border="0" alt="Hosted by SourceForge"></a></font></td></tr></table>