Skip to content

Commit

Permalink
Examples Update
Browse files Browse the repository at this point in the history
  • Loading branch information
vicvalentim committed Oct 25, 2024
1 parent c0aea7e commit 66de9bc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 31 deletions.
4 changes: 0 additions & 4 deletions examples/Basic/Basic.pde
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@ class Scene1 implements Scene {
this.parent = parent;
}

@Override
public void setupScene() {
// Specific scene setup, if necessary
println("Scene1 setup completed.");
}

@Override
public void sceneRender(PGraphics pg) {
pg.pushMatrix();
pg.background(0, 0, 80, 0);
Expand All @@ -86,13 +84,11 @@ class Scene1 implements Scene {
pg.popMatrix();
}

@Override
public void keyPressed(char key) {
// Implement key response logic, if necessary
println("Key pressed in Scene1: " + key);
}

@Override
public void mouseEvent(MouseEvent event) {
// Implement mouse event logic, if necessary
println("Mouse event in Scene1: " + event.getX() + ", " + event.getY() + ", button: " + event.getButton());
Expand Down
22 changes: 4 additions & 18 deletions examples/ChangeScene/ChangeScene.pde
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ void keyPressed() {
// Forward mouse events to the library
void mouseEvent(processing.event.MouseEvent event) {
ziviDome.mouseEvent(event);
// Optionally call mouseEvent of the current scene
if (currentScene != null) {
currentScene.mouseEvent(event.getX(), event.getY(), event.getButton());
currentScene.mouseEvent(event);
}
}

Expand All @@ -64,13 +65,11 @@ class Scene1 implements Scene {
this.parent = parent;
}


public void setupScene() {
// Specific scene setup, if necessary
println("Scene1 setup completed.");
}


public void sceneRender(PGraphics pg) {
pg.ambientLight(128, 128, 128); // Add ambient light
pg.pushMatrix();
Expand All @@ -95,24 +94,16 @@ class Scene1 implements Scene {
pg.popMatrix();
}


public void keyPressed(char key) {
// Implement key response logic, if necessary
println("Key pressed in Scene1: " + key);
}


public void mouseEvent(int mouseX, int mouseY, int button) {
public void mouseEvent(MouseEvent event) {
// Implement mouse event logic, if necessary
println("Mouse event in Scene1: " + mouseX + ", " + mouseY + ", button: " + button);
}
}

// Forward control events to the library
void controlEvent(controlP5.ControlEvent theEvent) {
ziviDome.controlEvent(theEvent);
}

// Implementation of Scene2 that uses the Scene interface
class Scene2 implements Scene {
zividomelive parent;
Expand All @@ -121,12 +112,10 @@ class Scene2 implements Scene {
this.parent = parent;
}


public void setupScene() {
// Specific scene settings, if necessary
}


public void sceneRender(PGraphics pg) {
pg.pushMatrix();
pg.background(25, 25, 112);
Expand All @@ -137,15 +126,12 @@ class Scene2 implements Scene {
pg.popMatrix();
}


public void keyPressed(char key) {
// Implement key response logic, if necessary
}


public void mouseEvent(int mouseX, int mouseY, int button) {
public void mouseEvent(MouseEvent event) {
// Implement mouse event logic, if necessary
println("Mouse event in Scene2: " + mouseX + ", " + mouseY + ", button: " + button);
}

void drawLabeledBox(PGraphics pg, float size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ class Scene1 implements Scene {
this.parent = parent;
}

@Override

public void setupScene() {
// Specific scene setup, if necessary
}

@Override

public void sceneRender(PGraphics pg) {
// Scene rendering logic
}

@Override

public void keyPressed(char key) {
// Key response logic
}

@Override

public void mouseEvent(MouseEvent event) {
// Mouse event logic
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void controlEvent(controlP5.ControlEvent theEvent) {
ziviDome.controlEvent(theEvent);
}

// Implementation of Scene1 that uses the Scene interface
// Implementation of Scene that uses the Scene interface
class Scene1 implements Scene {
zividomelive parent;
PGraphics pg;
Expand All @@ -74,13 +74,11 @@ class Scene1 implements Scene {
birthTime = new ArrayList<Long>();
}

@Override
public void setupScene() {
noStroke();
fill(64, 255, 255, 192); // Set fill color for particles
}

@Override
public void sceneRender(PGraphics pg) {
pg.beginDraw();
pg.background(32);
Expand Down Expand Up @@ -150,12 +148,10 @@ class Scene1 implements Scene {
pg.endDraw();
}

@Override
public void keyPressed(char key) {
// Key response logic
}

@Override
public void mouseEvent(MouseEvent event) {
if (event.getAction() == MouseEvent.PRESS || event.getAction() == MouseEvent.DRAG) {
addNewParticle((event.getX())*0.1, (event.getY())*0.1);
Expand Down

0 comments on commit 66de9bc

Please sign in to comment.