Dependencies: mbed FATFileSystem
SceneCreator/SceneFunctions.cpp@9:ac396c818874, 2019-04-25 (annotated)
- Committer:
- rottenegg
- Date:
- Thu Apr 25 01:31:32 2019 +0000
- Revision:
- 9:ac396c818874
- Child:
- 10:4fda7b01484a
CaMove: New Chaser Character Functions; AniPaths: New Chaser Model Paths; SceneCreator: Update and completion + new Chaser Options; SceneFunctions : New Scene Functions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rottenegg | 9:ac396c818874 | 1 | #include "SceneFunctions.h" |
rottenegg | 9:ac396c818874 | 2 | |
rottenegg | 9:ac396c818874 | 3 | //Constructor Functions |
rottenegg | 9:ac396c818874 | 4 | void SceneFunctions::set_buttonPin(PinName pin) { |
rottenegg | 9:ac396c818874 | 5 | _BOK = (new DigitalIn(pin)); |
rottenegg | 9:ac396c818874 | 6 | _BOK->mode(PullDown); |
rottenegg | 9:ac396c818874 | 7 | } |
rottenegg | 9:ac396c818874 | 8 | |
rottenegg | 9:ac396c818874 | 9 | void SceneFunctions::deletebutton() { |
rottenegg | 9:ac396c818874 | 10 | delete _BOK; |
rottenegg | 9:ac396c818874 | 11 | } |
rottenegg | 9:ac396c818874 | 12 | |
rottenegg | 9:ac396c818874 | 13 | //Ultility Functions |
rottenegg | 9:ac396c818874 | 14 | void SceneFunctions::transition(N5110 &lcd) { |
rottenegg | 9:ac396c818874 | 15 | for (int i = 0;i < 84;i++) { |
rottenegg | 9:ac396c818874 | 16 | lcd.drawRect(0,0,i,48,FILL_BLACK); |
rottenegg | 9:ac396c818874 | 17 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 18 | } |
rottenegg | 9:ac396c818874 | 19 | for (int i = 0;i < 84;i++) { |
rottenegg | 9:ac396c818874 | 20 | lcd.drawRect(0,0,i,48,FILL_WHITE); |
rottenegg | 9:ac396c818874 | 21 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 22 | } |
rottenegg | 9:ac396c818874 | 23 | } |
rottenegg | 9:ac396c818874 | 24 | |
rottenegg | 9:ac396c818874 | 25 | void SceneFunctions::lockin(N5110 &lcd) { |
rottenegg | 9:ac396c818874 | 26 | while (_BOK->read() == 0) { |
rottenegg | 9:ac396c818874 | 27 | lcd.printString(" ",0,5); |
rottenegg | 9:ac396c818874 | 28 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 29 | wait(0.15); |
rottenegg | 9:ac396c818874 | 30 | lcd.printString("...Press B...",0,5); |
rottenegg | 9:ac396c818874 | 31 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 32 | wait(0.15); |
rottenegg | 9:ac396c818874 | 33 | } |
rottenegg | 9:ac396c818874 | 34 | } |
rottenegg | 9:ac396c818874 | 35 | |
rottenegg | 9:ac396c818874 | 36 | void SceneFunctions::flash(N5110 &lcd) { |
rottenegg | 9:ac396c818874 | 37 | for(int i = 0; i < 4; i++) { |
rottenegg | 9:ac396c818874 | 38 | lcd.drawRect(0,0,84,48,FILL_BLACK); |
rottenegg | 9:ac396c818874 | 39 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 40 | wait(0.15); |
rottenegg | 9:ac396c818874 | 41 | lcd.drawRect(0,0,84,48,FILL_WHITE); |
rottenegg | 9:ac396c818874 | 42 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 43 | wait(0.15); |
rottenegg | 9:ac396c818874 | 44 | }; |
rottenegg | 9:ac396c818874 | 45 | }; |
rottenegg | 9:ac396c818874 | 46 | |
rottenegg | 9:ac396c818874 | 47 | //Unique to Scene Functions |
rottenegg | 9:ac396c818874 | 48 | //scene 0 Functions |
rottenegg | 9:ac396c818874 | 49 | void SceneFunctions::set_scene0(CaMove &CM) { |
rottenegg | 9:ac396c818874 | 50 | CM.set_region(1, 28, 12, 17); //event 0 |
rottenegg | 9:ac396c818874 | 51 | CM.set_region(66, 15, 21, 24); //event 1 |
rottenegg | 9:ac396c818874 | 52 | }; |
rottenegg | 9:ac396c818874 | 53 | //pre funtions |
rottenegg | 9:ac396c818874 | 54 | void SceneFunctions::obj0_scene0(N5110 &lcd) { |
rottenegg | 9:ac396c818874 | 55 | lcd.drawRect(32,1,20,2,FILL_BLACK); |
rottenegg | 9:ac396c818874 | 56 | }; |
rottenegg | 9:ac396c818874 | 57 | //pos functions |
rottenegg | 9:ac396c818874 | 58 | void SceneFunctions::event0_scene0(N5110 &lcd) { |
rottenegg | 9:ac396c818874 | 59 | this->transition(lcd); |
rottenegg | 9:ac396c818874 | 60 | lcd.clear(); |
rottenegg | 9:ac396c818874 | 61 | lcd.printString("Hello My Name",0,0); |
rottenegg | 9:ac396c818874 | 62 | lcd.printString("Veigar I Shall",0,1); |
rottenegg | 9:ac396c818874 | 63 | lcd.printString("Help You Find",0,2); |
rottenegg | 9:ac396c818874 | 64 | lcd.printString("What You Seek",0,3); |
rottenegg | 9:ac396c818874 | 65 | lcd.printString("Now go ... ",0,4); |
rottenegg | 9:ac396c818874 | 66 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 67 | this->lockin(lcd); |
rottenegg | 9:ac396c818874 | 68 | this->transition(lcd); |
rottenegg | 9:ac396c818874 | 69 | } |
rottenegg | 9:ac396c818874 | 70 | |
rottenegg | 9:ac396c818874 | 71 | //event 1 |
rottenegg | 9:ac396c818874 | 72 | void SceneFunctions::event1_scene0(N5110 &lcd) { |
rottenegg | 9:ac396c818874 | 73 | this->transition(lcd); |
rottenegg | 9:ac396c818874 | 74 | lcd.clear(); |
rottenegg | 9:ac396c818874 | 75 | lcd.printString("It's a Weird",0,0); |
rottenegg | 9:ac396c818874 | 76 | lcd.printString("quite eerie...",0,1); |
rottenegg | 9:ac396c818874 | 77 | lcd.printString("Statue !!",0,2); |
rottenegg | 9:ac396c818874 | 78 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 79 | this->lockin(lcd); |
rottenegg | 9:ac396c818874 | 80 | this->transition(lcd); |
rottenegg | 9:ac396c818874 | 81 | } |
rottenegg | 9:ac396c818874 | 82 | |
rottenegg | 9:ac396c818874 | 83 | //scene1 Funtions |
rottenegg | 9:ac396c818874 | 84 | void SceneFunctions::set_scene1(CaMove &CM) { |
rottenegg | 9:ac396c818874 | 85 | CM.set_region(2, 38, 8, 7); //event 0 |
rottenegg | 9:ac396c818874 | 86 | CM.set_region(72, 2, 8, 7); //event 1 |
rottenegg | 9:ac396c818874 | 87 | }; |
rottenegg | 9:ac396c818874 | 88 | |
rottenegg | 9:ac396c818874 | 89 | //pre funtions |
rottenegg | 9:ac396c818874 | 90 | void SceneFunctions::obj0_scene1(N5110 &lcd) { |
rottenegg | 9:ac396c818874 | 91 | lcd.drawLine(30,40,31,20,0); |
rottenegg | 9:ac396c818874 | 92 | lcd.drawLine(55,40,55,20,1); |
rottenegg | 9:ac396c818874 | 93 | lcd.drawRect(5,1,20,2,FILL_BLACK); |
rottenegg | 9:ac396c818874 | 94 | } |
rottenegg | 9:ac396c818874 | 95 | |
rottenegg | 9:ac396c818874 | 96 | void SceneFunctions::obj1_scene1(N5110 &lcd) { |
rottenegg | 9:ac396c818874 | 97 | lcd.drawRect(32,1,20,2,FILL_BLACK); |
rottenegg | 9:ac396c818874 | 98 | } |
rottenegg | 9:ac396c818874 | 99 | |
rottenegg | 9:ac396c818874 | 100 | |
rottenegg | 9:ac396c818874 | 101 | //pos functions |
rottenegg | 9:ac396c818874 | 102 | void SceneFunctions::event0_scene1(N5110 &lcd) { |
rottenegg | 9:ac396c818874 | 103 | lcd.drawRect(74,3,6,3,FILL_WHITE); |
rottenegg | 9:ac396c818874 | 104 | lcd.drawLine(4,39,7,41,1); |
rottenegg | 9:ac396c818874 | 105 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 106 | wait(0.2); |
rottenegg | 9:ac396c818874 | 107 | lcd.drawRect(74,3,6,3,FILL_WHITE); |
rottenegg | 9:ac396c818874 | 108 | lcd.drawLine(9,39,7,41,1); |
rottenegg | 9:ac396c818874 | 109 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 110 | wait(0.2); |
rottenegg | 9:ac396c818874 | 111 | } |
rottenegg | 9:ac396c818874 | 112 | |
rottenegg | 9:ac396c818874 | 113 | void SceneFunctions::event1_scene1(N5110 &lcd) { |
rottenegg | 9:ac396c818874 | 114 | lcd.drawRect(74,3,6,3,FILL_WHITE); |
rottenegg | 9:ac396c818874 | 115 | lcd.drawLine(74,3,77,5,1); |
rottenegg | 9:ac396c818874 | 116 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 117 | wait(0.2); |
rottenegg | 9:ac396c818874 | 118 | lcd.drawRect(74,3,6,3,FILL_WHITE); |
rottenegg | 9:ac396c818874 | 119 | lcd.drawLine(79,3,77,5,1); |
rottenegg | 9:ac396c818874 | 120 | lcd.refresh(); |
rottenegg | 9:ac396c818874 | 121 | wait(0.2); |
rottenegg | 9:ac396c818874 | 122 | } |