imtk
diff test.c @ 1:dfbd12d1f566
finished the checkbox control, did some reorg as well.
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 30 Dec 2010 15:10:25 +0200 |
parents | b04d49e4599c |
children | 3d661dd17af3 |
line diff
1.1 --- a/test.c Thu Dec 30 05:22:14 2010 +0200 1.2 +++ b/test.c Thu Dec 30 15:10:25 2010 +0200 1.3 @@ -8,6 +8,7 @@ 1.4 #include "imtk.h" 1.5 1.6 void disp(void); 1.7 +void gui(void); 1.8 void reshape(int x, int y); 1.9 void keyb(unsigned char key, int x, int y); 1.10 void keyb_up(unsigned char key, int x, int y); 1.11 @@ -40,20 +41,37 @@ 1.12 1.13 void disp(void) 1.14 { 1.15 + glClearColor(0.6, 0.6, 0.6, 0.0); 1.16 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1.17 1.18 + gui(); 1.19 + 1.20 + glutSwapBuffers(); 1.21 +} 1.22 + 1.23 +void gui(void) 1.24 +{ 1.25 + static int bnshow; 1.26 + 1.27 imtk_begin(); 1.28 1.29 - if(imtk_button(0, "foobar", 100, 100)) { 1.30 + if(imtk_button(IMUID, "foobar", 100, 100)) { 1.31 printf("clicked button 0\n"); 1.32 } 1.33 - if(imtk_button(1, "xyzzy", 100, 200)) { 1.34 + if(imtk_button(IMUID, "xyzzy", 100, 200)) { 1.35 printf("clicked button 1\n"); 1.36 } 1.37 + if(imtk_button(IMUID, "Quit", 100, 500)) { 1.38 + exit(0); 1.39 + } 1.40 + 1.41 + if((bnshow = imtk_checkbox(IMUID, "show hidden button", 100, 260, bnshow))) { 1.42 + if(imtk_button(IMUID, "I was hidden!", 130, 300)) { 1.43 + printf("you clicked the hidden button!\n"); 1.44 + } 1.45 + } 1.46 1.47 imtk_end(); 1.48 - 1.49 - glutSwapBuffers(); 1.50 } 1.51 1.52 void reshape(int x, int y)