I already know that Processing has several functions related to Time and Date.
So for example, if I want to display the date in this format: day-month-year
I can code this way:
Since the month() function only returns integer value from 1 to 12, I've built a simple function to convert this number into the name of the month (like "January", "February" and so on) using switch statement.
switch(month())
{
case 1:
monthName = "January";
break;
...
But what I really want to know is how can I display the name of the day (like "Sunday", "Monday", etc) ?
This is because day() function only returns an integer value indicating the day number, not the name of the day.
I'm expecting the result like the one below:
I'm just learning Processing. I want to create a Processing sketch that does this:
If I press the left mouse button, the rectangle gets zoomed in
If I press the right mouse button, it gets zoomed out
Here is the code:
int zoom = 1;
void setup()
{
size(240, 240);
background(204);
smooth();
rectMode(CENTER);
}
void draw()
{
if(mousePressed)
{
if(mouseButton == LEFT)
{
zoom += 0.01;
}
if(mouseButton == RIGHT)
{
zoom -= 0.01;
}
scale(zoom);
}
rect(width/2, height/2, 30, 30);
}
But when I run it, it only draws a white rectangle at the center and nothing happened when I click the left or right mouse button. Can anyone spot what's wrong with the code? I suspect there's something silly going on