Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

pgcolor.cpp

Go to the documentation of this file.
00001 //
00002 // C++ Implementation: pgcolor
00003 //
00004 // Description:
00005 //
00006 //
00007 // Author: Alexander Pipelka <pipelka@pipelka.net>, (C) 2003
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
00010 //
00011 //
00012 
00013 #include "pgcolor.h"
00014 
00015 PG_Color::PG_Color() {
00016         r = 0;
00017         g = 0;
00018         b = 0;
00019 }
00020 
00021 PG_Color::PG_Color(const SDL_Color& c) {
00022         *this = c;
00023 }
00024 
00025 PG_Color::PG_Color(Uint32 c) {
00026         *this = c;
00027 }
00028 
00029 PG_Color::PG_Color(Uint8 r, Uint8 g, Uint8 b) {
00030         *this = (Uint32)((r << 16) | (g << 8) | b);
00031 }
00032 
00033 PG_Color& PG_Color::operator=(const SDL_Color& c) {
00034         r = c.r;
00035         g = c.g;
00036         b = c.b;
00037 
00038         return *this;
00039 }
00040 
00041 PG_Color& PG_Color::operator=(Uint32 c) {
00042         r = (c >> 16) & 0xFF;
00043         g = (c >> 8) & 0xFF;
00044         b = c & 0xFF;
00045 
00046         return *this;
00047 }
00048 
00049 PG_Color::operator Uint32() const {
00050         return (r << 16) | (g << 8) | b;
00051 }

Generated on Tue Jun 24 01:27:47 2008 for Advanced Strategic Command by  doxygen 1.4.2