class Modifier{ //ContentType (2)
|
|
private:
|
|
|
|
String title;
|
|
int *value;
|
|
int max;
|
|
int min;
|
|
int step;
|
|
|
|
int previousScreen = 0;
|
|
int previousContentType = 0;
|
|
|
|
public:
|
|
|
|
void configure(String title, int *value, int max, int min, int step){
|
|
this->title = title;
|
|
this->value = value;
|
|
this->max = max;
|
|
this->min = min;
|
|
this->step = step;
|
|
}
|
|
|
|
void drawModifier(){
|
|
display.clearDisplay();
|
|
display.fillRect(0, 0, 127 , 16, SSD1306_WHITE);
|
|
display.setTextColor(SSD1306_BLACK, SSD1306_WHITE);
|
|
display.setTextSize(1);
|
|
display.setCursor(2, 4);
|
|
display.println(this->title);
|
|
|
|
display.setTextColor(SSD1306_WHITE);
|
|
display.setTextSize(3);
|
|
display.setCursor(2, ((DISP_HEIGHT - 16 - 15)/2) + 16);
|
|
display.println(*this->value);
|
|
|
|
display.display();
|
|
|
|
display.setTextSize(1);
|
|
}
|
|
|
|
void increaseValue(){
|
|
if((*this->value + this->step) <= this->max){
|
|
*this->value += this->step;
|
|
}
|
|
}
|
|
|
|
void decreaseValue(){
|
|
if((*this->value - this->step) >= this->min){
|
|
*this->value -= this->step;
|
|
}
|
|
}
|
|
|
|
void setPreviousScreen(int prev){
|
|
this->previousScreen = prev;
|
|
}
|
|
|
|
void setPreviousContentType(int prev){
|
|
this->previousContentType = prev;
|
|
}
|
|
|
|
int getPreviousScreen(){
|
|
int prev = this->previousScreen;
|
|
return prev;
|
|
}
|
|
|
|
int getPreviousContentType(){
|
|
int prev = this->previousContentType;
|
|
return prev;
|
|
}
|
|
};
|