Gel2D - The free/open source game creation suite

gelViewport.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 __GELVIEWPORT_H__
00017 #define __GELVIEWPORT_H__
00018 
00019 #include "gelColor.h"
00020 #include "gelRect.h"
00021 
00022 namespace gel
00023 {
00026 
00027 
00040     class GelViewport
00041     {
00042         public:
00044 
00045                         GelViewport();
00046                         GelViewport( int mode );
00047                         GelViewport( GelRect dims );
00048                         GelViewport( GelRectf dims );
00049 
00051 
00052                         ~GelViewport();
00053 
00054             void reset();
00055 
00056             void setAbsRect( GelRect dims ) { absRect = dims; }
00057             void setRelRect( GelRectf dims ) { relRect = dims; }
00058 
00059             GelRect getAbsRect() const { return absRect; }
00060             GelRectf getRelRect() const { return relRect; }
00061 
00062             void setSizingMode( int mode ) { sizingMode = mode; }
00063             int getSizingMode() const { return sizingMode; }
00064 
00065                         void setBackgroundColor( GelColor col ) { backgroundCol = col; }
00066                         GelColor getBackgroundColor() const { return backgroundCol; }
00067 
00068                         GelRect relToAbs() const;
00069 
00070                         bool operator == ( const GelViewport &vp ) const;
00071                         bool operator != ( const GelViewport &vp ) const;
00072 
00073         private:
00074             GelRect absRect;
00075             GelRectf relRect;
00076             GelColor backgroundCol;
00077             int sizingMode;
00078     };
00080 }
00081 
00082 #endif // __GELVIEWPORT_H__