Skip to content

Commit a28077a

Browse files
committed
adjusted code formatting to fit in better
1 parent d5a19b8 commit a28077a

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

core/src/processing/core/PApplet.java

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -470,27 +470,30 @@ public void onCreate(Bundle savedInstanceState) {
470470
//get renderer name anc class
471471
String renderer_name = sketchRenderer();
472472
Class<?> renderer_class = null;
473-
try{
474-
renderer_class = Class.forName( renderer_name);}
475-
catch( ClassNotFoundException exception){
473+
try {
474+
renderer_class = Class.forName(renderer_name);
475+
} catch (ClassNotFoundException exception) {
476476
//what to throw here?
477-
throw new RuntimeException(
478-
String.format(
479-
"Error: Could not resolve renderer class name: %s", renderer_name),
480-
exception);}
477+
String message = String.format(
478+
"Error: Could not resolve renderer class name: %s", renderer_name);
479+
throw new RuntimeException(message, exception);
480+
}
481481

482482
//java2d renderer
483-
if( renderer_name.equals( JAVA2D))
484-
surfaceView = new SketchSurfaceView( this, sw, sh);
483+
if (renderer_name.equals(JAVA2D)) {
484+
surfaceView = new SketchSurfaceView(this, sw, sh);
485+
}
485486
//P2D, P3D, and any other PGraphicsOpenGL-based renderer
486-
else if( PGraphicsOpenGL.class.isAssignableFrom( renderer_class))
487-
surfaceView = new SketchSurfaceViewGL( this, sw, sh,
487+
else if (PGraphicsOpenGL.class.isAssignableFrom(renderer_class)){
488+
surfaceView = new SketchSurfaceViewGL(this, sw, sh,
488489
(Class<? extends PGraphicsOpenGL>) renderer_class);
490+
}
489491
//anything else
490-
else throw new RuntimeException(
491-
String.format(
492-
"Error: Unsupported renderer class: %s",
493-
renderer_name));
492+
else {
493+
String message = String.format(
494+
"Error: Unsupported renderer class: %s", renderer_name)
495+
throw new RuntimeException(message);
496+
}
494497

495498
// g = ((SketchSurfaceView) surfaceView).getGraphics();
496499

@@ -829,22 +832,26 @@ public SketchSurfaceViewGL(
829832
// before surfaceChanged() is ever called.
830833

831834
//P2D
832-
if( renderer_class.equals( PGraphics2D.class))
835+
if (renderer_class.equals( PGraphics2D.class)) {
833836
g3 = new PGraphics2D();
837+
}
834838
//P3D
835-
else if( renderer_class.equals( PGraphics3D.class))
839+
else if (renderer_class.equals( PGraphics3D.class)) {
836840
g3 = new PGraphics3D();
837-
//something that extends P2D or P3D
838-
else
839-
try{
841+
}
842+
//something that extends P2D, P3D, or PGraphicsOpenGL
843+
else {
844+
try {
840845
//dang java generics
841846
Constructor<? extends PGraphicsOpenGL> constructor =
842847
renderer_class.getConstructor();
843-
g3 = constructor.newInstance();}
844-
catch( Exception exception){
848+
g3 = constructor.newInstance();
849+
} catch (Exception exception) {
845850
throw new RuntimeException(
846851
"Error: Failed to initialize custom OpenGL renderer",
847-
exception);}
852+
exception);
853+
}
854+
}
848855

849856

850857
//set it up

0 commit comments

Comments
 (0)