Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static class Avatar {
- // If the texture is to be a permanent part
- // of the avatar, instead of supplying the texture
- // to the draw function, a PImage field could be
- // added at the top of the Avatar class and set
- // in the constructor.
- Avatar draw(PGraphics2D rndr, PImage texture) {
- rndr.pushStyle();
- rndr.noStroke();
- rndr.pushMatrix();
- rndr.translate(x, y);
- rndr.rotate(rot);
- rndr.scale(size);
- rndr.beginShape(QUADS);
- rndr.texture(texture);
- rndr.vertex(-0.5, 0.5, 0.0, 0.0);
- rndr.vertex(0.5, 0.5, 1.0, 0.0);
- rndr.vertex(0.5, -0.5, 1.0, 1.0);
- rndr.vertex(-0.5, -0.5, 0.0, 1.0);
- rndr.endShape(CLOSE);
- rndr.popMatrix();
- rndr.popStyle();
- return this;
- }
- }
Add Comment
Please, Sign In to add comment