![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Diff: MenuClasses/Settings/Settings.cpp
- Revision:
- 49:441c32f6603e
- Parent:
- 43:233f93860d08
- Child:
- 55:df0825049171
--- a/MenuClasses/Settings/Settings.cpp Fri Apr 26 12:46:42 2019 +0000 +++ b/MenuClasses/Settings/Settings.cpp Fri Apr 26 17:16:22 2019 +0000 @@ -42,9 +42,10 @@ {1,1,0,0,0,0,0,0}, }; -float * Settings::Implement(N5110 &lcd, Gamepad &pad, int st, float cs) +float * Settings::Implement(N5110 &lcd, Gamepad &pad, float cs) { Settings::info(lcd, pad); + int st = 1; pad.init(); while (pad.check_event(Gamepad::BACK_PRESSED) == false) { //if button pressed. Direction d = pad.get_direction(); @@ -66,7 +67,7 @@ lcd.drawSprite(5,22,13,8,(int *)naviL); //Function used to draw the sprite. lcd.drawSprite(71,22,13,8,(int *)naviR); //Function used to draw the sprite. if(st==1) { - cs = Settings::controlSensitivity(lcd, pad); + Settings::controlSensitivity(lcd, pad); } if(st==2) { Settings::brigntness(lcd, pad); @@ -78,11 +79,10 @@ Settings::volume(lcd, pad); } if(st==5) { - cs_sc[1] = Settings::showCredits(lcd, pad); + Settings::showCredits(lcd, pad); } lcd.refresh(); } - cs_sc[0] = cs; return cs_sc; } @@ -110,15 +110,13 @@ lcd.clear(); } -float Settings::controlSensitivity(N5110 &lcd, Gamepad &pad) +void Settings::controlSensitivity(N5110 &lcd, Gamepad &pad) { lcd.printString("Control Speeds",0,0); - float cs; - cs = pad.read_pot()*5+1; + cs_sc[0] = pad.read_pot()*5+1; lcd.drawRect(15,22,54,13,FILL_TRANSPARENT); lcd.drawRect(15,22,pad.read_pot()*54,13,FILL_BLACK); pad.leds_on(); - return cs; } void Settings::brigntness(N5110 &lcd, Gamepad &pad) @@ -153,23 +151,21 @@ pad.leds_on(); } -int Settings::showCredits(N5110 &lcd, Gamepad &pad) +void Settings::showCredits(N5110 &lcd, Gamepad &pad) { lcd.printString("Show Credits?",5,0); float pot; - int show = 1; pot = pad.read_pot(); if(((0.1<=pot)&&(pot<=0.2))||((0.3<=pot)&&(pot<=0.4))||((0.5<=pot)&&(pot<=0.6))||((0.7<=pot)&&(pot<=0.8))||((0.9<=pot)&&(pot<=1))) { lcd.printString("NO",36,3); - show = 0; + cs_sc[1] = 0; } else { lcd.printString("YES",33,3); - show = 1; + cs_sc[1] = 1; } pad.leds_on(); - return show; } \ No newline at end of file