66import java .awt .GraphicsConfiguration ;
77import java .awt .GraphicsDevice ;
88import java .awt .GraphicsEnvironment ;
9- import java .awt .Point ;
109import java .awt .Rectangle ;
1110import java .awt .geom .Rectangle2D ;
1211import java .awt .image .BufferedImage ;
@@ -88,7 +87,6 @@ public Canvas initCanvas(PApplet sketch) {
8887 Display .setParent (canvas );
8988 return canvas ;
9089 } catch (LWJGLException e ) {
91- // TODO Auto-generated catch block
9290 e .printStackTrace ();
9391 }
9492 return null ;
@@ -112,12 +110,8 @@ public Frame initFrame(PApplet sketch, Color backgroundColor,
112110 PApplet .println (mode );
113111 }
114112 } catch (LWJGLException e ) {
115- // TODO Auto-generated catch block
116113 e .printStackTrace ();
117114 }
118-
119-
120-
121115
122116 if (deviceIndex >= 0 ) { // if -1, use the default device
123117 GraphicsDevice [] devices = environment .getScreenDevices ();
@@ -339,12 +333,10 @@ public void setSmooth(int level) {
339333 @ Override
340334 public void setFrameRate (float fps ) {
341335 frameRateTarget = fps ;
342- // frameRatePeriod = (long) (1000000000.0 / frameRateTarget);
343336 if (60 < fps ) {
344337 // Disables v-sync
345338 System .err .println ("Disabling VSync" );
346339 Display .setVSyncEnabled (false );
347- // Display.sync((int)fps);
348340 } else {
349341 Display .setVSyncEnabled (true );
350342 }
@@ -353,39 +345,20 @@ public void setFrameRate(float fps) {
353345
354346 @ Override
355347 public void requestFocus () {
356- // TODO Auto-generated method stub
348+ // seems there is no way of request focus on the LWJGL Display, unless
349+ // it is parented inside a Canvas:
350+ // http://www.java-gaming.org/index.php?topic=31158.0
357351 }
358352
359353
360354 @ Override
361355 public void blit () {
362- // TODO Auto-generated method stub
363-
356+ Display .update (); // maybe this ??
364357 }
365358
366359 @ Override
367360 public void setCursor (int kind ) {
368361 System .err .println ("Sorry, cursor types not supported in OpenGL, provide your cursor image" );
369- // TODO Auto-generated method stub
370- // if (PApplet.platform == PConstants.MACOSX && kind == PConstants.MOVE) {
371- // kind = PConstants.HAND;
372- // }
373- //
374- // java.awt.Cursor cursor0 = java.awt.Cursor.getPredefinedCursor(kind);
375-
376-
377- // Cursor cursor1 = Cursor(cursor0.,
378- // int height,
379- // int xHotspot,
380- // int yHotspot,
381- // int numImages,
382- // java.nio.IntBuffer images,
383- // java.nio.IntBuffer delays);
384-
385-
386- // Mouse.setNativeCursor(cursor1);
387- // cursorVisible = true;
388- // this.cursorType = kind;
389362 }
390363
391364 @ Override
@@ -399,22 +372,17 @@ public void setCursor(PImage image, int hotspotX, int hotspotY) {
399372 Mouse .setNativeCursor (currentCursor );
400373 cursorVisible = true ;
401374 } catch (LWJGLException e ) {
402- // TODO Auto-generated catch block
403375 e .printStackTrace ();
404376 }
405377 }
406378
407379 @ Override
408380 public void showCursor () {
409381 if (!cursorVisible ) {
410- // setCursor(cursorType);
411- // cursorVisible = true;
412- // Mouse.setCursor(Cursor.getPredefinedCursor(cursorType));
413382 try {
414383 Mouse .setNativeCursor (currentCursor );
415384 cursorVisible = true ;
416385 } catch (LWJGLException e ) {
417- // TODO Auto-generated catch block
418386 e .printStackTrace ();
419387 }
420388 }
@@ -426,15 +394,13 @@ public void hideCursor() {
426394 try {
427395 invisibleCursor = new Cursor (1 , 1 , 0 , 0 , 1 , BufferUtils .createIntBuffer (1 ), null );
428396 } catch (LWJGLException e1 ) {
429- // TODO Auto-generated catch block
430397 e1 .printStackTrace ();
431398 }
432399 }
433400 try {
434401 Mouse .setNativeCursor (invisibleCursor );
435402 cursorVisible = false ;
436403 } catch (LWJGLException e ) {
437- // TODO Auto-generated catch block
438404 e .printStackTrace ();
439405 }
440406 }
@@ -632,7 +598,6 @@ protected class KeyPoller extends Thread {
632598 try {
633599 Keyboard .create ();
634600 } catch (LWJGLException e ) {
635- // TODO Auto-generated catch block
636601 e .printStackTrace ();
637602 }
638603 }
@@ -728,9 +693,7 @@ protected class MousePoller extends Thread {
728693 stopRequested = false ;
729694 try {
730695 Mouse .create ();
731- // Mouse.setNativeCursor(null);
732696 } catch (LWJGLException e ) {
733- // TODO Auto-generated catch block
734697 e .printStackTrace ();
735698 }
736699 }
0 commit comments