Library of Navigator of menu systems

Committer:
pyeh9
Date:
Thu Feb 28 22:19:46 2013 +0000
Revision:
0:8209f74d51a0
First commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pyeh9 0:8209f74d51a0 1 #include "Navigator.h"
pyeh9 0:8209f74d51a0 2
pyeh9 0:8209f74d51a0 3 Navigator::Navigator(Menu &root, RPG &rpg, TextLCD *lcd) : activeMenu(root), rpg(rpg), lcd(lcd) {}
pyeh9 0:8209f74d51a0 4
pyeh9 0:8209f74d51a0 5 void Navigator::printMenu()
pyeh9 0:8209f74d51a0 6 {
pyeh9 0:8209f74d51a0 7 lcd->printf("%s\n", activeMenu.selections[0].selText);
pyeh9 0:8209f74d51a0 8 lcd->printf("%s\n", activeMenu.selections[1].selText);
pyeh9 0:8209f74d51a0 9 }
pyeh9 0:8209f74d51a0 10
pyeh9 0:8209f74d51a0 11 void Navigator::poll()
pyeh9 0:8209f74d51a0 12 {
pyeh9 0:8209f74d51a0 13 if((direction = rpg.dir())!=0){ //Get Dir
pyeh9 0:8209f74d51a0 14 wait(0.2);
pyeh9 0:8209f74d51a0 15 lcd->cls();
pyeh9 0:8209f74d51a0 16 lcd->printf(" direction:%d\n", direction);
pyeh9 0:8209f74d51a0 17 }
pyeh9 0:8209f74d51a0 18
pyeh9 0:8209f74d51a0 19 if (rpg.pb()){
pyeh9 0:8209f74d51a0 20 wait(0.2);
pyeh9 0:8209f74d51a0 21 lcd->cls();
pyeh9 0:8209f74d51a0 22 lcd->printf(" button pressed\n");
pyeh9 0:8209f74d51a0 23 }
pyeh9 0:8209f74d51a0 24
pyeh9 0:8209f74d51a0 25 }