Library of Navigator of menu systems

Files at this revision

API Documentation at this revision

Comitter:
pyeh9
Date:
Thu Feb 28 22:19:46 2013 +0000
Commit message:
First commit

Changed in this revision

Navigator.cpp Show annotated file Show diff for this revision Revisions of this file
Navigator.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 8209f74d51a0 Navigator.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Navigator.cpp	Thu Feb 28 22:19:46 2013 +0000
@@ -0,0 +1,25 @@
+#include "Navigator.h"
+
+Navigator::Navigator(Menu &root, RPG &rpg, TextLCD *lcd) : activeMenu(root), rpg(rpg), lcd(lcd) {}
+
+void Navigator::printMenu()
+{
+    lcd->printf("%s\n", activeMenu.selections[0].selText);
+    lcd->printf("%s\n", activeMenu.selections[1].selText);
+}
+
+void Navigator::poll()
+{
+    if((direction = rpg.dir())!=0){ //Get Dir
+        wait(0.2); 
+        lcd->cls();
+        lcd->printf(" direction:%d\n", direction);
+    }
+       
+    if (rpg.pb()){
+        wait(0.2);
+        lcd->cls();
+        lcd->printf(" button pressed\n"); 
+    }
+    
+}
\ No newline at end of file
diff -r 000000000000 -r 8209f74d51a0 Navigator.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Navigator.h	Thu Feb 28 22:19:46 2013 +0000
@@ -0,0 +1,28 @@
+#ifndef NAVIGATOR_H
+#define NAVIGATOR_H
+
+#include "mbed.h"
+#include "Menu.h"
+#include "TextLCD.h"
+#include "RPG.h"
+
+class Navigator {   
+    private: 
+               
+    public:
+        //Navigator(Menu &, RPG &, TextLCD &);
+        Navigator(Menu &, RPG &, TextLCD *lcd);
+        Menu activeMenu;
+        RPG rpg;
+        TextLCD *lcd; 
+        int direction;
+        bool selectButton;
+        
+        void poll();
+        void moveUp();
+        void moveDown();
+        void printMenu();
+        void update();
+};
+
+#endif 
\ No newline at end of file