- Timestamp:
- Jan 26, 2006, 2:39:31 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/event/event_handler.cc
r6769 r6771 156 156 PRINTF(4)("Subscribing event type: %i\n", eventType); 157 157 if( state == ES_ALL ) 158 159 160 161 162 163 164 158 { 159 for(unsigned int i = 0; i < ES_NUMBER; i++) 160 if( likely(this->listeners[i][eventType] == NULL)) 161 this->listeners[i][eventType] = el; 162 else 163 PRINTF(2)("%s of class %s tried to subscribe to event %i @ state %i but this event has already been subscribed\n", el->getName(), el->getClassName(), eventType, state); 164 } 165 165 else 166 166 if( likely(this->listeners[state][eventType] == NULL)) 167 168 169 167 { 168 this->listeners[state][eventType] = el; 169 } 170 170 else 171 171 PRINTF(2)("% of class %s tried to subscribe to event %i @ state %i but this event has already been subscribed\n", el->getName(), el->getClassName(), eventType, state); … … 203 203 return; 204 204 if( state == ES_ALL) 205 206 207 208 209 210 211 212 213 214 215 else 216 217 218 219 220 221 222 205 { 206 for(unsigned int i = 0; i < ES_NUMBER; i++) 207 { 208 for(unsigned int j = 0; j < EV_NUMBER; j++) 209 { 210 if( this->listeners[i][j] == el ) 211 this->listeners[i][j] = NULL; 212 } 213 } 214 } 215 else 216 { 217 for(int j = 0; j < EV_NUMBER; j++) 218 { 219 if( this->listeners[state][j] == el ) 220 this->listeners[state][j] = NULL; 221 } 222 } 223 223 } 224 224 … … 231 231 { 232 232 if( state == ES_ALL) 233 { 234 for(int i = 0; i < ES_NUMBER; ++i) 235 { 236 for(int j = 0; j < EV_NUMBER; ++j) 237 { 238 this->listeners[i][j] = NULL; 239 } 240 } 241 } 242 else 233 { 234 for(int i = 0; i < ES_NUMBER; ++i) 243 235 { 244 236 for(int j = 0; j < EV_NUMBER; ++j) 245 { 246 this->listeners[state][j] = NULL; 247 } 248 } 237 { 238 this->listeners[i][j] = NULL; 239 } 240 } 241 } 242 else 243 { 244 for(int j = 0; j < EV_NUMBER; ++j) 245 { 246 this->listeners[state][j] = NULL; 247 } 248 } 249 249 } 250 250 … … 262 262 SDL_WM_GrabInput(SDL_GRAB_OFF); 263 263 else 264 ;//SDL_WM_GrabInput(SDL_GRAB_ON);264 SDL_WM_GrabInput(SDL_GRAB_ON); 265 265 } 266 266 … … 276 276 EventListener* listener = NULL; 277 277 while( SDL_PollEvent (&event)) 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 278 { 279 switch( event.type) 280 { 281 case SDL_KEYDOWN: 282 ev.bPressed = true; 283 ev.type = event.key.keysym.sym; 284 if (unlikely(this->bUNICODE)) 285 ev.x = event.key.keysym.unicode; 286 break; 287 case SDL_KEYUP: 288 ev.bPressed = false; 289 ev.type = event.key.keysym.sym; 290 if (unlikely(this->bUNICODE)) 291 ev.x = event.key.keysym.unicode; 292 break; 293 case SDL_MOUSEMOTION: 294 ev.bPressed = false; 295 ev.type = EV_MOUSE_MOTION; 296 ev.x = event.motion.x; 297 ev.y = event.motion.y; 298 ev.xRel = event.motion.xrel; 299 ev.yRel = event.motion.yrel; 300 break; 301 case SDL_MOUSEBUTTONUP: 302 ev.bPressed = false; 303 ev.type = event.button.button + SDLK_LAST; 304 break; 305 case SDL_MOUSEBUTTONDOWN: 306 ev.bPressed = true; 307 ev.type = event.button.button + SDLK_LAST; 308 break; 309 case SDL_JOYAXISMOTION: 310 ev.bPressed = false; 311 ev.type = EV_JOY_AXIS_MOTION; 312 break; 313 case SDL_JOYBALLMOTION: 314 ev.bPressed = false; 315 ev.type = EV_JOY_BALL_MOTION; 316 break; 317 case SDL_JOYHATMOTION: 318 ev.bPressed = false; 319 ev.type = EV_JOY_HAT_MOTION; 320 break; 321 case SDL_JOYBUTTONDOWN: 322 ev.bPressed = true; 323 ev.type = EV_JOY_BUTTON; 324 break; 325 case SDL_JOYBUTTONUP: 326 ev.bPressed = true; 327 ev.type = EV_JOY_BUTTON; 328 break; 329 case SDL_VIDEORESIZE: 330 ev.resize = event.resize; 331 ev.type = EV_VIDEO_RESIZE; 332 break; 333 case SDL_QUIT: 334 ev.type = EV_MAIN_QUIT; 335 break; 336 default: 337 ev.type = EV_UNKNOWN; 338 break; 339 } 340 341 /* small debug routine: shows all events dispatched by the event handler */ 342 PRINT(4)("\n==========================| EventHandler::process () |===\n"); 343 PRINT(4)("= Got Event nr %i, for state %i", ev.type, this->state); 344 345 listener = this->listeners[this->state][ev.type]; 346 if( listener != NULL) 347 { 348 PRINT(4)("= Event dispatcher msg: This event has been consumed\n"); 349 PRINT(4)("=======================================================\n"); 350 listener->process(ev); 351 } 352 else 353 { 354 PRINT(4)("= Event dispatcher msg: This event has NOT been consumed\n"); 355 PRINT(4)("=======================================================\n"); 356 } 357 } 358 358 } 359 359 -
trunk/src/lib/graphics/importer/vertex_array_model.cc
r6769 r6771 268 268 this->addNormal(0.0, 1, 0.0); 269 269 this->addTexCoor((float)i/(float)resolutionX, (float)j/(float)resolutionY); 270 this->addColor( (float)i/20.0, 0.0, (float)j/20.0);270 this->addColor(1.0, 1.0, 1.0); 271 271 } 272 272 } -
trunk/src/story_entities/game_world_data.cc
r6634 r6771 33 33 #include "test_entity.h" 34 34 #include "terrain.h" 35 #include "skybox.h" 35 36 #include "md2Model.h" 36 37 #include "world_entities/projectiles/projectile.h" … … 59 60 #include "ogg_player.h" 60 61 #include "shader.h" 61 62 62 63 63 … … 207 207 //todo do this more elegant 208 208 if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) 209 { 209 210 this->sky = dynamic_cast<WorldEntity*>(created); 211 State::setSkyBox(dynamic_cast<SkyBox*>(this->sky)); 212 } 210 213 if( element->Value() != NULL && !strcmp( element->Value(), "Terrain")) 211 214 { … … 263 266 delete this->objectManager; 264 267 } 268 if(State::getSkyBox()) 269 State::setSkyBox(NULL); 265 270 } 266 271 -
trunk/src/world_entities/environments/water.cc
r6766 r6771 85 85 } 86 86 87 /** 88 * @brief rebuilds the Grid below the WaterSurface, killing all hight information 89 * 90 * This should be called on all subGrid changes except wave and tick. 91 */ 87 92 void Water::rebuildGrid() 88 93 { … … 118 123 } 119 124 125 /** 126 * after this a rebuild() must be called 127 */ 120 128 void Water::setResolution(unsigned int resX, unsigned int resY) 121 129 { … … 124 132 } 125 133 134 /** 135 * after this a rebuild() must be called 136 */ 126 137 void Water::setSize(float sizeX, float sizeY) 127 138 { … … 136 147 137 148 149 /** 150 * @brief calculated the Position in the Grid, this Point is nearest to 151 * @param x, the x-position over the Grid 152 * @param z: the z-Position(or y) over the Grid 153 * @param row returns the row if not out of range 154 * @param column returns the column if not out of range 155 * @returns true if a valid point is found, false if any x or y are out of range 156 */ 138 157 bool Water::posToGridPoint(float x, float z, unsigned int& row, unsigned int& column) 139 158 { … … 152 171 void Water::draw() const 153 172 { 154 if (this->grid != NULL) 155 { 156 //SkyBox::enableCubeMap(); 157 WorldEntity::draw(); 158 glBindTexture(GL_TEXTURE_2D, 15); 159 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 160 161 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); 162 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); 163 glEnable(GL_TEXTURE_GEN_S); 164 glEnable(GL_TEXTURE_GEN_T); 165 166 glEnable(GL_BLEND); 173 assert (this->grid != NULL); 174 { 175 glMatrixMode(GL_MODELVIEW); 176 glPushMatrix(); 177 178 /* translate */ 179 glTranslatef (this->getAbsCoor ().x, 180 this->getAbsCoor ().y, 181 this->getAbsCoor ().z); 182 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 183 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 184 185 if (State::getSkyBox()) 186 { 187 glBindTexture(GL_TEXTURE_2D, State::getSkyBox()->getTexture(SKY_TOP)); 188 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 189 190 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); 191 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); 192 glEnable(GL_TEXTURE_GEN_S); 193 glEnable(GL_TEXTURE_GEN_T); 194 } 167 195 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 196 this->grid->draw(); 168 197 // this->waterShader->activateShader(); 169 198 // this->waterMaterial->select(); -
trunk/src/world_entities/skybox.h
r6634 r6771 12 12 /* INCLUDES */ 13 13 #include "world_entity.h" 14 #include "material.h" 14 15 15 /* FORWARD DECLARATION */ 16 class Material; 17 class Texture; 16 enum SKY_SIDE 17 { 18 SKY_TOP = 0, 19 SKY_BOTTOM, 20 SKY_LEFT, 21 SKY_RIGHT, 22 SKY_FRONT, 23 SKY_BACK 24 }; 18 25 19 26 //! A Class to handle a SkyBox … … 46 53 const char* right, const char* front, const char* back); 47 54 55 GLuint getTexture(SKY_SIDE side) const { return (this->material[side]) ? this->material[side]->getDiffuseTexture(): 0; }; 56 48 57 static void enableCubeMap(); 49 58 static void disableCubeMap();
Note: See TracChangeset
for help on using the changeset viewer.