Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. void ofApp::setup(){
  2. ofSetWindowShape(400,400);
  3. ofSetBackgroundColor(0);
  4.  
  5. font.load("Arial", 16);
  6.  
  7.  
  8. }
  9.  
  10. //--------------------------------------------------------------
  11. void ofApp::update(){
  12. bool polin = true;
  13.  
  14. for (i = 0; i >= typedText.length() / 2; i++) {
  15. typedText[first] = 0 + i;
  16. typedText[last] = typedText.length() - i - 1;
  17. if (typedText[first] != typedText[last]) {
  18. polin = false;
  19. }
  20. }
  21.  
  22. if (typedText[first] == typedText[last]) {
  23. polin = true;
  24. ofSetColor(0, 0, 0);
  25. }
  26. else {
  27. polin = false;
  28. ofSetColor(255, 0, 0);
  29. }
  30. }
  31.  
  32. //--------------------------------------------------------------
  33. void ofApp::draw() {
  34.  
  35. // for (plate = 0; plate <= typedText.length() - 1; plate++) {
  36. // std::tolower(plate);
  37. // };
  38.  
  39. //Test Poli
  40.  
  41.  
  42.  
  43.  
  44.  
  45. //actually writing stuff
  46.  
  47. font.drawString(typedText+(ofGetFrameNum()/20%2==0 ? "_":""), 10,200);
  48. }
  49.  
  50. //--------------------------------------------------------------
  51. void ofApp::keyPressed(int key){
  52.  
  53. }
  54.  
  55. //--------------------------------------------------------------
  56. void ofApp::keyReleased(int key){
  57. int l = typedText.length();
  58. switch(key) {
  59. case OF_KEY_BACKSPACE:
  60. typedText = typedText.substr(0, std::max(0,l)-1);
  61. break;
  62. case OF_KEY_TAB:
  63. typedText += " ";
  64. break;
  65. case OF_KEY_RETURN:
  66. typedText += "\n";
  67. break;
  68. case OF_KEY_ESC:
  69. case OF_KEY_DEL:
  70. case OF_KEY_LEFT_SHIFT:
  71. case OF_KEY_RIGHT_SHIFT:
  72. case OF_KEY_SHIFT:
  73. case OF_KEY_ALT:
  74. case OF_KEY_RIGHT:
  75. case OF_KEY_LEFT:
  76. case OF_KEY_UP:
  77. case OF_KEY_DOWN:
  78. break;
  79. default:
  80. typedText += key;
  81. }
  82. }
  83.  
  84. //--------------------------------------------------------------
  85. void ofApp::mouseMoved(int x, int y ){
  86.  
  87. }
  88.  
  89. //--------------------------------------------------------------
  90. void ofApp::mouseDragged(int x, int y, int button){
  91.  
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement