So here is my code:
void Draw() {
int x = 57;
int y = 500;
int temp = x;
int colour;
for (int i = 0; i <= 13; ++i){
for (int j = 0; j <= 9; ++j){
if (i % 2 == 0){
colour = 3;
}
else colour = 4;
DrawRectangle(x, y, 67, 30, colors[colour]);
x = x + 67;
}
y = y - 30;
x = temp;
}
DrawCircle(100, 100, 10, colors[2]);
DrawRectangle(20, 0, 95, 12, colors[1]);
}
void Move(int key, int x, int y) {
if (key == GLUT_KEY_LEFT) { // left arrow key is pressed
}
else if (key == GLUT_KEY_RIGHT) { // right arrow key is pressed
}
glutPostRedisplay(); // Redo- the drawing by calling
}
These are my two functions in a class. I need to copy the values of x and y from Move() to Draw(), but Draw() does not take any arguments, What other way is there to do this. Also, if someone needs the full code he can ask for it.
Aucun commentaire:
Enregistrer un commentaire