Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated and Fixed Reflections Library #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.11</version>
<version>0.9.12</version>
</dependency>
<dependency>
<groupId>controlP5</groupId>
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/jto/processing/sketch/mapper/SketchMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

public class SketchMapper {

private static final int INITIAL_SURFACE_RESOLUTION = 6;
private static final String PREFIX = "";

private final PApplet parent;
private final Reflections reflections;
private int initialSurfaceResolution = 6;
private int mostRecentSurface = 0;
// SurfaceMapper variables
private PGraphics graphicsOffScreen;
Expand All @@ -35,7 +36,6 @@ public class SketchMapper {
private PImage backgroundImage;
private String layoutFilename;
private boolean firstDraw = true;
private ControlWindow controlWindow;

/**
* Constructor for SketchMapper objects.
Expand Down Expand Up @@ -63,8 +63,6 @@ public SketchMapper(final PApplet parent, final String filename) {
try {
this.parent = parent;

reflections = new Reflections();

//register our handler methods in this object on our parent.
parent.registerMethod("mouseEvent", this);
parent.registerMethod("keyEvent", this);
Expand All @@ -77,7 +75,7 @@ public SketchMapper(final PApplet parent, final String filename) {
surfaceMapper.setDisableSelectionTool(true);

// Initialize custom menus
controlWindow = new ControlWindow(parent, parent.width, parent.height, surfaceMapper, this);
ControlWindow controlWindow = new ControlWindow(parent, parent.width, parent.height, surfaceMapper, this);
quadOptions = controlWindow.getQuadOptions();
bezierOptions = controlWindow.getBezierOptions();
programOptions = controlWindow.getProgramOptions();
Expand Down Expand Up @@ -145,7 +143,7 @@ public void draw() {
surfaceMapper.load(parent.dataFile(layoutFilename));
} else {
// Creates one surface at center of screen
surfaceMapper.createQuadSurface(initialSurfaceResolution, parent.width / 2, parent.height / 2);
surfaceMapper.createQuadSurface(INITIAL_SURFACE_RESOLUTION, parent.width / 2, parent.height / 2);
}

// add sketches to surfaces, if not set
Expand Down Expand Up @@ -316,7 +314,8 @@ public void mouseEvent(MouseEvent event) {
}

private void registerClasspathSketches() {
final Set<Class<? extends AbstractSketch>> sketchTypes = reflections.getSubTypesOf(AbstractSketch.class);
Reflections reflections = new Reflections(PREFIX);
Set<Class<? extends AbstractSketch>> sketchTypes = reflections.getSubTypesOf(AbstractSketch.class);
if (null == sketchTypes || sketchTypes.isEmpty()) {
return;
}
Expand Down