2 * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "effectManager.h"
20 #include "Effects/Effect.h"
21 #include "Effects/Gravity.h"
22 #include "Effects/GravityWell.h"
23 #include "Effects/Screen.h"
26 #include "input/inputManager.h"
27 #include "config/config.h"
29 /// ***** Private Variables *****
34 GravityWell* mouseWell;
36 /// ***** Initializers/Cleaners *****
41 effects = new Effect*[numEffects]();
43 mouseWell = new GravityWell(input::mousePosition());
45 effects[0] = new Screen();
46 effects[1] = new Gravity();
47 effects[2] = mouseWell;
51 for(int i=0; i < numEffects; i++)
59 /// ***** Public Methods *****
61 void effect::update(float)
65 void effect::handleInput()
67 if(cfg::mouseWellOn())
70 mouseWell->setPosition(input::mousePosition());
78 Vector2 effect::positionDelta(const PhysicsEntity* e, float time_step)
82 for(int i=0; i < numEffects; i++)
84 acc += effects[i]->positionDelta(e, time_step);
89 Vector2 effect::velocityDelta(const PhysicsEntity* e, float time_step)
93 for(int i=0; i < numEffects; i++)
95 acc += effects[i]->velocityDelta(e, time_step);
100 Vector2 effect::forceDelta(const PhysicsEntity* e, float time_step)
104 for(int i=0; i < numEffects; i++)
106 acc += effects[i]->forceDelta(e, time_step);