setting priorities for next versions, and removing PMethods

This commit is contained in:
benfry
2005-02-11 04:19:26 +00:00
parent 17ee12a4b7
commit 5fa7202eee
5 changed files with 106 additions and 468 deletions
+42 -16
View File
@@ -64,11 +64,30 @@ public class PApplet extends Applet
public int mouseX, mouseY;
//public int pmouseX, pmouseY;
// used to set pmouseX/Y to mouseX/Y the first time
// mouseX/Y are used, otherwise pmouseX/Y would always
// be zero making a big jump. yech.
//boolean firstMouseEvent;
public int pmouseX, pmouseY;
/**
* previous mouseX/Y for the draw loop, separated out because this is
* separate from the pmouseX/Y when inside the mouse event handlers.
*/
protected int dmouseX, dmouseY;
/**
* pmouseX/Y for the event handlers (mousePressed(), mouseDragged() etc)
* these are different because mouse events are queued to the end of
* draw, so the previous position has to be updated on each event,
* as opposed to the pmouseX/Y that's used inside draw, which is expected
* to be updated once per trip through draw().
*/
protected int emouseX, emouseY;
/**
* used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used,
* otherwise pmouseX/Y are always zero, causing a nasty jump. just using
* (frameCount == 0) won't work since mouseXxxxx() may not be called
* until a couple frames into things.
*/
boolean firstMouse;
public boolean mousePressed;
public MouseEvent mouseEvent;
@@ -206,7 +225,7 @@ public class PApplet extends Applet
//loopMethod = true;
looping = true;
redraw = true; // draw this guy once
//firstMouseEvent = true;
firstMouse = true;
/*
// call setup for changed params
@@ -777,9 +796,10 @@ public class PApplet extends Applet
} else {
preMethods.handle();
//for (int i = 0; i < libraryCount; i++) {
// if (libraryCalls[i][PLibrary.PRE]) libraries[i].pre();
//}
pmouseX = dmouseX;
pmouseY = dmouseY;
draw();
// these are called *after* loop so that valid
@@ -787,6 +807,10 @@ public class PApplet extends Applet
// be before, since a call to background() would wipe
// out anything that had been drawn so far.
dequeueMouseEvents();
// dmouseX/Y is updated only once per frame
dmouseX = mouseX;
dmouseY = mouseY;
dequeueKeyEvents();
if (THREAD_DEBUG) println(Thread.currentThread().getName() +
" 2b endFrame");
@@ -913,8 +937,8 @@ public class PApplet extends Applet
* overloaded to do something more useful.
*/
protected void handleMouseEvent(MouseEvent event) {
//pmouseX = mouseX;
//pmouseY = mouseY;
pmouseX = emouseX;
pmouseY = emouseY;
mouseX = event.getX();
mouseY = event.getY();
@@ -931,11 +955,11 @@ public class PApplet extends Applet
// this used to only be called on mouseMoved and mouseDragged
// change it back if people run into trouble
//if (firstMouseEvent) {
//pmouseX = mouseX;
//pmouseY = mouseY;
//firstMouseEvent = false;
//}
if (firstMouse) {
pmouseX = mouseX;
pmouseY = mouseY;
firstMouse = false;
}
switch (event.getID()) {
case MouseEvent.MOUSE_PRESSED:
@@ -956,6 +980,8 @@ public class PApplet extends Applet
mouseMoved();
break;
}
emouseX = mouseX;
emouseY = mouseY;
}
+1 -1
View File
@@ -68,7 +68,7 @@ import java.awt.image.*;
import java.io.*;
public class PGraphics extends PImage implements PMethods, PConstants {
public class PGraphics extends PImage implements PConstants {
/// width minus one (useful for many calculations)
public int width1;
-384
View File
@@ -1,384 +0,0 @@
package processing.core;
// this file is auto-generated. no touchy-touchy.
public interface PMethods {
public void modified();
public void alpha(int alpha[]);
public void alpha(PImage alpha);
public void filter(int kind);
public void filter(int kind, float param);
public int get(int x, int y);
public PImage get(int x, int y, int w, int h);
public void set(int x, int y, int c);
public void copy(PImage src, int dx, int dy);
public void copy(int sx1, int sy1, int sx2, int sy2,
int dx1, int dy1, int dx2, int dy2);
public void copy(PImage src, int sx1, int sy1, int sx2, int sy2,
int dx1, int dy1, int dx2, int dy2);
public void blend(PImage src, int sx, int sy, int dx, int dy, int mode);
public void blend(int sx, int sy, int dx, int dy, int mode);
public void blend(int sx1, int sy1, int sx2, int sy2,
int dx1, int dy1, int dx2, int dy2, int mode);
public void blend(PImage src, int sx1, int sy1, int sx2, int sy2,
int dx1, int dy1, int dx2, int dy2, int mode);
public PImage get();
public void save(String filename);
public void smooth();
public void noSmooth();
public void imageMode(int mode);
public void defaults();
public void beginFrame();
public void endFrame();
public void beginShape();
public void beginShape(int kind);
public void normal(float nx, float ny, float nz);
public void textureMode(int mode);
public void texture(PImage image);
public void vertex(float x, float y);
public void vertex(float x, float y, float u, float v);
public void vertex(float x, float y, float z);
public void vertex(float x, float y, float z,
float u, float v);
public void bezierVertex(float x, float y);
public void bezierVertex(float x, float y, float z);
public void curveVertex(float x, float y);
public void curveVertex(float x, float y, float z);
public void endShape();
public void render_lines();
public void point(float x, float y);
public void point(float x, float y, float z);
public void line(float x1, float y1, float x2, float y2);
public void line(float x1, float y1, float z1,
float x2, float y2, float z2);
public void triangle(float x1, float y1, float x2, float y2,
float x3, float y3);
public void rectMode(int mode);
public void rect(float x1, float y1, float x2, float y2);
public void quad(float x1, float y1, float x2, float y2,
float x3, float y3, float x4, float y4);
public void image(PImage image, float x1, float y1);
public void image(PImage image,
float x1, float y1, float x2, float y2);
public void image(PImage image,
float x1, float y1, float x2, float y2,
float u1, float v1, float u2, float v2);
public void cache(PImage image);
public void cache(PImage images[]);
public void arcMode(int mode);
public void arc(float start, float stop,
float x, float y, float radius);
public void arc(float start, float stop,
float x, float y, float hr, float vr);
public void ellipseMode(int mode);
public void ellipse(float x, float y, float hradius, float vradius);
public void circle(float x, float y, float radius);
public float bezierPoint(float a, float b, float c, float d,
float t);
public float bezierTangent(float a, float b, float c, float d,
float t);
public void bezier(float x1, float y1,
float x2, float y2,
float x3, float y3,
float x4, float y4);
public void bezier(float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3,
float x4, float y4, float z4);
public void bezierDetail(int detail);
public void curveDetail(int detail);
public void curveTightness(float tightness);
public float curvePoint(float a, float b, float c, float d,
float t);
public float curveTangent(float a, float b, float c, float d,
float t);
public void curve(float x1, float y1,
float x2, float y2,
float x3, float y3,
float x4, float y4);
public void curve(float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3,
float x4, float y4, float z4);
public void box(float size);
public void box(float w, float h, float d);
public void sphereDetail(int res);
public void sphere(float r);
public void sphere(float x, float y, float z, float r);
public void textFont(PFont which);
public void textSize(float size);
public void textFont(PFont which, float size);
public void textLeading(float leading);
public void textMode(int mode);
public void textSpace(int space);
public void text(char c, float x, float y);
public void text(char c, float x, float y, float z);
public void text(String s, float x, float y);
public void text(String s, float x, float y, float z);
public void text(String s, float x, float y, float w, float h);
public void text(String s, float x1, float y1, float z, float x2, float y2);
public void text(int num, float x, float y);
public void text(int num, float x, float y, float z);
public void text(float num, float x, float y);
public void text(float num, float x, float y, float z);
public void angleMode(int mode);
public void translate(float tx, float ty);
public void translate(float tx, float ty, float tz);
public void rotateX(float angle);
public void rotateY(float angle);
public void rotate(float angle);
public void rotateZ(float angle);
public void rotate(float angle, float v0, float v1, float v2);
public void scale(float s);
public void scale(float sx, float sy);
public void scale(float x, float y, float z);
public void transform(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33);
public void push();
public void pop();
public void resetMatrix();
public void applyMatrix(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33);
public void applyMatrix(float n00, float n01, float n02,
float n10, float n11, float n12);
public void printMatrix();
public void cameraMode(int mode);
public void beginCamera();
public void endCamera();
public void ortho(float left, float right,
float bottom, float top,
float near, float far);
public void perspective(float fovy, float aspect, float zNear, float zFar);
public void frustum(float left, float right, float bottom,
float top, float znear, float zfar);
public void lookat(float eyeX, float eyeY, float eyeZ,
float centerX, float centerY, float centerZ,
float upX, float upY, float upZ);
public void printCamera();
public float screenX(float x, float y);
public float screenY(float x, float y);
public float screenX(float x, float y, float z);
public float screenY(float x, float y, float z);
public float screenZ(float x, float y, float z);
public float objectX(float x, float y, float z);
public float objectY(float x, float y, float z);
public float objectZ(float x, float y, float z);
public void colorMode(int mode);
public void colorMode(int mode, float max);
public void colorMode(int mode,
float maxX, float maxY, float maxZ);
public void colorMode(int mode,
float maxX, float maxY, float maxZ, float maxA);
public void noTint();
public void tint(int rgb);
public void tint(float gray);
public void tint(float gray, float alpha);
public void tint(float x, float y, float z);
public void tint(float x, float y, float z, float a);
public void noFill();
public void fill(int rgb);
public void fill(float gray);
public void fill(float gray, float alpha);
public void fill(float x, float y, float z);
public void fill(float x, float y, float z, float a);
public void strokeWeight(float weight);
public void strokeJoin(int join);
public void strokeCap(int cap);
public void noStroke();
public void stroke(int rgb);
public void stroke(float gray);
public void stroke(float gray, float alpha);
public void stroke(float x, float y, float z);
public void stroke(float x, float y, float z, float a);
public void background(int rgb);
public void background(float gray);
public void background(float x, float y, float z);
public void background(PImage image);
public void clear();
public void depth();
public void noDepth();
public void lights();
public void noLights();
public void light(int num, float x, float y, float z,
float red, float green, float blue);
public void lightEnable(int num);
public void lightDisable(int num);
public void lightPosition(int num, float x, float y, float z);
public void lightAmbient(int num, float x, float y, float z);
public void lightDiffuse(int num, float x, float y, float z);
public void lightSpecular(int num, float x, float y, float z);
public void hint(int which);
public void unhint(int which);
}
+8 -9
View File
@@ -29,11 +29,10 @@ foreach $line (@applet) {
last if ($line =~ /$insert/);
}
open(INTF, ">PMethods.java") || die $!;
print INTF "package processing.core;\n\n\n\n";
#print INTF "import java.io.*;\n\n";
print INTF "// this file is auto-generated. no touchy-touchy.\n\n";
print INTF "public interface PMethods {\n";
#open(INTF, ">PMethods.java") || die $!;
#print INTF "package processing.core;\n\n\n\n";
#print INTF "// this file is auto-generated. no touchy-touchy.\n\n";
#print INTF "public interface PMethods {\n";
$comments = 0;
@@ -77,7 +76,7 @@ while ($line = shift(@contents)) {
if ($got_interface == 1) {
$iline = $line;
$iline =~ s/ \{/\;/;
print INTF "\n$iline";
# print INTF "\n$iline";
}
$decl .= $line;
@@ -90,7 +89,7 @@ while ($line = shift(@contents)) {
$iline = $line;
$iline =~ s/ \{/\;/;
#$iline =~ s/\) \{/\)\;/;
print INTF $iline;
# print INTF $iline;
}
}
@@ -123,10 +122,10 @@ while ($line = shift(@contents)) {
}
}
print OUT "}\n";
print INTF "}\n";
#print INTF "}\n";
close(OUT);
close(INTF);
#close(INTF);
$oldguy = join(' ', @applet);
+55 -58
View File
@@ -1,22 +1,30 @@
0077 core
X bring back pmouseX/Y using a tricky method of storing separate
X values for inside draw() versus inside the event handler versions
_ bring back pmouseX/Y using a tricky method of storing separate
_ values for inside draw() versus inside the event handler versions
_ be consistent about getXxx() methods
_ metaballs example dies when using box()
_ long string of exceptions, which are also missing their newlines
_ basic sample audio playback needed for p5
_ make separate java 1.1 and java 1.3 classes
_ when running externally, applets don't always get placed properly
_ if size is never set, then doesn't always layout
_ problem is in gl and in core, and is inconsistent
_ move more logic for layout into PApplet.. maybe a static method?
_ this way can avoid duplicating / breaking things
_ on start, mouseX is 0.. how to avoid?
_ use firstMouse variable.. figure out naming
_ depth() shouldn't be needed for opengl unless actually 3D
_ right now the camera doesn't get set up unless you call depth()
_ image loading bug is huge
_ don't show applet frame until first frame
_ but don't do it if it's a subclass, ie opengl..
_ arc with stroke only draws the arc shape itself
_ may need a 'wedge' function to draw a stroke around the whole thing
_ explicitly state depth()/nodepth()
_ don't allocate zbuffer & stencil until depth() is called
_ add gzipInput and gzipOutput
_ image(String name) and textFont(String name)
_ do we change to font(arial, 12) ?
_ loadImage() is broken on some machines
_ hacked for a fix in 72, but need to better coordinate with openStream()
_ 404 error because first searches applet directory on zipdecode
_ how to handle full screen (opengl especially) or no screen (for scripts)
_ implement fullsize().. this takes over the screen as best it can
@@ -25,12 +33,23 @@ _ that if applet is 500x500, centers on a 800x600 window
_ though how do you get the screen size?
_ screen.width and screen.height?
_ resolve ARGB versus RGBA versus just A issues for fonts
_ make sure that current scenario works identically on mac
_ if so, just switch the image code to expect alpha in the high bits
_ fonts probably need to be RGBA, not ALPHA style images
_ there's nothing really ALPHA about them?
_ when running externally, applets don't always get placed properly
_ if size is never set, then doesn't always layout
_ problem is in gl and in core, and is inconsistent
_ move more logic for layout into PApplet.. maybe a static method?
_ this way can avoid duplicating / breaking things
_ when using core graphics, don't show applet frame until first frame
_ (in opengl, open frame early, make sure this isn't inhibited)
_ light(x, y, z, c1, c2, c3, TYPE)
_ also BLight with same constructor, and on() and off() fxn
//
0078
opengl
_ fix non-bound textures from mangling everything else
_ fix enable/disable textures for some objects
_ fix endian ordering issues so that things work properly
@@ -39,31 +58,24 @@ _ minimum texture size may be 64x64
_ might need to enforce it as a minimum
_ what should the update image function be called?
_ box and sphere are broken in gl
_ metaballs example dies when using box()
_ long string of exceptions, which are also missing their newlines
_ get loop, noLoop, redraw, and framerate all working in opengl
_ needs custom animator thread..
_ basic sample audio playback needed for p5
_ make separate java 1.1 and java 1.3 classes
_ be consistent about getXxx() methods
_ depth() shouldn't be needed for opengl unless actually 3D
_ right now the camera doesn't get set up unless you call depth()
_ resolve ARGB versus RGBA versus just A issues for fonts
_ make sure that current scenario works identically on mac
_ if so, just switch the image code to expect alpha in the high bits
_ fonts probably need to be RGBA, not ALPHA style images
_ there's nothing really ALPHA about them?
//
0076
_ image loading bug is huge
_ add gzipInput and gzipOutput
_ should image i/o and sound i/o be moved into PImage and PSound?
_ how to load external encoders/decoders
_ image(String name) and textFont(String name)
_ do we change to font(arial, 12) ?
scripting
_ document the use of "die"
_ can override the method to do your own handling
@@ -102,9 +114,6 @@ _ if just rotate/translate, then can use SCREEN_SPACE for fonts
_ bring screen space and font size settings back in to PGraphics
_ causing too much trouble to be stuck down in PFont
_ explicitly state depth()/nodepth()
_ don't allocate zbuffer & stencil until depth() is called
_ massive graphics engine changes
_ move to new graphics engine
_ test with rgb cube, shut off smoothing
@@ -130,9 +139,6 @@ _ open with photoshop, resave, see which tags change
_ particularly of those that are included in the original image
_ perhaps something gets corrected?
_ arc with stroke only draws the arc shape itself
_ may need a 'wedge' function to draw a stroke around the whole thing
_ need timer in as part of the api
_ or at least include an example that uses it
@@ -154,10 +160,6 @@ _ this will require changes to PTriangle and PLine inside their loops
_ break apart functions into local (placement) and override (blitting)
_ just have a "thin_flat_line" option in opengl code
_ image("blah.jpg");
_ loadImage() is broken on some machines
_ hacked for a fix in 72, but need to better coordinate with openStream()
_ renderers can plug in:
_ at direct api level
_ taking over all color() functions and vertex collection
@@ -218,18 +220,16 @@ _ addcolor("blah blah blah", colornum);
_ fill("blah blah blah");
_ maybe this is bad practice--too slow, should use variables
_ 404 error because first searches applet directory on zipdecode
_ write PApplet2, a full screen version of PApplet
_ write java 1.3 code for full screen version of PApplet
_ this might be used for presentation mode
_ api for file-based renderers
_ need to work this out since it will affect other api changes
_ size(0, 0) and then ai.size(10000, 20000)
_ size 0 is code for internal to not show any window
_ saveFrame(PRenderer) or saveFrame("name", PRenderer)
_ saveFrame gets called at the beginning of loop()
_ or is just a message to save the next frame (problem for anim)
o api for file-based renderers
o need to work this out since it will affect other api changes
o size(0, 0) and then ai.size(10000, 20000)
o size 0 is code for internal to not show any window
o saveFrame(PRenderer) or saveFrame("name", PRenderer)
o saveFrame gets called at the beginning of loop()
o or is just a message to save the next frame (problem for anim)
_ illustrator export / rendering mode
_ also postscript or pdf export?
_ update illustrator code to use core api
@@ -237,7 +237,7 @@ _ even if not actually working properly.. just in naming of things
_ sorting of polygons/lines on simple painters algorithm
_ better lighting model to show darkness at various depths
_ maybe just ultra-high res bitmaps from gl
_ version of BApplet that replaces g. with ai. or pdf.
o version of BApplet that replaces g. with ai. or pdf.
_ figure out how to handle cached images, multiple images
_ MediaTracker blocking is prolly making jar download really slow
@@ -247,9 +247,6 @@ _ mkoser wish list
_ filled polygons working with smooth()
_ z-clipping
_ light(x, y, z, c1, c2, c3, TYPE)
_ also BLight with same constructor, and on() and off() fxn
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////