//----------- Function for drawing pipe -----------
// consider : type of pipe, rotation, location
// pink pipe = a pipe which is waiting to be placed by user
// grey pipe = pipes already placed on the screen
void ofApp::drawPipe() {
if (currentP->pipe_type == 1) {
float x, y;
switch (currentP->rotation) {
case 1:
x = currentP->x;
y = currentP->y + 40;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 120, 40);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x + 105, y - 10, 15, 60);
break;
case 2:
x = currentP->x + 40;
y = currentP->y;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 40, 120);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x - 10, y + 105, 60, 15);
break;
case 3:
x = currentP->x;
y = currentP->y + 40;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 120, 40);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x, y - 10, 15, 60);
break;
case 4:
x = currentP->x + 40;
y = currentP->y;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 40, 120);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x - 10, y, 60, 15);
break;
}
}
else if (currentP->pipe_type == 2) {
float x, y;
switch (currentP->rotation) {
case 1:
x = currentP->x;
y = currentP->y + 40;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 40, 40);
ofDrawRectangle(x + 40, y, 40, 40);
ofDrawRectangle(x + 40, y + 40, 40, 40);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x + 30, y + 65, 60, 15);
break;
case 2:
x = currentP->x;
y = currentP->y + 40;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 40, 40);
ofDrawRectangle(x + 40, y, 40, 40);
ofDrawRectangle(x + 40, y - 40, 40, 40);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x, y - 10, 15, 60);
break;
case 3:
x = currentP->x + 40;
y = currentP->y;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 40, 40);
ofDrawRectangle(x, y + 40, 40, 40);
ofDrawRectangle(x + 40, y + 40, 40, 40);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x - 10, y, 60, 15);
break;
case 4:
x = currentP->x + 40;
y = currentP->y + 40;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 40, 40);
ofDrawRectangle(x + 40, y, 40, 40);
ofDrawRectangle(x, y + 40, 40, 40);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x + 65, y - 10, 15, 60);
break;
}
}
else if (currentP->pipe_type == 3) {
float x, y;
switch (currentP->rotation) {
case 1:
x = currentP->x;
y = currentP->y + 40;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 40, 40);
ofDrawRectangle(x + 40, y, 40, 40);
ofDrawRectangle(x + 40, y + 40, 40, 40);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x, y - 10, 15, 60);
break;
case 2:
x = currentP->x;
y = currentP->y + 40;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 40, 40);
ofDrawRectangle(x + 40, y, 40, 40);
ofDrawRectangle(x + 40, y - 40, 40, 40);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x + 30, y - 40, 60, 15);
break;
case 3:
x = currentP->x + 40;
y = currentP->y;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 40, 40);
ofDrawRectangle(x, y + 40, 40, 40);
ofDrawRectangle(x + 40, y + 40, 40, 40);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x + 65, y + 30, 15, 60);
break;
case 4:
x = currentP->x + 40;
y = currentP->y + 40;
ofSetColor(colorA, colorB, colorC);
ofDrawRectangle(x, y, 40, 40);
ofDrawRectangle(x + 40, y, 40, 40);
ofDrawRectangle(x, y + 40, 40, 40);
ofSetColor(colorA, colorD, colorE);
ofDrawRectangle(x - 10, y + 65, 60, 15);
break;
}
}
}