Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ofApp::setup(){
- ofSetWindowShape(400,400);
- ofSetBackgroundColor(0);
- font.load("Arial", 16);
- }
- //--------------------------------------------------------------
- void ofApp::update(){
- bool polin = true;
- for (i = 0; i >= typedText.length() / 2; i++) {
- typedText[first] = 0 + i;
- typedText[last] = typedText.length() - i - 1;
- if (typedText[first] != typedText[last]) {
- polin = false;
- }
- }
- if (typedText[first] == typedText[last]) {
- polin = true;
- ofSetColor(0, 0, 0);
- }
- else {
- polin = false;
- ofSetColor(255, 0, 0);
- }
- }
- //--------------------------------------------------------------
- void ofApp::draw() {
- // for (plate = 0; plate <= typedText.length() - 1; plate++) {
- // std::tolower(plate);
- // };
- //Test Poli
- //actually writing stuff
- font.drawString(typedText+(ofGetFrameNum()/20%2==0 ? "_":""), 10,200);
- }
- //--------------------------------------------------------------
- void ofApp::keyPressed(int key){
- }
- //--------------------------------------------------------------
- void ofApp::keyReleased(int key){
- int l = typedText.length();
- switch(key) {
- case OF_KEY_BACKSPACE:
- typedText = typedText.substr(0, std::max(0,l)-1);
- break;
- case OF_KEY_TAB:
- typedText += " ";
- break;
- case OF_KEY_RETURN:
- typedText += "\n";
- break;
- case OF_KEY_ESC:
- case OF_KEY_DEL:
- case OF_KEY_LEFT_SHIFT:
- case OF_KEY_RIGHT_SHIFT:
- case OF_KEY_SHIFT:
- case OF_KEY_ALT:
- case OF_KEY_RIGHT:
- case OF_KEY_LEFT:
- case OF_KEY_UP:
- case OF_KEY_DOWN:
- break;
- default:
- typedText += key;
- }
- }
- //--------------------------------------------------------------
- void ofApp::mouseMoved(int x, int y ){
- }
- //--------------------------------------------------------------
- void ofApp::mouseDragged(int x, int y, int button){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement