So I can move the blocks by adjusting the values in the array (which will help later) but I am having trouble with the time interval. How can I get it to move every .5s (for example) without affecting (or stopping) the rest of the program?
The space is 7x15 (with a space at the bottom) and the rects are multiplied my 1-7 depending on which column and 1-15 depending on the row.
This is the relevant function but let me know if I should include the rest of the code. It is just the background and a button that is yet to be given the 'stop' part.
void moveLights()
{
int rowNum[] = {2,3,4};
//These will show rects 2,3 and 4. Adjust for desired column number.
for (int lights = 0;lights<=rowNum.length-1;lights++)
So, obviously it needs a lot of work for it to be a fully functioning calendar app, but what are your initial thoughts? I just made this for fun, I guess its my first real application. To add an event just add a line in the setEvent() function at the top as I haven't added the 'add event' portion to the gui yet. You will probably have to add a new event as we are most likely in different time zones. I know there are a lot but if you spot an error just let me know :D.
if (startTimeArray[eventNumberInArray]<=hour()+(minute()*pow(10,-2))&&endTimeArray[eventNumberInArray]>hour()+(minute()*pow(10,-2)))
{
currentEventsCounter-=20;
fill(0);
int endPositionVal = round(((float)((float)((int(endTimeArray[eventNumberInArray])+((float)((endTimeArray[eventNumberInArray]-int(endTimeArray[eventNumberInArray]))*pow(10,2))/60))-(hour()+((float)minute()/60)))*60)/60)*100);
noStroke();
if (calendarNameArray[eventNumberInArray] == "Music")
{
color eventCol = color(100,0,150,75);
fill(eventCol);
}
else if (calendarNameArray[eventNumberInArray] == "Exercise")
{
color eventCol = color(255,0,0,75);
fill(eventCol);
}
else if (calendarNameArray[eventNumberInArray] == "School")
{
color eventCol = color(0,150,150,75);
fill(eventCol);
}
else if (calendarNameArray[eventNumberInArray] == "Sleep")
{
color eventCol = color(0,0,0,75);
fill(eventCol);
}
else if (calendarNameArray[eventNumberInArray] == "Meal")
OK so let me explain what it is first. This is just one line that determines the y position of a rect. So it is getting a time value from the timeArray in the form: 15.45, it then determines how long between that time and the current time. It is then scaled so that for every hour there is 100px. So, for example if there is a 2 hour difference the value should be 200.
In the comment it is broken down and explained, what am i doing wrong?
I println'd the value and it is giving me -1100 haha. What am i doing wrong?
float x = ((((int(endTimeArray[eventNumberInArray])+(((endTimeArray[eventNumberInArray]-int(endTimeArray[eventNumberInArray]))*pow(10,2))/60))-(hour()+(minute()/60)))*60)/60)*100);
/*
a = endTimeArray[eventNumberInArray]-int(endTimeArray[eventNumberInArray])
Takes the time from the array (e.g. 12.15) and minuses the integer of it so: 12.15-12 and were left with 0.15.
b = a *pow(10,2)
Now we make .15 into the minutes by multiplying by 100: 0.15*100 = 15.
c = b/60
Divide by 60 so that we make it into a real decimal rather than the amount of minutes so: 15/60 = 0.25 hours.
f = int(endTimeArray[eventNumberInArray])+c
This makes it into the amount of hours so it is now 12.25 hours.
d = minute()/60
to make the minutes into a decimal. For example 30 --> .5
e = hour()+d
Now hour is added to the decimal of a minute so for example: 11.5 hours.
g = f-e
Using previous examples: 12.25-11.5 = 0.75. Its a 0.75 Hour difference
h = e*60
Multiply 0.75*60 so that it goes back into minutes. 0.75*60 = 45
i = h*100/60
Now it is scaled so that every hour is equal to 100. 45*100/60 = 75.
*/
If I haven't explained something please let me know and I will explain it better.