This is the Mexican Standoff prototype made by Francisco Martin and Andrew Smith. Please refer to the following link for instructions on hardware hookup: https://developer.mbed.org/users/fomartin/notebook/mexican-standoff-reaction-game/

Dependencies:   SDFileSystem mbed-rtos mbed wave_player 4DGL-uLCD-SE PinDetect

Revision:
0:75716bd37804
Child:
1:4976bbb3376f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/States/Rules.cpp	Mon Mar 14 03:04:08 2016 +0000
@@ -0,0 +1,69 @@
+#include "States.h"
+#include <algorithm>
+
+Rules::Rules(uLCD_4DGL &uLCD, PinDetect &button0, PinDetect &button1, PinDetect &button2, PinDetect &button3)
+{
+    uLCD.color(LGREY);
+    uLCD.set_font_size(5, 9);
+    
+    int page = 0;
+    bool updateText = true;
+    
+    
+    do
+    {
+        if(updateText)
+        {
+            updateText = false;
+            
+            switch(page)
+            {
+                case 0:
+                {
+                    uLCD.cls();
+                    uLCD.printf(" Mexican Standoff \n");
+                    uLCD.printf("  First player to \n");
+                    uLCD.printf(" fire the correct \n");
+                    uLCD.printf("     gun wins!    \n");
+                    uLCD.printf("\n");
+                    uLCD.printf(" Learn the visual \n");
+                    uLCD.printf("       cues!      \n");
+                    uLCD.printf("\n");
+                    uLCD.printf("\n");
+                    uLCD.printf("    (Page 1/2)    ");
+                } break;
+                
+                case 1:
+                {
+                    uLCD.cls();
+                    uLCD.printf("      Video:      \n");
+                    uLCD.printf("  Shoot on green. \n");
+                    uLCD.printf(" Hold fire on red.\n");
+                    uLCD.printf(" Arrow tells which\n");
+                    uLCD.printf("gun to use. Circle\n");
+                    uLCD.printf(" means use either!\n");
+                    uLCD.printf("\n");
+                    uLCD.printf("\n");
+                    uLCD.printf("\n");
+                    uLCD.printf("    (Page 2/2)    ");
+                } break;
+            }
+        }
+        
+        if(!button3)
+        {
+            if(page != 0)
+                updateText = true;
+                
+            page = max(0, page - 1);
+        }    
+        if(!button2)
+        {
+            if(page != 2)
+                updateText = true;
+                
+            page = min(2, page + 1);
+        }
+            
+    } while(button0 && button1); //evaluate this after rendering text so it doesn't immediately exit menu if button is down
+}
\ No newline at end of file