From 54f2f3c4f6181305a562783a41646f45d9328f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gero=20M=C3=BCller?= Date: Fri, 14 Jan 2011 22:39:27 +0100 Subject: [PATCH] various windows fixes --- src/Application.cpp | 3 ++- src/CMakeLists.txt | 2 +- src/Client.cpp | 3 +-- src/Explosion.cpp | 2 ++ src/game.cpp | 2 +- src/oglfont.cpp | 5 +++++ 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index 20cd939..d8d77ce 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -10,7 +10,7 @@ #include "network.h" Application::Application() : - running(false), master(false) { + running(false), master(false), time(0.0) { } @@ -31,6 +31,7 @@ void Application::stop() { } void Application::initialize(int argc, char ** argv) { + time = PerformanceTimer::get(); game_setup(&game); game_reset(&game); gameUpdateSchudule.setExact(true); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cfe1d2c..ae96fd6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -70,6 +70,6 @@ if (OPENGL_FOUND) endif(UNIX) target_link_libraries(gremlin - glfw spark + glfw spark ${OPENGL_LIBRARIES} ) endif(OPENGL_FOUND) diff --git a/src/Client.cpp b/src/Client.cpp index 131e17b..b54b5eb 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -357,7 +357,6 @@ void Client::prepareFrame(double rx, double ry, double rz) { void Client::initialize(int argc, char ** argv) { Application::initialize(argc, argv); - double time, last_player_update; std::string arg1; if (argc > 1) { @@ -506,7 +505,7 @@ void Client::update() { { std::stringstream sstr; - sstr << "FPS: " << (int) (1 / dt) << " Time: " << round(dt * 10000.0) + sstr << "FPS: " << (int) (1 / dt) << " Time: " << floor(dt * 10000.0 + 0.5) / 10.0; oglf_print(&font, 10, 25 * fy++, sstr.str().c_str()); } diff --git a/src/Explosion.cpp b/src/Explosion.cpp index 38f3cd5..b099b8d 100644 --- a/src/Explosion.cpp +++ b/src/Explosion.cpp @@ -10,6 +10,8 @@ using namespace SPK; using namespace SPK::GL; +#define M_PI 3.126 + Explosion::~Explosion() { SPKFactory::getInstance().destroyAll(); } diff --git a/src/game.cpp b/src/game.cpp index 67dcf41..9e5ef01 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -205,7 +205,7 @@ void _explode_bomb(game_t *game, bomb_t *bomb) { continue; double distance2 = pow(player->x - bomb->x, 2) + pow(player->y - bomb->y, 2) + pow(player->z - bomb->z, 2); - if (distance2 < pow(150, 2)) { + if (distance2 < pow(150., 2.)) { if (game->explosion_callback) game->explosion_callback(player->x, player->y, player->z, game->explosion_callback_data); diff --git a/src/oglfont.cpp b/src/oglfont.cpp index 634d519..ce24111 100644 --- a/src/oglfont.cpp +++ b/src/oglfont.cpp @@ -1,4 +1,9 @@ #include "oglfont.h" +#ifdef _MSC_VER +#define LEAN_AND_MEAN +#include +#endif + #include #include #include