00001 /*************************************************************************** 00002 * Copyright (C) 2004 by Stephen Bridges * 00003 * widget@widget.dynu.com * 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 PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef GAMEOBJS_H 00022 #define GAMEOBJS_H 00023 00024 // $Id$ 00025 00028 #include <GL/gl.h> 00029 00030 #include "absobj.h" 00031 #include "matrix4x4.h" 00032 #include "vec4.h" 00033 00035 const int EXHAUSTSIZE = 300; 00037 const int BULLETNUM = 30; 00038 00042 class Grid : public AbsObj 00043 { 00044 public: 00046 Grid(float xin, float zin) : AbsObj() { set_dim(xin, zin);}; 00048 void set_dim(float xin, float zin) {l(0) = xin; l(2) = zin;}; 00049 void render(void); 00051 void update(float time) {}; 00052 }; 00053 00054 00055 /* 00067 class Particle : public AbsObj 00068 { 00069 public: 00070 Particle(); 00071 void regen(Vec4 pos, Vec4 dir, float spread, Vec4 spd); 00072 void render(void); 00073 00078 void update(float time); 00079 }; 00080 00082 class Bullet : public AbsObj 00083 { 00084 public: 00085 Bullet(); 00086 void regen(Vec4 pos, Vec4 dir, Vec4 spd); 00087 void render(void); 00092 void update(float time); 00093 }; 00094 00096 class Light : public AbsObj 00097 { 00099 Vec4 amb; 00101 Vec4 diff; 00102 GLenum lightnumber; 00103 public: 00104 Light(); 00105 Light(GLenum t); 00107 void enable(void) {glEnable(lightnumber);}; 00109 void disable(void) {glDisable(lightnumber);}; 00110 void setAmb(float *in); 00111 void setDiff(float *in); 00112 void pos(float xin, float yin, float zin); 00113 void update(float time); 00114 void render(void); 00115 // void collide(Vec4 p) {return false;}; 00116 }; 00117 00119 typedef vector <Particle> ShipExhaust; 00124 typedef vector <Bullet> ShipBullet; 00125 00127 class Ship : public AbsObj 00128 { 00129 public: 00133 enum TurnType {Left, WasLeft, Right, WasRight, None}; 00134 private: 00136 bool thrust; 00138 bool firing; 00140 enum TurnType turning; 00142 ShipExhaust exhaust; 00144 ShipBullet guns; 00146 float lastfiring; 00147 00149 Vec4 TurnSpeed; 00150 public: 00151 Ship(float xin, float yin, float zin); 00152 ~Ship(); 00154 void set_dim(float xin, float yin, float zin) {l(0) = xin; l(1) = yin; l(2) = zin;}; 00156 void setThrust(bool in) {thrust = in;}; 00158 void setFiring(bool in) {firing = in;}; 00160 void setTurning(enum TurnType in) {turning = in;}; 00161 void respawn(float xin, float yin, float zin); 00162 void update(float time); 00163 void render(void); 00164 }; 00165 00167 class Wall : public AbsObj 00168 { 00169 public: 00170 Wall(Vec4 lower, Vec4 upper); 00171 ~Wall(); 00172 void update(float time) {AbsObj::genericupdate(time);}; 00173 void render(void) {AbsObj::genericrender();}; 00174 // void update(float time) {AbsObj::update(time); affine.Print();}; 00175 }; 00176 00177 /* 00178 * $Log$ 00179 */ 00180 00181 #endif 00182 00183 // EOF