mirror of
https://github.com/processing/processing4.git
synced 2026-06-09 09:03:17 +02:00
fixes to bagel and processing for multi-font size, setting g.applet, bugs in stream
This commit is contained in:
@@ -87,10 +87,10 @@ public class ProcessingApplet extends Applet
|
||||
}
|
||||
|
||||
|
||||
//public Dimension getPreferredSize() {
|
||||
//println("getting pref'd size");
|
||||
//return new Dimension(width, height);
|
||||
//}
|
||||
public Dimension getPreferredSize() {
|
||||
//println("getting pref'd size");
|
||||
return new Dimension(width, height);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------
|
||||
@@ -232,6 +232,11 @@ public class ProcessingApplet extends Applet
|
||||
g = new Bagel(width, height);
|
||||
pixels = g.pixels;
|
||||
|
||||
// set this here, and if not inside browser, getDocumentBase()
|
||||
// will fail with a NullPointerException, and cause applet to
|
||||
// be set to null. might be a better way to deal with that, but..
|
||||
g.applet = this;
|
||||
|
||||
// do all the defaults down here, because
|
||||
// subclasses need to go through this function
|
||||
g.lighting = false;
|
||||
@@ -696,6 +701,47 @@ public class ProcessingApplet extends Applet
|
||||
*/
|
||||
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
// run as application
|
||||
|
||||
|
||||
static public void main(String args[]) {
|
||||
if (args.length != 1) {
|
||||
System.err.println("error: ProcessingApplet <appletname>");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
Frame frame = new Frame();
|
||||
Class c = Class.forName(args[0]);
|
||||
ProcessingApplet applet = (ProcessingApplet) c.newInstance();
|
||||
applet.init();
|
||||
applet.start();
|
||||
|
||||
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
frame.add(applet);
|
||||
frame.pack();
|
||||
|
||||
frame.setLocation((screen.width - applet.g.width) / 2,
|
||||
(screen.height - applet.g.height) / 2);
|
||||
|
||||
frame.show();
|
||||
applet.requestFocus(); // get keydowns right away
|
||||
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
// public functions from bagel
|
||||
@@ -856,6 +902,11 @@ public class ProcessingApplet extends Applet
|
||||
}
|
||||
|
||||
|
||||
public void setFont(BagelFont which) {
|
||||
g.setFont(which);
|
||||
}
|
||||
|
||||
|
||||
public void setFont(BagelFont which, float size) {
|
||||
g.setFont(which, size);
|
||||
}
|
||||
@@ -1069,13 +1120,13 @@ public class ProcessingApplet extends Applet
|
||||
}
|
||||
|
||||
|
||||
public void smoothingOn() {
|
||||
g.smoothingOn();
|
||||
public void hint(int which) {
|
||||
g.hint(which);
|
||||
}
|
||||
|
||||
|
||||
public void smoothingOff() {
|
||||
g.smoothingOff();
|
||||
public void unhint(int which) {
|
||||
g.unhint(which);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+11
-1
@@ -18,6 +18,7 @@ Michael McGuffin <mjmcguff@dgp.toronto.edu>
|
||||
Anthony Okolie <anthony@anthonyone.com>
|
||||
Luis Miguel P. <luismi@standbyclick.com>
|
||||
Daniel Evan Schwartz <design@roomn8.com>
|
||||
Enrico Trujillo <etrujill@unm.edu>
|
||||
Jeff Williams <jeffw@pinchy.org>
|
||||
Ian Wojtowicz <ian@woj.com>
|
||||
andres <moscoca@bigpond.com>
|
||||
@@ -131,12 +132,21 @@ _ add hint for super smooth fonts
|
||||
_ add preferredsize to processingapplet
|
||||
X bug in Bagel.loadImage that made images not work in applets
|
||||
_ millis returns 0 (though getMillis() is fine)
|
||||
X catch exception inside polygon scanner (slower?)
|
||||
|
||||
_ rewrite fill/stroke/etc to use same code
|
||||
_ doesn't need to be super fast, so the extra assigns no big deal
|
||||
|
||||
_ WRITE CONVERTER FROM JAVA BAGEL -> CPP
|
||||
_ include #ifdefs for c stuff
|
||||
|
||||
_ try with 1.4 frame buffer stuff to see if it's faster
|
||||
_ will 1.4 work on osx?
|
||||
_ it's really a pain to use external files in processing
|
||||
_ getStream sucks (zach rewrote)
|
||||
_ should be able to work for application or applets
|
||||
_ may want to use getResource() (to get things from .jar files)
|
||||
|
||||
_ fix buzz.pl to not create ../../bagel
|
||||
_ need to clamp colors (nothing > 255 or < 0)
|
||||
_ try using serial events from javacomm instead of just reading straight
|
||||
_ paren problems comes from overusing parens (too many closing)
|
||||
|
||||
Reference in New Issue
Block a user