Library of Navigator of menu systems

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Navigator.cpp Source File

Navigator.cpp

00001 #include "Navigator.h"
00002 
00003 Navigator::Navigator(Menu &root, RPG &rpg, TextLCD *lcd) : activeMenu(root), rpg(rpg), lcd(lcd) {}
00004 
00005 void Navigator::printMenu()
00006 {
00007     lcd->printf("%s\n", activeMenu.selections[0].selText);
00008     lcd->printf("%s\n", activeMenu.selections[1].selText);
00009 }
00010 
00011 void Navigator::poll()
00012 {
00013     if((direction = rpg.dir())!=0){ //Get Dir
00014         wait(0.2); 
00015         lcd->cls();
00016         lcd->printf(" direction:%d\n", direction);
00017     }
00018        
00019     if (rpg.pb()){
00020         wait(0.2);
00021         lcd->cls();
00022         lcd->printf(" button pressed\n"); 
00023     }
00024     
00025 }