asdf
parent
0cc8babc19
commit
6ed1fdf427
|
|
@ -8,6 +8,10 @@ public class RectRenderer extends DiveScript{
|
||||||
public Color color = null;
|
public Color color = null;
|
||||||
public int width, height;
|
public int width, height;
|
||||||
|
|
||||||
|
public void create() {
|
||||||
|
name = "Rectangle Renderer";
|
||||||
|
}
|
||||||
|
|
||||||
public void render(Graphics2D g) {
|
public void render(Graphics2D g) {
|
||||||
g.setColor(color);
|
g.setColor(color);
|
||||||
g.fillRect((int)entity.x, (int)entity.y, width, height);
|
g.fillRect((int)entity.x, (int)entity.y, width, height);
|
||||||
|
|
|
||||||
|
|
@ -105,10 +105,21 @@ public class SceneManager {
|
||||||
System.out.println("" + componentClass + " is not of type component!");
|
System.out.println("" + componentClass + " is not of type component!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} catch( ClassNotFoundException e ) {
|
} catch( ClassNotFoundException e) {
|
||||||
System.out.println("Component " + componentClass + " not found!");
|
try {
|
||||||
continue;
|
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();
|
component.entity = (Entity) scopeObject.peek();
|
||||||
((Entity)scopeObject.peek()).addComponent(component);
|
((Entity)scopeObject.peek()).addComponent(component);
|
||||||
scopeObject.push(component);
|
scopeObject.push(component);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue