Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of Facial Expression: SHOCK #89

Merged
merged 1 commit into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 59 additions & 19 deletions Arduino/OsrScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,14 @@ int* Screen::get_color(int num){
}

void Screen::display_face(int face){
if (face == 0x01){
if (face == 0x00){
happy_face();
}
else if (face == 0x01){
eight_bit_face();
}
else if (face == 0x00){
happy_face();
else if (face == 0x02){
shocked_face();
}
}

Expand Down Expand Up @@ -265,11 +268,23 @@ void Screen::happy_eye(int x, int y, int rgb[]){

}


void Screen::sleepy_eye(int x, int y, int rgb[]){
RGBmatrixPanel::drawLine(x-2,y,x+2,y,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
}

void Screen::shocked_eye(int x, int y, int rgb[]){
RGBmatrixPanel::drawLine(x-2,y-2,x+2,y+2,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x-2,y+2,x+2,y-2,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
}

void Screen::eight_bit_eye(int x, int y){
RGBmatrixPanel::fillCircle(x,y,2,RGBmatrixPanel::Color444(0,0,15));
RGBmatrixPanel::drawLine(x-1,y-1,x-1,y+1,RGBmatrixPanel::Color444(3,0,15));
RGBmatrixPanel::drawLine(x,y+1,x+1,y+1,RGBmatrixPanel::Color444(3,0,15));
RGBmatrixPanel::drawLine(x,y-1,x+1,y-1,RGBmatrixPanel::Color444(WHITE));
RGBmatrixPanel::drawLine(x,y,x+1,y,RGBmatrixPanel::Color444(WHITE));
}

void Screen::happy_mouth(int x, int y, int rgb[]){
RGBmatrixPanel::drawLine(x-4,y,x-2,y+2,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x-1,y+2,x+2,y+2,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
Expand All @@ -278,13 +293,6 @@ void Screen::happy_mouth(int x, int y, int rgb[]){
RGBmatrixPanel::drawPixel(x+5,y-1,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
}

void Screen::circle_cheek(int x, int y, int rgb[]){
RGBmatrixPanel::drawLine(x-1,y,x-1,y+1,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x+2,y,x+2,y+1,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x,y-1,x+1,y-1,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x,y+2,x+1,y+2,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
}


void Screen::cute_mouth(int x, int y, int rgb[]){
RGBmatrixPanel::drawLine(x-4,y,x-2,y+2,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
Expand All @@ -299,20 +307,26 @@ void Screen::cute_mouth(int x, int y, int rgb[]){
//RGBmatrixPanel::drawPixel(x-4,y-1,RGBmatrixPanel::Color444(r,g,b));
//RGBmatrixPanel::drawPixel(x+5,y-1,RGBmatrixPanel::Color444(r,g,b));
}

void Screen::open_mouth(int x, int y, int rgb[]){
RGBmatrixPanel::drawLine(x-2,y-1,x+2,y-1,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x+2,y-1,x+2,y+2,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x+2,y+2,x-2,y+2,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x-2,y+2,x-2,y-1,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
}

void Screen::circle_cheek(int x, int y, int rgb[]){
RGBmatrixPanel::drawLine(x-1,y,x-1,y+1,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x+2,y,x+2,y+1,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x,y-1,x+1,y-1,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x,y+2,x+1,y+2,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
}

void Screen::cute_cheeks(int x, int y, int rgb[]){
RGBmatrixPanel::drawLine(x-2,y-1,x+1,y-1,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
RGBmatrixPanel::drawLine(x-2,y,x+1,y,RGBmatrixPanel::Color444(rgb[0],rgb[1],rgb[2]));
}

void Screen::eight_bit_eye(int x, int y){
RGBmatrixPanel::fillCircle(x,y,2,RGBmatrixPanel::Color444(0,0,15));
RGBmatrixPanel::drawLine(x-1,y-1,x-1,y+1,RGBmatrixPanel::Color444(3,0,15));
RGBmatrixPanel::drawLine(x,y+1,x+1,y+1,RGBmatrixPanel::Color444(3,0,15));
RGBmatrixPanel::drawLine(x,y-1,x+1,y-1,RGBmatrixPanel::Color444(WHITE));
RGBmatrixPanel::drawLine(x,y,x+1,y,RGBmatrixPanel::Color444(WHITE));
}


void Screen::eight_bit_face(){
//clear_face();
Expand All @@ -338,6 +352,32 @@ void Screen::happy_face(){
cute_cheeks(22,9,cheek_color);

}

void Screen::shocked_face(){
/*
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooo●ooo●ooo●ooo●ooooooooooo
ooooooooo●o●ooooo●o●oooooooooooo
oooooooooo●ooooooo●ooooooooooooo
ooooooooo●o●ooooo●o●oooooooooooo
oooooooo●ooo●ooo●ooo●ooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooo●●●●●ooooooooooooooo
oooooooooooo●ooo●ooooooooooooooo
oooooooooooo●ooo●ooooooooooooooo
oooooooooooo●●●●●ooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
*/
int eye_color[] = {15,0,0};
int mouth_color[] = {15,0,0};
shocked_eye(10,5,eye_color);
shocked_eye(18,5,eye_color);
open_mouth(14,11,mouth_color);
}

void Screen::sleepy_face(){
int eye_color[] = {3,0,15};
Expand Down
1 change: 1 addition & 0 deletions Arduino/OsrScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class Screen: public RGBmatrixPanel {
void eight_bit_eye(int,int);
void eight_bit_face();
void happy_face();
void shocked_face();
void sleepy_face();
void clear_face();

Expand Down