Skip to content

Instantly share code, notes, and snippets.

@nappa7878
Created December 21, 2012 05:23
Show Gist options
  • Select an option

  • Save nappa7878/4350843 to your computer and use it in GitHub Desktop.

Select an option

Save nappa7878/4350843 to your computer and use it in GitHub Desktop.
小学校算数 九九 自動作成した問題をマウスクリックで連続表示
// **********************************************
// 自動作成したな問題を
// マウスクリックで連続表示
//
// **********************************************
//フォントを準備する
PFont font = createFont("FFScale",32);
//問題設定
String[] Qstr = new String[9];
//表示している問題番号
int Qcount = 0;
void setup(){
size(640,480);
colorMode(RGB,255);
MakeQuestion();
}
void draw(){
Question();
//ループを止める
noLoop();
}
void MakeQuestion(){
for(int i=0;i<9;i++){
Qstr[i] = "2" + "×" + (i+1);
}
}
void Question(){
background(255,255,255);
fill(0,0,0);
textFont(font,250);
textAlign(CENTER,CENTER);
text( Qstr[Qcount] ,width/2,height/2);
}
void mousePressed(){
//ループを始める
loop();
Qcount++;
if(Qcount>Qstr.length-1){
Qcount = 0;
}
}
void keyPressed(){
loop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment