libresman
diff examples/imgthumbs/src/main.c @ 3:a396d43a62f9
made the images always visible fullscreen by default regardless of their aspect ratio
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 31 Jan 2014 05:15:18 +0200 |
parents | 026cdd1737ff |
children | eadf99551730 |
line diff
1.1 --- a/examples/imgthumbs/src/main.c Fri Jan 31 03:40:00 2014 +0200 1.2 +++ b/examples/imgthumbs/src/main.c Fri Jan 31 05:15:18 2014 +0200 1.3 @@ -84,7 +84,7 @@ 1.4 if(show_thumb->aspect >= 1.0) { 1.5 glScalef(1, 1.0 / show_thumb->aspect, 1); 1.6 } else { 1.7 - glScalef(show_thumb->aspect, 1, 1); 1.8 + glScalef(show_thumb->aspect / win_aspect, 1.0 / win_aspect, 1); 1.9 } 1.10 1.11 glBegin(GL_QUADS); 1.12 @@ -129,7 +129,13 @@ 1.13 { 1.14 switch(key) { 1.15 case 27: 1.16 - exit(0); 1.17 + if(show_thumb) { 1.18 + show_thumb = 0; 1.19 + glutPostRedisplay(); 1.20 + } else { 1.21 + exit(0); 1.22 + } 1.23 + break; 1.24 1.25 case ' ': 1.26 show_zoom = 1.0;