Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

rect.h

00001 //FILE:         rect.h
00002 //AUTHOR:       Nathan Cournia <nathan@cournia.com>
00003 
00004 #ifndef COURNIA_RECT_H
00005 #define COURNIA_RECT_H 1
00006 
00008 /*
00009  * Stores information for a w x h rectangle at (x, y).
00010  */
00011 template <class T>
00012 struct rectangle
00013 {
00014         T x; 
00015         T y; 
00016         T w; 
00017         T h; 
00018 
00020         inline void set_xy( T x_, T y_ ) {
00021                 x = x_;
00022                 y = y_;
00023         }
00024 
00026         inline void set_wh( T w_, T h_ ) {
00027                 w = w_;
00028                 h = h_;
00029         }
00030 
00032         inline void set( T x_, T y_, T w_, T h_ ) {
00033                 x = x_;
00034                 y = y_;
00035                 w = w_;
00036                 h = h_;
00037         }
00038 
00040         inline void scale( T s ) {
00041                 x *= s;
00042                 y *= s;
00043                 w *= s;
00044                 h *= s;
00045         }
00046 };
00047 
00049 typedef rectangle<int> recti;
00050 
00052 typedef rectangle<float> rectf;
00053 
00054 #endif

Generated on Tue Feb 11 18:49:41 2003 for uber by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002