asdf
parent
0cc8babc19
commit
6ed1fdf427
|
|
@ -8,6 +8,10 @@ public class RectRenderer extends DiveScript{
|
|||
public Color color = null;
|
||||
public int width, height;
|
||||
|
||||
public void create() {
|
||||
name = "Rectangle Renderer";
|
||||
}
|
||||
|
||||
public void render(Graphics2D g) {
|
||||
g.setColor(color);
|
||||
g.fillRect((int)entity.x, (int)entity.y, width, height);
|
||||
|
|
|
|||
|
|
@ -106,9 +106,20 @@ public class SceneManager {
|
|||
continue;
|
||||
}
|
||||
} catch( ClassNotFoundException e) {
|
||||
try {
|
||||
Object maybeComponent = Class.forName("diveengine2d." + componentClass).newInstance();
|
||||
if(maybeComponent instanceof DiveScript) {
|
||||
component = (DiveScript)maybeComponent;
|
||||
}else {
|
||||
System.out.println("" + componentClass + " is not of type component!");
|
||||
continue;
|
||||
}
|
||||
} catch( ClassNotFoundException ex) {
|
||||
System.out.println("Component " + componentClass + " not found!");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
component.create();
|
||||
component.entity = (Entity) scopeObject.peek();
|
||||
((Entity)scopeObject.peek()).addComponent(component);
|
||||
scopeObject.push(component);
|
||||
|
|
|
|||
Loading…
Reference in New Issue