proj home

Files   Classes   Functions   Hierarchy  

menusystemtest Class Reference

Display the capabilities of the menusystem class. More...

#include <menusystemtest.h>

Collaboration diagram for menusystemtest:

List of all members.

Public Member Functions

 menusystemtest ()
 Constructor.
void test01 (int &argc, char **&argv)
 Display a menu with keyboard interaction.
void test02 (int &argc, char **&argv)
 Test message menu functionality.

Static Public Member Functions

static void keyboard01 (unsigned char key, int x, int y)
 This gui forwards keyboard input to the current menu.
static void display01 ()
 Display the current menu and primitive window.
static void keyboard02 (unsigned char key, int x, int y)
static void display02 ()

Static Public Attributes

static menusystemcurrent = 0
 The menu is contained as a composite member.


Detailed Description

Display the capabilities of the menusystem class.

Definition at line 17 of file menusystemtest.h.


Constructor & Destructor Documentation

menusystemtest::menusystemtest (  )  [inline]

Constructor.

Definition at line 27 of file menusystemtest.h.

00028     : xGraphics(true) {}


Member Function Documentation

void menusystemtest::display01 (  )  [static]

Display the current menu and primitive window.

Definition at line 302 of file menusystemtest.cpp.

References current, gobjContainer::draw(), menusystem::draw(), and glerrordisplay().

00303 {
00304   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00305 
00306   //xGraphics.draw();
00307   assert(current!=0);
00308   current->draw();
00309 
00310   pw->draw();
00311 
00312   glerrordisplay();
00313   glutSwapBuffers();
00314 }

void menusystemtest::display02 (  )  [static]

Definition at line 327 of file menusystemtest.cpp.

References gobjContainer::draw(), glerrordisplay(), and gobj::global.

00328 { 
00329   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00330 
00331   gobj::global->draw();
00332 
00333   glerrordisplay();
00334   
00335   glutSwapBuffers();
00336 }

void menusystemtest::keyboard01 ( unsigned char  key,
int  x,
int  y 
) [static]

This gui forwards keyboard input to the current menu.

Definition at line 317 of file menusystemtest.cpp.

00322 {
00323   assert(current!=0);
00324   current->read(key);
00325 }

void menusystemtest::keyboard02 ( unsigned char  key,
int  x,
int  y 
) [static]

Definition at line 339 of file menusystemtest.cpp.

00344 {
00345   static uint messageid=1;
00346 
00347   switch (key)
00348   {
00349     case 27: exit(0); break;
00350     case 'm': 
00351     {
00352       stringstream ss;
00353       ss << messageid++;
00354       current->addfont12start(ss.str() + " message.",1);
00355     }
00356     break;
00357 
00358     case ' ': current->scrolldown(); break;
00359    
00360     case 'M': 
00361     {
00362       string str = "This is some text. It has to be a paragraph. ";
00363       str += "Testing the paragraph writing in the message mode.";
00364       current->addfont10paragraphstart(str,40,1);
00365     }
00366     break;
00367 
00368     case 'a':
00369     {
00370       string str = "1.Cabbage\n2.Tomatoes\n3.Pears";
00371       current->addfont10blockstart(str,1);
00372     }
00373     break;
00374    
00375   }
00376 
00377   glutPostRedisplay();
00378 }

void menusystemtest::test01 ( int &  argc,
char **&  argv 
)

Display a menu with keyboard interaction.

*pw << t01();

Definition at line 240 of file menusystemtest.cpp.

References menusystem::addsubmenu(), display01(), keyboard01(), gobjContainer::set(), zpr::update(), and xGraphics.

00244 {
00245   glutInit(&argc,argv);
00246   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00247   glutInitWindowSize(800,600);
00248   glutCreateWindow("");
00249   glutDisplayFunc(display01);
00250   glutKeyboardFunc(keyboard01);
00251 
00252   OpenGLinitialisation();
00253 
00254   glEnable(GL_DEPTH_TEST);
00255   glEnable(GL_CULL_FACE);
00256   glEnable(GL_NORMALIZE);
00257 
00258   xGraphics.set();
00259 
00260   menu01 * m1 = new menu01();
00261   m1->addsubmenu( new menu02() );
00262   menu03 * m3 = new menu03();
00263   m1->addsubmenu( m3 );
00264   m3->addsubmenu( new menu04() );
00265   current = m1;
00266 
00267   pw = new primitiveWindow( point3<double>(0.0,0.0,0.0), 0.1 );
00268 
00269   string tmp("cat \n mat");
00270 
00271   *pw << tmp;
00273 
00274   t01 tmp2;
00275 //  cout << tmp2 << endl;
00276   *pw << tmp2;
00277   //t01().print(*pw);
00278 
00279   tmp = "The weather is very lovely if you like it hot. I have to write ";
00280   tmp += "some silly text and display it, though I am looking forward to ";
00281   tmp += "seeing this software in the product.";
00282 
00283   pw->addparagraph(tmp,63);
00284 
00285   pw->vg.push_back
00286   ( 
00287     new gobjMyBitmapCharacter
00288     (
00289       "be happy?",
00290       point3<double>(.2,.3,.7),
00291       GLUT_BITMAP_HELVETICA_18
00292     ) 
00293   );
00294 
00295   zpr zz;
00296 
00297   zz.update();
00298   glutMainLoop();
00299 }

void menusystemtest::test02 ( int &  argc,
char **&  argv 
)

Test message menu functionality.

Definition at line 381 of file menusystemtest.cpp.

References menusystem::addfont10(), menusystem::addfont12(), display02(), menusystem::fontcolor, gobjpush, mainmenu(), gobjContainer::set(), zpr::update(), and xGraphics.

00385 {
00386   glutInit(&argc,argv);
00387   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00388   glutInitWindowSize(800,600);
00389   glutCreateWindow("");
00390   glutDisplayFunc(display02);
00391   glutKeyboardFunc(keyboard02);
00392 
00393   OpenGLinitialisation();
00394 
00395   glEnable(GL_DEPTH_TEST);
00396   glEnable(GL_CULL_FACE);
00397   glEnable(GL_NORMALIZE);
00398 
00399   xGraphics.set();
00400 
00401   current = 
00402     new menusystem(0,0,true,point2<GLint>(60,50),10);
00403   gobjpush(current);
00404   current->fontcolor = point4<float>(1.0,0.0,0.0,0.8);
00405   current->lightingdisable();
00406 
00407   menusystem * mainmenu = 
00408     new menusystem(0,0,true,point2<GLint>(250,70),10);
00409   mainmenu->fontcolor = point4<float>(240.0/255.0,192.0/255.0,10.0/255.0,0.8);
00410   mainmenu->addfont12("menusystem test",2);
00411   mainmenu->addfont10("m    - print a message.",1);
00412   mainmenu->addfont10("M    - print a paragraph(no user returns in string).",1);
00413   mainmenu->addfont10("space",1);
00414   mainmenu->addfont10("a    - print a block(user returns in string).",1);
00415   gobjpush(mainmenu);
00416 
00417  
00418   //current->addfont12start("The first message.",1);
00419 
00420   zpr zz;
00421 
00422   zz.update();
00423   glutMainLoop();
00424 }


Member Data Documentation

The menu is contained as a composite member.

Definition at line 31 of file menusystemtest.h.

Referenced by display01().


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:06 2011 for Chelton Evans Source by  doxygen 1.5.8