various windows fixes

This commit is contained in:
Gero Müller 2011-01-14 22:39:27 +01:00
parent 14e4f4f54c
commit 54f2f3c4f6
6 changed files with 12 additions and 5 deletions

View File

@ -10,7 +10,7 @@
#include "network.h" #include "network.h"
Application::Application() : 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) { void Application::initialize(int argc, char ** argv) {
time = PerformanceTimer::get();
game_setup(&game); game_setup(&game);
game_reset(&game); game_reset(&game);
gameUpdateSchudule.setExact(true); gameUpdateSchudule.setExact(true);

View File

@ -70,6 +70,6 @@ if (OPENGL_FOUND)
endif(UNIX) endif(UNIX)
target_link_libraries(gremlin target_link_libraries(gremlin
glfw spark glfw spark ${OPENGL_LIBRARIES}
) )
endif(OPENGL_FOUND) endif(OPENGL_FOUND)

View File

@ -357,7 +357,6 @@ void Client::prepareFrame(double rx, double ry, double rz) {
void Client::initialize(int argc, char ** argv) { void Client::initialize(int argc, char ** argv) {
Application::initialize(argc, argv); Application::initialize(argc, argv);
double time, last_player_update;
std::string arg1; std::string arg1;
if (argc > 1) { if (argc > 1) {
@ -506,7 +505,7 @@ void Client::update() {
{ {
std::stringstream sstr; 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; / 10.0;
oglf_print(&font, 10, 25 * fy++, sstr.str().c_str()); oglf_print(&font, 10, 25 * fy++, sstr.str().c_str());
} }

View File

@ -10,6 +10,8 @@
using namespace SPK; using namespace SPK;
using namespace SPK::GL; using namespace SPK::GL;
#define M_PI 3.126
Explosion::~Explosion() { Explosion::~Explosion() {
SPKFactory::getInstance().destroyAll(); SPKFactory::getInstance().destroyAll();
} }

View File

@ -205,7 +205,7 @@ void _explode_bomb(game_t *game, bomb_t *bomb) {
continue; continue;
double distance2 = pow(player->x - bomb->x, 2) + pow(player->y double distance2 = pow(player->x - bomb->x, 2) + pow(player->y
- bomb->y, 2) + pow(player->z - bomb->z, 2); - bomb->y, 2) + pow(player->z - bomb->z, 2);
if (distance2 < pow(150, 2)) { if (distance2 < pow(150., 2.)) {
if (game->explosion_callback) if (game->explosion_callback)
game->explosion_callback(player->x, player->y, player->z, game->explosion_callback(player->x, player->y, player->z,
game->explosion_callback_data); game->explosion_callback_data);

View File

@ -1,4 +1,9 @@
#include "oglfont.h" #include "oglfont.h"
#ifdef _MSC_VER
#define LEAN_AND_MEAN
#include <windows.h>
#endif
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#include <stdio.h> #include <stdio.h>