istereo2

diff src/istereo.c @ 22:c6971ff4795e

screenshot helper code
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 02 Oct 2015 07:10:19 +0300
parents 2b85d05df3f2
children 9d53a4938ce8
line diff
     1.1 --- a/src/istereo.c	Fri Oct 02 04:55:54 2015 +0300
     1.2 +++ b/src/istereo.c	Fri Oct 02 07:10:19 2015 +0300
     1.3 @@ -138,6 +138,8 @@
     1.4  	dtx_close_font(font);
     1.5  }
     1.6  
     1.7 +static int time_print_pending;
     1.8 +
     1.9  void redraw(void)
    1.10  {
    1.11  	float pan_x, pan_y, z;
    1.12 @@ -216,6 +218,11 @@
    1.13  #endif
    1.14  
    1.15  	assert(glGetError() == GL_NO_ERROR);
    1.16 +
    1.17 +	if(time_print_pending) {
    1.18 +		printf("t: %lds %ldms\n", time_msec / 1000, time_msec % 1000);
    1.19 +		time_print_pending = 0;
    1.20 +	}
    1.21  }
    1.22  
    1.23  static void render(float t)
    1.24 @@ -443,6 +450,7 @@
    1.25  	paused = !paused;
    1.26  	if(paused) {
    1.27  		last_pause = sys_msec;
    1.28 +		time_print_pending = 1;
    1.29  	} else {
    1.30  		time_offset -= sys_msec - last_pause;
    1.31  	}
    1.32 @@ -450,7 +458,8 @@
    1.33  
    1.34  void seektime(long msec)
    1.35  {
    1.36 -	time_offset -= msec;
    1.37 +	time_offset += msec;
    1.38 +	time_print_pending = 1;
    1.39  }
    1.40  
    1.41  static unsigned int get_shader_program(const char *vfile, const char *pfile)