tavli
diff src/game.cc @ 1:3fcd7b4d631f
board mesh generation
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 22 Jun 2015 05:05:37 +0300 |
parents | 52e0dd47753b |
children | e48b40a3c82a |
line diff
1.1 --- a/src/game.cc Sun Jun 21 06:30:39 2015 +0300 1.2 +++ b/src/game.cc Mon Jun 22 05:05:37 2015 +0300 1.3 @@ -1,11 +1,14 @@ 1.4 #include <stdio.h> 1.5 #include <GL/glew.h> 1.6 #include "game.h" 1.7 +#include "board.h" 1.8 1.9 static void draw_backdrop(); 1.10 1.11 int win_width, win_height; 1.12 1.13 +static Board board; 1.14 + 1.15 static float cam_theta, cam_phi = 25, cam_dist = 6; 1.16 static bool bnstate[8]; 1.17 static int prev_x, prev_y; 1.18 @@ -19,11 +22,16 @@ 1.19 glEnable(GL_LIGHTING); 1.20 glEnable(GL_LIGHT0); 1.21 1.22 + if(!board.init()) { 1.23 + return false; 1.24 + } 1.25 + 1.26 return true; 1.27 } 1.28 1.29 void game_cleanup() 1.30 { 1.31 + board.destroy(); 1.32 } 1.33 1.34 void game_update(unsigned long time_msec) 1.35 @@ -42,13 +50,16 @@ 1.36 1.37 draw_backdrop(); 1.38 1.39 + board.draw(); 1.40 + 1.41 + /* 1.42 glBegin(GL_QUADS); 1.43 glNormal3f(0, 1, 0); 1.44 glVertex3f(-1, 0, 1); 1.45 glVertex3f(1, 0, 1); 1.46 glVertex3f(1, 0, -1); 1.47 glVertex3f(-1, 0, -1); 1.48 - glEnd(); 1.49 + glEnd();*/ 1.50 } 1.51 1.52 static void draw_backdrop() 1.53 @@ -85,7 +96,7 @@ 1.54 { 1.55 glMatrixMode(GL_PROJECTION); 1.56 glLoadIdentity(); 1.57 - gluPerspective(50, (float)x / (float)y, 0.5, 500.0); 1.58 + gluPerspective(50, (float)x / (float)y, 0.2, 200.0); 1.59 1.60 glViewport(0, 0, x, y); 1.61 }