org.jbox2d.testbed.tests
Class SpriteBinding

java.lang.Object
  extended by org.jbox2d.testbed.AbstractExample
      extended by org.jbox2d.testbed.tests.SpriteBinding

public class SpriteBinding
extends AbstractExample

This example demonstrates how to bind a sprite to an image using Processing. See ProcessingDebugDraw.drawImage() and AbstractExample.bindImage() for more details on this - these should translate fairly easily to most OpenGL-style rendering methods.

Assumes a .png file named "noise.png" has been added to the build path


Field Summary
 Body body
           
 Vec2[] localCoords
           
 processing.core.PImage myImage
           
 Vec2[] texCoords
           
 
Fields inherited from class org.jbox2d.testbed.AbstractExample
black, blue, bombSpawning, bombSpawnPoint, boundImages, cachedCamScale, cachedCamX, cachedCamY, gray, green, hasCachedCamera, instructionString, keyDown, m_bomb, m_boundaryListener, m_contactListener, m_debugDraw, m_destructionListener, m_mouseJoint, m_pointCount, m_points, m_textLine, m_world, m_worldAABB, memFree, mouseScreen, mouseWorld, needsReset, newKeyDown, parent, pmousePressed, pmouseScreen, red, settings, textLineHeight, white
 
Constructor Summary
SpriteBinding(TestbedMain _parent)
           
 
Method Summary
 void create()
          Create the world geometry for each test.
 java.lang.String getName()
           
 
Methods inherited from class org.jbox2d.testbed.AbstractExample
bindImage, boundaryViolated, completeBombSpawn, createWorld, getExampleInstructions, initialize, jointDestroyed, keyPressed, keyReleased, launchBomb, launchBomb, mouseDown, mouseMove, mouseUp, postStep, preStep, printInstructions, setCamera, spawnBomb, step
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localCoords

public Vec2[] localCoords

texCoords

public Vec2[] texCoords

myImage

public processing.core.PImage myImage

body

public Body body
Constructor Detail

SpriteBinding

public SpriteBinding(TestbedMain _parent)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class AbstractExample
Returns:
Title of example.

create

public void create()
Description copied from class: AbstractExample
Create the world geometry for each test. Any custom initialization for a test should go here. Called immediately after initialize(), which handles generic test initialization and should usually not be overloaded.

Specified by:
create in class AbstractExample