Computer Science Canada Firing off events without user input |
Author: | zuber [ Tue May 27, 2008 8:10 am ] | ||
Post subject: | Firing off events without user input | ||
I was looking into making an RPG template for later use, and I stumbled (rather by accident ) upon what I thought was an interesting way to avoid the whole flickering screen problem. Essentially what I'm doing is writing the program as an applet with bits of JFrame in it: (Note that this was edited slightly to be useable by people without my pictures)
Now thus far it all works fairly well, the collision/input/movement all work as intended. My problem is that if I want to put other things onto the screen I need to wait for user input, which is a pain. What I want to know is whether or not I can put in some code to fire off an event (which triggers the redrawing of the screen) without any sort of user input (So no keylistenner,mouselistener etc. and timers are impractical for what I'm trying to do, due to the ideally dynamic nature of the motion that will be on-screen). So, can an event be fired without using a timer or human input? |
Author: | Reality Check [ Tue May 27, 2008 8:15 pm ] |
Post subject: | Re: Firing off events without user input |
Hey zuber we don't have to do an RPG anymore. He wants us to do something simpler. If you want to do the RPG for personal fulfillment go ahead but you know Cuyugan, you'll probably get 100 no matter what you hand in. But anyways, what Mike and I did was fire off dummy events through method calls that did nothing. I'm sure there are better ways to do it though. |
Author: | shadowman544 [ Tue May 27, 2008 8:28 pm ] |
Post subject: | Re: Firing off events without user input |
i think that last post would be better suited for a pm rather than posting as an answer to a question |
Author: | zuber [ Wed May 28, 2008 7:51 am ] |
Post subject: | Re: Firing off events without user input |
Forget a PM, he could have just told me yesterday in class, or today... in the same time it took him to tell me that he had responded to my topic =/ Assuming this works I guess I won't have to reach across the table to smack you ![]() |
Author: | Reality Check [ Wed May 28, 2008 7:55 am ] |
Post subject: | Re: Firing off events without user input |
It's how I roll ![]() |
Author: | shadowman544 [ Wed May 28, 2008 5:53 pm ] |
Post subject: | RE:Firing off events without user input |
lol ok |
Author: | Nick [ Wed May 28, 2008 6:00 pm ] |
Post subject: | Re: Firing off events without user input |
zuber @ Tue May 27, 2008 8:10 am wrote: way to avoid the whole flickering screen problem.
Just double buffer |
Author: | shadowman544 [ Wed May 28, 2008 7:00 pm ] |
Post subject: | RE:Firing off events without user input |
greesy I think you should explain that more |
Author: | Nick [ Wed May 28, 2008 8:41 pm ] |
Post subject: | RE:Firing off events without user input |
well the flickering occurs when indvidually drawing each object onto the screen, double buffering is basacally drawing everything off the screen, then moving it all onto the screen at once |
Author: | shadowman544 [ Mon Jun 02, 2008 8:26 am ] |
Post subject: | Re: Firing off events without user input |
thank you, a code example would have been nice bot thank you. by your definition can we assume that this is like the view. update in turing. |
Author: | Hendo [ Sat Jun 07, 2008 5:21 pm ] | ||||
Post subject: | Re: Firing off events without user input | ||||
I do flicker free animation using offscreen graphics. Something like in your method where you draw everything have
Just make sure to make a new image variable like so
|