@@ -425,6 +425,7 @@ static public class RendererChangeException extends RuntimeException { }
425425
426426
427427 /** Called with the activity is first created. */
428+ @ SuppressWarnings ("unchecked" )
428429 @ Override
429430 public void onCreate (Bundle savedInstanceState ) {
430431 super .onCreate (savedInstanceState );
@@ -467,31 +468,30 @@ public void onCreate(Bundle savedInstanceState) {
467468 int sw = sketchWidth ();
468469 int sh = sketchHeight ();
469470
470- //get renderer name anc class
471- String renderer_name = sketchRenderer ();
472- Class <?> renderer_class = null ;
471+ // Get renderer name and class
472+ String rendererName = sketchRenderer ();
473+ Class <?> rendererClass = null ;
473474 try {
474- renderer_class = Class .forName (renderer_name );
475+ rendererClass = Class .forName (rendererName );
475476 } catch (ClassNotFoundException exception ) {
476- //what to throw here?
477477 String message = String .format (
478- "Error: Could not resolve renderer class name: %s" , renderer_name );
478+ "Error: Could not resolve renderer class name: %s" , rendererName );
479479 throw new RuntimeException (message , exception );
480480 }
481481
482- //java2d renderer
483- if (renderer_name .equals (JAVA2D )) {
482+ // JAVA2D renderer
483+ if (rendererName .equals (JAVA2D )) {
484484 surfaceView = new SketchSurfaceView (this , sw , sh );
485485 }
486- //P2D, P3D, and any other PGraphicsOpenGL-based renderer
487- else if (PGraphicsOpenGL .class .isAssignableFrom (renderer_class )){
486+ // P2D, P3D, and any other PGraphicsOpenGL-based renderer
487+ else if (PGraphicsOpenGL .class .isAssignableFrom (rendererClass )){
488488 surfaceView = new SketchSurfaceViewGL (this , sw , sh ,
489- (Class <? extends PGraphicsOpenGL >) renderer_class );
489+ (Class <? extends PGraphicsOpenGL >) rendererClass );
490490 }
491- //anything else
491+ // Anything else
492492 else {
493493 String message = String .format (
494- "Error: Unsupported renderer class: %s" , renderer_name )
494+ "Error: Unsupported renderer class: %s" , rendererName );
495495 throw new RuntimeException (message );
496496 }
497497
@@ -809,7 +809,7 @@ public class SketchSurfaceViewGL extends GLSurfaceView /*implements SketchSurfac
809809
810810 public SketchSurfaceViewGL (
811811 Context context , int wide , int high ,
812- Class <? extends PGraphicsOpenGL > renderer_class ){
812+ Class <? extends PGraphicsOpenGL > clazz ){
813813 super (context );
814814
815815 // Check if the system supports OpenGL ES 2.0.
@@ -832,19 +832,19 @@ public SketchSurfaceViewGL(
832832 // before surfaceChanged() is ever called.
833833
834834 //P2D
835- if (renderer_class .equals ( PGraphics2D .class )) {
835+ if (clazz .equals (PGraphics2D .class )) {
836836 g3 = new PGraphics2D ();
837837 }
838838 //P3D
839- else if (renderer_class .equals ( PGraphics3D .class )) {
839+ else if (clazz .equals (PGraphics3D .class )) {
840840 g3 = new PGraphics3D ();
841841 }
842842 //something that extends P2D, P3D, or PGraphicsOpenGL
843843 else {
844844 try {
845845 //dang java generics
846846 Constructor <? extends PGraphicsOpenGL > constructor =
847- renderer_class .getConstructor ();
847+ clazz .getConstructor ();
848848 g3 = constructor .newInstance ();
849849 } catch (Exception exception ) {
850850 throw new RuntimeException (
0 commit comments