mirror of
https://github.com/Astatin3/Code.org-Final-Projects.git
synced 2026-06-09 00:18:02 -06:00
Add code
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import org.code.theater.*;
|
||||
import org.code.media.*;
|
||||
|
||||
|
||||
// Utility function to make messing with code.org's libraries easier
|
||||
public class Renderer extends Scene {
|
||||
private Theater Theater;
|
||||
private final Image image;
|
||||
private final double delay = 0.5;
|
||||
|
||||
public final int width;
|
||||
public final int height;
|
||||
|
||||
public Renderer() {
|
||||
Theater = new Theater();
|
||||
width = getWidth();
|
||||
height = getHeight();
|
||||
image = new Image(width, height);
|
||||
}
|
||||
|
||||
public void refreshImage(){
|
||||
this.drawImage(image, 0, 0, width);
|
||||
pause(delay);
|
||||
}
|
||||
|
||||
public void setPixel(int x, int y, Color color){
|
||||
image.setPixel(x, y, color);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
System.out.println("Sending video to client...");
|
||||
Theater.playScenes(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user