1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
void leftMouseClick(int* colors, int* colors2, int no_colors, int* score)
{
int x = 0;
int y = 0;
bool correct = false;
for (int j = 0; j < no_colors; j++)
{
gout << setPos(300, 400) << "Click on Color #" << (j+1) << endg;
while(true)
{
if (leftMouse(x, y))
{
//check for colors
//clicking box 1 at the bottom
if ( (x > 50) && (x < 125) && (y > 300) && (y < 375) ){
if (colors2[0] == colors[j])
{
correct = true;
gout << setPos(300,10) << "Correct!" << endg;
}
else if (colors2[0] != colors[j])
{
gout << setPos(300,10) << "INCORRECT ANSWER" << endg;
correct = false;
}
cout << correct << endl;
if (correct = true)
score = score + 2;
else if (correct = false)
score = score - 2;
}
//clicking box 2
if ( (x > 150) && (x < 225) && (y > 300) && (y > 375) ){
if (colors2[1] == colors[j])
{
correct = true;
gout << setPos(300,10) << "Correct!" << endg;
}
else if (colors2[1] != colors[j])
{
gout << setPos(300,10) << "INCORRECT ANSWER" << endg;
correct = false;
}
cout << correct << endl;
if (correct = true)
score = score + 2;
else if (correct = false;
score = score - 2;
}
//clicking box 3
if ( (x > 250) && (x < 325) && (y > 300) && (y > 375) ){
if (colors2[2] == colors[j])
{
correct = true;
gout << setPos(300,10) << "Correct!" << endg;
}
else if (colors2[2] != colors[j])
{
gout << setPos(300,10) << "INCORRECT ANSWER" << endg;
correct = false;
}
cout << correct << endl;
if (correct = true)
score = score + 2;
else if (correct = false)
score = score - 2;
}
//clicking box 4
if ( (x > 350) && (x < 425) && (y > 300) && (y > 375) )
{
if (colors2[3] == colors[j])
{
correct = true;
gout << setPos(300,10) << "Correct!" << endg;
}
else if (colors2[3] != colors[j])
{
gout << setPos(300,10) << "INCORRECT ANSWER" << endg;
correct = false;
}
cout << correct << endl;
if (correct = true)
score = score + 2;
else if (correct = false)
score = score - 2;
}
//clicking box 5
if ( (x > 450) && (x < 525) && (y > 300) && (y > 375) ){
if (colors2[4] == colors[j])
{
correct = true;
gout << setPos(300,10) << "Correct!" << endg;
}
else if (colors2[4] != colors[j])
{
gout << setPos(300,10) << "INCORRECT ANSWER" << endg;
correct = false;
}
cout << correct << endl;
if (correct = true)
*score = *score + 2;
else if (correct = false)
*score = *score - 2;
}
}
}
}
}
|