Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members Related Pages

# sdlmm_srect.h

Go to the documentation of this file.

    00001 /*
    00002  * SDLmm - a C++ wrapper for SDL and related libraries
    00003  * Copyright © 2001 David Hedbor <david@hedbor.org>
    00004  *
    00005  * This program is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU General Public License as
    00007  * published by the Free Software Foundation; either version 2 of the
    00008  * License, or (at your option) any later version.
    00009  *
    00010  * This program is distributed in the hope that it will be useful, but
    00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU General Public License
    00016  * along with this program; if not, write to the Free Software
    00017  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00018  *
    00019  */
    00020
    00028 #ifndef SDLMM_SRECT_H
    00029 #define SDLMM_SRECT_H
    00030 #include  "sdlmm_spoint.h"
    00031
    00032 namespace SDLmm {
    00043   class SRect : public SDL_Rect {
    00044   public:
    00047     SRect();
    00048
    00051
    00052     SRect(const SRect& rect);
    00053
    00055
    00056     SRect(const SDL_Rect& rect);
    00057
    00059
    00063     SRect(const SPoint& point);
    00064
    00067
    00071     SRect(const SPoint &upper_left_point,
    00072           const SPoint &bottom_right_point);
    00073
    00076
    00083     SRect(const SPoint &point, Uint16 nw, Uint16 nh);
    00084
    00086
    00090     SRect(Sint16 nx, Sint16 ny, Uint16 nw, Uint16 nh);
    00091
    00093
    00097     SRect(Uint16 nw, Uint16 nh);
    00098
    00100     SRect& operator=(const SDL_Rect& rect) {
    00101       if(this == &rect) return *this;
    00102       x = rect.x; y = rect.y;
    00103       w = rect.w; h = rect.h;
    00104       return *this;
    00105     }
    00106
    00108
    00111     bool operator==(const SDL_Rect& rect) const {
    00112       return ((x == rect.x) && (y == rect.y) &&
    00113               (w == rect.w) && (h == rect.h));
    00114     }
    00115
    00117
    00118     SPoint GetUpperLeft() const { return SPoint(x, y); }
    00120
    00121     SPoint GetUpperRight() const { return SPoint(x+w, y); }
    00123
    00124     SPoint GetBottomLeft() const { return SPoint(x, y+h); }
    00126
    00127     SPoint GetBottomRight() const { return SPoint(x+w, y+h); }
    00128
    00129   };
    00130 }
    00131
    00132 #endif // SDLMM_SRECT_H
    00133

Documentation automatically generated by written by Dimitri van Heesch. | Project hosted at