Difference between revisions of "QFunction"
From Digipool-Wiki
Line 35: | Line 35: | ||
</pre> | </pre> | ||
+ | |||
+ | <br> | ||
+ | |||
+ | == Check-Box Function == | ||
+ | |||
+ | Nutze diese Funktion um einen Text / eine Frage anzuzeigen. Der Text kann maximal aus drei Zeilen bestehn. | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | // x-Position, y-Position, Checkbox-Number, Text-1-Line, Text-3-Line | ||
+ | function cBox(cX, cY, cN, cT1, cT2){ | ||
+ | if( (mouseIsPressed)&&(mouseUp == 0) ){ | ||
+ | if( (mouseX>cX-150)&&(mouseX<cX+150)&&(mouseY>cY)&&(mouseY<cY+40) ){ | ||
+ | mouseUp = 1; | ||
+ | if(cList[cN] == 0){ | ||
+ | cList[cN] = 1; | ||
+ | }else{ | ||
+ | cList[cN] = 0; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | if(mouseIsPressed == false){ | ||
+ | mouseUp = 0; | ||
+ | } | ||
+ | |||
+ | // Text | ||
+ | fill(250); | ||
+ | rect(cX - 150, cY, 300, 40); | ||
+ | fill(10); | ||
+ | textAlign(LEFT); | ||
+ | textSize(18); | ||
+ | |||
+ | if(cT2 == ""){ | ||
+ | text(cT1, cX - 110, cY + 25); | ||
+ | }else{ | ||
+ | text(cT1, cX - 110, cY + 15); | ||
+ | text(cT2, cX - 110, cY + 34); | ||
+ | } | ||
+ | |||
+ | // Checkbox | ||
+ | ellipseMode(CENTER); | ||
+ | stroke(20); | ||
+ | strokeWeight(2); | ||
+ | noFill(); | ||
+ | ellipse(cX - 130, cY+20, 25, 25); | ||
+ | if(cList[cN] == 1){ | ||
+ | fill(20); | ||
+ | ellipse(cX - 130, cY+20, 15, 15); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | <br> |
Revision as of 11:42, 26 January 2018
Guestion Box Function
Nutze diese Funktion um einen Text / eine Frage anzuzeigen. Der Text kann maximal aus drei Zeilen bestehn.
// x-Position, y-Position, Guestion-Number, Text-1-Line, Text-3-Line, Text-3-Line function qBox(qX, qY, qN, qT1, qT2, qT3){ // Text fill(250); rect(qX - 150, qY, 300, 70); fill(10); textAlign(LEFT); textSize(20); if( (qT2 == "")&&(qT3 == "") ){ text(qT1, qX - 145, qY + 20); } if( (qT2 != "")&&(qT3 == "") ){ text(qT1, qX - 145, qY + 20); text(qT2, qX - 145, qY + 42); } if( (qT2 != "")&&(qT3 != "") ){ text(qT1, qX - 145, qY + 20); text(qT2, qX - 145, qY + 42); text(qT3, qX - 145, qY + 64); } }
Check-Box Function
Nutze diese Funktion um einen Text / eine Frage anzuzeigen. Der Text kann maximal aus drei Zeilen bestehn.
// x-Position, y-Position, Checkbox-Number, Text-1-Line, Text-3-Line function cBox(cX, cY, cN, cT1, cT2){ if( (mouseIsPressed)&&(mouseUp == 0) ){ if( (mouseX>cX-150)&&(mouseX<cX+150)&&(mouseY>cY)&&(mouseY<cY+40) ){ mouseUp = 1; if(cList[cN] == 0){ cList[cN] = 1; }else{ cList[cN] = 0; } } } if(mouseIsPressed == false){ mouseUp = 0; } // Text fill(250); rect(cX - 150, cY, 300, 40); fill(10); textAlign(LEFT); textSize(18); if(cT2 == ""){ text(cT1, cX - 110, cY + 25); }else{ text(cT1, cX - 110, cY + 15); text(cT2, cX - 110, cY + 34); } // Checkbox ellipseMode(CENTER); stroke(20); strokeWeight(2); noFill(); ellipse(cX - 130, cY+20, 25, 25); if(cList[cN] == 1){ fill(20); ellipse(cX - 130, cY+20, 15, 15); } }