improved network and physics integration

This commit is contained in:
gmueller
2011-01-23 16:23:44 +01:00
parent f9c374bc78
commit 1006f94ba0
5 changed files with 198 additions and 126 deletions

View File

@@ -388,8 +388,7 @@ void Client::initialize(Arguments &arg) {
// Initialise GLFW
if (!glfwInit()) {
fprintf(stderr, "Failed to initialize GLFW\n");
exit(EXIT_FAILURE);
throw("Failed to initialize GLFW");
}
setup_opengl();
@@ -401,6 +400,8 @@ void Client::initialize(Arguments &arg) {
if (isMaster()) {
Team *team = game.getTeam(0);
game.local_player = game.spawn_player(team);
std::cout << "[Game] local player " << game.local_player->id
<< std::endl;
}
size_t i;
@@ -478,17 +479,17 @@ void Client::update() {
glEnable( GL_LIGHTING);
glEnable( GL_CULL_FACE);
glDisable( GL_TEXTURE_2D);
for (size_t i = 0; i < game.teams.size(); i++)
draw_team(&game.teams[i]);
// for (size_t i = 0; i < game.teams.size(); i++)
// draw_team(&game.teams[i]);
for (size_t i = 0; i < GAME_PLAYER_COUNT; i++)
drawPlayer(&game.player[i]);
for (size_t i = 0; i < GAME_BOMB_COUNT; i++)
draw_bomb(&game.bomb[i]);
for (size_t i = 0; i < GAME_POINT_COUNT; i++)
draw_point(&game.point[i]);
// for (size_t i = 0; i < GAME_BOMB_COUNT; i++)
// draw_bomb(&game.bomb[i]);
//
// for (size_t i = 0; i < GAME_POINT_COUNT; i++)
// draw_point(&game.point[i]);
drawLevel();