src/graphic/color.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  *  Wormux is a convivial mass murder game.
00003  *  Copyright (C) 2001-2004 Lawrence Azzoug.
00004  *
00005  *  This program 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 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program 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 ARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU GeneralPublic License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
00018  ******************************************************************************
00019  * Handle a color
00020  *****************************************************************************/
00021 
00022 #include "color.h"
00023 #include <SDL.h>
00024 
00025 Color::Color(){
00026         SetColor(200, 50, 50, 130);
00027 }
00028 
00029 Color::Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a){
00030         SetColor(r, g, b, a);
00031 }
00032 
00033 bool Color::operator==(const Color &color) const{
00034         return red == color.red 
00035                 && green == color.green 
00036                 && blue == color.blue 
00037                 && alpha == color.alpha;
00038 }
00039 
00040 void Color::SetColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a){
00041         red = r;
00042         green = g;
00043         blue = b;
00044         alpha = a;
00045 }
00046 
00047 Uint8 Color::GetRed() const{
00048         return red;
00049 }
00050 
00051 Uint8 Color::GetGreen() const{
00052         return green;
00053 }
00054 
00055 Uint8 Color::GetBlue() const{
00056         return blue;
00057 }
00058 
00059 Uint8 Color::GetAlpha() const{
00060         return alpha;
00061 }
00062 
00063 SDL_Color Color::GetSDLColor() const{
00064         SDL_Color sdlColor;
00065 
00066         sdlColor.r = red;
00067         sdlColor.g = green;
00068         sdlColor.b = blue;
00069         sdlColor.unused = alpha;
00070 
00071         return sdlColor;
00072 }

Generated on Mon Jan 1 13:10:56 2007 for Wormux by  doxygen 1.4.7