00001 00002 // 00003 // Das Tank - Copyright (C) 2006, 2007 Windsor Schmidt <windsor@windsorworld.net> 00004 // 00005 // This program is free software; you can redistribute it and/or modify it 00006 // under the terms of the GNU General Public License as published by the Free 00007 // Software Foundation; either version 2 of the License, or (at your option) 00008 // any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 // more details. 00014 // 00015 // You should have received a copy of the GNU General Public License along with 00016 // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00017 // Place, Suite 330, Boston, MA 02111-1307 USA 00018 // 00020 00021 00022 #ifndef STDAFX 00023 #include "stdafx.h" 00024 #endif 00025 00026 MiniShock::MiniShock(void) 00027 { 00028 vPosition.x = 0; 00029 fEnergy = .02; 00030 fAge = 0; 00031 00032 fColorR = 1; // set default color to white 00033 fColorG = 1; 00034 fColorB = 1; 00035 } 00036 00037 MiniShock::MiniShock(Vector vPos, float energy) 00038 { 00039 vPosition = vPos; 00040 fEnergy = energy; 00041 fAge = 0; 00042 00043 fColorR = 1; // set default color to white 00044 fColorG = 1; 00045 fColorB = 1; 00046 } 00047 00048 MiniShock::~MiniShock(void) 00049 { 00050 } 00051 00052 void MiniShock::Draw(void) 00053 { 00054 int i; 00055 00056 glBlendFunc (GL_SRC_ALPHA, GL_ONE); 00057 glEnable (GL_BLEND); 00058 glDisable(GL_TEXTURE_2D); 00059 glPushMatrix(); 00060 glTranslatef(vPosition.x, vPosition.y, 0.1); 00061 glColor4f(fColorR, fColorG, fColorB, fEnergy); 00062 DrawCircle(fAge * 0.002); 00063 glRotatef(-fAge * 0.1, 0, 0, 1); 00064 glLineWidth(5); 00065 glColor4f(1.0, 1.0, 1.0, fEnergy * 0.4); 00066 DrawCircle(fAge * 0.003); 00067 glLineWidth(1); 00068 00069 glPopMatrix(); 00070 } 00071 00072 bool MiniShock::Step(float timeStep) 00073 { 00074 fAge += timeStep; 00075 00076 fEnergy -= 0.1; 00077 00078 if(fEnergy <= 0) 00079 { 00080 return true; 00081 } 00082 else 00083 { 00084 return false; 00085 } 00086 } 00087 00090 void MiniShock::SetColor(float r, float g, float b) 00091 { 00092 fColorR = r; 00093 fColorG = g; 00094 fColorB = b; 00095 }
Copyright Windsor Schmidt 2006 - All rights reserved.