istereo2

changeset 20:2b85d05df3f2

animation controls for easier screenshot grabbing
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 02 Oct 2015 04:54:55 +0300
parents dc99ceee9294
children 8f41da60b9f5
files ios/shots/SIZES src/glut/main.c src/istereo.c src/istereo.h src/ui.cc
diffstat 5 files changed, 50 insertions(+), 10 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ios/shots/SIZES	Fri Oct 02 04:54:55 2015 +0300
     1.3 @@ -0,0 +1,5 @@
     1.4 +3.5 inch: 960x640
     1.5 +4.0 inch: 1136x640
     1.6 +4.7 inch: 1334x750
     1.7 +5.5 inch: 2208x1242
     1.8 +    ipad: 2048x1496
     2.1 --- a/src/glut/main.c	Fri Oct 02 04:20:21 2015 +0300
     2.2 +++ b/src/glut/main.c	Fri Oct 02 04:54:55 2015 +0300
     2.3 @@ -93,6 +93,18 @@
     2.4  		}
     2.5  		break;
     2.6  
     2.7 +	case ' ':
     2.8 +		playpause();
     2.9 +		break;
    2.10 +
    2.11 +	case '.':
    2.12 +		seektime(250);
    2.13 +		break;
    2.14 +
    2.15 +	case ',':
    2.16 +		seektime(-250);
    2.17 +		break;
    2.18 +
    2.19  	default:
    2.20  		break;
    2.21  	}
     3.1 --- a/src/istereo.c	Fri Oct 02 04:20:21 2015 +0300
     3.2 +++ b/src/istereo.c	Fri Oct 02 04:54:55 2015 +0300
     3.3 @@ -51,6 +51,9 @@
     3.4  int view_xsz, view_ysz;
     3.5  float view_aspect;
     3.6  
     3.7 +static int paused;
     3.8 +static long sys_msec, time_offset, time_msec, last_pause;
     3.9 +
    3.10  int stereo = 0;
    3.11  int use_bump = 0;
    3.12  int show_opt = 1;
    3.13 @@ -138,7 +141,9 @@
    3.14  void redraw(void)
    3.15  {
    3.16  	float pan_x, pan_y, z;
    3.17 -	float tsec = get_time_sec();
    3.18 +	sys_msec = get_time_msec();
    3.19 +	time_msec = (paused ? last_pause : sys_msec) + time_offset;
    3.20 +	double tsec = time_msec / 1000.0;
    3.21  
    3.22  	z = ring_height * segm;
    3.23  	worm(tsec, z, &pan_x, &pan_y);
    3.24 @@ -433,6 +438,21 @@
    3.25  	}
    3.26  }
    3.27  
    3.28 +void playpause(void)
    3.29 +{
    3.30 +	paused = !paused;
    3.31 +	if(paused) {
    3.32 +		last_pause = sys_msec;
    3.33 +	} else {
    3.34 +		time_offset -= sys_msec - last_pause;
    3.35 +	}
    3.36 +}
    3.37 +
    3.38 +void seektime(long msec)
    3.39 +{
    3.40 +	time_offset -= msec;
    3.41 +}
    3.42 +
    3.43  static unsigned int get_shader_program(const char *vfile, const char *pfile)
    3.44  {
    3.45  	unsigned int prog, vs, ps;
     4.1 --- a/src/istereo.h	Fri Oct 02 04:20:21 2015 +0300
     4.2 +++ b/src/istereo.h	Fri Oct 02 04:54:55 2015 +0300
     4.3 @@ -27,4 +27,7 @@
     4.4  void mouse_button(int bn, int press, int x, int y);
     4.5  void mouse_motion(int x, int y);
     4.6  
     4.7 +void playpause(void);
     4.8 +void seektime(long msec);
     4.9 +
    4.10  #endif	/* ISTEREO_H_ */
     5.1 --- a/src/ui.cc	Fri Oct 02 04:20:21 2015 +0300
     5.2 +++ b/src/ui.cc	Fri Oct 02 04:54:55 2015 +0300
     5.3 @@ -43,21 +43,21 @@
     5.4  
     5.5  	CheckBox *cbox;
     5.6  
     5.7 -#ifdef IPHONE
     5.8 -	if(have_retina()) {
     5.9 +//#ifdef IPHONE
    5.10 +//	if(have_retina()) {
    5.11  		cbox = new CheckBox;
    5.12  		cbox->set_position(300, ypos + vsep);
    5.13  		cbox->set_size(300, vsz);
    5.14  		cbox->set_text("Retina quality rendering");
    5.15 -		if(using_retina_res()) {
    5.16 +		//if(using_retina_res()) {
    5.17  			cbox->check();
    5.18 -		} else {
    5.19 -			cbox->uncheck();
    5.20 -		}
    5.21 -		cbox->set_callback(EV_CHANGE, retina_cbox_handler);
    5.22 +		//} else {
    5.23 +		//	cbox->uncheck();
    5.24 +		//}
    5.25 +//		cbox->set_callback(EV_CHANGE, retina_cbox_handler);
    5.26  		scr.add_widget(cbox);
    5.27 -	}
    5.28 -#endif
    5.29 +//	}
    5.30 +//#endif
    5.31  
    5.32  	cbox = new CheckBox;
    5.33  	cbox->set_position(300, ypos);