Build a water level GUI.

edited November 2016 in How To...

Hi guys, I would like to know if someone of you knows how to create a level monitoring GUI, without using the void draw(). I need to avoid to use it because I have a problem integrating it to my system. Thanks and best regards! -xkapono

Tagged:

Answers

  • Can you provide more info about what is your specific problem with draw?

  • http://pastebin.com/L9UdbWH8

    Here is my code. I hope you understand why..

  • Is your image bg the same size as the sketch window?

  • Anyway, you can't get rid of draw if you want to draw stuff to the window. Maybe PM Chrisir or someone else with indepth knowledge.

  • If you want to avoid draw, I think it wpuld be best to just use write in Java and use eclipse or something.

    But if you want to use processing, you need to use draw if you want the software run continually. I guess you could use one mousePressed() or keyPressed() or something like that to avoid draw(), but then you programming would only run at specific events.

    If you can explain the problem you have with draw, it will possible to find a solution.

  • edited November 2016

    What error pops up when you run the code? Could you post that too?

  • You could stop draw execution by calling noLoop() in either in setup() or draw(). Then you can call redraw() everytime you want to execute draw():

    https://processing.org/reference/redraw_.html

    I believe there is another way you can run processing. it is the static mode (I believe that is how it is called) where you don't code neither setup() nor draw(). Your code will execute once. However I am not sure if this is what you want to do at the end since you are using controlP5. I will think you need draw() to interact with those elements.

    Can you comment and be more specific when you say in your initial post:

    I have a problem integrating it to my system

    Kf

  • @kfrajer If I'm right, static mode just puts your code into setup, though I may be wrong.

  • the problem is that my background(bg) gets above the drawn water level..

  • I'm not sure I understand...

  • Please post your code or a small sample demonstrating your problem.

    Kf

Sign In or Register to comment.