LIBGL := -lGL -lGLU
LIBSDL := `sdl-config --libs`
endif
-LIBMY := -lpg
+LIBMY := -lbear
LIBS := ${LIBSDL} ${LIBGL} ${LIBMY}
OPTFLAGS := -O2
LIBSCPY := # := start
ifeq (${BUILD},WIN32)
LIBSCPY += SDL.dll
- LIBSCPY += pg.dll
+ LIBSCPY += bear.dll
else
LIBSCPY += libSDL-1.2.so.0
- LIBSCPY += libpg.so.0
+ LIBSCPY += libbear.so.0
endif
LIBSCPY := $(addprefix ${DSTLIBSDIR},${LIBSCPY})
--- /dev/null
+/usr/mingw32/lib/bear.dll
\ No newline at end of file
--- /dev/null
+/usr/lib/libbear.so.0
\ No newline at end of file
+++ /dev/null
-/usr/lib/libpg.so.0
\ No newline at end of file
+++ /dev/null
-/usr/mingw32/lib/pg.dll
\ No newline at end of file
#ifndef COLLISIONINFO_H
#define COLLISIONINFO_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
/// ***** Header Class *****
#ifndef EFFECT_H
#define EFFECT_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
// Mutual headers ...
#ifndef GRAVITY_H
#define GRAVITY_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "Effect.h"
#ifndef GRAVITYWELL_H
#define GRAVITYWELL_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "Effect.h"
#ifndef SCREEN_H
#define SCREEN_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "Effect.h"
#include "Ball.h"
-#include <pg/debug.h>
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/debug.h>
+#include <bear/Vector2.h>
+using namespace bear;
#include "graphics/graphics.h"
#ifndef BALL_H
#define BALL_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "PhysicsEntity.h"
#include "Entity.h"
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
/// ***** Constructors/Destructors *****
#ifndef ENTITY_H
#define ENTITY_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
/// ***** Header Class *****
#include "Line.h"
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
/// ***** Constructors/Destructors *****
#ifndef LINE_H
#define LINE_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "Particle.h"
#include "Particle.h"
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
/// ***** Constructors/Destructors *****
#ifndef PARTICLE_H
#define PARTICLE_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "Entity.h"
#include "PhysicsEntity.h"
-#include <pg/debug.h>
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/debug.h>
+#include <bear/Vector2.h>
+using namespace bear;
#include "effectManager.h"
#ifndef PHYSICS_H
#define PHYSICS_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "Entity.h"
#include "Point.h"
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
/// ***** Constructors/Destructors *****
#ifndef POINT_H
#define POINT_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "Particle.h"
#include "Polygon.h"
-#include <pg/debug.h>
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/debug.h>
+#include <bear/Vector2.h>
+using namespace bear;
#include "graphics/graphics.h"
#ifndef POLYGON_H
#define POLYGON_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "PhysicsEntity.h"
#include "WindParticle.h"
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
/// ***** Constructors/Destructors *****
#ifndef WINDPARTICLE_H
#define WINDPARTICLE_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "Point.h"
#include "collisionManager.h"
-#include <pg/debug.h>
-#include <pg/Vector2.h>
-#include <pg/mathw.h>
-using namespace pg;
+#include <bear/debug.h>
+#include <bear/Vector2.h>
+#include <bear/mathw.h>
+using namespace bear;
#include "Entities/Ball.h"
#include "Entities/Polygon.h"
#include "config.h"
-#include <pg/debug.h>
-using namespace pg;
+#include <bear/debug.h>
+using namespace bear;
#include <SDL/SDL.h>
#include "keys.h"
#include "keys.h"
-#include <pg/debug.h>
-using namespace pg;
+#include <bear/debug.h>
+using namespace bear;
#include <SDL/SDL.h>
#ifndef KEYS_H
#define KEYS_H
-#include <pg/debug.h>
-using namespace pg;
+#include <bear/debug.h>
+using namespace bear;
#include <SDL/SDL.h>
#include "reader.h"
-#include <pg/debug.h>
-using namespace pg;
+#include <bear/debug.h>
+using namespace bear;
#include <iostream>
using std::cerr;
#include "effectManager.h"
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include <set>
#ifndef EFFECTMANAGER_H
#define EFFECTMANAGER_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include "Entities/PhysicsEntity.h"
#ifndef ENTITYCREATOR_H
#define ENTITYCREATOR_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
/// ***** Header Methods *****
namespace creator
#include "entityManager.h"
-#include <pg/debug.h>
-#include <pg/Lock.h>
-#include <pg/Autolock.h>
-using namespace pg;
+#include <bear/debug.h>
+#include <bear/Lock.h>
+#include <bear/Autolock.h>
+using namespace bear;
#include <set>
#include <SDL/SDL.h>
#include "game.h"
-#include <pg/debug.h>
-using namespace pg;
+#include <bear/debug.h>
+using namespace bear;
#include <vector>
using std::vector;
#include "graphics.h"
-#include <pg/debug.h>
-#include <pg/mathw.h>
-using namespace pg;
+#include <bear/debug.h>
+#include <bear/mathw.h>
+using namespace bear;
#include <GL/gl.h>
#include <GL/glu.h>
#ifndef GRAPHICS_H
#define GRAPHICS_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include <vector>
#include "inputManager.h"
-#include <pg/debug.h>
-using namespace pg;
+#include <bear/debug.h>
+using namespace bear;
#include <SDL/SDL.h>
#ifndef INPUT_H
#define INPUT_H
-#include <pg/Vector2.h>
-using namespace pg;
+#include <bear/Vector2.h>
+using namespace bear;
#include <SDL/SDL.h>
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <pg/debug.h>
-#include <pg/ticks.h>
-using namespace pg;
+#include <bear/debug.h>
+#include <bear/Timer.h>
+using namespace bear;
#include <iostream>
using std::cout;
static int s_iUPS, s_iFPS;
static int s_iUpdateCount, s_iDrawCount;
-static MICRO s_micLastSecond;
+
+static Ticks s_micLastSecond;
+static Timer s_timer;
static const float s_fGameStep = 10;
installSignal();
debug::init();
+
+ s_timer.init();
}
void mainClean()
{
+ s_timer.fini();
+
debug::fini();
}
void updateFPSCounters()
{
// Check if a second has passed to recalculate UPS and FPS
- if (tickCountMicro() - s_micLastSecond >= 1000000)
+ if (s_timer.query() - s_micLastSecond >= 1000000)
{
s_iUPS = s_iUpdateCount;
s_iFPS = s_iDrawCount;
s_iUpdateCount -= s_iUPS;
s_iDrawCount -= s_iFPS;
- s_micLastSecond = tickCountMicro();
+ s_micLastSecond = s_timer.query();
if(cfg::showFPS())
{
{
updatesInit();
- s_micLastSecond = tickCountMicro();
+ s_micLastSecond = s_timer.query();
while(s_bIsRunning)
{
- MICRO time = tickCountMicro();
+ Timer timer;
+ timer.init();
handleInput();
update(s_fGameStep);
updateFPSCounters();
- time = tickCountMicro() - time;
+ const Ticks ticks = timer.query();
+ timer.fini();
- float wait = (1000000.0 / s_iTargetUPS - time);
+ float wait = (1000000.0 / s_iTargetUPS - ticks.microseconds());
s_fAccUpdateWait += 0 < wait ? wait : 0;
if(s_iMinWaitMicro < s_fAccUpdateWait)
while(s_bIsRunning)
{
- MICRO time = tickCountMicro();
+ Timer timer;
+ timer.init();
draw();
- time = tickCountMicro() - time;
+ const Ticks ticks = timer.query();
+ timer.fini();
- float wait = (1000000.0 / s_iTargetFPS - time);
+ float wait = (1000000.0 / s_iTargetFPS - ticks.microseconds());
s_fAccDrawWait += 0 < wait ? wait : 0;
if(s_iMinWaitMicro < s_fAccDrawWait)