+/*
+ * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include "game.h"
+#include "debug.h"
+
+#include <vector>
+using std::vector;
+
+#include "entityCreator.h"
+#include "effectManager.h"
#include "GameStates/GameState.h"
#include "GameStates/Running.h"
#include "GameStates/Paused.h"
#include "GameStates/CreatingPolygon.h"
-#include <vector>
-using std::vector;
-
/// ***** Private Variables *****
/// ***** Public Methods *****
-void gameInit()
+
+void game::init()
{
running = new Running();
paused = new Paused();
creating_Polygon = new CreatingPolygon();
+
+ // create starting entities
+ creator::init();
+
+ active_States.push_back(running);
+
+ effect::init();
+
+#ifdef DEBUGGING
+ cout << "World Created" << endl;
+#endif
}
-void gameClean()
+void game::clean()
{
+ effect::clean();
+
+ creator::clean();
+
delete creating_Polygon;
delete paused;
delete running;
}
-void gameInput()
+void game::input()
{
- int size = active_States.size();
+ int last = active_States.size() -1;
for( int i = 0;
- i < size;
+ i <= last;
i++ )
{
- if( i-1 == size )
+ if( i == last )
active_States[i]->handleInput(true);
else
active_States[i]->handleInput(false);
}
-
}
-void gameUpdate(float time_step)
+void game::update(float time_step)
{
- int size = active_States.size();
+ int last = active_States.size() -1;
for( int i = 0;
- i < size;
+ i <= last;
i++ )
{
- if( i-1 == size )
+ if( i == last )
active_States[i]->update(time_step, true);
else
active_States[i]->update(time_step, false);
}
}
-void gameDraw()
+void game::draw()
{
- int size = active_States.size();
+ int last = active_States.size() -1;
for( int i = 0;
- i < size;
+ i <= last;
i++ )
{
- if( i-1 == size )
+ if( i == last )
active_States[i]->draw(true);
else
active_States[i]->draw(false);