Library implementing menu system, with RPG interface, navigator system
Dependencies: Menu RPG TextLCD mbed
notes.h@0:10b365b7873b, 2013-02-28 (annotated)
- Committer:
- pyeh9
- Date:
- Thu Feb 28 22:19:56 2013 +0000
- Revision:
- 0:10b365b7873b
- Child:
- 2:202735df93cd
First commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pyeh9 | 0:10b365b7873b | 1 | /* |
pyeh9 | 0:10b365b7873b | 2 | struct dirent *p; |
pyeh9 | 0:10b365b7873b | 3 | DIR *d = opendir("/sd/mydir"); |
pyeh9 | 0:10b365b7873b | 4 | char line[80]; |
pyeh9 | 0:10b365b7873b | 5 | string filename; |
pyeh9 | 0:10b365b7873b | 6 | |
pyeh9 | 0:10b365b7873b | 7 | while((p = readdir(d)) != NULL){ |
pyeh9 | 0:10b365b7873b | 8 | menu.push_back(p->d_name); |
pyeh9 | 0:10b365b7873b | 9 | } |
pyeh9 | 0:10b365b7873b | 10 | |
pyeh9 | 0:10b365b7873b | 11 | */ |
pyeh9 | 0:10b365b7873b | 12 | //lcd.printf("%s\n", test.getText()); |
pyeh9 | 0:10b365b7873b | 13 | |
pyeh9 | 0:10b365b7873b | 14 | /*lcd.printf(">%s\n", menu[cursor].c_str()); |
pyeh9 | 0:10b365b7873b | 15 | lcd.printf(" %s", menu[cursor+1].c_str()); |
pyeh9 | 0:10b365b7873b | 16 | while(1){ |
pyeh9 | 0:10b365b7873b | 17 | if((dirt = rpg1.dir())!=0){ //Get Dir |
pyeh9 | 0:10b365b7873b | 18 | wait(0.15); |
pyeh9 | 0:10b365b7873b | 19 | cursor = cursor + dirt; //Ad Dir to count |
pyeh9 | 0:10b365b7873b | 20 | if(cursor < 0) cursor = 0; |
pyeh9 | 0:10b365b7873b | 21 | else if(cursor > 8) cursor = 8; |
pyeh9 | 0:10b365b7873b | 22 | lcd.cls(); |
pyeh9 | 0:10b365b7873b | 23 | lcd.printf(">%s\n", menu[cursor].c_str()); |
pyeh9 | 0:10b365b7873b | 24 | lcd.printf(" %s", menu[cursor+1].c_str()); |
pyeh9 | 0:10b365b7873b | 25 | } |
pyeh9 | 0:10b365b7873b | 26 | |
pyeh9 | 0:10b365b7873b | 27 | if (rpg1.pb()){ |
pyeh9 | 0:10b365b7873b | 28 | wait(0.25); |
pyeh9 | 0:10b365b7873b | 29 | lcd.cls(); |
pyeh9 | 0:10b365b7873b | 30 | filename = "/sd/mydir/"+menu[cursor]; |
pyeh9 | 0:10b365b7873b | 31 | //lcd.printf("%s\n", filename); |
pyeh9 | 0:10b365b7873b | 32 | FILE *fp = fopen(filename.c_str(), "r"); |
pyeh9 | 0:10b365b7873b | 33 | if(fp == NULL) { |
pyeh9 | 0:10b365b7873b | 34 | error("Could not open file for reading\n"); |
pyeh9 | 0:10b365b7873b | 35 | } |
pyeh9 | 0:10b365b7873b | 36 | fgets(line, 80, fp); |
pyeh9 | 0:10b365b7873b | 37 | lcd.printf("%s\n", line); |
pyeh9 | 0:10b365b7873b | 38 | fclose(fp); |
pyeh9 | 0:10b365b7873b | 39 | } |
pyeh9 | 0:10b365b7873b | 40 | } |
pyeh9 | 0:10b365b7873b | 41 | */ |