I have problem with text(); help me someone

edited February 2018 in Questions about Code

first hallo and sorry if posted in wrong place but little confused where to post...

text function not working(working but very bed and strange)..so what I mean...

here simple code:

void setup() {
  size(200, 200);
  background(0);
}
void draw() {
  text("It's Working",70,100);
}

problem is time, for this code to run its need about 2 minute and processor killing himself...after that finally text appears.. I do not know its Bug or something like that but on my machine its not working well, if someone knows wha tis this and how to solve it please tell me

// Intel Quad Core 2.5Ghz, Windows 8
// Processing 2.1.1

here is test on "hallo precessing" page and its working quick and good and second image is my machine and this is what is looks like before draw text

I have this problem only on text(); at this time....

working notworking

Tagged:

Answers

  • Few suggestions here. You can use smooth() in setup() or for text() you should use a font, this will make things look nice on screen. processing.org/reference/PFont.html. Second the function draw() is a looping function, meaning that whatever you enter inside it will repeat with a certain frame rate. text() also repeats itself over and over at the same position. You need to use background(0) before text() in draw(). Also the text color by default is white you can use fill() to change that. The best way to learn is getting some good examples like learningprocessing.com/examples/ and a book. And also to view at the processing reference page processing.org/reference/

    Happy coding

  • edited March 2014

    I already tray PFont but same...text color is default white and I have background black, also I need BG in Setup and Text in Draw...I cant understand why is this problem for my machine...its running smoothly complex codes and this small text has problem, cant get...another try on other PC i3 3.3GHz Windows 7 and its working good...about 2 sec need to run............................. also one thing, I was trying tipe some text on my little game and it seems to never will run after I add text(); in my code. Processing lagging and processor going crazy but nothing happening.....

  • Which means you have a software problem with your PC. Try to reinstall/update your java version, and download/extract processing 2.1.1 again.

  • edited March 2014
    void setup() {
      size(200, 200);
      background(0);
    }
    void draw() {
      text("It's Working",70,100);
      println(millis());
      noLoop();
    }
    

    the above gives me about 400ms. which isn't great for something so simple. dual core laptop, 3.5 years old now... mint linux 13, processing 1.5.1, openjdk 1.12.6

  • edited March 2014

    As i said update if you can. Version 1.5.1 is 3 years old. Also there is java version 7 already. I haven't worked with processing on linux before. The millis is the time passed since the sketch is stared. noLoop() will only display one frame.

  • edited March 2014

    Processing v1.5.1 runs very well in Java 7! [-(
    Merely rename/delete bundled "/java" subfolder! O:-)

  • edited March 2014

    SilentAce did but same

    koogs your code giving me same result

    maybe my Windows need refresh, but I'm not sure

  • *Solution: I moved background(0); in to void draw(){} and everything is smooth and quick now...

Sign In or Register to comment.