試著打出文字來ㄜ!
畫框框然後讓字出現在框框左上角
size(300,300);
rect(30,100,200,100);
fill(255,0,0);//用fill填色,84stroke
textSize(30);
textAlign(LEFT,TOP);
text("TRIGGER",30,100);
———————————————————————————————————————
顯示中文字!
———————————————————————————————————————
size(500,500);
fill(100,55,255);
//("字體名稱",字體大小)
PFont font1 = createFont("Times New Roman",40);
textFont(font1); //("想打ㄉ文字",x,y)
text("中文下ㄑ辣! GoodGood!",30,50);
PFont font2 = createFont("細明體",40);
textFont(font2);
text("中文下ㄑ辣! GoodGood!",30,120);
———————————————————————————————————————
練習陣列! //0,1,2 x軸
int [][]A={{1,1,1}, //0 y軸
{2,0,2}, //1
{0,2,0}, //2
{1,1,1} }; //3
PImage fox, rabbit;
void mousePressed(){
int i= int(mouseY/100);
int j= int(mouseX/100);
if(A[i][j]==2) A[i][j]=0;
else if(A[i][j]==0) A[i][j]=1;
else if(A[i][j]==1) A[i][j]=2;
}
void setup(){
size(300,400);
fox=loadImage("fox.png");
rabbit=loadImage("rabbit.png");
}
void draw(){
background(200);
for(int i=0; i<4; i++){//左
for(int j=0; j<3; j++){//右
if(A[i][j]==1) image(fox, j*100,i*100,100,100);//[y][x]
if(A[i][j]==2) image(rabbit, j*100,i*100,100,100);
}
}
ellipse(mouseX,mouseY,20,20);
text("mouseX: "+mouseX+" mouseY:"+mouseY,30,30);
}
———————————————————————————————————————





沒有留言:
張貼留言