imtk

diff test.c @ 3:038e5577d527

added slider and progress bar widgets
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 31 Dec 2010 18:10:13 +0200
parents 3d661dd17af3
children 00a4ea4ee6dc
line diff
     1.1 --- a/test.c	Fri Dec 31 01:54:53 2010 +0200
     1.2 +++ b/test.c	Fri Dec 31 18:10:13 2010 +0200
     1.3 @@ -19,6 +19,7 @@
     1.4  void motion(int x, int y);
     1.5  
     1.6  int xsz, ysz;
     1.7 +float angle;
     1.8  
     1.9  int main(int argc, char **argv)
    1.10  {
    1.11 @@ -69,6 +70,7 @@
    1.12  	glLoadIdentity();
    1.13  	glTranslatef(0, 0, -8);
    1.14  	glRotatef(25, 1, 0, 0);
    1.15 +	glRotatef(angle, 0, 1, 0);
    1.16  
    1.17  	glFrontFace(GL_CW);
    1.18  	glutSolidTeapot(1.0);
    1.19 @@ -89,6 +91,7 @@
    1.20  	static int bnshow;
    1.21  	static char textbuf[256];
    1.22  	static char textbuf2[256];
    1.23 +	static float val;
    1.24  
    1.25  	imtk_begin();
    1.26  
    1.27 @@ -122,6 +125,14 @@
    1.28  		}
    1.29  	}
    1.30  
    1.31 +	val = imtk_slider(IMUID, angle, 0.0, 360.0, 30, 390);
    1.32 +	if(val != angle) {
    1.33 +		angle = val;
    1.34 +		glutPostRedisplay();
    1.35 +	}
    1.36 +
    1.37 +	imtk_progress(IMUID, val / 360.0, 30, 420);
    1.38 +
    1.39  	if(imtk_button(IMUID, "Quit", 30, 500)) {
    1.40  		exit(0);
    1.41  	}