Gel2D - The free/open source game creation suite

gelRect.h
Go to the documentation of this file.
00001 /*
00002 Gel2D Game Engine - Cross-platform 2D gaming middleware
00003 Copyright (C) 2011 Mark D. Procarione
00004 
00005 Gel2D is free software: you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation, either version 3 of the License, or
00008 (at your option) any later version.
00009 
00010 Gel2D is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 GNU General Public License for more details.
00014 */
00015 
00016 #ifndef __GELRECT_H__
00017 #define __GELRECT_H__
00018 
00019 namespace gel
00020 {
00021     class GelRect
00022     {
00023         public:
00025 
00026             GelRect() { left = top = width = height = 0; }
00027 
00029 
00033                         GelRect( int _left, int _top, int _width, int _height );
00034 
00036 
00040                         void set( int _left, int _top, int _width, int _height );
00041 
00043 
00044             void toOGLview( int view[4] ) const;
00045 
00046             GelRect operator=( const GelRect &r ) { left=r.left; top=r.top; width=r.width; height=r.height; return *this; }
00047 
00048             bool operator==( const GelRect &r ) const { return ( left==r.left && top==r.top && width==r.width && height==r.height ); }
00049                         bool operator!=( const GelRect &r ) const { return ( left!=r.left || top!=r.top || width!=r.width || height!=r.height ); }
00050 
00051         public:
00052             int left, top, width, height;
00053     };
00054 
00055     class GelRectf
00056     {
00057         public:
00059 
00060             GelRectf() { left = top = width = height = 0; }
00061 
00063 
00067                         GelRectf( float _left, float _top, float _width, float _height );
00068 
00070 
00074                         void set( float _left, float _top, float _width, float _height );
00075 
00076             GelRectf operator=( const GelRectf &r )  { left=r.left; top=r.top; width=r.width; height=r.height; return *this; }
00077 
00078             bool operator==( const GelRectf &r ) const { return ( left==r.left && top==r.top && width==r.width && height==r.height ); }
00079                         bool operator!=( const GelRectf &r ) const { return ( left!=r.left || top!=r.top || width!=r.width || height!=r.height ); }
00080 
00081         public:
00082             float left, top, width, height;
00083     };
00084 }
00085 
00086 #endif // __GELRECT_H__