adding basics folder to the android dist

This commit is contained in:
benfry
2011-03-07 00:13:51 +00:00
parent 7dcad20514
commit 4f2985a30a
408 changed files with 16462 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
/**
* Sprite (Teddy)
* by James Patterson.
*
* Demonstrates loading and displaying a transparent GIF image.
*/
PImage teddy;
float xpos;
float ypos;
float drag = 30;
void setup() {
size(200, 200);
teddy = loadImage("teddy.gif");
xpos = width/2;
ypos = height/2;
}
void draw() {
background(102);
float difx = mouseX - xpos-teddy.width/2;
if (abs(difx) > 1) {
xpos = xpos + difx/drag;
xpos = constrain(xpos, 0, width-teddy.width);
}
float dify = mouseY - ypos-teddy.height/2;
if (abs(dify) > 1) {
ypos = ypos + dify/drag;
ypos = constrain(ypos, 0, height-teddy.height);
}
// Display the sprite at the position xpos, ypos
image(teddy, xpos, ypos);
}

View File

@@ -0,0 +1,61 @@
import processing.core.*;
import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
import java.util.regex.*;
public class Sprite extends PApplet {
/**
* Sprite (Teddy)
* by James Patterson.
*
* Demonstrates loading and displaying a transparent GIF image.
*/
PImage teddy;
float xpos;
float ypos;
float drag = 30.0f;
public void setup()
{
size(200,200);
teddy = loadImage("teddy.gif");
xpos = width/2;
ypos = height/2;
frameRate(60);
}
public void draw()
{
background(102);
float difx = mouseX - xpos-teddy.width/2;
if(abs(difx) > 1.0f) {
xpos = xpos + difx/drag;
xpos = constrain(xpos, 0, width-teddy.width);
}
float dify = mouseY - ypos-teddy.height/2;
if(abs(dify) > 1.0f) {
ypos = ypos + dify/drag;
ypos = constrain(ypos, 0, height-teddy.height);
}
// Display the sprite at the position xpos, ypos
image(teddy, xpos, ypos);
}
static public void main(String args[]) {
PApplet.main(new String[] { "Sprite" });
}
}

View File

@@ -0,0 +1,41 @@
/**
* Sprite (Teddy)
* by James Patterson.
*
* Demonstrates loading and displaying a transparent GIF image.
*/
PImage teddy;
float xpos;
float ypos;
float drag = 30.0;
void setup()
{
size(200,200);
teddy = loadImage("teddy.gif");
xpos = width/2;
ypos = height/2;
frameRate(60);
}
void draw()
{
background(102);
float difx = mouseX - xpos-teddy.width/2;
if(abs(difx) > 1.0) {
xpos = xpos + difx/drag;
xpos = constrain(xpos, 0, width-teddy.width);
}
float dify = mouseY - ypos-teddy.height/2;
if(abs(dify) > 1.0) {
ypos = ypos + dify/drag;
ypos = constrain(ypos, 0, height-teddy.height);
}
// Display the sprite at the position xpos, ypos
image(teddy, xpos, ypos);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B