From 426e9a62eb622dbc16568df40b3fe7d14ae22d69 Mon Sep 17 00:00:00 2001 From: Daniel Shiffman Date: Mon, 11 Mar 2013 00:09:05 -0400 Subject: [PATCH] removing old XML objects example, new one will replace --- .../LoadingXMLObjects/Bubble.pde | 29 --------- .../LoadingXMLObjects/LoadingXMLObjects.pde | 62 ------------------- .../LoadingXMLObjects/data/bubbles.xml | 1 - 3 files changed, 92 deletions(-) delete mode 100644 java/examples/Topics/Advanced Data/LoadingXMLObjects/Bubble.pde delete mode 100644 java/examples/Topics/Advanced Data/LoadingXMLObjects/LoadingXMLObjects.pde delete mode 100644 java/examples/Topics/Advanced Data/LoadingXMLObjects/data/bubbles.xml diff --git a/java/examples/Topics/Advanced Data/LoadingXMLObjects/Bubble.pde b/java/examples/Topics/Advanced Data/LoadingXMLObjects/Bubble.pde deleted file mode 100644 index e99f2a93d..000000000 --- a/java/examples/Topics/Advanced Data/LoadingXMLObjects/Bubble.pde +++ /dev/null @@ -1,29 +0,0 @@ -// A Bubble class -class Bubble { - - float x,y; - float diameter; - color c; - - Bubble(float r,float g, float b, float d) { - x = width/2; - y = height/2; - c = color(r, g, b, 204); - diameter = d; - } - - // Display Bubble - void display() { - noStroke(); - fill(c); - ellipse(x, y, diameter, diameter); - } - - // Bubble drifts upwards - void drift() { - x += random(-1, 1); - y += random(-1, 1); - x = constrain(x, 0, width); - y = constrain(y, 0, height); - } -} diff --git a/java/examples/Topics/Advanced Data/LoadingXMLObjects/LoadingXMLObjects.pde b/java/examples/Topics/Advanced Data/LoadingXMLObjects/LoadingXMLObjects.pde deleted file mode 100644 index d3fb2ef85..000000000 --- a/java/examples/Topics/Advanced Data/LoadingXMLObjects/LoadingXMLObjects.pde +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Loading XML Data - * by Daniel Shiffman. - * - * This example demonstrates how to use loadXML() - * to retrieve data from an XML document and make - * objects from that data - * - * Here is what the XML looks like: - * - * - - 40 - - - - */ - -// An array of Bubble objects -Bubble[] bubbles; - -void setup() { - size(640, 360); - - // Load an XML document - XML xml = loadXML("bubbles.xml"); - - // Get all the child elements - XML[] children = xml.getChildren("bubble"); - - // Make an array of objects the same size - bubbles = new Bubble[children.length]; - - for (int i = 0; i < children.length; i++ ) { - - // The diameter is the content of the child named "Diamater" - XML diameterElement = children[i].getChild("diameter"); - int diameter = int(diameterElement.getContent()); - - // The color element has three attributes - XML colorElement = children[i].getChild("color"); - // An int for r g and b - int r = colorElement.getInt("red"); - int g = colorElement.getInt("green"); - int b = colorElement.getInt("blue"); - - // Make a new Bubble object with values from XML document - bubbles[i] = new Bubble(r, g, b, diameter); - } -} - - -void draw() { - background(255); - - // Display and move all bubbles - for (int i = 0; i < bubbles.length; i++ ) { - bubbles[i].display(); - bubbles[i].drift(); - } -} - diff --git a/java/examples/Topics/Advanced Data/LoadingXMLObjects/data/bubbles.xml b/java/examples/Topics/Advanced Data/LoadingXMLObjects/data/bubbles.xml deleted file mode 100644 index fc79fb9a7..000000000 --- a/java/examples/Topics/Advanced Data/LoadingXMLObjects/data/bubbles.xml +++ /dev/null @@ -1 +0,0 @@ - 40 20 80 \ No newline at end of file