Re: keyReleased keyPressed problem
Posted by
elect on
Oct 16, 2014; 2:55pm
URL: https://forum.jogamp.org/keyReleased-keyPressed-problem-tp4033288p4033388.html
I am reading this page
http://jogamp.org/jogl/doc/NEWT-Overview.htmlAt the end it says: " The following example shows you how to use a fifo to pipe events from the EDT (listener) to the rendering loop. "
And in the TestParenting02NEWT.java, I see a while loop
159 while (duration>0 && !shouldQuit) {
160 glWindow1.display();
161 glWindow2.display();
162 duration -= step;
163 x += 1;
164 y += 1;
165 // glWindow1.setPosition(x,y);
166 glWindow2.setPosition(glWindow1.getWidth()/2,glWindow1.getHeight()/2-y);
167 Thread.sleep(step);
168
169 while( null != ( event = eventFifo.get() ) ) {
170 final Window source = (Window) event.getSource();
171 if(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY == event.getEventType()) {
172 shouldQuit = true;
173 } else if(event instanceof KeyEvent) {
174 final KeyEvent keyEvent = (KeyEvent) event;
175 switch(keyEvent.getKeyChar()) {
176 case 'q':
177 shouldQuit = true;
178 break;
179 case 'f':
180 source.setFullscreen(!source.isFullscreen());
181 break;
182 }
183 }
184 }
185 }Which is the difference between this and a keyListener?