how do i make my screen size smaller and how do i combine the fuel gauge with speedometer and temperature with tachometer. plus how do i make them work independently with each other and how to add auto door to simulate in the car dashboard?
PImage img,img2;
int R1=250, R2=200, R3 =150, R4 = 150, R5=130;
int angle1=0, angle2=0, angle3=180,angle4=360,angle5=180,angle6=180;
int zero_offset=130;
void setup()
{
size(1500, 1000);
background(0);
img = loadImage("fuel.png");
img2 = loadImage("temperature.png");
}
void draw()
{
pushMatrix();
translate(450,300);
fill(0);
strokeWeight(5);
stroke(47,212,199);
circle(0,0, 2*R1); //circle 1
for(int x=0; x<280; x=x+20)
{
if (x % 20 == 0)
{
float radi = radians(x+zero_offset);
line(cos(radi)*R1, sin(radi)*R1, cos(radi)*R1*0.9, sin(radi)*R1*0.9);
}
}
fill(0);
strokeWeight(2);
noStroke();
circle(0,0,2*R2);
fill(255);
textAlign(CENTER,CENTER);
textSize(24);
int t=0;
for(int i=0; i<280; i=i+20)
{
if (i % 20 == 0)
{
float radi = radians(i+zero_offset);
text(t,cos(radi)*(R2),sin(radi)*(R2));
t=t+10;
}
}
textAlign(CENTER); //km/h
textSize(30);
fill(48,213,240);
text("km/h",10,-80);
fill(255); // Circle in middle
strokeWeight(5);
stroke(48,213,240);
rotate (radians(angle1+zero_offset));
line(0,0,180,0);
line(180,0,170,10);
line(180,0,170,-10);
strokeWeight(10);
circle(0,0,30);
popMatrix();
pushMatrix(); //Circle 2
translate(1050, 300);
fill(0);
strokeWeight(5);
stroke(48,213,200);
circle(0, 0, 2*R1);
for (int x=0; x<280; x=x+20) {
if (x % 20 == 0) {
float radi = radians(x+zero_offset);
line(cos(radi)*R1, sin(radi)*R1, cos(radi)*R1*0.9, sin(radi)*R1*0.9);
if (x >180)
{
stroke(255,0,0);
}
}
}
fill(0);
strokeWeight(1);
noStroke();
circle(0,0,2*R2);
fill(255);
textAlign(CENTER,CENTER);
textSize(24);
int t1=0;
for(int i=0; i<280; i=i+20)
{
if (i % 20 == 0)
{
float radi = radians(i+zero_offset);
text((t1/10),cos(radi)*(R2),sin(radi)*(R2));
t1=t1+10;
if (t1 > 100)
{
fill(255,0,0);
}
}
}
textAlign(CENTER); //km/h
textSize(30);
fill(48,213,240);
text("x1000 RPM",10,-80);
fill(48,213,240);
strokeWeight(5);
stroke(48,213,240);
rotate (radians(angle2+zero_offset));
line(180,0,170,10);
line(0,0,180,0);
line(180,0,170,-10);
fill(255);
strokeWeight(10);
circle(0,0,30);
popMatrix();
pushMatrix(); //Fuel Gauge
translate(250,700);
fill(0);
strokeWeight(5);
stroke(48,213,200);
circle(0, 0, 2*R3);
image(img, -45, 40, width/15, height/12);
arc(0, 0, 2*R5, 2*R5, radians(angle3), radians(angle4));
fill(0,0);
textAlign(CENTER);
textSize(20);
fill(255,0,0);
text("E", 225*cos(radians(240)), 225*sin(radians(175)));
fill(255,255,0);
text("1/2", 225*cos(radians(270)), 225*sin(radians(210)));
fill(0,255,0);
text("F", 225*cos(radians(60)), 225*sin(radians(5)));
rotate(radians(angle5));
stroke(48,213,240);
strokeWeight(5);
line(0,0,100,0);
popMatrix();
pushMatrix(); //Temperature
translate(1250,700);
fill(0);
strokeWeight(5);
stroke(48,213,200);
circle(0, 0, 2*R3);
image(img2, -45, 40, width/16, height/14);
arc(0, 0, 2*R5, 2*R5, radians(angle3), radians(angle4));
textAlign(CENTER);
textSize(20);
fill(48,213,240);
text("C", 225*cos(radians(240)), 225*sin(radians(175)));
fill(255,0,0);
text("H", 225*cos(radians(60)), 225*sin(radians(5)));
rotate(radians(angle6));
stroke(48,213,240);
strokeWeight(5);
line(0,0,100,0);
popMatrix();
}
void keyPressed() {
if (key=='a')angle5=angle5+10;
if(angle5>360) angle5=360;
if (key=='s')angle1=angle1+20;
if(angle1>260) angle1=260;
if(key=='d') angle2=angle2+10;
if(angle2>260)angle2=260;
if(key=='f') angle6=angle6+20;
if(angle6>360) angle6=360;
}