Say I'm in a while loop doing something. I want processing to update it's keyboard and mouse status, and possibly update the drawing too while I'm in the loop. Is there any method that processing uses to update itself? I want to be able to call that method from within a loop. The reason I want to do this, is so that I can have something looping until a key is pressed, using something like while(key != 'A'); But the keyboard won't update on its own accord. I want it to look more like this:
while(key != 'A')
{
updateKeyboard();
}
But what is the name of this updateKeyboard() method? How will I implement it if it isn't already there?
Okay, I am building this game, and it works just fine inside the PDE. However, whenever I export it as anything- an applet, any kind of application, it fails. I get nothing but a blank, white window. The console prints out this:
Exception in thread "Animation Thread" java.lang.NullPointerException
at Game$Sprite.<init>(Game.java:123)
at Game.setup(Game.java:28)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
But only from outside the PDE do I get this message. I know it isn't a security issue, because I signed the JAR, and the error also happens in applications. What could be the problem? I don't think it has anything to do with my programming, because it runs fine from within the PDE. I also noticed that when exporting, I get this error in the PDE console:
Could not copy source file: /tmp/Game1804938955307683740temp/Game.java
Could not copy source file: /tmp/Game1804938955307683740temp/Game.java
I am looking into making a small RPG (oxymoronic, I know), using processing. It seems to have the capabilities, and I really like the interface and the ease of programming. I am at a point in my game creation where I need some kind of textbox like the ones used in RPG's. These are formatted text boxes that display one character at a time, as if it were being typed. I also came across the text(String, int, int, int, int) method for text-box formatting. However, this cannot be used for individual characters one at a time. I want to know, is there any way I can use this method to format text into a text box, but actually draw the characters one at a time? Or, if there isn't an easy way out, what is the logic behind text formatting? What is happening to each character behind the scenes? I may have to format the text myself, and then loop through the string, drawing each character at its appropriate place. But how would I determine where to draw the character?
TL;DR
I want to make a text box that draws one character at a time.
1.) Is there any way I can use the text() method to format the text but only draw one character at a time?
2.) If not, how do I format the characters myself?