dbf-udg
diff src/udg.cc @ 9:7056437a361b
added demosys
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 19 Feb 2013 18:17:17 +0200 |
parents | f0a47f46ee45 |
children | 1120c069eb17 |
line diff
1.1 --- a/src/udg.cc Mon Feb 18 06:53:44 2013 +0200 1.2 +++ b/src/udg.cc Tue Feb 19 18:17:17 2013 +0200 1.3 @@ -7,6 +7,7 @@ 1.4 #include "dither_matrix.h" 1.5 #include "scroller.h" 1.6 #include "mballs.h" 1.7 +#include "dsys.h" 1.8 1.9 #define DITHER_SZ 8 1.10 #define DITHER_LEVELS 16 1.11 @@ -44,6 +45,8 @@ 1.12 int opt_highres, opt_regular_render; 1.13 bool opt_autorot = true; 1.14 1.15 +struct dsys_demo *demo; 1.16 + 1.17 1.18 int main(int argc, char **argv) 1.19 { 1.20 @@ -127,6 +130,10 @@ 1.21 return false; 1.22 } 1.23 1.24 + if(!(demo = dsys_open("demoscript"))) { 1.25 + return false; 1.26 + } 1.27 + 1.28 glEnable(GL_CULL_FACE); 1.29 glEnable(GL_DEPTH_TEST); 1.30 glEnable(GL_LIGHTING); 1.31 @@ -175,9 +182,12 @@ 1.32 float lcol[] = {1, 1, 1, 1}; 1.33 float lcol2[] = {0.35, 0.3, 0.15, 1}; 1.34 1.35 + dsys_update(demo, dsys_msec_to_dtime(glutGet(GLUT_ELAPSED_TIME))); 1.36 + 1.37 + float sec = dsys_dtime_to_sec(dsys_time(demo)); 1.38 + float auto_angle = sec * 10.0; 1.39 + 1.40 int xres, yres; 1.41 - float auto_angle = glutGet(GLUT_ELAPSED_TIME) / 100.0; 1.42 - 1.43 if(opt_highres) { 1.44 xres = xsz; 1.45 yres = ysz; 1.46 @@ -223,7 +233,7 @@ 1.47 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 80.0); 1.48 1.49 bind_program(phong_prog); 1.50 - mball_render(); 1.51 + mball_render(sec); 1.52 bind_program(0); 1.53 1.54