Processing 3 + SublimeText 3 + HYPE - Duplicate method setup() in type build

edited November 2016 in Library Questions

I'm trying to get SublimeText3 setup using Processing3 and the HYPE library. I'm trying to run some sample code but keep getting an error.

When I build my sketch I keep getting this: build.pde:1:0:1:0: Duplicate method setup() in type build

Here's the code I'm trying to run...

import hype.*;

void setup() {
    size(640,640);
    H.init(this).background(#242424);

    HRect rect1 = new HRect(100);
    rect1.rounding(10);         // set corner rounding
    rect1.strokeWeight(6);      // set stroke weight
    rect1.stroke(#000000, 150); // set stroke color and alpha
    rect1.fill(#FF6600);        // set fill color
    rect1.anchorAt(H.CENTER);   // set where anchor point is / key point for rotation and positioning
    rect1.rotation(45);         // set rotation of the rect
    rect1.loc(100,height / 2);  // set x and y location
    H.add(rect1); 

    // here's the same code / with method chaining

    HRect rect2 = new HRect(100);
    rect2
        .rounding(10)
        .strokeWeight(6)
        .stroke(#000000, 150)
        .fill(#FF9900)
        .anchorAt(H.CENTER)
        .rotation(45)
        .loc(247,height / 2)
    ;
    H.add(rect2);

    // here's the same code / minus the hard returns and tabbing

    HRect rect3 = new HRect(100);
    rect3.rounding(10).strokeWeight(6).stroke(#000000, 150).fill(#FFCC00).anchorAt(H.CENTER).rotation(45).loc(394,height / 2);
    H.add(rect3);

    H.drawStage(); // paint the stage

    // here is the non HYPE version / basic processing syntax

    pushMatrix();
        strokeWeight(6);
        stroke(#000000, 150);
        fill(#FF3300);
        translate(width - 100, (height / 2));
        rotate( radians(45) );
        rect(0, 0, 100, 100, 10, 10, 10, 10);
    popMatrix();

    /*

    thoughts : well in the processing version you'd have to use push and pop
    matrix to perform the rotation and positioning. I find this difficult to explain
    to designers that you're not rotating the rect but the entire stage.

    not having the ability to adjust an "anchor" position means we have to calculate
    the rect's y coordinate to get it centered so trying to subract half of the rect's height

    translate(width - 100, (height / 2) - 50); // nope still doesn't center

    this is because a 100 x 100 rectangle rotated 45 degrees now sits at 141 x 141 (approx)
    this would mean we'd have to offset like so :

    translate(width - 100, (height / 2) - 70.5);

    */

    // draw where the horiz line is

    strokeWeight(1);
    stroke(#0095a8);
    line(0, height/2, width, height/2);

    noLoop();
}

void draw() {

}

Any help would be greatly appreciated!!! Thanks

Answers

  • edited November 2016

    This posted code isn't valid ".java" source code but ".pde"! :-@
    Only Processing's IDE (PDE) can deal w/ ".pde" files AFAIK.
    Is Sublime capable of transpiling ".pde" to ".java"? Got no idea! :-/

  • Yes, you can use .pde files within Sublime. Here's the package that I installed https://github.com/b-g/processing-sublime

  • edited November 2016

    Impressive! Regardless I can't help ya out, b/c I've never used Hype nor Sublime. :(
    Also it seems like library Hype isn't available as a 3rd-party library for the PDE either.

    I'm suspicious the project is kinda dead and it's stuck @ Processing 2; dunno: :-SS
    https://github.com/hype/HYPE_Processing/blob/master/CHANGELOG.md

  • Answer ✓

    I got it working! Just deleted everything and started from scratch. Not really sure why it's working now but it is.

  • GoToLoop far from dead even works in processing ide but you do have to compile source code:-

    hype

  • IIRC, someone committed changes more-or-less recently to "libify" HYPE (used to be pretty much web applet only), so building it by hand shouldn't be necessary any more. When I was messing around with it (a couple of years ago), I was able to do quite a lot with it in Python mode.

  • I don't know where you got the compiled library from but I have found I can use it pretty well in JRubyArt. It is not a library for beginners so compiling it should not be any hardship.

Sign In or Register to comment.