Page 1 of 1

My solution for lesson 6 homework - good or bad?

Posted: May 14th, 2013, 11:54 pm
by DreamBliss
If you have not tried to do the lesson 6 homework than you should not read this. In fact you should not read this until you have watched lesson 7. This is how I solved the cursor color change issue, but I didn't follow the rules and used an operator that had not as yet been introduced. Is this a good solution or would it present problems if I wanted to have a color change in another area? Just want to see if my thinking is good here:

Code: Select all

int yT = 200; // Border 200 pixels
int yB = 400; // Border 400 pixels
int xL = 300; // Border 300 pixels
int xR = 500; // Border 500 pixels

if(xPos < xL || xPos > xR) // Defining color change area for X
{
	red = 255;
	green = 255;
	blue = 255;
}

if(yPos < yT || yPos > yB) // Defining color change area for Y
{
	red = 255;
	green = 255;
	blue = 255;
} //xPos, yPos is a user variable that sets the x,y value of the cursor to 400,300 in order to solve an earlier homework assignment.
On a side note I have decided to prowl the forums and see if there is anyone I can help with anything. I feel confident enough in the basics that maybe I can contribute in this way.