istereo2

diff src/istereo.c @ 8:661bf09db398

- replaced Quartz timer with cross-platform timer code - protected goatkit builtin theme function from being optimized out
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 24 Sep 2015 07:09:37 +0300
parents a3c4fcc9f8f3
children ea928c313344
line diff
     1.1 --- a/src/istereo.c	Thu Sep 24 06:49:25 2015 +0300
     1.2 +++ b/src/istereo.c	Thu Sep 24 07:09:37 2015 +0300
     1.3 @@ -32,6 +32,7 @@
     1.4  #include "config.h"
     1.5  #include "ui.h"
     1.6  #include "drawtext.h"
     1.7 +#include "timer.h"
     1.8  
     1.9  static void render(float t);
    1.10  static void draw_tunnel(float t);
    1.11 @@ -40,7 +41,6 @@
    1.12  static void draw_text(float idx, vec3_t tpos, float alpha);
    1.13  static void worm(float t, float z, float *tx, float *ty);
    1.14  static unsigned int get_shader_program(const char *vfile, const char *pfile);
    1.15 -static float get_sec(void);
    1.16  
    1.17  unsigned int prog, prog_simple, prog_tunnel, prog_text, prog_color, prog_ui, prog_font;
    1.18  unsigned int tex, tex_stones, tex_normal, tex_text;
    1.19 @@ -133,7 +133,7 @@
    1.20  void redraw(void)
    1.21  {
    1.22  	float pan_x, pan_y, z;
    1.23 -	float tsec = get_sec();
    1.24 +	float tsec = get_time_sec();
    1.25  
    1.26  	z = ring_height * segm;
    1.27  	worm(tsec, z, &pan_x, &pan_y);
    1.28 @@ -442,28 +442,3 @@
    1.29  	}
    1.30  	return prog;
    1.31  }
    1.32 -
    1.33 -
    1.34 -#ifdef IPHONE
    1.35 -#include <QuartzCore/QuartzCore.h>
    1.36 -
    1.37 -static float get_sec(void)
    1.38 -{
    1.39 -	static float first;
    1.40 -	static int init;
    1.41 -
    1.42 -	if(!init) {
    1.43 -		init = 1;
    1.44 -		first = CACurrentMediaTime();
    1.45 -		return 0.0f;
    1.46 -	}
    1.47 -	return CACurrentMediaTime() - first;
    1.48 -}
    1.49 -
    1.50 -#else
    1.51 -
    1.52 -static float get_sec(void)
    1.53 -{
    1.54 -	return (float)glutGet(GLUT_ELAPSED_TIME) / 1000.0f;
    1.55 -}
    1.56 -#endif